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 * This file was (probably) generated from
33 #include <gstvideofilter.h>
36 #define GST_TYPE_VIDEOTEMPLATE \
37 (gst_videotemplate_get_type())
38 #define GST_VIDEOTEMPLATE(obj) \
39 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEOTEMPLATE,GstVideotemplate))
40 #define GST_VIDEOTEMPLATE_CLASS(klass) \
41 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEOTEMPLATE,GstVideotemplateClass))
42 #define GST_IS_VIDEOTEMPLATE(obj) \
43 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEOTEMPLATE))
44 #define GST_IS_VIDEOTEMPLATE_CLASS(obj) \
45 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEOTEMPLATE))
47 typedef struct _GstVideotemplate GstVideotemplate;
48 typedef struct _GstVideotemplateClass GstVideotemplateClass;
50 struct _GstVideotemplate
52 GstVideofilter videofilter;
56 struct _GstVideotemplateClass
58 GstVideofilterClass parent_class;
62 /* GstVideotemplate signals and args */
75 static void gst_videotemplate_base_init (gpointer g_class);
76 static void gst_videotemplate_class_init (gpointer g_class,
78 static void gst_videotemplate_init (GTypeInstance * instance, gpointer g_class);
80 static void gst_videotemplate_set_property (GObject * object, guint prop_id,
81 const GValue * value, GParamSpec * pspec);
82 static void gst_videotemplate_get_property (GObject * object, guint prop_id,
83 GValue * value, GParamSpec * pspec);
85 static void gst_videotemplate_planar411 (GstVideofilter * videofilter,
86 void *dest, void *src);
87 static void gst_videotemplate_setup (GstVideofilter * videofilter);
90 gst_videotemplate_get_type (void)
92 static GType videotemplate_type = 0;
94 if (!videotemplate_type) {
95 static const GTypeInfo videotemplate_info = {
96 sizeof (GstVideotemplateClass),
97 gst_videotemplate_base_init,
99 gst_videotemplate_class_init,
102 sizeof (GstVideotemplate),
104 gst_videotemplate_init,
107 videotemplate_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
108 "GstVideotemplate", &videotemplate_info, 0);
110 return videotemplate_type;
113 static GstVideofilterFormat gst_videotemplate_formats[] = {
114 {"I420", 12, gst_videotemplate_planar411,},
119 gst_videotemplate_base_init (gpointer g_class)
121 static GstElementDetails videotemplate_details =
122 GST_ELEMENT_DETAILS ("Video Filter Template",
123 "Filter/Effect/Video",
124 "Template for a video filter",
125 "David Schleef <ds@schleef.org>");
126 GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
127 GstVideofilterClass *videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
130 gst_element_class_set_details (element_class, &videotemplate_details);
132 for (i = 0; i < G_N_ELEMENTS (gst_videotemplate_formats); i++) {
133 gst_videofilter_class_add_format (videofilter_class,
134 gst_videotemplate_formats + i);
137 gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
141 gst_videotemplate_class_init (gpointer g_class, gpointer class_data)
143 GObjectClass *gobject_class;
144 GstVideofilterClass *videofilter_class;
146 gobject_class = G_OBJECT_CLASS (g_class);
147 videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
150 g_object_class_install_property (gobject_class, ARG_METHOD,
151 g_param_spec_enum ("method", "method", "method",
152 GST_TYPE_VIDEOTEMPLATE_METHOD, GST_VIDEOTEMPLATE_METHOD_1,
156 gobject_class->set_property = gst_videotemplate_set_property;
157 gobject_class->get_property = gst_videotemplate_get_property;
159 videofilter_class->setup = gst_videotemplate_setup;
163 gst_videotemplate_init (GTypeInstance * instance, gpointer g_class)
165 GstVideotemplate *videotemplate = GST_VIDEOTEMPLATE (instance);
166 GstVideofilter *videofilter;
168 GST_DEBUG ("gst_videotemplate_init");
170 videofilter = GST_VIDEOFILTER (videotemplate);
176 gst_videotemplate_set_property (GObject * object, guint prop_id,
177 const GValue * value, GParamSpec * pspec)
179 GstVideotemplate *src;
181 /* it's not null if we got it, but it might not be ours */
182 g_return_if_fail (GST_IS_VIDEOTEMPLATE (object));
183 src = GST_VIDEOTEMPLATE (object);
185 GST_DEBUG ("gst_videotemplate_set_property");
189 src->method = g_value_get_enum (value);
198 gst_videotemplate_get_property (GObject * object, guint prop_id, GValue * value,
201 GstVideotemplate *src;
203 /* it's not null if we got it, but it might not be ours */
204 g_return_if_fail (GST_IS_VIDEOTEMPLATE (object));
205 src = GST_VIDEOTEMPLATE (object);
210 g_value_set_enum (value, src->method);
214 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
220 plugin_init (GstPlugin * plugin)
222 return gst_element_register (plugin, "videotemplate", GST_RANK_NONE,
223 GST_TYPE_VIDEOTEMPLATE);
226 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
229 "Template for a video filter",
230 plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
232 static void gst_videotemplate_setup (GstVideofilter * videofilter)
234 GstVideotemplate *videotemplate;
236 g_return_if_fail (GST_IS_VIDEOTEMPLATE (videofilter));
237 videotemplate = GST_VIDEOTEMPLATE (videofilter);
239 /* if any setup needs to be done, do it here */
244 gst_videotemplate_planar411 (GstVideofilter * videofilter,
245 void *dest, void *src)
247 GstVideotemplate *videotemplate;
248 int width = gst_videofilter_get_input_width (videofilter);
249 int height = gst_videofilter_get_input_height (videofilter);
251 g_return_if_fail (GST_IS_VIDEOTEMPLATE (videofilter));
252 videotemplate = GST_VIDEOTEMPLATE (videofilter);
254 /* do something interesting here. This simply copies the source
255 * to the destination. */
256 memcpy (dest, src, width * height + (width / 2) * (height / 2) * 2);