From 6b421cc354cb0c297fcf99d7824b99b61caec99d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 7 Feb 2014 18:52:19 +0100 Subject: DecoderPlugin: pass Path instance to file_decode() and scan_file() --- src/decoder/plugins/AudiofileDecoderPlugin.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/decoder/plugins/AudiofileDecoderPlugin.cxx') diff --git a/src/decoder/plugins/AudiofileDecoderPlugin.cxx b/src/decoder/plugins/AudiofileDecoderPlugin.cxx index 8a7f34dfe..262c4a5bf 100644 --- a/src/decoder/plugins/AudiofileDecoderPlugin.cxx +++ b/src/decoder/plugins/AudiofileDecoderPlugin.cxx @@ -23,6 +23,7 @@ #include "input/InputStream.hxx" #include "CheckAudioFormat.hxx" #include "tag/TagHandler.hxx" +#include "fs/Path.hxx" #include "util/Error.hxx" #include "util/Domain.hxx" #include "Log.hxx" @@ -37,10 +38,12 @@ static constexpr Domain audiofile_domain("audiofile"); -static int audiofile_get_duration(const char *file) +gcc_pure +static int +audiofile_get_duration(Path path_fs) { int total_time; - AFfilehandle af_fp = afOpenFile(file, "r", nullptr); + AFfilehandle af_fp = afOpenFile(path_fs.c_str(), "r", nullptr); if (af_fp == AF_NULL_FILEHANDLE) { return -1; } @@ -227,15 +230,15 @@ audiofile_stream_decode(Decoder &decoder, InputStream &is) } static bool -audiofile_scan_file(const char *file, +audiofile_scan_file(Path path_fs, const struct tag_handler *handler, void *handler_ctx) { - int total_time = audiofile_get_duration(file); + int total_time = audiofile_get_duration(path_fs); if (total_time < 0) { FormatWarning(audiofile_domain, "Failed to get total song time from: %s", - file); + path_fs.c_str()); return false; } -- cgit v1.2.3