ported the shagadelic plugin, shake it baby!
[platform/upstream/gst-plugins-good.git] / gst / effectv / gsteffectv.c
1 /* GStreamer
2  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3  *
4  * EffecTV:
5  * Copyright (C) 2001 FUKUCHI Kentarou
6  *
7  * EffecTV is free software. We release this product under the terms of the
8  * GNU General Public License version 2. The license is included in the file
9  * COPYING.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13  * A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
14  */
15
16 #include <string.h>
17 #include <gst/gst.h>
18 #include "gsteffectv.h"
19
20
21 struct _elements_entry {
22   gchar *name;
23   GType (*type) (void);
24   GstElementDetails *details;
25   gboolean (*factoryinit) (GstElementFactory *factory);
26 };
27
28 static struct _elements_entry _elements[] = {
29   { "edgeTV",           gst_edgetv_get_type,            &gst_edgetv_details,            NULL },
30   { "agingTV",          gst_agingtv_get_type,           &gst_agingtv_details,           NULL },
31   { "diceTV",           gst_dicetv_get_type,            &gst_dicetv_details,            NULL },
32   { "warpTV",           gst_warptv_get_type,            &gst_warptv_details,            NULL },
33   { "shagadelicTV",     gst_shagadelictv_get_type,      &gst_shagadelictv_details,      NULL },
34   { NULL, 0 },
35 };
36
37
38 GstPadTemplate* 
39 gst_effectv_src_factory (void)
40 {
41   static GstPadTemplate *templ = NULL;
42   if (!templ) {
43     templ = GST_PAD_TEMPLATE_NEW ( 
44                 "src",
45                 GST_PAD_SRC,
46                 GST_PAD_ALWAYS,
47                 GST_CAPS_NEW (
48                   "effectv_src",
49                   "video/raw",
50                     "format",         GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB ")),
51                     "bpp",            GST_PROPS_INT (32),
52                     "depth",          GST_PROPS_INT (32),
53                     "endianness",     GST_PROPS_INT (G_BYTE_ORDER),
54                     "red_mask",       GST_PROPS_INT (0xff0000),
55                     "green_mask",     GST_PROPS_INT (0xff00),
56                     "blue_mask",      GST_PROPS_INT (0xff),
57                     "width",          GST_PROPS_INT_RANGE (16, 4096),
58                     "height",         GST_PROPS_INT_RANGE (16, 4096)
59                 )
60              );
61   }
62   return templ;
63 }
64
65 GstPadTemplate* 
66 gst_effectv_sink_factory (void)
67 {
68   static GstPadTemplate *templ = NULL;
69   if (!templ) {
70     templ = GST_PAD_TEMPLATE_NEW ( 
71                 "sink",
72                 GST_PAD_SINK,
73                 GST_PAD_ALWAYS,
74                 GST_CAPS_NEW (
75                   "effectv_sink",
76                   "video/raw",
77                     "format",         GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB ")),
78                     "bpp",            GST_PROPS_INT (32),
79                     "depth",          GST_PROPS_INT (32),
80                     "endianness",     GST_PROPS_INT (G_BYTE_ORDER),
81                     "red_mask",       GST_PROPS_INT (0xff0000),
82                     "green_mask",     GST_PROPS_INT (0xff00),
83                     "blue_mask",      GST_PROPS_INT (0xff),
84                     "width",          GST_PROPS_INT_RANGE (16, 4096),
85                     "height",         GST_PROPS_INT_RANGE (16, 4096)
86                 )
87              );
88   }
89   return templ;
90 }
91
92 static gboolean
93 plugin_init (GModule * module, GstPlugin * plugin)
94 {
95   GstElementFactory *factory;
96   gint i = 0;
97
98   while (_elements[i].name) {
99     factory = gst_element_factory_new (_elements[i].name,
100                                       (_elements[i].type) (),
101                                        _elements[i].details);
102
103     if (!factory) {
104       g_warning ("gst_effecttv_new failed for `%s'",
105                  _elements[i].name);
106       continue;
107     }
108     gst_element_factory_add_pad_template (factory, gst_effectv_src_factory ());
109     gst_element_factory_add_pad_template (factory, gst_effectv_sink_factory ());
110
111     gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
112     if (_elements[i].factoryinit) {
113       _elements[i].factoryinit (factory);
114     }
115     i++;
116   }
117
118   return TRUE;
119 }
120
121 GstPluginDesc plugin_desc = {
122   GST_VERSION_MAJOR,
123   GST_VERSION_MINOR,
124   "effectv",
125   plugin_init
126 };