Passed
Push — master ( e997b4...814bec )
by Sébastien
02:46
created

YadifVideoFilter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 37
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getFFmpegCLIValue() 0 10 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Soluble\MediaTools\Video\Filter;
6
7
class YadifVideoFilter extends AbstractVideoFilter implements VideoFilterTypeDeintInterface
8
{
9
    public const DEFAULT_MODE   = 0;
10
    public const DEFAULT_PARITY = -1;
11
    public const DEFAULT_DEINT  = 0;
12
13
    /** @var array<string, int> */
14
    protected $options = [
15
        'mode'   => self::DEFAULT_MODE,
16
        'parity' => self::DEFAULT_PARITY,
17
        'deint'  => self::DEFAULT_DEINT,
18
    ];
19
20
    /**
21
     * @param int $mode   The interlacing mode to adopt (0, send_frame Output one frame for each frame)
22
     * @param int $parity default=-1 Enable automatic detection of field parity. 0:
23
     * @param int $deint  Specify which frames to deinterlace (0: all - Deinterlace all frames.)
24
     */
25 1
    public function __construct(int $mode = self::DEFAULT_MODE, int $parity = self::DEFAULT_PARITY, int $deint = self::DEFAULT_DEINT)
26
    {
27 1
        $this->options = [
28 1
            'mode'   => $mode,
29 1
            'parity' => $parity,
30 1
            'deint'  => $deint,
31
        ];
32 1
    }
33
34 1
    public function getFFmpegCLIValue(): string
35
    {
36 1
        $yadifArg = sprintf(
37 1
            'yadif=mode=%s:parity=%s:deint=%s',
38 1
            $this->options['mode'],
39 1
            $this->options['parity'],
40 1
            $this->options['deint']
41
        );
42
43 1
        return $yadifArg;
44
    }
45
}
46