gst_plugins_base/gst-libs/gst/video/gstvideofilter.c
branchRCL_3
changeset 30 7e817e7e631c
parent 29 567bb019e3e3
equal deleted inserted replaced
29:567bb019e3e3 30:7e817e7e631c
    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 
       
    44 GST_DEBUG_CATEGORY_STATIC (gst_video_filter_debug);
    42 GST_DEBUG_CATEGORY_STATIC (gst_video_filter_debug);
    45 #define GST_CAT_DEFAULT gst_video_filter_debug
    43 #define GST_CAT_DEFAULT gst_video_filter_debug
    46 
    44 
    47 static void gst_video_filter_class_init (gpointer g_class, gpointer class_data);
    45 static void gst_video_filter_class_init (gpointer g_class, gpointer class_data);
    48 static void gst_video_filter_init (GTypeInstance * instance, gpointer g_class);
    46 static void gst_video_filter_init (GTypeInstance * instance, gpointer g_class);
    75         "GstVideoFilter", &video_filter_info, G_TYPE_FLAG_ABSTRACT);
    73         "GstVideoFilter", &video_filter_info, G_TYPE_FLAG_ABSTRACT);
    76   }
    74   }
    77   return video_filter_type;
    75   return video_filter_type;
    78 }
    76 }
    79 
    77 
    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 
       
   100 static void
    78 static void
   101 gst_video_filter_class_init (gpointer g_class, gpointer class_data)
    79 gst_video_filter_class_init (gpointer g_class, gpointer class_data)
   102 {
    80 {
   103   GObjectClass *gobject_class;
    81   GObjectClass *gobject_class;
   104   GstElementClass *gstelement_class;
    82   GstElementClass *gstelement_class;
   107 
    85 
   108   klass = (GstVideoFilterClass *) g_class;
    86   klass = (GstVideoFilterClass *) g_class;
   109   gobject_class = (GObjectClass *) klass;
    87   gobject_class = (GObjectClass *) klass;
   110   gstelement_class = (GstElementClass *) klass;
    88   gstelement_class = (GstElementClass *) klass;
   111   trans_class = (GstBaseTransformClass *) klass;
    89   trans_class = (GstBaseTransformClass *) klass;
   112 
       
   113   trans_class->get_unit_size =
       
   114       GST_DEBUG_FUNCPTR (gst_video_filter_get_unit_size);
       
   115 
    90 
   116   parent_class = g_type_class_peek_parent (klass);
    91   parent_class = g_type_class_peek_parent (klass);
   117 
    92 
   118   GST_DEBUG_CATEGORY_INIT (gst_video_filter_debug, "videofilter", 0,
    93   GST_DEBUG_CATEGORY_INIT (gst_video_filter_debug, "videofilter", 0,
   119       "videofilter");
    94       "videofilter");