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,
30 /*#define DEBUG_ENABLED */
31 #include <gstvideotemplate.h>
34 /* GstVideotemplate signals and args */
45 static void gst_videotemplate_base_init (gpointer g_class);
46 static void gst_videotemplate_class_init (gpointer g_class, gpointer class_data);
47 static void gst_videotemplate_init (GTypeInstance *instance, gpointer g_class);
49 static void gst_videotemplate_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
50 static void gst_videotemplate_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
52 static void gst_videotemplate_planar411(GstVideofilter *videofilter, void *dest, void *src);
53 static void gst_videotemplate_setup(GstVideofilter *videofilter);
56 gst_videotemplate_get_type (void)
58 static GType videotemplate_type = 0;
60 if (!videotemplate_type) {
61 static const GTypeInfo videotemplate_info = {
62 sizeof(GstVideotemplateClass),
63 gst_videotemplate_base_init,
65 gst_videotemplate_class_init,
68 sizeof(GstVideotemplate),
70 gst_videotemplate_init,
72 videotemplate_type = g_type_register_static(GST_TYPE_VIDEOFILTER,
73 "GstVideotemplate", &videotemplate_info, 0);
75 return videotemplate_type;
78 static GstVideofilterFormat gst_videotemplate_formats[] = {
79 { "I420", 12, gst_videotemplate_planar411, },
84 gst_videotemplate_base_init (gpointer g_class)
86 static GstElementDetails videotemplate_details = GST_ELEMENT_DETAILS (
87 "Video Filter Template",
88 "Filter/Effect/Video",
89 "Template for a video filter",
90 "David Schleef <ds@schleef.org>"
92 GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
93 GstVideofilterClass *videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
96 gst_element_class_set_details (element_class, &videotemplate_details);
98 for(i=0;i<G_N_ELEMENTS(gst_videotemplate_formats);i++){
99 gst_videofilter_class_add_format(videofilter_class,
100 gst_videotemplate_formats + i);
103 gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
107 gst_videotemplate_class_init (gpointer g_class, gpointer class_data)
109 GObjectClass *gobject_class;
110 GstVideofilterClass *videofilter_class;
112 gobject_class = G_OBJECT_CLASS (g_class);
113 videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
116 g_object_class_install_property(gobject_class, ARG_METHOD,
117 g_param_spec_enum("method","method","method",
118 GST_TYPE_VIDEOTEMPLATE_METHOD, GST_VIDEOTEMPLATE_METHOD_1,
122 gobject_class->set_property = gst_videotemplate_set_property;
123 gobject_class->get_property = gst_videotemplate_get_property;
125 videofilter_class->setup = gst_videotemplate_setup;
129 gst_videotemplate_init (GTypeInstance *instance, gpointer g_class)
131 GstVideotemplate *videotemplate = GST_VIDEOTEMPLATE (instance);
132 GstVideofilter *videofilter;
134 GST_DEBUG("gst_videotemplate_init");
136 videofilter = GST_VIDEOFILTER(videotemplate);
142 gst_videotemplate_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
144 GstVideotemplate *src;
146 /* it's not null if we got it, but it might not be ours */
147 g_return_if_fail(GST_IS_VIDEOTEMPLATE(object));
148 src = GST_VIDEOTEMPLATE(object);
150 GST_DEBUG("gst_videotemplate_set_property");
154 src->method = g_value_get_enum (value);
163 gst_videotemplate_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
165 GstVideotemplate *src;
167 /* it's not null if we got it, but it might not be ours */
168 g_return_if_fail(GST_IS_VIDEOTEMPLATE(object));
169 src = GST_VIDEOTEMPLATE(object);
174 g_value_set_enum (value, src->method);
178 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
183 static gboolean plugin_init (GstPlugin *plugin)
185 if(!gst_library_load("gstvideofilter"))
188 return gst_element_register (plugin, "videotemplate", GST_RANK_NONE,
189 GST_TYPE_VIDEOTEMPLATE);
196 "Template for a video filter",
205 static void gst_videotemplate_setup(GstVideofilter *videofilter)
207 GstVideotemplate *videotemplate;
209 g_return_if_fail(GST_IS_VIDEOTEMPLATE(videofilter));
210 videotemplate = GST_VIDEOTEMPLATE(videofilter);
212 /* if any setup needs to be done, do it here */
216 static void gst_videotemplate_planar411(GstVideofilter *videofilter,
217 void *dest, void *src)
219 GstVideotemplate *videotemplate;
220 int width = gst_videofilter_get_input_width(videofilter);
221 int height = gst_videofilter_get_input_height(videofilter);
223 g_return_if_fail(GST_IS_VIDEOTEMPLATE(videofilter));
224 videotemplate = GST_VIDEOTEMPLATE(videofilter);
226 /* do something interesting here. This simply copies the source
227 * to the destination. */
228 memcpy(dest,src,width * height + (width/2) * (height/2) * 2);