[prev in list] [next in list] [prev in thread] [next in thread]
List: rockbox-cvs
Subject: Skip Length across tracks
From: rockbox-gerrit-noreply--- via rockbox-cvs <rockbox-cvs () lists ! haxx ! se>
Date: 2023-10-22 12:21:22
Message-ID: 202310221221.39MCLMu21212453 () archos ! rockbox ! org
[Download RAW message or body]
commit 4fb37ecbc692fdbb2e46aeaccf411caf631f9699
Author: roman.artiukhin <bahusdrive@gmail.com>
Date: Sun Mar 26 12:12:52 2023 +0300
Skip Length across tracks
Allows to use Prev button to skip length from the end of previous track.
Can be enabled with:
Settings -> Playback Settings -> Skip Length set to some time interval
and
Settings -> Playback Settings -> Rewind Across Tracks set to Yes
Change-Id: I99f234035a8a5acc9cbfe05ea83971ec5ddc59ea
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index 10c971fcc4..2a595f74e6 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -464,7 +464,21 @@ static void play_hop(int direction)
if (direction > 0)
next_track();
else if (direction < 0)
+ {
+ if (step > 0 && global_settings.rewind_across_tracks && elapsed < \
DEFAULT_SKIP_THRESH && playlist_check(-1)) + {
+ bool audio_paused = (audio_status() & \
AUDIO_STATUS_PAUSE)?true:false; + if (!audio_paused)
+ audio_pause();
+ audio_prev();
+ audio_ff_rewind(-step);
+ if (!audio_paused)
+ audio_resume();
+ return;
+ }
+
prev_track(DEFAULT_SKIP_THRESH);
+ }
return;
}
else if (direction == 1 && step >= remaining)
diff --git a/apps/playback.c b/apps/playback.c
index 9d5a6569ae..18a3bad5b7 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -123,6 +123,9 @@ static enum audio_buffer_state
/** Main state control **/
static bool ff_rw_mode SHAREDBSS_ATTR = false; /* Pre-ff-rewind mode (A,O-) */
+static long seek_on_finish_load_time = 0;
+static int seek_on_finish_load_id3_hid = 0;
+
static enum play_status
{
PLAY_STOPPED = 0,
@@ -1590,8 +1593,16 @@ static bool audio_start_codec(bool auto_skip)
return false;
}
+ bool delayed_seek = false;
+ if (info.id3_hid == seek_on_finish_load_id3_hid)
+ {
+ cur_id3->elapsed = seek_on_finish_load_time;
+ cur_id3->offset = 0;
+ delayed_seek = true;
+ }
+
#ifdef HAVE_TAGCACHE
- bool autoresume_enable = global_settings.autoresume_enable;
+ bool autoresume_enable = !delayed_seek && global_settings.autoresume_enable;
if (autoresume_enable && !(cur_id3->elapsed || cur_id3->offset))
{
@@ -1641,8 +1652,8 @@ static bool audio_start_codec(bool auto_skip)
and back again will cause accumulation of silent rewinds - that's not
our job to track directly nor could it be in any reasonable way
*/
- resume_rewind_adjust_progress(cur_id3, &cur_id3->elapsed,
- &cur_id3->offset);
+ if (!delayed_seek)
+ resume_rewind_adjust_progress(cur_id3, &cur_id3->elapsed, &cur_id3->offset);
/* Update the codec API with the metadata and track info */
id3_write(CODEC_ID3, cur_id3);
@@ -2429,6 +2440,9 @@ static void audio_on_finish_load_track(int id3_hid)
{
audio_handle_track_load_status(LOAD_TRACK_ERR_START_CODEC);
}
+
+ seek_on_finish_load_time = 0;
+ seek_on_finish_load_id3_hid = 0;
}
/* Called when handles other than metadata handles have finished buffering
@@ -3161,6 +3175,12 @@ static void audio_on_ff_rewind(long time)
track_event_flags = TEF_NONE;
+ if (time < 0)
+ {
+ time = id3->length + time;
+ if (time < 0)
+ time = 0;
+ }
/* Send event before clobbering the time if rewinding. */
if (time == 0)
{
@@ -3201,18 +3221,15 @@ static void audio_on_ff_rewind(long time)
/* Track must complete the loading _now_ since a codec and audio
handle are needed in order to do the seek */
bool finish_load = cur_info.audio_hid < 0;
-
- if (finish_load &&
- audio_finish_load_track(&cur_info) != LOAD_TRACK_READY)
+ if (finish_load)
{
- /* Call above should push any load sequence - no need for
- halt_decoding_track here if no skip was pending here because
- there would not be a codec started if no audio handle was yet
- opened */
- break;
+ seek_on_finish_load_time = time;
+ seek_on_finish_load_id3_hid = cur_info.id3_hid;
+ // Wait till playback thread receives finish load track event and seek \
then + return;
}
- if (pending == TRACK_SKIP_AUTO || finish_load)
+ if (pending == TRACK_SKIP_AUTO)
{
if (!bufreadid3(cur_info.id3_hid, ci_id3) ||
!audio_init_codec(&cur_info, ci_id3))
--
rockbox-cvs mailing list
rockbox-cvs@lists.haxx.se
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic