/* deal with EOF state */
if (src->curoffset >= src->size) {
GST_DEBUG (0,"map offset %ld >= size %ld --> eos\n", src->curoffset, src->size);
+ gst_pad_event(pad,(void *)GST_EVENT_EOS);
gst_pad_set_eos (pad);
buf = gst_buffer_new();
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_EOS);
GValue *value, GParamSpec *pspec);
static void gst_fakesink_chain (GstPad *pad, GstBuffer *buf);
+static gboolean gst_fakesink_event (GstPad *pad, void *event);
static GstElementClass *parent_class = NULL;
static guint gst_fakesink_signals[LAST_SIGNAL] = { 0 };
pad = gst_pad_new ("sink", GST_PAD_SINK);
gst_element_add_pad (GST_ELEMENT (fakesink), pad);
gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_fakesink_chain));
+ gst_pad_set_event_function (pad, GST_DEBUG_FUNCPTR (gst_fakesink_event));
fakesink->sinkpads = g_slist_prepend (NULL, pad);
fakesink->numsinkpads = 1;
return TRUE;
}
+
+
+static gboolean
+gst_fakesink_event (GstPad *pad, void *event)
+{
+ GST_DEBUG (GST_CAT_EVENT, "fakesink has event %d on pad %s:%s\n",(gint)event,GST_DEBUG_PAD_NAME(pad));
+ if ((gint)event == GST_EVENT_EOS) {
+ GST_DEBUG(GST_CAT_EVENT, "have EOS\n");
+ }
+}
GST_DEBUG_ELEMENT (GST_CAT_STATES,element,"have failed change_state return\n");
return return_val;
}
+
+ /* Last thing we do is verify that a successful state change really
+ * did change the state... */
+ if (GST_STATE(element) != curpending) {
+ GST_DEBUG_ELEMENT (GST_CAT_STATES, element, "element claimed state-change success, but state didn't change\n");
+ return GST_STATE_FAILURE;
+ }
}
/* this is redundant, really, it will always return SUCCESS */
g_return_if_fail (element != NULL);
g_return_if_fail (GST_IS_ELEMENT (element));
+ GST_DEBUG(GST_CAT_EVENT, "signaling EOS on element %s\n",GST_OBJECT_NAME(element));
g_signal_emit (G_OBJECT (element), gst_element_signals[EOS], 0);
GST_FLAG_SET(element,GST_ELEMENT_COTHREAD_STOPPING);
}
"XML",
"NEGOTIATION",
"REFCOUNTING",
+ "EVENT",
};
/**
[GST_CAT_XML] = "01;37;41", // !!
[GST_CAT_NEGOTIATION] = "07;34",
[GST_CAT_REFCOUNTING] = "00;34:42",
+ [GST_CAT_EVENT] = "01;37;41", // !!
[31] = "",
};
GST_CAT_XML, // XML load/save of everything
GST_CAT_NEGOTIATION, // Caps Negotiation stuff
GST_CAT_REFCOUNTING, // Ref Counting stuff
+ GST_CAT_EVENT, // Event system
GST_CAT_MAX_CATEGORY = 31
};
pad->qosfunc = NULL;
pad->eosfunc = GST_DEBUG_FUNCPTR(gst_pad_eos_func);
- pad->pushfunc = GST_DEBUG_FUNCPTR(gst_pad_push_func);
- pad->pullfunc = NULL;
+ pad->chainhandler = GST_DEBUG_FUNCPTR(gst_pad_push_func);
+ pad->gethandler = NULL;
pad->pullregionfunc = NULL;
pad->bufferpoolfunc = NULL;
}
/**
+ * gst_pad_set_event_function:
+ * @pad: the pad to set the event handler for
+ * @event: the event handler
+ *
+ * Set the given event handler for the pad.
+ */
+void
+gst_pad_set_event_function (GstPad *pad,
+ GstPadEventFunction event)
+{
+ g_return_if_fail (pad != NULL);
+ g_return_if_fail (GST_IS_REAL_PAD (pad));
+
+ GST_RPAD_EVENTFUNC(pad) = event;
+ GST_DEBUG (GST_CAT_PADS,"eventfunc for %s:%s set to %s\n",
+ GST_DEBUG_PAD_NAME(pad),GST_DEBUG_FUNCPTR_NAME(event));
+}
+
+/**
* gst_pad_set_getregion_function:
* @pad: the pad to set the getregion function for
* @getregion: the getregion function
g_return_if_fail (GST_PAD_DIRECTION (pad) == GST_PAD_SRC);
g_return_if_fail (peer != NULL);
- if (peer->pushfunc) {
- GST_DEBUG (GST_CAT_DATAFLOW, "calling pushfunc &%s of peer pad %s:%s\n",
- GST_DEBUG_FUNCPTR_NAME (peer->pushfunc), GST_DEBUG_PAD_NAME (((GstPad*)peer)));
- (peer->pushfunc) (((GstPad*)peer), buf);
+ if (peer->chainhandler) {
+ GST_DEBUG (GST_CAT_DATAFLOW, "calling chainhandler &%s of peer pad %s:%s\n",
+ GST_DEBUG_FUNCPTR_NAME (peer->chainhandler), GST_DEBUG_PAD_NAME (((GstPad*)peer)));
+ (peer->chainhandler) (((GstPad*)peer), buf);
} else
- GST_DEBUG (GST_CAT_DATAFLOW, "no pushfunc\n");
+ GST_DEBUG (GST_CAT_DATAFLOW, "no chainhandler\n");
}
#endif
g_return_val_if_fail (GST_PAD_DIRECTION (pad) == GST_PAD_SINK, NULL);
g_return_val_if_fail (peer != NULL, NULL);
- if (peer->pullfunc) {
- GST_DEBUG (GST_CAT_DATAFLOW,"calling pullfunc %s of peer pad %s:%s\n",
- GST_DEBUG_FUNCPTR_NAME(peer->pullfunc),GST_DEBUG_PAD_NAME(peer));
- return (peer->pullfunc)(((GstPad*)peer));
+ if (peer->gethandler) {
+ GST_DEBUG (GST_CAT_DATAFLOW,"calling gethandler %s of peer pad %s:%s\n",
+ GST_DEBUG_FUNCPTR_NAME(peer->gethandler),GST_DEBUG_PAD_NAME(peer));
+ return (peer->gethandler)(((GstPad*)peer));
} else {
- GST_DEBUG (GST_CAT_DATAFLOW,"no pullfunc for peer pad %s:%s at %p\n",GST_DEBUG_PAD_NAME(((GstPad*)peer)),&peer->pullfunc);
+ GST_DEBUG (GST_CAT_DATAFLOW,"no gethandler for peer pad %s:%s at %p\n",GST_DEBUG_PAD_NAME(((GstPad*)peer)),&peer->gethandler);
return NULL;
}
}
return GST_PAD(ghostpad);
}
+
+
+gboolean
+gst_pad_event (GstPad *pad, void *event)
+{
+ GstRealPad *peer;
+ gboolean handled = FALSE;
+
+ GST_DEBUG(GST_CAT_EVENT, "have event %d on pad %s:%s\n",(gint)event,GST_DEBUG_PAD_NAME(pad));
+
+ peer = GST_RPAD_PEER(pad);
+ if (GST_RPAD_EVENTFUNC(peer))
+ handled = GST_RPAD_EVENTFUNC(peer) (peer, event);
+
+ else {
+ GST_DEBUG(GST_CAT_EVENT, "there's no event function for peer %s:%s\n",GST_DEBUG_PAD_NAME(peer));
+ }
+
+ if (!handled) {
+ GST_DEBUG(GST_CAT_EVENT, "would proceed with default behavior here\n");
+ gst_pad_event_default(peer,event);
+ }
+}
+
+/* pad is the receiving pad */
+static void
+gst_pad_event_default(GstPad *pad, void *event)
+{
+ switch((gint)event) {
+ case GST_EVENT_EOS:
+ if (GST_PAD_PARENT(pad)->numsrcpads == 1)
+ gst_element_signal_eos(GST_PAD_PARENT(pad));
+ else
+ GST_DEBUG(GST_CAT_EVENT, "WARNING: no default behavior for EOS with multiple srcpads\n");
+ break;
+ }
+}
#include <gst/gstbuffer.h>
#include <gst/cothreads.h>
#include <gst/gstcaps.h>
+#include <gst/gstevent.h>
#ifdef __cplusplus
* buf is the buffer being passed */
typedef void (*GstPadChainFunction) (GstPad *pad,GstBuffer *buf);
typedef GstBuffer* (*GstPadGetFunction) (GstPad *pad);
-typedef GstBuffer* (*GstPadGetRegionFunction) (GstPad *pad, GstRegionType type, guint64 offset, guint64 len);
-typedef void (*GstPadQoSFunction) (GstPad *pad, glong qos_message);
+typedef gboolean (*GstPadEventFunction) (GstPad *pad, void *event);
-typedef void (*GstPadPushFunction) (GstPad *pad, GstBuffer *buf);
-typedef GstBuffer* (*GstPadPullFunction) (GstPad *pad);
+typedef GstBuffer* (*GstPadGetRegionFunction) (GstPad *pad, GstRegionType type, guint64 offset, guint64 len);
typedef GstBuffer* (*GstPadPullRegionFunction) (GstPad *pad, GstRegionType type, guint64 offset, guint64 len);
+typedef void (*GstPadQoSFunction) (GstPad *pad, glong qos_message);
typedef gboolean (*GstPadEOSFunction) (GstPad *pad);
typedef GstPadNegotiateReturn (*GstPadNegotiateFunction) (GstPad *pad, GstCaps **caps, gpointer *data);
typedef void (*GstPadNewCapsFunction) (GstPad *pad, GstCaps *caps);
GstSchedule *sched;
GstPadChainFunction chainfunc;
+ GstPadChainFunction chainhandler;
GstPadGetFunction getfunc;
+ GstPadGetFunction gethandler;
+
+ GstPadEventFunction eventfunc;
+ GstPadEventFunction eventhandler;
+
GstPadGetRegionFunction getregionfunc;
+ GstPadPullRegionFunction pullregionfunc;
GstPadQoSFunction qosfunc;
GstPadEOSFunction eosfunc;
- GstPadPushFunction pushfunc;
- GstPadPullFunction pullfunc;
- GstPadPullRegionFunction pullregionfunc;
-
GstPadNegotiateFunction negotiatefunc;
GstPadNewCapsFunction newcapsfunc;
GstPadBufferPoolFunction bufferpoolfunc;
#define GST_RPAD_BUFPEN(pad) (((GstRealPad *)(pad))->bufpen)
#define GST_RPAD_SCHED(pad) (((GstRealPad *)(pad))->sched)
#define GST_RPAD_CHAINFUNC(pad) (((GstRealPad *)(pad))->chainfunc)
+#define GST_RPAD_CHAINHANDLER(pad) (((GstRealPad *)(pad))->chainhandler)
#define GST_RPAD_GETFUNC(pad) (((GstRealPad *)(pad))->getfunc)
+#define GST_RPAD_GETHANDLER(pad) (((GstRealPad *)(pad))->gethandler)
+#define GST_RPAD_EVENTFUNC(pad) (((GstRealPad *)(pad))->eventfunc)
+#define GST_RPAD_EVENTHANDLER(pad) (((GstRealPad *)(pad))->eventhandler)
+
#define GST_RPAD_GETREGIONFUNC(pad) (((GstRealPad *)(pad))->getregionfunc)
-#define GST_RPAD_PUSHFUNC(pad) (((GstRealPad *)(pad))->pushfunc)
-#define GST_RPAD_PULLFUNC(pad) (((GstRealPad *)(pad))->pullfunc)
#define GST_RPAD_PULLREGIONFUNC(pad) (((GstRealPad *)(pad))->pullregionfunc)
#define GST_RPAD_QOSFUNC(pad) (((GstRealPad *)(pad))->qosfunc)
#define GST_RPAD_EOSFUNC(pad) (((GstRealPad *)(pad))->eosfunc)
+
#define GST_RPAD_NEGOTIATEFUNC(pad) (((GstRealPad *)(pad))->negotiatefunc)
#define GST_RPAD_NEWCAPSFUNC(pad) (((GstRealPad *)(pad))->newcapsfunc)
#define GST_RPAD_BUFFERPOOLFUNC(pad) (((GstRealPad *)(pad))->bufferpoolfunc)
/* Some check functions (unused?) */
#define GST_PAD_CONNECTED(pad) (GST_PAD_PEER(pad) != NULL)
-#define GST_PAD_CAN_PULL(pad) (GST_IS_REAL_PAD(pad) && GST_REAL_PAD(pad)->pullfunc != NULL)
+#define GST_PAD_CAN_PULL(pad) (GST_IS_REAL_PAD(pad) && GST_REAL_PAD(pad)->gethandler != NULL)
/***** PadTemplate *****/
void gst_pad_set_chain_function (GstPad *pad, GstPadChainFunction chain);
void gst_pad_set_get_function (GstPad *pad, GstPadGetFunction get);
+void gst_pad_set_event_function (GstPad *pad, GstPadEventFunction event);
+
void gst_pad_set_getregion_function (GstPad *pad, GstPadGetRegionFunction getregion);
void gst_pad_set_qos_function (GstPad *pad, GstPadQoSFunction qos);
void gst_pad_set_eos_function (GstPad *pad, GstPadEOSFunction eos);
+
void gst_pad_set_negotiate_function (GstPad *pad, GstPadNegotiateFunction nego);
void gst_pad_set_newcaps_function (GstPad *pad, GstPadNewCapsFunction newcaps);
void gst_pad_set_bufferpool_function (GstPad *pad, GstPadBufferPoolFunction bufpool);
void gst_pad_push (GstPad *pad, GstBuffer *buf);
#else
#define gst_pad_push(pad,buf) G_STMT_START{ \
- if (((GstRealPad *)(pad))->peer->pushfunc) \
- (((GstRealPad *)(pad))->peer->pushfunc)((GstPad *)(((GstRealPad *)(pad))->peer),(buf)); \
+ if (((GstRealPad *)(pad))->peer->chainhandler) \
+ (((GstRealPad *)(pad))->peer->chainhandler)((GstPad *)(((GstRealPad *)(pad))->peer),(buf)); \
}G_STMT_END
#endif
#if 1
GstBuffer* gst_pad_pullregion (GstPad *pad, GstRegionType type, guint64 offset, guint64 len);
#else
#define gst_pad_pull(pad) \
- ( (((GstRealPad *)(pad))->peer->pullfunc) ? \
-(((GstRealPad *)(pad))->peer->pullfunc)((GstPad *)(((GstRealPad *)(pad))->peer)) : \
+ ( (((GstRealPad *)(pad))->peer->gethandler) ? \
+(((GstRealPad *)(pad))->peer->gethandler)((GstPad *)(((GstRealPad *)(pad))->peer)) : \
NULL )
#define gst_pad_pullregion(pad,type,offset,len) \
( (((GstRealPad *)(pad))->peer->pullregionfunc) ? \
(((GstRealPad *)(pad))->peer->pullregionfunc)((GstPad *)(((GstRealPad *)(pad))->peer),(type),(offset),(len)) : \
NULL )
#endif
+
+#if 1
+gboolean gst_pad_event (GstPad *pad, void *event);
+#else
+#define gst_pad_event(pad,event) G_STMT_START{ \
+ ( (((GstRealPad *)(pad))->peer->eventhandler) ? \
+ (((GstRealPad *)(pad))->peer->eventhandler)((GstPad *)(((GstRealPad *)(pad))->peer),(event)) : \
+FALSE )
+}G_STMT_END
+#endif
+
+
GstBuffer* gst_pad_peek (GstPad *pad);
GstPad* gst_pad_select (GList *padlist);
GstPad* gst_pad_selectv (GstPad *pad, ...);
void
_gst_plugin_initialize (void)
{
+#ifndef GST_DISABLE_REGISTRY
xmlDocPtr doc;
+#endif
+
_gst_modules = NULL;
_gst_modules_seqno = 0;
_gst_plugins = NULL;
PLUGINS_BUILDDIR "/gst/autoplug");
#endif /* PLUGINS_USE_BUILDDIR */
+#ifndef GST_DISABLE_REGISTRY
doc = xmlParseFile (GST_CONFIG_DIR"/reg.xml");
if (!doc ||
gst_plugin_load_thyself (doc->xmlRootNode);
xmlFreeDoc (doc);
+#endif // GST_DISABLE_REGISTRY
}
/**
return g_list_copy (_gst_plugins);
}
+#ifndef GST_DISABLE_REGISTRY
/**
* gst_plugin_save_thyself:
* @parent: the parent node to save the plugin to
GST_INFO (GST_CAT_PLUGIN_LOADING, "added %d registered factories, %d autopluggers and %d types",
elementcount, autoplugcount, typecount);
}
+#endif // GST_DISABLE_REGISTRY
/**
}
static void
-gst_schedule_pushfunc_proxy (GstPad *pad, GstBuffer *buf)
+gst_schedule_chainhandler_proxy (GstPad *pad, GstBuffer *buf)
{
GstRealPad *peer = GST_RPAD_PEER(pad);
GST_DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad));
- GST_DEBUG (GST_CAT_DATAFLOW,"putting buffer %p in peer's pen\n",buf);
+ GST_DEBUG (GST_CAT_DATAFLOW,"putting buffer %p in peer \"%s:%s\"'s pen\n",buf,GST_DEBUG_PAD_NAME(peer));
// FIXME this should be bounded
// loop until the bufferpen is empty so we can fill it up again
static GstBuffer*
-gst_schedule_pullfunc_proxy (GstPad *pad)
+gst_schedule_gethandler_proxy (GstPad *pad)
{
GstBuffer *buf;
GstRealPad *peer = GST_RPAD_PEER(pad);
// set the chain proxies
if (GST_RPAD_DIRECTION(pad) == GST_PAD_SINK) {
GST_DEBUG (GST_CAT_SCHEDULING,"copying chain function into push proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad));
- GST_RPAD_PUSHFUNC(pad) = GST_RPAD_CHAINFUNC(pad);
+ GST_RPAD_CHAINHANDLER(pad) = GST_RPAD_CHAINFUNC(pad);
} else {
GST_DEBUG (GST_CAT_SCHEDULING,"copying get function into pull proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad));
- GST_RPAD_PULLFUNC(pad) = GST_RPAD_GETFUNC(pad);
+ GST_RPAD_GETHANDLER(pad) = GST_RPAD_GETFUNC(pad);
GST_RPAD_PULLREGIONFUNC(pad) = GST_RPAD_GETREGIONFUNC(pad);
}
} else {
if (gst_pad_get_direction (pad) == GST_PAD_SINK) {
GST_DEBUG (GST_CAT_SCHEDULING,"setting cothreaded push proxy for sinkpad %s:%s\n",GST_DEBUG_PAD_NAME(pad));
- GST_RPAD_PUSHFUNC(pad) = GST_DEBUG_FUNCPTR(gst_schedule_pushfunc_proxy);
+ GST_RPAD_CHAINHANDLER(pad) = GST_DEBUG_FUNCPTR(gst_schedule_chainhandler_proxy);
} else {
GST_DEBUG (GST_CAT_SCHEDULING,"setting cothreaded pull proxy for srcpad %s:%s\n",GST_DEBUG_PAD_NAME(pad));
- GST_RPAD_PULLFUNC(pad) = GST_DEBUG_FUNCPTR(gst_schedule_pullfunc_proxy);
+ GST_RPAD_GETHANDLER(pad) = GST_DEBUG_FUNCPTR(gst_schedule_gethandler_proxy);
GST_RPAD_PULLREGIONFUNC(pad) = GST_DEBUG_FUNCPTR(gst_schedule_pullregionfunc_proxy);
}
}
if (GST_RPAD_DIRECTION(pad) == GST_PAD_SINK) {
GST_DEBUG (GST_CAT_SCHEDULING,"copying chain function into push proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad));
- GST_RPAD_PUSHFUNC(pad) = GST_RPAD_CHAINFUNC(pad);
+ GST_RPAD_CHAINHANDLER(pad) = GST_RPAD_CHAINFUNC(pad);
} else {
GST_DEBUG (GST_CAT_SCHEDULING,"copying get function into pull proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad));
- GST_RPAD_PULLFUNC(pad) = GST_RPAD_GETFUNC(pad);
+ GST_RPAD_GETHANDLER(pad) = GST_RPAD_GETFUNC(pad);
GST_RPAD_PULLREGIONFUNC(pad) = GST_RPAD_GETREGIONFUNC(pad);
}
}
(gst_object_get_parent (GST_OBJECT (outside)) != GST_OBJECT (bin))) {
if (gst_pad_get_direction (pad) == GST_PAD_SINK) {
GST_DEBUG (0,"dealing with outside source element %s\n",GST_ELEMENT_NAME(outside));
-// GST_DEBUG (0,"PUNT: copying pullfunc ptr from %s:%s to %s:%s (@ %p)\n",
-//GST_DEBUG_PAD_NAME(pad->peer),GST_DEBUG_PAD_NAME(pad),&pad->pullfunc);
-// pad->pullfunc = pad->peer->pullfunc;
-// GST_DEBUG (0,"PUNT: setting pushfunc proxy to fake proxy on %s:%s\n",GST_DEBUG_PAD_NAME(pad->peer));
-// pad->peer->pushfunc = GST_DEBUG_FUNCPTR(gst_bin_pushfunc_fake_proxy);
- GST_RPAD_PULLFUNC(pad) = GST_DEBUG_FUNCPTR(gst_bin_pullfunc_proxy);
+// GST_DEBUG (0,"PUNT: copying gethandler ptr from %s:%s to %s:%s (@ %p)\n",
+//GST_DEBUG_PAD_NAME(pad->peer),GST_DEBUG_PAD_NAME(pad),&pad->gethandler);
+// pad->gethandler = pad->peer->gethandler;
+// GST_DEBUG (0,"PUNT: setting chainhandler proxy to fake proxy on %s:%s\n",GST_DEBUG_PAD_NAME(pad->peer));
+// pad->peer->chainhandler = GST_DEBUG_FUNCPTR(gst_bin_chainhandler_fake_proxy);
+ GST_RPAD_GETHANDLER(pad) = GST_DEBUG_FUNCPTR(gst_bin_gethandler_proxy);
GST_RPAD_PULLREGIONFUNC(pad) = GST_DEBUG_FUNCPTR(gst_bin_pullregionfunc_proxy);
}
} else {
if (gst_pad_get_direction (pad) == GST_PAD_SINK) {
GST_DEBUG (0,"setting push proxy for sinkpad %s:%s\n",GST_DEBUG_PAD_NAME(pad));
// set the proxy functions
- pad->pushfunc = GST_DEBUG_FUNCPTR(gst_bin_pushfunc_proxy);
- GST_DEBUG (0,"pushfunc %p = gst_bin_pushfunc_proxy %p\n",&pad->pushfunc,gst_bin_pushfunc_proxy);
+ pad->chainhandler = GST_DEBUG_FUNCPTR(gst_bin_chainhandler_proxy);
+ GST_DEBUG (0,"chainhandler %p = gst_bin_chainhandler_proxy %p\n",&pad->chainhandler,gst_bin_chainhandler_proxy);
} else if (gst_pad_get_direction (pad) == GST_PAD_SRC) {
GST_DEBUG (0,"setting pull proxies for srcpad %s:%s\n",GST_DEBUG_PAD_NAME(pad));
// set the proxy functions
- GST_RPAD_PULLFUNC(pad) = GST_DEBUG_FUNCPTR(gst_bin_pullfunc_proxy);
+ GST_RPAD_GETHANDLER(pad) = GST_DEBUG_FUNCPTR(gst_bin_gethandler_proxy);
GST_RPAD_PULLREGIONFUNC(pad) = GST_DEBUG_FUNCPTR(gst_bin_pullregionfunc_proxy);
- GST_DEBUG (0,"pad->pullfunc(@%p) = gst_bin_pullfunc_proxy(@%p)\n",
- &pad->pullfunc,gst_bin_pullfunc_proxy);
+ GST_DEBUG (0,"pad->gethandler(@%p) = gst_bin_gethandler_proxy(@%p)\n",
+ &pad->gethandler,gst_bin_gethandler_proxy);
pad->pullregionfunc = GST_DEBUG_FUNCPTR(gst_bin_pullregionfunc_proxy);
}
pads = g_list_next (pads);
GST_DEBUG (0,"found SINK pad %s:%s\n", GST_DEBUG_PAD_NAME(pad));
// copy the peer's chain function, easy enough
- GST_DEBUG (0,"copying peer's chainfunc to %s:%s's pushfunc\n",GST_DEBUG_PAD_NAME(pad));
- GST_RPAD_PUSHFUNC(pad) = GST_DEBUG_FUNCPTR(GST_RPAD_CHAINFUNC(GST_RPAD_PEER(pad)));
+ GST_DEBUG (0,"copying peer's chainfunc to %s:%s's chainhandler\n",GST_DEBUG_PAD_NAME(pad));
+ GST_RPAD_CHAINHANDLER(pad) = GST_DEBUG_FUNCPTR(GST_RPAD_CHAINFUNC(GST_RPAD_PEER(pad)));
// need to walk through and check for outside connections
//FIXME need to do this for all pads
break;
}
// get the parent of the peer of the pad
- outside = GST_ELEMENT (GST_RPAD_PARENT(peer));
+ outside = GST_ELEMENT (GST_PAD_PARENT(peer));
if (!outside) break;
// if it's a connection and it's not ours...
if (GST_IS_CONNECTION (outside) &&
// set up proxy functions
if (gst_pad_get_direction (pad) == GST_PAD_SINK) {
GST_DEBUG (0,"setting push proxy for sinkpad %s:%s\n",GST_DEBUG_PAD_NAME(pad));
- pad->pushfunc = GST_DEBUG_FUNCPTR(gst_bin_pushfunc_proxy);
+ pad->chainhandler = GST_DEBUG_FUNCPTR(gst_bin_chainhandler_proxy);
} else if (gst_pad_get_direction (pad) == GST_PAD_SRC) {
GST_DEBUG (0,"setting pull proxy for srcpad %s:%s\n",GST_DEBUG_PAD_NAME(pad));
- GST_RPAD_PULLFUNC(pad) = GST_DEBUG_FUNCPTR(gst_bin_pullfunc_proxy);
+ GST_RPAD_GETHANDLER(pad) = GST_DEBUG_FUNCPTR(gst_bin_gethandler_proxy);
GST_RPAD_PULLREGIONFUNC(pad) = GST_DEBUG_FUNCPTR(gst_bin_pullregionfunc_proxy);
}
} else {
// we can just copy the chain function, since it shares the prototype
GST_DEBUG (0,"copying chain function into push proxy for %s:%s\n",
GST_DEBUG_PAD_NAME(pad));
- pad->pushfunc = pad->chainfunc;
+ pad->chainhandler = pad->chainfunc;
} else if (gst_pad_get_direction (pad) == GST_PAD_SRC) {
// we can just copy the get function, since it shares the prototype
GST_DEBUG (0,"copying get function into pull proxy for %s:%s\n",
GST_DEBUG_PAD_NAME(pad));
- pad->pullfunc = pad->getfunc;
+ pad->gethandler = pad->getfunc;
}
}
}
if (gst_pad_get_direction (pad) == GST_PAD_SINK) {
GST_DEBUG (0,"copying chain function into push proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad));
- pad->pushfunc = pad->chainfunc;
+ pad->chainhandler = pad->chainfunc;
} else {
GST_DEBUG (0,"copying get function into pull proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad));
- pad->pullfunc = pad->getfunc;
+ pad->gethandler = pad->getfunc;
}
}
}
while (padlist) {
pad = GST_PAD (padlist->data);
- GST_RPAD_PUSHFUNC(pad) = GST_DEBUG_FUNCPTR(gst_schedule_select_proxy);
+ GST_RPAD_CHAINHANDLER(pad) = GST_DEBUG_FUNCPTR(gst_schedule_select_proxy);
padlist = g_list_next (padlist);
}
break;
default:
+ GST_DEBUG_ELEMENT(GST_CAT_THREAD, element, "UNHANDLED STATE CHANGE! %x\n",transition);
break;
}
/* deal with EOF state */
if (src->curoffset >= src->size) {
GST_DEBUG (0,"map offset %ld >= size %ld --> eos\n", src->curoffset, src->size);
+ gst_pad_event(pad,(void *)GST_EVENT_EOS);
gst_pad_set_eos (pad);
buf = gst_buffer_new();
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_EOS);
GValue *value, GParamSpec *pspec);
static void gst_fakesink_chain (GstPad *pad, GstBuffer *buf);
+static gboolean gst_fakesink_event (GstPad *pad, void *event);
static GstElementClass *parent_class = NULL;
static guint gst_fakesink_signals[LAST_SIGNAL] = { 0 };
pad = gst_pad_new ("sink", GST_PAD_SINK);
gst_element_add_pad (GST_ELEMENT (fakesink), pad);
gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_fakesink_chain));
+ gst_pad_set_event_function (pad, GST_DEBUG_FUNCPTR (gst_fakesink_event));
fakesink->sinkpads = g_slist_prepend (NULL, pad);
fakesink->numsinkpads = 1;
return TRUE;
}
+
+
+static gboolean
+gst_fakesink_event (GstPad *pad, void *event)
+{
+ GST_DEBUG (GST_CAT_EVENT, "fakesink has event %d on pad %s:%s\n",(gint)event,GST_DEBUG_PAD_NAME(pad));
+ if ((gint)event == GST_EVENT_EOS) {
+ GST_DEBUG(GST_CAT_EVENT, "have EOS\n");
+ }
+}
noinst_PROGRAMS = init loadall simplefake states caps queue registry \
paranoia rip mp3encode autoplug props case4 markup load tee autoplug2 autoplug3 \
-capsconnect padfactory autoplug4 incsched reaping threadlock mp1vid reconnect faketest
+capsconnect padfactory autoplug4 incsched reaping threadlock mp1vid reconnect \
+faketest events
# we have nothing but apps here, we can do this safely
LIBS += $(GST_LIBS)
--- /dev/null
+#include <gst/gst.h>
+
+void eos_handler(GstElement *element) {
+ printf("got EOS signal\n");
+}
+
+int main (int argc,char *argv[]) {
+ GstElement *pipeline, *disksrc, *identity, *fakesink;
+
+ gst_init(&argc,&argv);
+
+ pipeline = gst_pipeline_new("pipeline");
+ disksrc = gst_elementfactory_make("disksrc","disksrc");
+ identity = gst_elementfactory_make("identity","identity");
+ fakesink = gst_elementfactory_make("fakesink","fakesink");
+
+ g_object_set(G_OBJECT(disksrc),"location","events.c",NULL);
+ g_signal_connectc(G_OBJECT(fakesink),"eos",eos_handler,NULL,FALSE);
+
+ gst_bin_add(GST_BIN(pipeline),disksrc);
+ gst_bin_add(GST_BIN(pipeline),fakesink);
+
+ gst_element_connect(disksrc,"src",fakesink,"sink");
+
+ gst_element_set_state(pipeline,GST_STATE_PLAYING);
+
+ gst_bin_iterate(GST_BIN(pipeline));
+ gst_bin_iterate(GST_BIN(pipeline));
+}