aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-11-11 17:20:27 +0100
committerMax Kellermann <max@duempel.org>2015-11-11 19:56:08 +0100
commitfaca8bc02a67ed06e60a4d827d5d7bb69027b4f3 (patch)
tree7ee84be6f74ed503dfa9468487026a121b6891ee
parent5e93c05095eff2385f02fa946fdb2e97353b1843 (diff)
downloadmpd-faca8bc02a67ed06e60a4d827d5d7bb69027b4f3.tar.gz
mpd-faca8bc02a67ed06e60a4d827d5d7bb69027b4f3.tar.xz
mpd-faca8bc02a67ed06e60a4d827d5d7bb69027b4f3.zip
decoder/Control: Seek() returns Error information
Diffstat (limited to '')
-rw-r--r--src/decoder/DecoderControl.cxx17
-rw-r--r--src/decoder/DecoderControl.hxx2
-rw-r--r--src/player/Thread.cxx4
3 files changed, 18 insertions, 5 deletions
diff --git a/src/decoder/DecoderControl.cxx b/src/decoder/DecoderControl.cxx
index c41165d1e..fc3ab7ad8 100644
--- a/src/decoder/DecoderControl.cxx
+++ b/src/decoder/DecoderControl.cxx
@@ -19,6 +19,7 @@
#include "config.h"
#include "DecoderControl.hxx"
+#include "DecoderError.hxx"
#include "MusicPipe.hxx"
#include "DetachedSong.hxx"
@@ -105,7 +106,7 @@ DecoderControl::Stop()
}
bool
-DecoderControl::Seek(SongTime t)
+DecoderControl::Seek(SongTime t, Error &error_r)
{
assert(state != DecoderState::START);
assert(state != DecoderState::ERROR);
@@ -116,20 +117,30 @@ DecoderControl::Seek(SongTime t)
gcc_unreachable();
case DecoderState::STOP:
+ /* TODO: if this happens, the caller should be given a
+ chance to restart the decoder */
+ error_r.Set(decoder_domain, "Decoder is dead");
return false;
case DecoderState::DECODE:
break;
}
- if (!seekable)
+ if (!seekable) {
+ error_r.Set(decoder_domain, "Not seekable");
return false;
+ }
seek_time = t;
seek_error = false;
LockSynchronousCommand(DecoderCommand::SEEK);
- return !seek_error;
+ if (seek_error) {
+ error_r.Set(decoder_domain, "Decoder failed to seek");
+ return false;
+ }
+
+ return true;
}
void
diff --git a/src/decoder/DecoderControl.hxx b/src/decoder/DecoderControl.hxx
index a8e675bba..4147f5acc 100644
--- a/src/decoder/DecoderControl.hxx
+++ b/src/decoder/DecoderControl.hxx
@@ -365,7 +365,7 @@ public:
void Stop();
- bool Seek(SongTime t);
+ bool Seek(SongTime t, Error &error_r);
void Quit();
diff --git a/src/player/Thread.cxx b/src/player/Thread.cxx
index 9a5732ada..20ffcb069 100644
--- a/src/player/Thread.cxx
+++ b/src/player/Thread.cxx
@@ -605,8 +605,10 @@ Player::SeekDecoder()
where = total_time;
}
- if (!dc.Seek(where + start_time)) {
+ Error error;
+ if (!dc.Seek(where + start_time, error)) {
/* decoder failure */
+ pc.SetError(PlayerError::DECODER, std::move(error));
pc.LockCommandFinished();
return false;
}