And the revTV plugin..
[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   { "vertigoTV",        gst_vertigotv_get_type,         &gst_vertigotv_details,         NULL },
35   { "revTV",            gst_revtv_get_type,             &gst_revtv_details,             NULL },
36   { NULL, 0 },
37 };
38
39
40 GstPadTemplate* 
41 gst_effectv_src_factory (void)
42 {
43   static GstPadTemplate *templ = NULL;
44   if (!templ) {
45     templ = GST_PAD_TEMPLATE_NEW ( 
46                 "src",
47                 GST_PAD_SRC,
48                 GST_PAD_ALWAYS,
49                 GST_CAPS_NEW (
50                   "effectv_src",
51                   "video/raw",
52                     "format",         GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB ")),
53                     "bpp",            GST_PROPS_INT (32),
54                     "depth",          GST_PROPS_INT (32),
55                     "endianness",     GST_PROPS_INT (G_BYTE_ORDER),
56                     "red_mask",       GST_PROPS_INT (0xff0000),
57                     "green_mask",     GST_PROPS_INT (0xff00),
58                     "blue_mask",      GST_PROPS_INT (0xff),
59                     "width",          GST_PROPS_INT_RANGE (16, 4096),
60                     "height",         GST_PROPS_INT_RANGE (16, 4096)
61                 )
62              );
63   }
64   return templ;
65 }
66
67 GstPadTemplate* 
68 gst_effectv_sink_factory (void)
69 {
70   static GstPadTemplate *templ = NULL;
71   if (!templ) {
72     templ = GST_PAD_TEMPLATE_NEW ( 
73                 "sink",
74                 GST_PAD_SINK,
75                 GST_PAD_ALWAYS,
76                 GST_CAPS_NEW (
77                   "effectv_sink",
78                   "video/raw",
79                     "format",         GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB ")),
80                     "bpp",            GST_PROPS_INT (32),
81                     "depth",          GST_PROPS_INT (32),
82                     "endianness",     GST_PROPS_INT (G_BYTE_ORDER),
83                     "red_mask",       GST_PROPS_INT (0xff0000),
84                     "green_mask",     GST_PROPS_INT (0xff00),
85                     "blue_mask",      GST_PROPS_INT (0xff),
86                     "width",          GST_PROPS_INT_RANGE (16, 4096),
87                     "height",         GST_PROPS_INT_RANGE (16, 4096)
88                 )
89              );
90   }
91   return templ;
92 }
93
94 static gboolean
95 plugin_init (GModule * module, GstPlugin * plugin)
96 {
97   GstElementFactory *factory;
98   gint i = 0;
99
100   while (_elements[i].name) {
101     factory = gst_element_factory_new (_elements[i].name,
102                                       (_elements[i].type) (),
103                                        _elements[i].details);
104
105     if (!factory) {
106       g_warning ("gst_effecttv_new failed for `%s'",
107                  _elements[i].name);
108       continue;
109     }
110     gst_element_factory_add_pad_template (factory, gst_effectv_src_factory ());
111     gst_element_factory_add_pad_template (factory, gst_effectv_sink_factory ());
112
113     gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
114     if (_elements[i].factoryinit) {
115       _elements[i].factoryinit (factory);
116     }
117     i++;
118   }
119
120   return TRUE;
121 }
122
123 GstPluginDesc plugin_desc = {
124   GST_VERSION_MAJOR,
125   GST_VERSION_MINOR,
126   "effectv",
127   plugin_init
128 };