-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generic chapter representation #249
Comments
@Serial-ATA Here is a good writeup about chapters from the And a rust ID3 chapters implementation: https://docs.rs/chapters/0.4.2/chapters/fn.from_mp3_file.html I had the following thoughts:
|
Hello @sandreas! Just letting you know, this is pretty far out. Currently Lofty does not support chapters in any format (they'll just be exposed as binary items). Support for the individual chapter formats (ID3v2, EBML, Vorbis Comments, and MP4) will have to come before the generic implementation.
So we could read the chapters, and as new ones come into the list, we update the previous chapter's end time with the current one's start time. But...
What would be done in the case of The best solution I can think of would be to make the end time
Do you mean have |
Thank you for this detailed response.
Absolutely. If I could help besides providing resources and links specs, I would. Unfortunately I hardly have any experience in Rust, so my code would probably not have the quality to be ever released :-)
I would consider the total duration as optional but helpful if present. If it is not present, the last chapter would not have a length if it cannot be determined otherwise. You could go
That could be a good decision, but as I said, I'm no rust professional. I leave this up to the experts (e.g. you) - but I would like the idea, that the struct also has kind of a real type + unit / precision. Otherwise it could be milliseconds or nanoseconds. The |
Yeah, that's a better solution. We could simply error if someone tries to write a zero length chapter (if it's a format that even needs an end time).
There's no performance penalty for using Thanks for your input on the issue. Having never used chapters myself (hence the current lack of support), its good to know how they could be represented in a way that is actually useful. |
If you would like to experiment with chapters and are looking for testfiles, atldotnet has some. And tone as an |
Similar to
Picture
, once chapters are supported in ID3v2 (#189), EBML, Vorbis Comments, and MP4, it may be worth creating a generic representation of chapters that can be converted to and from the concrete implementations.Not yet sure if this would be easy (or possible) to accomplish, since there's a pretty big difference in available information between the formats.
The basic idea would be:
This seems to cover the bare minimum required information for chapters in all formats (It could be expanded with additional optional information).
However, with MP4 (at least in one of many chapter formats available) and Vorbis Comments, there is only a name and start time available.
end_time
may need to be optional, making the conversion betweenChapter
and the ID3v2/EBML chapters fallible.The text was updated successfully, but these errors were encountered: