aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/DecoderPlugin.hxx
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/DecoderPlugin.hxx
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/DecoderPlugin.hxx')
-rw-r--r--src/decoder/DecoderPlugin.hxx16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/decoder/DecoderPlugin.hxx b/src/decoder/DecoderPlugin.hxx
index 3155be04b..716b01141 100644
--- a/src/decoder/DecoderPlugin.hxx
+++ b/src/decoder/DecoderPlugin.hxx
@@ -25,6 +25,7 @@
struct config_param;
struct InputStream;
struct tag_handler;
+class Path;
/**
* Opaque handle which the decoder plugin passes to the functions in
@@ -65,14 +66,14 @@ struct DecoderPlugin {
*
* Either implement this method or stream_decode().
*/
- void (*file_decode)(Decoder &decoder, const char *path_fs);
+ void (*file_decode)(Decoder &decoder, Path path_fs);
/**
* Scan metadata of a file.
*
* @return false if the operation has failed
*/
- bool (*scan_file)(const char *path_fs,
+ bool (*scan_file)(Path path_fs,
const struct tag_handler *handler,
void *handler_ctx);
@@ -95,7 +96,7 @@ struct DecoderPlugin {
* a filename for every single track according to tnum (param 2)
* do not include full pathname here, just the "virtual" file
*/
- char* (*container_scan)(const char *path_fs, const unsigned int tnum);
+ char* (*container_scan)(Path path_fs, const unsigned int tnum);
/* last element in these arrays must always be a nullptr: */
const char *const*suffixes;
@@ -133,14 +134,16 @@ struct DecoderPlugin {
/**
* Decode a file.
*/
- void FileDecode(Decoder &decoder, const char *path_fs) const {
+ template<typename P>
+ void FileDecode(Decoder &decoder, P path_fs) const {
file_decode(decoder, path_fs);
}
/**
* Read the tag of a file.
*/
- bool ScanFile(const char *path_fs,
+ template<typename P>
+ bool ScanFile(P path_fs,
const tag_handler &handler, void *handler_ctx) const {
return scan_file != nullptr
? scan_file(path_fs, &handler, handler_ctx)
@@ -160,7 +163,8 @@ struct DecoderPlugin {
/**
* return "virtual" tracks in a container
*/
- char *ContainerScan(const char *path, const unsigned int tnum) const {
+ template<typename P>
+ char *ContainerScan(P path, const unsigned int tnum) const {
return container_scan(path, tnum);
}