aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/OpusDecoderPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-08 01:01:40 +0100
committerMax Kellermann <max@duempel.org>2013-01-08 01:08:01 +0100
commit9fb5aad1576920dc17481591e737b74b2f4ab12f (patch)
tree397843fd6ae94588420775ccb697a22fc41a5b28 /src/decoder/OpusDecoderPlugin.cxx
parenta6301d45f4a347e068414e6075be2e5f87eef948 (diff)
downloadmpd-9fb5aad1576920dc17481591e737b74b2f4ab12f.tar.gz
mpd-9fb5aad1576920dc17481591e737b74b2f4ab12f.tar.xz
mpd-9fb5aad1576920dc17481591e737b74b2f4ab12f.zip
decoder/OggUtil: add OggExpectFirstPage() and OggExpectPageIn()
Diffstat (limited to '')
-rw-r--r--src/decoder/OpusDecoderPlugin.cxx11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/decoder/OpusDecoderPlugin.cxx b/src/decoder/OpusDecoderPlugin.cxx
index 27bd702fa..827285775 100644
--- a/src/decoder/OpusDecoderPlugin.cxx
+++ b/src/decoder/OpusDecoderPlugin.cxx
@@ -269,8 +269,8 @@ mpd_opus_scan_stream(struct input_stream *is,
ogg_sync_state oy;
ogg_sync_init(&oy);
- ogg_page page;
- if (!OggExpectPage(oy, page, nullptr, is)) {
+ ogg_stream_state os;
+ if (!OggExpectFirstPage(oy, os, nullptr, is)) {
ogg_sync_clear(&oy);
return false;
}
@@ -280,10 +280,6 @@ mpd_opus_scan_stream(struct input_stream *is,
bool result = false;
- ogg_stream_state os;
- ogg_stream_init(&os, ogg_page_serialno(&page));
- ogg_stream_pagein(&os, &page);
-
ogg_packet packet;
while (true) {
int r = ogg_stream_packetout(&os, &packet);
@@ -296,12 +292,11 @@ mpd_opus_scan_stream(struct input_stream *is,
if (remaining_pages-- == 0)
break;
- if (!OggExpectPage(oy, page, nullptr, is)) {
+ if (!OggExpectPageIn(oy, os, nullptr, is)) {
result = false;
break;
}
- ogg_stream_pagein(&os, &page);
continue;
}