VP9   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
c 0
b 0
f 0
dl 0
loc 59
rs 10
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getModulus() 0 3 1
A getAvailableVideoCodecs() 0 3 1
A getAvailableAudioCodecs() 0 3 1
A __construct() 0 11 2
A supportBFrames() 0 3 1
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 StreamFormat
18
{
19
    private const MODULUS = 2;
20
21
    /**
22
     * VP9 constructor.
23
     * @param string $video_codec
24
     * @param string|null $audio_codec
25
     * @param bool $default_init_opts
26
     */
27
    public function __construct(string $video_codec = 'libvpx-vp9', string $audio_codec = 'aac', bool $default_init_opts = true)
28
    {
29
        $this
30
            ->setVideoCodec($video_codec)
31
            ->setAudioCodec($audio_codec);
32
33
        /**
34
         * set the default value of h265 codec options
35
         * see https://ffmpeg.org/ffmpeg-codecs.html#Options-26 for more information about options
36
         */
37
        if ($default_init_opts) {
38
            //@TODO: add default vp9
39
        }
40
    }
41
42
    /**
43
     * {@inheritDoc}
44
     */
45
    public function getAvailableAudioCodecs()
46
    {
47
        return ['libvorbis'];
48
    }
49
50
    /**
51
     * {@inheritDoc}
52
     */
53
    public function getAvailableVideoCodecs(): array
54
    {
55
        return ['libvpx', 'libvpx-vp9'];
56
    }
57
58
    /**
59
     * @return int
60
     */
61
    public function getModulus()
62
    {
63
        return static::MODULUS;
64
    }
65
66
    /**
67
     * Returns true if the current format supports B-Frames.
68
     *
69
     * @see https://wikipedia.org/wiki/Video_compression_picture_types
70
     *
71
     * @return Boolean
72
     */
73
    public function supportBFrames()
74
    {
75
        return true;
76
    }
77
}
78