uridecodebin3: notify when 'current-(sub)uri' properties are updated

Assume both uri and suburi are changed when the main item changes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4543>
This commit is contained in:
Guillaume Desmottes 2023-05-03 16:26:53 +02:00 committed by GStreamer Marge Bot
parent f58416b1a4
commit 58f80c180c

View file

@ -582,11 +582,21 @@ gst_uri_decode_bin3_class_init (GstURIDecodeBin3Class * klass)
klass->select_stream = gst_uridecodebin3_select_stream; klass->select_stream = gst_uridecodebin3_select_stream;
} }
static void
current_updated (GstURIDecodeBin3 * dec)
{
GObject *object = G_OBJECT (dec);
g_object_notify (object, "current-uri");
g_object_notify (object, "current-suburi");
}
static void static void
check_output_group_id (GstURIDecodeBin3 * dec) check_output_group_id (GstURIDecodeBin3 * dec)
{ {
GList *iter; GList *iter;
guint common_group_id = GST_GROUP_ID_INVALID; guint common_group_id = GST_GROUP_ID_INVALID;
gboolean notify_current = FALSE;
PLAY_ITEMS_LOCK (dec); PLAY_ITEMS_LOCK (dec);
@ -619,9 +629,15 @@ check_output_group_id (GstURIDecodeBin3 * dec)
dec->output_item->group_id = common_group_id; dec->output_item->group_id = common_group_id;
free_play_item (dec, previous_item); free_play_item (dec, previous_item);
} }
notify_current = TRUE;
} }
PLAY_ITEMS_UNLOCK (dec); PLAY_ITEMS_UNLOCK (dec);
if (notify_current) {
/* don't hold the object lock as application could fetch some properties whose getters require this lock as well */
current_updated (dec);
}
} }
static GstPadProbeReturn static GstPadProbeReturn
@ -1986,6 +2002,7 @@ gst_uri_decode_bin3_change_state (GstElement * element,
case GST_STATE_CHANGE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
g_atomic_int_set (&uridecodebin->shutdown, 0); g_atomic_int_set (&uridecodebin->shutdown, 0);
ret = activate_play_item (uridecodebin->input_item); ret = activate_play_item (uridecodebin->input_item);
current_updated (uridecodebin);
if (ret == GST_STATE_CHANGE_FAILURE) if (ret == GST_STATE_CHANGE_FAILURE)
goto failure; goto failure;
break; break;