From: Eric Wong <e@80x24.org>
To: dtas-all@nongnu.org
Subject: [RFC] player: "cue prev" reliably hits previous cue breakpoint
Date: Mon, 11 Apr 2016 02:27:43 +0000 [thread overview]
Message-ID: <20160411022743.GA22090@dcvr.yhbt.net> (raw)
Seeking around a track should not be done relative to
a previous seek, but should rather be analogous to the
"tl prev" command to skip around the tracklist.
I'm not sure what drugs I was on when I originally wrote
this original version, but I'm fairly certain this is a
bugfix and not intentional behavior.
---
Thoughts? I'm _pretty_ sure this is the right thing to do;
will think about it for a bit...
lib/dtas/player/client_handler.rb | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/lib/dtas/player/client_handler.rb b/lib/dtas/player/client_handler.rb
index 7b33967..8a15974 100644
--- a/lib/dtas/player/client_handler.rb
+++ b/lib/dtas/player/client_handler.rb
@@ -745,9 +745,9 @@ def __bp_prev_next(io, msg, cur, bp)
return io.emit("INVALID TYPE")
end
fmt = cur.format
+ ds = __current_decoded_samples
case msg[0]
when "next"
- ds = __current_decoded_samples
bp.each do |ci|
next if ci.offset_samples(fmt) < ds
seek_internal(cur, ci.offset)
@@ -756,11 +756,15 @@ def __bp_prev_next(io, msg, cur, bp)
# go to the next (real) track if not found
__current_drop
when "prev"
- os = cur.offset_samples # where we currently started
+ prev = nil
bp.reverse_each do |ci|
- next if ci.offset_samples(fmt) >= os
- seek_internal(cur, ci.offset)
- return io.emit("OK")
+ if prev.nil?
+ next if ci.offset_samples(fmt) >= ds
+ prev = ci
+ else
+ seek_internal(cur, ci.offset)
+ return io.emit("OK")
+ end
end
# offset may be nil/zero if we couldn't find a previous breakpoint
seek_internal(cur, '0')
--
EW
next reply other threads:[~2016-04-11 2:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-11 2:27 Eric Wong [this message]
2016-04-24 2:45 ` [PATCH] player: extra "cue" seeking functionality Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://80x24.org/dtas/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160411022743.GA22090@dcvr.yhbt.net \
--to=e@80x24.org \
--cc=dtas-all@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/dtas.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).