LibAudio: Use an existing file stream when parsing a FLAC header

Before this change the file stream was generated two times:
one time in the parse_header(), and another time for the whole class
in the constructor.

The previous commit moved the m_stream initialization before
executing the parse_header function, so we can now reuse that here.
This commit is contained in:
Karol Kosek 2021-08-03 11:30:30 +02:00 committed by Andreas Kling
parent 81261bc169
commit e500b39e47
Notes: sideshowbarker 2024-07-19 17:20:35 +09:00

View file

@ -69,13 +69,11 @@ bool FlacLoaderPlugin::sniff()
bool FlacLoaderPlugin::parse_header()
{
Optional<Core::InputFileStream> fis;
bool ok = true;
InputBitStream bit_input = [&]() -> InputBitStream {
if (m_file) {
fis = Core::InputFileStream(*m_file);
return InputBitStream(*fis);
return InputBitStream(m_stream->get<Core::InputFileStream>());
}
return InputBitStream(m_stream->get<InputMemoryStream>());
}();