diff options
author | Erik Walthinsen <omega@temple-baptist.org> | 2001-05-25 21:00:07 +0000 |
---|---|---|
committer | Erik Walthinsen <omega@temple-baptist.org> | 2001-05-25 21:00:07 +0000 |
commit | 4a583683e5cdf35d6f059952cbae4416120f8749 (patch) | |
tree | ae6079f992bebb3fb51ac8b97f2a16d8ea0ef64c /gst/gstpad.c | |
parent | 54271eca8ec659e79199f587de00fcbff0dea826 (diff) |
Merged from INCSCHED on 200505251!!!INCSCHED1-200105251
Original commit message from CVS:
Merged from INCSCHED on 200505251!!!
Diffstat (limited to 'gst/gstpad.c')
-rw-r--r-- | gst/gstpad.c | 248 |
1 files changed, 188 insertions, 60 deletions
diff --git a/gst/gstpad.c b/gst/gstpad.c index 48bd1e376..69913d25c 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -27,6 +27,7 @@ #include "gstelement.h" #include "gsttype.h" #include "gstbin.h" +#include "gstscheduler.h" /***** Start with the base GstPad class *****/ @@ -78,6 +79,9 @@ gst_pad_init (GstPad *pad) enum { REAL_SET_ACTIVE, REAL_CAPS_CHANGED, + REAL_CAPS_NEGO_FAILED, + REAL_CONNECTED, + REAL_DISCONNECTED, /* FILL ME */ REAL_LAST_SIGNAL }; @@ -97,7 +101,6 @@ static void gst_real_pad_get_arg (GtkObject *object,GtkArg *arg,guint id); static void gst_real_pad_destroy (GtkObject *object); static void gst_pad_push_func (GstPad *pad, GstBuffer *buf); -static gboolean gst_pad_eos_func (GstPad *pad); static GstPad *real_pad_parent_class = NULL; @@ -144,16 +147,31 @@ gst_real_pad_class_init (GstRealPadClass *klass) GTK_SIGNAL_OFFSET (GstRealPadClass, caps_changed), gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1, GTK_TYPE_POINTER); + gst_real_pad_signals[REAL_CAPS_NEGO_FAILED] = + gtk_signal_new ("caps_nego_failed", GTK_RUN_LAST, gtkobject_class->type, + GTK_SIGNAL_OFFSET (GstRealPadClass, caps_nego_failed), + gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1, + GTK_TYPE_POINTER); + gst_real_pad_signals[REAL_CONNECTED] = + gtk_signal_new ("connected", GTK_RUN_LAST, gtkobject_class->type, + GTK_SIGNAL_OFFSET (GstRealPadClass, connected), + gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1, + GTK_TYPE_POINTER); + gst_real_pad_signals[REAL_DISCONNECTED] = + gtk_signal_new ("disconnected", GTK_RUN_LAST, gtkobject_class->type, + GTK_SIGNAL_OFFSET (GstRealPadClass, disconnected), + gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1, + GTK_TYPE_POINTER); gtk_object_class_add_signals (gtkobject_class, gst_real_pad_signals, REAL_LAST_SIGNAL); gtk_object_add_arg_type ("GstRealPad::active", GTK_TYPE_BOOL, GTK_ARG_READWRITE, REAL_ARG_ACTIVE); - gtkobject_class->destroy = gst_real_pad_destroy; - gtkobject_class->set_arg = gst_real_pad_set_arg; - gtkobject_class->get_arg = gst_real_pad_get_arg; + gtkobject_class->destroy = GST_DEBUG_FUNCPTR(gst_real_pad_destroy); + gtkobject_class->set_arg = GST_DEBUG_FUNCPTR(gst_real_pad_set_arg); + gtkobject_class->get_arg = GST_DEBUG_FUNCPTR(gst_real_pad_get_arg); - gstobject_class->save_thyself = gst_pad_save_thyself; + gstobject_class->save_thyself = GST_DEBUG_FUNCPTR(gst_pad_save_thyself); gstobject_class->path_string_separator = "."; } @@ -167,7 +185,7 @@ gst_real_pad_init (GstRealPad *pad) pad->getfunc = NULL; pad->getregionfunc = NULL; pad->qosfunc = NULL; - pad->eosfunc = gst_pad_eos_func; + pad->eosfunc = GST_DEBUG_FUNCPTR(gst_pad_eos_func); pad->pushfunc = GST_DEBUG_FUNCPTR(gst_pad_push_func); pad->pullfunc = NULL; @@ -260,6 +278,8 @@ gst_pad_new_from_template (GstPadTemplate *templ, g_return_val_if_fail (templ != NULL, NULL); pad = gst_pad_new (name, templ->direction); + gst_object_ref (GST_OBJECT (templ)); + gst_object_sink (GST_OBJECT (templ)); GST_PAD_PADTEMPLATE(pad) = templ; return pad; @@ -330,8 +350,8 @@ void gst_pad_set_chain_function (GstPad *pad, g_return_if_fail (GST_IS_REAL_PAD (pad)); GST_RPAD_CHAINFUNC(pad) = chain; - GST_DEBUG (0,"chainfunc for %s:%s(@%p) at %p is set to %p\n", - GST_DEBUG_PAD_NAME(pad),pad,&GST_RPAD_CHAINFUNC(pad),chain); + GST_DEBUG (GST_CAT_PADS,"chainfunc for %s:%s set to %s\n", + GST_DEBUG_PAD_NAME(pad),GST_DEBUG_FUNCPTR_NAME(chain)); } /** @@ -349,8 +369,8 @@ gst_pad_set_get_function (GstPad *pad, g_return_if_fail (GST_IS_REAL_PAD (pad)); GST_RPAD_GETFUNC(pad) = get; - GST_DEBUG (0,"getfunc for %s:%s(@%p) at %p is set to %p\n", - GST_DEBUG_PAD_NAME(pad),pad,&GST_RPAD_GETFUNC(pad),get); + GST_DEBUG (GST_CAT_PADS,"getfunc for %s:%s set to %s\n", + GST_DEBUG_PAD_NAME(pad),GST_DEBUG_FUNCPTR_NAME(get)); } /** @@ -368,8 +388,8 @@ gst_pad_set_getregion_function (GstPad *pad, g_return_if_fail (GST_IS_REAL_PAD (pad)); GST_RPAD_GETREGIONFUNC(pad) = getregion; - GST_DEBUG (0,"getregionfunc for %s:%s(@%p) at %p is set to %p\n", - GST_DEBUG_PAD_NAME(pad),pad,&GST_RPAD_GETREGIONFUNC(pad),getregion); + GST_DEBUG (GST_CAT_PADS,"getregionfunc for %s:%s set to %s\n", + GST_DEBUG_PAD_NAME(pad),GST_DEBUG_FUNCPTR_NAME(getregion)); } /** @@ -387,8 +407,8 @@ gst_pad_set_qos_function (GstPad *pad, g_return_if_fail (GST_IS_REAL_PAD (pad)); GST_RPAD_QOSFUNC(pad) = qos; - GST_DEBUG (0,"qosfunc for %s:%s(@%p) at %p is set to %p\n", - GST_DEBUG_PAD_NAME(pad),pad,&GST_RPAD_QOSFUNC(pad),qos); + GST_DEBUG (GST_CAT_PADS,"qosfunc for %s:%s set to %s\n", + GST_DEBUG_PAD_NAME(pad),GST_DEBUG_FUNCPTR_NAME(qos)); } /** @@ -406,8 +426,8 @@ gst_pad_set_eos_function (GstPad *pad, g_return_if_fail (GST_IS_REAL_PAD (pad)); GST_RPAD_EOSFUNC(pad) = eos; - GST_DEBUG (0,"eosfunc for %s:%s(@%p) at %p is set to %p\n", - GST_DEBUG_PAD_NAME(pad),pad,&GST_RPAD_EOSFUNC(pad),eos); + GST_DEBUG (GST_CAT_PADS,"eosfunc for %s:%s set to %s\n", + GST_DEBUG_PAD_NAME(pad),GST_DEBUG_FUNCPTR_NAME(eos)); } /** @@ -425,11 +445,10 @@ gst_pad_set_negotiate_function (GstPad *pad, g_return_if_fail (GST_IS_REAL_PAD (pad)); GST_RPAD_NEGOTIATEFUNC(pad) = nego; - GST_DEBUG (0,"negotiatefunc for %s:%s(@%p) at %p is set to %p\n", - GST_DEBUG_PAD_NAME(pad),pad,&GST_RPAD_NEGOTIATEFUNC(pad),nego); + GST_DEBUG (GST_CAT_PADS,"negotiatefunc for %s:%s set to %s\n", + GST_DEBUG_PAD_NAME(pad),GST_DEBUG_FUNCPTR_NAME(nego)); } - /** * gst_pad_set_newcaps_function: * @pad: the pad to set the newcaps function for @@ -445,8 +464,8 @@ gst_pad_set_newcaps_function (GstPad *pad, g_return_if_fail (GST_IS_REAL_PAD (pad)); GST_RPAD_NEWCAPSFUNC (pad) = newcaps; - GST_DEBUG (0,"newcapsfunc for %s:%s(@%p) at %p is set to %p\n", - GST_DEBUG_PAD_NAME(pad),pad,&GST_RPAD_NEWCAPSFUNC(pad),newcaps); + GST_DEBUG (GST_CAT_PADS,"newcapsfunc for %s:%s set to %s\n", + GST_DEBUG_PAD_NAME(pad),GST_DEBUG_FUNCPTR_NAME(newcaps)); } /** @@ -464,18 +483,19 @@ gst_pad_set_bufferpool_function (GstPad *pad, g_return_if_fail (GST_IS_REAL_PAD (pad)); GST_RPAD_BUFFERPOOLFUNC (pad) = bufpool; - GST_DEBUG (0,"bufferpoolfunc for %s:%s(@%p) at %p is set to %p\n", - GST_DEBUG_PAD_NAME (pad), pad, &GST_RPAD_BUFFERPOOLFUNC (pad), bufpool); + GST_DEBUG (GST_CAT_PADS,"bufferpoolfunc for %s:%s set to %s\n", + GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME(bufpool)); } static void gst_pad_push_func(GstPad *pad, GstBuffer *buf) { if (GST_RPAD_CHAINFUNC(GST_RPAD_PEER(pad)) != NULL) { - GST_DEBUG (0,"calling chain function\n"); + GST_DEBUG (GST_CAT_DATAFLOW,"calling chain function %s\n", + GST_DEBUG_FUNCPTR_NAME(GST_RPAD_CHAINFUNC(GST_RPAD_PEER(pad)))); (GST_RPAD_CHAINFUNC(GST_RPAD_PEER(pad)))(pad,buf); } else { - GST_DEBUG (0,"got a problem here: default pad_push handler in place, no chain function\n"); + GST_DEBUG (GST_CAT_DATAFLOW,"got a problem here: default pad_push handler in place, no chain function\n"); } } @@ -495,7 +515,7 @@ gst_pad_handle_qos(GstPad *pad, GList *pads; GstPad *target_pad; - GST_DEBUG (0,"gst_pad_handle_qos(\"%s\",%08ld)\n", GST_OBJECT_NAME (GST_PAD_PARENT (pad)),qos_message); + GST_DEBUG (GST_CAT_PADS,"gst_pad_handle_qos(\"%s\",%08ld)\n", GST_OBJECT_NAME (GST_PAD_PARENT (pad)),qos_message); if (GST_RPAD_QOSFUNC(pad)) { (GST_RPAD_QOSFUNC(pad)) (pad,qos_message); @@ -503,7 +523,7 @@ gst_pad_handle_qos(GstPad *pad, element = GST_ELEMENT (GST_PAD_PARENT(GST_RPAD_PEER(pad))); pads = element->pads; - GST_DEBUG (0,"gst_pad_handle_qos recurse(\"%s\",%08ld)\n", GST_ELEMENT_NAME (element), qos_message); + GST_DEBUG (GST_CAT_PADS,"gst_pad_handle_qos recurse(\"%s\",%08ld)\n", GST_ELEMENT_NAME (element), qos_message); while (pads) { target_pad = GST_PAD (pads->data); if (GST_RPAD_DIRECTION(target_pad) == GST_PAD_SINK) { @@ -535,6 +555,9 @@ gst_pad_disconnect (GstPad *srcpad, g_return_if_fail (sinkpad != NULL); g_return_if_fail (GST_IS_PAD (sinkpad)); + GST_INFO (GST_CAT_ELEMENT_PADS, "disconnecting %s:%s(%p) and %s:%s(%p)", + GST_DEBUG_PAD_NAME(srcpad), srcpad, GST_DEBUG_PAD_NAME(sinkpad), sinkpad); + // now we need to deal with the real/ghost stuff realsrc = GST_PAD_REALIZE(srcpad); realsink = GST_PAD_REALIZE(sinkpad); @@ -542,6 +565,14 @@ gst_pad_disconnect (GstPad *srcpad, g_return_if_fail (GST_RPAD_PEER(realsrc) != NULL); g_return_if_fail (GST_RPAD_PEER(realsink) != NULL); + if ((GST_RPAD_DIRECTION(realsrc) == GST_PAD_SINK) && + (GST_RPAD_DIRECTION(realsink) == GST_PAD_SRC)) { + GstRealPad *temppad; + + temppad = realsrc; + realsrc = realsink; + realsink = temppad; + } g_return_if_fail ((GST_RPAD_DIRECTION(realsrc) == GST_PAD_SRC) && (GST_RPAD_DIRECTION(realsink) == GST_PAD_SINK)); @@ -549,6 +580,16 @@ gst_pad_disconnect (GstPad *srcpad, GST_RPAD_PEER(realsrc) = NULL; GST_RPAD_PEER(realsink) = NULL; + /* fire off a signal to each of the pads telling them that they've been disconnected */ + gtk_signal_emit(GTK_OBJECT(realsrc), gst_real_pad_signals[REAL_DISCONNECTED], realsink); + gtk_signal_emit(GTK_OBJECT(realsink), gst_real_pad_signals[REAL_DISCONNECTED], realsrc); + + // now tell the scheduler + if (realsrc->sched) + GST_SCHEDULE_PAD_DISCONNECT (realsrc->sched, (GstPad *)realsrc, (GstPad *)realsink); +// if (realsink->sched) +// GST_SCHEDULE_PAD_DISCONNECT (realsink->sched, (GstPad *)realsrc, (GstPad *)realsink); + GST_INFO (GST_CAT_ELEMENT_PADS, "disconnected %s:%s and %s:%s", GST_DEBUG_PAD_NAME(srcpad), GST_DEBUG_PAD_NAME(sinkpad)); } @@ -567,7 +608,6 @@ gst_pad_connect (GstPad *srcpad, GstPad *sinkpad) { GstRealPad *realsrc, *realsink; - GstRealPad *temppad; gboolean negotiated = FALSE; /* generic checks */ @@ -576,49 +616,69 @@ gst_pad_connect (GstPad *srcpad, g_return_val_if_fail(sinkpad != NULL, FALSE); g_return_val_if_fail(GST_IS_PAD(sinkpad), FALSE); - GST_INFO (GST_CAT_ELEMENT_PADS, "about to connect %s:%s and %s:%s", + GST_INFO (GST_CAT_PADS, "connecting %s:%s and %s:%s", GST_DEBUG_PAD_NAME(srcpad), GST_DEBUG_PAD_NAME(sinkpad)); // now we need to deal with the real/ghost stuff realsrc = GST_PAD_REALIZE(srcpad); realsink = GST_PAD_REALIZE(sinkpad); + if ((GST_PAD (realsrc) != srcpad) || (GST_PAD (realsink) != sinkpad)) + GST_INFO (GST_CAT_PADS, "*actually* connecting %s:%s and %s:%s", + GST_DEBUG_PAD_NAME(realsrc), GST_DEBUG_PAD_NAME(realsink)); + g_return_val_if_fail(GST_RPAD_PEER(realsrc) == NULL, FALSE); g_return_val_if_fail(GST_RPAD_PEER(realsink) == NULL, FALSE); /* check for reversed directions and swap if necessary */ if ((GST_RPAD_DIRECTION(realsrc) == GST_PAD_SINK) && (GST_RPAD_DIRECTION(realsink) == GST_PAD_SRC)) { + GstRealPad *temppad; + temppad = realsrc; realsrc = realsink; realsink = temppad; } g_return_val_if_fail((GST_RPAD_DIRECTION(realsrc) == GST_PAD_SRC) && - (GST_RPAD_DIRECTION(realsink) == GST_PAD_SINK), FALSE); + (GST_RPAD_DIRECTION(realsink) == GST_PAD_SINK), FALSE); /* first set peers */ GST_RPAD_PEER(realsrc) = realsink; GST_RPAD_PEER(realsink) = realsrc; - /* FIXME: set connected flag */ - - GST_INFO (GST_CAT_ELEMENT_PADS, "connected %s:%s and %s:%s", - GST_DEBUG_PAD_NAME(srcpad), GST_DEBUG_PAD_NAME(sinkpad)); - if (GST_PAD_CAPS (srcpad)) { + GST_DEBUG(GST_CAT_PADS, "renegotiation from srcpad\n"); negotiated = gst_pad_renegotiate (srcpad); } else if (GST_PAD_CAPS (sinkpad)) { + GST_DEBUG(GST_CAT_PADS, "renegotiation from sinkpad\n"); negotiated = gst_pad_renegotiate (sinkpad); } - else + else { + GST_DEBUG(GST_CAT_PADS, "not renegotiating connection\n"); negotiated = TRUE; + } if (!negotiated) { + GST_INFO(GST_CAT_PADS, "pads %s:%s and %s:%s failed to negotiate, disconnecting", + GST_DEBUG_PAD_NAME(srcpad), GST_DEBUG_PAD_NAME(sinkpad)); gst_pad_disconnect (GST_PAD (realsrc), GST_PAD (realsink)); return FALSE; } + + /* fire off a signal to each of the pads telling them that they've been connected */ + gtk_signal_emit(GTK_OBJECT(realsrc), gst_real_pad_signals[REAL_CONNECTED], realsink); + gtk_signal_emit(GTK_OBJECT(realsink), gst_real_pad_signals[REAL_CONNECTED], realsrc); + + // now tell the scheduler(s) + if (realsrc->sched) + GST_SCHEDULE_PAD_CONNECT (realsrc->sched, (GstPad *)realsrc, (GstPad *)realsink); + else if (realsink->sched) + GST_SCHEDULE_PAD_CONNECT (realsink->sched, (GstPad *)realsrc, (GstPad *)realsink); + + GST_INFO (GST_CAT_PADS, "connected %s:%s and %s:%s", + GST_DEBUG_PAD_NAME(srcpad), GST_DEBUG_PAD_NAME(sinkpad)); return TRUE; } @@ -668,13 +728,31 @@ gst_pad_get_padtemplate (GstPad *pad) * * Returns: the parent object */ -GstObject* +GstElement* gst_pad_get_parent (GstPad *pad) { g_return_val_if_fail (pad != NULL, NULL); g_return_val_if_fail (GST_IS_PAD (pad), NULL); - return GST_OBJECT_PARENT (pad); + return GST_PAD_PARENT (pad); +} + +void +gst_pad_set_sched (GstPad *pad, GstSchedule *sched) +{ + g_return_if_fail (pad != NULL); + g_return_if_fail (GST_IS_PAD (pad)); + + GST_RPAD_SCHED(pad) = sched; +} + +GstSchedule* +gst_pad_get_sched (GstPad *pad) +{ + g_return_val_if_fail (pad != NULL, NULL); + g_return_val_if_fail (GST_IS_PAD (pad), NULL); + + return GST_RPAD_SCHED(pad); } /** @@ -687,7 +765,7 @@ gst_pad_get_parent (GstPad *pad) * * Returns: the parent object */ -GstObject* +GstElement* gst_pad_get_real_parent (GstPad *pad) { g_return_val_if_fail (pad != NULL, NULL); @@ -892,7 +970,7 @@ gst_pad_check_compatibility (GstPad *srcpad, GstPad *sinkpad) } } else { - GST_DEBUG (0,"gstpad: could not check capabilities of pads (%s:%s) and (%s:%s) %p %p\n", + GST_DEBUG (GST_CAT_PADS,"could not check capabilities of pads (%s:%s) and (%s:%s) %p %p\n", GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad), GST_PAD_CAPS (srcpad), GST_PAD_CAPS (sinkpad)); return TRUE; @@ -940,25 +1018,51 @@ gst_pad_get_bufferpool (GstPad *pad) GST_DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad)); if (peer->bufferpoolfunc) { - GST_DEBUG (0,"calling bufferpoolfunc &%s (@%p) of peer pad %s:%s\n", + GST_DEBUG (GST_CAT_PADS,"calling bufferpoolfunc &%s (@%p) of peer pad %s:%s\n", GST_DEBUG_FUNCPTR_NAME(peer->bufferpoolfunc),&peer->bufferpoolfunc,GST_DEBUG_PAD_NAME(((GstPad*)peer))); return (peer->bufferpoolfunc)(((GstPad*)peer)); } else { - GST_DEBUG (0,"no bufferpoolfunc for peer pad %s:%s at %p\n",GST_DEBUG_PAD_NAME(((GstPad*)peer)),&peer->bufferpoolfunc); + GST_DEBUG (GST_CAT_PADS,"no bufferpoolfunc for peer pad %s:%s at %p\n",GST_DEBUG_PAD_NAME(((GstPad*)peer)),&peer->bufferpoolfunc); return NULL; } } - -// FIXME this needs to be rethought soon static void gst_real_pad_destroy (GtkObject *object) { GstPad *pad = GST_PAD (object); -// g_print("in gst_pad_real_destroy()\n"); + GST_DEBUG (GST_CAT_REFCOUNTING, "destroy %s:%s\n", GST_DEBUG_PAD_NAME(pad)); + + if (GST_PAD (pad)->padtemplate) + gst_object_unref (GST_OBJECT (GST_PAD (pad)->padtemplate)); - g_list_free (GST_REAL_PAD(pad)->ghostpads); + if (GST_PAD_PEER (pad)) + gst_pad_disconnect (pad, GST_PAD (GST_PAD_PEER (pad))); + + if (GST_IS_ELEMENT (GST_OBJECT_PARENT (pad))) + gst_element_remove_pad (GST_ELEMENT (GST_OBJECT_PARENT (pad)), pad); + + // FIXME we should destroy the ghostpads, because they are nothing without the real pad + if (GST_REAL_PAD (pad)->ghostpads) { + GList *orig, *ghostpads; + + orig = ghostpads = g_list_copy (GST_REAL_PAD (pad)->ghostpads); + + while (ghostpads) { + GstPad *ghostpad = GST_PAD (ghostpads->data); + + if (GST_IS_ELEMENT (GST_OBJECT_PARENT (ghostpad))) + gst_element_remove_pad (GST_ELEMENT (GST_OBJECT_PARENT (ghostpad)), ghostpad); + + ghostpads = g_list_next (ghostpads); + } + g_list_free (orig); + g_list_free (GST_REAL_PAD(pad)->ghostpads); + } + + if (GTK_OBJECT_CLASS (real_pad_parent_class)->destroy) + GTK_OBJECT_CLASS (real_pad_parent_class)->destroy (object); } @@ -1170,9 +1274,22 @@ gst_pad_renegotiate (GstPad *pad) result = gst_pad_renegotiate_func (GST_PAD (currentpad), &data1, GST_PAD (otherpad), &data2, &newcaps); + if (!result) { + GST_DEBUG (GST_CAT_NEGOTIATION, "firing caps_nego_failed signal on %s:%s and %s:%s to give it a chance to succeed\n", + GST_DEBUG_PAD_NAME(currentpad),GST_DEBUG_PAD_NAME(otherpad)); + gtk_signal_emit (GTK_OBJECT(currentpad), + gst_real_pad_signals[REAL_CAPS_NEGO_FAILED],&result); + gtk_signal_emit (GTK_OBJECT(otherpad), + gst_real_pad_signals[REAL_CAPS_NEGO_FAILED],&result); + if (result) + GST_DEBUG (GST_CAT_NEGOTIATION, "caps_nego_failed handler claims success at renego, believing\n"); + } + if (result) { GST_DEBUG (GST_CAT_NEGOTIATION, "pads aggreed on caps :)\n"); + newcaps = GST_PAD_CAPS (pad); + /* here we have some sort of aggreement of the caps */ GST_PAD_CAPS (currentpad) = gst_caps_ref (newcaps); if (GST_RPAD_NEWCAPSFUNC (currentpad)) @@ -1181,6 +1298,13 @@ gst_pad_renegotiate (GstPad *pad) GST_PAD_CAPS (otherpad) = gst_caps_ref (newcaps); if (GST_RPAD_NEWCAPSFUNC (otherpad)) GST_RPAD_NEWCAPSFUNC (otherpad) (GST_PAD (otherpad), newcaps); + + GST_DEBUG (GST_CAT_NEGOTIATION, "firing caps_changed signal on %s:%s and %s:%s\n", + GST_DEBUG_PAD_NAME(currentpad),GST_DEBUG_PAD_NAME(otherpad)); + gtk_signal_emit (GTK_OBJECT(currentpad), + gst_real_pad_signals[REAL_CAPS_CHANGED],GST_PAD_CAPS(currentpad)); + gtk_signal_emit (GTK_OBJECT(otherpad), + gst_real_pad_signals[REAL_CAPS_CHANGED],GST_PAD_CAPS(otherpad)); } return result; @@ -1313,16 +1437,16 @@ gst_pad_push (GstPad *pad, GstBuffer *buf) { GstRealPad *peer = GST_RPAD_PEER (pad); - g_return_if_fail (peer != NULL); - GST_DEBUG_ENTER ("(%s:%s)", GST_DEBUG_PAD_NAME (pad)); + + g_return_if_fail (peer != NULL); if (peer->pushfunc) { - GST_DEBUG (0, "calling pushfunc &%s of peer pad %s:%s\n", + 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); } else - GST_DEBUG (0, "no pushfunc\n"); + GST_DEBUG (GST_CAT_DATAFLOW, "no pushfunc\n"); } #endif @@ -1340,16 +1464,16 @@ gst_pad_pull (GstPad *pad) { GstRealPad *peer = GST_RPAD_PEER(pad); - g_return_val_if_fail (peer != NULL, NULL); - GST_DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad)); + g_return_val_if_fail (peer != NULL, NULL); + if (peer->pullfunc) { - GST_DEBUG (0,"calling pullfunc &%s (@%p) of peer pad %s:%s\n", - GST_DEBUG_FUNCPTR_NAME(peer->pullfunc),&peer->pullfunc,GST_DEBUG_PAD_NAME(((GstPad*)peer))); + 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)); } else { - GST_DEBUG (0,"no pullfunc for peer pad %s:%s at %p\n",GST_DEBUG_PAD_NAME(((GstPad*)peer)),&peer->pullfunc); + GST_DEBUG (GST_CAT_DATAFLOW,"no pullfunc for peer pad %s:%s at %p\n",GST_DEBUG_PAD_NAME(((GstPad*)peer)),&peer->pullfunc); return NULL; } } @@ -1380,11 +1504,11 @@ gst_pad_pullregion (GstPad *pad, GstRegionType type, guint64 offset, guint64 len GST_DEBUG_ENTER("(%s:%s,%d,%lld,%lld)",GST_DEBUG_PAD_NAME(pad),type,offset,len); if (peer->pullregionfunc) { - GST_DEBUG (0,"calling pullregionfunc &%s of peer pad %s:%s\n", + GST_DEBUG (GST_CAT_DATAFLOW,"calling pullregionfunc &%s of peer pad %s:%s\n", GST_DEBUG_FUNCPTR_NAME(peer->pullregionfunc),GST_DEBUG_PAD_NAME(((GstPad*)peer))); return (peer->pullregionfunc)(((GstPad*)peer),type,offset,len); } else { - GST_DEBUG (0,"no pullregionfunc\n"); + GST_DEBUG (GST_CAT_DATAFLOW,"no pullregionfunc\n"); return NULL; } } @@ -1528,7 +1652,7 @@ gst_padtemplate_save_thyself (GstPadTemplate *templ, xmlNodePtr parent) xmlNodePtr subtree; guchar *presence; - GST_DEBUG (0,"saving padtemplate %s\n", templ->name_template); + GST_DEBUG (GST_CAT_XML,"saving padtemplate %s\n", templ->name_template); xmlNewChild(parent,NULL,"nametemplate", templ->name_template); xmlNewChild(parent,NULL,"direction", (templ->direction == GST_PAD_SINK? "sink":"src")); @@ -1616,7 +1740,7 @@ gst_padtemplate_load_thyself (xmlNodePtr parent) } -static gboolean +gboolean gst_pad_eos_func(GstPad *pad) { GstElement *element; @@ -1649,6 +1773,8 @@ gst_pad_eos_func(GstPad *pad) GST_INFO (GST_CAT_PADS,"set EOS on sink pad %s:%s",GST_DEBUG_PAD_NAME(pad)); GST_FLAG_SET (pad, GST_PAD_EOS); + gst_element_set_state (GST_ELEMENT(GST_PAD_PARENT(pad)), GST_STATE_READY); + return TRUE; } @@ -1676,6 +1802,8 @@ gst_pad_set_eos(GstPad *pad) GST_INFO (GST_CAT_PADS,"set EOS on src pad %s:%s",GST_DEBUG_PAD_NAME(pad)); GST_FLAG_SET (pad, GST_PAD_EOS); + gst_element_set_state (GST_ELEMENT(GST_PAD_PARENT(pad)), GST_STATE_READY); + gst_element_signal_eos (GST_ELEMENT (GST_PAD_PARENT (pad))); return TRUE; @@ -1783,7 +1911,7 @@ gst_ghost_pad_new (gchar *name, // FIXME need to ref the real pad here... ? - GST_DEBUG(0,"created ghost pad \"%s\"\n",name); + GST_DEBUG(GST_CAT_PADS,"created ghost pad \"%s\"\n",name); return GST_PAD(ghostpad); } |