decoder/opus: use class OggStreamState in _scan_stream()

This commit is contained in:
Max Kellermann
2016-05-09 15:28:41 +02:00
parent f80736c3d7
commit f01b991108

View File

@@ -444,10 +444,12 @@ mpd_opus_scan_stream(InputStream &is,
InputStreamReader reader(is); InputStreamReader reader(is);
OggSyncState oy(reader); OggSyncState oy(reader);
ogg_stream_state os; ogg_page first_page;
if (!oy.ExpectFirstPage(os)) if (!oy.ExpectPage(first_page))
return false; return false;
OggStreamState os(first_page);
/* read at most 64 more pages */ /* read at most 64 more pages */
unsigned remaining_pages = 64; unsigned remaining_pages = 64;
@@ -457,7 +459,7 @@ mpd_opus_scan_stream(InputStream &is,
ogg_packet packet; ogg_packet packet;
while (remaining_packets > 0) { while (remaining_packets > 0) {
int r = ogg_stream_packetout(&os, &packet); int r = os.PacketOut(packet);
if (r < 0) { if (r < 0) {
result = false; result = false;
break; break;
@@ -508,8 +510,6 @@ mpd_opus_scan_stream(InputStream &is,
tag_handler_invoke_duration(handler, handler_ctx, duration); tag_handler_invoke_duration(handler, handler_ctx, duration);
} }
ogg_stream_clear(&os);
return result; return result;
} }