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 gstvideotemplate.c,
31 #include <gstvideofilter.h>
34 #define GST_TYPE_VIDEOTEMPLATE \
35 (gst_videotemplate_get_type())
36 #define GST_VIDEOTEMPLATE(obj) \
37 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEOTEMPLATE,GstVideotemplate))
38 #define GST_VIDEOTEMPLATE_CLASS(klass) \
39 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEOTEMPLATE,GstVideotemplateClass))
40 #define GST_IS_VIDEOTEMPLATE(obj) \
41 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEOTEMPLATE))
42 #define GST_IS_VIDEOTEMPLATE_CLASS(obj) \
43 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEOTEMPLATE))
45 typedef struct _GstVideotemplate GstVideotemplate;
46 typedef struct _GstVideotemplateClass GstVideotemplateClass;
48 struct _GstVideotemplate {
49 GstVideofilter videofilter;
53 struct _GstVideotemplateClass {
54 GstVideofilterClass parent_class;
58 /* GstVideotemplate signals and args */
69 static void gst_videotemplate_base_init (gpointer g_class);
70 static void gst_videotemplate_class_init (gpointer g_class, gpointer class_data);
71 static void gst_videotemplate_init (GTypeInstance *instance, gpointer g_class);
73 static void gst_videotemplate_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
74 static void gst_videotemplate_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
76 static void gst_videotemplate_planar411(GstVideofilter *videofilter, void *dest, void *src);
77 static void gst_videotemplate_setup(GstVideofilter *videofilter);
80 gst_videotemplate_get_type (void)
82 static GType videotemplate_type = 0;
84 if (!videotemplate_type) {
85 static const GTypeInfo videotemplate_info = {
86 sizeof(GstVideotemplateClass),
87 gst_videotemplate_base_init,
89 gst_videotemplate_class_init,
92 sizeof(GstVideotemplate),
94 gst_videotemplate_init,
96 videotemplate_type = g_type_register_static(GST_TYPE_VIDEOFILTER,
97 "GstVideotemplate", &videotemplate_info, 0);
99 return videotemplate_type;
102 static GstVideofilterFormat gst_videotemplate_formats[] = {
103 { "I420", 12, gst_videotemplate_planar411, },
108 gst_videotemplate_base_init (gpointer g_class)
110 static GstElementDetails videotemplate_details = GST_ELEMENT_DETAILS (
111 "Video Filter Template",
112 "Filter/Effect/Video",
113 "Template for a video filter",
114 "David Schleef <ds@schleef.org>"
116 GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
117 GstVideofilterClass *videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
120 gst_element_class_set_details (element_class, &videotemplate_details);
122 for(i=0;i<G_N_ELEMENTS(gst_videotemplate_formats);i++){
123 gst_videofilter_class_add_format(videofilter_class,
124 gst_videotemplate_formats + i);
127 gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
131 gst_videotemplate_class_init (gpointer g_class, gpointer class_data)
133 GObjectClass *gobject_class;
134 GstVideofilterClass *videofilter_class;
136 gobject_class = G_OBJECT_CLASS (g_class);
137 videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
140 g_object_class_install_property(gobject_class, ARG_METHOD,
141 g_param_spec_enum("method","method","method",
142 GST_TYPE_VIDEOTEMPLATE_METHOD, GST_VIDEOTEMPLATE_METHOD_1,
146 gobject_class->set_property = gst_videotemplate_set_property;
147 gobject_class->get_property = gst_videotemplate_get_property;
149 videofilter_class->setup = gst_videotemplate_setup;
153 gst_videotemplate_init (GTypeInstance *instance, gpointer g_class)
155 GstVideotemplate *videotemplate = GST_VIDEOTEMPLATE (instance);
156 GstVideofilter *videofilter;
158 GST_DEBUG("gst_videotemplate_init");
160 videofilter = GST_VIDEOFILTER(videotemplate);
166 gst_videotemplate_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
168 GstVideotemplate *src;
170 /* it's not null if we got it, but it might not be ours */
171 g_return_if_fail(GST_IS_VIDEOTEMPLATE(object));
172 src = GST_VIDEOTEMPLATE(object);
174 GST_DEBUG("gst_videotemplate_set_property");
178 src->method = g_value_get_enum (value);
187 gst_videotemplate_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
189 GstVideotemplate *src;
191 /* it's not null if we got it, but it might not be ours */
192 g_return_if_fail(GST_IS_VIDEOTEMPLATE(object));
193 src = GST_VIDEOTEMPLATE(object);
198 g_value_set_enum (value, src->method);
202 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
207 static gboolean plugin_init (GstPlugin *plugin)
209 if(!gst_library_load("gstvideofilter"))
212 return gst_element_register (plugin, "videotemplate", GST_RANK_NONE,
213 GST_TYPE_VIDEOTEMPLATE);
220 "Template for a video filter",
228 static void gst_videotemplate_setup(GstVideofilter *videofilter)
230 GstVideotemplate *videotemplate;
232 g_return_if_fail(GST_IS_VIDEOTEMPLATE(videofilter));
233 videotemplate = GST_VIDEOTEMPLATE(videofilter);
235 /* if any setup needs to be done, do it here */
239 static void gst_videotemplate_planar411(GstVideofilter *videofilter,
240 void *dest, void *src)
242 GstVideotemplate *videotemplate;
243 int width = gst_videofilter_get_input_width(videofilter);
244 int height = gst_videofilter_get_input_height(videofilter);
246 g_return_if_fail(GST_IS_VIDEOTEMPLATE(videofilter));
247 videotemplate = GST_VIDEOTEMPLATE(videofilter);
249 /* do something interesting here. This simply copies the source
250 * to the destination. */
251 memcpy(dest,src,width * height + (width/2) * (height/2) * 2);