Completed
Push — master ( 64cc65...e3f897 )
by Amin
03:07
created

HLS::setFilter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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;
13
14
use Streaming\Filters\HLSFilter;
15
use Streaming\Traits\Representations;
16
use Streaming\Filters\Filter;
17
18
class HLS extends Export
19
{
20
    use Representations;
21
22
    /** @var string */
23
    private $hls_time = 10;
24
25
    /** @var bool */
26
    private $hls_allow_cache = true;
27
28
    /** @var string */
29
    private $hls_key_info_file = "";
30
31
    /** @var string */
32
    private $ts_sub_directory = "";
33
34
    /** @var string */
35
    private $hls_base_url = "";
36
37
    /**
38
     * @return string
39
     */
40
    public function getTsSubDirectory(): string
41
    {
42
        return $this->ts_sub_directory;
43
    }
44
45
    /**
46
     * @param string $ts_sub_directory
47
     * @return HLS
48
     */
49
    public function setTsSubDirectory(string $ts_sub_directory)
50
    {
51
        $this->ts_sub_directory = $ts_sub_directory;
52
        return $this;
53
    }
54
55
    /**
56
     * @param string $hls_time
57
     * @return HLS
58
     */
59
    public function setHlsTime(string $hls_time): HLS
60
    {
61
        $this->hls_time = $hls_time;
62
        return $this;
63
    }
64
65
    /**
66
     * @return string
67
     */
68
    public function getHlsTime(): string
69
    {
70
        return $this->hls_time;
71
    }
72
73
    /**
74
     * @param bool $hls_allow_cache
75
     * @return HLS
76
     */
77
    public function setHlsAllowCache(bool $hls_allow_cache): HLS
78
    {
79
        $this->hls_allow_cache = $hls_allow_cache;
80
        return $this;
81
    }
82
83
    /**
84
     * @return bool
85
     */
86
    public function isHlsAllowCache(): bool
87
    {
88
        return $this->hls_allow_cache;
89
    }
90
91
    /**
92
     * @param string $hls_key_info_file
93
     * @return HLS
94
     */
95
    public function setHlsKeyInfoFile(string $hls_key_info_file): HLS
96
    {
97
        $this->hls_key_info_file = $hls_key_info_file;
98
        return $this;
99
    }
100
101
    /**
102
     * @param string $url
103
     * @param string $path
104
     * @param int $length
105
     * @return HLS
106
     * @throws Exception\Exception
107
     */
108
    public function generateRandomKeyInfo(string $url, string $path, int $length = 32): HLS
109
    {
110
        $this->setHlsKeyInfoFile(KeyInfo::generate($url, $path, $length));
111
        return $this;
112
    }
113
114
    /**
115
     * @return string
116
     */
117
    public function getHlsKeyInfoFile(): string
118
    {
119
        return $this->hls_key_info_file;
120
    }
121
122
    /**
123
     * @param string $hls_base_url
124
     * @return HLS
125
     */
126
    public function setHlsBaseUrl(string $hls_base_url): HLS
127
    {
128
        $this->hls_base_url = $hls_base_url;
129
        return $this;
130
    }
131
132
    /**
133
     * @return string
134
     */
135
    public function getHlsBaseUrl(): string
136
    {
137
        return $this->hls_base_url;
138
    }
139
140
    /**
141
     * @return Filter
142
     */
143
    protected function getFilter(): Filter
144
    {
145
        return new HLSFilter($this);
146
    }
147
}
148