mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
hlsdemux: set duration in outgoing buffers
Currently we push each fragment as a single buffer.
This commit is contained in:
parent
7ec71fb446
commit
851e9b1f8d
3 changed files with 15 additions and 13 deletions
|
@ -1015,12 +1015,11 @@ gst_hls_demux_get_next_fragment (GstHLSDemux * demux, gboolean retry)
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
guint avail;
|
guint avail;
|
||||||
const gchar *next_fragment_uri;
|
const gchar *next_fragment_uri;
|
||||||
|
GstClockTime duration;
|
||||||
gboolean discont;
|
gboolean discont;
|
||||||
|
|
||||||
next_fragment_uri =
|
if (!gst_m3u8_client_get_next_fragment (demux->client, &discont,
|
||||||
gst_m3u8_client_get_next_fragment (demux->client, &discont);
|
&next_fragment_uri, &duration)) {
|
||||||
|
|
||||||
if (!next_fragment_uri) {
|
|
||||||
GST_INFO_OBJECT (demux, "This playlist doesn't contain more fragments");
|
GST_INFO_OBJECT (demux, "This playlist doesn't contain more fragments");
|
||||||
demux->end_of_playlist = TRUE;
|
demux->end_of_playlist = TRUE;
|
||||||
GST_TASK_SIGNAL (demux->task);
|
GST_TASK_SIGNAL (demux->task);
|
||||||
|
@ -1034,6 +1033,7 @@ gst_hls_demux_get_next_fragment (GstHLSDemux * demux, gboolean retry)
|
||||||
|
|
||||||
avail = gst_adapter_available (demux->download);
|
avail = gst_adapter_available (demux->download);
|
||||||
buf = gst_adapter_take_buffer (demux->download, avail);
|
buf = gst_adapter_take_buffer (demux->download, avail);
|
||||||
|
GST_BUFFER_DURATION (buf) = duration;
|
||||||
|
|
||||||
if (G_UNLIKELY (demux->input_caps == NULL)) {
|
if (G_UNLIKELY (demux->input_caps == NULL)) {
|
||||||
demux->input_caps = gst_type_find_helper_for_buffer (NULL, buf, NULL);
|
demux->input_caps = gst_type_find_helper_for_buffer (NULL, buf, NULL);
|
||||||
|
|
|
@ -432,29 +432,31 @@ _find_next (GstM3U8MediaFile * file, GstM3U8Client * client)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
const gchar *
|
gboolean
|
||||||
gst_m3u8_client_get_next_fragment (GstM3U8Client * client,
|
gst_m3u8_client_get_next_fragment (GstM3U8Client * client,
|
||||||
gboolean * discontinuity)
|
gboolean * discontinuity, const gchar ** uri, GstClockTime * duration)
|
||||||
{
|
{
|
||||||
GList *l;
|
GList *l;
|
||||||
GstM3U8MediaFile *file;
|
GstM3U8MediaFile *file;
|
||||||
|
|
||||||
g_return_val_if_fail (client != NULL, NULL);
|
g_return_val_if_fail (client != NULL, FALSE);
|
||||||
g_return_val_if_fail (client->current != NULL, NULL);
|
g_return_val_if_fail (client->current != NULL, FALSE);
|
||||||
g_return_val_if_fail (discontinuity != NULL, NULL);
|
g_return_val_if_fail (discontinuity != NULL, FALSE);
|
||||||
|
|
||||||
GST_DEBUG ("Looking for fragment %d", client->sequence);
|
GST_DEBUG ("Looking for fragment %d", client->sequence);
|
||||||
l = g_list_find_custom (client->current->files, client,
|
l = g_list_find_custom (client->current->files, client,
|
||||||
(GCompareFunc) _find_next);
|
(GCompareFunc) _find_next);
|
||||||
if (l == NULL)
|
if (l == NULL)
|
||||||
return NULL;
|
return FALSE;
|
||||||
|
|
||||||
file = GST_M3U8_MEDIA_FILE (l->data);
|
file = GST_M3U8_MEDIA_FILE (l->data);
|
||||||
|
|
||||||
*discontinuity = client->sequence != file->sequence;
|
*discontinuity = client->sequence != file->sequence;
|
||||||
client->sequence = file->sequence + 1;
|
client->sequence = file->sequence + 1;
|
||||||
|
|
||||||
return file->uri;
|
*uri = file->uri;
|
||||||
|
*duration = file->duration * GST_SECOND;
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -75,8 +75,8 @@ GstM3U8Client *gst_m3u8_client_new (const gchar * uri);
|
||||||
void gst_m3u8_client_free (GstM3U8Client * client);
|
void gst_m3u8_client_free (GstM3U8Client * client);
|
||||||
gboolean gst_m3u8_client_update (GstM3U8Client * client, gchar * data);
|
gboolean gst_m3u8_client_update (GstM3U8Client * client, gchar * data);
|
||||||
void gst_m3u8_client_set_current (GstM3U8Client * client, GstM3U8 * m3u8);
|
void gst_m3u8_client_set_current (GstM3U8Client * client, GstM3U8 * m3u8);
|
||||||
const gchar *gst_m3u8_client_get_next_fragment (GstM3U8Client * client,
|
gboolean gst_m3u8_client_get_next_fragment (GstM3U8Client * client,
|
||||||
gboolean * discontinuity);
|
gboolean * discontinuity, const gchar ** uri, GstClockTime * duration);
|
||||||
GstClockTime gst_m3u8_client_get_duration (GstM3U8Client * client);
|
GstClockTime gst_m3u8_client_get_duration (GstM3U8Client * client);
|
||||||
const gchar *gst_m3u8_client_get_uri(GstM3U8Client * client);
|
const gchar *gst_m3u8_client_get_uri(GstM3U8Client * client);
|
||||||
gboolean gst_m3u8_client_has_variant_playlist(GstM3U8Client * client);
|
gboolean gst_m3u8_client_has_variant_playlist(GstM3U8Client * client);
|
||||||
|
|
Loading…
Reference in a new issue