decoder/wavpack: merge duplicate code into Scan()
This commit is contained in:
parent
d4ce6049c9
commit
1245b4a49f
@ -580,6 +580,19 @@ wavpack_filedecode(DecoderClient &client, Path path_fs)
|
||||
wavpack_decode(client, wpc, true);
|
||||
}
|
||||
|
||||
static void
|
||||
Scan(WavpackContext *wpc,TagHandler &handler) noexcept
|
||||
{
|
||||
try {
|
||||
handler.OnAudioFormat(CheckAudioFormat(wpc));
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
const auto duration = GetDuration(wpc);
|
||||
if (!duration.IsNegative())
|
||||
handler.OnDuration(SongTime(duration));
|
||||
}
|
||||
|
||||
/*
|
||||
* Reads metainfo from the specified file.
|
||||
*/
|
||||
@ -598,15 +611,7 @@ wavpack_scan_file(Path path_fs, TagHandler &handler) noexcept
|
||||
WavpackCloseFile(wpc);
|
||||
};
|
||||
|
||||
try {
|
||||
handler.OnAudioFormat(CheckAudioFormat(wpc));
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
const auto duration = GetDuration(wpc);
|
||||
if (!duration.IsNegative())
|
||||
handler.OnDuration(SongTime(duration));
|
||||
|
||||
Scan(wpc, handler);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -627,15 +632,7 @@ wavpack_scan_stream(InputStream &is, TagHandler &handler) noexcept
|
||||
WavpackCloseFile(wpc);
|
||||
};
|
||||
|
||||
try {
|
||||
handler.OnAudioFormat(CheckAudioFormat(wpc));
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
const auto duration = GetDuration(wpc);
|
||||
if (!duration.IsNegative())
|
||||
handler.OnDuration(SongTime(duration));
|
||||
|
||||
Scan(wpc, handler);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user