ebu / libadm

Audio Definition Model (ITU-R BS.2076) handling library
https://libadm.readthedocs.io
Apache License 2.0
39 stars 16 forks source link

block duration assignment should set rtimes #183

Open tomjnixon opened 12 months ago

tomjnixon commented 12 months ago

block duration assignment sets duration attributes here:

ttps://github.com/ebu/libadm/blob/9955fbd2941756140b3e4a47c1fdcef7d711e162/src/utilities/block_duration_assignment.cpp#L83C1-L88

If the block has a default rtime, it will still have a duration set, which is invalid.

Thus just needs block.set(block.template get<Rtime>()); added to ensure that rtime is set whenever duration is, and some tests.

Spotted by @davemar-bbc.

tomjnixon commented 9 months ago

This code should also probably fix interpolationLengths, which can also be affected by rounding, an may be broken if the duration is reduced.

This should probably be a separate function, as the name (updateBlockFormatDurations) is quite explicit about what it does.

the equivalent EAR code is:

https://github.com/ebu/ebu_adm_renderer/blob/master/ear/fileio/adm/timing_fixes.py

... but because this doesn't issue warnings and doesn't account for audioObject times, it's a bit simpler.