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
|
1 |
|
public function getDuration() |
83
|
|
|
{ |
84
|
1 |
|
return $this->extinfTag->getDuration(); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @return Chrisyue\PhpM3u8\Tag\ByteRangeTag |
89
|
|
|
*/ |
90
|
2 |
|
public function getByteRangeTag() |
91
|
|
|
{ |
92
|
2 |
|
return $this->byteRangeTag; |
93
|
|
|
} |
94
|
|
|
|
95
|
1 |
|
public function isEmpty() |
96
|
|
|
{ |
97
|
1 |
|
return $this->uri->isEmpty(); |
98
|
|
|
} |
99
|
|
|
|
100
|
2 |
|
protected function getComponents() |
101
|
|
|
{ |
102
|
|
|
return array( |
103
|
2 |
|
$this->extinfTag, |
104
|
2 |
|
$this->byteRangeTag, |
105
|
2 |
|
$this->discontinuityTag, |
106
|
2 |
|
$this->uri, |
107
|
2 |
|
); |
108
|
|
|
} |
109
|
|
|
} |
110
|
|
|
|