mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-26 17:18:15 +00:00
gst/gstpad.c: Fix accumulator, add default value by using _emitv() instead of _emit() for signal emission.
Original commit message from CVS: * gst/gstpad.c: (_gst_do_pass_data_accumulator), (silly_return_true_function), (gst_pad_class_init), (gst_pad_emit_have_data_signal), (gst_pad_chain), (gst_pad_push), (gst_pad_get_range), (gst_pad_pull_range), (gst_pad_push_event), (gst_pad_send_event): Fix accumulator, add default value by using _emitv() instead of _emit() for signal emission.
This commit is contained in:
parent
af3acddad9
commit
a220106c57
2 changed files with 53 additions and 11 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2005-06-29 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
|
||||||
|
* gst/gstpad.c: (_gst_do_pass_data_accumulator),
|
||||||
|
(silly_return_true_function), (gst_pad_class_init),
|
||||||
|
(gst_pad_emit_have_data_signal), (gst_pad_chain), (gst_pad_push),
|
||||||
|
(gst_pad_get_range), (gst_pad_pull_range), (gst_pad_push_event),
|
||||||
|
(gst_pad_send_event):
|
||||||
|
Fix accumulator, add default value by using _emitv() instead
|
||||||
|
of _emit() for signal emission.
|
||||||
|
|
||||||
2005-06-29 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
2005-06-29 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
|
||||||
* docs/manual/advanced-dataaccess.xml:
|
* docs/manual/advanced-dataaccess.xml:
|
||||||
|
|
54
gst/gstpad.c
54
gst/gstpad.c
|
@ -125,16 +125,20 @@ static gboolean
|
||||||
_gst_do_pass_data_accumulator (GSignalInvocationHint * ihint,
|
_gst_do_pass_data_accumulator (GSignalInvocationHint * ihint,
|
||||||
GValue * return_accu, const GValue * handler_return, gpointer dummy)
|
GValue * return_accu, const GValue * handler_return, gpointer dummy)
|
||||||
{
|
{
|
||||||
if (ihint->run_type == G_SIGNAL_RUN_FIRST) {
|
if (!g_value_get_boolean (handler_return)) {
|
||||||
gboolean ret = g_value_get_boolean (handler_return);
|
g_value_set_boolean (return_accu, FALSE);
|
||||||
|
return FALSE;
|
||||||
g_value_set_boolean (return_accu, ret);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
silly_return_true_function (GstPad * pad, GstMiniObject * o)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_pad_class_init (GstPadClass * klass)
|
gst_pad_class_init (GstPadClass * klass)
|
||||||
{
|
{
|
||||||
|
@ -188,6 +192,7 @@ gst_pad_class_init (GstPadClass * klass)
|
||||||
gstobject_class->save_thyself = GST_DEBUG_FUNCPTR (gst_pad_save_thyself);
|
gstobject_class->save_thyself = GST_DEBUG_FUNCPTR (gst_pad_save_thyself);
|
||||||
#endif
|
#endif
|
||||||
gstobject_class->path_string_separator = ".";
|
gstobject_class->path_string_separator = ".";
|
||||||
|
klass->have_data = silly_return_true_function;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2666,6 +2671,33 @@ handle_pad_block (GstPad * pad)
|
||||||
* Data passing functions
|
* Data passing functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_pad_emit_have_data_signal (GstPad * pad, GstMiniObject * obj)
|
||||||
|
{
|
||||||
|
GValue ret = { 0 };
|
||||||
|
GValue args[2] = { {0}, {0} };
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
|
/* init */
|
||||||
|
g_value_init (&ret, G_TYPE_BOOLEAN);
|
||||||
|
g_value_set_boolean (&ret, TRUE);
|
||||||
|
g_value_init (&args[0], GST_TYPE_PAD);
|
||||||
|
g_value_set_object (&args[0], pad);
|
||||||
|
g_value_init (&args[1], G_TYPE_POINTER);
|
||||||
|
g_value_set_pointer (&args[1], obj);
|
||||||
|
|
||||||
|
/* actually emit */
|
||||||
|
g_signal_emitv (args, gst_pad_signals[PAD_HAVE_DATA], 0, &ret);
|
||||||
|
res = g_value_get_boolean (&ret);
|
||||||
|
|
||||||
|
/* clean up */
|
||||||
|
g_value_unset (&ret);
|
||||||
|
g_value_unset (&args[0]);
|
||||||
|
g_value_unset (&args[1]);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_pad_chain:
|
* gst_pad_chain:
|
||||||
* @pad: a sink #GstPad.
|
* @pad: a sink #GstPad.
|
||||||
|
@ -2717,7 +2749,7 @@ gst_pad_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
goto no_function;
|
goto no_function;
|
||||||
|
|
||||||
if (g_atomic_int_get (&pad->emit_buffer_signals) >= 1) {
|
if (g_atomic_int_get (&pad->emit_buffer_signals) >= 1) {
|
||||||
g_signal_emit (pad, gst_pad_signals[PAD_HAVE_DATA], 0, buffer, &do_pass);
|
do_pass = gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT (buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_pass) {
|
if (do_pass) {
|
||||||
|
@ -2801,7 +2833,7 @@ gst_pad_push (GstPad * pad, GstBuffer * buffer)
|
||||||
GST_UNLOCK (pad);
|
GST_UNLOCK (pad);
|
||||||
|
|
||||||
if (g_atomic_int_get (&pad->emit_buffer_signals) >= 1) {
|
if (g_atomic_int_get (&pad->emit_buffer_signals) >= 1) {
|
||||||
g_signal_emit (pad, gst_pad_signals[PAD_HAVE_DATA], 0, buffer, &do_pass);
|
do_pass = gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT (buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_pass) {
|
if (do_pass) {
|
||||||
|
@ -2939,7 +2971,7 @@ gst_pad_get_range (GstPad * pad, guint64 offset, guint size,
|
||||||
if (ret == GST_FLOW_OK && g_atomic_int_get (&pad->emit_buffer_signals) >= 1) {
|
if (ret == GST_FLOW_OK && g_atomic_int_get (&pad->emit_buffer_signals) >= 1) {
|
||||||
gboolean do_pass = TRUE;
|
gboolean do_pass = TRUE;
|
||||||
|
|
||||||
g_signal_emit (pad, gst_pad_signals[PAD_HAVE_DATA], 0, *buffer, &do_pass);
|
do_pass = gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT (*buffer));
|
||||||
if (!do_pass) {
|
if (!do_pass) {
|
||||||
GST_DEBUG ("Dropping data after FALSE probe return");
|
GST_DEBUG ("Dropping data after FALSE probe return");
|
||||||
gst_buffer_unref (*buffer);
|
gst_buffer_unref (*buffer);
|
||||||
|
@ -3013,7 +3045,7 @@ gst_pad_pull_range (GstPad * pad, guint64 offset, guint size,
|
||||||
if (ret == GST_FLOW_OK && g_atomic_int_get (&pad->emit_buffer_signals) >= 1) {
|
if (ret == GST_FLOW_OK && g_atomic_int_get (&pad->emit_buffer_signals) >= 1) {
|
||||||
gboolean do_pass = TRUE;
|
gboolean do_pass = TRUE;
|
||||||
|
|
||||||
g_signal_emit (pad, gst_pad_signals[PAD_HAVE_DATA], 0, *buffer, &do_pass);
|
do_pass = gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT (*buffer));
|
||||||
if (!do_pass) {
|
if (!do_pass) {
|
||||||
GST_DEBUG ("Dropping data after FALSE probe return");
|
GST_DEBUG ("Dropping data after FALSE probe return");
|
||||||
gst_buffer_unref (*buffer);
|
gst_buffer_unref (*buffer);
|
||||||
|
@ -3065,7 +3097,7 @@ gst_pad_push_event (GstPad * pad, GstEvent * event)
|
||||||
GST_UNLOCK (pad);
|
GST_UNLOCK (pad);
|
||||||
|
|
||||||
if (g_atomic_int_get (&pad->emit_event_signals) >= 1) {
|
if (g_atomic_int_get (&pad->emit_event_signals) >= 1) {
|
||||||
g_signal_emit (pad, gst_pad_signals[PAD_HAVE_DATA], 0, event, &do_pass);
|
do_pass = gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT (event));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_pass) {
|
if (do_pass) {
|
||||||
|
@ -3145,7 +3177,7 @@ gst_pad_send_event (GstPad * pad, GstEvent * event)
|
||||||
GST_UNLOCK (pad);
|
GST_UNLOCK (pad);
|
||||||
|
|
||||||
if (g_atomic_int_get (&pad->emit_event_signals) >= 1) {
|
if (g_atomic_int_get (&pad->emit_event_signals) >= 1) {
|
||||||
g_signal_emit (pad, gst_pad_signals[PAD_HAVE_DATA], 0, event, &do_pass);
|
do_pass = gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT (event));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_pass) {
|
if (do_pass) {
|
||||||
|
|
Loading…
Reference in a new issue