diff --git a/ChangeLog b/ChangeLog index 8fee8b5568..256b267dbc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-01-30 Tim-Philipp Müller + + * gst/playback/gstplaybasebin.c: (gst_play_base_bin_get_property), + (gst_play_base_bin_get_streaminfo_value_array): + Take some locks and make a copy of the streaminfo value array we + maintain while holding the lock, so that the application can + retrieve the stream-info as a value array in a thread-safe way. + 2007-01-30 Wim Taymans * gst/audioconvert/gstaudioconvert.c: diff --git a/gst/playback/gstplaybasebin.c b/gst/playback/gstplaybasebin.c index bb6abe03d2..0594c370af 100644 --- a/gst/playback/gstplaybasebin.c +++ b/gst/playback/gstplaybasebin.c @@ -75,8 +75,8 @@ static void gst_play_base_bin_handle_message_func (GstBin * bin, static GstStateChangeReturn gst_play_base_bin_change_state (GstElement * element, GstStateChange transition); -const GList *gst_play_base_bin_get_streaminfo (GstPlayBaseBin * play_base_bin); -const GValueArray *gst_play_base_bin_get_streaminfo_value_array (GstPlayBaseBin +static const GList *gst_play_base_bin_get_streaminfo (GstPlayBaseBin * bin); +static GValueArray *gst_play_base_bin_get_streaminfo_value_array (GstPlayBaseBin * play_base_bin); static void preroll_remove_overrun (GstElement * element, GstPlayBaseBin * play_base_bin); @@ -2502,8 +2502,10 @@ gst_play_base_bin_get_property (GObject * object, guint prop_id, GValue * value, (gpointer) gst_play_base_bin_get_streaminfo (play_base_bin)); break; case ARG_STREAMINFO_VALUES:{ - g_value_set_boxed (value, - gst_play_base_bin_get_streaminfo_value_array (play_base_bin)); + GValueArray *copy; + + copy = gst_play_base_bin_get_streaminfo_value_array (play_base_bin); + g_value_take_boxed (value, copy); break; } case ARG_SOURCE: @@ -2594,7 +2596,7 @@ cleanup_groups: } } -const GList * +static const GList * gst_play_base_bin_get_streaminfo (GstPlayBaseBin * play_base_bin) { GstPlayBaseGroup *group = get_active_group (play_base_bin); @@ -2606,15 +2608,18 @@ gst_play_base_bin_get_streaminfo (GstPlayBaseBin * play_base_bin) return info; } -const GValueArray * +static GValueArray * gst_play_base_bin_get_streaminfo_value_array (GstPlayBaseBin * play_base_bin) { - GstPlayBaseGroup *group = get_active_group (play_base_bin); + GstPlayBaseGroup *group; GValueArray *array = NULL; + GROUP_LOCK (play_base_bin); + group = get_active_group (play_base_bin); if (group) { - array = group->streaminfo_value_array; + array = g_value_array_copy (group->streaminfo_value_array); } + GROUP_UNLOCK (play_base_bin); return array; }