mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-04 22:48:49 +00:00
dashdemux: segment template parsing: added support for %d
Added support for %d in template identifier. Added testcases for %d, %3d, %0-4d identifier formats.
This commit is contained in:
parent
933d367440
commit
4eea6c3833
2 changed files with 12 additions and 6 deletions
|
@ -2968,15 +2968,18 @@ validate_format (const gchar * format)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
/* Following the % must be a 0, or any of d, x or u.
|
/* the spec mandates a format like %0[width]d
|
||||||
|
But we also accept %d, because it doesn't hurt us
|
||||||
|
*/
|
||||||
|
/* Following the %, if we have a number, it must start with 0 */
|
||||||
|
if (g_ascii_isdigit (p[0]) && p[0] != '0')
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
/* Following the % must be a number, or any of d, x or u.
|
||||||
* x and u are not part of the spec, but don't hurt us
|
* x and u are not part of the spec, but don't hurt us
|
||||||
*/
|
*/
|
||||||
if (p[0] == '0') {
|
|
||||||
p++;
|
|
||||||
|
|
||||||
while (g_ascii_isdigit (*p))
|
while (g_ascii_isdigit (*p))
|
||||||
p++;
|
p++;
|
||||||
}
|
|
||||||
|
|
||||||
/* After any 0 and alphanumeric values, there must be
|
/* After any 0 and alphanumeric values, there must be
|
||||||
* an d, x or u.
|
* an d, x or u.
|
||||||
|
|
|
@ -2488,10 +2488,13 @@ GST_START_TEST (dash_mpdparser_template_parsing)
|
||||||
{"TestMedia$Bandwidth$$$test", "TestMedia2500$test"}, /* Bandwidth identifier */
|
{"TestMedia$Bandwidth$$$test", "TestMedia2500$test"}, /* Bandwidth identifier */
|
||||||
{"TestMedia$Time$", "TestMedia100"}, /* Time identifier */
|
{"TestMedia$Time$", "TestMedia100"}, /* Time identifier */
|
||||||
{"TestMedia$Time", NULL}, /* Identifier not finished with $ */
|
{"TestMedia$Time", NULL}, /* Identifier not finished with $ */
|
||||||
|
{"Time$Time%d$", "Time100"}, /* usage of %d (no width) */
|
||||||
{"Time$Time%0d$", "Time100"}, /* usage of format smaller than number of digits */
|
{"Time$Time%0d$", "Time100"}, /* usage of format smaller than number of digits */
|
||||||
{"Time$Time%01d$", "Time100"}, /* usage of format smaller than number of digits */
|
{"Time$Time%01d$", "Time100"}, /* usage of format smaller than number of digits */
|
||||||
{"Time$Time%05d$", "Time00100"}, /* usage of format bigger than number of digits */
|
{"Time$Time%05d$", "Time00100"}, /* usage of format bigger than number of digits */
|
||||||
{"Time$Time%05dtest$", "Time00100test"}, /* usage extra text in format */
|
{"Time$Time%05dtest$", "Time00100test"}, /* usage extra text in format */
|
||||||
|
{"Time$Time%3d$", NULL}, /* incorrect format: width does not start with 0 */
|
||||||
|
{"Time$Time%0-4d$", NULL}, /* incorrect format: width is not a number */
|
||||||
{"Time$Time%0$", NULL}, /* incorrect format: no d, x or u */
|
{"Time$Time%0$", NULL}, /* incorrect format: no d, x or u */
|
||||||
{"Time$Time1%01d$", NULL}, /* incorrect format: does not start with % after identifier */
|
{"Time$Time1%01d$", NULL}, /* incorrect format: does not start with % after identifier */
|
||||||
{"$Bandwidth%/init.mp4v", NULL}, /* incorrect identifier: not finished with $ */
|
{"$Bandwidth%/init.mp4v", NULL}, /* incorrect identifier: not finished with $ */
|
||||||
|
|
Loading…
Reference in a new issue