diff options
author | Max Kellermann <max@duempel.org> | 2012-02-11 19:12:02 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2012-02-11 17:04:29 +0100 |
commit | 5d73215a8dad922c8e383f3837f3ec9e26503389 (patch) | |
tree | 8fc4b96d93a907054a05d3250f97bf4f68c6df85 /src/decoder_plugin.h | |
parent | b7356bc526dbbd6fa00d40caff2addec10ae7c7e (diff) | |
download | mpd-5d73215a8dad922c8e383f3837f3ec9e26503389.tar.gz mpd-5d73215a8dad922c8e383f3837f3ec9e26503389.tar.xz mpd-5d73215a8dad922c8e383f3837f3ec9e26503389.zip |
decoder_plugin: scan tags with callback table
Pass a callback table to scan_file() and scan_stream(), instead of
returning a tag object.
Diffstat (limited to '')
-rw-r--r-- | src/decoder_plugin.h | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/src/decoder_plugin.h b/src/decoder_plugin.h index 0ce1af53e..933ba6751 100644 --- a/src/decoder_plugin.h +++ b/src/decoder_plugin.h @@ -26,6 +26,7 @@ struct config_param; struct input_stream; struct tag; +struct tag_handler; /** * Opaque handle which the decoder plugin passes to the functions in @@ -70,18 +71,22 @@ struct decoder_plugin { void (*file_decode)(struct decoder *decoder, const char *path_fs); /** - * Read the tags of a local file. + * Scan metadata of a file. * - * @return NULL if the operation has failed + * @return false if the operation has failed */ - struct tag *(*tag_dup)(const char *path_fs); + bool (*scan_file)(const char *path_fs, + const struct tag_handler *handler, + void *handler_ctx); /** - * Read the tags of a stream. + * Scan metadata of a file. * - * @return NULL if the operation has failed + * @return false if the operation has failed */ - struct tag *(*stream_tag)(struct input_stream *is); + bool (*scan_stream)(struct input_stream *is, + const struct tag_handler *handler, + void *handler_ctx); /** * @brief Return a "virtual" filename for subtracks in @@ -150,25 +155,28 @@ decoder_plugin_file_decode(const struct decoder_plugin *plugin, /** * Read the tag of a file. */ -static inline struct tag * -decoder_plugin_tag_dup(const struct decoder_plugin *plugin, - const char *path_fs) +static inline bool +decoder_plugin_scan_file(const struct decoder_plugin *plugin, + const char *path_fs, + const struct tag_handler *handler, void *handler_ctx) { - return plugin->tag_dup != NULL - ? plugin->tag_dup(path_fs) - : NULL; + return plugin->scan_file != NULL + ? plugin->scan_file(path_fs, handler, handler_ctx) + : false; } /** * Read the tag of a stream. */ -static inline struct tag * -decoder_plugin_stream_tag(const struct decoder_plugin *plugin, - struct input_stream *is) +static inline bool +decoder_plugin_scan_stream(const struct decoder_plugin *plugin, + struct input_stream *is, + const struct tag_handler *handler, + void *handler_ctx) { - return plugin->stream_tag != NULL - ? plugin->stream_tag(is) - : NULL; + return plugin->scan_stream != NULL + ? plugin->scan_stream(is, handler, handler_ctx) + : false; } /** |