summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Schmidt <thaytan@noraisin.net>2009-11-21 16:37:34 +0100
committerJan Schmidt <thaytan@noraisin.net>2009-11-21 18:23:51 +0100
commit332eb4ea4d26bde76d30ca05f6804c43f6a48810 (patch)
treebccb36bbbb8d833abc36c354f85d1dc05beff7fb
parent022970e9f911da45215ae4faa4cf40d0bf1ddce2 (diff)
basesrc: Add gst_base_src_new_seamless_segment()
Merge new function from resindvd into the primary GstBaseSrc for starting a new seamless segment. API: gst_base_src_new_seamless_segment()
-rw-r--r--docs/libs/gstreamer-libs-sections.txt1
-rw-r--r--libs/gst/base/gstbasesrc.c63
-rw-r--r--libs/gst/base/gstbasesrc.h1
-rw-r--r--win32/common/libgstbase.def1
4 files changed, 66 insertions, 0 deletions
diff --git a/docs/libs/gstreamer-libs-sections.txt b/docs/libs/gstreamer-libs-sections.txt
index b7877b4e2a..9c5bb45421 100644
--- a/docs/libs/gstreamer-libs-sections.txt
+++ b/docs/libs/gstreamer-libs-sections.txt
@@ -237,6 +237,7 @@ gst_base_src_get_blocksize
gst_base_src_set_blocksize
gst_base_src_get_do_timestamp
gst_base_src_set_do_timestamp
+gst_base_src_new_seamless_segment
GST_BASE_SRC_PAD
<SUBSECTION Standard>
diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c
index 9053609a81..a416aac1fc 100644
--- a/libs/gst/base/gstbasesrc.c
+++ b/libs/gst/base/gstbasesrc.c
@@ -697,6 +697,69 @@ gst_base_src_get_do_timestamp (GstBaseSrc * src)
return res;
}
+/**
+ * gst_base_src_new_seamless_segment:
+ * @src: The source
+ * @start: The new start value for the segment
+ * @stop: Stop value for the new segment
+ * @position: The position value for the new segent
+ *
+ * Prepare a new seamless segment for emission downstream. This function must
+ * only be called by derived sub-classes, and only from the create() function,
+ * as the stream-lock needs to be held.
+ *
+ * The format for the new segment will be the current format of the source, as
+ * configured with gst_base_src_set_format()
+ *
+ * Returns: %TRUE if preparation of the seamless segment succeeded.
+ *
+ * Since: 0.10.26
+ */
+gboolean
+gst_base_src_new_seamless_segment (GstBaseSrc * src, gint64 start, gint64 stop,
+ gint64 position)
+{
+ gboolean res = TRUE;
+
+ GST_DEBUG_OBJECT (src,
+ "Starting new seamless segment. Start %" GST_TIME_FORMAT " stop %"
+ GST_TIME_FORMAT " position %" GST_TIME_FORMAT, GST_TIME_ARGS (start),
+ GST_TIME_ARGS (stop), GST_TIME_ARGS (position));
+
+ if (src->data.ABI.running) {
+ if (src->priv->close_segment)
+ gst_event_unref (src->priv->close_segment);
+ src->priv->close_segment =
+ gst_event_new_new_segment_full (TRUE,
+ src->segment.rate, src->segment.applied_rate, src->segment.format,
+ src->segment.start, src->segment.last_stop, src->segment.time);
+ }
+
+ gst_segment_set_newsegment_full (&src->segment, FALSE, src->segment.rate,
+ src->segment.applied_rate, src->segment.format, start, stop, position);
+
+ if (src->priv->start_segment)
+ gst_event_unref (src->priv->start_segment);
+ if (src->segment.rate >= 0.0) {
+ /* forward, we send data from last_stop to stop */
+ src->priv->start_segment =
+ gst_event_new_new_segment_full (FALSE,
+ src->segment.rate, src->segment.applied_rate, src->segment.format,
+ src->segment.last_stop, stop, src->segment.time);
+ } else {
+ /* reverse, we send data from last_stop to start */
+ src->priv->start_segment =
+ gst_event_new_new_segment_full (FALSE,
+ src->segment.rate, src->segment.applied_rate, src->segment.format,
+ src->segment.start, src->segment.last_stop, src->segment.time);
+ }
+
+ src->priv->discont = TRUE;
+ src->data.ABI.running = TRUE;
+
+ return res;
+}
+
static gboolean
gst_base_src_setcaps (GstPad * pad, GstCaps * caps)
{
diff --git a/libs/gst/base/gstbasesrc.h b/libs/gst/base/gstbasesrc.h
index 45cad9858c..7f46a7354d 100644
--- a/libs/gst/base/gstbasesrc.h
+++ b/libs/gst/base/gstbasesrc.h
@@ -247,6 +247,7 @@ gulong gst_base_src_get_blocksize (GstBaseSrc *src);
void gst_base_src_set_do_timestamp (GstBaseSrc *src, gboolean timestamp);
gboolean gst_base_src_get_do_timestamp (GstBaseSrc *src);
+gboolean gst_base_src_new_seamless_segment (GstBaseSrc *src, gint64 start, gint64 stop, gint64 position);
G_END_DECLS
#endif /* __GST_BASE_SRC_H__ */
diff --git a/win32/common/libgstbase.def b/win32/common/libgstbase.def
index d1fee7b10f..6064a62c6c 100644
--- a/win32/common/libgstbase.def
+++ b/win32/common/libgstbase.def
@@ -38,6 +38,7 @@ EXPORTS
gst_base_src_get_do_timestamp
gst_base_src_get_type
gst_base_src_is_live
+ gst_base_src_new_seamless_segment
gst_base_src_query_latency
gst_base_src_set_blocksize
gst_base_src_set_do_timestamp