Commit 3759f298 authored by Max Kellermann's avatar Max Kellermann

decoder/wavpack: move wavpack_scan_file() down

parent bc555593
...@@ -220,34 +220,6 @@ wavpack_decode(DecoderClient &client, WavpackContext *wpc, bool can_seek) ...@@ -220,34 +220,6 @@ wavpack_decode(DecoderClient &client, WavpackContext *wpc, bool can_seek)
} }
/* /*
* Reads metainfo from the specified file.
*/
static bool
wavpack_scan_file(Path path_fs,
const TagHandler &handler, void *handler_ctx)
{
char error[ERRORLEN];
WavpackContext *wpc = WavpackOpenFileInput(path_fs.c_str(), error,
OPEN_DSD_FLAG, 0);
if (wpc == nullptr) {
FormatError(wavpack_domain,
"failed to open WavPack file \"%s\": %s",
path_fs.c_str(), error);
return false;
}
AtScopeExit(wpc) {
WavpackCloseFile(wpc);
};
const auto duration = GetDuration(wpc);
if (!duration.IsNegative())
tag_handler_invoke_duration(handler, handler_ctx, SongTime(duration));
return true;
}
/*
* #InputStream <=> WavpackStreamReader wrapper callbacks * #InputStream <=> WavpackStreamReader wrapper callbacks
*/ */
...@@ -498,6 +470,34 @@ wavpack_filedecode(DecoderClient &client, Path path_fs) ...@@ -498,6 +470,34 @@ wavpack_filedecode(DecoderClient &client, Path path_fs)
wavpack_decode(client, wpc, true); wavpack_decode(client, wpc, true);
} }
/*
* Reads metainfo from the specified file.
*/
static bool
wavpack_scan_file(Path path_fs,
const TagHandler &handler, void *handler_ctx)
{
char error[ERRORLEN];
WavpackContext *wpc = WavpackOpenFileInput(path_fs.c_str(), error,
OPEN_DSD_FLAG, 0);
if (wpc == nullptr) {
FormatError(wavpack_domain,
"failed to open WavPack file \"%s\": %s",
path_fs.c_str(), error);
return false;
}
AtScopeExit(wpc) {
WavpackCloseFile(wpc);
};
const auto duration = GetDuration(wpc);
if (!duration.IsNegative())
tag_handler_invoke_duration(handler, handler_ctx, SongTime(duration));
return true;
}
static char const *const wavpack_suffixes[] = { static char const *const wavpack_suffixes[] = {
"wv", "wv",
nullptr nullptr
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment