Create a parser that interprets parsing events and produces a manifest object. Get all the tests working. Comment a few manifest controller tests out because the interface of that object needs to be updated to use the new parser.
Regexes and tests for m3u8 tags that are likely to be relevant to playback. High-level m3u8 tests are still failing because their is still no "interpretation" of the incoming parse stream.
Split parsing into tokenization and a very liberal parser. After this, an "interpreter" needs to be created to build an object representation of the manifest based on the events emitted by the parser. Higher-level manifest tests are broken until that interpreter is written.
Add the peg parser generation step to the gruntfile. Include the generated parser in the test harness page. Update many of the m3u8 tests to work with the new parser. There are a number of tests still failing. I believe this is because parts of the grammar are not sufficiently flexible to handle some optional parameters. For instance, #EXT-X-BYTE-RANGE is being glommed incorrectly into the #EXTINF definition and that's throwing off parsing. This commit is a progress checkpoint; things are definitely not working correctly.
Rename mediaFile to mediaURL in segment and rendition
Rename byteRange into byterange and default it to -1 in segment
Rename duration to targetDuration in segment
Generate the parser file via 'npm run peg'.
There is a simple test script in test/pegtest.js.
The test can be run via 'npm run testpeg' which will generate a new copy
of the parser and then run the test file.
The difference isn't particularly significant but we can get away with a couple fewer shifts when parsing TS packets. Also, avoid an additional branch by default the dts value to the calculated pts.
Drop the extra null byte when closing an "ecmascript array" in the metadata tag. The spec specifies a 3 byte tag and I'm not sure how the 4-byte version managed to work in practice. This makes the output differ significantly from the original actionscript version of the code but the converted video still plays back without any issues.
Forgot that time was being measured in ms so the throughput values were off by 1000. Changed reporting unit to MB/s and fixed the precision to 3 digits so it's not overwhelming.
Check whether the byte buffer is large enough before performing a write and allocate a larger buffer if necessary. Do less byte-by-byte ops when writing metadata double tags since they were a significant portion of parse computation when testing on my laptop.
Created a page that runs the segment parser repeatedly on the bunnies test segment. Initial testing indicates garbage parseTSPacket and garbage collection take up about a quarter of the parse run.