summaryrefslogtreecommitdiff
path: root/gst/virtualdub/gstvirtualdub.c
blob: d83ccd2c78099b7fd80bc3e0af55e66071073d62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/* GStreamer
 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
 *
 * EffecTV:
 * Copyright (C) 2001 FUKUCHI Kentarou
 *
 * EffecTV is free software. We release this product under the terms of the
 * GNU General Public License version 2. The license is included in the file
 * COPYING.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 */

#include <string.h>
#include <gst/gst.h>
#include "gstvirtualdub.h"


struct _elements_entry {
  gchar *name;
  GType (*type) (void);
  GstElementDetails *details;
  gboolean (*factoryinit) (GstElementFactory *factory);
};

static struct _elements_entry _elements[] = {
  { "xsharpen",  	gst_xsharpen_get_type, 		&gst_xsharpen_details, 		NULL },
  { NULL, 0 },
};


GstPadTemplate* 
gst_virtualdub_src_factory (void)
{
  static GstPadTemplate *templ = NULL;
  if (!templ) {
    templ = GST_PAD_TEMPLATE_NEW ( 
  		"src",
  		GST_PAD_SRC,
  		GST_PAD_ALWAYS,
  		GST_CAPS_NEW (
  		  "virtualdub_src",
  		  "video/raw",
  		    "format",         GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB ")),
  		    "bpp",            GST_PROPS_INT (32),
  		    "depth",          GST_PROPS_INT (32),
  		    "endianness",     GST_PROPS_INT (G_BYTE_ORDER),
  		    "red_mask",       GST_PROPS_INT (0xff0000),
  		    "green_mask",     GST_PROPS_INT (0xff00),
  		    "blue_mask",      GST_PROPS_INT (0xff),
  		    "width",          GST_PROPS_INT_RANGE (16, 4096),
  		    "height",         GST_PROPS_INT_RANGE (16, 4096)
		)
  	     );
  }
  return templ;
}

GstPadTemplate* 
gst_virtualdub_sink_factory (void)
{
  static GstPadTemplate *templ = NULL;
  if (!templ) {
    templ = GST_PAD_TEMPLATE_NEW ( 
  		"sink",
  		GST_PAD_SINK,
  		GST_PAD_ALWAYS,
  		GST_CAPS_NEW (
  		  "virtualdub_sink",
  		  "video/raw",
  		    "format",         GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB ")),
  		    "bpp",            GST_PROPS_INT (32),
  		    "depth",          GST_PROPS_INT (32),
  		    "endianness",     GST_PROPS_INT (G_BYTE_ORDER),
  		    "red_mask",       GST_PROPS_INT (0xff0000),
  		    "green_mask",     GST_PROPS_INT (0xff00),
  		    "blue_mask",      GST_PROPS_INT (0xff),
  		    "width",          GST_PROPS_INT_RANGE (16, 4096),
  		    "height",         GST_PROPS_INT_RANGE (16, 4096)
		)
  	     );
  }
  return templ;
}

static gboolean
plugin_init (GModule * module, GstPlugin * plugin)
{
  GstElementFactory *factory;
  gint i = 0;

  while (_elements[i].name) {
    factory = gst_element_factory_new (_elements[i].name,
                                      (_elements[i].type) (),
                                       _elements[i].details);

    if (!factory) {
      g_warning ("gst_virtualdub_new failed for `%s'",
                 _elements[i].name);
      continue;
    }
    gst_element_factory_add_pad_template (factory, gst_virtualdub_src_factory ());
    gst_element_factory_add_pad_template (factory, gst_virtualdub_sink_factory ());

    gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
    if (_elements[i].factoryinit) {
      _elements[i].factoryinit (factory);
    }
    i++;
  }

  return TRUE;
}

GstPluginDesc plugin_desc = {
  GST_VERSION_MAJOR,
  GST_VERSION_MINOR,
  "virtualdub",
  plugin_init
};