pad: add probe id to the info

This commit is contained in:
Wim Taymans 2012-01-26 11:01:21 +01:00
parent b6d11d844e
commit 3844f80266
2 changed files with 9 additions and 4 deletions

View file

@ -1170,7 +1170,7 @@ gst_pad_add_probe (GstPad * pad, GstPadProbeType mask,
"pad is in use, delay idle callback"); "pad is in use, delay idle callback");
GST_OBJECT_UNLOCK (pad); GST_OBJECT_UNLOCK (pad);
} else { } else {
GstPadProbeInfo info = { GST_PAD_PROBE_TYPE_IDLE, }; GstPadProbeInfo info = { GST_PAD_PROBE_TYPE_IDLE, res, };
/* the pad is idle now, we can signal the idle callback now */ /* the pad is idle now, we can signal the idle callback now */
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad, GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
@ -2827,6 +2827,8 @@ probe_hook_marshal (GHook * hook, ProbeMarshall * data)
if (callback == NULL) if (callback == NULL)
return; return;
info->id = hook->hook_id;
GST_OBJECT_UNLOCK (pad); GST_OBJECT_UNLOCK (pad);
ret = callback (pad, info, hook->data); ret = callback (pad, info, hook->data);
@ -2871,7 +2873,7 @@ no_match:
G_STMT_START { \ G_STMT_START { \
if (G_UNLIKELY (pad->num_probes)) { \ if (G_UNLIKELY (pad->num_probes)) { \
/* we start with passing NULL as the data item */ \ /* we start with passing NULL as the data item */ \
GstPadProbeInfo info = { mask, NULL, offs, size }; \ GstPadProbeInfo info = { mask, 0, NULL, offs, size }; \
ret = do_probe_callbacks (pad, &info, defaultval); \ ret = do_probe_callbacks (pad, &info, defaultval); \
/* store the possibly updated data item */ \ /* store the possibly updated data item */ \
data = GST_PAD_PROBE_INFO_DATA (&info); \ data = GST_PAD_PROBE_INFO_DATA (&info); \
@ -2890,7 +2892,7 @@ no_match:
G_STMT_START { \ G_STMT_START { \
if (G_UNLIKELY (pad->num_probes)) { \ if (G_UNLIKELY (pad->num_probes)) { \
/* pass NULL as the data item */ \ /* pass NULL as the data item */ \
GstPadProbeInfo info = { mask, NULL, 0, 0 }; \ GstPadProbeInfo info = { mask, 0, NULL, 0, 0 }; \
ret = do_probe_callbacks (pad, &info, defaultval); \ ret = do_probe_callbacks (pad, &info, defaultval); \
if (G_UNLIKELY (ret != defaultval && ret != GST_FLOW_OK)) \ if (G_UNLIKELY (ret != defaultval && ret != GST_FLOW_OK)) \
goto label; \ goto label; \
@ -2900,7 +2902,7 @@ no_match:
#define PROBE_FULL(pad,mask,data,offs,size,label,defaultval) \ #define PROBE_FULL(pad,mask,data,offs,size,label,defaultval) \
G_STMT_START { \ G_STMT_START { \
if (G_UNLIKELY (pad->num_probes)) { \ if (G_UNLIKELY (pad->num_probes)) { \
GstPadProbeInfo info = { mask, data, offs, size }; \ GstPadProbeInfo info = { mask, 0, data, offs, size }; \
ret = do_probe_callbacks (pad, &info, defaultval); \ ret = do_probe_callbacks (pad, &info, defaultval); \
data = GST_PAD_PROBE_INFO_DATA (&info); \ data = GST_PAD_PROBE_INFO_DATA (&info); \
if (G_UNLIKELY (ret != defaultval && ret != GST_FLOW_OK)) \ if (G_UNLIKELY (ret != defaultval && ret != GST_FLOW_OK)) \

View file

@ -514,6 +514,7 @@ typedef enum
/** /**
* GstPadProbeInfo: * GstPadProbeInfo:
* @type: the current probe type * @type: the current probe type
* @id: the id of the probe
* @data: type specific data, check the @type field to know the datatype. * @data: type specific data, check the @type field to know the datatype.
* This field can be NULL. * This field can be NULL.
* @offset: offset of pull probe, this field is valid when @type contains * @offset: offset of pull probe, this field is valid when @type contains
@ -526,6 +527,7 @@ typedef enum
typedef struct typedef struct
{ {
GstPadProbeType type; GstPadProbeType type;
gulong id;
gpointer data; gpointer data;
guint64 offset; guint64 offset;
guint size; guint size;
@ -534,6 +536,7 @@ typedef struct
} GstPadProbeInfo; } GstPadProbeInfo;
#define GST_PAD_PROBE_INFO_TYPE(d) ((d)->type) #define GST_PAD_PROBE_INFO_TYPE(d) ((d)->type)
#define GST_PAD_PROBE_INFO_ID(d) ((d)->id)
#define GST_PAD_PROBE_INFO_DATA(d) ((d)->data) #define GST_PAD_PROBE_INFO_DATA(d) ((d)->data)
#define GST_PAD_PROBE_INFO_BUFFER(d) GST_BUFFER_CAST(GST_PAD_PROBE_INFO_DATA(d)) #define GST_PAD_PROBE_INFO_BUFFER(d) GST_BUFFER_CAST(GST_PAD_PROBE_INFO_DATA(d))