2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3 * Copyright (C) <2003> David Schleef <ds@schleef.org>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
22 * SECTION:gstvideofilter
23 * @short_description: Base class for video filters
27 * Provides useful functions and a base class for video filters.
30 * The videofilter will by default enable QoS on the parent GstBaseTransform
31 * to implement frame dropping.
40 #include "gstvideofilter.h"
42 #include <gst/video/video.h>
44 GST_DEBUG_CATEGORY_STATIC (gst_video_filter_debug);
45 #define GST_CAT_DEFAULT gst_video_filter_debug
47 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);
50 static GstBaseTransformClass *parent_class = NULL;
53 gst_video_filter_get_type (void)
55 static GType video_filter_type = 0;
57 if (!video_filter_type) {
58 static const GTypeInfo video_filter_info = {
59 sizeof (GstVideoFilterClass),
62 gst_video_filter_class_init,
65 sizeof (GstVideoFilter),
67 gst_video_filter_init,
70 video_filter_type = g_type_register_static (GST_TYPE_BASE_TRANSFORM,
71 "GstVideoFilter", &video_filter_info, G_TYPE_FLAG_ABSTRACT);
73 return video_filter_type;
77 gst_video_filter_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
83 if (!gst_video_format_parse_caps (caps, &fmt, &width, &height)) {
84 GST_WARNING_OBJECT (btrans, "Failed to parse caps %" GST_PTR_FORMAT, caps);
88 *size = gst_video_format_get_size (fmt, width, height);
90 GST_DEBUG_OBJECT (btrans, "Returning size %u bytes for caps %"
91 GST_PTR_FORMAT, *size, caps);
97 gst_video_filter_class_init (gpointer g_class, gpointer class_data)
99 GstBaseTransformClass *trans_class;
100 GstVideoFilterClass *klass;
102 klass = (GstVideoFilterClass *) g_class;
103 trans_class = (GstBaseTransformClass *) klass;
105 trans_class->get_unit_size =
106 GST_DEBUG_FUNCPTR (gst_video_filter_get_unit_size);
108 parent_class = g_type_class_peek_parent (klass);
110 GST_DEBUG_CATEGORY_INIT (gst_video_filter_debug, "videofilter", 0,
115 gst_video_filter_init (GTypeInstance * instance, gpointer g_class)
117 GstVideoFilter *videofilter = GST_VIDEO_FILTER (instance);
119 GST_DEBUG_OBJECT (videofilter, "gst_video_filter_init");
121 videofilter->inited = FALSE;
123 gst_base_transform_set_qos_enabled (GST_BASE_TRANSFORM (videofilter), TRUE);