From 613360878936e59232fe1b258f9b7109361610b7 Mon Sep 17 00:00:00 2001 From: Youness Alaoui Date: Fri, 2 Sep 2011 23:48:22 +0000 Subject: [PATCH] hlsdemux: Add a get_target_duration and get_current_uri api to m3u8_client --- gst/hls/m3u8.c | 26 ++++++++++++++++++++++++++ gst/hls/m3u8.h | 2 ++ 2 files changed, 28 insertions(+) diff --git a/gst/hls/m3u8.c b/gst/hls/m3u8.c index a17193fb7a..c407d72d83 100644 --- a/gst/hls/m3u8.c +++ b/gst/hls/m3u8.c @@ -535,6 +535,19 @@ gst_m3u8_client_get_duration (GstM3U8Client * client) return duration * GST_SECOND; } +GstClockTime +gst_m3u8_client_get_target_duration (GstM3U8Client * client) +{ + GstClockTime duration = 0; + + g_return_val_if_fail (client != NULL, GST_CLOCK_TIME_NONE); + + GST_M3U8_CLIENT_LOCK (client); + duration = client->current->targetduration; + GST_M3U8_CLIENT_UNLOCK (client); + return duration * GST_SECOND; +} + const gchar * gst_m3u8_client_get_uri (GstM3U8Client * client) { @@ -548,6 +561,19 @@ gst_m3u8_client_get_uri (GstM3U8Client * client) return uri; } +const gchar * +gst_m3u8_client_get_current_uri (GstM3U8Client * client) +{ + const gchar *uri; + + g_return_val_if_fail (client != NULL, NULL); + + GST_M3U8_CLIENT_LOCK (client); + uri = client->current->uri; + GST_M3U8_CLIENT_UNLOCK (client); + return uri; +} + gboolean gst_m3u8_client_has_variant_playlist (GstM3U8Client * client) { diff --git a/gst/hls/m3u8.h b/gst/hls/m3u8.h index 5223b5cd93..8c83990f87 100644 --- a/gst/hls/m3u8.h +++ b/gst/hls/m3u8.h @@ -85,7 +85,9 @@ gboolean gst_m3u8_client_get_next_fragment (GstM3U8Client * client, gboolean * discontinuity, const gchar ** uri, GstClockTime * duration, GstClockTime * timestamp); GstClockTime gst_m3u8_client_get_duration (GstM3U8Client * client); +GstClockTime gst_m3u8_client_get_target_duration (GstM3U8Client * client); const gchar *gst_m3u8_client_get_uri(GstM3U8Client * client); +const gchar *gst_m3u8_client_get_current_uri(GstM3U8Client * client); gboolean gst_m3u8_client_has_variant_playlist(GstM3U8Client * client); gboolean gst_m3u8_client_is_live(GstM3U8Client * client);