From c5159206dcea00766b7d567193e1c4fd13f12cf3 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Tue, 17 May 2011 02:15:12 +0000 Subject: Fix build with very recent copies of FFmpeg This is a backport of the 1.2 code that was commited to utilize the new API provided by FFmpeg for awhile now but this is especially important because the old API has been eliminated all together from said copies of FFmpeg. --- src/post/planar/pp.c | 56 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 24 deletions(-) (limited to 'src/post/planar') diff --git a/src/post/planar/pp.c b/src/post/planar/pp.c index c9db99f2c..6b805e20b 100644 --- a/src/post/planar/pp.c +++ b/src/post/planar/pp.c @@ -35,6 +35,12 @@ # include #endif +#if LIBPOSTPROC_VERSION_MAJOR < 52 +# define pp_context pp_context_t +# define pp_mode pp_mode_t +# define PP_PARAMETERS_T +#endif + #define PP_STRING_SIZE 256 /* size of pp mode string (including all options) */ /* plugin class initialization function */ @@ -76,14 +82,15 @@ struct post_plugin_pp_s { /* libpostproc specific stuff */ int pp_flags; - pp_context_t *pp_context; - pp_mode_t *pp_mode; + pp_context *our_context; + pp_mode *our_mode; pthread_mutex_t lock; }; static int set_parameters (xine_post_t *this_gen, void *param_gen) { +#ifdef PP_PARAMETERS_T post_plugin_pp_t *this = (post_plugin_pp_t *)this_gen; pp_parameters_t *param = (pp_parameters_t *)param_gen; @@ -92,17 +99,18 @@ static int set_parameters (xine_post_t *this_gen, void *param_gen) { memcpy( &this->params, param, sizeof(pp_parameters_t) ); pthread_mutex_unlock (&this->lock); - +#endif return 1; } static int get_parameters (xine_post_t *this_gen, void *param_gen) { +#ifdef PP_PARAMETERS_T post_plugin_pp_t *this = (post_plugin_pp_t *)this_gen; pp_parameters_t *param = (pp_parameters_t *)param_gen; memcpy( param, &this->params, sizeof(pp_parameters_t) ); - +#endif return 1; } @@ -202,8 +210,8 @@ static post_plugin_t *pp_open_plugin(post_class_t *class_gen, int inputs, if(cpu_caps & MM_ACCEL_X86_3DNOW) this->pp_flags |= PP_CPU_CAPS_3DNOW; - this->pp_mode = NULL; - this->pp_context = NULL; + this->our_mode = NULL; + this->our_context = NULL; pthread_mutex_init (&this->lock, NULL); @@ -248,13 +256,13 @@ static void pp_dispose(post_plugin_t *this_gen) post_plugin_pp_t *this = (post_plugin_pp_t *)this_gen; if (_x_post_dispose(this_gen)) { - if(this->pp_mode) { - pp_free_mode(this->pp_mode); - this->pp_mode = NULL; + if(this->our_mode) { + pp_free_mode(this->our_mode); + this->our_mode = NULL; } - if(this->pp_context) { - pp_free_context(this->pp_context); - this->pp_context = NULL; + if(this->our_context) { + pp_free_context(this->our_context); + this->our_context = NULL; } free(this); } @@ -304,7 +312,7 @@ static int pp_draw(vo_frame_t *frame, xine_stream_t *stream) pthread_mutex_lock (&this->lock); - if( !this->pp_context || + if( !this->our_context || this->frame_width != yv12_frame->width || this->frame_height != yv12_frame->height ) { @@ -312,32 +320,32 @@ static int pp_draw(vo_frame_t *frame, xine_stream_t *stream) this->frame_height = yv12_frame->height; pp_flags = this->pp_flags; - if(this->pp_context) - pp_free_context(this->pp_context); + if(this->our_context) + pp_free_context(this->our_context); - this->pp_context = pp_get_context(frame->width, frame->height, pp_flags); + this->our_context = pp_get_context(frame->width, frame->height, pp_flags); - if(this->pp_mode) { - pp_free_mode(this->pp_mode); - this->pp_mode = NULL; + if(this->our_mode) { + pp_free_mode(this->our_mode); + this->our_mode = NULL; } } - if(!this->pp_mode) - this->pp_mode = pp_get_mode_by_name_and_quality(this->params.mode, + if(!this->our_mode) + this->our_mode = pp_get_mode_by_name_and_quality(this->params.mode, this->params.quality); - if(this->pp_mode) + if(this->our_mode) pp_postprocess(yv12_frame->base, yv12_frame->pitches, out_frame->base, out_frame->pitches, (frame->width+7)&(~7), frame->height, NULL, 0, - this->pp_mode, this->pp_context, + this->our_mode, this->our_context, 0 /*this->av_frame->pict_type*/); pthread_mutex_unlock (&this->lock); - if(this->pp_mode) { + if(this->our_mode) { skip = out_frame->draw(out_frame, stream); _x_post_frame_copy_up(frame, out_frame); } else { -- cgit v1.2.3