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