summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2016-05-11 17:57:51 +0200
committerMax Kellermann <max@duempel.org>2016-05-11 17:57:51 +0200
commitfa4178fefa44064b839fef1ba850f0d757ed25b0 (patch)
tree12838becbe96a11c295aa4f7074a6abe51672a2f /src
parent1af59d31b92f9a3d817dde6c026c5ab43d1e9499 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/decoder/plugins/OpusDecoderPlugin.cxx19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/decoder/plugins/OpusDecoderPlugin.cxx b/src/decoder/plugins/OpusDecoderPlugin.cxx
index 027957f31..ab2ec6409 100644
--- a/src/decoder/plugins/OpusDecoderPlugin.cxx
+++ b/src/decoder/plugins/OpusDecoderPlugin.cxx
@@ -95,14 +95,21 @@ 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?
*/
bool IsInitialized() const {
@@ -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();