From 9fb5aad1576920dc17481591e737b74b2f4ab12f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 8 Jan 2013 01:01:40 +0100 Subject: decoder/OggUtil: add OggExpectFirstPage() and OggExpectPageIn() --- src/decoder/OpusDecoderPlugin.cxx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/decoder/OpusDecoderPlugin.cxx') 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; } -- cgit v1.2.3