summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Liu <lq@chinaffmpeg.org>2020-03-12 14:00:45 +0800
committerSteven Liu <lq@chinaffmpeg.org>2020-03-12 14:00:45 +0800
commit31bc1c44d634ac52a25fbad1d096f26793c3888a (patch)
treeed6db2ff035eea154e37ba87fbf899fe7b11c6be
parent5c72bb62a97fa6ae407ca55184fc0519e641f727 (diff)
downloadffmpeg-31bc1c44d634ac52a25fbad1d096f26793c3888a.tar.gz
avformat/hlsenc: set the options when open the key info files
make the options same as segments for the http put method Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
-rw-r--r--libavformat/hlsenc.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 19aa2b1208..b4c72b6e54 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -686,6 +686,7 @@ static int do_encrypt(AVFormatContext *s, VariantStream *vs)
}
if (!*hls->key_string) {
+ AVDictionary *options = NULL;
if (!hls->key) {
if ((ret = randomize(key, sizeof(key))) < 0) {
av_log(s, AV_LOG_ERROR, "Cannot generate a strong random key\n");
@@ -696,7 +697,10 @@ static int do_encrypt(AVFormatContext *s, VariantStream *vs)
}
ff_data_to_hex(hls->key_string, key, sizeof(key), 0);
- if ((ret = s->io_open(s, &pb, hls->key_file, AVIO_FLAG_WRITE, NULL)) < 0)
+ set_http_options(s, &options, hls);
+ ret = s->io_open(s, &pb, hls->key_file, AVIO_FLAG_WRITE, &options);
+ av_dict_free(&options);
+ if (ret < 0)
return ret;
avio_seek(pb, 0, SEEK_CUR);
avio_write(pb, key, KEYSIZE);
@@ -712,8 +716,12 @@ static int hls_encryption_start(AVFormatContext *s)
int ret;
AVIOContext *pb;
uint8_t key[KEYSIZE];
+ AVDictionary *options = NULL;
- if ((ret = s->io_open(s, &pb, hls->key_info_file, AVIO_FLAG_READ, NULL)) < 0) {
+ set_http_options(s, &options, hls);
+ ret = s->io_open(s, &pb, hls->key_info_file, AVIO_FLAG_READ, &options);
+ av_dict_free(&options);
+ if (ret < 0) {
av_log(hls, AV_LOG_ERROR,
"error opening key info file %s\n", hls->key_info_file);
return ret;
@@ -740,7 +748,10 @@ static int hls_encryption_start(AVFormatContext *s)
return AVERROR(EINVAL);
}
- if ((ret = s->io_open(s, &pb, hls->key_file, AVIO_FLAG_READ, NULL)) < 0) {
+ set_http_options(s, &options, hls);
+ ret = s->io_open(s, &pb, hls->key_file, AVIO_FLAG_READ, &options);
+ av_dict_free(&options);
+ if (ret < 0) {
av_log(hls, AV_LOG_ERROR, "error opening key file %s\n", hls->key_file);
return ret;
}