-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathffmpeg-filter.php
69 lines (53 loc) · 1.25 KB
/
ffmpeg-filter.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
class ffmpeg_filter {
public $id;
public $name;
public $values;
public $input_streams;
public $output_streams;
public $filter;
public function __construct() {
$filter = null;
}
static public function filter_with_params($name,$values,$input_streams,$output_streams,$next_filter = null) {
$filter = new ffmpeg_filter();
$filter->name = $name;
$filter->values = $values;
$filter->input_streams = $input_streams;
$filter->output_streams = $output_streams;
$filter->filter = $next_filter;
return $filter;
}
static public function scale($width,$heigth) {
$filter = new ffmpeg_filter();
$filter->name = "scale";
$filter->values = array($width,$heigth);
$filter->input_streams = array();
$filter->output_streams = array();
return $filter;
}
public function get_string() {
$str = $this->name;
if (!empty($this->values)) {
$str .= "=";
} else {
return $str;
}
$numItems = count($this->values);
$i = 0;
foreach ($this->values as $param) {
$str .= $param;
if (!(++$i === $numItems)) {
$str .= ":";
}
}
if (!is_null($this->filter)) {
$str .= "," . $this->filter->get_string();
}
return $str;
}
public function add_seq_filter($filter) {
$this->filter = $filter;
}
}
?>