Repository navigation
feat: play .m4b audiobooks with embedded chapters - #74
Merged
BasilSkyWalk merged 2 commits intoNov 11, 2026
Merged
Conversation
Reads the Nero chapter list (moov.udta.chpl) of an .m4b or .m4a file. Chapter titles are not kept. - The scanner and the PC indexer count a file's chapters into the track record's last u16 (up to 255). The library format stays version 3, and a library built earlier reads 0 there. - .m4b is scanned, fingerprinted and decoded like .m4a. - The player loads the chapter starts of a spoken track with chapters (the first 160, as whole-second gaps in 330 bytes) and reports the chapter count and the current chapter. - Now Playing shows "Chapter N of M" in place of the queue place. The Up Next screen becomes the chapter list, and picking a chapter seeks to it. Vol+/- still jump 30 s / 15 s. - A single-file book keeps its chapter in its bookmark, and its shelf row shows "N chapters" or "Chapter N of M". - New string STR_MENU_CHAPTERS, translated in every language. - Tests for the parser, the scanner, the builder, the shelves and both screens; a chaptered fixture; docs.
BasilJoySG
approved these changes
Nov 11, 2026
Regenerates the Polish pack and the tags and two-drive library fixtures.
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
.m4bfiles and the chapters embedded in them (the Nerochplatom, written by m4b-tool, mp4v2 and ffmpeg).
.m4bis scanned, fingerprinted and decoded like.m4a, on the device, in the simulator and intools/library_index.py.u16. At most 255 are counted. 0 means none, unreadable, out of order, or a 64-bit atom size.STR_MENU_CHAPTERS, translated in every language.Vol+/Vol- still jump 30 s / 15 s, and nothing else in the player's behaviour changes. Chapter titles are not read or shown.
Library format
The track record's last
u16was reserved, and it now holdschapters. The format stays version 3. A library built before this change reads 0 there, so books show no chapters until the next rescan.docs/library-format.mdis updated, andtests/fixtures/tags_library.dbandtwo_drives.dbare regenerated.Memory
uint16gaps in whole seconds: 160 chapters in about 330 bytes. A first version with 255uint32starts pushed static RAM over the audit budget by about 600 bytes.Not included
These are listed in
docs/known-issues.md.Tests
New
test_mp4_chapters(parser, damaged and truncated files, failing source, more than 160 chapters, backwards starts), a chaptered fixture (tests/fixtures/tags/chapters.m4b) in the scan, builder and PC indexer comparisons (the reference builder and random library generator carry the field), and tests for the shelves, Now Playing, the chapter list and the language packs.All tests pass in the
devpreset exceptfonts_up_to_date, which fails on my machine for a reason unrelated to this change.Tested on a real device with a chaptered book, on the final build (rebased on 0.11.1, with the reduced chapter table): Now Playing, the chapter list, jumping to a chapter and resuming from the bookmark all work.
