summaryrefslogtreecommitdiff
path: root/libavformat/dashenc.c
diff options
context:
space:
mode:
authorTimo Rothenpieler <timo@rothenpieler.org>2015-03-01 22:59:55 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-03-02 21:40:26 +0100
commit6cfd536675092489b9f384f8553ad97a96a10731 (patch)
tree96fa25100ec77309ec57a5981cde0df1d5793a90 /libavformat/dashenc.c
parentb86af8da3100a7eef3247747cd469b988f134e0d (diff)
avformat/dashenc: Update codec_str on extradata_size change
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/dashenc.c')
-rw-r--r--libavformat/dashenc.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index a6792c1957..25c699e5d5 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -72,6 +72,7 @@ typedef struct OutputStream {
int bit_rate;
char bandwidth_str[64];
+ int codec_str_extradata_size;
char codec_str[100];
} OutputStream;
@@ -501,6 +502,13 @@ static int write_manifest(AVFormatContext *s, int final)
if (st->codec->codec_type != AVMEDIA_TYPE_VIDEO)
continue;
+
+ if (os->codec_str_extradata_size != st->codec->extradata_size) {
+ memset(os->codec_str, 0, sizeof(os->codec_str));
+ set_codec_str(s, st->codec, os->codec_str, sizeof(os->codec_str));
+ os->codec_str_extradata_size = st->codec->extradata_size;
+ }
+
avio_printf(out, "\t\t\t<Representation id=\"%d\" mimeType=\"video/mp4\" codecs=\"%s\"%s width=\"%d\" height=\"%d\">\n", i, os->codec_str, os->bandwidth_str, st->codec->width, st->codec->height);
output_segment_list(&c->streams[i], out, c);
avio_printf(out, "\t\t\t</Representation>\n");
@@ -515,6 +523,13 @@ static int write_manifest(AVFormatContext *s, int final)
if (st->codec->codec_type != AVMEDIA_TYPE_AUDIO)
continue;
+
+ if (os->codec_str_extradata_size != st->codec->extradata_size) {
+ memset(os->codec_str, 0, sizeof(os->codec_str));
+ set_codec_str(s, st->codec, os->codec_str, sizeof(os->codec_str));
+ os->codec_str_extradata_size = st->codec->extradata_size;
+ }
+
avio_printf(out, "\t\t\t<Representation id=\"%d\" mimeType=\"audio/mp4\" codecs=\"%s\"%s audioSamplingRate=\"%d\">\n", i, os->codec_str, os->bandwidth_str, st->codec->sample_rate);
avio_printf(out, "\t\t\t\t<AudioChannelConfiguration schemeIdUri=\"urn:mpeg:dash:23003:3:audio_channel_configuration:2011\" value=\"%d\" />\n", st->codec->channels);
output_segment_list(&c->streams[i], out, c);
@@ -649,7 +664,8 @@ static int dash_write_header(AVFormatContext *s)
else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
c->has_audio = 1;
- set_codec_str(s, os->ctx->streams[0]->codec, os->codec_str, sizeof(os->codec_str));
+ set_codec_str(s, s->streams[i]->codec, os->codec_str, sizeof(os->codec_str));
+ os->codec_str_extradata_size = s->streams[i]->codec->extradata_size;
os->first_pts = AV_NOPTS_VALUE;
os->max_pts = AV_NOPTS_VALUE;
os->segment_index = 1;