gst_plugins_base/gst-libs/gst/video/gstvideofilter.c
changeset 8 4a7fac7dd34a
parent 0 0e761a78d257
child 30 7e817e7e631c
equal deleted inserted replaced
7:71e347f905f2 8:4a7fac7dd34a
    37 #include "config.h"
    37 #include "config.h"
    38 #endif
    38 #endif
    39 
    39 
    40 #include "gstvideofilter.h"
    40 #include "gstvideofilter.h"
    41 
    41 
       
    42 #include <gst/video/video.h>
       
    43 
    42 GST_DEBUG_CATEGORY_STATIC (gst_video_filter_debug);
    44 GST_DEBUG_CATEGORY_STATIC (gst_video_filter_debug);
    43 #define GST_CAT_DEFAULT gst_video_filter_debug
    45 #define GST_CAT_DEFAULT gst_video_filter_debug
    44 
    46 
    45 static void gst_video_filter_class_init (gpointer g_class, gpointer class_data);
    47 static void gst_video_filter_class_init (gpointer g_class, gpointer class_data);
    46 static void gst_video_filter_init (GTypeInstance * instance, gpointer g_class);
    48 static void gst_video_filter_init (GTypeInstance * instance, gpointer g_class);
    73         "GstVideoFilter", &video_filter_info, G_TYPE_FLAG_ABSTRACT);
    75         "GstVideoFilter", &video_filter_info, G_TYPE_FLAG_ABSTRACT);
    74   }
    76   }
    75   return video_filter_type;
    77   return video_filter_type;
    76 }
    78 }
    77 
    79 
       
    80 static gboolean
       
    81 gst_video_filter_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
       
    82     guint * size)
       
    83 {
       
    84   GstVideoFormat fmt;
       
    85   gint width, height;
       
    86 
       
    87   if (!gst_video_format_parse_caps (caps, &fmt, &width, &height)) {
       
    88     GST_WARNING_OBJECT (btrans, "Failed to parse caps %" GST_PTR_FORMAT, caps);
       
    89     return FALSE;
       
    90   }
       
    91 
       
    92   *size = gst_video_format_get_size (fmt, width, height);
       
    93 
       
    94   GST_DEBUG_OBJECT (btrans, "Returning size %u bytes for caps %"
       
    95       GST_PTR_FORMAT, *size, caps);
       
    96 
       
    97   return TRUE;
       
    98 }
       
    99 
    78 static void
   100 static void
    79 gst_video_filter_class_init (gpointer g_class, gpointer class_data)
   101 gst_video_filter_class_init (gpointer g_class, gpointer class_data)
    80 {
   102 {
    81   GObjectClass *gobject_class;
   103   GObjectClass *gobject_class;
    82   GstElementClass *gstelement_class;
   104   GstElementClass *gstelement_class;
    85 
   107 
    86   klass = (GstVideoFilterClass *) g_class;
   108   klass = (GstVideoFilterClass *) g_class;
    87   gobject_class = (GObjectClass *) klass;
   109   gobject_class = (GObjectClass *) klass;
    88   gstelement_class = (GstElementClass *) klass;
   110   gstelement_class = (GstElementClass *) klass;
    89   trans_class = (GstBaseTransformClass *) klass;
   111   trans_class = (GstBaseTransformClass *) klass;
       
   112 
       
   113   trans_class->get_unit_size =
       
   114       GST_DEBUG_FUNCPTR (gst_video_filter_get_unit_size);
    90 
   115 
    91   parent_class = g_type_class_peek_parent (klass);
   116   parent_class = g_type_class_peek_parent (klass);
    92 
   117 
    93   GST_DEBUG_CATEGORY_INIT (gst_video_filter_debug, "videofilter", 0,
   118   GST_DEBUG_CATEGORY_INIT (gst_video_filter_debug, "videofilter", 0,
    94       "videofilter");
   119       "videofilter");