From 638ecae59027a2ec10de46385b70e11b007eb720 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 19 May 2008 10:03:09 +0000 Subject: [PATCH] libs/gst/base/gstbasesrc.c: When the subclass did not set caps on outgoing buffers, configure the caps we negotiated ... Original commit message from CVS: * libs/gst/base/gstbasesrc.c: (gst_base_src_get_range), (gst_base_src_start): When the subclass did not set caps on outgoing buffers, configure the caps we negotiated on the source pad. When the typefind helper does not find caps, error out properly instead of doing things with NULL caps. --- ChangeLog | 9 +++++++++ libs/gst/base/gstbasesrc.c | 18 +++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c9ab2e5e1b..36bf91e1e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-05-19 Wim Taymans + + * libs/gst/base/gstbasesrc.c: (gst_base_src_get_range), + (gst_base_src_start): + When the subclass did not set caps on outgoing buffers, configure the + caps we negotiated on the source pad. + When the typefind helper does not find caps, error out properly instead + of doing things with NULL caps. + 2008-05-18 Tim-Philipp Müller * gst/gsttypefind.h: diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index 02e6600f3d..5057476228 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -1825,6 +1825,10 @@ gst_base_src_get_range (GstBaseSrc * src, guint64 offset, guint length, && GST_BUFFER_TIMESTAMP (*buf) == -1) GST_BUFFER_TIMESTAMP (*buf) = 0; + /* set pad caps on the buffer if the buffer had no caps */ + if (GST_BUFFER_CAPS (*buf) == NULL) + gst_buffer_set_caps (*buf, GST_PAD_CAPS (src->srcpad)); + /* now sync before pushing the buffer */ status = gst_base_src_do_sync (src, *buf); @@ -2377,7 +2381,9 @@ gst_base_src_start (GstBaseSrc * basesrc) if (basesrc->random_access && basesrc->data.ABI.typefind && size != -1) { GstCaps *caps; - caps = gst_type_find_helper (basesrc->srcpad, size); + if (!(caps = gst_type_find_helper (basesrc->srcpad, size))) + goto typefind_failed; + gst_pad_set_caps (basesrc->srcpad, caps); gst_caps_unref (caps); } else { @@ -2404,6 +2410,16 @@ could_not_negotiate: gst_base_src_stop (basesrc); return FALSE; } +typefind_failed: + { + GST_DEBUG_OBJECT (basesrc, "could not typefind, stopping"); + GST_ELEMENT_ERROR (basesrc, STREAM, FORMAT, + ("Could not determine media type"), + ("Add support for this media type")); + /* we must call stop */ + gst_base_src_stop (basesrc); + return FALSE; + } } static gboolean