Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
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
Show 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 @@
...
@@ -2,7 +2,7 @@
* theora.c: theora decoder module making use of libtheora.
* theora.c: theora decoder module making use of libtheora.
*****************************************************************************
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* 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>
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
*
...
@@ -616,6 +616,7 @@ static int OpenEncoder( vlc_object_t *p_this )
...
@@ -616,6 +616,7 @@ static int OpenEncoder( vlc_object_t *p_this )
theora_encode_init
(
&
p_sys
->
td
,
&
p_sys
->
ti
);
theora_encode_init
(
&
p_sys
->
td
,
&
p_sys
->
ti
);
theora_info_clear
(
&
p_sys
->
ti
);
theora_info_clear
(
&
p_sys
->
ti
);
theora_comment_init
(
&
p_sys
->
tc
);
p_sys
->
i_headers
=
0
;
p_sys
->
i_headers
=
0
;
...
@@ -640,13 +641,13 @@ static block_t *Headers( encoder_t *p_enc )
...
@@ -640,13 +641,13 @@ static block_t *Headers( encoder_t *p_enc )
theora_encode_header
(
&
p_sys
->
td
,
&
oggpacket
);
theora_encode_header
(
&
p_sys
->
td
,
&
oggpacket
);
break
;
break
;
case
1
:
case
1
:
theora_comment_init
(
&
p_sys
->
tc
);
theora_encode_comment
(
&
p_sys
->
tc
,
&
oggpacket
);
theora_encode_comment
(
&
p_sys
->
tc
,
&
oggpacket
);
break
;
break
;
case
2
:
case
2
:
theora_encode_tables
(
&
p_sys
->
td
,
&
oggpacket
);
theora_encode_tables
(
&
p_sys
->
td
,
&
oggpacket
);
break
;
break
;
default:
default:
break
;
}
}
p_sys
->
i_headers
++
;
p_sys
->
i_headers
++
;
...
@@ -672,7 +673,6 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
...
@@ -672,7 +673,6 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
ogg_packet
oggpacket
;
ogg_packet
oggpacket
;
block_t
*
p_block
;
block_t
*
p_block
;
yuv_buffer
yuv
;
yuv_buffer
yuv
;
int
i_ret
;
/* Theora is a one-frame-in, one-frame-out system. Submit a frame
/* Theora is a one-frame-in, one-frame-out system. Submit a frame
* for compression and pull out the packet. */
* for compression and pull out the packet. */
...
@@ -695,9 +695,8 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
...
@@ -695,9 +695,8 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
/* Ogg packet to block */
/* Ogg packet to block */
p_block
=
block_New
(
p_enc
,
oggpacket
.
bytes
);
p_block
=
block_New
(
p_enc
,
oggpacket
.
bytes
);
p_block
->
p_buffer
=
oggpacket
.
packet
;
memcpy
(
p_block
->
p_buffer
,
oggpacket
.
packet
,
oggpacket
.
bytes
);
p_block
->
i_buffer
=
oggpacket
.
bytes
;
p_block
->
i_dts
=
p_pict
->
date
;
//oggpacket.granulepos;
p_block
->
i_dts
=
oggpacket
.
granulepos
;
return
p_block
;
return
p_block
;
}
}
...
@@ -711,7 +710,7 @@ static void CloseEncoder( vlc_object_t *p_this )
...
@@ -711,7 +710,7 @@ static void CloseEncoder( vlc_object_t *p_this )
encoder_sys_t
*
p_sys
=
p_enc
->
p_sys
;
encoder_sys_t
*
p_sys
=
p_enc
->
p_sys
;
theora_info_clear
(
&
p_sys
->
ti
);
theora_info_clear
(
&
p_sys
->
ti
);
theora_comment_clear
(
&
p_sys
->
tc
);
//
theora_comment_clear( &p_sys->tc );
free
(
p_sys
);
free
(
p_sys
);
}
}
modules/stream_out/transcode.c
View file @
0b9cad3a
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* transcode.c
* transcode.c
*****************************************************************************
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* 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>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
*
...
@@ -318,6 +318,7 @@ struct sout_stream_id_t
...
@@ -318,6 +318,7 @@ struct sout_stream_id_t
vlc_fourcc_t
b_transcode
;
vlc_fourcc_t
b_transcode
;
sout_format_t
f_src
;
/* only if transcoding */
sout_format_t
f_src
;
/* only if transcoding */
sout_format_t
f_dst
;
/* " " " */
sout_format_t
f_dst
;
/* " " " */
unsigned
int
i_inter_pixfmt
;
/* intermediary format when transcoding */
/* id of the out stream */
/* id of the out stream */
void
*
id
;
void
*
id
;
...
@@ -1498,6 +1499,9 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
...
@@ -1498,6 +1499,9 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
sout_BufferChain
(
out
,
p_out
);
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
;
id
->
b_enc_inited
=
VLC_TRUE
;
}
}
else
if
(
!
id
->
b_enc_inited
)
else
if
(
!
id
->
b_enc_inited
)
...
@@ -1537,6 +1541,9 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
...
@@ -1537,6 +1541,9 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
id
->
b_transcode
=
VLC_FALSE
;
id
->
b_transcode
=
VLC_FALSE
;
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
id
->
i_inter_pixfmt
=
id
->
ff_enc_c
->
pix_fmt
;
id
->
b_enc_inited
=
VLC_TRUE
;
id
->
b_enc_inited
=
VLC_TRUE
;
}
}
...
@@ -1555,7 +1562,7 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
...
@@ -1555,7 +1562,7 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
buf
=
malloc
(
i_size
);
buf
=
malloc
(
i_size
);
avpicture_fill
(
(
AVPicture
*
)
id
->
p_ff_pic_tmp0
,
buf
,
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
);
id
->
ff_dec_c
->
width
,
id
->
ff_dec_c
->
height
);
}
}
...
@@ -1567,25 +1574,25 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
...
@@ -1567,25 +1574,25 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
}
}
/* convert pix format */
/* convert pix format */
if
(
!
id
->
p_encoder
)
if
(
id
->
ff_dec_c
->
pix_fmt
!=
id
->
i_inter_pixfmt
)
if
(
id
->
ff_dec_c
->
pix_fmt
!=
id
->
ff_enc_c
->
pix_fmt
)
{
{
if
(
id
->
p_ff_pic_tmp1
==
NULL
)
if
(
id
->
p_ff_pic_tmp1
==
NULL
)
{
{
int
i_size
;
int
i_size
;
uint8_t
*
buf
;
uint8_t
*
buf
;
id
->
p_ff_pic_tmp1
=
avcodec_alloc_frame
();
id
->
p_ff_pic_tmp1
=
avcodec_alloc_frame
();
i_size
=
avpicture_get_size
(
id
->
ff_enc_c
->
pix_fmt
,
i_size
=
avpicture_get_size
(
id
->
i_inter_pixfmt
,
id
->
ff_dec_c
->
width
,
id
->
ff_dec_c
->
height
);
id
->
ff_dec_c
->
width
,
id
->
ff_dec_c
->
height
);
buf
=
malloc
(
i_size
);
buf
=
malloc
(
i_size
);
avpicture_fill
(
(
AVPicture
*
)
id
->
p_ff_pic_tmp1
,
buf
,
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
);
id
->
ff_dec_c
->
width
,
id
->
ff_dec_c
->
height
);
}
}
img_convert
(
(
AVPicture
*
)
id
->
p_ff_pic_tmp1
,
id
->
ff_enc_c
->
pix_
fmt
,
img_convert
(
(
AVPicture
*
)
id
->
p_ff_pic_tmp1
,
id
->
i_inter_pix
fmt
,
(
AVPicture
*
)
frame
,
id
->
ff_dec_c
->
pix_fmt
,
(
AVPicture
*
)
frame
,
id
->
ff_dec_c
->
pix_fmt
,
id
->
ff_dec_c
->
width
,
id
->
ff_dec_c
->
height
);
id
->
ff_dec_c
->
width
,
id
->
ff_dec_c
->
height
);
...
@@ -1594,8 +1601,8 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
...
@@ -1594,8 +1601,8 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
/* convert size and crop */
/* convert size and crop */
if
(
!
id
->
p_encoder
)
if
(
!
id
->
p_encoder
)
if
(
id
->
ff_dec_c
->
width
!=
id
->
f
f_enc_c
->
width
||
if
(
id
->
ff_dec_c
->
width
!=
id
->
f
_dst
.
i_
width
||
id
->
ff_dec_c
->
height
!=
id
->
f
f_enc_c
->
height
||
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_top
>
0
||
p_sys
->
i_crop_bottom
>
0
||
p_sys
->
i_crop_left
>
0
||
p_sys
->
i_crop_right
)
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,
...
@@ -1604,17 +1611,19 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
int
i_size
;
int
i_size
;
uint8_t
*
buf
;
uint8_t
*
buf
;
id
->
p_ff_pic_tmp2
=
avcodec_alloc_frame
();
id
->
p_ff_pic_tmp2
=
avcodec_alloc_frame
();
i_size
=
avpicture_get_size
(
id
->
ff_enc_c
->
pix_fmt
,
i_size
=
avpicture_get_size
(
id
->
i_inter_pixfmt
,
id
->
ff_enc_c
->
width
,
id
->
ff_enc_c
->
height
);
id
->
f_dst
.
i_width
,
id
->
f_dst
.
i_height
);
buf
=
malloc
(
i_size
);
buf
=
malloc
(
i_size
);
avpicture_fill
(
(
AVPicture
*
)
id
->
p_ff_pic_tmp2
,
buf
,
avpicture_fill
(
(
AVPicture
*
)
id
->
p_ff_pic_tmp2
,
buf
,
id
->
ff_enc_c
->
pix_
fmt
,
id
->
i_inter_pix
fmt
,
id
->
f
f_enc_c
->
width
,
id
->
ff_enc_c
->
height
);
id
->
f
_dst
.
i_width
,
id
->
f_dst
.
i_
height
);
id
->
p_vresample
=
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
,
id
->
ff_dec_c
->
width
,
id
->
ff_dec_c
->
height
,
p_stream
->
p_sys
->
i_crop_top
,
p_stream
->
p_sys
->
i_crop_top
,
p_stream
->
p_sys
->
i_crop_bottom
,
p_stream
->
p_sys
->
i_crop_bottom
,
...
@@ -1650,8 +1659,8 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
...
@@ -1650,8 +1659,8 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
int
i_plane
;
int
i_plane
;
vout_InitPicture
(
VLC_OBJECT
(
p_stream
),
&
pic
,
vout_InitPicture
(
VLC_OBJECT
(
p_stream
),
&
pic
,
id
->
f
f_dec_c
->
width
,
id
->
ff_dec_c
->
height
,
id
->
f
_dst
.
i_width
,
id
->
f_dst
.
i_
height
,
VLC_FOURCC
(
'I'
,
'4'
,
'2'
,
'0'
)
);
id
->
p_encoder
->
format
.
video
.
i_chroma
);
for
(
i_plane
=
0
;
i_plane
<
pic
.
i_planes
;
i_plane
++
)
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,
...
@@ -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
);
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
);
memcpy
(
p_out
->
p_buffer
,
p_block
->
p_buffer
,
p_block
->
i_buffer
);
sout_BufferChain
(
out
,
p_out
);
sout_BufferChain
(
out
,
p_out
);
block_Release
(
p_block
);
}
}
return
VLC_SUCCESS
;
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