Commit 3b9b472758 for ffmpeg
commit 3b9b472758dc1191044ea873478ec1b7fff4164b
Author: Kacper Michajłow <kasper93@gmail.com>
Date: Tue Oct 27 23:30:42 2026 +0100
avformat/dashdec: read fragments of local files from their offset
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 <kasper93@gmail.com>
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index f0ee580023..ac91fd5ad9 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1864,7 +1864,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) {
@@ -1882,7 +1882,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);