[FFmpeg-devel] [PATCH 4/4] avformat/hlsenc: add http options to m3u8 hlsenc

Steven Liu lq at chinaffmpeg.org
Mon Dec 18 10:47:54 EET 2017


Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
---
 libavformat/hlsenc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 0cb75ff198..636b7db183 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1723,6 +1723,7 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
     int stream_index = 0;
     int range_length = 0;
     uint8_t *buffer = NULL;
+    AVDictionary *options = NULL;
     VariantStream *vs = NULL;
 
     for (i = 0; i < hls->nb_varstreams; i++) {
@@ -1835,7 +1836,8 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
         }
 
         if (hls->segment_type == SEGMENT_TYPE_FMP4) {
-            ret = hlsenc_io_open(s, &vs->out, vs->avf->filename, NULL);
+            set_http_options(s, &options, hls);
+            ret = hlsenc_io_open(s, &vs->out, vs->avf->filename, &options);
             if (ret < 0) {
                 av_log(NULL, AV_LOG_ERROR, "Failed to open file '%s'\n",
                     vs->avf->filename);
@@ -1899,6 +1901,7 @@ static int hls_write_trailer(struct AVFormatContext *s)
     HLSContext *hls = s->priv_data;
     AVFormatContext *oc = NULL;
     AVFormatContext *vtt_oc = NULL;
+    AVDictionary *options = NULL;
     char *old_filename = NULL;
     int i;
     int ret = 0;
@@ -1916,7 +1919,8 @@ static int hls_write_trailer(struct AVFormatContext *s)
     }
     if ( hls->segment_type == SEGMENT_TYPE_FMP4) {
         int range_length = 0;
-        ret = hlsenc_io_open(s, &vs->out, vs->avf->filename, NULL);
+        set_http_options(s, &options, hls);
+        ret = hlsenc_io_open(s, &vs->out, vs->avf->filename, &options);
         if (ret < 0) {
             av_log(NULL, AV_LOG_ERROR, "Failed to open file '%s'\n", vs->avf->filename);
             return AVERROR(ENOENT);
-- 
2.14.3 (Apple Git-98)





More information about the ffmpeg-devel mailing list