$OpenBSD: patch-src_post_planar_pp_c,v 1.1 2011/06/13 08:10:01 dcoppa Exp $

Eliminate use of old FFmpeg APIs.

--- src/post/planar/pp.c.orig	Tue Mar  9 17:17:05 2010
+++ src/post/planar/pp.c	Mon May 16 20:42:58 2011
@@ -35,6 +35,12 @@
 #  include <libpostproc/postprocess.h>
 #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
   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 *cla
   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 *s
 
     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 *s
       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 {
