Failed Conditions
Push — master ( c912ee...feeb83 )
by Sébastien
03:39
created

src/Video/VideoConvertParamsInterface.php (3 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Soluble\MediaTools\Video;
6
7
use Soluble\MediaTools\Common\Service\ActionParamInterface;
8
use Soluble\MediaTools\Video\Exception\InvalidArgumentException;
9
use Soluble\MediaTools\Video\Exception\UnsetParamReaderException;
10
11
interface VideoConvertParamsInterface extends ActionParamInterface
12
{
13
    // VIDEO constants
14
    public const PARAM_VIDEO_CODEC         = 'VIDEO_CODEC';
15
    public const PARAM_VIDEO_BITRATE       = 'VIDEO_BITRATE';
16
    public const PARAM_VIDEO_MIN_BITRATE   = 'VIDEO_MIN_BITRATE';
17
    public const PARAM_VIDEO_MAX_BITRATE   = 'VIDEO_MAX_BITRATE';
18
    public const PARAM_VIDEO_QUALITY_SCALE = 'VIDEO_QUALITY_SCALE';
19
    public const PARAM_VIDEO_FILTER        = 'VIDEO_FILTER';
20
    public const PARAM_CRF                 = 'CRF';
21
    public const PARAM_PIX_FMT             = 'PIX_FMT';
22
    public const PARAM_PRESET              = 'PRESET';
23
    public const PARAM_TUNE                = 'TUNE';
24
    public const PARAM_STREAMABLE          = 'STREAMABLE';
25
    public const PARAM_QUALITY             = 'QUALITY';
26
    public const PARAM_FRAME_PARALLEL      = 'FRAME_PARALLEL';
27
    public const PARAM_TILE_COLUMNS        = 'TILE_COLUMNS';
28
    public const PARAM_KEYFRAME_SPACING    = 'KEYFRAME_SPACING';
29
    public const PARAM_VIDEO_FRAMES        = 'VIDEO_FRAMES';
30
31
    // Audio family constants
32
    public const PARAM_AUDIO_CODEC         = 'AUDIO_CODEC';
33
    public const PARAM_AUDIO_BITRATE       = 'AUDIO_BITRATE';
34
    public const PARAM_NOAUDIO             = 'NOAUDIO';
35
36
    // Timeslice options
37
    public const PARAM_SEEK_START        = 'SEEK_START';
38
    public const PARAM_SEEK_END          = 'SEEK_END';
39
40
    // Encoder options
41
    public const PARAM_SPEED             = 'SPEED';
42
    public const PARAM_PASS              = 'PASS';
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 8 spaces but found 14 spaces

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
43
    public const PARAM_PASSLOGFILE       = 'PASSLOGFILE';
44
    public const PARAM_THREADS           = 'THREADS';
45
46
    // File Options
47
    public const PARAM_OVERWRITE         = 'OVERWRITE';
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 9 spaces

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
48
    public const PARAM_OUTPUT_FORMAT     = 'OUTPUT_FORMAT';
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 1 space but found 5 spaces

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
49
50
    /**
51
     * Built-in params.
52
     *
53
     * @var string[]
54
     */
55
    public const BUILTIN_PARAMS = [
56
        self::PARAM_VIDEO_QUALITY_SCALE,
57
        self::PARAM_VIDEO_CODEC,
58
        self::PARAM_VIDEO_BITRATE,
59
        self::PARAM_VIDEO_MIN_BITRATE,
60
        self::PARAM_VIDEO_MAX_BITRATE,
61
        self::PARAM_VIDEO_FILTER,
62
        self::PARAM_AUDIO_CODEC,
63
        self::PARAM_AUDIO_BITRATE,
64
        self::PARAM_CRF,
65
        self::PARAM_PIX_FMT,
66
        self::PARAM_PRESET,
67
        self::PARAM_TUNE,
68
        self::PARAM_STREAMABLE,
69
        self::PARAM_QUALITY,
70
        self::PARAM_OUTPUT_FORMAT,
71
        self::PARAM_FRAME_PARALLEL,
72
        self::PARAM_TILE_COLUMNS,
73
        self::PARAM_THREADS,
74
        self::PARAM_SPEED,
75
        self::PARAM_KEYFRAME_SPACING,
76
        self::PARAM_OVERWRITE,
77
        self::PARAM_NOAUDIO,
78
        self::PARAM_VIDEO_FRAMES,
79
        self::PARAM_SEEK_START,
80
        self::PARAM_SEEK_END,
81
        self::PARAM_PASSLOGFILE,
82
        self::PARAM_PASS,
83
    ];
84
85
    /**
86
     * Set a built-in param...
87
     *
88
     * @param string $paramName  a param that must exist in builtInParams
89
     * @param mixed  $paramValue
90
     *
91
     * @throws InvalidArgumentException in case of unsupported builtin param
92
     */
93
    public function withBuiltInParam(string $paramName, $paramValue): self;
94
95
    /**
96
     * Return VideoConvertParams without this one.
97
     */
98
    public function withoutParam(string $paramName): self;
99
100
    /**
101
     * Return the internal array holding params.
102
     *
103
     * @return array<string,mixed>
104
     */
105
    public function toArray(): array;
106
107
    /**
108
     * Return a param, throw an exception if the param has not been defined yet.
109
     *
110
     * @return mixed
111
     *
112
     * @throws UnsetParamReaderException
113
     */
114
    public function getParam(string $paramName);
115
116
    /**
117
     * Return a new object with (extra) params added (they will be merged).
118
     *
119
     * @return VideoConvertParamsInterface
120
     */
121
    public function withConvertParams(self $extraParams): self;
122
}
123