aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/dashenc.c
diff options
context:
space:
mode:
authorPeter Große <pegro@friiks.de>2017-01-29 15:26:29 +0100
committerMartin Storsjö <martin@martin.st>2017-01-31 00:33:07 +0200
commitca9bc9de690258d4761a19b0df6e9c9113b80115 (patch)
tree3b3cdb40eb6fbf735c9adb3b76b9063964ffdde7 /libavformat/dashenc.c
parentefd2fc41b3f0749f9715d50b581f22bbaa8c5b99 (diff)
downloadffmpeg-ca9bc9de690258d4761a19b0df6e9c9113b80115.tar.gz
dashenc: default to one AdaptationSet per stream
Previously all mapped streams of a media type (video, audio) where assigned to a single AdaptationSet. Using the DASH live profile it is mandatory, that the segments of all representations are aligned, which is currently not enforced. This leads to problems when using video streams with different key frame intervals. So to play safe, default to one AdaptationSet per stream, unless overwritten by explicit assignment. To get the old assignment scheme, use -adaptation_sets "id=0,streams=v id=1,streams=a" Signed-off-by: Peter Große <pegro@friiks.de> Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/dashenc.c')
-rw-r--r--libavformat/dashenc.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 12e6f9b5d9..286b24def3 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -524,26 +524,15 @@ static int parse_adaptation_sets(AVFormatContext *s)
enum { new_set, parse_id, parsing_streams } state;
AdaptationSet *as;
int i, n, ret;
- enum AVMediaType types[] = { AVMEDIA_TYPE_VIDEO, AVMEDIA_TYPE_AUDIO, AVMEDIA_TYPE_UNKNOWN };
- // default: one AdaptationSet for each media type
+ // default: one AdaptationSet for each stream
if (!p) {
- for (n = 0; types[n] != AVMEDIA_TYPE_UNKNOWN; n++) {
- int as_idx = 0;
-
- for (i = 0; i < s->nb_streams; i++) {
- if (s->streams[i]->codecpar->codec_type != types[n])
- continue;
-
- if (!as_idx) {
- if ((ret = add_adaptation_set(s, &as, types[n])) < 0)
- return ret;
- as_idx = c->nb_as;
+ for (i = 0; i < s->nb_streams; i++) {
+ if ((ret = add_adaptation_set(s, &as, s->streams[i]->codecpar->codec_type)) < 0)
+ return ret;
+ snprintf(as->id, sizeof(as->id), "%d", i);
- snprintf(as->id, sizeof(as->id), "%d", i);
- }
- c->streams[i].as_idx = as_idx;
- }
+ c->streams[i].as_idx = c->nb_as;
}
goto end;
}