Serial-ATA / lofty-rs

Audio metadata library
Apache License 2.0
179 stars 34 forks source link

Add another `ItemKey` variant for float BPM values #334

Closed Serial-ATA closed 5 months ago

Serial-ATA commented 5 months ago

Right now, MP4 has its integer and float BPM atoms map to the integer BPM atom:

https://github.com/Serial-ATA/lofty-rs/blob/f4be1e3775e233847f1620fb4295302817f95341/src/tag/item.rs#L280

These are different values, and should not collide with each other. There should be an IntegerBpm and (FloatBpm | PreciseBpm) ItemKey variant.

I do not know yet if other tag formats have a specified float BPM item.

uklotzde commented 5 months ago

I suggest to introduce IntegerBpm for values that are known to be restricted (ID3v2 TBPM, MP4 tmpo). For all values with unknown precision Bpm should be used as before.

Reading is unambiguous, but writing could become challenging.

uklotzde commented 5 months ago

Lofty should not implement any semantics and instead leave it to the client: #335

If the client wants to ensure that at least one of the values is written it needs to set both and implement the desired conversion/rounding.