-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Function in doc.js called extractTimeAndTickRate might contain a bug that seems like an impediment in development of one of our tools. The line
Line 1649 in 7716bcc
| } else if ((m = CLOCK_TIME_FRAMES_RE.exec(str)) !== null) { |
The issues we currently face are:
-
parsing
beginandendtimecodes are regexp-based- it is cool and nice approach for resilient timecode picker, yet proved to not cover corner-cases (nonDropFrame encoding, etc.)
- it ignores
ttp:timeBaseparameter's value (which is not a best practice)
-
timecode parser does not consider SMPTE cases with dropFrame encoding
- it ignores attribute
ttp:dropMode- not necessary to pass each Regex test - it does not cover Drop-Frame encoded timecodes (like library
smpte-timecodedoes)
- it ignores attribute
Few solutions I might think of (that would not affect the library itself too much):
-
allow passing custom timecode parser to
imsc.fromXMLfunction. Implementing Dependency Injection here is a nice way to get rid of multiple edge cases you would not want to cover and maintain by yourselves -
implement standard-compliant parser that will cover all cases (Drop/Non-Drop Frame encoding, 2:3 pull-down on 23.976, etc.) - includes lot of effort implementing and preparing proper tests
-
make
fromXMLsomething more like a declarative pipeline ( where you can provide callbacks that can override parsing process steps - see: https://rxjs.dev/guide/higher-order-observables ) that processes the sax stream -
become dependent on
smpte-timecodelibrary - worst solution IMHO. I like how you rely onsaxparser, yet personally I prefer to have more control over dependencies I include into my codebase