gst_plugins_base/gst-libs/gst/video/gstvideofilter.c
changeset 8 4a7fac7dd34a
parent 0 0e761a78d257
child 30 7e817e7e631c
--- a/gst_plugins_base/gst-libs/gst/video/gstvideofilter.c	Fri Mar 19 09:35:09 2010 +0200
+++ b/gst_plugins_base/gst-libs/gst/video/gstvideofilter.c	Fri Apr 16 15:15:52 2010 +0300
@@ -39,6 +39,8 @@
 
 #include "gstvideofilter.h"
 
+#include <gst/video/video.h>
+
 GST_DEBUG_CATEGORY_STATIC (gst_video_filter_debug);
 #define GST_CAT_DEFAULT gst_video_filter_debug
 
@@ -75,6 +77,26 @@
   return video_filter_type;
 }
 
+static gboolean
+gst_video_filter_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
+    guint * size)
+{
+  GstVideoFormat fmt;
+  gint width, height;
+
+  if (!gst_video_format_parse_caps (caps, &fmt, &width, &height)) {
+    GST_WARNING_OBJECT (btrans, "Failed to parse caps %" GST_PTR_FORMAT, caps);
+    return FALSE;
+  }
+
+  *size = gst_video_format_get_size (fmt, width, height);
+
+  GST_DEBUG_OBJECT (btrans, "Returning size %u bytes for caps %"
+      GST_PTR_FORMAT, *size, caps);
+
+  return TRUE;
+}
+
 static void
 gst_video_filter_class_init (gpointer g_class, gpointer class_data)
 {
@@ -88,6 +110,9 @@
   gstelement_class = (GstElementClass *) klass;
   trans_class = (GstBaseTransformClass *) klass;
 
+  trans_class->get_unit_size =
+      GST_DEBUG_FUNCPTR (gst_video_filter_get_unit_size);
+
   parent_class = g_type_class_peek_parent (klass);
 
   GST_DEBUG_CATEGORY_INIT (gst_video_filter_debug, "videofilter", 0,