summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2014-07-24 10:08:32 (GMT)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2014-07-29 12:31:24 (GMT)
commit805ff11f8c6d9f1f7adbadd7d71369634b0668a5 (patch)
tree95fd9870db7b74dea93dbd9c3d3447045b7fe94c
parentabae12f428a4041b2304f9be81228524482cf813 (diff)
downloadgst-plugins-dlnasrc-805ff11f8c6d9f1f7adbadd7d71369634b0668a5.tar.gz
gst-plugins-dlnasrc-805ff11f8c6d9f1f7adbadd7d71369634b0668a5.tar.xz
dlna_src_parse_npt_range: stop time is optional
The MCVT tool server doesn't report any.
-rw-r--r--src/util.c18
-rw-r--r--tests/test-util.c2
2 files changed, 12 insertions, 8 deletions
diff --git a/src/util.c b/src/util.c
index 70409ec..82b516a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -151,16 +151,18 @@ dlna_src_parse_npt_range (GstDlnaSrc * dlna_src, const gchar * field_str,
if (!dlna_src_npt_to_nanos (dlna_src, *start_str, start))
goto fail;
- /* Read stop value */
- ret_code = sscanf (cursor, "%31[^/ ]%*s", tmp2);
- if (ret_code == -1)
- goto fail;
+ /* Read stop value, if any */
+ if (g_ascii_isdigit (cursor[0])) {
+ ret_code = sscanf (cursor, "%31[^/ ]%*s", tmp2);
+ if (ret_code == -1)
+ goto fail;
- cursor += strlen (tmp2);
+ cursor += strlen (tmp2);
- *stop_str = g_strdup (tmp2);
- if (!dlna_src_npt_to_nanos (dlna_src, *stop_str, stop))
- goto fail;
+ *stop_str = g_strdup (tmp2);
+ if (!dlna_src_npt_to_nanos (dlna_src, *stop_str, stop))
+ goto fail;
+ }
/* Do we have the total length? */
if (cursor[0] == '/') {
diff --git a/tests/test-util.c b/tests/test-util.c
index 84031ce..f685275 100644
--- a/tests/test-util.c
+++ b/tests/test-util.c
@@ -36,6 +36,8 @@ test_parse_ntp_range (void)
"335.1", "336.1", "40445.4", 335099985920, 336099999744, 40445400842240);
do_test_parse_ntp_range ("availableSeekRange.dlna.org: 0 npt=0:00:00.000-0:00:48.716 bytes=0-5219255 cleartextbytes=0-5219255",
"0:00:00.000", "0:00:48.716", NULL, 0, 48716001280, 0);
+ do_test_parse_ntp_range ("npt=10.0-/* bytes=24409920-198755327/198755328",
+ "10.0", NULL, "*", 10000000000, 0, 0);
}
int