diff options
| author | YP3 Audiobook <noreply@example.invalid> | 2026-11-27 00:51:12 +0000 |
|---|---|---|
| committer | YP3 Audiobook <noreply@example.invalid> | 2026-11-27 00:51:12 +0000 |
| commit | 7a06b5d2d7ac329dc5cba794b019ba185b9b09e2 (patch) | |
| tree | fac537bb029a8532aadec97816292c3074b9e608 /patches/0008-yp3-no-rewind-on-pause-while-a-book-is-still-loading.patch | |
| parent | 4b670f7ac2635de6d6583d603d97f0bcfbec6733 (diff) | |
| download | yp3-audiobook-firmware-7a06b5d2d7ac329dc5cba794b019ba185b9b09e2.tar.gz | |
Release 1.1
- Hold Up/Down to keep changing the volume
- Pulling the SD card powers the player off instead of crashing; with no
card at power-on it says so and turns off
- Long M4B books load without freezing the controls, with a
"Loading book N%" screen
- The Center press that powers the player on no longer pauses the book
as it resumes (which also made it load twice)
- No "Bookmark saved" pause at power-off
- USB disk shows up right away while a book loads (flasher's
"NO USB DISK")
- tests/m4a: host test of the M4B index loader
Diffstat (limited to 'patches/0008-yp3-no-rewind-on-pause-while-a-book-is-still-loading.patch')
| -rw-r--r-- | patches/0008-yp3-no-rewind-on-pause-while-a-book-is-still-loading.patch | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/patches/0008-yp3-no-rewind-on-pause-while-a-book-is-still-loading.patch b/patches/0008-yp3-no-rewind-on-pause-while-a-book-is-still-loading.patch new file mode 100644 index 0000000..e8e8e58 --- /dev/null +++ b/patches/0008-yp3-no-rewind-on-pause-while-a-book-is-still-loading.patch @@ -0,0 +1,70 @@ +From cab74ec7312b907abd750b7ea807b2a4371e6f74 Mon Sep 17 00:00:00 2001 +From: YP3 Audiobook <noreply@example.invalid> +Date: Fri, 27 Nov 2026 00:05:54 +0000 +Subject: [PATCH 08/11] yp3: no rewind-on-pause while a book is still loading + +Booting into a long M4B with Bluetooth headphones connecting sometimes +loaded the book twice. Playback was paused during the load, and the +pause's "rewind duration on pause" (2 s, the audiobook default) seeked +to elapsed - 2 s, clamped to 0. A seek halts the codec, and halted +mid-load it was started again, reading the whole index a second time. + +Rewind on pause now only when there is something to rewind: the track +has played (elapsed > 0) and its index is not being read. + +--- + apps/codec_thread.c | 6 ++++++ + apps/codec_thread.h | 1 + + apps/gui/wps.c | 7 +++++-- + 3 files changed, 12 insertions(+), 2 deletions(-) + +diff --git a/apps/codec_thread.c b/apps/codec_thread.c +index a4f5b39c..fc6eeecf 100644 +--- a/apps/codec_thread.c ++++ b/apps/codec_thread.c +@@ -598,6 +598,12 @@ static void codec_load_progress_callback(int percent) + load_percent = percent >= 100 ? -1 : percent; + } + ++/* A track start is reading its index (load_progress), however briefly */ ++bool codec_loading(void) ++{ ++ return load_percent >= 0; ++} ++ + /* 0-99 while a track start is reading its index and has taken longer than + * half a second (no flash for a short one), else -1 */ + int codec_load_progress(void) +diff --git a/apps/codec_thread.h b/apps/codec_thread.h +index 36749228..6f0776d8 100644 +--- a/apps/codec_thread.h ++++ b/apps/codec_thread.h +@@ -51,6 +51,7 @@ size_t codec_finish_stream(void); + void codec_unload(void); + int codec_loaded(void); + int codec_load_progress(void); ++bool codec_loading(void); + + /* */ + +diff --git a/apps/gui/wps.c b/apps/gui/wps.c +index ebbca5fe..3fd19a0e 100644 +--- a/apps/gui/wps.c ++++ b/apps/gui/wps.c +@@ -140,8 +140,11 @@ void wps_do_action(enum wps_do_action_type action, bool updatewps) + { + audio_pause(); + +- if (global_settings.pause_rewind) { +- unsigned long elapsed = audio_current_track()->elapsed; ++ unsigned long elapsed = audio_current_track()->elapsed; ++ /* Nothing to rewind until the track plays: a seek while a long ++ book still loads restarts the codec, which reads the whole ++ index again (a pause during the load at boot did) */ ++ if (global_settings.pause_rewind && elapsed > 0 && !codec_loading()) { + long newpos = elapsed - (global_settings.pause_rewind * 1000); + + audio_pre_ff_rewind(); +-- +2.56.1 + |
