aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/hlsenc.c
diff options
context:
space:
mode:
authorDeHackEd <git@dehacked.net>2017-08-06 15:10:35 +0800
committerSteven Liu <lq@chinaffmpeg.org>2017-08-06 15:10:35 +0800
commiteabeb9093abe0169a574945760ad3a26bf47cba4 (patch)
treeb2df573b94fbbaca1201ecfea7373aefa5065a9a /libavformat/hlsenc.c
parent1e443051b277f73b94a2f660d3fd31a1a7beab52 (diff)
downloadffmpeg-eabeb9093abe0169a574945760ad3a26bf47cba4.tar.gz
avformat/hlsenc: allow dynamic encryption key rotation
Makes behaviour of 805ce25b1d2f optional, re-enables HLS key rotation feature Reviewed-by: Steven Liu <lq@onvideo.cn> Signed-off-by: DHE <git@dehacked.net>
Diffstat (limited to 'libavformat/hlsenc.c')
-rw-r--r--libavformat/hlsenc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 5cf8c89ee7..74a3249b73 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -85,6 +85,7 @@ typedef enum HLSFlags {
HLS_SECOND_LEVEL_SEGMENT_DURATION = (1 << 9), // include segment duration (microsec) in segment filenames when use_localtime e.g.: %%09t
HLS_SECOND_LEVEL_SEGMENT_SIZE = (1 << 10), // include segment size (bytes) in segment filenames when use_localtime e.g.: %%014s
HLS_TEMP_FILE = (1 << 11),
+ HLS_PERIODIC_REKEY = (1 << 12),
} HLSFlags;
typedef enum {
@@ -1236,7 +1237,7 @@ static int hls_start(AVFormatContext *s)
" will use -hls_key_info_file priority\n");
}
- if (c->number <= 1) {
+ if (c->number <= 1 || (c->flags & HLS_PERIODIC_REKEY)) {
if (c->key_info_file) {
if ((err = hls_encryption_start(s)) < 0)
goto fail;
@@ -1804,6 +1805,7 @@ static const AVOption options[] = {
{"second_level_segment_index", "include segment index in segment filenames when use_localtime", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_SECOND_LEVEL_SEGMENT_INDEX }, 0, UINT_MAX, E, "flags"},
{"second_level_segment_duration", "include segment duration in segment filenames when use_localtime", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_SECOND_LEVEL_SEGMENT_DURATION }, 0, UINT_MAX, E, "flags"},
{"second_level_segment_size", "include segment size in segment filenames when use_localtime", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_SECOND_LEVEL_SEGMENT_SIZE }, 0, UINT_MAX, E, "flags"},
+ {"periodic_rekey", "reload keyinfo file periodically for re-keying", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_PERIODIC_REKEY }, 0, UINT_MAX, E, "flags"},
{"use_localtime", "set filename expansion with strftime at segment creation", OFFSET(use_localtime), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E },
{"use_localtime_mkdir", "create last directory component in strftime-generated filename", OFFSET(use_localtime_mkdir), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E },
{"hls_playlist_type", "set the HLS playlist type", OFFSET(pl_type), AV_OPT_TYPE_INT, {.i64 = PLAYLIST_TYPE_NONE }, 0, PLAYLIST_TYPE_NB-1, E, "pl_type" },