Passed
Push — master ( ac0e9d...b23da5 )
by Amin
04:21
created

VP9::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 2
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of the PHP-FFmpeg-video-streaming package.
5
 *
6
 * (c) Amin Yazdanpanah <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Streaming\Format;
13
14
/**
15
 * The VP9 video format
16
 */
17
final class VP9 extends Video
18
{
19
    /**
20
     * VP9 constructor.
21
     * @param string $video_codec
22
     * @param string|null $audio_codec
23
     */
24
    public function __construct(string $video_codec = 'libvpx-vp9', string $audio_codec = null)
25
    {
26
        $this->setVideoCodec($video_codec);
27
28
        if($audio_codec){
29
            $this->setAudioCodec($audio_codec);
30
        }
31
    }
32
33
    /**
34
     * {@inheritDoc}
35
     */
36
    public function getAvailableAudioCodecs()
37
    {
38
        return [''];
39
    }
40
41
    /**
42
     * {@inheritDoc}
43
     */
44
    public function getAvailableVideoCodecs(): array
45
    {
46
        return ['libvpx', 'libvpx-vp9'];
47
    }
48
49
    /**
50
     * @return int
51
     */
52
    public function getModulus()
53
    {
54
        return 2;
55
    }
56
57
    /**
58
     * Returns true if the current format supports B-Frames.
59
     *
60
     * @see https://wikipedia.org/wiki/Video_compression_picture_types
61
     *
62
     * @return Boolean
63
     */
64
    public function supportBFrames()
65
    {
66
        return true;
67
    }
68
}
69