1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the PhpM3u8 package. |
5
|
|
|
* |
6
|
|
|
* (c) Chrisyue <http://chrisyue.com/> |
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 Chrisyue\PhpM3u8; |
13
|
|
|
|
14
|
|
|
class Segment extends AbstractContainer |
15
|
|
|
{ |
16
|
|
|
private $extinfTag; |
17
|
|
|
private $byteRangeTag; |
18
|
|
|
private $discontinuityTag; |
19
|
|
|
private $uri; |
20
|
|
|
|
21
|
|
|
private $mediaSequence; |
22
|
|
|
private $discontinuitySequence; |
23
|
|
|
|
24
|
2 |
|
public function __construct($m3u8Version = null) |
25
|
|
|
{ |
26
|
2 |
|
$this->extinfTag = new Tag\ExtinfTag($m3u8Version); |
27
|
2 |
|
$this->byteRangeTag = new Tag\ByteRangeTag(); |
28
|
2 |
|
$this->discontinuityTag = new Tag\DiscontinuityTag(); |
29
|
2 |
|
$this->uri = new Uri(); |
30
|
2 |
|
} |
31
|
|
|
|
32
|
1 |
|
public function setMediaSequence($mediaSequence) |
33
|
|
|
{ |
34
|
1 |
|
$this->mediaSequence = $mediaSequence; |
35
|
|
|
|
36
|
1 |
|
return $this; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function getMediaSequence() |
40
|
|
|
{ |
41
|
|
|
return $this->mediaSequence; |
42
|
|
|
} |
43
|
|
|
|
44
|
1 |
|
public function setDiscontinuitySequence($discontinuitySequence) |
45
|
|
|
{ |
46
|
1 |
|
$this->discontinuitySequence = $discontinuitySequence; |
47
|
|
|
|
48
|
1 |
|
return $this; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function getDiscontinuitySequence() |
52
|
|
|
{ |
53
|
|
|
return $this->discontinuitySequence; |
54
|
|
|
} |
55
|
|
|
|
56
|
2 |
|
public function getUri() |
57
|
|
|
{ |
58
|
2 |
|
return $this->uri; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @return Chrisyue\PhpM3u8\Tag\DiscontinuityTag |
63
|
|
|
*/ |
64
|
1 |
|
public function getDiscontinuityTag() |
65
|
|
|
{ |
66
|
1 |
|
return $this->discontinuityTag; |
67
|
|
|
} |
68
|
|
|
|
69
|
1 |
|
public function isDiscontinuity() |
70
|
|
|
{ |
71
|
1 |
|
return $this->discontinuityTag->isDiscontinuity(); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @return Chrisyue\PhpM3u8\Tag\ExtinfTag |
76
|
|
|
*/ |
77
|
2 |
|
public function getExtinfTag() |
78
|
|
|
{ |
79
|
2 |
|
return $this->extinfTag; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @return Chrisyue\PhpM3u8\Tag\ByteRangeTag |
84
|
|
|
*/ |
85
|
2 |
|
public function getByteRangeTag() |
86
|
|
|
{ |
87
|
2 |
|
return $this->byteRangeTag; |
88
|
|
|
} |
89
|
|
|
|
90
|
1 |
|
public function isEmpty() |
91
|
|
|
{ |
92
|
1 |
|
return $this->uri->isEmpty(); |
93
|
|
|
} |
94
|
|
|
|
95
|
2 |
|
protected function getComponents() |
96
|
|
|
{ |
97
|
|
|
return array( |
98
|
2 |
|
$this->extinfTag, |
99
|
2 |
|
$this->byteRangeTag, |
100
|
2 |
|
$this->discontinuityTag, |
101
|
2 |
|
$this->uri, |
102
|
2 |
|
); |
103
|
|
|
} |
104
|
|
|
} |
105
|
|
|
|