You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request][MP4] Support for arbitrary atom access #1245
It would be great if taglib could allow accessing MP4 atoms directly, including fetching, adding, updating and deleting.
I currently reused some of the private implementation of the library to do so as part of personal project, but if you would be interested, I'd like to make that part of the TagLib public library. This would help the Mixxx project to edit NI Stem track metadata
I appreciate this would expose quite a bit of the private library as I have currently implemented, so I'd be happy to rework that to some extend to make it manageable over time in the API.
This sounds interesting. TagLib already has some extension points, the TagLib::MP4::ItemFactory if you simply want to support additional atoms inside moov.udta.meta.ilst. Your use case goes beyond this, so there would be the possibility to extend TagLib::File::MP4 (and the dependencies like the corresponding Tag as needed) and register it with TagLib::FileRef::addFileTypeResolver(). This enhanced MP4 resolver would then be used in your application instead of the default implementation. If this is not possible or involves copying or duplicating a lot of code from TagLib because it is not accessible, a pull request fixing that would be welcome. Note, however, that binary compatibility (see e.g. Policies/Binary Compatibility Issues With C++ must be preserved.
Hi @ufleisch, coming back to this some time after my initial enquiries...
Here was the minimal changes I had to do in order to render STEM atoms as part of the MP4. This is a change I currently use, tho this is obviously breaking the current metadata rendering.
Trying to refactor those changes into something that would ensure the binary compatibility policy, I believe this could be an acceptable path, allowing minimal changes, while allowing UDTA atom customisation:
What do we do with TagLib::MP4::Tag::save? Currently we could keep it as it, but ideally we would want to make it virtual to allow polymorphism, but AFAICT, this could break compatibly.
We need to find atom (referenced as findAtomByPath in the snippet above). I'm thinking about adding a protected method, that would proxy d->atoms->path. Does that sound like a viable option?
It would be good to hear your thoughts here, before I potentially formulate these into a change request
Sorry for not answering earlier. I do not know anything about STEM, so I am probably not a great help here. Concerning TagLib::MP4::Tag::save(), making it virtual would probably break binary compatibility on Windows. But it is apparently only called from MP4::File::save(), which is virtual, so you could add a new non-virtual method to MP4::Tag and reimplement MP4::File overriding save() and using the reimplemented MP4::Tag class. Exposing d->atoms->path() should be possible.
I just had a short look into your fork. Exposing new functionality in the C bindings with complex properties is the correct thing to do.
Great to hear! And thank for taking the time to look into this.
For full disclosure, I am now using this on my project via this adapted rust binding (some more changes to be done before a formal release with license changes).
Let me know if you would like me to stabilise this and submit a PR against TagLib to ad NI Stem support directly onto TagLib!
Activity
ufleisch commentedon Oct 18, 2024
This sounds interesting. TagLib already has some extension points, the
TagLib::MP4::ItemFactoryif you simply want to support additional atoms insidemoov.udta.meta.ilst. Your use case goes beyond this, so there would be the possibility to extendTagLib::File::MP4(and the dependencies like the correspondingTagas needed) and register it withTagLib::FileRef::addFileTypeResolver(). This enhanced MP4 resolver would then be used in your application instead of the default implementation. If this is not possible or involves copying or duplicating a lot of code from TagLib because it is not accessible, a pull request fixing that would be welcome. Note, however, that binary compatibility (see e.g. Policies/Binary Compatibility Issues With C++ must be preserved.acolombier commentedon Aug 27, 2025
Hi @ufleisch, coming back to this some time after my initial enquiries...
Here was the minimal changes I had to do in order to render STEM atoms as part of the MP4. This is a change I currently use, tho this is obviously breaking the current metadata rendering.
Trying to refactor those changes into something that would ensure the binary compatibility policy, I believe this could be an acceptable path, allowing minimal changes, while allowing UDTA atom customisation:
This way, one could for example support the NI STEM like so:
Couple of things remaining to sort are:
TagLib::MP4::Tag::save? Currently we could keep it as it, but ideally we would want to make it virtual to allow polymorphism, but AFAICT, this could break compatibly.findAtomByPathin the snippet above). I'm thinking about adding a protected method, that would proxyd->atoms->path. Does that sound like a viable option?It would be good to hear your thoughts here, before I potentially formulate these into a change request
acolombier commentedon Aug 30, 2025
FYI, I am working on an alternative to add first class support to STEM directly within TagLib.
The reason for this change in direction is the desire to use this in the Rust wrapper, that only support the C TagLib.
Appreciate this may not be a direction you would like to take tho so I have keep the PR on my repo so far.
ufleisch commentedon Sep 1, 2025
Sorry for not answering earlier. I do not know anything about STEM, so I am probably not a great help here. Concerning
TagLib::MP4::Tag::save(), making it virtual would probably break binary compatibility on Windows. But it is apparently only called fromMP4::File::save(), which is virtual, so you could add a new non-virtual method toMP4::Tagand reimplementMP4::Fileoverridingsave()and using the reimplementedMP4::Tagclass. Exposingd->atoms->path()should be possible.I just had a short look into your fork. Exposing new functionality in the C bindings with complex properties is the correct thing to do.
acolombier commentedon Sep 3, 2025
Great to hear! And thank for taking the time to look into this.
For full disclosure, I am now using this on my project via this adapted rust binding (some more changes to be done before a formal release with license changes).
Let me know if you would like me to stabilise this and submit a PR against TagLib to ad NI Stem support directly onto TagLib!