mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
26042c9fee
Original commit message from CVS: - added gob example plugin
141 lines
3.6 KiB
Text
141 lines
3.6 KiB
Text
|
|
%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
|
|
};
|
|
%}
|