Commit 35b441bec3 for ffmpeg
commit 35b441bec31ed262bda2a43a10a8e232241c9d24
Author: Kacper Michajłow <kasper93@gmail.com>
Date: Fri Dec 4 18:43:23 2026 +0100
avformat/dash: take the segment number of a template as int64_t
@startNumber is an unsigned 32 bit number and the demuxer counts the
segments in an int64_t, but ff_dash_fill_tmpl_params() took an int.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
diff --git a/libavformat/dash.c b/libavformat/dash.c
index 6c27fb5781..db3fe3c7a9 100644
--- a/libavformat/dash.c
+++ b/libavformat/dash.c
@@ -67,7 +67,7 @@ static DASHTmplId dash_read_tmpl_id(const char *identifier, char *format_tag,
// next parse the dash format-tag and generate a c-string format tag
// (next_ptr now points at the first '%' at the beginning of the format-tag)
if (id_type != DASH_TMPL_ID_UNDEFINED) {
- const char *number_format = (id_type == DASH_TMPL_ID_TIME) ? PRId64 : "d";
+ const char *number_format = (id_type == DASH_TMPL_ID_BANDWIDTH) ? "d" : PRId64;
if (next_ptr[0] == '$') { // no dash format-tag
snprintf(format_tag, format_tag_size, "%%%s", number_format);
*ptr = &next_ptr[1];
@@ -94,14 +94,14 @@ static DASHTmplId dash_read_tmpl_id(const char *identifier, char *format_tag,
void ff_dash_fill_tmpl_params(char *dst, size_t buffer_size,
const char *template, int rep_id,
- int number, int bit_rate,
+ int64_t number, int bit_rate,
int64_t time) {
int dst_pos = 0;
const char *t_cur = template;
if (!buffer_size)
return;
while (dst_pos < buffer_size - 1 && *t_cur) {
- char format_tag[7]; // May be "%d", "%0Xd", or "%0Xlld" (for $Time$), where X is in [0-9]
+ char format_tag[7]; // May be "%d", "%0Xd", or "%0Xlld", where X is in [0-9]
int n = 0;
DASHTmplId id_type;
const char *t_next = strchr(t_cur, '$'); // copy over everything up to the first '$' character
diff --git a/libavformat/dash.h b/libavformat/dash.h
index c6d9d2c331..bb25c934bb 100644
--- a/libavformat/dash.h
+++ b/libavformat/dash.h
@@ -34,6 +34,6 @@ typedef enum {
} DASHTmplId;
-void ff_dash_fill_tmpl_params(char *dst, size_t buffer_size, const char *template, int rep_id, int number, int bit_rate, int64_t time);
+void ff_dash_fill_tmpl_params(char *dst, size_t buffer_size, const char *template, int rep_id, int64_t number, int bit_rate, int64_t time);
#endif /* AVFORMAT_DASH_H */