mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
utils: remove _full variants of probes
Remove the _full variants and add the destroy notify to the regular methods.
This commit is contained in:
parent
9b1c84d5ac
commit
a5bbf7f369
11 changed files with 44 additions and 118 deletions
|
@ -3132,42 +3132,6 @@ gst_pad_query_peer_convert (GstPad * pad, GstFormat src_format, gint64 src_val,
|
|||
* @pad: pad to add the data probe handler to
|
||||
* @handler: function to call when data is passed over pad
|
||||
* @data: (closure): data to pass along with the handler
|
||||
*
|
||||
* Adds a "data probe" to a pad. This function will be called whenever data
|
||||
* passes through a pad. In this case data means both events and buffers. The
|
||||
* probe will be called with the data as an argument, meaning @handler should
|
||||
* have the same callback signature as the #GstPad::have-data signal.
|
||||
* Note that the data will have a reference count greater than 1, so it will
|
||||
* be immutable -- you must not change it.
|
||||
*
|
||||
* For source pads, the probe will be called after the blocking function, if any
|
||||
* (see gst_pad_set_blocked_async()), but before looking up the peer to chain
|
||||
* to. For sink pads, the probe function will be called before configuring the
|
||||
* sink with new caps, if any, and before calling the pad's chain function.
|
||||
*
|
||||
* Your data probe should return TRUE to let the data continue to flow, or FALSE
|
||||
* to drop it. Dropping data is rarely useful, but occasionally comes in handy
|
||||
* with events.
|
||||
*
|
||||
* Although probes are implemented internally by connecting @handler to the
|
||||
* have-data signal on the pad, if you want to remove a probe it is insufficient
|
||||
* to only call g_signal_handler_disconnect on the returned handler id. To
|
||||
* remove a probe, use the appropriate function, such as
|
||||
* gst_pad_remove_data_probe().
|
||||
*
|
||||
* Returns: The handler id.
|
||||
*/
|
||||
gulong
|
||||
gst_pad_add_data_probe (GstPad * pad, GCallback handler, gpointer data)
|
||||
{
|
||||
return gst_pad_add_data_probe_full (pad, handler, data, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_pad_add_data_probe_full:
|
||||
* @pad: pad to add the data probe handler to
|
||||
* @handler: function to call when data is passed over pad
|
||||
* @data: (closure): data to pass along with the handler
|
||||
* @notify: (allow-none): function to call when the probe is disconnected,
|
||||
* or NULL
|
||||
*
|
||||
|
@ -3201,7 +3165,7 @@ gst_pad_add_data_probe (GstPad * pad, GCallback handler, gpointer data)
|
|||
* Since: 0.10.20
|
||||
*/
|
||||
gulong
|
||||
gst_pad_add_data_probe_full (GstPad * pad, GCallback handler,
|
||||
gst_pad_add_data_probe (GstPad * pad, GCallback handler,
|
||||
gpointer data, GDestroyNotify notify)
|
||||
{
|
||||
gulong sigid;
|
||||
|
@ -3229,23 +3193,6 @@ gst_pad_add_data_probe_full (GstPad * pad, GCallback handler,
|
|||
* gst_pad_add_event_probe:
|
||||
* @pad: pad to add the event probe handler to
|
||||
* @handler: function to call when events are passed over pad
|
||||
* @data: (closure): data to pass along with the handler
|
||||
*
|
||||
* Adds a probe that will be called for all events passing through a pad. See
|
||||
* gst_pad_add_data_probe() for more information.
|
||||
*
|
||||
* Returns: The handler id
|
||||
*/
|
||||
gulong
|
||||
gst_pad_add_event_probe (GstPad * pad, GCallback handler, gpointer data)
|
||||
{
|
||||
return gst_pad_add_event_probe_full (pad, handler, data, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_pad_add_event_probe_full:
|
||||
* @pad: pad to add the event probe handler to
|
||||
* @handler: function to call when events are passed over pad
|
||||
* @data: (closure): data to pass along with the handler, or NULL
|
||||
* @notify: (allow-none): function to call when probe is disconnected, or NULL
|
||||
*
|
||||
|
@ -3260,7 +3207,7 @@ gst_pad_add_event_probe (GstPad * pad, GCallback handler, gpointer data)
|
|||
* Since: 0.10.20
|
||||
*/
|
||||
gulong
|
||||
gst_pad_add_event_probe_full (GstPad * pad, GCallback handler,
|
||||
gst_pad_add_event_probe (GstPad * pad, GCallback handler,
|
||||
gpointer data, GDestroyNotify notify)
|
||||
{
|
||||
gulong sigid;
|
||||
|
@ -3285,23 +3232,6 @@ gst_pad_add_event_probe_full (GstPad * pad, GCallback handler,
|
|||
/**
|
||||
* gst_pad_add_buffer_probe:
|
||||
* @pad: pad to add the buffer probe handler to
|
||||
* @handler: function to call when buffers are passed over pad
|
||||
* @data: (closure): data to pass along with the handler
|
||||
*
|
||||
* Adds a probe that will be called for all buffers passing through a pad. See
|
||||
* gst_pad_add_data_probe() for more information.
|
||||
*
|
||||
* Returns: The handler id
|
||||
*/
|
||||
gulong
|
||||
gst_pad_add_buffer_probe (GstPad * pad, GCallback handler, gpointer data)
|
||||
{
|
||||
return gst_pad_add_buffer_probe_full (pad, handler, data, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_pad_add_buffer_probe_full:
|
||||
* @pad: pad to add the buffer probe handler to
|
||||
* @handler: function to call when buffer are passed over pad
|
||||
* @data: (closure): data to pass along with the handler
|
||||
* @notify: (allow-none): function to call when the probe is disconnected,
|
||||
|
@ -3318,7 +3248,7 @@ gst_pad_add_buffer_probe (GstPad * pad, GCallback handler, gpointer data)
|
|||
* Since: 0.10.20
|
||||
*/
|
||||
gulong
|
||||
gst_pad_add_buffer_probe_full (GstPad * pad, GCallback handler,
|
||||
gst_pad_add_buffer_probe (GstPad * pad, GCallback handler,
|
||||
gpointer data, GDestroyNotify notify)
|
||||
{
|
||||
gulong sigid;
|
||||
|
|
|
@ -937,33 +937,21 @@ GstBuffer * gst_buffer_merge (GstBuffer * buf1, GstBuffer * buf2);
|
|||
GstBuffer * gst_buffer_join (GstBuffer * buf1, GstBuffer * buf2);
|
||||
|
||||
/* probes */
|
||||
gulong gst_pad_add_data_probe (GstPad * pad,
|
||||
GCallback handler,
|
||||
gpointer data);
|
||||
|
||||
gulong gst_pad_add_data_probe_full (GstPad * pad,
|
||||
gulong gst_pad_add_data_probe (GstPad * pad,
|
||||
GCallback handler,
|
||||
gpointer data,
|
||||
GDestroyNotify notify);
|
||||
|
||||
void gst_pad_remove_data_probe (GstPad * pad, guint handler_id);
|
||||
|
||||
gulong gst_pad_add_event_probe (GstPad * pad,
|
||||
GCallback handler,
|
||||
gpointer data);
|
||||
|
||||
gulong gst_pad_add_event_probe_full (GstPad * pad,
|
||||
gulong gst_pad_add_event_probe (GstPad * pad,
|
||||
GCallback handler,
|
||||
gpointer data,
|
||||
GDestroyNotify notify);
|
||||
|
||||
void gst_pad_remove_event_probe (GstPad * pad, guint handler_id);
|
||||
|
||||
gulong gst_pad_add_buffer_probe (GstPad * pad,
|
||||
GCallback handler,
|
||||
gpointer data);
|
||||
|
||||
gulong gst_pad_add_buffer_probe_full (GstPad * pad,
|
||||
gulong gst_pad_add_buffer_probe (GstPad * pad,
|
||||
GCallback handler,
|
||||
gpointer data,
|
||||
GDestroyNotify notify);
|
||||
|
|
|
@ -81,7 +81,7 @@ gst_buffer_straw_start_pipeline (GstElement * bin, GstPad * pad)
|
|||
{
|
||||
GstStateChangeReturn ret;
|
||||
|
||||
id = gst_pad_add_buffer_probe (pad, G_CALLBACK (buffer_probe), NULL);
|
||||
id = gst_pad_add_buffer_probe (pad, G_CALLBACK (buffer_probe), NULL, NULL);
|
||||
|
||||
cond = g_cond_new ();
|
||||
lock = g_mutex_new ();
|
||||
|
|
|
@ -118,7 +118,8 @@ gst_consistency_checker_new (GstPad * pad)
|
|||
consist = g_new0 (GstStreamConsistency, 1);
|
||||
consist->pad = g_object_ref (pad);
|
||||
consist->probeid =
|
||||
gst_pad_add_data_probe (pad, (GCallback) source_pad_data_cb, consist);
|
||||
gst_pad_add_data_probe (pad, (GCallback) source_pad_data_cb, consist,
|
||||
NULL);
|
||||
|
||||
return consist;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,8 @@ setup_output_pad (GstElement * element, GstStaticPadTemplate * tmpl)
|
|||
fail_if (output_pad == NULL, "Could not create a output_pad");
|
||||
|
||||
/* add probe */
|
||||
probe_id = gst_pad_add_data_probe (output_pad, G_CALLBACK (probe_cb), NULL);
|
||||
probe_id =
|
||||
gst_pad_add_data_probe (output_pad, G_CALLBACK (probe_cb), NULL, NULL);
|
||||
g_object_set_data (G_OBJECT (output_pad), "probe_id",
|
||||
GINT_TO_POINTER (probe_id));
|
||||
|
||||
|
@ -313,7 +314,8 @@ run_input_selector_buffer_count (gint num_input_pads,
|
|||
input_pads = g_list_append (input_pads, setup_input_pad (sel));
|
||||
}
|
||||
/* add probe */
|
||||
probe_id = gst_pad_add_data_probe (output_pad, G_CALLBACK (probe_cb), NULL);
|
||||
probe_id =
|
||||
gst_pad_add_data_probe (output_pad, G_CALLBACK (probe_cb), NULL, NULL);
|
||||
g_object_set_data (G_OBJECT (output_pad), "probe_id",
|
||||
GINT_TO_POINTER (probe_id));
|
||||
|
||||
|
|
|
@ -465,11 +465,11 @@ GST_START_TEST (send_custom_events)
|
|||
/* add pad-probes to faksrc.src and fakesink.sink */
|
||||
fail_if ((srcpad = gst_element_get_static_pad (fakesrc, "src")) == NULL);
|
||||
gst_pad_add_event_probe (srcpad, (GCallback) event_probe,
|
||||
GINT_TO_POINTER (TRUE));
|
||||
GINT_TO_POINTER (TRUE), NULL);
|
||||
|
||||
fail_if ((sinkpad = gst_element_get_static_pad (fakesink, "sink")) == NULL);
|
||||
gst_pad_add_event_probe (sinkpad, (GCallback) event_probe,
|
||||
GINT_TO_POINTER (FALSE));
|
||||
GINT_TO_POINTER (FALSE), NULL);
|
||||
|
||||
/* Upstream events */
|
||||
test_event (pipeline, GST_EVENT_CUSTOM_UPSTREAM, sinkpad, TRUE, srcpad);
|
||||
|
|
|
@ -286,7 +286,7 @@ GST_START_TEST (test_push_unlinked)
|
|||
/* adding a probe that returns FALSE will drop the buffer without trying
|
||||
* to chain */
|
||||
id = gst_pad_add_buffer_probe (src, (GCallback) _probe_handler,
|
||||
GINT_TO_POINTER (0));
|
||||
GINT_TO_POINTER (0), NULL);
|
||||
buffer = gst_buffer_new ();
|
||||
gst_buffer_ref (buffer);
|
||||
fail_unless (gst_pad_push (src, buffer) == GST_FLOW_OK);
|
||||
|
@ -297,7 +297,7 @@ GST_START_TEST (test_push_unlinked)
|
|||
/* adding a probe that returns TRUE will still chain the buffer,
|
||||
* and hence drop because pad is unlinked */
|
||||
id = gst_pad_add_buffer_probe (src, (GCallback) _probe_handler,
|
||||
GINT_TO_POINTER (1));
|
||||
GINT_TO_POINTER (1), NULL);
|
||||
buffer = gst_buffer_new ();
|
||||
gst_buffer_ref (buffer);
|
||||
fail_unless (gst_pad_push (src, buffer) == GST_FLOW_NOT_LINKED);
|
||||
|
@ -377,7 +377,7 @@ GST_START_TEST (test_push_linked)
|
|||
/* adding a probe that returns FALSE will drop the buffer without trying
|
||||
* to chain */
|
||||
id = gst_pad_add_buffer_probe (src, (GCallback) _probe_handler,
|
||||
GINT_TO_POINTER (0));
|
||||
GINT_TO_POINTER (0), NULL);
|
||||
buffer = gst_buffer_new ();
|
||||
gst_buffer_ref (buffer);
|
||||
fail_unless (gst_pad_push (src, buffer) == GST_FLOW_OK);
|
||||
|
@ -388,7 +388,7 @@ GST_START_TEST (test_push_linked)
|
|||
|
||||
/* adding a probe that returns TRUE will still chain the buffer */
|
||||
id = gst_pad_add_buffer_probe (src, (GCallback) _probe_handler,
|
||||
GINT_TO_POINTER (1));
|
||||
GINT_TO_POINTER (1), NULL);
|
||||
buffer = gst_buffer_new ();
|
||||
gst_buffer_ref (buffer);
|
||||
fail_unless (gst_pad_push (src, buffer) == GST_FLOW_OK);
|
||||
|
|
|
@ -274,7 +274,7 @@ GST_START_TEST (test_base_time)
|
|||
gst_element_link (fakesrc, fakesink);
|
||||
|
||||
sink = gst_element_get_static_pad (fakesink, "sink");
|
||||
gst_pad_add_buffer_probe (sink, G_CALLBACK (sink_pad_probe), &observed);
|
||||
gst_pad_add_buffer_probe (sink, G_CALLBACK (sink_pad_probe), &observed, NULL);
|
||||
|
||||
fail_unless (gst_element_set_state (pipeline, GST_STATE_PAUSED)
|
||||
== GST_STATE_CHANGE_NO_PREROLL, "expected no-preroll from live pipeline");
|
||||
|
|
|
@ -89,18 +89,20 @@ GST_START_TEST (test_buffer_probe_n_times)
|
|||
pad = gst_element_get_static_pad (fakesink, "sink");
|
||||
|
||||
/* add the probes we need for the test */
|
||||
gst_pad_add_data_probe (pad, G_CALLBACK (data_probe), SPECIAL_POINTER (0));
|
||||
gst_pad_add_buffer_probe (pad, G_CALLBACK (buffer_probe),
|
||||
SPECIAL_POINTER (1));
|
||||
gst_pad_add_event_probe (pad, G_CALLBACK (event_probe), SPECIAL_POINTER (2));
|
||||
gst_pad_add_data_probe (pad, G_CALLBACK (data_probe), SPECIAL_POINTER (0),
|
||||
NULL);
|
||||
gst_pad_add_buffer_probe (pad, G_CALLBACK (buffer_probe), SPECIAL_POINTER (1),
|
||||
NULL);
|
||||
gst_pad_add_event_probe (pad, G_CALLBACK (event_probe), SPECIAL_POINTER (2),
|
||||
NULL);
|
||||
|
||||
/* add some probes just to test that _full works and the data is free'd
|
||||
/* add some string probes just to test that the data is free'd
|
||||
* properly as it should be */
|
||||
gst_pad_add_data_probe_full (pad, G_CALLBACK (probe_do_nothing),
|
||||
gst_pad_add_data_probe (pad, G_CALLBACK (probe_do_nothing),
|
||||
g_strdup ("data probe string"), (GDestroyNotify) g_free);
|
||||
gst_pad_add_buffer_probe_full (pad, G_CALLBACK (probe_do_nothing),
|
||||
gst_pad_add_buffer_probe (pad, G_CALLBACK (probe_do_nothing),
|
||||
g_strdup ("buffer probe string"), (GDestroyNotify) g_free);
|
||||
gst_pad_add_event_probe_full (pad, G_CALLBACK (probe_do_nothing),
|
||||
gst_pad_add_event_probe (pad, G_CALLBACK (probe_do_nothing),
|
||||
g_strdup ("event probe string"), (GDestroyNotify) g_free);
|
||||
|
||||
gst_object_unref (pad);
|
||||
|
@ -180,9 +182,12 @@ GST_START_TEST (test_buffer_probe_once)
|
|||
gst_element_link (fakesrc, fakesink);
|
||||
|
||||
pad = gst_element_get_static_pad (fakesink, "sink");
|
||||
id1 = gst_pad_add_data_probe (pad, G_CALLBACK (data_probe_once), &id1);
|
||||
id2 = gst_pad_add_buffer_probe (pad, G_CALLBACK (buffer_probe_once), &id2);
|
||||
id3 = gst_pad_add_event_probe (pad, G_CALLBACK (event_probe_once), &id3);
|
||||
id1 = gst_pad_add_data_probe (pad, G_CALLBACK (data_probe_once), &id1, NULL);
|
||||
id2 =
|
||||
gst_pad_add_buffer_probe (pad, G_CALLBACK (buffer_probe_once), &id2,
|
||||
NULL);
|
||||
id3 =
|
||||
gst_pad_add_event_probe (pad, G_CALLBACK (event_probe_once), &id3, NULL);
|
||||
gst_object_unref (pad);
|
||||
|
||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||
|
|
|
@ -77,7 +77,7 @@ GST_START_TEST (basesrc_eos_events_push_live_op)
|
|||
fail_unless (srcpad != NULL);
|
||||
|
||||
probe = gst_pad_add_event_probe (srcpad,
|
||||
G_CALLBACK (eos_event_counter), &num_eos);
|
||||
G_CALLBACK (eos_event_counter), &num_eos, NULL);
|
||||
|
||||
bus = gst_element_get_bus (pipe);
|
||||
|
||||
|
@ -155,7 +155,7 @@ GST_START_TEST (basesrc_eos_events_push)
|
|||
fail_unless (srcpad != NULL);
|
||||
|
||||
probe = gst_pad_add_event_probe (srcpad,
|
||||
G_CALLBACK (eos_event_counter), &num_eos);
|
||||
G_CALLBACK (eos_event_counter), &num_eos, NULL);
|
||||
|
||||
bus = gst_element_get_bus (pipe);
|
||||
|
||||
|
@ -222,7 +222,7 @@ GST_START_TEST (basesrc_eos_events_pull_live_op)
|
|||
fail_unless (srcpad != NULL);
|
||||
|
||||
probe = gst_pad_add_event_probe (srcpad,
|
||||
G_CALLBACK (eos_event_counter), &num_eos);
|
||||
G_CALLBACK (eos_event_counter), &num_eos, NULL);
|
||||
|
||||
gst_element_set_state (pipe, GST_STATE_PLAYING);
|
||||
state_ret = gst_element_get_state (pipe, NULL, NULL, -1);
|
||||
|
@ -294,7 +294,7 @@ GST_START_TEST (basesrc_eos_events_pull)
|
|||
fail_unless (srcpad != NULL);
|
||||
|
||||
probe = gst_pad_add_event_probe (srcpad,
|
||||
G_CALLBACK (eos_event_counter), &num_eos);
|
||||
G_CALLBACK (eos_event_counter), &num_eos, NULL);
|
||||
|
||||
bus = gst_element_get_bus (pipe);
|
||||
|
||||
|
@ -364,7 +364,7 @@ GST_START_TEST (basesrc_eos_events_push_live_eos)
|
|||
fail_unless (srcpad != NULL);
|
||||
|
||||
probe = gst_pad_add_event_probe (srcpad,
|
||||
G_CALLBACK (eos_event_counter), &num_eos);
|
||||
G_CALLBACK (eos_event_counter), &num_eos, NULL);
|
||||
|
||||
bus = gst_element_get_bus (pipe);
|
||||
|
||||
|
@ -441,7 +441,7 @@ GST_START_TEST (basesrc_eos_events_pull_live_eos)
|
|||
fail_unless (srcpad != NULL);
|
||||
|
||||
probe = gst_pad_add_event_probe (srcpad,
|
||||
G_CALLBACK (eos_event_counter), &num_eos);
|
||||
G_CALLBACK (eos_event_counter), &num_eos, NULL);
|
||||
|
||||
bus = gst_element_get_bus (pipe);
|
||||
|
||||
|
@ -534,7 +534,7 @@ GST_START_TEST (basesrc_seek_events_rate_update)
|
|||
fail_unless (probe_pad != NULL);
|
||||
|
||||
probe = gst_pad_add_event_probe (probe_pad,
|
||||
G_CALLBACK (segment_event_catcher), &seg_event);
|
||||
G_CALLBACK (segment_event_catcher), &seg_event, NULL);
|
||||
|
||||
/* prepare the seek */
|
||||
rate_seek = gst_event_new_seek (0.5, GST_FORMAT_TIME, GST_SEEK_FLAG_NONE,
|
||||
|
|
|
@ -69,7 +69,7 @@ GST_START_TEST (test_queue)
|
|||
fail_unless (queue != NULL);
|
||||
pad = gst_element_get_static_pad (queue, "sink");
|
||||
fail_unless (pad != NULL);
|
||||
probe = gst_pad_add_event_probe (pad, G_CALLBACK (modify_caps), filter);
|
||||
probe = gst_pad_add_event_probe (pad, G_CALLBACK (modify_caps), filter, NULL);
|
||||
|
||||
bus = gst_element_get_bus (pipeline);
|
||||
|
||||
|
|
Loading…
Reference in a new issue