diff options
Diffstat (limited to 'audio/mserv')
-rw-r--r-- | audio/mserv/Makefile | 4 | ||||
-rw-r--r-- | audio/mserv/distinfo | 15 | ||||
-rw-r--r-- | audio/mserv/patches/patch-aa | 8 | ||||
-rw-r--r-- | audio/mserv/patches/patch-ab | 8 | ||||
-rw-r--r-- | audio/mserv/patches/patch-ac | 247 | ||||
-rw-r--r-- | audio/mserv/patches/patch-ad | 21 | ||||
-rw-r--r-- | audio/mserv/patches/patch-ae | 88 | ||||
-rw-r--r-- | audio/mserv/patches/patch-af | 351 | ||||
-rw-r--r-- | audio/mserv/patches/patch-ag | 43 | ||||
-rw-r--r-- | audio/mserv/patches/patch-am | 15 |
10 files changed, 501 insertions, 299 deletions
diff --git a/audio/mserv/Makefile b/audio/mserv/Makefile index ee46361b0e1..09de8a0c27e 100644 --- a/audio/mserv/Makefile +++ b/audio/mserv/Makefile @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.20 2004/02/14 17:21:33 jlam Exp $ +# $NetBSD: Makefile,v 1.21 2004/02/20 00:41:16 abs Exp $ # DISTNAME= mserv-0.35 -PKGREVISION= 7 +PKGREVISION= 8 CATEGORIES= audio MASTER_SITES= http://www.mserv.org/download/ diff --git a/audio/mserv/distinfo b/audio/mserv/distinfo index 15a42ee20cd..57e33367b7f 100644 --- a/audio/mserv/distinfo +++ b/audio/mserv/distinfo @@ -1,10 +1,11 @@ -$NetBSD: distinfo,v 1.15 2003/12/04 10:11:27 abs Exp $ +$NetBSD: distinfo,v 1.16 2004/02/20 00:41:16 abs Exp $ SHA1 (mserv-0.35.tar.gz) = 850835946e4d5a0deccdd22a18f30170c0a7b57c Size (mserv-0.35.tar.gz) = 280299 bytes -SHA1 (patch-aa) = 22bb3f2af2494e50456c9b1bf136774b3b300aae -SHA1 (patch-ab) = 9d1b9fe0ee1b5392e2249b50d3e27426b17c9c04 -SHA1 (patch-ac) = 535900af6550bf340068fd10af7d7564ed2fb4c4 -SHA1 (patch-af) = 2839b8e0c51a4c1c182173abc1c406b66a915ac4 -SHA1 (patch-ag) = 232ce715468e8a59820b856a586dc708d65a2b5e -SHA1 (patch-am) = 925a304562d89c3aca32a3f07f00eab912e8d2dd +SHA1 (patch-aa) = 3756e6b338ad8501daa258237868e9ef2d96cb49 +SHA1 (patch-ab) = 91d6840eae30182343db97d3f67d23d0c423dbe7 +SHA1 (patch-ac) = 068b14b4a8a0ce4dcb19e0cd28fc6a7296f86dad +SHA1 (patch-ad) = 105edf313c2101f0961aab8a94022a5a0d07eb22 +SHA1 (patch-ae) = 559f2ecf11bcd25b5ea3423dff4b1a4bf4066b78 +SHA1 (patch-af) = ea56ea4f0c7f807484ff9e75f798fea7f3335df3 +SHA1 (patch-ag) = 7d5fae48c89db4b9bdccf371528c3b3e890455a9 diff --git a/audio/mserv/patches/patch-aa b/audio/mserv/patches/patch-aa index ec320f9bee4..9acaf1bb48e 100644 --- a/audio/mserv/patches/patch-aa +++ b/audio/mserv/patches/patch-aa @@ -1,8 +1,8 @@ -$NetBSD: patch-aa,v 1.7 2003/09/03 19:55:28 abs Exp $ +$NetBSD: patch-aa,v 1.8 2004/02/20 00:41:16 abs Exp $ ---- mserv/Makefile.in.orig 2003-08-03 16:57:19.000000000 +0200 -+++ mserv/Makefile.in 2003-09-03 14:01:16.000000000 +0200 -@@ -130,7 +130,7 @@ +--- mserv/Makefile.in.orig Sun Aug 3 15:57:19 2003 ++++ mserv/Makefile.in +@@ -130,7 +130,7 @@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ diff --git a/audio/mserv/patches/patch-ab b/audio/mserv/patches/patch-ab index 0ea31b632fc..bf1740088a3 100644 --- a/audio/mserv/patches/patch-ab +++ b/audio/mserv/patches/patch-ab @@ -1,8 +1,8 @@ -$NetBSD: patch-ab,v 1.7 2003/09/03 12:35:12 martin Exp $ +$NetBSD: patch-ab,v 1.8 2004/02/20 00:41:16 abs Exp $ ---- mserv/cmd.c.orig 2003-08-02 16:26:19.000000000 +0200 -+++ mserv/cmd.c 2003-09-03 13:51:41.000000000 +0200 -@@ -51,7 +51,7 @@ +--- mserv/cmd.c.orig Sat Aug 2 15:26:19 2003 ++++ mserv/cmd.c +@@ -51,7 +51,7 @@ met: #include <math.h> #include "mserv.h" #include "misc.h" diff --git a/audio/mserv/patches/patch-ac b/audio/mserv/patches/patch-ac index 6fa97ffec88..46e750ed320 100644 --- a/audio/mserv/patches/patch-ac +++ b/audio/mserv/patches/patch-ac @@ -1,145 +1,108 @@ -$NetBSD: patch-ac,v 1.9 2003/12/04 10:11:27 abs Exp $ +$NetBSD: patch-ac,v 1.10 2004/02/20 00:41:16 abs Exp $ ---- mserv/mserv.c.orig Sun Aug 3 15:57:20 2003 -+++ mserv/mserv.c -@@ -62,12 +62,17 @@ met: - #include <sys/ioctl.h> - #include <time.h> +--- mserv/defconf.c.orig Mon Aug 4 19:25:36 2003 ++++ mserv/defconf.c +@@ -1,54 +1,53 @@ + #include "defines.h" -+#ifdef PARSE_OGG_INFO -+#include <vorbis/codec.h> -+#include <vorbis/vorbisfile.h> -+#endif -+ - #include "mserv.h" - #include "misc.h" - #include "cmd.h" - #include "acl.h" - #include "mp3info.h" --#include "soundcard.h" -+#include "mservsoundcard.h" - #include "defconf.h" - #include "conf.h" - #include "opt.h" -@@ -2019,11 +2024,13 @@ static t_track *mserv_loadtrk(const char - alen = strlen(buffer); - if (buffer[alen-1] != '\n') { - mserv_log("Line %d too long in '%s'", line, fullpath_trk); -+ fclose(fd); - return NULL; - } - buffer[--alen] = '\0'; - if (!(l = strcspn(buffer, "=")) || l >= 64) { - mserv_log("Invalid track line %d in '%s'", line, fullpath_trk); -+ fclose(fd); - return NULL; - } - strncpy(token, buffer, l); -@@ -2059,6 +2066,7 @@ static t_track *mserv_loadtrk(const char - } - if ((arate = malloc(sizeof(t_rating)+strlen(token)+1)) == NULL) { - mserv_log("Out of memory creating ratings for '%s'", fullpath_trk); -+ fclose(fd); - return NULL; - } - memset(arate, 0, sizeof(t_rating)); -@@ -2082,15 +2090,18 @@ static t_track *mserv_loadtrk(const char - } - if (!*author) { - mserv_log("No author specified in '%s'", fullpath_trk); -+ fclose(fd); - return NULL; - } - if (!*name) { - mserv_log("No name specified in '%s'", fullpath_trk); -+ fclose(fd); - return NULL; - } - if (fstat(fileno(fd), &buf) == -1) { - perror("fstat"); - mserv_log("Unable to stat '%s': %s", filename, strerror(errno)); -+ fclose(fd); - return NULL; - } - mtime = buf.st_mtime; -@@ -2098,8 +2109,17 @@ static t_track *mserv_loadtrk(const char - } - if (duration == 0 && !*miscinfo) { - len = strlen(fullpath_file); -+#ifdef PARSE_OGG_INFO -+ if (len > 4 && !stricmp(".mp3", fullpath_file+len-4) || -+ !stricmp(".ogg", fullpath_file+len-4)) { -+ if (!stricmp(".mp3", fullpath_file+len-4)) -+ duration = mserv_mp3info_readlen(fullpath_file, &bitrate, &id3tag); -+ else -+ duration = mserv_ogginfo_readlen(fullpath_file, &bitrate, &id3tag); -+#else - if (len > 4 && !stricmp(".mp3", fullpath_file+len-4)) { - duration = mserv_mp3info_readlen(fullpath_file, &bitrate, &id3tag); -+#endif - if (duration == -1) { - mserv_log("Unable to determine details of mp3 '%s': %s", - filename, strerror(errno)); -@@ -3427,6 +3447,62 @@ int mserv_setmixer(t_client *cl, int wha - close(mixer_fd); - mserv_response(cl, "NAN", NULL); - return -1; -+} -+ -+#endif -+ -+#ifdef PARSE_OGG_INFO -+int mserv_ogginfo_readlen(const char *fname, int *bitrate_ret, -+ t_id3tag *id3tag) -+{ -+ OggVorbis_File vf; -+ FILE *f; -+ ogg_sync_state sync; -+ vorbis_info *vi; -+ vorbis_comment *vc; -+ char **comment; -+ double duration; -+ -+ if (id3tag) -+ memset(id3tag, 0, sizeof(*id3tag)); -+ -+ if ((f = fopen(fname, "rb")) == NULL) -+ return -1; -+ -+ if (ov_open(f, &vf, NULL, 0) < 0) { -+ fclose(f); -+ return -1; -+ } -+ -+ if ( !(vi = ov_info(&vf, -1)) || !(vc = ov_comment(&vf, -1))) { -+ ov_clear(&vf); -+ fclose(f); -+ return -1; -+ } -+ -+ if (bitrate_ret) -+ *bitrate_ret = vi->bitrate_nominal/1024; -+ -+ for (comment = vc->user_comments ; *comment ; ++comment) { -+ if (strncasecmp(*comment, "title=", 6) == 0) { -+ strlcpy(id3tag->title, *comment + 6, MP3ID3_TITLELEN+1); -+ id3tag->present = 1; -+ } -+ else if (strncasecmp(*comment, "artist=", 7) == 0) -+ strlcpy(id3tag->artist, *comment + 7, MP3ID3_ARTISTLEN+1); -+ else if (strncasecmp(*comment, "album=", 6) == 0) -+ strlcpy(id3tag->album, *comment + 6, MP3ID3_ALBUMLEN+1); -+ else if (strncasecmp(*comment, "date=", 5) == 0) -+ strlcpy(id3tag->year, *comment + 5, MP3ID3_YEARLEN+1); -+ else if (strncasecmp(*comment, "genre=", 6) == 0) -+ strlcpy(id3tag->genre, *comment + 6, 31); -+ /* tracknumber ignored */ -+ } -+ -+ duration = ov_time_total(&vf, -1); -+ ov_clear(&vf); -+ fclose(f); -+ return (int)duration * 100; - } +-const char defconf_file[] = "# Mserv configuration file for 0.33 and later\n\ +-\n\ +-# File locations, / at start is absolute, otherwise relative to mserv root\n\ +-path_acl=acl\n\ +-path_webacl=webacl\n\ +-path_logfile=log\n\ +-path_tracks=tracks\n\ +-path_trackinfo=trackinfo\n\ +-path_playout=player.out\n\ +-path_idea=idea\n\ +-path_mixer=/dev/mixer\n\ +-path_language=" DATADIR "/english.lang\n\ +-\n\ +-# Define player invokation methods\n\ +-# mservplay is our special wrapper, the first parameter is a 'nice' level\n\ +-# play is part of sox\n\ +-prog_mpg123=/usr/local/bin/mpg123 -b 1024\n\ +-prog_freeamp=/usr/local/bin/freeamp -ui mpg123\n\ +-prog_mservplay=/usr/local/bin/mservplay 0 mpg123 -b 1024\n\ +-prog_play=/usr/local/bin/play\n\ +-prog_ogg123=/usr/local/bin/ogg123\n\ +-\n\ +-# Set players for each file extension we want to support, unknown extensions\n\ +-# are ignored by mserv\n\ +-player_mp3=prog_mpg123\n\ +-player_wav=prog_play\n\ +-player_au=prog_play\n\ +-player_ogg=prog_ogg\n\ +-\n\ +-# Set default random mode, either on or off. You must still tell mserv to\n\ +-# start playing (PLAY).\n\ +-random=off\n\ +-\n\ +-# Set whether or not you would like play to start as soon as mserv has loaded.\n\ +-play=off\n\ +-\n\ +-# Set default random factor, 0.5 is completely random, 0.6 is less random\n\ +-# and takes into account your ratings, 0.4 plays your worst tunes. 0.99 max.\n\ +-factor=0.60\n\ +-\n\ +-# Set default filter, leave blank for off. Example: \"!classical\" to\n\ +-# not play classical genre, or \"year>=1980&year<1990\" to only play\n\ +-# 80's songs.\n\ +-filter=\n\ +-\n\ +-# Set gap between songs, in seconds. 0 to start the next song as quick as\n\ +-# possible.\n\ +-gap=1\n\ +-\n\ +-"; ++const char defconf_file[] = "# Mserv configuration file for 0.33 and later\n" ++"\n" ++"# File locations, / at start is absolute, otherwise relative to mserv root\n" ++"path_acl=acl\n" ++"path_webacl=webacl\n" ++"path_logfile=log\n" ++"path_tracks=tracks\n" ++"path_trackinfo=trackinfo\n" ++"path_playout=player.out\n" ++"path_idea=idea\n" ++"path_mixer=/dev/mixer\n" ++"path_language=" DATADIR "/english.lang\n" ++"\n" ++"# Define player invokation methods\n" ++"# mservplay is our special wrapper, the first parameter is a 'nice' level\n" ++"# play is part of sox\n" ++"prog_mpg123=" PATH_MPG123 " -b 1024\n" ++"prog_freeamp=/usr/local/bin/freeamp -ui " PATH_MPG123 "\n" ++"prog_mservplay=/usr/local/bin/mservplay 0 " PATH_MPG123 " -b 1024\n" ++"prog_play=/usr/local/bin/play\n" ++"prog_ogg123=/usr/local/bin/ogg123\n" ++"\n" ++"# Set players for each file extension we want to support, unknown extensions\n" ++"# are ignored by mserv\n" ++"player_mp3=prog_mpg123\n" ++"player_wav=prog_play\n" ++"player_au=prog_play\n" ++"player_ogg=prog_ogg123\n" ++"\n" ++"# Set default random mode, either on or off. You must still tell mserv to\n" ++"# start playing (PLAY).\n" ++"random=off\n" ++"\n" ++"# Set whether or not you would like play to start as soon as mserv has loaded.\n" ++"play=off\n" ++"\n" ++"# Set default random factor, 0.5 is completely random, 0.6 is less random\n" ++"# and takes into account your ratings, 0.4 plays your worst tunes. 0.99 max.\n" ++"factor=0.60\n" ++"\n" ++"# Set default filter, leave blank for off. Example: \"!classical\" to\n" ++"# not play classical genre, or \"year>=1980&year<1990\" to only play\n" ++"# 80's songs.\n" ++"filter=\n" ++"\n" ++"# Set gap between songs, in seconds. 0 to start the next song as quick as\n" ++"# possible.\n" ++"gap=1\n" ++"\n"; - #endif + unsigned int defconf_size = sizeof(defconf_file)-1; diff --git a/audio/mserv/patches/patch-ad b/audio/mserv/patches/patch-ad new file mode 100644 index 00000000000..a9defc157c5 --- /dev/null +++ b/audio/mserv/patches/patch-ad @@ -0,0 +1,21 @@ +$NetBSD: patch-ad,v 1.6 2004/02/20 00:41:16 abs Exp $ + +--- mserv/defines.h.orig Sun Aug 3 15:57:20 2003 ++++ mserv/defines.h +@@ -1,3 +1,7 @@ ++#ifndef PATH_MPG123 ++#define PATH_MPG123 BINDIR "/mpg123" ++#endif ++ + /* maximum amount to queue in each output buffer */ + #define OUTBUFLEN 32*1024 + +@@ -39,7 +43,7 @@ + #define MISCINFOLEN 128 + + /* maximum number of tracks in each album */ +-#define TRACKSPERALBUM 200 ++#define TRACKSPERALBUM 250 + + /* maximum language line length */ + #define LANGLINELEN 1024 diff --git a/audio/mserv/patches/patch-ae b/audio/mserv/patches/patch-ae new file mode 100644 index 00000000000..901d5664b02 --- /dev/null +++ b/audio/mserv/patches/patch-ae @@ -0,0 +1,88 @@ +$NetBSD: patch-ae,v 1.8 2004/02/20 00:41:16 abs Exp $ + +--- mserv/mp3info.c.orig Thu Feb 19 17:46:03 2004 ++++ mserv/mp3info.c +@@ -27,6 +27,7 @@ + #define h_thing(val) ((val>>20)&0xfff) + + #define ID3V2HEADERLEN 10 ++#define min(x,y) ((x)<(y)?(x):(y)) + + /* mp3 bit rate and sampling frequency tables */ + +@@ -45,12 +46,14 @@ const int sampling_freq_table[2][3] = + /* structure of id3 tag in mp3 file */ + + typedef struct id3tag_disc_str +-{ +- char title[MP3ID3_TITLELEN]; +- char artist[MP3ID3_ARTISTLEN]; +- char album[MP3ID3_ALBUMLEN]; +- char year[MP3ID3_YEARLEN]; +- char comment[MP3ID3_COMMENTLEN]; ++{ /* These are all fixed lengths. ++ * Avoid #define'd lengths that get get redefined for other uses ++ */ ++ char title[30]; ++ char artist[30]; ++ char album[30]; ++ char year[4]; ++ char comment[28]; + unsigned char genre; + } id3tag_disc; + +@@ -312,38 +315,44 @@ int mserv_mp3info_readlen(const char *fn + if (id3tag) + { + id3tag_disc tag_disc; ++ int len; + + if (fread(&tag_disc, 1, 125, f) != 125) + goto error; + + id3tag->present = 1; + +- memcpy(id3tag->title, tag_disc.title, MP3ID3_TITLELEN); +- id3tag->title[MP3ID3_TITLELEN] = '\0'; ++ len = min(MP3ID3_TITLELEN, sizeof(tag_disc.title)); ++ memcpy(id3tag->title, tag_disc.title, len); ++ id3tag->title[len] = '\0'; + e = id3tag->title + strlen(id3tag->title); + while (e > id3tag->title && *(e-1) == ' ') + *--e = '\0'; + +- memcpy(id3tag->artist, tag_disc.artist, MP3ID3_ARTISTLEN); +- id3tag->artist[MP3ID3_ARTISTLEN] = '\0'; ++ len = min(MP3ID3_ARTISTLEN, sizeof(tag_disc.artist)); ++ memcpy(id3tag->artist, tag_disc.artist, len); ++ id3tag->artist[len] = '\0'; + e = id3tag->artist + strlen(id3tag->artist); + while (e > id3tag->artist && *(e-1) == ' ') + *--e = '\0'; + +- memcpy(id3tag->album, tag_disc.album, MP3ID3_ALBUMLEN); +- id3tag->album[MP3ID3_ALBUMLEN] = '\0'; ++ len = min(MP3ID3_ALBUMLEN, sizeof(tag_disc.album)); ++ memcpy(id3tag->album, tag_disc.album, len); ++ id3tag->album[len] = '\0'; + e = id3tag->album + strlen(id3tag->album); + while (e > id3tag->album && *(e-1) == ' ') + *--e = '\0'; + +- memcpy(id3tag->year, tag_disc.year, MP3ID3_YEARLEN); +- id3tag->year[MP3ID3_YEARLEN] = '\0'; ++ len = min(MP3ID3_YEARLEN, sizeof(tag_disc.year)); ++ memcpy(id3tag->year, tag_disc.year, len); ++ id3tag->year[len] = '\0'; + e = id3tag->year + strlen(id3tag->year); + while (e > id3tag->year && *(e-1) == ' ') + *--e = '\0'; + +- memcpy(id3tag->comment, tag_disc.comment, MP3ID3_COMMENTLEN); +- id3tag->comment[MP3ID3_COMMENTLEN] = '\0'; ++ len = min(MP3ID3_COMMENTLEN, sizeof(tag_disc.comment)); ++ memcpy(id3tag->comment, tag_disc.comment, len); ++ id3tag->comment[len] = '\0'; + e = id3tag->comment + strlen(id3tag->comment); + while (e > id3tag->comment && *(e-1) == ' ') + *--e = '\0'; diff --git a/audio/mserv/patches/patch-af b/audio/mserv/patches/patch-af index 695db1f8890..a6fecfef01b 100644 --- a/audio/mserv/patches/patch-af +++ b/audio/mserv/patches/patch-af @@ -1,108 +1,249 @@ -$NetBSD: patch-af,v 1.7 2003/09/03 19:55:28 abs Exp $ +$NetBSD: patch-af,v 1.8 2004/02/20 00:41:16 abs Exp $ ---- mserv/defconf.c.orig 2003-08-04 20:25:36.000000000 +0200 -+++ mserv/defconf.c 2003-09-03 13:44:02.000000000 +0200 -@@ -1,54 +1,53 @@ - #include "defines.h" +--- mserv/mserv.c.orig Sun Aug 3 15:57:20 2003 ++++ mserv/mserv.c +@@ -62,12 +62,17 @@ met: + #include <sys/ioctl.h> + #include <time.h> --const char defconf_file[] = "# Mserv configuration file for 0.33 and later\n\ --\n\ --# File locations, / at start is absolute, otherwise relative to mserv root\n\ --path_acl=acl\n\ --path_webacl=webacl\n\ --path_logfile=log\n\ --path_tracks=tracks\n\ --path_trackinfo=trackinfo\n\ --path_playout=player.out\n\ --path_idea=idea\n\ --path_mixer=/dev/mixer\n\ --path_language=" DATADIR "/english.lang\n\ --\n\ --# Define player invokation methods\n\ --# mservplay is our special wrapper, the first parameter is a 'nice' level\n\ --# play is part of sox\n\ --prog_mpg123=/usr/local/bin/mpg123 -b 1024\n\ --prog_freeamp=/usr/local/bin/freeamp -ui mpg123\n\ --prog_mservplay=/usr/local/bin/mservplay 0 mpg123 -b 1024\n\ --prog_play=/usr/local/bin/play\n\ --prog_ogg123=/usr/local/bin/ogg123\n\ --\n\ --# Set players for each file extension we want to support, unknown extensions\n\ --# are ignored by mserv\n\ --player_mp3=prog_mpg123\n\ --player_wav=prog_play\n\ --player_au=prog_play\n\ --player_ogg=prog_ogg\n\ --\n\ --# Set default random mode, either on or off. You must still tell mserv to\n\ --# start playing (PLAY).\n\ --random=off\n\ --\n\ --# Set whether or not you would like play to start as soon as mserv has loaded.\n\ --play=off\n\ --\n\ --# Set default random factor, 0.5 is completely random, 0.6 is less random\n\ --# and takes into account your ratings, 0.4 plays your worst tunes. 0.99 max.\n\ --factor=0.60\n\ --\n\ --# Set default filter, leave blank for off. Example: \"!classical\" to\n\ --# not play classical genre, or \"year>=1980&year<1990\" to only play\n\ --# 80's songs.\n\ --filter=\n\ --\n\ --# Set gap between songs, in seconds. 0 to start the next song as quick as\n\ --# possible.\n\ --gap=1\n\ --\n\ --"; -+const char defconf_file[] = "# Mserv configuration file for 0.33 and later\n" -+"\n" -+"# File locations, / at start is absolute, otherwise relative to mserv root\n" -+"path_acl=acl\n" -+"path_webacl=webacl\n" -+"path_logfile=log\n" -+"path_tracks=tracks\n" -+"path_trackinfo=trackinfo\n" -+"path_playout=player.out\n" -+"path_idea=idea\n" -+"path_mixer=/dev/mixer\n" -+"path_language=" DATADIR "/english.lang\n" -+"\n" -+"# Define player invokation methods\n" -+"# mservplay is our special wrapper, the first parameter is a 'nice' level\n" -+"# play is part of sox\n" -+"prog_mpg123=" PATH_MPG123 " -b 1024\n" -+"prog_freeamp=/usr/local/bin/freeamp -ui " PATH_MPG123 "\n" -+"prog_mservplay=/usr/local/bin/mservplay 0 " PATH_MPG123 " -b 1024\n" -+"prog_play=/usr/local/bin/play\n" -+"prog_ogg123=/usr/local/bin/ogg123\n" -+"\n" -+"# Set players for each file extension we want to support, unknown extensions\n" -+"# are ignored by mserv\n" -+"player_mp3=prog_mpg123\n" -+"player_wav=prog_play\n" -+"player_au=prog_play\n" -+"player_ogg=prog_ogg123\n" -+"\n" -+"# Set default random mode, either on or off. You must still tell mserv to\n" -+"# start playing (PLAY).\n" -+"random=off\n" -+"\n" -+"# Set whether or not you would like play to start as soon as mserv has loaded.\n" -+"play=off\n" -+"\n" -+"# Set default random factor, 0.5 is completely random, 0.6 is less random\n" -+"# and takes into account your ratings, 0.4 plays your worst tunes. 0.99 max.\n" -+"factor=0.60\n" -+"\n" -+"# Set default filter, leave blank for off. Example: \"!classical\" to\n" -+"# not play classical genre, or \"year>=1980&year<1990\" to only play\n" -+"# 80's songs.\n" -+"filter=\n" -+"\n" -+"# Set gap between songs, in seconds. 0 to start the next song as quick as\n" -+"# possible.\n" -+"gap=1\n" -+"\n"; ++#ifdef PARSE_OGG_INFO ++#include <vorbis/codec.h> ++#include <vorbis/vorbisfile.h> ++#endif ++ + #include "mserv.h" + #include "misc.h" + #include "cmd.h" + #include "acl.h" + #include "mp3info.h" +-#include "soundcard.h" ++#include "mservsoundcard.h" + #include "defconf.h" + #include "conf.h" + #include "opt.h" +@@ -131,7 +136,8 @@ static void mserv_vresponse(t_client *cl + static void mserv_scandir(void); + static void mserv_scandir_recurse(const char *pathname); + static t_track *mserv_loadtrk(const char *filename); +-static t_album *mserv_loadalbum(const char *filename, int onlyifexists); ++static t_album *mserv_loadalbum(const char *filename, int onlyifexists, ++ const char *default_author); + static int album_insertsort(t_album *album); + static t_author *mserv_authorlist(void); + static int author_insertsort(t_author **list, t_author *author); +@@ -292,7 +298,7 @@ int main(int argc, char *argv[]) + ps->pw_dir[strlen(ps->pw_dir)-1] == '/' ? "" : "/"); + } else { + /* copy out of environment */ +- if ((m = malloc(strlen(mserv_root))) == NULL) { ++ if ((m = malloc(strlen(mserv_root)+1)) == NULL) { + fprintf(stderr, "%s: out of memory\n", progname); + exit(1); + } +@@ -305,7 +311,7 @@ int main(int argc, char *argv[]) + l--; + mserv_root[l] = '\0'; + if (!mserv_conf) { +- if ((m = malloc(strlen(mserv_root)+sizeof("/config"))) == NULL) { ++ if ((m = malloc(strlen(mserv_root)+sizeof("/config")+1)) == NULL) { + fprintf(stderr, "%s: out of memory\n", progname); + exit(1); + } +@@ -1624,6 +1630,7 @@ static void mserv_scandir_recurse(const + int i; + t_album *album; + int flag = 0; ++ const char *default_author = 0; - unsigned int defconf_size = sizeof(defconf_file)-1; + /* pathname is "" or "directory/" or "directory/directory/..." */ + +@@ -1686,22 +1693,32 @@ static void mserv_scandir_recurse(const + toomany = 1; + break; + } ++ + if (mserv_verbose) + mserv_log("Track file: %s", fullpath); + if ((tracks[tnum] = mserv_loadtrk(filename)) == NULL) { + mserv_log("Unable to add track '%s'", fullpath); + } else { ++ ++ if (default_author == 0) ++ default_author = tracks[tnum]->author; ++ else if (default_author != (const char *)-1 && strcmp(default_author, ++ tracks[tnum]->author)) ++ default_author = (const char *)-1; ++ + tracks[tnum]->id = mserv_nextid_track++; + tracks[tnum]->n_album = mserv_nextid_album; + tracks[tnum]->n_track = tnum+1; + tracks[tnum]->next = mserv_tracks; + mserv_tracks = tracks[tnum++]; + } ++ + flag = 1; /* there is at least one track in this directory */ + } + closedir(dir); + /* load album, but only if there is an album file or flag is set */ +- if ((album = mserv_loadalbum(pathname, flag ? 0 : 1)) == NULL) ++ if ((album = mserv_loadalbum(pathname, flag ? 0 : 1, ++ (default_author == (const char *)-1) ?0 :default_author)) == NULL) + return; + qsort(tracks, TRACKSPERALBUM, sizeof(t_track *), + mserv_trackcompare_filename); +@@ -1815,7 +1832,7 @@ static int mserv_trackcompare_rating(con + } + } + +-static t_album *mserv_loadalbum(const char *filename, int onlyifexists) ++static t_album *mserv_loadalbum(const char *filename, int onlyifexists, const char *default_author) + { + FILE *fd; + char fullpath[MAXFNAME]; +@@ -1899,8 +1916,13 @@ static t_album *mserv_loadalbum(const ch + return NULL; + mtime = time(NULL); + } +- if (!*author) +- strcpy(author, "!-Unindexed"); ++ if (!*author) { ++ if (default_author) ++ strcpy(author, default_author); ++ else ++ strcpy(author, "!-Unindexed"); ++ } ++ + if (!*name) { + if (!*filename || !*(filename+1)) { + strcpy(name, "rootdir"); +@@ -2019,11 +2041,13 @@ static t_track *mserv_loadtrk(const char + alen = strlen(buffer); + if (buffer[alen-1] != '\n') { + mserv_log("Line %d too long in '%s'", line, fullpath_trk); ++ fclose(fd); + return NULL; + } + buffer[--alen] = '\0'; + if (!(l = strcspn(buffer, "=")) || l >= 64) { + mserv_log("Invalid track line %d in '%s'", line, fullpath_trk); ++ fclose(fd); + return NULL; + } + strncpy(token, buffer, l); +@@ -2059,6 +2083,7 @@ static t_track *mserv_loadtrk(const char + } + if ((arate = malloc(sizeof(t_rating)+strlen(token)+1)) == NULL) { + mserv_log("Out of memory creating ratings for '%s'", fullpath_trk); ++ fclose(fd); + return NULL; + } + memset(arate, 0, sizeof(t_rating)); +@@ -2082,15 +2107,18 @@ static t_track *mserv_loadtrk(const char + } + if (!*author) { + mserv_log("No author specified in '%s'", fullpath_trk); ++ fclose(fd); + return NULL; + } + if (!*name) { + mserv_log("No name specified in '%s'", fullpath_trk); ++ fclose(fd); + return NULL; + } + if (fstat(fileno(fd), &buf) == -1) { + perror("fstat"); + mserv_log("Unable to stat '%s': %s", filename, strerror(errno)); ++ fclose(fd); + return NULL; + } + mtime = buf.st_mtime; +@@ -2098,8 +2126,17 @@ static t_track *mserv_loadtrk(const char + } + if (duration == 0 && !*miscinfo) { + len = strlen(fullpath_file); ++#ifdef PARSE_OGG_INFO ++ if (len > 4 && !stricmp(".mp3", fullpath_file+len-4) || ++ !stricmp(".ogg", fullpath_file+len-4)) { ++ if (!stricmp(".mp3", fullpath_file+len-4)) ++ duration = mserv_mp3info_readlen(fullpath_file, &bitrate, &id3tag); ++ else ++ duration = mserv_ogginfo_readlen(fullpath_file, &bitrate, &id3tag); ++#else + if (len > 4 && !stricmp(".mp3", fullpath_file+len-4)) { + duration = mserv_mp3info_readlen(fullpath_file, &bitrate, &id3tag); ++#endif + if (duration == -1) { + mserv_log("Unable to determine details of mp3 '%s': %s", + filename, strerror(errno)); +@@ -2719,7 +2756,7 @@ t_album *mserv_checkdisk_album(t_album * + } + if (buf.st_mtime == album->mtime) + return album; +- if ((newalbum = mserv_loadalbum(album->filename, 1)) == NULL) { ++ if ((newalbum = mserv_loadalbum(album->filename, 1, 0)) == NULL) { + mserv_log("Unable to re-load '%s'", album->filename); + return album; + } +@@ -3427,6 +3464,62 @@ int mserv_setmixer(t_client *cl, int wha + close(mixer_fd); + mserv_response(cl, "NAN", NULL); + return -1; ++} ++ ++#endif ++ ++#ifdef PARSE_OGG_INFO ++int mserv_ogginfo_readlen(const char *fname, int *bitrate_ret, ++ t_id3tag *id3tag) ++{ ++ OggVorbis_File vf; ++ FILE *f; ++ ogg_sync_state sync; ++ vorbis_info *vi; ++ vorbis_comment *vc; ++ char **comment; ++ double duration; ++ ++ if (id3tag) ++ memset(id3tag, 0, sizeof(*id3tag)); ++ ++ if ((f = fopen(fname, "rb")) == NULL) ++ return -1; ++ ++ if (ov_open(f, &vf, NULL, 0) < 0) { ++ fclose(f); ++ return -1; ++ } ++ ++ if ( !(vi = ov_info(&vf, -1)) || !(vc = ov_comment(&vf, -1))) { ++ ov_clear(&vf); ++ fclose(f); ++ return -1; ++ } ++ ++ if (bitrate_ret) ++ *bitrate_ret = vi->bitrate_nominal/1024; ++ ++ for (comment = vc->user_comments ; *comment ; ++comment) { ++ if (strncasecmp(*comment, "title=", 6) == 0) { ++ strlcpy(id3tag->title, *comment + 6, MP3ID3_TITLELEN+1); ++ id3tag->present = 1; ++ } ++ else if (strncasecmp(*comment, "artist=", 7) == 0) ++ strlcpy(id3tag->artist, *comment + 7, MP3ID3_ARTISTLEN+1); ++ else if (strncasecmp(*comment, "album=", 6) == 0) ++ strlcpy(id3tag->album, *comment + 6, MP3ID3_ALBUMLEN+1); ++ else if (strncasecmp(*comment, "date=", 5) == 0) ++ strlcpy(id3tag->year, *comment + 5, MP3ID3_YEARLEN+1); ++ else if (strncasecmp(*comment, "genre=", 6) == 0) ++ strlcpy(id3tag->genre, *comment + 6, 31); ++ /* tracknumber ignored */ ++ } ++ ++ duration = ov_time_total(&vf, -1); ++ ov_clear(&vf); ++ fclose(f); ++ return (int)duration * 100; + } + + #endif diff --git a/audio/mserv/patches/patch-ag b/audio/mserv/patches/patch-ag index b2fcd268e2c..5b3188778e7 100644 --- a/audio/mserv/patches/patch-ag +++ b/audio/mserv/patches/patch-ag @@ -1,21 +1,24 @@ -$NetBSD: patch-ag,v 1.5 2003/09/03 12:35:13 martin Exp $ +$NetBSD: patch-ag,v 1.6 2004/02/20 00:41:16 abs Exp $ ---- mserv/defines.h.orig 2003-08-03 16:57:20.000000000 +0200 -+++ mserv/defines.h 2003-09-03 13:24:27.000000000 +0200 -@@ -1,3 +1,7 @@ -+#ifndef PATH_MPG123 -+#define PATH_MPG123 BINDIR "/mpg123" -+#endif -+ - /* maximum amount to queue in each output buffer */ - #define OUTBUFLEN 32*1024 - -@@ -39,7 +43,7 @@ - #define MISCINFOLEN 128 - - /* maximum number of tracks in each album */ --#define TRACKSPERALBUM 200 -+#define TRACKSPERALBUM 250 - - /* maximum language line length */ - #define LANGLINELEN 1024 +--- mserv/opt.c.orig Sun Aug 3 15:57:20 2003 ++++ mserv/opt.c +@@ -115,7 +115,7 @@ int opt_read(const char *root) + sprintf(m, "%s/%s", root, val); + } else { + /* value is absolute path */ +- if ((m = malloc(strlen(val))) == NULL) { ++ if ((m = malloc(strlen(val)+1)) == NULL) { + fprintf(stderr, "%s: out of memory building path\n", progname); + return -1; + } +@@ -164,8 +164,8 @@ int opt_read(const char *root) + /* special case - player variable is an indirected to another variable */ + if ((val = conf_getvalue("player")) == NULL) { + if (mserv_verbose) +- printf("No player specified, defaulting to /usr/local/bin/mpg123\n"); +- opt_player = "/usr/local/bin/mpg123"; ++ printf("No player specified, defaulting to " PATH_MPG123 "\n"); ++ opt_player = PATH_MPG123; + } else { + if ((opt_player = conf_getvalue(val)) == NULL) { + fprintf(stderr, "%s: player setting '%s' not found\n", progname, diff --git a/audio/mserv/patches/patch-am b/audio/mserv/patches/patch-am deleted file mode 100644 index 02128e6c228..00000000000 --- a/audio/mserv/patches/patch-am +++ /dev/null @@ -1,15 +0,0 @@ -$NetBSD: patch-am,v 1.2 2003/09/03 12:35:14 martin Exp $ - ---- mserv/opt.c.orig 2003-08-03 16:57:20.000000000 +0200 -+++ mserv/opt.c 2003-09-03 13:35:18.000000000 +0200 -@@ -164,8 +164,8 @@ - /* special case - player variable is an indirected to another variable */ - if ((val = conf_getvalue("player")) == NULL) { - if (mserv_verbose) -- printf("No player specified, defaulting to /usr/local/bin/mpg123\n"); -- opt_player = "/usr/local/bin/mpg123"; -+ printf("No player specified, defaulting to " PATH_MPG123 "\n"); -+ opt_player = PATH_MPG123; - } else { - if ((opt_player = conf_getvalue(val)) == NULL) { - fprintf(stderr, "%s: player setting '%s' not found\n", progname, |