gst/playback/: Work around refcount problem with g_value_set_object() that occur if the core has been compiled agains...

Original commit message from CVS:
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_get_property):
* gst/playback/gstplaybin.c: (gst_play_bin_get_property):
Work around refcount problem with g_value_set_object() that occur
if the core has been compiled against GLib-2.6 (g_value_set_object()
will only g_object_ref() the element, but the caller will
gst_object_unref() it and bad things will happen due to the way
GstObjects are refcounted in the GLib-2.6 case). Fixes problems with
totem for people on FC4 using Thomas's 0.10 RPMs.
This commit is contained in:
Tim-Philipp Müller 2005-12-07 18:51:35 +00:00
parent 5c6b057091
commit d0cc0e9082
3 changed files with 35 additions and 4 deletions

View file

@ -1,3 +1,14 @@
2005-12-07 Tim-Philipp Müller <tim at centricular dot net>
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_get_property):
* gst/playback/gstplaybin.c: (gst_play_bin_get_property):
Work around refcount problem with g_value_set_object() that occur
if the core has been compiled against GLib-2.6 (g_value_set_object()
will only g_object_ref() the element, but the caller will
gst_object_unref() it and bad things will happen due to the way
GstObjects are refcounted in the GLib-2.6 case). Fixes problems with
totem for people on FC4 using Thomas's 0.10 RPMs.
2005-12-07 Edward Hervey <edward@fluendo.com> 2005-12-07 Edward Hervey <edward@fluendo.com>
Time to welcome ogm to 0.10 :) Time to welcome ogm to 0.10 :)

View file

@ -38,6 +38,16 @@ GST_DEBUG_CATEGORY_STATIC (gst_play_base_bin_debug);
#define GROUP_WAIT(pbb) g_cond_wait (pbb->group_cond, pbb->group_lock) #define GROUP_WAIT(pbb) g_cond_wait (pbb->group_cond, pbb->group_lock)
#define GROUP_SIGNAL(pbb) g_cond_signal (pbb->group_cond) #define GROUP_SIGNAL(pbb) g_cond_signal (pbb->group_cond)
#ifndef GST_HAVE_GLIB_2_8
#define _gst_gvalue_set_gstobject(gvalue,obj) \
gst_object_ref (obj); \
g_value_set_object (gvalue, obj); \
g_object_unref (obj);
#else
#define _gst_gvalue_set_gstobject(gvalue,obj) \
g_value_set_object (gvalue, obj);
#endif
/* props */ /* props */
enum enum
{ {
@ -1671,7 +1681,7 @@ gst_play_base_bin_get_property (GObject * object, guint prop_id, GValue * value,
(gpointer) gst_play_base_bin_get_streaminfo (play_base_bin)); (gpointer) gst_play_base_bin_get_streaminfo (play_base_bin));
break; break;
case ARG_SOURCE: case ARG_SOURCE:
g_value_set_object (value, play_base_bin->source); _gst_gvalue_set_gstobject (value, play_base_bin->source);
break; break;
case ARG_VIDEO: case ARG_VIDEO:
GROUP_LOCK (play_base_bin); GROUP_LOCK (play_base_bin);

View file

@ -39,6 +39,16 @@ GST_DEBUG_CATEGORY_STATIC (gst_play_bin_debug);
#define VOLUME_MAX_DOUBLE 4.0 #define VOLUME_MAX_DOUBLE 4.0
#ifndef GST_HAVE_GLIB_2_8
#define _gst_gvalue_set_gstobject(gvalue,obj) \
gst_object_ref (obj); \
g_value_set_object (gvalue, obj); \
g_object_unref (obj);
#else
#define _gst_gvalue_set_gstobject(gvalue,obj) \
g_value_set_object (gvalue, obj);
#endif
typedef struct _GstPlayBin GstPlayBin; typedef struct _GstPlayBin GstPlayBin;
typedef struct _GstPlayBinClass GstPlayBinClass; typedef struct _GstPlayBinClass GstPlayBinClass;
@ -330,13 +340,13 @@ gst_play_bin_get_property (GObject * object, guint prop_id, GValue * value,
switch (prop_id) { switch (prop_id) {
case ARG_VIDEO_SINK: case ARG_VIDEO_SINK:
g_value_set_object (value, play_bin->video_sink); _gst_gvalue_set_gstobject (value, play_bin->video_sink);
break; break;
case ARG_AUDIO_SINK: case ARG_AUDIO_SINK:
g_value_set_object (value, play_bin->audio_sink); _gst_gvalue_set_gstobject (value, play_bin->audio_sink);
break; break;
case ARG_VIS_PLUGIN: case ARG_VIS_PLUGIN:
g_value_set_object (value, play_bin->visualisation); _gst_gvalue_set_gstobject (value, play_bin->visualisation);
break; break;
case ARG_VOLUME: case ARG_VOLUME:
g_value_set_double (value, play_bin->volume); g_value_set_double (value, play_bin->volume);