decoder/opus: remove ogg_page parameter from constructor

Initialize the OggStreamState as soon as the first page is seen; no
special code needed in the caller.
This commit is contained in:
Max Kellermann 2016-05-11 17:57:51 +02:00
parent 1af59d31b9
commit fa4178fefa
1 changed files with 11 additions and 8 deletions

View File

@ -95,13 +95,20 @@ class MPDOpusDecoder {
public:
MPDOpusDecoder(Decoder &_decoder,
InputStream &_input_stream,
ogg_page &first_page)
InputStream &_input_stream)
:decoder(_decoder), input_stream(_input_stream),
os(first_page) {}
os(0) {}
~MPDOpusDecoder();
/**
* Has the OggStreamState been initialized with the first
* serial?
*/
bool HasSerial() const {
return os.GetSerialNo() != 0;
}
/**
* Has decoder_initialized() been called yet?
*/
@ -402,11 +409,7 @@ mpd_opus_stream_decode(Decoder &decoder,
DecoderReader reader(decoder, input_stream);
OggSyncState oy(reader);
ogg_page page;
if (!oy.ExpectPage(page))
return;
MPDOpusDecoder d(decoder, input_stream, page);
MPDOpusDecoder d(decoder, input_stream);
while (true) {
auto cmd = d.HandlePackets();