aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/plugins/AudiofileDecoderPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-07 18:52:19 +0100
committerMax Kellermann <max@duempel.org>2014-02-07 18:52:19 +0100
commit6b421cc354cb0c297fcf99d7824b99b61caec99d (patch)
treee41f9fd76e3850da2716ab3dfd4fa08025f351f3 /src/decoder/plugins/AudiofileDecoderPlugin.cxx
parent37ec29b225095e9c02b974134e056f8ba1a8678c (diff)
downloadmpd-6b421cc354cb0c297fcf99d7824b99b61caec99d.tar.gz
mpd-6b421cc354cb0c297fcf99d7824b99b61caec99d.tar.xz
mpd-6b421cc354cb0c297fcf99d7824b99b61caec99d.zip
DecoderPlugin: pass Path instance to file_decode() and scan_file()
Diffstat (limited to 'src/decoder/plugins/AudiofileDecoderPlugin.cxx')
-rw-r--r--src/decoder/plugins/AudiofileDecoderPlugin.cxx13
1 files changed, 8 insertions, 5 deletions
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;
}