Tests: added mp4 tests for moov atom before mdat atom.
diff --git a/mp4.t b/mp4.t
index 9f59427..171f31c 100644
--- a/mp4.t
+++ b/mp4.t
@@ -59,11 +59,22 @@
. '-map 0:0 -map 1:0 -pix_fmt yuv420p -g 15 -c:v libx264 '
. "${\($t->testdir())}/test.mp4") == 0
or die "Can't create mp4 file: $!";
+system('ffmpeg -loglevel quiet -y '
+ . '-f lavfi -i testsrc=duration=10:size=320x200:rate=15 '
+ . '-f lavfi -i testsrc=duration=20:size=320x200:rate=15 '
+ . '-map 0:0 -map 1:0 -pix_fmt yuv420p -g 15 -c:v libx264 '
+ . '-movflags +faststart '
+ . "${\($t->testdir())}/no_mdat.mp4") == 0
+ or die "Can't create mp4 file: $!";
-$t->run()->plan(13);
+$t->run()->plan(26);
###############################################################################
+my $test_uri = '/test.mp4';
+
+again:
+
is(durations($t, 0.0), '10.0 20.0', 'start zero');
is(durations($t, 2), '8.0 18.0', 'start integer');
is(durations($t, 7.1), '2.9 12.9', 'start float');
@@ -83,17 +94,19 @@
# invalid range results in ignoring end argument
-like(http_head('/test.mp4?start=1&end=1'), qr/200 OK/, 'zero range');
-like(http_head('/test.mp4?start=1&end=0'), qr/200 OK/, 'negative range');
+like(http_head("$test_uri?start=1&end=1"), qr/200 OK/, 'zero range');
+like(http_head("$test_uri?start=1&end=0"), qr/200 OK/, 'negative range');
# start/end values exceeding track/file duration
-unlike(http_head("/test.mp4?end=11"), qr!HTTP/1.1 500!,
+unlike(http_head("$test_uri?end=11"), qr!HTTP/1.1 500!,
'end beyond short track');
-unlike(http_head("/test.mp4?end=21"), qr!HTTP/1.1 500!, 'end beyond EOF');
-unlike(http_head("/test.mp4?start=11"), qr!HTTP/1.1 500!,
+unlike(http_head("$test_uri?end=21"), qr!HTTP/1.1 500!, 'end beyond EOF');
+unlike(http_head("$test_uri?start=11"), qr!HTTP/1.1 500!,
'start beyond short track');
-like(http_head("/test.mp4?start=21"), qr!HTTP/1.1 500!, 'start beyond EOF');
+like(http_head("$test_uri?start=21"), qr!HTTP/1.1 500!, 'start beyond EOF');
+
+$test_uri = '/no_mdat.mp4', goto again unless $test_uri eq '/no_mdat.mp4';
###############################################################################
@@ -101,7 +114,7 @@
my ($t, $start, $end) = @_;
my $path = $t->{_testdir} . '/frag.mp4';
- my $uri = '/test.mp4';
+ my $uri = $test_uri;
if (defined $start) {
$uri .= "?start=$start";
if (defined $end) {