summaryrefslogtreecommitdiff
path: root/libavformat/webmdashenc.c
diff options
context:
space:
mode:
authorVignesh Venkatasubramanian <vigneshv-at-google.com@ffmpeg.org>2017-04-11 21:33:28 -0700
committerJames Zern <jzern@google.com>2017-04-17 10:46:51 -0700
commit62c27fdba43def4cdc2fb6f2df60c7ac87918d6c (patch)
tree698d9805372a91a25b575493c2b21637da14c81b /libavformat/webmdashenc.c
parente22d495538c1de6a13cf8f51e7448d3312365747 (diff)
webm_dash_manifest: Add option to specify bandwidth
Add an option to webm_dash_manifest demuxer to specify a value for "bandwidth" field in the DASH manifest. The value is then used by the muxer. Fixes an existing FIXME in the code. Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: James Zern <jzern@google.com>
Diffstat (limited to 'libavformat/webmdashenc.c')
-rw-r--r--libavformat/webmdashenc.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
index d4b3146790..602726caf9 100644
--- a/libavformat/webmdashenc.c
+++ b/libavformat/webmdashenc.c
@@ -182,14 +182,19 @@ static int write_representation(AVFormatContext *s, AVStream *stream, char *id,
AVDictionaryEntry *cues_end = av_dict_get(stream->metadata, CUES_END, NULL, 0);
AVDictionaryEntry *filename = av_dict_get(stream->metadata, FILENAME, NULL, 0);
AVDictionaryEntry *bandwidth = av_dict_get(stream->metadata, BANDWIDTH, NULL, 0);
+ const char *bandwidth_str;
if ((w->is_live && (!filename)) ||
(!w->is_live && (!irange || !cues_start || !cues_end || !filename || !bandwidth))) {
return AVERROR_INVALIDDATA;
}
avio_printf(s->pb, "<Representation id=\"%s\"", id);
- // FIXME: For live, This should be obtained from the input file or as an AVOption.
- avio_printf(s->pb, " bandwidth=\"%s\"",
- w->is_live ? (stream->codecpar->codec_type == AVMEDIA_TYPE_AUDIO ? "128000" : "1000000") : bandwidth->value);
+ // if bandwidth for live was not provided, use a default
+ if (w->is_live && !bandwidth) {
+ bandwidth_str = (stream->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) ? "128000" : "1000000";
+ } else {
+ bandwidth_str = bandwidth->value;
+ }
+ avio_printf(s->pb, " bandwidth=\"%s\"", bandwidth_str);
if (stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && output_width)
avio_printf(s->pb, " width=\"%d\"", stream->codecpar->width);
if (stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && output_height)