aboutsummaryrefslogtreecommitdiffstats
path: root/src/tag.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-06-01 12:50:15 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-06-01 12:50:15 +0000
commit16da97e4c80b375f6976690e0a04102eff0a6bbd (patch)
tree67c3380dd8c9cdb4b478c6dbda14bbd47ecf953f /src/tag.c
parent16fcd1eceac6806853b32a7fb35305cafec521c1 (diff)
downloadmpd-16da97e4c80b375f6976690e0a04102eff0a6bbd.tar.gz
mpd-16da97e4c80b375f6976690e0a04102eff0a6bbd.tar.xz
mpd-16da97e4c80b375f6976690e0a04102eff0a6bbd.zip
parsing mp3 id3v2 tags on the fly for streams
git-svn-id: https://svn.musicpd.org/mpd/trunk@1281 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/tag.c')
-rw-r--r--src/tag.c49
1 files changed, 26 insertions, 23 deletions
diff --git a/src/tag.c b/src/tag.c
index ae9d41040..50c1dcd86 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -37,13 +37,6 @@
#include <FLAC/file_decoder.h>
#include <FLAC/metadata.h>
#endif
-#ifdef HAVE_ID3TAG
-#ifdef USE_MPD_ID3TAG
-#include "libid3tag/id3tag.h"
-#else
-#include <id3tag.h>
-#endif
-#endif
void printMpdTag(FILE * fp, MpdTag * tag) {
if(tag->artist) myfprintf(fp,"Artist: %s\n",tag->artist);
@@ -95,25 +88,11 @@ char * getID3Info(struct id3_tag * tag, char * id) {
}
#endif
-MpdTag * id3Dup(char * file) {
- MpdTag * ret = NULL;
#ifdef HAVE_ID3TAG
- struct id3_file * id3_file;
- struct id3_tag * tag;
+MpdTag * parseId3Tag(struct id3_tag * tag) {
+ MpdTag * ret = NULL;
char * str;
- id3_file = id3_file_open(file, ID3_FILE_MODE_READONLY);
-
- if(!id3_file) {
- return NULL;
- }
-
- tag = id3_file_tag(id3_file);
- if(!tag) {
- id3_file_close(id3_file);
- return NULL;
- }
-
str = getID3Info(tag,ID3_FRAME_ARTIST);
if(str) {
if(!ret) ret = newMpdTag();
@@ -142,6 +121,30 @@ MpdTag * id3Dup(char * file) {
ret->track = str;
}
+ return ret;
+}
+#endif
+
+MpdTag * id3Dup(char * file) {
+ MpdTag * ret = NULL;
+#ifdef HAVE_ID3TAG
+ struct id3_file * id3_file;
+ struct id3_tag * tag;
+
+ id3_file = id3_file_open(file, ID3_FILE_MODE_READONLY);
+
+ if(!id3_file) {
+ return NULL;
+ }
+
+ tag = id3_file_tag(id3_file);
+ if(!tag) {
+ id3_file_close(id3_file);
+ return NULL;
+ }
+
+ ret = parseId3Tag(tag);
+
id3_file_close(id3_file);
#endif