[gst-cvs] gst-plugins-base: appsrc: Update segment duration and post a duration message if the duration changes
Sebastian Dröge
slomo at kemper.freedesktop.org
Fri Feb 12 02:02:54 PST 2010
Module: gst-plugins-base
Branch: master
Commit: b5fd5953d1f5fe54f2c6a1dadf8f22bd70bd776b
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=b5fd5953d1f5fe54f2c6a1dadf8f22bd70bd776b
Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date: Tue Feb 9 17:39:21 2010 +0100
appsrc: Update segment duration and post a duration message if the duration changes
Fixes bug #609423.
---
gst-libs/gst/app/gstappsrc.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/gst-libs/gst/app/gstappsrc.c b/gst-libs/gst/app/gstappsrc.c
index 32a0596..6b9512b 100644
--- a/gst-libs/gst/app/gstappsrc.c
+++ b/gst-libs/gst/app/gstappsrc.c
@@ -1049,13 +1049,26 @@ gst_app_src_get_caps (GstAppSrc * appsrc)
void
gst_app_src_set_size (GstAppSrc * appsrc, gint64 size)
{
+ GstSegment *segment;
+ gboolean bytes_segment;
+
g_return_if_fail (appsrc != NULL);
g_return_if_fail (GST_IS_APP_SRC (appsrc));
GST_OBJECT_LOCK (appsrc);
GST_DEBUG_OBJECT (appsrc, "setting size of %" G_GINT64_FORMAT, size);
appsrc->priv->size = size;
+
+ segment = &GST_BASE_SRC_CAST (appsrc)->segment;
+ bytes_segment = (segment->format == GST_FORMAT_BYTES);
+
+ if (bytes_segment)
+ gst_segment_set_duration (segment, GST_FORMAT_BYTES, size);
GST_OBJECT_UNLOCK (appsrc);
+
+ if (bytes_segment)
+ gst_element_post_message (GST_ELEMENT (appsrc),
+ gst_message_new_duration (GST_OBJECT (appsrc), GST_FORMAT_BYTES, size));
}
/**
More information about the Gstreamer-commits
mailing list