gst/playback/: Make sure the video frame buffer we return to apps via the "frame" property always has caps set on it....

Original commit message from CVS:
* gst/playback/gstplaybasebin.c:
* gst/playback/gstplaybin.c: (handoff):
Make sure the video frame buffer we return to apps via the
"frame" property always has caps set on it. Modify
_gst_gvalue_set_object() macro to handle NULL objects
gracefully too.
This commit is contained in:
Tim-Philipp Müller 2005-12-15 09:48:19 +00:00
parent 7906b3c945
commit f2e9c13e3f
3 changed files with 35 additions and 9 deletions

View file

@ -1,3 +1,12 @@
2005-12-15 Tim-Philipp Müller <tim at centricular dot net>
* gst/playback/gstplaybasebin.c:
* gst/playback/gstplaybin.c: (handoff):
Make sure the video frame buffer we return to apps via the
"frame" property always has caps set on it. Modify
_gst_gvalue_set_object() macro to handle NULL objects
gracefully too.
2005-12-14 Stefan Kost <ensonic@users.sf.net> 2005-12-14 Stefan Kost <ensonic@users.sf.net>
* gst/audiotestsrc/gstaudiotestsrc.c: * gst/audiotestsrc/gstaudiotestsrc.c:

View file

@ -40,9 +40,13 @@ GST_DEBUG_CATEGORY_STATIC (gst_play_base_bin_debug);
#ifndef GST_HAVE_GLIB_2_8 #ifndef GST_HAVE_GLIB_2_8
#define _gst_gvalue_set_gstobject(gvalue,obj) \ #define _gst_gvalue_set_gstobject(gvalue,obj) \
if (obj != NULL) { \
gst_object_ref (obj); \ gst_object_ref (obj); \
g_value_set_object (gvalue, obj); \ g_value_set_object (gvalue, obj); \
g_object_unref (obj); g_object_unref (obj); \
} else { \
g_value_set_object (gvalue, NULL); \
}
#else #else
#define _gst_gvalue_set_gstobject(gvalue,obj) \ #define _gst_gvalue_set_gstobject(gvalue,obj) \
g_value_set_object (gvalue, obj); g_value_set_object (gvalue, obj);

View file

@ -41,9 +41,13 @@ GST_DEBUG_CATEGORY_STATIC (gst_play_bin_debug);
#ifndef GST_HAVE_GLIB_2_8 #ifndef GST_HAVE_GLIB_2_8
#define _gst_gvalue_set_gstobject(gvalue,obj) \ #define _gst_gvalue_set_gstobject(gvalue,obj) \
if (obj != NULL) { \
gst_object_ref (obj); \ gst_object_ref (obj); \
g_value_set_object (gvalue, obj); \ g_value_set_object (gvalue, obj); \
g_object_unref (obj); g_object_unref (obj); \
} else { \
g_value_set_object (gvalue, NULL); \
}
#else #else
#define _gst_gvalue_set_gstobject(gvalue,obj) \ #define _gst_gvalue_set_gstobject(gvalue,obj) \
g_value_set_object (gvalue, obj); g_value_set_object (gvalue, obj);
@ -368,10 +372,19 @@ handoff (GstElement * identity, GstBuffer * frame, gpointer data)
{ {
GstPlayBin *play_bin = GST_PLAY_BIN (data); GstPlayBin *play_bin = GST_PLAY_BIN (data);
if (play_bin->frame) { gst_mini_object_replace ((GstMiniObject **) & play_bin->frame,
gst_buffer_unref (play_bin->frame); GST_MINI_OBJECT_CAST (frame));
/* applications need to know the buffer caps,
* make sure they are always set on the frame */
if (GST_BUFFER_CAPS (play_bin->frame) == NULL) {
GstPad *pad;
if ((pad = gst_element_get_pad (identity, "sink"))) {
gst_buffer_set_caps (play_bin->frame, GST_PAD_CAPS (pad));
gst_object_unref (pad);
}
} }
play_bin->frame = gst_buffer_ref (frame);
} }
/* make the element (bin) that contains the elements needed to perform /* make the element (bin) that contains the elements needed to perform