vpxdec: Remove unneeded add video_meta
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Tue, 15 Dec 2015 17:57:53 +0000 (12:57 -0500)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>
Tue, 15 Dec 2015 17:57:53 +0000 (12:57 -0500)
This also remove copies for VP8, which was not correctly in place
in previous related patch.

ext/vpx/gstvp9dec.c
ext/vpx/gstvpxdec.c
ext/vpx/gstvpxdec.h

index 5c9e727..d08a2f7 100644 (file)
@@ -62,7 +62,6 @@ static gboolean gst_vp9_dec_get_valid_format (GstVPXDec * dec,
     vpx_image_t * img, GstVideoFormat * fmt);
 static void gst_vp9_dec_handle_resolution_change (GstVPXDec * dec,
     vpx_image_t * img, GstVideoFormat fmt);
-static void gst_vp9_dec_add_video_meta (GstVPXDec * dec, GstBuffer * buffer);
 
 static GstStaticPadTemplate gst_vp9_dec_sink_template =
 GST_STATIC_PAD_TEMPLATE ("sink",
@@ -108,7 +107,6 @@ gst_vp9_dec_class_init (GstVP9DecClass * klass)
       GST_DEBUG_FUNCPTR (gst_vp9_dec_get_valid_format);
   vpx_class->handle_resolution_change =
       GST_DEBUG_FUNCPTR (gst_vp9_dec_handle_resolution_change);
-  vpx_class->add_video_meta = GST_DEBUG_FUNCPTR (gst_vp9_dec_add_video_meta);
 
   GST_DEBUG_CATEGORY_INIT (gst_vp9dec_debug, "vp9dec", 0, "VP9 Decoder");
 }
@@ -179,11 +177,4 @@ gst_vp9_dec_handle_resolution_change (GstVPXDec * dec, vpx_image_t * img,
   }
 }
 
-static void
-gst_vp9_dec_add_video_meta (GstVPXDec * dec, GstBuffer * buffer)
-{
-  gst_buffer_add_video_meta (buffer, GST_VIDEO_FRAME_FLAG_NONE,
-      GST_VIDEO_FORMAT_ENCODED, 0, 0);
-}
-
 #endif /* HAVE_VP9_DECODER */
index d48014a..fc75a7b 100644 (file)
@@ -109,10 +109,6 @@ static gboolean gst_vpx_dec_default_frame_format (GstVPXDec * dec,
     vpx_image_t * img, GstVideoFormat * fmt);
 static void gst_vpx_dec_handle_resolution_change (GstVPXDec * dec,
     vpx_image_t * img, GstVideoFormat fmt);
-#ifdef HAVE_VPX_1_4
-static void gst_vpx_dec_default_add_video_meta (GstVPXDec * dec,
-    GstBuffer * buffer);
-#endif //HAVE_VPX_1_4
 
 #define parent_class gst_vpx_dec_parent_class
 G_DEFINE_TYPE (GstVPXDec, gst_vpx_dec, GST_TYPE_VIDEO_DECODER);
@@ -176,7 +172,6 @@ gst_vpx_dec_class_init (GstVPXDecClass * klass)
   klass->handle_resolution_change = NULL;
   klass->get_frame_format =
       GST_DEBUG_FUNCPTR (gst_vpx_dec_default_frame_format);
-  klass->add_video_meta = NULL;
 
   GST_DEBUG_CATEGORY_INIT (gst_vpxdec_debug, "vpxdec", 0, "VPX Decoder");
 }
@@ -460,7 +455,9 @@ gst_vpx_dec_get_buffer_cb (gpointer priv, gsize min_size,
     return -1;
   }
 
-  gst_vpx_dec_default_add_video_meta (dec, buffer);
+  /* Add it now, while the buffer is writable */
+  gst_buffer_add_video_meta (buffer, GST_VIDEO_FRAME_FLAG_NONE,
+      GST_VIDEO_FORMAT_ENCODED, 0, 0);
 
   frame = g_new0 (struct Frame, 1);
   if (!gst_buffer_map (buffer, &frame->info, GST_MAP_READWRITE)) {
@@ -727,10 +724,10 @@ gst_vpx_dec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame)
   return ret;
 }
 
-
 static gboolean
 gst_vpx_dec_decide_allocation (GstVideoDecoder * bdec, GstQuery * query)
 {
+  GstVPXDec *dec = GST_VPX_DEC (bdec);
   GstBufferPool *pool;
   GstStructure *config;
 
@@ -745,6 +742,7 @@ gst_vpx_dec_decide_allocation (GstVideoDecoder * bdec, GstQuery * query)
   if (gst_query_find_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL)) {
     gst_buffer_pool_config_add_option (config,
         GST_BUFFER_POOL_OPTION_VIDEO_META);
+    dec->have_video_meta = TRUE;
   }
   gst_buffer_pool_set_config (pool, config);
   gst_object_unref (pool);
@@ -795,14 +793,4 @@ gst_vpx_dec_handle_resolution_change (GstVPXDec * dec, vpx_image_t * img,
   }
 }
 
-#ifdef HAVE_VPX_1_4
-static void
-gst_vpx_dec_default_add_video_meta (GstVPXDec * dec, GstBuffer * buffer)
-{
-  GstVPXDecClass *vpxclass = GST_VPX_DEC_GET_CLASS (dec);
-  if (vpxclass->add_video_meta != NULL) {
-    vpxclass->add_video_meta (dec, buffer);
-  }
-}
-#endif //HAVE_VPX_1_4
 #endif /* HAVE_VP8_DECODER ||  HAVE_VP9_DECODER */
index 825a3d3..6852f86 100644 (file)
@@ -102,8 +102,6 @@ struct _GstVPXDecClass
   void (*handle_resolution_change) (GstVPXDec *dec, vpx_image_t *img, GstVideoFormat fmt);
   /*virtual function to check valid format*/
   gboolean (*get_frame_format)(GstVPXDec *dec, vpx_image_t *img, GstVideoFormat* fmt);
-  /*virtual function to write video meta data to buffer*/
-  void (*add_video_meta)(GstVPXDec *dec, GstBuffer* buffer);
 };
 
 GType gst_vpx_dec_get_type (void);