gst/: allow probes to work on ghost pads by realizing the pad probe debugging

Original commit message from CVS:

* gst/gstpad.h:
* gst/gstprobe.c:
allow probes to work on ghost pads by realizing the pad
probe debugging
This commit is contained in:
Thomas Vander Stichele 2005-01-13 15:29:40 +00:00
parent bbf6413bdf
commit 805ecd1f81
3 changed files with 86 additions and 65 deletions

View file

@ -1,3 +1,10 @@
2005-01-13 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/gstpad.h:
* gst/gstprobe.c:
allow probes to work on ghost pads by realizing the pad
probe debugging
2005-01-11 Ronald S. Bultje <rbultje@ronald.bitfreak.net> 2005-01-11 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* docs/gst/gstreamer-sections.txt: * docs/gst/gstreamer-sections.txt:

View file

@ -492,9 +492,9 @@ gboolean gst_pad_dispatcher (GstPad *pad, GstPadDispatcherFunction dispatch
gpointer data); gpointer data);
#define gst_pad_add_probe(pad, probe) \ #define gst_pad_add_probe(pad, probe) \
(gst_probe_dispatcher_add_probe (&(GST_REAL_PAD (pad)->probedisp), probe)) (gst_probe_dispatcher_add_probe (&(GST_PAD_REALIZE (pad)->probedisp), probe))
#define gst_pad_remove_probe(pad, probe) \ #define gst_pad_remove_probe(pad, probe) \
(gst_probe_dispatcher_remove_probe (&(GST_REAL_PAD (pad)->probedisp), probe)) (gst_probe_dispatcher_remove_probe (&(GST_PAD_REALIZE (pad)->probedisp), probe))
#ifndef GST_DISABLE_LOADSAVE #ifndef GST_DISABLE_LOADSAVE
void gst_pad_load_and_link (xmlNodePtr self, GstObject *parent); void gst_pad_load_and_link (xmlNodePtr self, GstObject *parent);
@ -527,8 +527,6 @@ xmlNodePtr gst_ghost_pad_save_thyself (GstPad *pad,
void gst_pad_call_chain_function (GstPad *pad, GstData *data); void gst_pad_call_chain_function (GstPad *pad, GstData *data);
GstData * gst_pad_call_get_function (GstPad *pad); GstData * gst_pad_call_get_function (GstPad *pad);
G_END_DECLS G_END_DECLS
#endif /* __GST_PAD_H__ */ #endif /* __GST_PAD_H__ */

View file

@ -23,6 +23,9 @@
#include "gst_private.h" #include "gst_private.h"
#include "gstprobe.h" #include "gstprobe.h"
GST_DEBUG_CATEGORY_STATIC (debug_probe);
#define GST_CAT_DEFAULT debug_probe
static GstProbe * static GstProbe *
_gst_probe_copy (const GstProbe * src) _gst_probe_copy (const GstProbe * src)
{ {
@ -37,9 +40,12 @@ gst_probe_get_type (void)
if (!gst_probe_type) { if (!gst_probe_type) {
gst_probe_type = g_boxed_type_register_static ("GstProbe", gst_probe_type = g_boxed_type_register_static ("GstProbe",
(GBoxedCopyFunc) _gst_probe_copy, (GBoxedFreeFunc) gst_probe_destroy); (GBoxedCopyFunc) _gst_probe_copy, (GBoxedFreeFunc) gst_probe_destroy);
GST_DEBUG_CATEGORY_INIT (debug_probe, "GST_PROBE",
GST_DEBUG_BOLD | GST_DEBUG_FG_GREEN, "pad probes");
} }
return gst_probe_type; return gst_probe_type;
} }
/** /**
@ -66,6 +72,8 @@ gst_probe_new (gboolean single_shot,
probe->callback = callback; probe->callback = callback;
probe->user_data = user_data; probe->user_data = user_data;
GST_DEBUG ("created probe %p", probe);
return probe; return probe;
} }
@ -103,6 +111,8 @@ gst_probe_perform (GstProbe * probe, GstData ** data)
g_return_val_if_fail (probe, res); g_return_val_if_fail (probe, res);
GST_DEBUG ("performing probe %p", probe);
if (probe->callback) if (probe->callback)
res = probe->callback (probe, data, probe->user_data); res = probe->callback (probe, data, probe->user_data);
@ -193,6 +203,8 @@ gst_probe_dispatcher_add_probe (GstProbeDispatcher * disp, GstProbe * probe)
g_return_if_fail (disp); g_return_if_fail (disp);
g_return_if_fail (probe); g_return_if_fail (probe);
GST_DEBUG ("adding probe %p to dispatcher %p", probe, disp);
disp->probes = g_slist_prepend (disp->probes, probe); disp->probes = g_slist_prepend (disp->probes, probe);
} }
@ -209,6 +221,8 @@ gst_probe_dispatcher_remove_probe (GstProbeDispatcher * disp, GstProbe * probe)
g_return_if_fail (disp); g_return_if_fail (disp);
g_return_if_fail (probe); g_return_if_fail (probe);
GST_DEBUG ("removing probe %p from dispatcher %p", probe, disp);
disp->probes = g_slist_remove (disp->probes, probe); disp->probes = g_slist_remove (disp->probes, probe);
} }
@ -229,6 +243,8 @@ gst_probe_dispatcher_dispatch (GstProbeDispatcher * disp, GstData ** data)
g_return_val_if_fail (disp, res); g_return_val_if_fail (disp, res);
GST_DEBUG ("dispatching data %p on dispatcher %p", *data, disp);
walk = disp->probes; walk = disp->probes;
while (walk) { while (walk) {
GstProbe *probe = (GstProbe *) walk->data; GstProbe *probe = (GstProbe *) walk->data;