decoder/wavpack: move wavpack_scan_file() down

This commit is contained in:
Max Kellermann 2016-12-09 23:15:06 +01:00
parent bc5555933f
commit 3759f29852

View File

@ -219,34 +219,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
*/
@ -498,6 +470,34 @@ wavpack_filedecode(DecoderClient &client, Path path_fs)
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[] = {
"wv",
nullptr