Mercurial > libavcodec.hg
changeset 10565:26dc0444fa93 libavcodec
Call ff_find_hwaccel() after calling avcodec_set_dimensions().
Patch by Reimar
author | cehoyos |
---|---|
date | Tue, 24 Nov 2009 15:13:47 +0000 |
parents | 559ba9eabaff |
children | 7ca185b4bc42 |
files | h264.c |
diffstat | 1 files changed, 16 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/h264.c Tue Nov 24 10:10:39 2009 +0000 +++ b/h264.c Tue Nov 24 15:13:47 2009 +0000 @@ -2198,8 +2198,6 @@ 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 @@ 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 @@ 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);