From 62b24c4a35455b392b7f886f2a3e44261ed2d2a9 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Thu, 17 Jan 2013 14:43:44 +0200 Subject: ff_video_decoder: delay calling set_stream_info() instead of calling it from get_buffer() (merged from https://github.com/huceke/xine-lib-vaapi) --- src/combined/ffmpeg/ff_video_decoder.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/combined/ffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c index 7d87a6b7b..e231b4b2c 100644 --- a/src/combined/ffmpeg/ff_video_decoder.c +++ b/src/combined/ffmpeg/ff_video_decoder.c @@ -138,6 +138,8 @@ struct ff_video_decoder_s { #ifdef LOG enum PixelFormat debug_fmt; #endif + + uint8_t set_stream_info; }; /* import color matrix names */ @@ -213,7 +215,7 @@ static int get_buffer(AVCodecContext *context, AVFrame *av_frame){ this->aspect_ratio = (double)width / (double)height; this->aspect_ratio_prio = 1; lprintf("default aspect ratio: %f\n", this->aspect_ratio); - set_stream_info(this); + this->set_stream_info = 1; } } @@ -1320,6 +1322,11 @@ static void ff_handle_mpeg12_buffer (ff_video_decoder_t *this, buf_element_t *bu offset += len; } + if( this->set_stream_info) { + set_stream_info(this); + this->set_stream_info = 0; + } + if (got_picture && this->av_frame->data[0]) { /* got a picture, draw it */ if(!this->av_frame->opaque) { @@ -1536,6 +1543,11 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { set_stream_info(this); } + if( this->set_stream_info) { + set_stream_info(this); + this->set_stream_info = 0; + } + if (got_picture && this->av_frame->data[0]) { /* got a picture, draw it */ got_one_picture = 1; @@ -1899,6 +1911,7 @@ static video_decoder_t *ff_video_open_plugin (video_decoder_class_t *class_gen, this->mpeg_parser = NULL; this->dr1_frames = xine_list_new(); + this->set_stream_info = 0; #ifdef LOG this->debug_fmt = -1; -- cgit v1.2.3