[FFmpeg-cvslog] r20599 - trunk/libavcodec/h264.c
cehoyos
subversion
Tue Nov 24 16:13:48 CET 2009
Author: cehoyos
Date: Tue Nov 24 16:13:47 2009
New Revision: 20599
Log:
Call ff_find_hwaccel() after calling avcodec_set_dimensions().
Patch by Reimar
Modified:
trunk/libavcodec/h264.c
Modified: trunk/libavcodec/h264.c
==============================================================================
--- trunk/libavcodec/h264.c Tue Nov 24 11:10:39 2009 (r20598)
+++ trunk/libavcodec/h264.c Tue Nov 24 16:13:47 2009 (r20599)
@@ -2198,8 +2198,6 @@ static av_cold int decode_init(AVCodecCo
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(H264Conte
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(H264Conte
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);
More information about the ffmpeg-cvslog
mailing list