Added parsing of binary data for section_number and last_section_number for PAT and PMT packets
Showing
1 changed file
with
17 additions
and
2 deletions
... | @@ -104,6 +104,9 @@ ParseStream = function() { | ... | @@ -104,6 +104,9 @@ ParseStream = function() { |
104 | }; | 104 | }; |
105 | 105 | ||
106 | parsePat = function(payload, pat) { | 106 | parsePat = function(payload, pat) { |
107 | pat.section_number = payload[7]; | ||
108 | pat.last_section_number = payload[8]; | ||
109 | |||
107 | // skip the PSI header and parse the first PMT entry | 110 | // skip the PSI header and parse the first PMT entry |
108 | self.pmtPid = (payload[10] & 0x1F) << 8 | payload[11]; | 111 | self.pmtPid = (payload[10] & 0x1F) << 8 | payload[11]; |
109 | pat.pmtPid = self.pmtPid; | 112 | pat.pmtPid = self.pmtPid; |
... | @@ -120,6 +123,9 @@ ParseStream = function() { | ... | @@ -120,6 +123,9 @@ ParseStream = function() { |
120 | parsePmt = function(payload, pmt) { | 123 | parsePmt = function(payload, pmt) { |
121 | var tableEnd, programInfoLength, offset; | 124 | var tableEnd, programInfoLength, offset; |
122 | 125 | ||
126 | pmt.section_number = payload[6]; | ||
127 | pmt.last_section_number = payload[7]; | ||
128 | |||
123 | // PMTs can be sent ahead of the time when they should actually | 129 | // PMTs can be sent ahead of the time when they should actually |
124 | // take effect. We don't believe this should ever be the case | 130 | // take effect. We don't believe this should ever be the case |
125 | // for HLS but we'll ignore "forward" PMT declarations if we see | 131 | // for HLS but we'll ignore "forward" PMT declarations if we see |
... | @@ -154,9 +160,14 @@ ParseStream = function() { | ... | @@ -154,9 +160,14 @@ ParseStream = function() { |
154 | }; | 160 | }; |
155 | 161 | ||
156 | parsePes = function(payload, pes) { | 162 | parsePes = function(payload, pes) { |
157 | var dataAlignmentIndicator, ptsDtsFlags; | 163 | var ptsDtsFlags, |
164 | pesLength; | ||
165 | |||
166 | // PES packet length | ||
167 | pesLength = payload[4] << 8 | payload[5]; | ||
168 | |||
158 | // find out if this packets starts a new keyframe | 169 | // find out if this packets starts a new keyframe |
159 | dataAlignmentIndicator = (payload[6] & 0x04) !== 0; | 170 | pes.dataAlignmentIndicator = (payload[6] & 0x04) !== 0; |
160 | // PES packets may be annotated with a PTS value, or a PTS value | 171 | // PES packets may be annotated with a PTS value, or a PTS value |
161 | // and a DTS value. Determine what combination of values is | 172 | // and a DTS value. Determine what combination of values is |
162 | // available to work with. | 173 | // available to work with. |
... | @@ -238,6 +249,10 @@ ParseStream = function() { | ... | @@ -238,6 +249,10 @@ ParseStream = function() { |
238 | }; | 249 | }; |
239 | }; | 250 | }; |
240 | ParseStream.prototype = new videojs.Hls.Stream(); | 251 | ParseStream.prototype = new videojs.Hls.Stream(); |
252 | ParseStream.STREAM_TYPES = { | ||
253 | h264: 0x1b, | ||
254 | adts: 0x0f | ||
255 | }; | ||
241 | 256 | ||
242 | window.videojs.mp2t = { | 257 | window.videojs.mp2t = { |
243 | PAT_PID: 0x0000, | 258 | PAT_PID: 0x0000, | ... | ... |
-
Please register or sign in to post a comment