From 2cb7cfab19bfa6b5937582612a1fb58b220335a5 Mon Sep 17 00:00:00 2001 From: Prahal Date: Mon, 14 Jun 2010 11:16:45 +0200 Subject: [PATCH] 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 --- gst/playback/gstdecodebin2.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index 300d23e7f1..e7013376ab 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -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: