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 {
51 GstVideofilter videofilter;
55 struct _GstVideotemplateClass {
56 GstVideofilterClass parent_class;
60 /* GstVideotemplate signals and args */
71 static void gst_videotemplate_base_init (gpointer g_class);
72 static void gst_videotemplate_class_init (gpointer g_class, gpointer class_data);
73 static void gst_videotemplate_init (GTypeInstance *instance, gpointer g_class);
75 static void gst_videotemplate_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
76 static void gst_videotemplate_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
78 static void gst_videotemplate_planar411(GstVideofilter *videofilter, void *dest, void *src);
79 static void gst_videotemplate_setup(GstVideofilter *videofilter);
82 gst_videotemplate_get_type (void)
84 static GType videotemplate_type = 0;
86 if (!videotemplate_type) {
87 static const GTypeInfo videotemplate_info = {
88 sizeof(GstVideotemplateClass),
89 gst_videotemplate_base_init,
91 gst_videotemplate_class_init,
94 sizeof(GstVideotemplate),
96 gst_videotemplate_init,
98 videotemplate_type = g_type_register_static(GST_TYPE_VIDEOFILTER,
99 "GstVideotemplate", &videotemplate_info, 0);
101 return videotemplate_type;
104 static GstVideofilterFormat gst_videotemplate_formats[] = {
105 { "I420", 12, gst_videotemplate_planar411, },
110 gst_videotemplate_base_init (gpointer g_class)
112 static GstElementDetails videotemplate_details = GST_ELEMENT_DETAILS (
113 "Video Filter Template",
114 "Filter/Effect/Video",
115 "Template for a video filter",
116 "David Schleef <ds@schleef.org>"
118 GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
119 GstVideofilterClass *videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
122 gst_element_class_set_details (element_class, &videotemplate_details);
124 for(i=0;i<G_N_ELEMENTS(gst_videotemplate_formats);i++){
125 gst_videofilter_class_add_format(videofilter_class,
126 gst_videotemplate_formats + i);
129 gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
133 gst_videotemplate_class_init (gpointer g_class, gpointer class_data)
135 GObjectClass *gobject_class;
136 GstVideofilterClass *videofilter_class;
138 gobject_class = G_OBJECT_CLASS (g_class);
139 videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
142 g_object_class_install_property(gobject_class, ARG_METHOD,
143 g_param_spec_enum("method","method","method",
144 GST_TYPE_VIDEOTEMPLATE_METHOD, GST_VIDEOTEMPLATE_METHOD_1,
148 gobject_class->set_property = gst_videotemplate_set_property;
149 gobject_class->get_property = gst_videotemplate_get_property;
151 videofilter_class->setup = gst_videotemplate_setup;
155 gst_videotemplate_init (GTypeInstance *instance, gpointer g_class)
157 GstVideotemplate *videotemplate = GST_VIDEOTEMPLATE (instance);
158 GstVideofilter *videofilter;
160 GST_DEBUG("gst_videotemplate_init");
162 videofilter = GST_VIDEOFILTER(videotemplate);
168 gst_videotemplate_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
170 GstVideotemplate *src;
172 /* it's not null if we got it, but it might not be ours */
173 g_return_if_fail(GST_IS_VIDEOTEMPLATE(object));
174 src = GST_VIDEOTEMPLATE(object);
176 GST_DEBUG("gst_videotemplate_set_property");
180 src->method = g_value_get_enum (value);
189 gst_videotemplate_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
191 GstVideotemplate *src;
193 /* it's not null if we got it, but it might not be ours */
194 g_return_if_fail(GST_IS_VIDEOTEMPLATE(object));
195 src = GST_VIDEOTEMPLATE(object);
200 g_value_set_enum (value, src->method);
204 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
209 static gboolean plugin_init (GstPlugin *plugin)
211 if(!gst_library_load("gstvideofilter"))
214 return gst_element_register (plugin, "videotemplate", GST_RANK_NONE,
215 GST_TYPE_VIDEOTEMPLATE);
222 "Template for a video filter",
230 static void gst_videotemplate_setup(GstVideofilter *videofilter)
232 GstVideotemplate *videotemplate;
234 g_return_if_fail(GST_IS_VIDEOTEMPLATE(videofilter));
235 videotemplate = GST_VIDEOTEMPLATE(videofilter);
237 /* if any setup needs to be done, do it here */
241 static void gst_videotemplate_planar411(GstVideofilter *videofilter,
242 void *dest, void *src)
244 GstVideotemplate *videotemplate;
245 int width = gst_videofilter_get_input_width(videofilter);
246 int height = gst_videofilter_get_input_height(videofilter);
248 g_return_if_fail(GST_IS_VIDEOTEMPLATE(videofilter));
249 videotemplate = GST_VIDEOTEMPLATE(videofilter);
251 /* do something interesting here. This simply copies the source
252 * to the destination. */
253 memcpy(dest,src,width * height + (width/2) * (height/2) * 2);