45 size_t format_tag_size,
const char **ptr) {
52 }
else if (
av_strstart(identifier,
"$RepresentationID$", &next_ptr)) {
61 else if (
av_strstart(identifier,
"$Bandwidth", &next_ptr))
63 else if (
av_strstart(identifier,
"$Time", &next_ptr))
72 if (next_ptr[0] ==
'$') {
73 snprintf(format_tag, format_tag_size,
"%%%s", number_format);
76 const char *width_ptr;
82 snprintf(format_tag, format_tag_size,
"%s%c%s",
"%0", width_ptr[0], number_format);
86 "closing '$' character or a format-string like '%%0[width]d', " 87 "where width must be a single digit\n", next_ptr);
97 const char *
template,
int rep_id,
98 int number,
int bit_rate,
101 const char *t_cur =
template;
102 while (dst_pos < buffer_size - 1 && *t_cur) {
106 const char *t_next = strchr(t_cur,
'$');
108 int num_copy_bytes =
FFMIN(t_next - t_cur, buffer_size - dst_pos - 1);
109 av_strlcpy(&dst[dst_pos], t_cur, num_copy_bytes + 1);
111 dst_pos += num_copy_bytes;
114 av_strlcpy(&dst[dst_pos], t_cur, buffer_size - dst_pos);
118 if (dst_pos >= buffer_size - 1 || !*t_cur)
129 n =
snprintf(&dst[dst_pos], buffer_size - dst_pos, format_tag, rep_id);
132 n =
snprintf(&dst[dst_pos], buffer_size - dst_pos, format_tag, number);
135 n =
snprintf(&dst[dst_pos], buffer_size - dst_pos, format_tag, bit_rate);
138 n =
snprintf(&dst[dst_pos], buffer_size - dst_pos, format_tag, time);
152 dst_pos +=
FFMIN(n, buffer_size - dst_pos - 1);
static av_const int av_isdigit(int c)
Locale-independent conversion of ASCII isdigit.
#define AV_LOG_WARNING
Something somehow does not look correct.
miscellaneous OS support macros and functions.
static DASHTmplId dash_read_tmpl_id(const char *identifier, char *format_tag, size_t format_tag_size, const char **ptr)
simple assert() macros that are a bit more flexible than ISO C assert().
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
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)
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
Utilties for rational number calculation.
unbuffered private I/O API