Added a default handler for the pads.

Original commit message from CVS:
Added a default handler for the pads.
This commit is contained in:
Wim Taymans 2001-11-14 21:08:44 +00:00
parent 8e2530ee1c
commit fa78165bcd
2 changed files with 27 additions and 14 deletions

View file

@ -1455,8 +1455,8 @@ gst_pad_push (GstPad *pad, GstBuffer *buf)
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
{
}
else {
GST_DEBUG (GST_CAT_DATAFLOW, "no chainhandler\n");
}
}
@ -1958,21 +1958,31 @@ gst_ghost_pad_new (gchar *name,
}
/* pad is the receiving pad */
static void
gst_pad_event_default(GstPad *pad, GstEventType event, guint64 timestamp, guint32 data)
void
gst_pad_event_default (GstPad *pad, GstEvent *event)
{
GST_DEBUG(GST_CAT_EVENT, "default event handler for pad %s:%s\n",GST_DEBUG_PAD_NAME(pad));
switch (event) {
GstElement *element = GST_PAD_PARENT (pad);
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
if (GST_PAD_PARENT(pad)->numsinkpads == 1)
gst_element_signal_eos(GST_PAD_PARENT(pad));
else
GST_DEBUG(GST_CAT_EVENT, "WARNING: no default behavior for EOS with multiple sinkpads\n");
// gst_element_signal_eos (element);
gst_element_set_state (element, GST_STATE_PAUSED);
{
GList *pads = element->pads;
while (pads) {
if (GST_PAD_DIRECTION (pads->data) == GST_PAD_SRC) {
gst_pad_push (GST_PAD (pads->data), GST_BUFFER (gst_event_new (GST_EVENT_TYPE (event))));
}
pads = g_list_next (pads);
}
}
break;
default:
g_warning ("no default handler for event\n");
break;
}
gst_event_free (event);
}
/**

View file

@ -404,6 +404,9 @@ NULL )
#endif
gboolean gst_pad_send_event (GstPad *pad, GstEvent *event);
void gst_pad_event_default (GstPad *pad, GstEvent *event);
GstBuffer* gst_pad_peek (GstPad *pad);
GstPad* gst_pad_select (GList *padlist);