remove copyright field from plugins
[platform/upstream/gst-plugins-good.git] / gst / videofilter / gstvideotemplate.c
1 /* GStreamer
2  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3  * Copyright (C) <2003> David Schleef <ds@schleef.org>
4  *
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.
9  *
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.
14  *
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.
19  */
20
21 /*
22  * This file was (probably) generated from gstvideotemplate.c,
23  * $Id$
24  */
25
26 #ifdef HAVE_CONFIG_H
27 #include "config.h"
28 #endif
29
30 /*#define DEBUG_ENABLED */
31 #include <gstvideotemplate.h>
32 #include <string.h>
33
34 /* GstVideotemplate signals and args */
35 enum {
36   /* FILL ME */
37   LAST_SIGNAL
38 };
39
40 enum {
41   ARG_0,
42   /* FILL ME */
43 };
44
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);
48
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);
51
52 static void gst_videotemplate_planar411(GstVideofilter *videofilter, void *dest, void *src);
53 static void gst_videotemplate_setup(GstVideofilter *videofilter);
54
55 GType
56 gst_videotemplate_get_type (void)
57 {
58   static GType videotemplate_type = 0;
59
60   if (!videotemplate_type) {
61     static const GTypeInfo videotemplate_info = {
62       sizeof(GstVideotemplateClass),
63       gst_videotemplate_base_init,
64       NULL,
65       gst_videotemplate_class_init,
66       NULL,
67       NULL,
68       sizeof(GstVideotemplate),
69       0,
70       gst_videotemplate_init,
71     };
72     videotemplate_type = g_type_register_static(GST_TYPE_VIDEOFILTER,
73         "GstVideotemplate", &videotemplate_info, 0);
74   }
75   return videotemplate_type;
76 }
77
78 static GstVideofilterFormat gst_videotemplate_formats[] = {
79   { "I420", 12, gst_videotemplate_planar411, },
80 };
81
82   
83 static void
84 gst_videotemplate_base_init (gpointer g_class)
85 {
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>"
91   );
92   GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
93   GstVideofilterClass *videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
94   int i;
95   
96   gst_element_class_set_details (element_class, &videotemplate_details);
97
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);
101   }
102
103   gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
104 }
105
106 static void
107 gst_videotemplate_class_init (gpointer g_class, gpointer class_data)
108 {
109   GObjectClass *gobject_class;
110   GstVideofilterClass *videofilter_class;
111
112   gobject_class = G_OBJECT_CLASS (g_class);
113   videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
114
115 #if 0
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,
119       G_PARAM_READWRITE));
120 #endif
121
122   gobject_class->set_property = gst_videotemplate_set_property;
123   gobject_class->get_property = gst_videotemplate_get_property;
124
125   videofilter_class->setup = gst_videotemplate_setup;
126 }
127
128 static void
129 gst_videotemplate_init (GTypeInstance *instance, gpointer g_class)
130 {
131   GstVideotemplate *videotemplate = GST_VIDEOTEMPLATE (instance);
132   GstVideofilter *videofilter;
133
134   GST_DEBUG("gst_videotemplate_init");
135
136   videofilter = GST_VIDEOFILTER(videotemplate);
137
138   /* do stuff */
139 }
140
141 static void
142 gst_videotemplate_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
143 {
144   GstVideotemplate *src;
145
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);
149
150   GST_DEBUG("gst_videotemplate_set_property");
151   switch (prop_id) {
152 #if 0
153     case ARG_METHOD:
154       src->method = g_value_get_enum (value);
155       break;
156 #endif
157     default:
158       break;
159   }
160 }
161
162 static void
163 gst_videotemplate_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
164 {
165   GstVideotemplate *src;
166
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);
170
171   switch (prop_id) {
172 #if 0
173     case ARG_METHOD:
174       g_value_set_enum (value, src->method);
175       break;
176 #endif
177     default:
178       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
179       break;
180   }
181 }
182
183 static gboolean plugin_init (GstPlugin *plugin)
184 {
185   if(!gst_library_load("gstvideofilter"))
186     return FALSE;
187
188   return gst_element_register (plugin, "videotemplate", GST_RANK_NONE,
189       GST_TYPE_VIDEOTEMPLATE);
190 }
191
192 GST_PLUGIN_DEFINE (
193   GST_VERSION_MAJOR,
194   GST_VERSION_MINOR,
195   "videotemplate",
196   "Template for a video filter",
197   plugin_init,
198   VERSION,
199   GST_LICENSE,
200   GST_PACKAGE,
201   GST_ORIGIN
202 )
203
204 static void gst_videotemplate_setup(GstVideofilter *videofilter)
205 {
206   GstVideotemplate *videotemplate;
207
208   g_return_if_fail(GST_IS_VIDEOTEMPLATE(videofilter));
209   videotemplate = GST_VIDEOTEMPLATE(videofilter);
210
211   /* if any setup needs to be done, do it here */
212
213 }
214
215 static void gst_videotemplate_planar411(GstVideofilter *videofilter,
216     void *dest, void *src)
217 {
218   GstVideotemplate *videotemplate;
219   int width = gst_videofilter_get_input_width(videofilter);
220   int height = gst_videofilter_get_input_height(videofilter);
221
222   g_return_if_fail(GST_IS_VIDEOTEMPLATE(videofilter));
223   videotemplate = GST_VIDEOTEMPLATE(videofilter);
224
225   /* do something interesting here.  This simply copies the source
226    * to the destination. */
227   memcpy(dest,src,width * height + (width/2) * (height/2) * 2);
228 }
229