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
1 changed files with 5 additions and 5 deletions

View File

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