Package: mserv Tags: patch Hello.
This is a patch to mserv that fixes tag handling by using TagLib's C bindings. -- WBR, Andrew
diff -ur mserv-0.35/configure.ac mserv-0.35-/configure.ac
--- mserv-0.35/configure.ac 2003-08-03 17:57:19.000000000 +0300
+++ mserv-0.35-/configure.ac 2008-11-11 02:02:43.000000000 +0200
@@ -59,6 +59,7 @@
AC_CHECK_LIB(socket, main, MY_LIBS="$MY_LIBS -lsocket")
AC_CHECK_LIB(malloc, main, MY_LIBS="$MY_LIBS -lmalloc")
AC_CHECK_LIB(crypt, crypt, MY_LIBS="$MY_LIBS -lcrypt")
+ AC_CHECK_LIB(tag_c, taglib_file_new, MY_LIBS="$MY_LIBS -ltag_c")
AC_CHECK_LIB(ossaudio, _oss_ioctl, MY_LIBS="$MY_LIBS -lossaudio")
dnl Checks for libraries - mservcli
@@ -83,6 +84,8 @@
AC_CHECK_HEADERS(sys/soundcard.h, FOUND_SOUNDCARD=yes)
AC_CHECK_HEADERS(soundcard.h, FOUND_SOUNDCARD=yes)
+ CFLAGS+=" -I${prefix}/include/taglib"
+
dnl Checks for typedefs, structures, and compiler characteristics
AC_C_CONST
diff -ur mserv-0.35/debian/control mserv-0.35-/debian/control
--- mserv-0.35/debian/control 2008-11-11 02:14:12.000000000 +0200
+++ mserv-0.35-/debian/control 2008-11-11 02:11:54.000000000 +0200
@@ -2,7 +2,7 @@
Section: sound
Priority: optional
Maintainer: Nick Estes <[EMAIL PROTECTED]>
-Build-Depends: sharutils, debhelper (>= 4.1.51), cdbs
+Build-Depends: sharutils, debhelper (>= 4.1.51), cdbs, libtagc0-dev
Standards-Version: 3.6.1
Package: mserv
diff -ur mserv-0.35/mserv/mserv.c mserv-0.35-/mserv/mserv.c
--- mserv-0.35/mserv/mserv.c 2008-11-11 02:14:12.000000000 +0200
+++ mserv-0.35-/mserv/mserv.c 2008-11-11 02:04:58.000000000 +0200
@@ -63,6 +63,8 @@
#include <sys/ioctl.h>
#include <time.h>
+#include <tag_c.h>
+
#include "mserv.h"
#include "misc.h"
#include "cmd.h"
@@ -1982,7 +1984,10 @@
time_t mtime;
struct stat buf;
int bitrate;
- t_id3tag id3tag;
+ /*t_id3tag id3tag;*/
+ TagLib_File *file;
+ TagLib_Tag *tag;
+ TagLib_AudioProperties *properties;
int newinfofile = 0;
if ((unsigned int)snprintf(fullpath_file, MAXFNAME, "%s/%s",
@@ -2102,34 +2107,48 @@
}
if (duration == 0 && !*miscinfo) {
len = strlen(fullpath_file);
- if (len > 4 && !stricmp(".mp3", fullpath_file+len-4)) {
- duration = mserv_mp3info_readlen(fullpath_file, &bitrate, &id3tag);
+ if (1) {
+ file = taglib_file_new(fullpath_file);
+ if (file != NULL)
+ {
+ tag = taglib_file_tag(file);
+ properties = taglib_file_audioproperties(file);
+ duration = taglib_audioproperties_length(properties) * 100;
+ bitrate = taglib_audioproperties_bitrate(properties);
+ }
+ else
+ {
+ duration = -1;
+ }
+ /* duration = mserv_mp3info_readlen(fullpath_file, &bitrate, &id3tag); */
if (duration == -1) {
mserv_log("Unable to determine details of mp3 '%s': %s",
filename, strerror(errno));
duration = 0;
miscinfo[0] = '\0';
} else {
- if (id3tag.present) {
+ if (taglib_file_is_valid(file)) {
if (newinfofile) {
- strncpy(author, id3tag.artist, AUTHORLEN);
- author[AUTHORLEN] = '\0';
- strncpy(name, id3tag.title, NAMELEN);
+ strncpy(author, taglib_tag_artist(tag), AUTHORLEN);
+ author[AUTHORLEN] = '\0';
+ strncpy(name, taglib_tag_title(tag), NAMELEN);
name[NAMELEN] = '\0';
- year = atoi(id3tag.year);
- strncpy(genres, id3tag.genre, GENRESLEN);
+ year = taglib_tag_year(tag);
+ strncpy(genres, taglib_tag_genre(tag), GENRESLEN);
genres[GENRESLEN] = '\0';
mserv_strtoprintable(author);
mserv_strtoprintable(name);
mserv_strtoprintable(genres);
}
- if (*id3tag.comment) {
+ if (taglib_tag_comment(tag)) {
snprintf(miscinfo, MISCINFOLEN, "%dkbps; %s", bitrate,
- id3tag.comment);
+ taglib_tag_comment(tag));
mserv_strtoprintable(miscinfo);
} else {
sprintf(miscinfo, "%dkbps", bitrate);
}
+ taglib_tag_free_strings();
+ taglib_file_free(file);
} else {
sprintf(miscinfo, "%dkbps", bitrate);
signature.asc
Description: This is a digitally signed message part.

