decoder/Client: add virtual method Ready()

Replaces decoder_initialized().
This commit is contained in:
Max Kellermann
2016-11-18 07:59:01 +01:00
parent fd77acc217
commit 66fb352cca
28 changed files with 73 additions and 79 deletions

View File

@@ -38,21 +38,18 @@
#include <math.h>
void
decoder_initialized(DecoderClient &client,
const AudioFormat audio_format,
bool seekable, SignedSongTime duration)
Decoder::Ready(const AudioFormat audio_format,
bool seekable, SignedSongTime duration)
{
auto &decoder = (Decoder &)client;
DecoderControl &dc = decoder.dc;
struct audio_format_string af_string;
assert(dc.state == DecoderState::START);
assert(dc.pipe != nullptr);
assert(dc.pipe->IsEmpty());
assert(decoder.convert == nullptr);
assert(decoder.stream_tag == nullptr);
assert(decoder.decoder_tag == nullptr);
assert(!decoder.seeking);
assert(convert == nullptr);
assert(stream_tag == nullptr);
assert(decoder_tag == nullptr);
assert(!seeking);
assert(audio_format.IsDefined());
assert(audio_format.IsValid());
@@ -71,13 +68,13 @@ decoder_initialized(DecoderClient &client,
audio_format_to_string(dc.out_audio_format,
&af_string));
decoder.convert = new PcmConvert();
convert = new PcmConvert();
try {
decoder.convert->Open(dc.in_audio_format,
convert->Open(dc.in_audio_format,
dc.out_audio_format);
} catch (...) {
decoder.error = std::current_exception();
error = std::current_exception();
}
}