Skip to content

Commit

Permalink
0.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
birme committed Feb 16, 2017
1 parent 23fb8bb commit 04f8ef1
Show file tree
Hide file tree
Showing 16 changed files with 342 additions and 103 deletions.
112 changes: 79 additions & 33 deletions dist/hls-ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,33 +336,66 @@ var BYTE_STATE = {
};

var NAL_UNIT_TYPE = {
0: "unspecified",
1: "slice_layer_without_partitioning_rbsp()",
2: "slice_data_partition_a_layer_rbsp()",
3: "slice_data_partition_b_layer_rbsp()",
4: "slice_data_partition_c_layer_rbsp()",
5: "slice_layer_without_partitioning_rbsp()",
6: "sei_rbsp()",
7: "seq_parameter_set_rbsp()",
8: "pic_parameter_set_rbsp()",
9: "access_unit_delimiter_rbsp()",
10: "end_of_seq_rbsp( )",
11: "end_of_stream_rbsp( )",
12: "filler_data_rbsp()",
13: "seq_parameter_set_extension_rbsp()",
14: "prefix_nal_unit_rbsp()",
15: "subset_seq_parameter_set_rbsp()",
16: "reserved",
17: "reserved",
18: "reserved",
19: "slice_layer_without_partitioning_rbsp()",
20: "slice_layer_extension_rbsp()",
21: "slice_layer_extension_rbsp() annex I",
22: "reserved",
23: "reserved",
24: "unspecified",
28: "unspecified",
29: "unspecified"
0: "Unspecified",
1: "Coded slice of a non-IDR picture",
2: "Coded slice data partition A",
3: "Coded slice data partition B",
4: "Coded slice data partition C",
5: "Coded slice of an IDR picture",
6: "Supplemental enhancement information (SEI)",
7: "Sequence parameter set",
8: "Picture parameter set",
9: "Access unit delimiter",
10: "End of sequence",
11: "End of stream",
12: "Filler data",
13: "Sequence parameter set extension",
14: "Prefix NAL unit",
15: "Subset sequence parameter set",
16: "Depth parameter set",
17: "Reserved",
18: "Reserved",
19: "Coded slice of an auxiliary coded picture without partitioning",
20: "Coded slice extension",
21: "Coded slice extension for depth view components",
22: "Reserved",
23: "Reserved",
24: "Unspecified",
28: "Unspecified",
29: "Unspecified"
};

var NAL_UNIT_CATEGORY = {
0: "non-VCL",
1: "VCL",
2: "VCL",
3: "VCL",
4: "VCL",
5: "VCL",
6: "non-VCL",
7: "non-VCL",
8: "non-VCL",
9: "non-VCL",
10: "non-VCL",
11: "non-VCL",
12: "non-VCL",
13: "non-VCL",
14: "non-VCL",
15: "non-VCL",
16: "non-VCL",
17: "non-VCL",
18: "non-VCL",
19: "non-VCL",
20: "non-VCL",
21: "non-VCL",
22: "non-VCL",
23: "non-VCL",
24: "non-VCL",
25: "non-VCL",
26: "non-VCL",
27: "non-VCL",
28: "non-VCL",
29: "non-VCL"
};

var NALUnit = function constructor() {
Expand Down Expand Up @@ -406,6 +439,19 @@ var PESAVCParser = function (_PESParser) {
return NAL_UNIT_TYPE[type];
}

/**
* Translates a Nal Unit type value to a Nal Unit category
*
* @param {number} type Nal Unit Type
* @return {string}
*/

}, {
key: "nalUnitCategory",
value: function nalUnitCategory(type) {
return NAL_UNIT_CATEGORY[type];
}

/**
* Get all Nal Units in this data stream
*
Expand All @@ -423,11 +469,12 @@ var PESAVCParser = function (_PESParser) {
var unitType = void 0;
var unitStartPos = -1;

//console.log(util.hexDump(data.slice(0, 100)));
//log.debug(util.hexDump(data));

var byte = void 0;
while (pos < len) {
byte = data[pos++];
//log.debug(`pos=${pos}, byte:`, util.toHex(byte));
if (state === BYTE_STATE["0-7"]) {
state = byte ? BYTE_STATE["0-7"] : BYTE_STATE["8-15"];
continue;
Expand All @@ -440,19 +487,18 @@ var PESAVCParser = function (_PESParser) {
if (byte === 0) {
state = BYTE_STATE["24-31"];
} else if (byte === NAL_START_PREFIX) {
//log.debug(`Start Prefix at ${pos} unitStartPos=${unitStartPos}`);
if (unitStartPos >= 0) {
var unit = new NALUnit();
unit.data = data.subarray(unitStartPos, pos - state - 1);
unit.type = unitType;
unit.offset = unitStartPos - state - 1;
unit.pes = this.getHeaderForByteOffset(unit.offset);
units.push(unit);
unitStartPos = -1;
} else {
unitType = data[pos] & 0x1f;
unitStartPos = pos;
//log.debug(`NAL Type:${NAL_UNIT_TYPE[unitType]} (${unitStartPos})`);
log.debug("NAL Type:" + NAL_UNIT_TYPE[unitType] + " (" + unitStartPos + ")");
}
unitType = data[pos] & 0x1f;
unitStartPos = pos;
} else {
state = BYTE_STATE["0-7"];
}
Expand Down
8 changes: 4 additions & 4 deletions dist/hls-ts.min.js

Large diffs are not rendered by default.

159 changes: 154 additions & 5 deletions docs/PESAVCParser.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<label for="nav-trigger" class="overlay"></label>

<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ParseStream.html">ParseStream</a></li><li><a href="PESAVCParser.html">PESAVCParser</a><ul class='methods'><li data-type='method'><a href="PESAVCParser.html#getData">getData</a></li><li data-type='method'><a href="PESAVCParser.html#getHeaderForByteOffset">getHeaderForByteOffset</a></li><li data-type='method'><a href="PESAVCParser.html#getHeaders">getHeaders</a></li><li data-type='method'><a href="PESAVCParser.html#getId">getId</a></li><li data-type='method'><a href="PESAVCParser.html#getNalUnits">getNalUnits</a></li><li data-type='method'><a href="PESAVCParser.html#nalUnitType">nalUnitType</a></li></ul></li><li><a href="PESParser.html">PESParser</a><ul class='methods'><li data-type='method'><a href="PESParser.html#getData">getData</a></li><li data-type='method'><a href="PESParser.html#getHeaderForByteOffset">getHeaderForByteOffset</a></li><li data-type='method'><a href="PESParser.html#getHeaders">getHeaders</a></li><li data-type='method'><a href="PESParser.html#getId">getId</a></li></ul></li><li><a href="window.HlsTs.html">HlsTs</a><ul class='methods'><li data-type='method'><a href="window.HlsTs.html#createAvcParser">createAvcParser</a></li><li data-type='method'><a href="window.HlsTs.html#getDataStreamByProgramType">getDataStreamByProgramType</a></li><li data-type='method'><a href="window.HlsTs.html#getPacketsByProgramType">getPacketsByProgramType</a></li><li data-type='method'><a href="window.HlsTs.html#getPrograms">getPrograms</a></li><li data-type='method'><a href="window.HlsTs.html#parse">parse</a></li></ul></li></ul><h3>Modules</h3><ul><li><a href="module-HlsTs.html">HlsTs</a><ul class='methods'><li data-type='method'><a href="module-HlsTs.html#~createAvcParser">createAvcParser</a></li><li data-type='method'><a href="module-HlsTs.html#~getDataStreamByProgramType">getDataStreamByProgramType</a></li><li data-type='method'><a href="module-HlsTs.html#~getPacketsByProgramType">getPacketsByProgramType</a></li><li data-type='method'><a href="module-HlsTs.html#~parse">parse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ParseStream.html">ParseStream</a></li><li><a href="PESAVCParser.html">PESAVCParser</a><ul class='methods'><li data-type='method'><a href="PESAVCParser.html#getData">getData</a></li><li data-type='method'><a href="PESAVCParser.html#getHeaderForByteOffset">getHeaderForByteOffset</a></li><li data-type='method'><a href="PESAVCParser.html#getHeaders">getHeaders</a></li><li data-type='method'><a href="PESAVCParser.html#getId">getId</a></li><li data-type='method'><a href="PESAVCParser.html#getNalUnits">getNalUnits</a></li><li data-type='method'><a href="PESAVCParser.html#nalUnitCategory">nalUnitCategory</a></li><li data-type='method'><a href="PESAVCParser.html#nalUnitType">nalUnitType</a></li></ul></li><li><a href="PESParser.html">PESParser</a><ul class='methods'><li data-type='method'><a href="PESParser.html#getData">getData</a></li><li data-type='method'><a href="PESParser.html#getHeaderForByteOffset">getHeaderForByteOffset</a></li><li data-type='method'><a href="PESParser.html#getHeaders">getHeaders</a></li><li data-type='method'><a href="PESParser.html#getId">getId</a></li></ul></li><li><a href="window.HlsTs.html">HlsTs</a><ul class='methods'><li data-type='method'><a href="window.HlsTs.html#createAvcParser">createAvcParser</a></li><li data-type='method'><a href="window.HlsTs.html#getDataStreamByProgramType">getDataStreamByProgramType</a></li><li data-type='method'><a href="window.HlsTs.html#getPacketsByProgramType">getPacketsByProgramType</a></li><li data-type='method'><a href="window.HlsTs.html#getPrograms">getPrograms</a></li><li data-type='method'><a href="window.HlsTs.html#parse">parse</a></li></ul></li></ul><h3>Modules</h3><ul><li><a href="module-HlsTs.html">HlsTs</a><ul class='methods'><li data-type='method'><a href="module-HlsTs.html#~createAvcParser">createAvcParser</a></li><li data-type='method'><a href="module-HlsTs.html#~getDataStreamByProgramType">getDataStreamByProgramType</a></li><li data-type='method'><a href="module-HlsTs.html#~getPacketsByProgramType">getPacketsByProgramType</a></li><li data-type='method'><a href="module-HlsTs.html#~parse">parse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3>
</nav>

<div id="main">
Expand Down Expand Up @@ -150,7 +150,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_pes_pes_avc_parser.js.html">lib/pes/pes_avc_parser.js</a>, <a href="lib_pes_pes_avc_parser.js.html#line61">line 61</a>
<a href="lib_pes_pes_avc_parser.js.html">lib/pes/pes_avc_parser.js</a>, <a href="lib_pes_pes_avc_parser.js.html#line94">line 94</a>
</li></ul></dd>


Expand Down Expand Up @@ -738,7 +738,7 @@ <h4 class="name" id="getNalUnits"><span class="type-signature"></span>getNalUnit

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_pes_pes_avc_parser.js.html">lib/pes/pes_avc_parser.js</a>, <a href="lib_pes_pes_avc_parser.js.html#line85">line 85</a>
<a href="lib_pes_pes_avc_parser.js.html">lib/pes/pes_avc_parser.js</a>, <a href="lib_pes_pes_avc_parser.js.html#line128">line 128</a>
</li></ul></dd>


Expand Down Expand Up @@ -787,6 +787,155 @@ <h5>Returns:</h5>



<h4 class="name" id="nalUnitCategory"><span class="type-signature"></span>nalUnitCategory<span class="signature">(type)</span><span class="type-signature"> &rarr; {string}</span></h4>





<div class="description">
Translates a Nal Unit type value to a Nal Unit category
</div>









<h5>Parameters:</h5>


<table class="params">
<thead>
<tr>

<th>Name</th>


<th>Type</th>





<th class="last">Description</th>
</tr>
</thead>

<tbody>


<tr>

<td class="name"><code>type</code></td>


<td class="type">


<span class="param-type">number</span>



</td>





<td class="description last">Nal Unit Type</td>
</tr>


</tbody>
</table>






<dl class="details">


























<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_pes_pes_avc_parser.js.html">lib/pes/pes_avc_parser.js</a>, <a href="lib_pes_pes_avc_parser.js.html#line119">line 119</a>
</li></ul></dd>







</dl>













<h5>Returns:</h5>




<dl class="param-type">
<dt>
Type
</dt>
<dd>

<span class="param-type">string</span>


</dd>
</dl>










<h4 class="name" id="nalUnitType"><span class="type-signature"></span>nalUnitType<span class="signature">(type)</span><span class="type-signature"> &rarr; {string}</span></h4>


Expand Down Expand Up @@ -887,7 +1036,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_pes_pes_avc_parser.js.html">lib/pes/pes_avc_parser.js</a>, <a href="lib_pes_pes_avc_parser.js.html#line76">line 76</a>
<a href="lib_pes_pes_avc_parser.js.html">lib/pes/pes_avc_parser.js</a>, <a href="lib_pes_pes_avc_parser.js.html#line109">line 109</a>
</li></ul></dd>


Expand Down Expand Up @@ -949,7 +1098,7 @@ <h5>Returns:</h5>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Feb 13 2017 20:10:09 GMT+0100 (CET) using the Minami theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Thu Feb 16 2017 22:25:44 GMT+0100 (CET) using the Minami theme.
</footer>

<script>prettyPrint();</script>
Expand Down
4 changes: 2 additions & 2 deletions docs/PESParser.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<label for="nav-trigger" class="overlay"></label>

<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ParseStream.html">ParseStream</a></li><li><a href="PESAVCParser.html">PESAVCParser</a><ul class='methods'><li data-type='method'><a href="PESAVCParser.html#getData">getData</a></li><li data-type='method'><a href="PESAVCParser.html#getHeaderForByteOffset">getHeaderForByteOffset</a></li><li data-type='method'><a href="PESAVCParser.html#getHeaders">getHeaders</a></li><li data-type='method'><a href="PESAVCParser.html#getId">getId</a></li><li data-type='method'><a href="PESAVCParser.html#getNalUnits">getNalUnits</a></li><li data-type='method'><a href="PESAVCParser.html#nalUnitType">nalUnitType</a></li></ul></li><li><a href="PESParser.html">PESParser</a><ul class='methods'><li data-type='method'><a href="PESParser.html#getData">getData</a></li><li data-type='method'><a href="PESParser.html#getHeaderForByteOffset">getHeaderForByteOffset</a></li><li data-type='method'><a href="PESParser.html#getHeaders">getHeaders</a></li><li data-type='method'><a href="PESParser.html#getId">getId</a></li></ul></li><li><a href="window.HlsTs.html">HlsTs</a><ul class='methods'><li data-type='method'><a href="window.HlsTs.html#createAvcParser">createAvcParser</a></li><li data-type='method'><a href="window.HlsTs.html#getDataStreamByProgramType">getDataStreamByProgramType</a></li><li data-type='method'><a href="window.HlsTs.html#getPacketsByProgramType">getPacketsByProgramType</a></li><li data-type='method'><a href="window.HlsTs.html#getPrograms">getPrograms</a></li><li data-type='method'><a href="window.HlsTs.html#parse">parse</a></li></ul></li></ul><h3>Modules</h3><ul><li><a href="module-HlsTs.html">HlsTs</a><ul class='methods'><li data-type='method'><a href="module-HlsTs.html#~createAvcParser">createAvcParser</a></li><li data-type='method'><a href="module-HlsTs.html#~getDataStreamByProgramType">getDataStreamByProgramType</a></li><li data-type='method'><a href="module-HlsTs.html#~getPacketsByProgramType">getPacketsByProgramType</a></li><li data-type='method'><a href="module-HlsTs.html#~parse">parse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ParseStream.html">ParseStream</a></li><li><a href="PESAVCParser.html">PESAVCParser</a><ul class='methods'><li data-type='method'><a href="PESAVCParser.html#getData">getData</a></li><li data-type='method'><a href="PESAVCParser.html#getHeaderForByteOffset">getHeaderForByteOffset</a></li><li data-type='method'><a href="PESAVCParser.html#getHeaders">getHeaders</a></li><li data-type='method'><a href="PESAVCParser.html#getId">getId</a></li><li data-type='method'><a href="PESAVCParser.html#getNalUnits">getNalUnits</a></li><li data-type='method'><a href="PESAVCParser.html#nalUnitCategory">nalUnitCategory</a></li><li data-type='method'><a href="PESAVCParser.html#nalUnitType">nalUnitType</a></li></ul></li><li><a href="PESParser.html">PESParser</a><ul class='methods'><li data-type='method'><a href="PESParser.html#getData">getData</a></li><li data-type='method'><a href="PESParser.html#getHeaderForByteOffset">getHeaderForByteOffset</a></li><li data-type='method'><a href="PESParser.html#getHeaders">getHeaders</a></li><li data-type='method'><a href="PESParser.html#getId">getId</a></li></ul></li><li><a href="window.HlsTs.html">HlsTs</a><ul class='methods'><li data-type='method'><a href="window.HlsTs.html#createAvcParser">createAvcParser</a></li><li data-type='method'><a href="window.HlsTs.html#getDataStreamByProgramType">getDataStreamByProgramType</a></li><li data-type='method'><a href="window.HlsTs.html#getPacketsByProgramType">getPacketsByProgramType</a></li><li data-type='method'><a href="window.HlsTs.html#getPrograms">getPrograms</a></li><li data-type='method'><a href="window.HlsTs.html#parse">parse</a></li></ul></li></ul><h3>Modules</h3><ul><li><a href="module-HlsTs.html">HlsTs</a><ul class='methods'><li data-type='method'><a href="module-HlsTs.html#~createAvcParser">createAvcParser</a></li><li data-type='method'><a href="module-HlsTs.html#~getDataStreamByProgramType">getDataStreamByProgramType</a></li><li data-type='method'><a href="module-HlsTs.html#~getPacketsByProgramType">getPacketsByProgramType</a></li><li data-type='method'><a href="module-HlsTs.html#~parse">parse</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3>
</nav>

<div id="main">
Expand Down Expand Up @@ -669,7 +669,7 @@ <h5>Returns:</h5>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Feb 13 2017 20:10:09 GMT+0100 (CET) using the Minami theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Thu Feb 16 2017 22:25:44 GMT+0100 (CET) using the Minami theme.
</footer>

<script>prettyPrint();</script>
Expand Down
Loading

0 comments on commit 04f8ef1

Please sign in to comment.