decodebin2: use accumulator for autoplug-sort

Use an accumulator for the autoplug-sort signal so that we can stop the emission
when a signal handler produced a valid result. This avoids the object handler
to overwrite the results from user signals.

Fixes #621161
This commit is contained in:
Prahal 2010-06-14 11:16:45 +02:00 committed by Wim Taymans
parent 9a971980b7
commit 2cb7cfab19

View file

@ -555,6 +555,22 @@ _gst_select_accumulator (GSignalInvocationHint * ihint,
return FALSE;
}
static gboolean
_gst_array_hasvalue_accumulator (GSignalInvocationHint * ihint,
GValue * return_accu, const GValue * handler_return, gpointer dummy)
{
gpointer array;
array = g_value_get_boxed (handler_return);
if (!(ihint->run_type & G_SIGNAL_RUN_CLEANUP))
g_value_set_boxed (return_accu, array);
if (array != NULL)
return FALSE;
return TRUE;
}
static void
gst_decode_bin_class_init (GstDecodeBinClass * klass)
{
@ -681,8 +697,9 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass)
gst_decode_bin_signals[SIGNAL_AUTOPLUG_SORT] =
g_signal_new ("autoplug-sort", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstDecodeBinClass, autoplug_sort),
NULL, NULL, gst_play_marshal_BOXED__OBJECT_BOXED_BOXED,
G_TYPE_VALUE_ARRAY, 3, GST_TYPE_PAD, GST_TYPE_CAPS, G_TYPE_VALUE_ARRAY);
_gst_array_hasvalue_accumulator, NULL,
gst_play_marshal_BOXED__OBJECT_BOXED_BOXED, G_TYPE_VALUE_ARRAY, 3,
GST_TYPE_PAD, GST_TYPE_CAPS, G_TYPE_VALUE_ARRAY);
/**
* GstDecodeBin2::autoplug-select: