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

X264::supportBFrames()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
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
final class X264 extends Video
15
{
16
17
    /**
18
     * X264 constructor.
19
     * @param string $video_codec
20
     * @param string|null $audio_codec
21
     */
22
    public function __construct(string $video_codec = 'libx264', string $audio_codec = null)
23
    {
24
        $this->setVideoCodec($video_codec);
25
26
        if($audio_codec){
27
            $this->setAudioCodec($audio_codec);
28
        }
29
    }
30
31
    /**
32
     * Returns the list of available audio codecs for this format.
33
     *
34
     * @return array
35
     */
36
    public function getAvailableAudioCodecs()
37
    {
38
        return [''];
39
    }
40
41
    /**
42
     * Returns the list of available video codecs for this format.
43
     *
44
     * @return array
45
     */
46
    public function getAvailableVideoCodecs(): array
47
    {
48
        return ['libx264', 'h264', 'h264_afm'];
49
    }
50
51
    /**
52
     * @return int
53
     */
54
    public function getModulus()
55
    {
56
        return 2;
57
    }
58
59
    /**
60
     * Returns true if the current format supports B-Frames.
61
     *
62
     * @see https://wikipedia.org/wiki/Video_compression_picture_types
63
     *
64
     * @return Boolean
65
     */
66
    public function supportBFrames()
67
    {
68
        return true;
69
    }
70
}
71