Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
0b9cad3a
Commit
0b9cad3a
authored
Oct 08, 2003
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/codec/theora.c, modules/stream_out/transcode.c: theora encoding fixes.
parent
a80030a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
25 deletions
+34
-25
modules/codec/theora.c
modules/codec/theora.c
+6
-7
modules/stream_out/transcode.c
modules/stream_out/transcode.c
+28
-18
No files found.
modules/codec/theora.c
View file @
0b9cad3a
...
...
@@ -2,7 +2,7 @@
* theora.c: theora decoder module making use of libtheora.
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: theora.c,v 1.
9 2003/10/08 21:01:07
gbazin Exp $
* $Id: theora.c,v 1.
10 2003/10/08 23:00:40
gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
...
...
@@ -616,6 +616,7 @@ static int OpenEncoder( vlc_object_t *p_this )
theora_encode_init
(
&
p_sys
->
td
,
&
p_sys
->
ti
);
theora_info_clear
(
&
p_sys
->
ti
);
theora_comment_init
(
&
p_sys
->
tc
);
p_sys
->
i_headers
=
0
;
...
...
@@ -640,13 +641,13 @@ static block_t *Headers( encoder_t *p_enc )
theora_encode_header
(
&
p_sys
->
td
,
&
oggpacket
);
break
;
case
1
:
theora_comment_init
(
&
p_sys
->
tc
);
theora_encode_comment
(
&
p_sys
->
tc
,
&
oggpacket
);
break
;
case
2
:
theora_encode_tables
(
&
p_sys
->
td
,
&
oggpacket
);
break
;
default:
break
;
}
p_sys
->
i_headers
++
;
...
...
@@ -672,7 +673,6 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
ogg_packet
oggpacket
;
block_t
*
p_block
;
yuv_buffer
yuv
;
int
i_ret
;
/* Theora is a one-frame-in, one-frame-out system. Submit a frame
* for compression and pull out the packet. */
...
...
@@ -695,9 +695,8 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
/* Ogg packet to block */
p_block
=
block_New
(
p_enc
,
oggpacket
.
bytes
);
p_block
->
p_buffer
=
oggpacket
.
packet
;
p_block
->
i_buffer
=
oggpacket
.
bytes
;
p_block
->
i_dts
=
oggpacket
.
granulepos
;
memcpy
(
p_block
->
p_buffer
,
oggpacket
.
packet
,
oggpacket
.
bytes
);
p_block
->
i_dts
=
p_pict
->
date
;
//oggpacket.granulepos;
return
p_block
;
}
...
...
@@ -711,7 +710,7 @@ static void CloseEncoder( vlc_object_t *p_this )
encoder_sys_t
*
p_sys
=
p_enc
->
p_sys
;
theora_info_clear
(
&
p_sys
->
ti
);
theora_comment_clear
(
&
p_sys
->
tc
);
//
theora_comment_clear( &p_sys->tc );
free
(
p_sys
);
}
modules/stream_out/transcode.c
View file @
0b9cad3a
...
...
@@ -2,7 +2,7 @@
* transcode.c
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: transcode.c,v 1.3
5 2003/10/08 21:01:07
gbazin Exp $
* $Id: transcode.c,v 1.3
6 2003/10/08 23:00:40
gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -318,6 +318,7 @@ struct sout_stream_id_t
vlc_fourcc_t
b_transcode
;
sout_format_t
f_src
;
/* only if transcoding */
sout_format_t
f_dst
;
/* " " " */
unsigned
int
i_inter_pixfmt
;
/* intermediary format when transcoding */
/* id of the out stream */
void
*
id
;
...
...
@@ -1498,6 +1499,9 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
sout_BufferChain
(
out
,
p_out
);
}
id
->
i_inter_pixfmt
=
get_ff_chroma
(
id
->
p_encoder
->
format
.
video
.
i_chroma
);
id
->
b_enc_inited
=
VLC_TRUE
;
}
else
if
(
!
id
->
b_enc_inited
)
...
...
@@ -1537,6 +1541,9 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
id
->
b_transcode
=
VLC_FALSE
;
return
VLC_EGENERIC
;
}
id
->
i_inter_pixfmt
=
id
->
ff_enc_c
->
pix_fmt
;
id
->
b_enc_inited
=
VLC_TRUE
;
}
...
...
@@ -1555,7 +1562,7 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
buf
=
malloc
(
i_size
);
avpicture_fill
(
(
AVPicture
*
)
id
->
p_ff_pic_tmp0
,
buf
,
id
->
ff_enc_c
->
pix_
fmt
,
id
->
i_inter_pix
fmt
,
id
->
ff_dec_c
->
width
,
id
->
ff_dec_c
->
height
);
}
...
...
@@ -1567,26 +1574,26 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
}
/* convert pix format */
if
(
!
id
->
p_encoder
)
if
(
id
->
ff_dec_c
->
pix_fmt
!=
id
->
ff_enc_c
->
pix_fmt
)
if
(
id
->
ff_dec_c
->
pix_fmt
!=
id
->
i_inter_pixfmt
)
{
if
(
id
->
p_ff_pic_tmp1
==
NULL
)
{
int
i_size
;
uint8_t
*
buf
;
id
->
p_ff_pic_tmp1
=
avcodec_alloc_frame
();
i_size
=
avpicture_get_size
(
id
->
ff_enc_c
->
pix_fmt
,
id
->
ff_dec_c
->
width
,
id
->
ff_dec_c
->
height
);
i_size
=
avpicture_get_size
(
id
->
i_inter_pixfmt
,
id
->
ff_dec_c
->
width
,
id
->
ff_dec_c
->
height
);
buf
=
malloc
(
i_size
);
avpicture_fill
(
(
AVPicture
*
)
id
->
p_ff_pic_tmp1
,
buf
,
id
->
ff_enc_c
->
pix_
fmt
,
id
->
i_inter_pix
fmt
,
id
->
ff_dec_c
->
width
,
id
->
ff_dec_c
->
height
);
}
img_convert
(
(
AVPicture
*
)
id
->
p_ff_pic_tmp1
,
id
->
ff_enc_c
->
pix_
fmt
,
(
AVPicture
*
)
frame
,
id
->
ff_dec_c
->
pix_fmt
,
img_convert
(
(
AVPicture
*
)
id
->
p_ff_pic_tmp1
,
id
->
i_inter_pix
fmt
,
(
AVPicture
*
)
frame
,
id
->
ff_dec_c
->
pix_fmt
,
id
->
ff_dec_c
->
width
,
id
->
ff_dec_c
->
height
);
frame
=
id
->
p_ff_pic_tmp1
;
...
...
@@ -1594,8 +1601,8 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
/* convert size and crop */
if
(
!
id
->
p_encoder
)
if
(
id
->
ff_dec_c
->
width
!=
id
->
f
f_enc_c
->
width
||
id
->
ff_dec_c
->
height
!=
id
->
f
f_enc_c
->
height
||
if
(
id
->
ff_dec_c
->
width
!=
id
->
f
_dst
.
i_
width
||
id
->
ff_dec_c
->
height
!=
id
->
f
_dst
.
i_
height
||
p_sys
->
i_crop_top
>
0
||
p_sys
->
i_crop_bottom
>
0
||
p_sys
->
i_crop_left
>
0
||
p_sys
->
i_crop_right
)
{
...
...
@@ -1604,17 +1611,19 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
int
i_size
;
uint8_t
*
buf
;
id
->
p_ff_pic_tmp2
=
avcodec_alloc_frame
();
i_size
=
avpicture_get_size
(
id
->
ff_enc_c
->
pix_fmt
,
id
->
ff_enc_c
->
width
,
id
->
ff_enc_c
->
height
);
i_size
=
avpicture_get_size
(
id
->
i_inter_pixfmt
,
id
->
f_dst
.
i_width
,
id
->
f_dst
.
i_height
);
buf
=
malloc
(
i_size
);
avpicture_fill
(
(
AVPicture
*
)
id
->
p_ff_pic_tmp2
,
buf
,
id
->
ff_enc_c
->
pix_
fmt
,
id
->
f
f_enc_c
->
width
,
id
->
ff_enc_c
->
height
);
id
->
i_inter_pix
fmt
,
id
->
f
_dst
.
i_width
,
id
->
f_dst
.
i_
height
);
id
->
p_vresample
=
img_resample_full_init
(
id
->
ff_enc_c
->
width
,
id
->
ff_enc_c
->
height
,
img_resample_full_init
(
id
->
f_dst
.
i_width
,
id
->
f_dst
.
i_height
,
id
->
ff_dec_c
->
width
,
id
->
ff_dec_c
->
height
,
p_stream
->
p_sys
->
i_crop_top
,
p_stream
->
p_sys
->
i_crop_bottom
,
...
...
@@ -1650,8 +1659,8 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
int
i_plane
;
vout_InitPicture
(
VLC_OBJECT
(
p_stream
),
&
pic
,
id
->
f
f_dec_c
->
width
,
id
->
ff_dec_c
->
height
,
VLC_FOURCC
(
'I'
,
'4'
,
'2'
,
'0'
)
);
id
->
f
_dst
.
i_width
,
id
->
f_dst
.
i_
height
,
id
->
p_encoder
->
format
.
video
.
i_chroma
);
for
(
i_plane
=
0
;
i_plane
<
pic
.
i_planes
;
i_plane
++
)
{
...
...
@@ -1668,6 +1677,7 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
p_out
=
sout_BufferNew
(
p_stream
->
p_sout
,
p_block
->
i_buffer
);
memcpy
(
p_out
->
p_buffer
,
p_block
->
p_buffer
,
p_block
->
i_buffer
);
sout_BufferChain
(
out
,
p_out
);
block_Release
(
p_block
);
}
return
VLC_SUCCESS
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment