PR #25550 opened by Kacper Michajłow (kasper93)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25550
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25550.patch


From 86f534e9a65b7973ebe40d9d91452c35e608efcf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Tue, 27 Oct 2026 06:04:08 +0100
Subject: [PATCH 1/9] avformat/dashdec: fix seeking after EOF
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Since d9da090b1d, a representation that returns EOF is closed and its
streams are set to AVDISCARD_ALL, so that recheck_discard_flags() does
not reopen it. dash_read_seek() only does a dry run for representations
that are not open, so after a seek they stay closed and return no
packets, and playback cannot continue after a seek once the end was
read. Mark the representation as being at EOF instead, skip it when
picking the next packet, clear the mark when it is seeked or closed, and
leave the discard flags to the caller.

Fixes: d9da090b1d
Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavformat/dashdec.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 00f91fc205a..b7254485fcd 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -123,6 +123,7 @@ struct representation {
     uint32_t init_sec_buf_read_offset;
     int64_t cur_timestamp;
     int is_restart_needed;
+    int eof;
 };
 
 typedef struct DASHContext {
@@ -1963,6 +1964,7 @@ static void close_demux_for_component(struct 
representation *pls)
     memset(&pls->pb, 0x00, sizeof(pls->pb));
     pls->ctx->pb = NULL;
     avformat_close_input(&pls->ctx);
+    pls->eof = 0;
 }
 
 static int reopen_demux_for_component(AVFormatContext *s, struct 
representation *pls)
@@ -2389,7 +2391,7 @@ static int dash_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 
     for (i = 0; i < c->n_videos; i++) {
         rep = c->videos[i];
-        if (!rep->ctx)
+        if (!rep->ctx || rep->eof)
             continue;
         if (!cur || rep->cur_timestamp < mints) {
             cur = rep;
@@ -2398,7 +2400,7 @@ static int dash_read_packet(AVFormatContext *s, AVPacket 
*pkt)
     }
     for (i = 0; i < c->n_audios; i++) {
         rep = c->audios[i];
-        if (!rep->ctx)
+        if (!rep->ctx || rep->eof)
             continue;
         if (!cur || rep->cur_timestamp < mints) {
             cur = rep;
@@ -2408,7 +2410,7 @@ static int dash_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 
     for (i = 0; i < c->n_subtitles; i++) {
         rep = c->subtitles[i];
-        if (!rep->ctx)
+        if (!rep->ctx || rep->eof)
             continue;
         if (!cur || rep->cur_timestamp < mints) {
             cur = rep;
@@ -2434,12 +2436,8 @@ static int dash_read_packet(AVFormatContext *s, AVPacket 
*pkt)
             ff_format_io_close(cur->parent, &cur->input);
             ret = reopen_demux_for_component(s, cur);
         } else if (ret == AVERROR_EOF) {
-            close_demux_for_component(cur);
-            ff_format_io_close(cur->parent, &cur->input);
+            cur->eof = 1;
             av_log(s, AV_LOG_DEBUG, "EOF on stream_index %d\n", 
cur->stream_index);
-            // prevent recheck_discard_flags() from re-enabling the component
-            for (int i = 0; i < cur->nb_assoc_stream; i++)
-                cur->assoc_stream[i]->discard = AVDISCARD_ALL;
             return FFERROR_REDO;
         }
     }
@@ -2471,6 +2469,7 @@ static int dash_seek(AVFormatContext *s, struct 
representation *pls, int64_t see
     if (pls->n_fragments == 1) {
         pls->cur_timestamp = 0;
         pls->cur_seg_offset = 0;
+        pls->eof = 0;
         if (dry_run)
             return 0;
         ff_read_frame_flush(pls->ctx);
-- 
2.54.0


From 931246bf340586ced0b28b75157062ae0ba093dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Tue, 27 Oct 2026 06:04:13 +0100
Subject: [PATCH 2/9] avformat/dashdec: factor out the check whether a
 representation is needed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavformat/dashdec.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index b7254485fcd..235ad0e6217 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -2349,16 +2349,23 @@ static int dash_read_header(AVFormatContext *s)
     return 0;
 }
 
+static int representation_needed(const struct representation *pls)
+{
+    int needed = !pls->nb_assoc_stream;
+
+    for (int j = 0; j < pls->nb_assoc_stream; j++)
+        needed |= pls->assoc_stream[j]->discard < AVDISCARD_ALL;
+
+    return needed;
+}
+
 static void recheck_discard_flags(AVFormatContext *s, struct representation 
**p, int n)
 {
     int i, j;
 
     for (i = 0; i < n; i++) {
         struct representation *pls = p[i];
-        int needed = !pls->nb_assoc_stream;
-
-        for (int j = 0; j < pls->nb_assoc_stream; j++)
-            needed |= pls->assoc_stream[j]->discard < AVDISCARD_ALL;
+        int needed = representation_needed(pls);
 
         if (needed && !pls->ctx) {
             pls->cur_seg_offset = 0;
-- 
2.54.0


From d88166af89db6797ca31bb8c78db43887cc5a4c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Tue, 27 Oct 2026 06:04:17 +0100
Subject: [PATCH 3/9] avformat/dashdec: fix seeking representations enabled
 since the last read
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

dash_read_seek() only does a dry run for representations that are not
open. A representation the caller enabled since the last read is not
open yet, and for a single file the dry run returns without recording
the target, so the representation was opened at the start of the file
instead of at the seek target. Seek such representations too, and open
the demuxer first when there is a single file.

Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavformat/dashdec.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 235ad0e6217..619e63342f7 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -2479,6 +2479,12 @@ static int dash_seek(AVFormatContext *s, struct 
representation *pls, int64_t see
         pls->eof = 0;
         if (dry_run)
             return 0;
+        if (!pls->ctx) {
+            pls->init_sec_buf_read_offset = 0;
+            ret = reopen_demux_for_component(s, pls);
+            if (ret < 0)
+                return ret;
+        }
         ff_read_frame_flush(pls->ctx);
         return av_seek_frame(pls->ctx, -1, seek_pos_msec * 1000, flags);
     }
@@ -2543,15 +2549,15 @@ static int dash_read_seek(AVFormatContext *s, int 
stream_index, int64_t timestam
     /* Seek in discarded streams with dry_run=1 to avoid reopening them */
     for (i = 0; i < c->n_videos; i++) {
         if (!ret)
-            ret = dash_seek(s, c->videos[i], seek_pos_msec, flags, 
!c->videos[i]->ctx);
+            ret = dash_seek(s, c->videos[i], seek_pos_msec, flags, 
!c->videos[i]->ctx && !representation_needed(c->videos[i]));
     }
     for (i = 0; i < c->n_audios; i++) {
         if (!ret)
-            ret = dash_seek(s, c->audios[i], seek_pos_msec, flags, 
!c->audios[i]->ctx);
+            ret = dash_seek(s, c->audios[i], seek_pos_msec, flags, 
!c->audios[i]->ctx && !representation_needed(c->audios[i]));
     }
     for (i = 0; i < c->n_subtitles; i++) {
         if (!ret)
-            ret = dash_seek(s, c->subtitles[i], seek_pos_msec, flags, 
!c->subtitles[i]->ctx);
+            ret = dash_seek(s, c->subtitles[i], seek_pos_msec, flags, 
!c->subtitles[i]->ctx && !representation_needed(c->subtitles[i]));
     }
 
     return ret;
-- 
2.54.0


From 1a425392a923c6171818055b3b6bba1001daf577 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Wed, 28 Oct 2026 02:09:24 +0100
Subject: [PATCH 4/9] avformat/dashdec: seek the input only of a whole file
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

seek_data() moved the input of any Representation without an
initialization section to the positions of its demuxer. The input of a
byte range is opened with the "offset" option, from which the http and
libcurl protocols count the positions while they seek to positions in
the file, so a seek that reached the protocol landed as many bytes
before the target as the range starts at and returned the wrong data.
Seek the input only when it is a whole file, and fail the seek
otherwise.

Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavformat/dashdec.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 619e63342f7..43a92367128 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1866,10 +1866,18 @@ static int update_init_section(struct representation 
*pls)
     return 0;
 }
 
+static int is_whole_file(const struct representation *pls)
+{
+    return pls->n_fragments == 1 && !pls->init_sec_data_len &&
+           !pls->fragments[0]->url_offset && pls->fragments[0]->size < 0;
+}
+
 static int64_t seek_data(void *opaque, int64_t offset, int whence)
 {
     struct representation *v = opaque;
-    if (v->n_fragments && !v->init_sec_data_len) {
+    /* Avoid seeking for non-whole files, where an "offset" does not correspond
+     * to a position in the input. AVIO sets 0 position at "offset" of the 
input. */
+    if (is_whole_file(v)) {
         return avio_seek(v->input, offset, whence);
     }
 
-- 
2.54.0


From c40e8dffc4f2178c18441e1046b4ec7ca63aca8a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Tue, 27 Oct 2026 23:30:42 +0100
Subject: [PATCH 5/9] avformat/dashdec: read fragments of local files from
 their offset
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The byte range of a fragment was only passed as options for HTTP, so a
fragment in a local file was read from the start of the file. Also seek
non-http sources to required offset.

Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavformat/dashdec.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 43a92367128..a8fd0337ce9 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1792,7 +1792,7 @@ static int open_input(DASHContext *c, struct 
representation *pls, struct fragmen
 {
     AVDictionary *opts = NULL;
     char *url = NULL;
-    int ret = 0;
+    int ret = 0, is_http = 0;
 
     url = av_mallocz(c->max_url_size);
     if (!url) {
@@ -1810,7 +1810,14 @@ static int open_input(DASHContext *c, struct 
representation *pls, struct fragmen
     ff_make_absolute_url(url, c->max_url_size, c->base_url, seg->url);
     av_log(pls->parent, AV_LOG_VERBOSE, "DASH request for url '%s', offset 
%"PRId64"\n",
            url, seg->url_offset);
-    ret = open_url(pls->parent, &pls->input, url, &c->avio_opts, opts, NULL);
+    ret = open_url(pls->parent, &pls->input, url, &c->avio_opts, opts, 
&is_http);
+    if (ret >= 0 && !is_http && seg->url_offset > 0) {
+        int64_t pos = avio_seek(pls->input, seg->url_offset, SEEK_SET);
+        if (pos < 0) {
+            ff_format_io_close(pls->parent, &pls->input);
+            ret = pos;
+        }
+    }
 
 cleanup:
     av_free(url);
-- 
2.54.0


From 2b95269d5c4b5f66c3a9481c7e9487f3be048d2a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Wed, 28 Oct 2026 01:33:58 +0100
Subject: [PATCH 6/9] avformat/dashdec: make single file representations
 seekable
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

A Representation that is a single file is seeked by the demuxer of the
file, but the input of that demuxer was not seekable although
seek_data() can move it. This avoids reading whole file from the start
on seeking.

Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavformat/dashdec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index a8fd0337ce9..273cc11dcdb 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -2034,6 +2034,8 @@ static int reopen_demux_for_component(AVFormatContext *s, 
struct representation
         goto fail;
     }
 
+    if (!c->is_live && is_whole_file(pls))
+        pls->pb.pub.seekable = pls->input->seekable;
     pls->ctx->pb = &pls->pb.pub;
     pls->ctx->io_open  = nested_io_open;
 
-- 
2.54.0


From 258bb0ce2042ca76bbe4d2385f2883c3d63aa836 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Wed, 28 Oct 2026 00:01:04 +0100
Subject: [PATCH 7/9] avformat/dashdec: index segment lists from their start
 number
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The number of the current segment counts from the start number of the
Representation, but for a SegmentList it was used as the index into the
list. A list with startNumber="1", as the dash muxer writes for a single
file, skipped its first segment and then failed with "missing template
URL". On a manifest update, a live list moved the number by the change
of the start number, in the wrong direction and against the start number
of the first manifest, so it repeated segments and kept reloading at its
end. Index the list from the start number, and on an update keep the
number, take the start number of the new list and move to its first
segment when the number has left the list.

Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavformat/dashdec.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 273cc11dcdb..654eb4f5484 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -102,7 +102,6 @@ struct representation {
 
     int64_t first_seq_no;
     int64_t last_seq_no;
-    int64_t start_number; /* used in case when we have dynamic list of segment 
to know which segments are new one*/
 
     int64_t fragment_duration;
     int64_t fragment_timescale;
@@ -893,7 +892,7 @@ end:
                 av_log(s, AV_LOG_WARNING, "startNumber invalid, autochanged to 
0.\n"); \
                 start_number = 0; \
             } \
-            rep->start_number = rep->first_seq_no = start_number; \
+            rep->first_seq_no = start_number; \
             av_log(s, AV_LOG_TRACE, "rep->first_seq_no = [%"PRId64"]\n", 
rep->first_seq_no); \
             xmlFree(val); \
         } \
@@ -1563,15 +1562,11 @@ static void move_segments(struct representation 
*rep_src, struct representation
 {
     if (rep_dest && rep_src ) {
         free_fragment_list(rep_dest);
-        if (rep_src->start_number > (rep_dest->start_number + 
rep_dest->n_fragments))
-            rep_dest->cur_seq_no = 0;
-        else {
-            rep_dest->cur_seq_no += rep_src->start_number - 
rep_dest->start_number;
-            if (rep_dest->cur_seq_no < 0)
-                rep_dest->cur_seq_no = 0;
-        }
+        if (rep_dest->cur_seq_no < rep_src->first_seq_no)
+            rep_dest->cur_seq_no = rep_src->first_seq_no;
         rep_dest->fragments    = rep_src->fragments;
         rep_dest->n_fragments  = rep_src->n_fragments;
+        rep_dest->first_seq_no = rep_src->first_seq_no;
         rep_dest->parent  = rep_src->parent;
         rep_dest->last_seq_no = calc_max_seg_no(rep_dest, c);
         rep_src->fragments = NULL;
@@ -1689,8 +1684,9 @@ static struct fragment *get_current_fragment(struct 
representation *pls)
     int reload_count = 0;
 
     while (( !ff_check_interrupt(c->interrupt_callback)&& pls->n_fragments > 
0)) {
-        if (pls->cur_seq_no >= 0 && pls->cur_seq_no < pls->n_fragments) {
-            seg_ptr = pls->fragments[pls->cur_seq_no];
+        if (pls->cur_seq_no >= pls->first_seq_no &&
+            pls->cur_seq_no < pls->first_seq_no + pls->n_fragments) {
+            seg_ptr = pls->fragments[pls->cur_seq_no - pls->first_seq_no];
             seg = av_mallocz(sizeof(struct fragment));
             if (!seg) {
                 return NULL;
-- 
2.54.0


From c3567b41122b8bbbf26ad24eec6d3f588300a559 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Wed, 28 Oct 2026 00:04:04 +0100
Subject: [PATCH 8/9] avformat/dashdec: number segments from 1 without a
 startNumber
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The number of the first segment is @startNumber, or 1 when the attribute
is absent (ISO/IEC 23009-1, 5.3.9.5).

Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavformat/dashdec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 654eb4f5484..dd0880d8002 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -958,6 +958,7 @@ static int parse_manifest_representation(AVFormatContext 
*s, const char *url,
         }
     }
     rep->parent = s;
+    rep->first_seq_no = 1;
     representation_segmenttemplate_node = 
find_child_node_by_name(representation_node, "SegmentTemplate");
     representation_baseurl_node = find_child_node_by_name(representation_node, 
"BaseURL");
     representation_segmentlist_node = 
find_child_node_by_name(representation_node, "SegmentList");
-- 
2.54.0


From 69d11b5d9a62b9fd7cf3851f45e784ddd9378cbc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Wed, 28 Oct 2026 00:38:29 +0100
Subject: [PATCH 9/9] tests/fate/dashenc: add tests for each kind of segment
 addressing
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

dash_mixed.mpd has one Representation per kind of segment addressing.
The first is a single file with a Segment Index, longer than what the
stream analysis reads, the second a single file with a 'sidx' for each
fragment, the third a SegmentList with startNumber and the last a
SegmentTemplate with a SegmentTimeline and no startNumber, both on the
segments of dash_seek.mpd. Test seeking and looping them.

Signed-off-by: Kacper Michajłow <[email protected]>
---
 tests/fate/dashenc.mak         |  35 +++++++++++
 tests/ref/fate/dash-mixed-loop | 102 +++++++++++++++++++++++++++++++++
 tests/ref/fate/dash-mixed-seek |  83 +++++++++++++++++++++++++++
 3 files changed, 220 insertions(+)
 create mode 100644 tests/ref/fate/dash-mixed-loop
 create mode 100644 tests/ref/fate/dash-mixed-seek

diff --git a/tests/fate/dashenc.mak b/tests/fate/dashenc.mak
index 0f1cca3341c..6e4e4ff853c 100644
--- a/tests/fate/dashenc.mak
+++ b/tests/fate/dashenc.mak
@@ -56,5 +56,40 @@ fate-dash-seek-zero: CMD = framecrc -ss 0 -i 
$(TARGET_PATH)/tests/data/dash_seek
 fate-dash-seek-reference: CMD = framecrc -i 
$(TARGET_PATH)/tests/data/dash_seek.mpd -c copy
 fate-dash-seek-reference: REF = $(SRC_PATH)/tests/ref/fate/dash-seek-zero
 
+tests/data/dash_mixed.mpd: TAG = GEN
+tests/data/dash_mixed.mpd: ffmpeg$(PROGSSUF)$(EXESUF) tests/data/dash_seek.mpd 
| tests/data
+       $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< -nostdin -loglevel error -y \
+       -f lavfi -i "testsrc2=size=128x72:rate=25:duration=3" \
+       -map 0:v -c:v mpeg4 -g 18 -threads 1 -idct simple -dct fastint 
-bitexact \
+       -movflags +dash+global_sidx $(TARGET_PATH)/tests/data/dash_mixed_0.mp4 \
+       -map 0:v -c:v mpeg4 -g 18 -threads 1 -idct simple -dct fastint 
-bitexact \
+       -t 1.2 -movflags +dash $(TARGET_PATH)/tests/data/dash_mixed_1.mp4
+       $(Q)printf '%s\n' \
+       '<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" 
profiles="urn:mpeg:dash:profile:full:2011" type="static" 
mediaPresentationDuration="PT3S" minBufferTime="PT1S"><Period>' \
+       '<AdaptationSet mimeType="video/mp4"><Representation id="0" 
bandwidth="400000"><BaseURL>dash_mixed_0.mp4</BaseURL></Representation></AdaptationSet>'
 \
+       '<AdaptationSet mimeType="video/mp4"><Representation id="1" 
bandwidth="400000"><BaseURL>dash_mixed_1.mp4</BaseURL></Representation></AdaptationSet>'
 \
+       '<AdaptationSet mimeType="audio/mp4"><Representation id="2" 
bandwidth="8000"><SegmentList timescale="1000" duration="1000" 
startNumber="1">' \
+       '<Initialization sourceURL="dash_seek_init.mp4"/><SegmentURL 
media="dash_seek_1.m4s"/><SegmentURL media="dash_seek_2.m4s"/><SegmentURL 
media="dash_seek_3.m4s"/>' \
+       '</SegmentList></Representation></AdaptationSet>' \
+       '<AdaptationSet mimeType="audio/mp4"><Representation id="3" 
bandwidth="8000"><SegmentTemplate timescale="1000" 
initialization="dash_seek_init.mp4" media="dash_seek_$$Number$$.m4s">' \
+       '<SegmentTimeline><S t="0" d="1000" 
r="2"/></SegmentTimeline></SegmentTemplate></Representation></AdaptationSet>' \
+       '</Period></MPD>' > $@
+
+FATE_DASHENC_LAVFI-$(call ALLYES, TESTSRC2_FILTER SINE_FILTER LAVFI_INDEV 
WRAPPED_AVFRAME_DECODER PCM_S16LE_DECODER MPEG4_ENCODER MP2FIXED_ENCODER 
DASH_MUXER MP4_MUXER DASH_DEMUXER MOV_DEMUXER MPEG4_DECODER MP3_DECODER 
FILE_PROTOCOL FRAMECRC_MUXER PIPE_PROTOCOL) += fate-dash-mixed-seek 
fate-dash-mixed-loop
+fate-dash-mixed-seek fate-dash-mixed-loop: tests/data/dash_mixed.mpd
+fate-dash-mixed-seek: CMD = framecrc -ss 2.5 -i 
$(TARGET_PATH)/tests/data/dash_mixed.mpd -map 0 -c copy
+fate-dash-mixed-loop: CMD = framecrc -stream_loop 1 -i 
$(TARGET_PATH)/tests/data/dash_mixed.mpd -map 0:1 -map 0:2 -t 3.5 -c copy
+
+tests/data/dash_single.mpd: TAG = GEN
+tests/data/dash_single.mpd: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
+       $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< -nostdin -loglevel error \
+       -f lavfi -i "sine=sample_rate=16000:duration=3" \
+       -c:a mp2fixed -b:a 8k -bitexact -f dash -seg_duration 1 -single_file 1 
$(TARGET_PATH)/$@
+
+FATE_DASHENC_LAVFI-$(call ALLYES, SINE_FILTER LAVFI_INDEV PCM_S16LE_DECODER 
MP2FIXED_ENCODER DASH_MUXER MP4_MUXER DASH_DEMUXER MOV_DEMUXER MP3_DECODER 
FILE_PROTOCOL FRAMECRC_MUXER PIPE_PROTOCOL) += fate-dash-single-file
+fate-dash-single-file: tests/data/dash_single.mpd
+fate-dash-single-file: CMD = framecrc -i 
$(TARGET_PATH)/tests/data/dash_single.mpd -c copy
+fate-dash-single-file: REF = $(SRC_PATH)/tests/ref/fate/dash-seek-zero
+
 FATE_FFMPEG += $(FATE_DASHENC_LAVFI-yes)
 fate-dashenc: $(FATE_DASHENC_LAVFI-yes)
diff --git a/tests/ref/fate/dash-mixed-loop b/tests/ref/fate/dash-mixed-loop
new file mode 100644
index 00000000000..61fb6b22c2c
--- /dev/null
+++ b/tests/ref/fate/dash-mixed-loop
@@ -0,0 +1,102 @@
+#extradata 0:       30, 0x47370554
+#tb 0: 1/12800
+#media_type 0: video
+#codec_id 0: mpeg4
+#dimensions 0: 128x72
+#sar 0: 1/1
+#tb 1: 1/16000
+#media_type 1: audio
+#codec_id 1: mp3
+#sample_rate 1: 16000
+#channel_layout_name 1: mono
+1,          0,          0,     1152,       72, 0x76b21f9b
+0,        385,        385,      512,     4076, 0xb2886017
+0,        897,        897,      512,     2369, 0x8bde46d4, F=0x0
+1,       1152,       1152,     1152,       72, 0x9e131900
+0,       1409,       1409,      512,     2387, 0x6b7a1721, F=0x0
+1,       2304,       2304,     1152,       72, 0xaa621ba7
+0,       1921,       1921,      512,     2451, 0xf4144fc1, F=0x0
+0,       2433,       2433,      512,     2312, 0xb2c5f0b3, F=0x0
+1,       3456,       3456,     1152,       72, 0x76ab1842
+0,       2945,       2945,      512,     2934, 0xde7c2537, F=0x0
+0,       3457,       3457,      512,     2400, 0x9da4257b, F=0x0
+1,       4608,       4608,     1152,       72, 0xcc1f1c52
+0,       3969,       3969,      512,     2501, 0x08214be2, F=0x0
+0,       4481,       4481,      512,     1726, 0x455f264e, F=0x0
+1,       5760,       5760,     1152,       72, 0xd1991af3
+0,       4993,       4993,      512,     1724, 0x540e2ab8, F=0x0
+0,       5505,       5505,      512,     2157, 0x5bcdf563, F=0x0
+1,       6912,       6912,     1152,       72, 0x88301bf2
+0,       6017,       6017,      512,     1521, 0x6ca8e525, F=0x0
+1,       8064,       8064,     1152,       72, 0x9e8f1bb3
+0,       6529,       6529,      512,     1409, 0x8212b398, F=0x0
+0,       7041,       7041,      512,     1349, 0x3ffc7056, F=0x0
+1,       9216,       9216,     1152,       72, 0xc2911b4d
+0,       7553,       7553,      512,     1470, 0x7d92ca75, F=0x0
+0,       8065,       8065,      512,     1562, 0x157e20e0, F=0x0
+1,      10368,      10368,     1152,       72, 0xd44d1b0b
+0,       8577,       8577,      512,     1537, 0x816be049, F=0x0
+0,       9089,       9089,      512,     1433, 0x4229bc75, F=0x0
+1,      11520,      11520,     1152,       72, 0x5d3f1906
+0,       9601,       9601,      512,     3961, 0xc03974b5
+0,      10113,      10113,      512,     1428, 0x1e42d51e, F=0x0
+1,      12672,      12672,     1152,       72, 0xc5cb1bae
+0,      10625,      10625,      512,     1610, 0xd5b81d8c, F=0x0
+1,      13824,      13824,     1152,       72, 0x60fa18f9
+0,      11137,      11137,      512,     1541, 0x0626d35e, F=0x0
+0,      11649,      11649,      512,     1351, 0xa92c8fd7, F=0x0
+1,      14976,      14976,     1152,       72, 0xb0e01be3
+0,      12161,      12161,      512,     1298, 0x458d74d8, F=0x0
+0,      12673,      12673,      512,     1297, 0x6ab89041, F=0x0
+1,      16128,      16128,     1152,       72, 0x4ccf1a2b
+0,      13185,      13185,      512,     1815, 0xe237729d, F=0x0
+0,      13697,      13697,      512,     1404, 0x824abd25, F=0x0
+1,      17280,      17280,     1152,       72, 0x96ba1b53
+0,      14209,      14209,      512,     1426, 0x28b7d2d6, F=0x0
+0,      14721,      14721,      512,     1538, 0x6dd9f1ca, F=0x0
+1,      18432,      18432,     1152,       72, 0xc8db1a81
+0,      15233,      15233,      512,     1160, 0x57174960, F=0x0
+1,      19584,      19584,     1152,       72, 0xb5161cc4
+1,      20736,      20736,     1152,       72, 0x166a16a6
+1,      21888,      21888,     1152,       72, 0xd6631b63
+1,      23040,      23040,     1152,       72, 0x8a9019e5
+1,      24192,      24192,     1152,       72, 0xb9851c35
+1,      25344,      25344,     1152,       72, 0x81d51936
+1,      26496,      26496,     1152,       72, 0xd0671c45
+1,      27648,      27648,     1152,       72, 0x9ce119d9
+1,      28800,      28800,     1152,       72, 0xbde81b9f
+1,      29952,      29952,     1152,       72, 0x9e131900
+1,      31104,      31104,     1152,       72, 0xaa621ba7
+1,      32256,      32256,     1152,       72, 0x76ab1842
+1,      33408,      33408,     1152,       72, 0xcc1f1c52
+1,      34560,      34560,     1152,       72, 0xd1991af3
+1,      35712,      35712,     1152,       72, 0x88301bf2
+1,      36864,      36864,     1152,       72, 0x9e8f1bb3
+1,      38016,      38016,     1152,       72, 0xc2911b4d
+1,      39168,      39168,     1152,       72, 0xd44d1b0b
+1,      40320,      40320,     1152,       72, 0x5d3f1906
+1,      41472,      41472,     1152,       72, 0xc5cb1bae
+1,      42624,      42624,     1152,       72, 0x60fa18f9
+1,      43776,      43776,     1152,       72, 0xb0e01be3
+1,      44928,      44928,     1152,       72, 0x4ccf1a2b
+1,      46080,      46080,     1152,       72, 0x96ba1b53
+1,      47232,      47232,     1152,       72, 0x832d1ae9
+1,      48384,      48384,     1152,       72, 0x76b21f9b
+0,      39092,      39092,      512,     4076, 0xb2886017
+0,      39604,      39604,      512,     2369, 0x8bde46d4, F=0x0
+1,      49536,      49536,     1152,       72, 0x9e131900
+0,      40116,      40116,      512,     2387, 0x6b7a1721, F=0x0
+1,      50688,      50688,     1152,       72, 0xaa621ba7
+0,      40628,      40628,      512,     2451, 0xf4144fc1, F=0x0
+0,      41140,      41140,      512,     2312, 0xb2c5f0b3, F=0x0
+1,      51840,      51840,     1152,       72, 0x76ab1842
+0,      41652,      41652,      512,     2934, 0xde7c2537, F=0x0
+0,      42164,      42164,      512,     2400, 0x9da4257b, F=0x0
+1,      52992,      52992,     1152,       72, 0xcc1f1c52
+0,      42676,      42676,      512,     2501, 0x08214be2, F=0x0
+0,      43188,      43188,      512,     1726, 0x455f264e, F=0x0
+1,      54144,      54144,     1152,       72, 0xd1991af3
+0,      43700,      43700,      512,     1724, 0x540e2ab8, F=0x0
+0,      44212,      44212,      512,     2157, 0x5bcdf563, F=0x0
+1,      55296,      55296,     1152,       72, 0x88301bf2
+0,      44724,      44724,      512,     1521, 0x6ca8e525, F=0x0
diff --git a/tests/ref/fate/dash-mixed-seek b/tests/ref/fate/dash-mixed-seek
new file mode 100644
index 00000000000..7e15983a10d
--- /dev/null
+++ b/tests/ref/fate/dash-mixed-seek
@@ -0,0 +1,83 @@
+#extradata 0:       30, 0x47370554
+#extradata 1:       30, 0x47370554
+#tb 0: 1/12800
+#media_type 0: video
+#codec_id 0: mpeg4
+#dimensions 0: 128x72
+#sar 0: 1/1
+#tb 1: 1/12800
+#media_type 1: video
+#codec_id 1: mpeg4
+#dimensions 1: 128x72
+#sar 1: 1/1
+#tb 2: 1/16000
+#media_type 2: audio
+#codec_id 2: mp3
+#sample_rate 2: 16000
+#channel_layout_name 2: mono
+#tb 3: 1/16000
+#media_type 3: audio
+#codec_id 3: mp3
+#sample_rate 3: 16000
+#channel_layout_name 3: mono
+1,     -22399,     -22399,      512,     3961, 0xc03974b5
+1,     -21887,     -21887,      512,     1428, 0x1e42d51e, F=0x0
+1,     -21375,     -21375,      512,     1610, 0xd5b81d8c, F=0x0
+1,     -20863,     -20863,      512,     1541, 0x0626d35e, F=0x0
+1,     -20351,     -20351,      512,     1351, 0xa92c8fd7, F=0x0
+1,     -19839,     -19839,      512,     1298, 0x458d74d8, F=0x0
+1,     -19327,     -19327,      512,     1297, 0x6ab89041, F=0x0
+1,     -18815,     -18815,      512,     1815, 0xe237729d, F=0x0
+1,     -18303,     -18303,      512,     1404, 0x824abd25, F=0x0
+1,     -17791,     -17791,      512,     1426, 0x28b7d2d6, F=0x0
+1,     -17279,     -17279,      512,     1538, 0x6dd9f1ca, F=0x0
+1,     -16767,     -16767,      512,     1160, 0x57174960, F=0x0
+2,      -7744,      -7744,     1152,       72, 0x76ab1842
+3,      -7744,      -7744,     1152,       72, 0x76ab1842
+2,      -6592,      -6592,     1152,       72, 0xcc1f1c52
+3,      -6592,      -6592,     1152,       72, 0xcc1f1c52
+2,      -5440,      -5440,     1152,       72, 0xd1991af3
+3,      -5440,      -5440,     1152,       72, 0xd1991af3
+0,      -3967,      -3967,      512,     3176, 0xca55ead6
+0,      -3455,      -3455,      512,     1267, 0x68ed7ef2, F=0x0
+2,      -4288,      -4288,     1152,       72, 0x88301bf2
+3,      -4288,      -4288,     1152,       72, 0x88301bf2
+0,      -2943,      -2943,      512,     1156, 0xc6364c29, F=0x0
+2,      -3136,      -3136,     1152,       72, 0x9e8f1bb3
+3,      -3136,      -3136,     1152,       72, 0x9e8f1bb3
+0,      -2431,      -2431,      512,      913, 0x344ad337, F=0x0
+0,      -1919,      -1919,      512,     1324, 0x34798b46, F=0x0
+2,      -1984,      -1984,     1152,       72, 0xc2911b4d
+3,      -1984,      -1984,     1152,       72, 0xc2911b4d
+0,      -1407,      -1407,      512,      978, 0xe85af2de, F=0x0
+0,       -895,       -895,      512,     1201, 0x52f859d0, F=0x0
+2,       -832,       -832,     1152,       72, 0xd44d1b0b
+3,       -832,       -832,     1152,       72, 0xd44d1b0b
+0,       -383,       -383,      512,      957, 0xfa20d81f, F=0x0
+0,        129,        129,      512,     1258, 0x8d605ed5, F=0x0
+2,        320,        320,     1152,       72, 0x5d3f1906
+3,        320,        320,     1152,       72, 0x5d3f1906
+0,        641,        641,      512,     1037, 0xd37401e1, F=0x0
+0,       1153,       1153,      512,     1224, 0x06ba582f, F=0x0
+2,       1472,       1472,     1152,       72, 0xc5cb1bae
+3,       1472,       1472,     1152,       72, 0xc5cb1bae
+0,       1665,       1665,      512,      977, 0xd0d9eb9f, F=0x0
+2,       2624,       2624,     1152,       72, 0x60fa18f9
+3,       2624,       2624,     1152,       72, 0x60fa18f9
+0,       2177,       2177,      512,     1204, 0x23c67028, F=0x0
+0,       2689,       2689,      512,     1047, 0x896509bd, F=0x0
+2,       3776,       3776,     1152,       72, 0xb0e01be3
+3,       3776,       3776,     1152,       72, 0xb0e01be3
+0,       3201,       3201,      512,      956, 0x889dd68d, F=0x0
+0,       3713,       3713,      512,      989, 0x2c0cf397, F=0x0
+2,       4928,       4928,     1152,       72, 0x4ccf1a2b
+3,       4928,       4928,     1152,       72, 0x4ccf1a2b
+0,       4225,       4225,      512,     1268, 0x44237000, F=0x0
+0,       4737,       4737,      512,     1213, 0x3f7f5821, F=0x0
+2,       6080,       6080,     1152,       72, 0x96ba1b53
+3,       6080,       6080,     1152,       72, 0x96ba1b53
+0,       5249,       5249,      512,     3295, 0x6f564aa8
+0,       5761,       5761,      512,      898, 0x961fbf01, F=0x0
+2,       7232,       7232,     1152,       72, 0x832d1ae9
+3,       7232,       7232,     1152,       72, 0x832d1ae9
+0,       6273,       6273,      512,      938, 0x19ffd126, F=0x0
-- 
2.54.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to