Mercurial > hg > nginx-tests
comparison mp4.t @ 390:7a65ebfdb02e
Tests: skip mp4 if ffmpeg does not support lavfi format.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Fri, 11 Apr 2014 17:24:34 +0400 |
parents | c24d1c0b4c73 |
children | 847ea345becb |
comparison
equal
deleted
inserted
replaced
389:c24d1c0b4c73 | 390:7a65ebfdb02e |
---|---|
23 select STDERR; $| = 1; | 23 select STDERR; $| = 1; |
24 select STDOUT; $| = 1; | 24 select STDOUT; $| = 1; |
25 | 25 |
26 my $t = Test::Nginx->new()->has(qw/http mp4/)->has_daemon('ffprobe') | 26 my $t = Test::Nginx->new()->has(qw/http mp4/)->has_daemon('ffprobe') |
27 ->has_daemon('ffmpeg') | 27 ->has_daemon('ffmpeg') |
28 ->plan(14)->write_file_expand('nginx.conf', <<'EOF'); | 28 ->write_file_expand('nginx.conf', <<'EOF'); |
29 | 29 |
30 %%TEST_GLOBALS%% | 30 %%TEST_GLOBALS%% |
31 | 31 |
32 daemon off; | 32 daemon off; |
33 | 33 |
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 EOF | 50 EOF |
51 | 51 |
52 plan(skip_all => 'no lavfi') | |
53 unless grep /lavfi/, `ffmpeg -loglevel quiet -formats`; | |
52 system('ffmpeg -loglevel quiet -y ' | 54 system('ffmpeg -loglevel quiet -y ' |
53 . '-f lavfi -i testsrc=duration=10:size=320x200:rate=15 ' | 55 . '-f lavfi -i testsrc=duration=10:size=320x200:rate=15 ' |
54 . '-f lavfi -i testsrc=duration=20:size=320x200:rate=15 ' | 56 . '-f lavfi -i testsrc=duration=20:size=320x200:rate=15 ' |
55 . '-map 0:0 -map 1:0 -pix_fmt yuv420p -g 15 -c:v libx264 ' | 57 . '-map 0:0 -map 1:0 -pix_fmt yuv420p -g 15 -c:v libx264 ' |
56 . "${\($t->testdir())}/test.mp4") == 0 | 58 . "${\($t->testdir())}/test.mp4") == 0 |
57 or die "Can't create mp4 file: $!"; | 59 or die "Can't create mp4 file: $!"; |
58 | 60 |
59 $t->run(); | 61 $t->run()->plan(14); |
60 | 62 |
61 ############################################################################### | 63 ############################################################################### |
62 | 64 |
63 is(durations($t, 0.0), '10.0 20.0', 'start zero'); | 65 is(durations($t, 0.0), '10.0 20.0', 'start zero'); |
64 is(durations($t, 2), '8.0 18.0', 'start integer'); | 66 is(durations($t, 2), '8.0 18.0', 'start integer'); |