diff mbox series

[FFmpeg-devel] Added bandwidth parameter manual configurare in HLS master playlist

Message ID 20210416082236.143312-1-dhanishvijayan@gmail.com
State New
Headers show
Series [FFmpeg-devel] Added bandwidth parameter manual configurare in HLS master playlist
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Dhanish Vijayan April 16, 2021, 8:22 a.m. UTC
---
 libavformat/hlsenc.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 7d97ce1789..957eb609a0 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -183,6 +183,7 @@  typedef struct VariantStream {
     const char *sgroup;   /* subtitle group name */
     const char *ccgroup;  /* closed caption group name */
     const char *varname;  /* variant name */
+    int bandwidth;        /* bandwidth for the variant */
 } VariantStream;
 
 typedef struct ClosedCaptionsStream {
@@ -1492,6 +1493,10 @@  static int create_master_playlist(AVFormatContext *s,
             bandwidth += get_stream_bit_rate(aud_st);
         bandwidth += bandwidth / 10;
 
+        if (vs->bandwidth){
+            bandwidth = vs->bandwidth;
+        }
+
         ccgroup = NULL;
         if (vid_st && vs->ccgroup) {
             /* check if this group name is available in the cc map string */
@@ -2088,6 +2093,9 @@  static int parse_variant_stream_mapstring(AVFormatContext *s)
                                   (!av_strncasecmp(val, "1", strlen("1"))));
                 hls->has_default_key = 1;
                 continue;
+            } else if (av_strstart(keyval, "bandwidth:", &val)) {
+                vs->bandwidth  = strtoimax(val, NULL, 10);
+                continue;
             } else if (av_strstart(keyval, "name:", &val)) {
                 vs->varname  = val;
                 continue;