Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
ffmpeg2theora
Commits
61470e1c
Commit
61470e1c
authored
Oct 02, 2009
by
Jan Gerber
Browse files
for some codecs pix_fmt is not valid after init, copy early
parent
85f9e4c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/ffmpeg2theora.c
View file @
61470e1c
...
...
@@ -468,6 +468,7 @@ void ff2theora_output(ff2theora this) {
unsigned
int
i
;
AVCodecContext
*
aenc
=
NULL
;
AVCodecContext
*
venc
=
NULL
;
int
venc_pix_fmt
;
AVStream
*
astream
=
NULL
;
AVStream
*
vstream
=
NULL
;
AVCodec
*
acodec
=
NULL
;
...
...
@@ -523,10 +524,10 @@ void ff2theora_output(ff2theora this) {
if
(
this
->
video_index
>=
0
)
{
vstream
=
this
->
context
->
streams
[
this
->
video_index
];
venc
=
vstream
->
codec
;
vcodec
=
avcodec_find_decoder
(
venc
->
codec_id
);
display_width
=
venc
->
width
;
display_height
=
venc
->
height
;
venc_pix_fmt
=
venc
->
pix_fmt
;
if
(
vstream
->
time_base
.
den
&&
vstream
->
time_base
.
num
&&
av_q2d
(
vstream
->
time_base
)
>
0
.
001
)
{
...
...
@@ -577,7 +578,7 @@ void ff2theora_output(ff2theora this) {
1024
*
1024
);
if
(
vstream
->
sample_aspect_ratio
.
num
&&
// default
av_cmp_q
(
vstream
->
sample_aspect_ratio
,
v
stream
->
cod
ec
->
sample_aspect_ratio
))
{
av_cmp_q
(
vstream
->
sample_aspect_ratio
,
ve
n
c
->
sample_aspect_ratio
))
{
sample_aspect_ratio
.
num
=
vstream
->
sample_aspect_ratio
.
num
;
sample_aspect_ratio
.
den
=
vstream
->
sample_aspect_ratio
.
den
;
}
else
{
...
...
@@ -806,7 +807,7 @@ void ff2theora_output(ff2theora this) {
if
(
this
->
frame_width
>
0
||
this
->
frame_height
>
0
)
{
this
->
sws_colorspace_ctx
=
sws_getContext
(
display_width
,
display_height
,
venc
->
pix_fmt
,
display_width
,
display_height
,
venc
_
pix_fmt
,
display_width
,
display_height
,
this
->
pix_fmt
,
sws_flags
,
NULL
,
NULL
,
NULL
);
...
...
@@ -996,17 +997,17 @@ void ff2theora_output(ff2theora this) {
audio_done
=
1
;
if
(
!
info
.
audio_only
)
{
frame_p
=
frame
=
frame_alloc
(
v
stream
->
codec
->
pix_fmt
,
v
stream
->
codec
->
width
,
vstream
->
code
c
->
height
);
frame_p
=
frame
=
frame_alloc
(
v
enc_
pix_fmt
,
v
enc
->
width
,
ven
c
->
height
);
output_tmp_p
=
output_tmp
=
frame_alloc
(
this
->
pix_fmt
,
v
stream
->
codec
->
width
,
vstream
->
code
c
->
height
);
v
enc
->
width
,
ven
c
->
height
);
output_p
=
output
=
frame_alloc
(
this
->
pix_fmt
,
v
stream
->
codec
->
width
,
vstream
->
code
c
->
height
);
v
enc
->
width
,
ven
c
->
height
);
output_resized_p
=
output_resized
=
frame_alloc
(
this
->
pix_fmt
,
this
->
picture_width
,
this
->
picture_height
);
output_cropped_p
=
output_cropped
=
frame_alloc
(
this
->
pix_fmt
,
v
stream
->
cod
ec
->
width
-
this
->
frame_leftBand
,
v
stream
->
cod
ec
->
height
-
this
->
frame_topBand
);
ve
n
c
->
width
-
this
->
frame_leftBand
,
ve
n
c
->
height
-
this
->
frame_topBand
);
output_buffered_p
=
output_buffered
=
frame_alloc
(
this
->
pix_fmt
,
this
->
frame_width
,
this
->
frame_height
);
output_padded_p
=
output_padded
=
frame_alloc
(
this
->
pix_fmt
,
...
...
@@ -1257,7 +1258,7 @@ void ff2theora_output(ff2theora this) {
first frame decodec in case its not a keyframe
*/
if
(
pkt
.
stream_index
==
this
->
video_index
)
{
avcodec_decode_video2
(
v
stream
->
cod
ec
,
frame
,
&
got_picture
,
&
pkt
);
avcodec_decode_video2
(
ve
n
c
,
frame
,
&
got_picture
,
&
pkt
);
}
av_free_packet
(
&
pkt
);
continue
;
...
...
@@ -1276,7 +1277,7 @@ void ff2theora_output(ff2theora this) {
while
(
video_eos
||
avpkt
.
size
>
0
)
{
int
dups
=
0
;
static
th_ycbcr_buffer
ycbcr
;
len1
=
avcodec_decode_video2
(
v
stream
->
cod
ec
,
frame
,
&
got_picture
,
&
avpkt
);
len1
=
avcodec_decode_video2
(
ve
n
c
,
frame
,
&
got_picture
,
&
avpkt
);
if
(
len1
>=
0
)
{
if
(
got_picture
)
{
// this is disabled by default since it does not work
...
...
@@ -1320,7 +1321,7 @@ void ff2theora_output(ff2theora this) {
//For audio only files command line option"-e" will not work
//as we don't increment frame_count in audio section.
if
(
venc
->
pix_fmt
!=
this
->
pix_fmt
)
{
if
(
venc
_
pix_fmt
!=
this
->
pix_fmt
)
{
sws_scale
(
this
->
sws_colorspace_ctx
,
frame
->
data
,
frame
->
linesize
,
0
,
display_height
,
output_tmp
->
data
,
output_tmp
->
linesize
);
...
...
Write
Preview
Supports
Markdown
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