[FFmpeg-devel] [PATCH] Added bandwidth parameter manual configurare in HLS master playlist
Dhanish Vijayan
dhanishvijayan at gmail.com
Fri Apr 16 11:22:36 EEST 2021
---
libavformat/hlsenc.c | 8 ++++++++
1 file changed, 8 insertions(+)
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;
--
2.25.1
More information about the ffmpeg-devel
mailing list