diff options
author | Steven Liu <lq@chinaffmpeg.org> | 2017-04-28 10:17:40 +0800 |
---|---|---|
committer | Steven Liu <lq@chinaffmpeg.org> | 2017-04-28 10:17:40 +0800 |
commit | 363e4f0810d4085bbee3dced41a2de2d2c135dca (patch) | |
tree | 52bc9d39443341e699972cbc6ec19a71e4de2c58 /libavformat/hlsenc.c | |
parent | f7542d7e35e9bb9aff7829c15c78b9b467627482 (diff) | |
download | ffmpeg-363e4f0810d4085bbee3dced41a2de2d2c135dca.tar.gz |
avformat/hlsenc: hold old key info when append list
fix ticket id: #6353
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Diffstat (limited to 'libavformat/hlsenc.c')
-rw-r--r-- | libavformat/hlsenc.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 27c8e3355d..3ec0f330fb 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -810,6 +810,7 @@ static int parse_playlist(AVFormatContext *s, const char *url) int64_t new_start_pos; char line[1024]; const char *ptr; + const char *end; if ((ret = ffio_open_whitelist(&in, url, AVIO_FLAG_READ, &s->interrupt_callback, NULL, @@ -842,6 +843,29 @@ static int parse_playlist(AVFormatContext *s, const char *url) } else if (av_strstart(line, "#EXTINF:", &ptr)) { is_segment = 1; hls->duration = atof(ptr); + } else if (av_stristart(line, "#EXT-X-KEY:", &ptr)) { + ptr = av_stristr(line, "URI=\""); + if (ptr) { + ptr += strlen("URI=\""); + end = av_stristr(ptr, ","); + if (end) { + av_strlcpy(hls->key_uri, ptr, end - ptr); + } else { + av_strlcpy(hls->key_uri, ptr, sizeof(hls->key_uri)); + } + } + + ptr = av_stristr(line, "IV=0x"); + if (ptr) { + ptr += strlen("IV=0x"); + end = av_stristr(ptr, ","); + if (end) { + av_strlcpy(hls->iv_string, ptr, end - ptr); + } else { + av_strlcpy(hls->iv_string, ptr, sizeof(hls->iv_string)); + } + } + } else if (av_strstart(line, "#", NULL)) { continue; } else if (line[0]) { |