--- mt-daapd-cvs-20050223-tri/configure.in	2005-02-25 13:07:37.460369044 +0200
+++ mt-daapd-cvs-20050223-tri2/configure.in	2005-02-25 12:54:23.628896201 +0200
@@ -49,7 +49,6 @@
 
 AC_ARG_ENABLE(oggvorbis,[  --enable-oggvorbis      Enable Ogg/Vorbis support],
                            use_oggvorbis=true;
-#                           LDFLAGS="${LDFLAGS} -logg -lvorbis";
                            CPPFLAGS="${CPPFLAGS} -DOGGVORBIS")
 
 AC_ARG_ENABLE(flac,[  --enable-flac      Enable FLAC support],
@@ -189,12 +188,13 @@
   AC_CHECK_HEADERS(vorbis/codec.h,, [
    AC_MSG_ERROR([vorbis/codec.h not found... Must have libvorbis installed for Ogg/Vorbis support])])
   AC_CHECK_LIB(vorbis,vorbis_info_init,echo "Have vorbis",echo "Must have libvorbis for Ogg/Vorbis support";exit)
+  AC_CHECK_LIB(vorbisfile,ov_open,echo "Have vorbisfile",echo "Must have libvorbisfile for Ogg/Vorbis support";exit)
 
   if test x"$STATIC_LIBS" != x"no"; then
-    LDFLAGS="${LDFLAGS} ${STATIC_LIBS}/libvorbis.a"
+    LDFLAGS="${LDFLAGS} ${STATIC_LIBS}/libvorbis.a ${STATIC_LIBS}/libvorbisfile.a"
     echo "Adding static libvorbis"
   else
-    LDFLAGS="${LDFLAGS} -lvorbis"
+    LDFLAGS="${LDFLAGS} -lvorbis -lvorbisfile"
     echo "Adding dynamic libvorbis"
   fi
 fi
--- mt-daapd-cvs-20050223-tri/src/ogg.c	2005-02-25 13:07:37.472367222 +0200
+++ mt-daapd-cvs-20050223-tri2/src/ogg.c	2005-02-25 13:01:17.761017993 +0200
@@ -19,6 +19,7 @@
 #include <sys/stat.h>
 #include <ogg/ogg.h>
 #include <vorbis/codec.h>
+#include <vorbis/vorbisfile.h>
 /*
 #include <locale.h>
 #include "utf8.h"
@@ -782,10 +783,52 @@
 
 int scan_get_oggtags(char *filename, MP3FILE *pmp3)
 {
-  return 0; /* Implement me! XXX */
+    FILE *f;
+    OggVorbis_File vf;
+    vorbis_comment *comment = NULL;
+    char *val;
+
+    f = fopen(filename, "rb");
+    if (f == NULL) {
+        DPRINTF(E_FATAL, L_SCAN,
+		"Error opening input file \"%s\": %s\n", filename,
+		strerror(errno));
+        return 0;
+    }
+    if (ov_open(f, &vf, NULL, 0) != 0) {
+	fclose(f);
+        DPRINTF(E_FATAL, L_SCAN,
+		"Error opening Vorbis stream in \"%s\"\n", filename);
+        return 0;
+    }
+    comment = ov_comment(&vf, -1);
+    if (comment != NULL) {
+	if ((val = vorbis_comment_query(comment, "artist", 0)) != NULL)
+	    pmp3->artist = strdup(val);
+	if ((val = vorbis_comment_query(comment, "title", 0)) != NULL)
+	    pmp3->title = strdup(val);
+	if ((val = vorbis_comment_query(comment, "album", 0)) != NULL)
+	    pmp3->album = strdup(val);
+	if ((val = vorbis_comment_query(comment, "genre", 0)) != NULL)
+	    pmp3->genre = strdup(val);
+	if ((val = vorbis_comment_query(comment, "composer", 0)) != NULL)
+	    pmp3->composer = strdup(val);
+	if ((val = vorbis_comment_query(comment, "comment", 0)) != NULL)
+	    pmp3->comment = strdup(val);
+	if ((val = vorbis_comment_query(comment, "tracknumber", 0)) != NULL)
+	    pmp3->track = atoi(val);
+	if ((val = vorbis_comment_query(comment, "discnumber", 0)) != NULL)
+	    pmp3->disc = atoi(val);
+	if ((val = vorbis_comment_query(comment, "year", 0)) != NULL)
+	    pmp3->year = atoi(val);
+    }
+    ov_clear(&vf);
+    /*fclose(f);*/
+    return 0;
 }
 
-/*int main(int argc, char **argv) {
+#if 0
+int main(int argc, char **argv) {
     int f, ret;
 
     setlocale(LC_ALL, "");
@@ -793,5 +836,7 @@
     textdomain(PACKAGE);
 
     process_file(argv[f]);
-    }*/
+}
+#endif /* 0 */
+
 
--- mt-daapd-cvs-20050223-tri/src/flac.c	2005-02-25 13:07:37.468367829 +0200
+++ mt-daapd-cvs-20050223-tri2/src/flac.c	2005-02-25 13:00:54.096610947 +0200
@@ -115,7 +115,7 @@
 }
 
 #define GET_VORBIS_COMMENT(comment, name, len)				\
-        (((strncmp(name, (comment).entry, strlen(name)) == 0) &&	\
+        (((strncasecmp(name, (comment).entry, strlen(name)) == 0) &&	\
 	  ((comment).entry[strlen(name)] == '=')) ?			\
 	 ((*(len) = (comment).length - (strlen(name) + 1)),		\
 	  (&((comment).entry[strlen(name) + 1]))) :			\
@@ -127,28 +127,28 @@
     FLAC__Metadata_Chain *chain;
     FLAC__Metadata_Iterator *iterator;
     FLAC__StreamMetadata *block;
-    int rv = -1;
     int i;
     char *val;
     size_t len;
     char tmp;
+    int found = 0;
 
     chain = FLAC__metadata_chain_new();
     if (! chain) {
 	DPRINTF(E_WARN,L_SCAN,"Cannot allocate FLAC metadata chain\n");
-        return rv;
+        return 0;
     }
     if (! FLAC__metadata_chain_read(chain, filename)) {
 	DPRINTF(E_WARN,L_SCAN,"Cannot read FLAC metadata from %s\n", filename);
 	FLAC__metadata_chain_delete(chain);
-	return rv;
+	return 0;
     }
 
     iterator = FLAC__metadata_iterator_new();
     if (! iterator) {
 	DPRINTF(E_WARN,L_SCAN,"Cannot allocate FLAC metadata iterator\n");
 	FLAC__metadata_chain_delete(chain);
-	return rv;
+	return 0;
     }
 
     FLAC__metadata_iterator_init(iterator, chain);
@@ -191,7 +191,7 @@
 							"DISCNUMBER", &len)) {
 			tmp = *(val + len);
 			*(val + len) = '\0';
-			pmp3->track = atoi(val);
+			pmp3->disc = atoi(val);
 			*(val + len) = tmp;
 		    } else if (val = GET_VORBIS_COMMENT(block->data.vorbis_comment.comments[i],
 							"YEAR", &len)) {
@@ -201,17 +201,17 @@
 			*(val + len) = tmp;
 		    }
 		}
-		rv = 0;
 		break;
 	    }
+	    found = 1;
 	}
     } while (FLAC__metadata_iterator_next(iterator));
 
-    if (rv < 0) {
+    if (! found) {
 	DPRINTF(E_WARN,L_SCAN,"Cannot find FLAC metadata in %s\n", filename);
     }
 
     FLAC__metadata_iterator_delete(iterator);
     FLAC__metadata_chain_delete(chain);
-    return rv;
+    return 0;
 }
