mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
hlsdemux: Don't store the current key in the playlist
It's per fragment and applying to all following fragments until the next key is specified.
This commit is contained in:
parent
008edeadae
commit
37ffe063f6
2 changed files with 8 additions and 7 deletions
|
@ -73,7 +73,6 @@ gst_m3u8_free (GstM3U8 * self)
|
||||||
g_free (self->base_uri);
|
g_free (self->base_uri);
|
||||||
g_free (self->name);
|
g_free (self->name);
|
||||||
g_free (self->codecs);
|
g_free (self->codecs);
|
||||||
g_free (self->key);
|
|
||||||
|
|
||||||
g_list_foreach (self->files, (GFunc) gst_m3u8_media_file_free, NULL);
|
g_list_foreach (self->files, (GFunc) gst_m3u8_media_file_free, NULL);
|
||||||
g_list_free (self->files);
|
g_list_free (self->files);
|
||||||
|
@ -137,7 +136,6 @@ _m3u8_copy (const GstM3U8 * self, GstM3U8 * parent)
|
||||||
dup->version = self->version;
|
dup->version = self->version;
|
||||||
dup->targetduration = self->targetduration;
|
dup->targetduration = self->targetduration;
|
||||||
dup->allowcache = self->allowcache;
|
dup->allowcache = self->allowcache;
|
||||||
dup->key = g_strdup (self->key);
|
|
||||||
dup->bandwidth = self->bandwidth;
|
dup->bandwidth = self->bandwidth;
|
||||||
dup->program_id = self->program_id;
|
dup->program_id = self->program_id;
|
||||||
dup->codecs = g_strdup (self->codecs);
|
dup->codecs = g_strdup (self->codecs);
|
||||||
|
@ -350,6 +348,7 @@ gst_m3u8_update (GstM3U8 * self, gchar * data, gboolean * updated)
|
||||||
gchar *title, *end;
|
gchar *title, *end;
|
||||||
gboolean discontinuity = FALSE;
|
gboolean discontinuity = FALSE;
|
||||||
GstM3U8 *list;
|
GstM3U8 *list;
|
||||||
|
gchar *current_key = NULL;
|
||||||
gboolean have_iv = FALSE;
|
gboolean have_iv = FALSE;
|
||||||
guint8 iv[16] = { 0, };
|
guint8 iv[16] = { 0, };
|
||||||
gint64 size = -1, offset = -1;
|
gint64 size = -1, offset = -1;
|
||||||
|
@ -431,7 +430,7 @@ gst_m3u8_update (GstM3U8 * self, gchar * data, gboolean * updated)
|
||||||
self->mediasequence++);
|
self->mediasequence++);
|
||||||
|
|
||||||
/* set encryption params */
|
/* set encryption params */
|
||||||
file->key = g_strdup (self->key);
|
file->key = current_key ? g_strdup (current_key) : NULL;
|
||||||
if (file->key) {
|
if (file->key) {
|
||||||
if (have_iv) {
|
if (have_iv) {
|
||||||
memcpy (file->iv, iv, sizeof (iv));
|
memcpy (file->iv, iv, sizeof (iv));
|
||||||
|
@ -562,8 +561,8 @@ gst_m3u8_update (GstM3U8 * self, gchar * data, gboolean * updated)
|
||||||
|
|
||||||
/* IV and KEY are only valid until the next #EXT-X-KEY */
|
/* IV and KEY are only valid until the next #EXT-X-KEY */
|
||||||
have_iv = FALSE;
|
have_iv = FALSE;
|
||||||
g_free (self->key);
|
g_free (current_key);
|
||||||
self->key = NULL;
|
current_key = NULL;
|
||||||
while (data && parse_attributes (&data, &a, &v)) {
|
while (data && parse_attributes (&data, &a, &v)) {
|
||||||
if (g_str_equal (a, "URI")) {
|
if (g_str_equal (a, "URI")) {
|
||||||
gchar *key = g_strdup (v);
|
gchar *key = g_strdup (v);
|
||||||
|
@ -588,7 +587,7 @@ gst_m3u8_update (GstM3U8 * self, gchar * data, gboolean * updated)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self->key =
|
current_key =
|
||||||
uri_join (self->base_uri ? self->base_uri : self->uri, key);
|
uri_join (self->base_uri ? self->base_uri : self->uri, key);
|
||||||
g_free (keyp);
|
g_free (keyp);
|
||||||
} else if (g_str_equal (a, "IV")) {
|
} else if (g_str_equal (a, "IV")) {
|
||||||
|
@ -663,6 +662,9 @@ gst_m3u8_update (GstM3U8 * self, gchar * data, gboolean * updated)
|
||||||
data = g_utf8_next_char (end); /* skip \n */
|
data = g_utf8_next_char (end); /* skip \n */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free (current_key);
|
||||||
|
current_key = NULL;
|
||||||
|
|
||||||
/* reorder playlists by bitrate */
|
/* reorder playlists by bitrate */
|
||||||
if (self->lists) {
|
if (self->lists) {
|
||||||
gchar *top_variant_uri = NULL;
|
gchar *top_variant_uri = NULL;
|
||||||
|
|
|
@ -47,7 +47,6 @@ struct _GstM3U8
|
||||||
gint version; /* last EXT-X-VERSION */
|
gint version; /* last EXT-X-VERSION */
|
||||||
GstClockTime targetduration; /* last EXT-X-TARGETDURATION */
|
GstClockTime targetduration; /* last EXT-X-TARGETDURATION */
|
||||||
gboolean allowcache; /* last EXT-X-ALLOWCACHE */
|
gboolean allowcache; /* last EXT-X-ALLOWCACHE */
|
||||||
gchar *key;
|
|
||||||
|
|
||||||
gint bandwidth;
|
gint bandwidth;
|
||||||
gint program_id;
|
gint program_id;
|
||||||
|
|
Loading…
Reference in a new issue