From 65169c7eb995bacf838727d38ae6609a35ae512c Mon Sep 17 00:00:00 2001 From: naddy Date: Thu, 30 Oct 2008 14:46:59 +0000 Subject: [PATCH] * In the usage message, show the actually available libao devices. * Allow -o sun to override the default libao device. --- audio/mpg321/Makefile | 6 +-- audio/mpg321/patches/patch-ao_c | 12 +++++ audio/mpg321/patches/patch-mpg321_c | 79 +++++++++++++++++++++++++---- 3 files changed, 84 insertions(+), 13 deletions(-) create mode 100644 audio/mpg321/patches/patch-ao_c diff --git a/audio/mpg321/Makefile b/audio/mpg321/Makefile index 200f22308be..b87b7d8b7b9 100644 --- a/audio/mpg321/Makefile +++ b/audio/mpg321/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.19 2007/07/21 15:33:22 naddy Exp $ +# $OpenBSD: Makefile,v 1.20 2008/10/30 14:46:59 naddy Exp $ # not very useful with static libao SHARED_ONLY= Yes @@ -6,13 +6,13 @@ SHARED_ONLY= Yes COMMENT= free clone of mpg123, a command-line mp3 player DISTNAME= mpg321-0.2.10 -PKGNAME= ${DISTNAME}p1 +PKGNAME= ${DISTNAME}p2 CATEGORIES= audio HOMEPAGE= http://mpg321.sourceforge.net/ MAINTAINER= Christian Weisgerber -# GPL +# GPLv2 PERMIT_PACKAGE_CDROM= Yes PERMIT_PACKAGE_FTP= Yes PERMIT_DISTFILES_CDROM= Yes diff --git a/audio/mpg321/patches/patch-ao_c b/audio/mpg321/patches/patch-ao_c new file mode 100644 index 00000000000..340aafb9952 --- /dev/null +++ b/audio/mpg321/patches/patch-ao_c @@ -0,0 +1,12 @@ +$OpenBSD: patch-ao_c,v 1.1 2008/10/30 14:46:59 naddy Exp $ +--- ao.c.orig Thu Oct 30 15:41:11 2008 ++++ ao.c Thu Oct 30 15:41:26 2008 +@@ -94,7 +94,7 @@ void check_ao_default_play_device() + void check_default_play_device() + { + /* check that no output devices are currently selected */ +- if (!(options.opt & (MPG321_USE_OSS | MPG321_USE_STDOUT | MPG321_USE_ALSA | MPG321_USE_ESD ++ if (!(options.opt & (MPG321_USE_OSS | MPG321_USE_SUN | MPG321_USE_STDOUT | MPG321_USE_ALSA | MPG321_USE_ESD + | MPG321_USE_NULL | MPG321_USE_WAV | MPG321_USE_ARTS | MPG321_USE_AU + | MPG321_USE_CDR | MPG321_USE_ALSA09 | MPG321_USE_USERDEF))) + { diff --git a/audio/mpg321/patches/patch-mpg321_c b/audio/mpg321/patches/patch-mpg321_c index adb24ccec61..f1ef6914b77 100644 --- a/audio/mpg321/patches/patch-mpg321_c +++ b/audio/mpg321/patches/patch-mpg321_c @@ -1,7 +1,48 @@ -$OpenBSD: patch-mpg321_c,v 1.5 2007/07/21 15:33:22 naddy Exp $ +$OpenBSD: patch-mpg321_c,v 1.6 2008/10/30 14:46:59 naddy Exp $ --- mpg321.c.orig Sun Mar 24 06:49:20 2002 -+++ mpg321.c Sat Jul 21 16:36:41 2007 -@@ -188,7 +188,7 @@ static int show_id3(struct id3_tag const *tag) ++++ mpg321.c Thu Oct 30 14:48:54 2008 +@@ -75,9 +75,15 @@ void mpg321_error(char *file) + + void usage(char *argv0) + { ++ ao_info **devices; ++ int i, driver_count; ++ ++ devices = ao_driver_info_list(&driver_count); ++ + mpg123_boilerplate(); + fprintf(stderr, +- "\nUsage: %s [options] file(s) | URL(s) | -\n\n" ++ "\nUsage: %s [options] file(s) | URL(s) | -\n\n", argv0); ++ fprintf(stderr, + "Options supported:\n" + " --verbose or -v Increase verbosity\n" + " --quiet or -q Quiet mode (no title or boilerplate)\n" +@@ -85,7 +91,13 @@ void usage(char *argv0) + " --skip N or -k N Skip N frames into the file\n" + " --verbose or -v Be more verbose in playing files\n" + " -o dt Set output devicetype to dt\n" +- " [esd,alsa(09),arts,sun,oss]\n" ++ " ("); ++ for (i = 0; i < driver_count; i++) { ++ fprintf(stderr, "%s%s", devices[i]->short_name, ++ (i + 1 < driver_count) ? ", " : ""); ++ } ++ fprintf(stderr, ++ ")\n" + " --audiodevice N or -a N Use N for audio-out\n" + " --stdout or -s Use stdout for audio-out\n" + " --au N Use au file N for output\n" +@@ -101,7 +113,7 @@ void usage(char *argv0) + " --version or -V Print version information\n" + "\n" + "This version of mpg321 has been configured with " AUDIO_DEFAULT " as its default\n" +- "libao output device.\n" , argv0); ++ "libao output device.\n"); + } + + /* retsigtype is defined by configure; +@@ -188,7 +200,7 @@ static int show_id3(struct id3_tag const *tag) else { @@ -10,7 +51,7 @@ $OpenBSD: patch-mpg321_c,v 1.5 2007/07/21 15:33:22 naddy Exp $ free(names[i]); } } -@@ -203,7 +203,7 @@ static int show_id3(struct id3_tag const *tag) +@@ -203,7 +215,7 @@ static int show_id3(struct id3_tag const *tag) if (!names[i]) { fprintf (stderr, emptystring); } else { @@ -19,7 +60,25 @@ $OpenBSD: patch-mpg321_c,v 1.5 2007/07/21 15:33:22 naddy Exp $ free (names[i]); } if (i%2) fprintf (stderr, "\n"); -@@ -285,6 +285,8 @@ int main(int argc, char *argv[]) +@@ -239,6 +251,8 @@ int main(int argc, char *argv[]) + + status = MPG321_PLAYING; + ++ ao_initialize(); ++ + /* Get the command line options */ + parse_options(argc, argv, pl); + +@@ -257,8 +271,6 @@ int main(int argc, char *argv[]) + if (shuffle_play) + shuffle_files(pl); + +- ao_initialize(); +- + check_default_play_device(); + + if (!(options.opt & MPG321_REMOTE_PLAY)) +@@ -285,6 +297,8 @@ int main(int argc, char *argv[]) signal(SIGINT, SIG_DFL); playbuf.buf = NULL; @@ -28,7 +87,7 @@ $OpenBSD: patch-mpg321_c,v 1.5 2007/07/21 15:33:22 naddy Exp $ playbuf.fd = -1; playbuf.length = 0; playbuf.done = 0; -@@ -410,12 +412,14 @@ int main(int argc, char *argv[]) +@@ -410,12 +424,14 @@ int main(int argc, char *argv[]) if(fstat(fd, &stat) == -1) { @@ -43,7 +102,7 @@ $OpenBSD: patch-mpg321_c,v 1.5 2007/07/21 15:33:22 naddy Exp $ continue; } -@@ -432,6 +436,7 @@ int main(int argc, char *argv[]) +@@ -432,6 +448,7 @@ int main(int argc, char *argv[]) if((playbuf.buf = mmap(0, playbuf.length, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED) { @@ -51,7 +110,7 @@ $OpenBSD: patch-mpg321_c,v 1.5 2007/07/21 15:33:22 naddy Exp $ mpg321_error(currentfile); continue; } -@@ -509,9 +514,6 @@ int main(int argc, char *argv[]) +@@ -509,9 +526,6 @@ int main(int argc, char *argv[]) mad_decoder_finish(&decoder); @@ -61,7 +120,7 @@ $OpenBSD: patch-mpg321_c,v 1.5 2007/07/21 15:33:22 naddy Exp $ if (playbuf.frames) free(playbuf.frames); -@@ -521,6 +523,7 @@ int main(int argc, char *argv[]) +@@ -521,6 +535,7 @@ int main(int argc, char *argv[]) if (playbuf.fd == -1) { munmap(playbuf.buf, playbuf.length); @@ -69,7 +128,7 @@ $OpenBSD: patch-mpg321_c,v 1.5 2007/07/21 15:33:22 naddy Exp $ } else -@@ -535,10 +538,6 @@ int main(int argc, char *argv[]) +@@ -535,10 +550,6 @@ int main(int argc, char *argv[]) ao_close(playdevice); ao_shutdown();