Call ff_find_hwaccel() after calling avcodec_set_dimensions().

Patch by Reimar

Originally committed as revision 20599 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Reimar Döffinger 2009-11-24 15:13:47 +00:00 committed by Carl Eugen Hoyos
parent 8b4a6d47b2
commit f3bdc3da15

View File

@ -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);