aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-11-24 15:13:47 +0000
committerCarl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at>2009-11-24 15:13:47 +0000
commitf3bdc3da15e3c794f226f915656049bd01fbb871 (patch)
treef217ceb56b8796660bf550b70e99b65a8793b662 /libavcodec
parent8b4a6d47b28d5995613f5fae6142e8dbd85866d5 (diff)
downloadffmpeg-f3bdc3da15e3c794f226f915656049bd01fbb871.tar.gz
Call ff_find_hwaccel() after calling avcodec_set_dimensions().
Patch by Reimar Originally committed as revision 20599 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 21ea0b4235..1bfb1e2f25 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2198,8 +2198,6 @@ static av_cold int decode_init(AVCodecContext *avctx){
if(!avctx->has_b_frames)
s->low_delay= 1;
- avctx->pix_fmt= avctx->get_format(avctx, avctx->codec->pix_fmts);
- avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt);
avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
decode_init_vlc();
@@ -3809,6 +3807,22 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
if (!s->context_initialized) {
if(h != h0)
return -1; // we cant (re-)initialize context during parallel decoding
+
+ avcodec_set_dimensions(s->avctx, s->width, s->height);
+ s->avctx->sample_aspect_ratio= h->sps.sar;
+ if(!s->avctx->sample_aspect_ratio.den)
+ s->avctx->sample_aspect_ratio.den = 1;
+
+ if(h->sps.timing_info_present_flag){
+ s->avctx->time_base= (AVRational){h->sps.num_units_in_tick, h->sps.time_scale};
+ if(h->x264_build > 0 && h->x264_build < 44)
+ s->avctx->time_base.den *= 2;
+ av_reduce(&s->avctx->time_base.num, &s->avctx->time_base.den,
+ s->avctx->time_base.num, s->avctx->time_base.den, 1<<30);
+ }
+ s->avctx->pix_fmt = s->avctx->get_format(s->avctx, s->avctx->codec->pix_fmts);
+ s->avctx->hwaccel = ff_find_hwaccel(s->avctx->codec->id, s->avctx->pix_fmt);
+
if (MPV_common_init(s) < 0)
return -1;
s->first_field = 0;
@@ -3831,19 +3845,6 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
for(i = 0; i < s->avctx->thread_count; i++)
if(context_init(h->thread_context[i]) < 0)
return -1;
-
- avcodec_set_dimensions(s->avctx, s->width, s->height);
- s->avctx->sample_aspect_ratio= h->sps.sar;
- if(!s->avctx->sample_aspect_ratio.den)
- s->avctx->sample_aspect_ratio.den = 1;
-
- if(h->sps.timing_info_present_flag){
- s->avctx->time_base= (AVRational){h->sps.num_units_in_tick, h->sps.time_scale};
- if(h->x264_build > 0 && h->x264_build < 44)
- s->avctx->time_base.den *= 2;
- av_reduce(&s->avctx->time_base.num, &s->avctx->time_base.den,
- s->avctx->time_base.num, s->avctx->time_base.den, 1<<30);
- }
}
h->frame_num= get_bits(&s->gb, h->sps.log2_max_frame_num);