From 5f55ea1ef31ab598751d2b98b5a66360f647ea1b Mon Sep 17 00:00:00 2001 From: Andoni Morales Alastruey Date: Fri, 9 Nov 2012 15:37:57 +0100 Subject: [PATCH] videodecoder: add getter for QoS proportion and earliest_time Add a getter for the QoS proportion and earliest_time to help subclasses do better estimations based on the proportion. API: gst_video_decoder_get_qos_info() https://bugzilla.gnome.org/show_bug.cgi?id=687991 --- docs/libs/gst-plugins-base-libs-sections.txt | 1 + gst-libs/gst/video/gstvideodecoder.c | 28 ++++++++++++++++++++ gst-libs/gst/video/gstvideodecoder.h | 4 +++ win32/common/libgstvideo.def | 1 + 4 files changed, 34 insertions(+) diff --git a/docs/libs/gst-plugins-base-libs-sections.txt b/docs/libs/gst-plugins-base-libs-sections.txt index 68e2b80e52..ee2ea4b9c9 100644 --- a/docs/libs/gst-plugins-base-libs-sections.txt +++ b/docs/libs/gst-plugins-base-libs-sections.txt @@ -2253,6 +2253,7 @@ gst_video_decoder_get_max_decode_time gst_video_decoder_get_max_errors gst_video_decoder_get_oldest_frame gst_video_decoder_get_packetized +gst_video_decoder_get_qos_info gst_video_decoder_have_frame gst_video_decoder_get_latency gst_video_decoder_set_latency diff --git a/gst-libs/gst/video/gstvideodecoder.c b/gst-libs/gst/video/gstvideodecoder.c index 2aa98751e4..d48aa0a749 100644 --- a/gst-libs/gst/video/gstvideodecoder.c +++ b/gst-libs/gst/video/gstvideodecoder.c @@ -3158,6 +3158,34 @@ gst_video_decoder_get_max_decode_time (GstVideoDecoder * return deadline; } +/** + * gst_video_decoder_get_qos_info: + * @decoder: a #GstVideoDecoder + * @proportion: (out) (allow-none): address of variable in which to store the + * current QoS proportion, or %NULL + * @earliest_time: (out) (allow-none): address of variable in which to store the + * QoS earliest_time, or %NULL + * + * Returns: TRUE on success + * + * Since: 1.0.3 + */ +gboolean +gst_video_decoder_get_qos_info (GstVideoDecoder * decoder, gdouble * proportion, + GstClockTime * earliest_time) +{ + g_return_val_if_fail (GST_IS_VIDEO_DECODER (decoder), FALSE); + + GST_OBJECT_LOCK (decoder); + if (proportion != NULL) + *proportion = decoder->priv->proportion; + if (earliest_time != NULL) + *earliest_time = decoder->priv->earliest_time; + GST_OBJECT_UNLOCK (decoder); + + return TRUE; +} + GstFlowReturn _gst_video_decoder_error (GstVideoDecoder * dec, gint weight, GQuark domain, gint code, gchar * txt, gchar * dbg, const gchar * file, diff --git a/gst-libs/gst/video/gstvideodecoder.h b/gst-libs/gst/video/gstvideodecoder.h index adcd5a19bb..9dbe571e98 100644 --- a/gst-libs/gst/video/gstvideodecoder.h +++ b/gst-libs/gst/video/gstvideodecoder.h @@ -353,6 +353,10 @@ gboolean gst_video_decoder_negotiate (GstVideoDecoder * decode GstClockTimeDiff gst_video_decoder_get_max_decode_time (GstVideoDecoder *decoder, GstVideoCodecFrame *frame); +gboolean gst_video_decoder_get_qos_info (GstVideoDecoder * decoder, + gdouble *proportion, + GstClockTime *earliest_time); + GstFlowReturn gst_video_decoder_finish_frame (GstVideoDecoder *decoder, GstVideoCodecFrame *frame); diff --git a/win32/common/libgstvideo.def b/win32/common/libgstvideo.def index ad4080597b..797287e95e 100644 --- a/win32/common/libgstvideo.def +++ b/win32/common/libgstvideo.def @@ -88,6 +88,7 @@ EXPORTS gst_video_decoder_get_oldest_frame gst_video_decoder_get_output_state gst_video_decoder_get_packetized + gst_video_decoder_get_qos_info gst_video_decoder_get_type gst_video_decoder_have_frame gst_video_decoder_merge_tags