-
-
Notifications
You must be signed in to change notification settings - Fork 120
/
Copy pathDASHTest.php
76 lines (61 loc) · 2.11 KB
/
DASHTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
/**
* This file is part of the PHP-FFmpeg-video-streaming package.
*
* (c) Amin Yazdanpanah <contact@aminyazdanpanah.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tests\FFMpegStreaming;
use Streaming\DASH;
use Streaming\Stream;
use Streaming\Format\StreamFormat;
use Streaming\Representation;
class DASHTest extends TestCase
{
public function testDASHClass()
{
$this->assertInstanceOf(Stream::class, $this->getDASH());
}
public function testFormat()
{
$dash = $this->getDASH();
$dash->HEVC();
$this->assertInstanceOf(StreamFormat::class, $dash->getFormat());
}
public function testAutoRepresentations()
{
$dash = $this->getDASH();
$dash->HEVC()
->autoGenerateRepresentations();
$representations = $dash->getRepresentations()->all();
$this->assertIsArray($representations);
$this->assertInstanceOf(Representation::class, current($representations));
$this->assertEquals('256x144', $representations[0]->size2string());
$this->assertEquals('426x240', $representations[1]->size2string());
$this->assertEquals('640x360', $representations[2]->size2string());
$this->assertEquals(103, $representations[0]->getKiloBitrate());
$this->assertEquals(138, $representations[1]->getKiloBitrate());
$this->assertEquals(207, $representations[2]->getKiloBitrate());
}
public function testSet()
{
$dash = $this->getDASH();
$dash->setAdaption('test-adaption');
$this->assertEquals('test-adaption', $dash->getAdaption());
}
public function testSave()
{
$dash = $this->getDASH();
$export_class = $dash->HEVC()
->autoGenerateRepresentations()
->save($this->srcDir . '/dash/test.mpd');
$this->assertFileExists($this->srcDir . '/dash/test.mpd');
$this->assertInstanceOf(Stream::class, $export_class);
}
private function getDASH()
{
return new DASH($this->getVideo());
}
}