mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
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:
parent
bbf6413bdf
commit
805ecd1f81
3 changed files with 86 additions and 65 deletions
|
@ -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>
|
||||
|
||||
* docs/gst/gstreamer-sections.txt:
|
||||
|
|
128
gst/gstpad.h
128
gst/gstpad.h
|
@ -40,10 +40,10 @@ GST_EXPORT GType _gst_pad_type;
|
|||
GST_EXPORT GType _gst_real_pad_type;
|
||||
GST_EXPORT GType _gst_ghost_pad_type;
|
||||
|
||||
/*
|
||||
/*
|
||||
* Pad base class
|
||||
*/
|
||||
#define GST_TYPE_PAD (_gst_pad_type)
|
||||
#define GST_TYPE_PAD (_gst_pad_type)
|
||||
#define GST_IS_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD))
|
||||
#define GST_IS_PAD_FAST(obj) (G_OBJECT_TYPE(obj) == GST_TYPE_REAL_PAD || \
|
||||
G_OBJECT_TYPE(obj) == GST_TYPE_GHOST_PAD)
|
||||
|
@ -51,7 +51,7 @@ GST_EXPORT GType _gst_ghost_pad_type;
|
|||
#define GST_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD, GstPad))
|
||||
#define GST_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD, GstPadClass))
|
||||
|
||||
/*
|
||||
/*
|
||||
* Real Pads
|
||||
*/
|
||||
#define GST_TYPE_REAL_PAD (_gst_real_pad_type)
|
||||
|
@ -61,7 +61,7 @@ GST_EXPORT GType _gst_ghost_pad_type;
|
|||
#define GST_REAL_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_REAL_PAD, GstRealPad))
|
||||
#define GST_REAL_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_REAL_PAD, GstRealPadClass))
|
||||
|
||||
/*
|
||||
/*
|
||||
* Ghost Pads
|
||||
*/
|
||||
#define GST_TYPE_GHOST_PAD (_gst_ghost_pad_type)
|
||||
|
@ -97,39 +97,39 @@ typedef enum {
|
|||
#ifndef GST_DISABLE_DEPRECATED
|
||||
#ifdef G_HAVE_ISO_VARARGS
|
||||
#define GST_PAD_QUERY_TYPE_FUNCTION(functionname, ...) GST_QUERY_TYPE_FUNCTION (GstPad *, functionname, __VA_ARGS__);
|
||||
#define GST_PAD_FORMATS_FUNCTION(functionname, ...) GST_FORMATS_FUNCTION (GstPad *, functionname, __VA_ARGS__);
|
||||
#define GST_PAD_EVENT_MASK_FUNCTION(functionname, ...) GST_EVENT_MASK_FUNCTION (GstPad *, functionname, __VA_ARGS__);
|
||||
#define GST_PAD_FORMATS_FUNCTION(functionname, ...) GST_FORMATS_FUNCTION (GstPad *, functionname, __VA_ARGS__);
|
||||
#define GST_PAD_EVENT_MASK_FUNCTION(functionname, ...) GST_EVENT_MASK_FUNCTION (GstPad *, functionname, __VA_ARGS__);
|
||||
#elif defined(G_HAVE_GNUC_VARARGS)
|
||||
#define GST_PAD_QUERY_TYPE_FUNCTION(functionname, a...) GST_QUERY_TYPE_FUNCTION (GstPad *, functionname, a);
|
||||
#define GST_PAD_FORMATS_FUNCTION(functionname, a...) GST_FORMATS_FUNCTION (GstPad *, functionname, a);
|
||||
#define GST_PAD_FORMATS_FUNCTION(functionname, a...) GST_FORMATS_FUNCTION (GstPad *, functionname, a);
|
||||
#define GST_PAD_EVENT_MASK_FUNCTION(functionname, a...) GST_EVENT_MASK_FUNCTION (GstPad *, functionname, a);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* this defines the functions used to chain buffers
|
||||
* pad is the sink pad (so the same chain function can be used for N pads)
|
||||
* buf is the buffer being passed */
|
||||
typedef void (*GstPadChainFunction) (GstPad *pad,GstData *data);
|
||||
typedef GstData* (*GstPadGetFunction) (GstPad *pad);
|
||||
typedef void (*GstPadChainFunction) (GstPad *pad,GstData *data);
|
||||
typedef GstData* (*GstPadGetFunction) (GstPad *pad);
|
||||
typedef gboolean (*GstPadEventFunction) (GstPad *pad, GstEvent *event);
|
||||
typedef gboolean (*GstPadConvertFunction) (GstPad *pad,
|
||||
GstFormat src_format, gint64 src_value,
|
||||
typedef gboolean (*GstPadConvertFunction) (GstPad *pad,
|
||||
GstFormat src_format, gint64 src_value,
|
||||
GstFormat *dest_format, gint64 *dest_value);
|
||||
typedef gboolean (*GstPadQueryFunction) (GstPad *pad, GstQueryType type,
|
||||
GstFormat *format, gint64 *value);
|
||||
GstFormat *format, gint64 *value);
|
||||
typedef GList* (*GstPadIntLinkFunction) (GstPad *pad);
|
||||
typedef const GstFormat* (*GstPadFormatsFunction) (GstPad *pad);
|
||||
typedef const GstEventMask* (*GstPadEventMaskFunction) (GstPad *pad);
|
||||
typedef const GstQueryType* (*GstPadQueryTypeFunction) (GstPad *pad);
|
||||
|
||||
typedef GstPadLinkReturn (*GstPadLinkFunction) (GstPad *pad, const GstCaps *caps);
|
||||
typedef void (*GstPadUnlinkFunction) (GstPad *pad);
|
||||
typedef GstCaps* (*GstPadGetCapsFunction) (GstPad *pad);
|
||||
typedef GstCaps* (*GstPadFixateFunction) (GstPad *pad, const GstCaps *caps);
|
||||
typedef GstBuffer* (*GstPadBufferAllocFunction) (GstPad *pad, guint64 offset, guint size);
|
||||
typedef GstPadLinkReturn (*GstPadLinkFunction) (GstPad *pad, const GstCaps *caps);
|
||||
typedef void (*GstPadUnlinkFunction) (GstPad *pad);
|
||||
typedef GstCaps* (*GstPadGetCapsFunction) (GstPad *pad);
|
||||
typedef GstCaps* (*GstPadFixateFunction) (GstPad *pad, const GstCaps *caps);
|
||||
typedef GstBuffer* (*GstPadBufferAllocFunction) (GstPad *pad, guint64 offset, guint size);
|
||||
|
||||
typedef gboolean (*GstPadDispatcherFunction) (GstPad *pad, gpointer data);
|
||||
typedef gboolean (*GstPadDispatcherFunction) (GstPad *pad, gpointer data);
|
||||
|
||||
typedef enum {
|
||||
GST_PAD_UNKNOWN,
|
||||
|
@ -146,11 +146,11 @@ typedef enum {
|
|||
} GstPadFlags;
|
||||
|
||||
struct _GstPad {
|
||||
GstObject object;
|
||||
GstObject object;
|
||||
|
||||
gpointer element_private;
|
||||
gpointer element_private;
|
||||
|
||||
GstPadTemplate *padtemplate; /* the template for this pad */
|
||||
GstPadTemplate *padtemplate; /* the template for this pad */
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
@ -162,33 +162,33 @@ struct _GstPadClass {
|
|||
};
|
||||
|
||||
struct _GstRealPad {
|
||||
GstPad pad;
|
||||
GstPad pad;
|
||||
|
||||
/* the pad capabilities */
|
||||
GstCaps *caps;
|
||||
GstCaps *caps;
|
||||
GstPadFixateFunction appfixatefunc;
|
||||
GstCaps *appfilter;
|
||||
GstPadGetCapsFunction getcapsfunc;
|
||||
GstCaps *appfilter;
|
||||
GstPadGetCapsFunction getcapsfunc;
|
||||
GstPadFixateFunction fixatefunc;
|
||||
|
||||
GstPadDirection direction;
|
||||
|
||||
GstPadLinkFunction linkfunc;
|
||||
GstPadUnlinkFunction unlinkfunc;
|
||||
GstRealPad *peer;
|
||||
GstPadDirection direction;
|
||||
|
||||
gpointer sched_private;
|
||||
GstPadLinkFunction linkfunc;
|
||||
GstPadUnlinkFunction unlinkfunc;
|
||||
GstRealPad *peer;
|
||||
|
||||
gpointer sched_private;
|
||||
|
||||
/* data transport functions */
|
||||
GstPadChainFunction chainfunc;
|
||||
GstPadChainFunction chainhandler;
|
||||
GstPadGetFunction getfunc;
|
||||
GstPadChainFunction chainfunc;
|
||||
GstPadChainFunction chainhandler;
|
||||
GstPadGetFunction getfunc;
|
||||
GstPadGetFunction gethandler;
|
||||
GstPadEventFunction eventfunc;
|
||||
GstPadEventFunction eventhandler;
|
||||
GstPadEventMaskFunction eventmaskfunc;
|
||||
|
||||
GList *ghostpads;
|
||||
GList *ghostpads;
|
||||
|
||||
/* query/convert/formats functions */
|
||||
GstPadConvertFunction convertfunc;
|
||||
|
@ -199,7 +199,7 @@ struct _GstRealPad {
|
|||
|
||||
GstPadBufferAllocFunction bufferallocfunc;
|
||||
|
||||
GstProbeDispatcher probedisp;
|
||||
GstProbeDispatcher probedisp;
|
||||
|
||||
GstPadLink *link;
|
||||
GstCaps *explicit_caps;
|
||||
|
@ -208,13 +208,13 @@ struct _GstRealPad {
|
|||
};
|
||||
|
||||
struct _GstRealPadClass {
|
||||
GstPadClass parent_class;
|
||||
GstPadClass parent_class;
|
||||
|
||||
/* signal callbacks */
|
||||
void (*caps_nego_failed) (GstPad *pad, GstCaps *caps);
|
||||
|
||||
void (*linked) (GstPad *pad, GstPad *peer);
|
||||
void (*unlinked) (GstPad *pad, GstPad *peer);
|
||||
void (*linked) (GstPad *pad, GstPad *peer);
|
||||
void (*unlinked) (GstPad *pad, GstPad *peer);
|
||||
GstPadFixateFunction appfixatefunc;
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
|
@ -399,12 +399,12 @@ G_CONST_RETURN GstEventMask*
|
|||
|
||||
/* pad links */
|
||||
void gst_pad_set_link_function (GstPad *pad, GstPadLinkFunction link);
|
||||
gboolean gst_pad_can_link (GstPad *srcpad, GstPad *sinkpad);
|
||||
gboolean gst_pad_can_link_filtered (GstPad *srcpad, GstPad *sinkpad, const GstCaps *filtercaps);
|
||||
gboolean gst_pad_can_link (GstPad *srcpad, GstPad *sinkpad);
|
||||
gboolean gst_pad_can_link_filtered (GstPad *srcpad, GstPad *sinkpad, const GstCaps *filtercaps);
|
||||
void gst_pad_set_unlink_function (GstPad *pad, GstPadUnlinkFunction unlink);
|
||||
|
||||
gboolean gst_pad_link (GstPad *srcpad, GstPad *sinkpad);
|
||||
gboolean gst_pad_link_filtered (GstPad *srcpad, GstPad *sinkpad, const GstCaps *filtercaps);
|
||||
gboolean gst_pad_link (GstPad *srcpad, GstPad *sinkpad);
|
||||
gboolean gst_pad_link_filtered (GstPad *srcpad, GstPad *sinkpad, const GstCaps *filtercaps);
|
||||
void gst_pad_unlink (GstPad *srcpad, GstPad *sinkpad);
|
||||
gboolean gst_pad_is_linked (GstPad *pad);
|
||||
|
||||
|
@ -421,11 +421,11 @@ gboolean gst_pad_check_compatibility (GstPad *srcpad, GstPad *sinkpad);
|
|||
|
||||
void gst_pad_set_getcaps_function (GstPad *pad, GstPadGetCapsFunction getcaps);
|
||||
void gst_pad_set_fixate_function (GstPad *pad, GstPadFixateFunction fixate);
|
||||
GstCaps * gst_pad_proxy_getcaps (GstPad *pad);
|
||||
GstCaps * gst_pad_proxy_getcaps (GstPad *pad);
|
||||
GstPadLinkReturn gst_pad_proxy_pad_link (GstPad *pad, const GstCaps *caps);
|
||||
GstCaps * gst_pad_proxy_fixate (GstPad *pad, const GstCaps *caps);
|
||||
#ifndef GST_DISABLE_DEPRECATED
|
||||
GstPadLinkReturn gst_pad_proxy_link (GstPad *pad, const GstCaps *caps);
|
||||
GstPadLinkReturn gst_pad_proxy_link (GstPad *pad, const GstCaps *caps);
|
||||
#endif
|
||||
gboolean gst_pad_set_explicit_caps (GstPad *pad, const GstCaps *caps);
|
||||
void gst_pad_use_explicit_caps (GstPad *pad);
|
||||
|
@ -436,10 +436,10 @@ gboolean gst_pad_perform_negotiate (GstPad *srcpad, GstPad *sinkpad);
|
|||
GstPadLinkReturn gst_pad_renegotiate (GstPad *pad);
|
||||
void gst_pad_unnegotiate (GstPad *pad);
|
||||
gboolean gst_pad_try_relink_filtered (GstPad *srcpad, GstPad *sinkpad, const GstCaps *filtercaps);
|
||||
GstCaps* gst_pad_get_allowed_caps (GstPad *pad);
|
||||
GstCaps* gst_pad_get_allowed_caps (GstPad *pad);
|
||||
void gst_pad_caps_change_notify (GstPad *pad);
|
||||
|
||||
gboolean gst_pad_recover_caps_error (GstPad *pad, const GstCaps *allowed);
|
||||
gboolean gst_pad_recover_caps_error (GstPad *pad, const GstCaps *allowed);
|
||||
|
||||
/* data passing functions */
|
||||
void gst_pad_push (GstPad *pad, GstData *data);
|
||||
|
@ -457,7 +457,7 @@ GstData * gst_pad_collect (GstPad **selected, GstPad *pad, ...);
|
|||
GstData * gst_pad_collect_valist (GstPad **selected, GstPad *pad, va_list varargs);
|
||||
|
||||
/* convert/query/format functions */
|
||||
void gst_pad_set_formats_function (GstPad *pad,
|
||||
void gst_pad_set_formats_function (GstPad *pad,
|
||||
GstPadFormatsFunction formats);
|
||||
G_CONST_RETURN GstFormat*
|
||||
gst_pad_get_formats (GstPad *pad);
|
||||
|
@ -465,11 +465,11 @@ G_CONST_RETURN GstFormat*
|
|||
gst_pad_get_formats_default (GstPad *pad);
|
||||
|
||||
void gst_pad_set_convert_function (GstPad *pad, GstPadConvertFunction convert);
|
||||
gboolean gst_pad_convert (GstPad *pad,
|
||||
GstFormat src_format, gint64 src_value,
|
||||
gboolean gst_pad_convert (GstPad *pad,
|
||||
GstFormat src_format, gint64 src_value,
|
||||
GstFormat *dest_format, gint64 *dest_value);
|
||||
gboolean gst_pad_convert_default (GstPad *pad,
|
||||
GstFormat src_format, gint64 src_value,
|
||||
gboolean gst_pad_convert_default (GstPad *pad,
|
||||
GstFormat src_format, gint64 src_value,
|
||||
GstFormat *dest_format, gint64 *dest_value);
|
||||
|
||||
void gst_pad_set_query_function (GstPad *pad, GstPadQueryFunction query);
|
||||
|
@ -480,21 +480,21 @@ G_CONST_RETURN GstQueryType*
|
|||
gst_pad_get_query_types_default (GstPad *pad);
|
||||
gboolean gst_pad_query (GstPad *pad, GstQueryType type,
|
||||
GstFormat *format, gint64 *value);
|
||||
gboolean gst_pad_query_default (GstPad *pad, GstQueryType type,
|
||||
GstFormat *format, gint64 *value);
|
||||
gboolean gst_pad_query_default (GstPad *pad, GstQueryType type,
|
||||
GstFormat *format, gint64 *value);
|
||||
|
||||
void gst_pad_set_internal_link_function (GstPad *pad, GstPadIntLinkFunction intlink);
|
||||
GList* gst_pad_get_internal_links (GstPad *pad);
|
||||
GList* gst_pad_get_internal_links_default (GstPad *pad);
|
||||
|
||||
GList* gst_pad_get_internal_links_default (GstPad *pad);
|
||||
|
||||
/* misc helper functions */
|
||||
gboolean gst_pad_dispatcher (GstPad *pad, GstPadDispatcherFunction dispatch,
|
||||
gboolean gst_pad_dispatcher (GstPad *pad, GstPadDispatcherFunction dispatch,
|
||||
gpointer data);
|
||||
|
||||
#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) \
|
||||
(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
|
||||
void gst_pad_load_and_link (xmlNodePtr self, GstObject *parent);
|
||||
|
@ -509,7 +509,7 @@ GstPad* gst_ghost_pad_new (const gchar *name, GstPad *pad);
|
|||
GType gst_pad_template_get_type (void);
|
||||
|
||||
GstPadTemplate* gst_pad_template_new (const gchar *name_template,
|
||||
GstPadDirection direction, GstPadPresence presence,
|
||||
GstPadDirection direction, GstPadPresence presence,
|
||||
GstCaps *caps);
|
||||
|
||||
GstPadTemplate * gst_static_pad_template_get (GstStaticPadTemplate *pad_template);
|
||||
|
@ -519,16 +519,14 @@ const GstCaps* gst_pad_template_get_caps_by_name (GstPadTemplate *templ, const
|
|||
#endif
|
||||
|
||||
#ifndef GST_DISABLE_LOADSAVE
|
||||
xmlNodePtr gst_ghost_pad_save_thyself (GstPad *pad,
|
||||
xmlNodePtr parent);
|
||||
xmlNodePtr gst_ghost_pad_save_thyself (GstPad *pad,
|
||||
xmlNodePtr parent);
|
||||
#endif
|
||||
|
||||
/* for schedulers only */
|
||||
void gst_pad_call_chain_function (GstPad *pad, GstData *data);
|
||||
GstData * gst_pad_call_get_function (GstPad *pad);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
#endif /* __GST_PAD_H__ */
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
#include "gst_private.h"
|
||||
#include "gstprobe.h"
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (debug_probe);
|
||||
#define GST_CAT_DEFAULT debug_probe
|
||||
|
||||
static GstProbe *
|
||||
_gst_probe_copy (const GstProbe * src)
|
||||
{
|
||||
|
@ -37,9 +40,12 @@ gst_probe_get_type (void)
|
|||
if (!gst_probe_type) {
|
||||
gst_probe_type = g_boxed_type_register_static ("GstProbe",
|
||||
(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;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,6 +72,8 @@ gst_probe_new (gboolean single_shot,
|
|||
probe->callback = callback;
|
||||
probe->user_data = user_data;
|
||||
|
||||
GST_DEBUG ("created probe %p", probe);
|
||||
|
||||
return probe;
|
||||
}
|
||||
|
||||
|
@ -103,6 +111,8 @@ gst_probe_perform (GstProbe * probe, GstData ** data)
|
|||
|
||||
g_return_val_if_fail (probe, res);
|
||||
|
||||
GST_DEBUG ("performing probe %p", probe);
|
||||
|
||||
if (probe->callback)
|
||||
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 (probe);
|
||||
|
||||
GST_DEBUG ("adding probe %p to dispatcher %p", probe, disp);
|
||||
|
||||
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 (probe);
|
||||
|
||||
GST_DEBUG ("removing probe %p from dispatcher %p", probe, disp);
|
||||
|
||||
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);
|
||||
|
||||
GST_DEBUG ("dispatching data %p on dispatcher %p", *data, disp);
|
||||
|
||||
walk = disp->probes;
|
||||
while (walk) {
|
||||
GstProbe *probe = (GstProbe *) walk->data;
|
||||
|
|
Loading…
Reference in a new issue