@@ 14-43 (lines=30) @@ | ||
11 | ||
12 | namespace Chrisyue\PhpM3u8\Tag; |
|
13 | ||
14 | class MediaSequenceTag extends AbstractHeadTag |
|
15 | { |
|
16 | private $mediaSequence = 0; |
|
17 | ||
18 | const TAG_IDENTIFIER = '#EXT-X-MEDIA-SEQUENCE'; |
|
19 | ||
20 | public function setMediaSequence($mediaSequence) |
|
21 | { |
|
22 | $this->mediaSequence = $mediaSequence; |
|
23 | ||
24 | return $this; |
|
25 | } |
|
26 | ||
27 | public function getMediaSequence() |
|
28 | { |
|
29 | return $this->mediaSequence; |
|
30 | } |
|
31 | ||
32 | public function dump() |
|
33 | { |
|
34 | return sprintf('%s:%d', self::TAG_IDENTIFIER, $this->mediaSequence); |
|
35 | } |
|
36 | ||
37 | protected function read($line) |
|
38 | { |
|
39 | preg_match('/^#EXT-X-MEDIA-SEQUENCE:(\d+)/', $line, $matches); |
|
40 | ||
41 | $this->mediaSequence = (int) $matches[1]; |
|
42 | } |
|
43 | } |
|
44 |
@@ 14-42 (lines=29) @@ | ||
11 | ||
12 | namespace Chrisyue\PhpM3u8\Tag; |
|
13 | ||
14 | class TargetDurationTag extends AbstractHeadTag |
|
15 | { |
|
16 | private $targetDuration; |
|
17 | ||
18 | const TAG_IDENTIFIER = '#EXT-X-TARGETDURATION'; |
|
19 | ||
20 | public function setTargetDuration($targetDuration) |
|
21 | { |
|
22 | $this->targetDuration = $targetDuration; |
|
23 | ||
24 | return $this; |
|
25 | } |
|
26 | ||
27 | public function getTargetDuration() |
|
28 | { |
|
29 | return $this->targetDuration; |
|
30 | } |
|
31 | ||
32 | public function dump() |
|
33 | { |
|
34 | return sprintf('%s:%d', self::TAG_IDENTIFIER, $this->targetDuration); |
|
35 | } |
|
36 | ||
37 | protected function read($line) |
|
38 | { |
|
39 | preg_match('/^#EXT-X-TARGETDURATION:(\d+)/', $line, $matches); |
|
40 | $this->targetDuration = (int) $matches[1]; |
|
41 | } |
|
42 | } |
|
43 |
@@ 14-42 (lines=29) @@ | ||
11 | ||
12 | namespace Chrisyue\PhpM3u8\Tag; |
|
13 | ||
14 | class VersionTag extends AbstractHeadTag |
|
15 | { |
|
16 | private $version = 3; |
|
17 | ||
18 | const TAG_IDENTIFIER = '#EXT-X-VERSION'; |
|
19 | ||
20 | public function setVersion($version) |
|
21 | { |
|
22 | $this->version = $version; |
|
23 | ||
24 | return $this; |
|
25 | } |
|
26 | ||
27 | public function getVersion() |
|
28 | { |
|
29 | return $this->version; |
|
30 | } |
|
31 | ||
32 | public function dump() |
|
33 | { |
|
34 | return sprintf('%s:%d', self::TAG_IDENTIFIER, $this->version); |
|
35 | } |
|
36 | ||
37 | protected function read($line) |
|
38 | { |
|
39 | preg_match('/^#EXT-X-VERSION:(\d+)/', $line, $matches); |
|
40 | $this->version = (int) $matches[1]; |
|
41 | } |
|
42 | } |
|
43 |