decoder/Client: add DecoderCommand/seek virtual methods

This commit is contained in:
Max Kellermann
2016-11-18 08:15:07 +01:00
parent 66fb352cca
commit 47a0f46ce8
24 changed files with 156 additions and 172 deletions

View File

@@ -152,7 +152,7 @@ mpcdec_decode(DecoderClient &client, InputStream &is)
mpc_demux *demux = mpc_demux_init(&reader);
if (demux == nullptr) {
if (decoder_get_command(client) != DecoderCommand::STOP)
if (client.GetCommand() != DecoderCommand::STOP)
LogWarning(mpcdec_domain,
"Not a valid musepack stream");
return;
@@ -180,16 +180,15 @@ mpcdec_decode(DecoderClient &client, InputStream &is)
DecoderCommand cmd = DecoderCommand::NONE;
do {
if (cmd == DecoderCommand::SEEK) {
mpc_int64_t where =
decoder_seek_where_frame(client);
mpc_int64_t where = client.GetSeekFrame();
bool success;
success = mpc_demux_seek_sample(demux, where)
== MPC_STATUS_OK;
if (success)
decoder_command_finished(client);
client.CommandFinished();
else
decoder_seek_error(client);
client.SeekError();
}
MPC_SAMPLE_FORMAT sample_buffer[MPC_DECODER_BUFFER_LENGTH];