From: <tp...@ke...> - 2007-01-30 19:20:18
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: tpm Date: Tue Jan 30 2007 19:19:49 UTC Log message: * 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. Modified files: . : ChangeLog gst/playback : gstplaybasebin.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.3120&r2=1.3121 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c.diff?r1=1.138&r2=1.139 ====Begin Diffs==== Index: gstplaybasebin.c =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c,v retrieving revision 1.138 retrieving revision 1.139 diff -u -d -r1.138 -r1.139 --- gstplaybasebin.c 25 Jan 2007 16:02:41 -0000 1.138 +++ gstplaybasebin.c 30 Jan 2007 19:19:37 -0000 1.139 @@ -75,8 +75,8 @@ 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 @@ (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); } case ARG_SOURCE: @@ -2594,7 +2596,7 @@ } } -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 @@ 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; Index: ChangeLog RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.3120 retrieving revision 1.3121 diff -u -d -r1.3120 -r1.3121 --- ChangeLog 30 Jan 2007 11:29:16 -0000 1.3120 +++ ChangeLog 30 Jan 2007 19:19:37 -0000 1.3121 @@ -1,3 +1,11 @@ +2007-01-30 Tim-Philipp Müller <tim at centricular dot net> + * 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 <wi...@fl...> * gst/audioconvert/gstaudioconvert.c: |