Function in doc.js called extractTimeAndTickRate might contain a bug that seems like an impediment in development of one of our tools. The line
|
} else if ((m = CLOCK_TIME_FRAMES_RE.exec(str)) !== null) { |
to be precise
The issues we currently face are:
-
parsing begin and end timecodes 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:timeBase parameter'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-timecode does)
Few solutions I might think of (that would not affect the library itself too much):
-
allow passing custom timecode parser to imsc.fromXML function. 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 fromXML something 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-timecode library - worst solution IMHO. I like how you rely on sax parser, yet personally I prefer to have more control over dependencies I include into my codebase
Function in
doc.jscalledextractTimeAndTickRatemight contain a bug that seems like an impediment in development of one of our tools. The lineimscJS/src/main/js/doc.js
Line 1649 in 7716bcc
The issues we currently face are:
parsing
beginandendtimecodes are regexp-basedttp:timeBaseparameter's value (which is not a best practice)timecode parser does not consider SMPTE cases with dropFrame encoding
ttp:dropMode- not necessary to pass each Regex testsmpte-timecodedoes)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 yourselvesimplement 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 streambecome 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