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/song_update.c | |
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 'src/song_update.c')
-rw-r--r-- | src/song_update.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/song_update.c b/src/song_update.c index e7279a6f6..d6f643dd9 100644 --- a/src/song_update.c +++ b/src/song_update.c @@ -27,6 +27,7 @@ #include "tag_ape.h" #include "tag_id3.h" #include "tag.h" +#include "tag_handler.h" #include "input_stream.h" #include <glib.h> @@ -136,12 +137,16 @@ song_file_update(struct song *song) do { /* load file tag */ - song->tag = decoder_plugin_tag_dup(plugin, path_fs); - if (song->tag != NULL) + song->tag = tag_new(); + if (decoder_plugin_scan_file(plugin, path_fs, + &add_tag_handler, song->tag)) break; + tag_free(song->tag); + song->tag = NULL; + /* fall back to stream tag */ - if (plugin->stream_tag != NULL) { + if (plugin->scan_stream != NULL) { /* open the input_stream (if not already open) */ if (is == NULL) { @@ -153,11 +158,15 @@ song_file_update(struct song *song) /* now try the stream_tag() method */ if (is != NULL) { - song->tag = decoder_plugin_stream_tag(plugin, - is); - if (song->tag != NULL) + song->tag = tag_new(); + if (decoder_plugin_scan_stream(plugin, is, + &add_tag_handler, + song->tag)) break; + tag_free(song->tag); + song->tag = NULL; + input_stream_lock_seek(is, 0, SEEK_SET, NULL); } } |