From 60f3a9de93bee2febeda99e58725e541d0a5ffb3 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 3 May 2007 14:54:34 +0000 Subject: [PATCH] API: gst_base_src_query_latency(). Added method so that subclasses can easily get the latency values of the base sour... Original commit message from CVS: * docs/libs/gstreamer-libs-sections.txt: * libs/gst/base/gstbasesrc.c: (gst_base_src_query_latency), (gst_base_src_default_query), (gst_base_src_get_range): * libs/gst/base/gstbasesrc.h: API: gst_base_src_query_latency(). Added method so that subclasses can easily get the latency values of the base source class. --- ChangeLog | 9 +++++++ docs/libs/gstreamer-libs-sections.txt | 1 + libs/gst/base/gstbasesrc.c | 50 ++++++++++++++++++++++++++++++----- libs/gst/base/gstbasesrc.h | 4 +++ 4 files changed, 57 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index a4434b7..2bf84a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-05-03 Wim Taymans + + * docs/libs/gstreamer-libs-sections.txt: + * libs/gst/base/gstbasesrc.c: (gst_base_src_query_latency), + (gst_base_src_default_query), (gst_base_src_get_range): + * libs/gst/base/gstbasesrc.h: + API: gst_base_src_query_latency(). Added method so that subclasses can + easily get the latency values of the base source class. + 2007-05-02 Zaheer Abbas Merali <> * tools/gst-inspect.c (print_implementation_info): diff --git a/docs/libs/gstreamer-libs-sections.txt b/docs/libs/gstreamer-libs-sections.txt index 720a20f..f1227ea 100644 --- a/docs/libs/gstreamer-libs-sections.txt +++ b/docs/libs/gstreamer-libs-sections.txt @@ -154,6 +154,7 @@ gst_base_src_wait_playing gst_base_src_is_live gst_base_src_set_live gst_base_src_set_format +gst_base_src_query_latency GST_BASE_SRC_PAD diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index 6da492e..6f4ac2f 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -546,6 +546,40 @@ gst_base_src_set_format (GstBaseSrc * src, GstFormat format) gst_segment_init (&src->segment, format); } +/** + * gst_base_src_query_latency: + * @src: the source + * @live: if the source is live + * @min_latency: the min latency of the source + * @max_latency: the max latency of the source + * + * Query the source for the latency parameters. @live will be TRUE when @src is + * configured as a live source. @min_latency will be set as the latency between + * calling the create function and the timestamp on the resulting buffer. + * @max_latency is always the undefined value of -1. + * + * This function is mostly used by subclasses. + * + * Returns: TRUE if the query succeeded. + * + * Since: 0.10.13 + */ +gboolean +gst_base_src_query_latency (GstBaseSrc * src, gboolean * live, + GstClockTime * min_latency, GstClockTime * max_latency) +{ + GST_LIVE_LOCK (src); + if (live) + *live = src->is_live; + if (min_latency) + *min_latency = 0; + if (max_latency) + *max_latency = -1; + GST_LIVE_UNLOCK (src); + + return TRUE; +} + static gboolean gst_base_src_setcaps (GstPad * pad, GstCaps * caps) { @@ -740,14 +774,16 @@ gst_base_src_default_query (GstBaseSrc * src, GstQuery * query) break; } case GST_QUERY_LATENCY: - /* we can only report the fact that we are live or not, we know nothing - * about latency. Subclasses should override and implement something - * usefull */ - GST_LIVE_LOCK (src); - gst_query_set_latency (query, src->is_live, 0, -1); - GST_LIVE_UNLOCK (src); - res = TRUE; + { + GstClockTime min, max; + gboolean live; + + /* Subclasses should override and implement something usefull */ + res = gst_base_src_query_latency (src, &live, &min, &max); + + gst_query_set_latency (query, live, min, max); break; + } case GST_QUERY_JITTER: case GST_QUERY_RATE: default: diff --git a/libs/gst/base/gstbasesrc.h b/libs/gst/base/gstbasesrc.h index 2b85e95..4fcefea 100644 --- a/libs/gst/base/gstbasesrc.h +++ b/libs/gst/base/gstbasesrc.h @@ -237,6 +237,10 @@ gboolean gst_base_src_is_live (GstBaseSrc *src); void gst_base_src_set_format (GstBaseSrc *src, GstFormat format); +gboolean gst_base_src_query_latency (GstBaseSrc *src, gboolean * live, + GstClockTime * min_latency, + GstClockTime * max_latency); + G_END_DECLS #endif /* __GST_BASE_SRC_H__ */ -- 2.7.4