diff options
-rw-r--r-- | examples/gob/Makefile.am | 21 | ||||
-rw-r--r-- | examples/gob/gst-identity2.gob | 141 |
2 files changed, 162 insertions, 0 deletions
diff --git a/examples/gob/Makefile.am b/examples/gob/Makefile.am new file mode 100644 index 00000000..bd0b916e --- /dev/null +++ b/examples/gob/Makefile.am @@ -0,0 +1,21 @@ + +plugindir = $(libdir)/gst + +plugin_LTLIBRARIES = libgstidentity2.la + +GOB_FILES_ID = gst-identity2.c gst-identity2.h gst-identity2-private.h + +BUILT_SOURCES = \ + $(GOB_FILES_ID) + +libgstidentity2_la_SOURCES = gst-identity2.gob $(GOB_FILES_ID) +libgstidentity2_la_CFLAGS = $(GST_CFLAGS) +libgstidentity2_la_LIBADD = $(GST_LIBS) + +%.c %.h %-private.h: %.gob + gob $< + +CLEANFILES = $(GOB_FILES_ID) + +dist-hook: + cd $(distdir); rm -f $(CLEANFILES) diff --git a/examples/gob/gst-identity2.gob b/examples/gob/gst-identity2.gob new file mode 100644 index 00000000..9c34cb55 --- /dev/null +++ b/examples/gob/gst-identity2.gob @@ -0,0 +1,141 @@ + +%header{ +#include <gst/gst.h> +#include "gst-identity2.h" +#include "gst-identity2-private.h" +%} + +class Gst:Identity2 from Gst:Element { + + /* plugin init */ + private gboolean + plugin_init (GModule *module, GstPlugin *plugin) + { + static GstElementDetails identity2_details = { + "GOB Identity", + "Filter/Effect", + "Does nothing", + "1.0", + "Wim Taymans <wim.taymans@chello.be>", + "(C) 2001", + }; + GstElementFactory *factory; + + factory = gst_elementfactory_new ("identity2", TYPE_SELF, + &identity2_details); + g_return_val_if_fail (factory != NULL, FALSE); + + gst_plugin_add_feature (plugin, &(factory->feature)); + + return TRUE; + } + + /* pads FIXME gob oculd be improved here */ + private GstPad *sinkpad = + { + gst_pad_new ("sink", GST_PAD_SINK); + gst_element_add_pad (GST_ELEMENT (o), o->_priv->sinkpad); + gst_pad_set_chain_function (o->_priv->sinkpad, chain); + gst_pad_set_bufferpool_function (o->_priv->sinkpad, get_bufferpool); + //gst_pad_set_negotiate_function (o->_priv->sinkpad, negotiate_sink); + }; + private GstPad *srcpad = + { + gst_pad_new ("src", GST_PAD_SRC); + gst_element_add_pad (GST_ELEMENT (o), o->_priv->srcpad); + //gst_pad_set_negotiate_function (o->_priv->srcpad, negotiate_src); + }; + + /* arguments */ + /* + private gboolean loop_based = FALSE; argument BOOL loop_based + get { + ARG = self->_priv->loop_based; + } + set { + self->_priv->loop_based = ARG; + if (self->_priv->loop_based) { + gst_element_set_loop_function (GST_ELEMENT (self), loop); + gst_pad_set_chain_function (self->_priv->sinkpad, NULL); + } + else { + gst_pad_set_chain_function (self->_priv->sinkpad, chain); + gst_element_set_loop_function (GST_ELEMENT (self), NULL); + } + };*/ + private guint sleep_time = 0; argument UINT sleep_time link; + private gboolean silent = FALSE; argument BOOL silent link; + + /* signals */ + private signal last NONE(NONE) void handoff(self); + + /* core code here */ + private GstBufferPool* + get_bufferpool (GstPad *pad (check null)) + { + Self *self = SELF (gst_pad_get_parent (pad)); + + return gst_pad_get_bufferpool (self->_priv->srcpad); + } + + /* private GstPadNegotiateReturn + negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data) + { + Self *self = SELF (gst_pad_get_parent (pad)); + + return gst_pad_negotiate_proxy (pad, self->_priv->sinkpad, caps); + } + + private GstPadNegotiateReturn + negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) + { + Self *self = SELF (gst_pad_get_parent (pad)); + + return gst_pad_negotiate_proxy (pad, self->_priv->srcpad, caps); + } */ + + private void + chain (GstPad *pad (check null), GstBuffer *buf (check null)) + { + Self *self; + + self = SELF (gst_pad_get_parent (pad)); + + if (!self->_priv->silent) + g_print("identity2: chain ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(pad)); + + handoff (self); + gst_pad_push (self->_priv->srcpad, buf); + + if (self->_priv->sleep_time) + usleep (self->_priv->sleep_time); + } + + /*private void + loop (GstElement *element (check null)) + { + Self *self = SELF (element); + GstBuffer *buf; + + do { + buf = gst_pad_pull (self->_priv->sinkpad); + g_print("identity2: loop ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(self->_priv->sinkpad)); + + handoff (self); + gst_pad_push (self->_priv->srcpad, buf); + + if (self->_priv->sleep_time) + usleep (self->_priv->sleep_time); + + } while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element)); + }*/ +} + +%{ +GstPluginDesc plugin_desc = { + GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "identity2", + gst_identity2_plugin_init +}; +%} |