From 15f1ccaef8a48e5646df4a38592ab570d0aff93e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 14 Jun 2009 19:27:03 +0200 Subject: [PATCH] frei0r: Don't allow caps changes in PLAYING/PAUSED Most frei0r source plugins generate output based on previous output and creating a new instance on caps changes will let the output start at 0 again. --- gst/frei0r/gstfrei0rsrc.c | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/gst/frei0r/gstfrei0rsrc.c b/gst/frei0r/gstfrei0rsrc.c index 77d29964e7..b5bba6de39 100644 --- a/gst/frei0r/gstfrei0rsrc.c +++ b/gst/frei0r/gstfrei0rsrc.c @@ -58,6 +58,16 @@ gst_frei0r_src_set_caps (GstBaseSrc * src, GstCaps * caps) return TRUE; } +static GstCaps * +gst_frei0r_src_get_caps (GstBaseSrc * src) +{ + if (GST_PAD_CAPS (GST_BASE_SRC_PAD (src))) + return gst_caps_ref (GST_PAD_CAPS (GST_BASE_SRC_PAD (src))); + else + return + gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD (src))); +} + static GstFlowReturn gst_frei0r_src_create (GstPushSrc * src, GstBuffer ** buf) { @@ -116,29 +126,6 @@ gst_frei0r_src_create (GstPushSrc * src, GstBuffer ** buf) return GST_FLOW_OK; } -static void -gst_frei0r_src_get_times (GstBaseSrc * basesrc, GstBuffer * buffer, - GstClockTime * start, GstClockTime * end) -{ - /* for live sources, sync on the timestamp of the buffer */ - if (gst_base_src_is_live (basesrc)) { - GstClockTime timestamp = GST_BUFFER_TIMESTAMP (buffer); - - if (GST_CLOCK_TIME_IS_VALID (timestamp)) { - /* get duration to calculate end time */ - GstClockTime duration = GST_BUFFER_DURATION (buffer); - - if (GST_CLOCK_TIME_IS_VALID (duration)) { - *end = timestamp + duration; - } - *start = timestamp; - } - } else { - *start = -1; - *end = -1; - } -} - static gboolean gst_frei0r_src_start (GstBaseSrc * basesrc) { @@ -358,10 +345,10 @@ gst_frei0r_src_class_init (GstFrei0rSrcClass * klass, gst_element_class_add_pad_template (gstelement_class, templ); gstbasesrc_class->set_caps = gst_frei0r_src_set_caps; + gstbasesrc_class->get_caps = gst_frei0r_src_get_caps; gstbasesrc_class->is_seekable = gst_frei0r_src_is_seekable; gstbasesrc_class->do_seek = gst_frei0r_src_do_seek; gstbasesrc_class->query = gst_frei0r_src_query; - gstbasesrc_class->get_times = gst_frei0r_src_get_times; gstbasesrc_class->start = gst_frei0r_src_start; gstbasesrc_class->stop = gst_frei0r_src_stop;