-
Notifications
You must be signed in to change notification settings - Fork 1
Sdt #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Sdt #2
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
74c0374
Init
9a7abd5
SDT parser
1df3117
SDT identifier
2537c6d
SDT parser improve
53a7ef7
SDT parser improve
3ce2783
SDT parser improve
ebd7d9f
SDT parser improve
c380d85
SDT parser improve
5479366
SDT parser improve
555dbe1
SDT parser improve
5e620ae
SDT parser improve
2a1de74
PMT parser improve
c317f9a
Parse descriptors improve
bc37998
Parse descriptors improve
35029fb
SDT parser improve. Add test for SDT
d96591a
register SDT parser
54744c3
fixed event name sdt-update, added sdt output to StreamContext toString
b0f92cc
Passing an object in an update event
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * MIT License | ||
| * | ||
| * Copyright (c) 2018 Samuel CHEMLA | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal | ||
| * in the Software without restriction, including without limitation the rights | ||
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| * copies of the Software, and to permit persons to whom the Software is | ||
| * furnished to do so, subject to the following conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be included in all | ||
| * copies or substantial portions of the Software. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| * SOFTWARE. | ||
| */ | ||
|
|
||
| namespace PhpBg\DvbPsi\Descriptors; | ||
|
|
||
| use PhpBg\DvbPsi\Descriptors\Values\ServiceType; | ||
|
|
||
| /** | ||
| * Class ServiceList | ||
| * @see Final draft ETSI EN 300 468 V1.15.1 (2016-03), 6.2.33 Service descriptor | ||
| */ | ||
| class ServiceDescriptor | ||
| { | ||
|
|
||
| /** | ||
| * This is an 8-bit field specifying the type of the service. The assignment of service_type value for a | ||
| * service is described in annex I. | ||
| */ | ||
| public $serviceType; | ||
| public $serviceProviderName; | ||
| public $serviceName; | ||
|
|
||
| /** | ||
| * ServiceDescriptor constructor. | ||
| * @param $data | ||
| * @throws \PhpBg\DvbPsi\Exception | ||
| */ | ||
| public function __construct($data) | ||
| { | ||
| $pointer = 0; | ||
| $serviceType = unpack('C', $data[ $pointer])[1]; | ||
| $this->serviceType = new ServiceType($serviceType); | ||
|
|
||
| $pointer += 1; | ||
| $serviceProviderNameLength = unpack('C', $data[$pointer])[1]; | ||
|
|
||
| $pointer += 1; | ||
| $this->serviceProviderName = substr($data, $pointer, $serviceProviderNameLength); | ||
|
|
||
| $pointer += $serviceProviderNameLength; | ||
| $serviceNameLength = unpack('C', $data[$pointer])[1]; | ||
|
|
||
| $pointer += 1; | ||
| $this->serviceName = substr($data, $pointer, $serviceNameLength); | ||
| } | ||
|
|
||
| public function __toString() | ||
| { | ||
| $msg = sprintf("Service type: %s (0x%x)\n", $this->serviceType->getKey(), $this->serviceType->getValue() ); | ||
| $msg .= "Service provider name: $this->serviceProviderName\n"; | ||
| $msg .= "Service name: $this->serviceName\n"; | ||
|
|
||
| return $msg; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * MIT License | ||
| * | ||
| * Copyright (c) 2018 Samuel CHEMLA | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal | ||
| * in the Software without restriction, including without limitation the rights | ||
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| * copies of the Software, and to permit persons to whom the Software is | ||
| * furnished to do so, subject to the following conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be included in all | ||
| * copies or substantial portions of the Software. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| * SOFTWARE. | ||
| */ | ||
|
|
||
| namespace PhpBg\DvbPsi\Descriptors\Values; | ||
|
|
||
| use MyCLabs\Enum\Enum; | ||
| use PhpBg\DvbPsi\Exception; | ||
|
|
||
| /** | ||
| * Class EsType | ||
| * @see https://en.wikipedia.org/wiki/Program-specific_information#Elementary_stream_types | ||
| */ | ||
| class EsType | ||
| { | ||
| const ES_TYPES = [ | ||
| 1 =>'ISO/IEC 11172-2 (MPEG-1 video)in a packetized stream', | ||
| 2 =>'ITU-T Rec. H.262 and ISO/IEC 13818-2 (MPEG-2 higher rate interlaced video) in a packetized stream', | ||
| 3 =>'ISO/IEC 11172-3 (MPEG-1 audio) in a packetized stream', | ||
| 4 =>'ISO/IEC 13818-3 (MPEG-2 halved sample rate audio) in a packetized stream', | ||
| 5 =>'ITU-T Rec. H.222 and ISO/IEC 13818-1 (MPEG-2 tabled data) privately defined', | ||
| 6 =>'ITU-T Rec. H.222 and ISO/IEC 13818-1 (MPEG-2 packetized data) privately defined (i.e., DVB subtitles/VBI and AC-3)', | ||
| 7 =>'ISO/IEC 13522 (MHEG) in a packetized stream', | ||
| 8 =>'ITU-T Rec. H.222 and ISO/IEC 13818-1 DSM CC in a packetized stream', | ||
| 9 =>'ITU-T Rec. H.222 and ISO/IEC 13818-1/11172-1 auxiliary data in a packetized stream', | ||
| 10 =>'ISO/IEC 13818-6 DSM CC multiprotocol encapsulation ', | ||
| 11 =>'ISO/IEC 13818-6 DSM CC U-N messages', | ||
| 12 =>'ISO/IEC 13818-6 DSM CC stream descriptors', | ||
| 13 =>'ISO/IEC 13818-6 DSM CC tabled data', | ||
| 14 =>'ISO/IEC 13818-1 auxiliary data in a packetized stream', | ||
| 15 =>'ISO/IEC 13818-7 ADTS AAC (MPEG-2 lower bit-rate audio) in a packetized stream', | ||
| 16 =>'ISO/IEC 14496-2 (MPEG-4 H.263 based video) in a packetized stream', | ||
| 17 =>'ISO/IEC 14496-3 (MPEG-4 LOAS multi-format framed audio) in a packetized stream', | ||
| 18 =>'ISO/IEC 14496-1 (MPEG-4 FlexMux) in a packetized stream', | ||
| 19 =>'ISO/IEC 14496-1 (MPEG-4 FlexMux) in ISO/IEC 14496 tables', | ||
| 20 =>'ISO/IEC 13818-6 DSM CC synchronized download protocol', | ||
| 21 =>'Packetized metadata', | ||
| 22 =>'Sectioned metadata', | ||
| 23 =>'ISO/IEC 13818-6 DSM CC Data Carousel metadata', | ||
| 24 =>'ISO/IEC 13818-6 DSM CC Object Carousel metadata', | ||
| 25 =>'ISO/IEC 13818-6 Synchronized Download Protocol metadata', | ||
| 26 =>'ISO/IEC 13818-11 IPMP', | ||
| 27 =>'ITU-T Rec. H.264 and ISO/IEC 14496-10 (lower bit-rate video) in a packetized stream', | ||
| 28 =>'ISO/IEC 14496-3 (MPEG-4 raw audio) in a packetized stream', | ||
| 29 =>'ISO/IEC 14496-17 (MPEG-4 text) in a packetized stream', | ||
| 30 =>'ISO/IEC 23002-3 (MPEG-4 auxiliary video) in a packetized stream', | ||
| 31 =>'ISO/IEC 14496-10 SVC (MPEG-4 AVC sub-bitstream) in a packetized stream', | ||
| 32 =>'ISO/IEC 14496-10 MVC (MPEG-4 AVC sub-bitstream) in a packetized stream', | ||
| 33 =>'ITU-T Rec. T.800 and ISO/IEC 15444 (JPEG 2000 video) in a packetized stream', | ||
| 36 =>'ITU-T Rec. H.265 and ISO/IEC 23008-2 (Ultra HD video) in a packetized stream', | ||
| 66 =>'Chinese Video Standard in a packetized stream', | ||
| 127 =>'ISO/IEC 13818-11 IPMP (DRM) in a packetized stream', | ||
| 128 =>'ITU-T Rec. H.262 and ISO/IEC 13818-2 with DES-64-CBC encryption for DigiCipher II or PCM audio for Blu-ray in a packetized stream', | ||
| 129 =>'Dolby Digital (AC-3) up to six channel audio for ATSC and Blu-ray in a packetized stream', | ||
| 130 =>'SCTE subtitle or DTS 6 channel audio for Blu-ray in a packetized stream', | ||
| 131 =>'Dolby TrueHD lossless audio for Blu-ray in a packetized stream', | ||
| 132 =>'Dolby Digital Plus (enhanced AC-3) up to 16 channel audio for Blu-ray in a packetized stream', | ||
| 133 =>'DTS 8 channel audio for Blu-ray in a packetized stream', | ||
| 134 =>'SCTE-35[5] digital program insertion cue message or DTS 8 channel lossless audio for Blu-ray in a packetized stream', | ||
| 135 =>'Dolby Digital Plus (enhanced AC-3) up to 16 channel audio for ATSC in a packetized stream', | ||
| 144 =>'Blu-ray Presentation Graphic Stream (subtitling) in a packetized stream', | ||
| 145 =>'ATSC DSM CC Network Resources table', | ||
| 192 =>'DigiCipher II text in a packetized stream', | ||
| 193 =>'Dolby Digital (AC-3) up to six channel audio with AES-128-CBC data encryption in a packetized stream', | ||
| 194 =>'ATSC DSM CC synchronous data or Dolby Digital Plus up to 16 channel audio with AES-128-CBC data encryption in a packetized stream', | ||
| 207 =>'ISO/IEC 13818-7 ADTS AAC with AES-128-CBC frame encryption in a packetized stream', | ||
| 209 =>'BBC Dirac (Ultra HD video) in a packetized stream', | ||
| 210 =>'Audio Video Standard AVS2 (Ultra HD video) in a packetized stream', | ||
| 211 =>'Audio Video Standard AVS3 Audio in a packetized stream', | ||
| 212 =>'Audio Video Standard AVS3 Video (Ultra HD video) in a packetized stream', | ||
| 219 =>'ITU-T Rec. H.264 and ISO/IEC 14496-10 with AES-128-CBC slice encryption in a packetized stream', | ||
| 234 =>'Microsoft Windows Media Video 9 (lower bit-rate video) in a packetized stream', | ||
| ]; | ||
|
|
||
| public static function desc ($type) { | ||
| return self::ES_TYPES[$type]??'Unknown'; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * MIT License | ||
| * | ||
| * Copyright (c) 2018 Samuel CHEMLA | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal | ||
| * in the Software without restriction, including without limitation the rights | ||
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| * copies of the Software, and to permit persons to whom the Software is | ||
| * furnished to do so, subject to the following conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be included in all | ||
| * copies or substantial portions of the Software. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| * SOFTWARE. | ||
| */ | ||
|
|
||
| namespace PhpBg\DvbPsi\Descriptors\Values; | ||
|
|
||
| use MyCLabs\Enum\Enum; | ||
| use PhpBg\DvbPsi\Exception; | ||
|
|
||
| /** | ||
| * Class EsType | ||
| * @see https://en.wikipedia.org/wiki/Program-specific_information#Elementary_stream_types | ||
| */ | ||
| class ProgramEsDescriptorTag | ||
| { | ||
| const TAG = [ | ||
| 2 =>'Video stream header parameters for ITU-T Rec. H.262, ISO/IEC 13818-2 and ISO/IEC 11172-2', | ||
| 3 =>'Audio stream header parameters for ISO/IEC 13818-3 and ISO/IEC 11172-3', | ||
| 4 =>'Hierarchy for stream selection', | ||
| 5 =>'Registration of private formats', | ||
| 6 =>'Data stream alignment for packetized video and audio sync point', | ||
| 7 =>'Target background grid defines total display area size', | ||
| 8 =>'Video Window defines position in display area', | ||
| 9 =>'Conditional access system and EMM/ECM PID', | ||
| 10 =>'ISO 639 language and audio type', | ||
| 11 =>'System clock external reference', | ||
| 12 =>'Multiplex buffer utilization bounds', | ||
| 13 =>'Copyright identification system and reference', | ||
| 14 =>'Maximum bit rate', | ||
| 15 =>'Private data indicator', | ||
| 16 =>'Smoothing buffer', | ||
| 17 =>'STD video buffer leak control', | ||
| 18 =>'IBP video I-frame indicator', | ||
| 19 =>'ISO/IEC13818-6 DSM CC carousel identifier', | ||
| 20 =>'ISO/IEC13818-6 DSM CC association tag', | ||
| 21 =>'ISO/IEC13818-6 DSM CC deferred association tag', | ||
| 22 =>'ISO/IEC13818-6 DSM CC Reserved.', | ||
| 23 =>'DSM CC NPT reference', | ||
| 24 =>'DSM CC NPT endpoint', | ||
| 25 =>'DSM CC stream mode', | ||
| 26 =>'DSM CC stream event', | ||
| 27 =>'Video stream header parameters for ISO/IEC 14496-2 (MPEG-4 H.263 based)', | ||
| 28 =>'Audio stream header parameters for ISO/IEC 14496-3 (MPEG-4 LOAS multi-format framed)', | ||
| 29 =>'IOD parameters for ISO/IEC 14496-1', | ||
| 30 =>'SL parameters for ISO/IEC 14496-1', | ||
| 31 =>'FMC parameters for ISO/IEC 14496-1', | ||
| 32 =>'External ES identifier for ISO/IEC 14496-1', | ||
| 33 =>'MuxCode for ISO/IEC 14496-1', | ||
| 34 =>'FMX Buffer Size for ISO/IEC 14496-1', | ||
| 35 =>'Multiplex Buffer for ISO/IEC 14496-1', | ||
| 36 =>'Content labeling for ISO/IEC 14496-1', | ||
| 37 =>'Metadata pointer', | ||
| 38 =>'Metadata', | ||
| 39 =>'Metadata STD', | ||
| 40 =>'Video stream header parameters for ITU-T Rec. H.264 and ISO/IEC 14496-10', | ||
| 41 =>'ISO/IEC 13818-11 IPMP (DRM)', | ||
| 42 =>'Timing and HRD for ITU-T Rec. H.264 and ISO/IEC 14496-10', | ||
| 43 =>'Audio stream header parameters for ISO/IEC 13818-7 ADTS AAC', | ||
| 44 =>'FlexMux Timing for ISO/IEC 14496-1', | ||
| 45 =>'Text stream header parameters for ISO/IEC 14496', | ||
| 46 =>'Audio extension stream header parameters for ISO/IEC 14496-3 (MPEG-4 LOAS multi-format framed)', | ||
| 47 =>'Video auxiliary stream header parameters', | ||
| 48 =>'Video scalable stream header parameters', | ||
| 49 =>'Video multi stream header parameters', | ||
| 50 =>'Video stream header parameters for ITU-T Rec. T.800 and ISO/IEC 15444 (JPEG 2000)', | ||
| 51 =>'Video multi operation point stream header parameters', | ||
| 52 =>'Video stereoscopic (3D) stream header parameters for ITU-T Rec. H.262, ISO/IEC 13818-2 and ISO/IEC 11172-2', | ||
| 53 =>'Program stereoscopic (3D) information', | ||
| 54 =>'Video stereoscopic (3D) information', | ||
| 160 =>'VideoLAN FourCC, video size and codec initialization data', | ||
| ]; | ||
|
|
||
| public static function desc ($tag) { | ||
| return self::TAG[$tag]??'Unknown'; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to put your name on the files you created if you want to