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

Submitted by Steven Liu on Dec. 18, 2017, 8:47 a.m.

Details

Message ID 20171218084754.14053-1-lq@chinaffmpeg.org
State New
Headers show

Commit Message

Steven Liu Dec. 18, 2017, 8:47 a.m.
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/hlsenc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

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);