diff options
author | schwarz <schwarz@pkgsrc.org> | 2005-03-28 19:52:21 +0000 |
---|---|---|
committer | schwarz <schwarz@pkgsrc.org> | 2005-03-28 19:52:21 +0000 |
commit | 5c4f14268e80ce0f5d05f55b10478de040083def (patch) | |
tree | b818da7e03967ccf0e6233676dfbe0223616d49e /audio | |
parent | 14616f1b06be0cc5de76041b985acf4fa8998fe3 (diff) | |
download | pkgsrc-5c4f14268e80ce0f5d05f55b10478de040083def.tar.gz |
added support for "old" (i.e. pre-6.X) IRIX audio libraries.
(approved by recht and jschauma)
Diffstat (limited to 'audio')
-rw-r--r-- | audio/mpg123/distinfo | 3 | ||||
-rw-r--r-- | audio/mpg123/patches/patch-au | 157 |
2 files changed, 159 insertions, 1 deletions
diff --git a/audio/mpg123/distinfo b/audio/mpg123/distinfo index 1faf09b043d..c77896db955 100644 --- a/audio/mpg123/distinfo +++ b/audio/mpg123/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.22 2005/02/23 20:39:49 agc Exp $ +$NetBSD: distinfo,v 1.23 2005/03/28 19:52:21 schwarz Exp $ SHA1 (mpg123/mpg123-0.59r.tar.gz) = c32fe242f4506d218bd19a51a4034da9fdc79493 RMD160 (mpg123/mpg123-0.59r.tar.gz) = 17d47ca04fdcac5e2d71f95ccbd23b61b5ed8b3c @@ -26,3 +26,4 @@ SHA1 (patch-aq) = a993d815b6657b9a2241b2e3f0ba30d6c2861230 SHA1 (patch-ar) = e81771bf72da97d898f9320fb6c529e5a1151050 SHA1 (patch-as) = 8765b22c556cdc217f6270f3a5e70b40b36b9229 SHA1 (patch-at) = 9a64a62f7d1d115e3d36dbb0f08762d4b0eb1e2b +SHA1 (patch-au) = 02c480cbb6ff8ab904be93eaf319b43f4f02d588 diff --git a/audio/mpg123/patches/patch-au b/audio/mpg123/patches/patch-au new file mode 100644 index 00000000000..e09d2aa28a8 --- /dev/null +++ b/audio/mpg123/patches/patch-au @@ -0,0 +1,157 @@ +$NetBSD: patch-au,v 1.1 2005/03/28 19:52:21 schwarz Exp $ + +--- audio_sgi.c.orig 2005-03-07 13:54:23.000000000 +0100 ++++ audio_sgi.c 2005-03-07 13:54:27.000000000 +0100 +@@ -6,20 +6,48 @@ + + #include "mpg123.h" + ++#ifdef AL_RESOURCE /* as a test whether we use the "new" IRIX ++ audio libraries */ ++#define NEW_IRIX_AUDIO ++#define HAVE_ALGETERRORSTRING ++#else ++#define alClosePort(x) ALcloseport(x) ++#define alFreeConfig(x) ALfreeconfig(x) ++#define alGetFilled(x) ALgetfilled(x) ++#define alSetChannels(x,y) ALsetchannels(x,y) ++#define alSetQueueSize(x,y) ALsetqueuesize(x,y) ++#define alSetSampFmt(x,y) ALsetsampfmt(x,y) ++#define alSetWidth(x,y) ALsetwidth(x,y) ++#define alNewConfig() ALnewconfig() ++#define alOpenPort(x,y,z) ALopenport(x,y,z) ++#endif + + /* Analog output constant */ + static const char analog_output_res_name[] = ".AnalogOut"; + ++/* Routine to print a message to stderr; uses alGetErrorString(oserror) ++ if available */ ++ ++void errormessage(const char *message) ++{ ++#ifdef HAVE_ALGETERRORSTRING ++ fprintf(stderr,"%s : %s\n",message,alGetErrorString(oserror())); ++#else ++ fprintf(stderr,"%s error\n",message); ++#endif ++} + + int audio_open(struct audio_info_struct *ai) + { ++#ifdef NEW_IRIX_AUDIO + int dev = AL_DEFAULT_OUTPUT; ++#endif + + ai->config = alNewConfig(); + + /* Test for correct completion */ + if (ai->config == 0) { +- fprintf(stderr,"audio_open : %s\n",alGetErrorString(oserror())); ++ errormessage("audio_open"); + exit(-1); + } + +@@ -33,6 +61,8 @@ + alSetSampFmt(ai->config,AL_SAMPFMT_TWOSCOMP); + alSetQueueSize(ai->config, 131069); + ++#ifdef NEW_IRIX_AUDIO ++ + /* Setup output device to specified module. If there is no module + specified in ai structure, use the default four output */ + if ((ai->device) != NULL) { +@@ -61,15 +91,16 @@ + /* Set the device */ + if (alSetDevice(ai->config,dev) < 0) + { +- fprintf(stderr,"audio_open : %s\n",alGetErrorString(oserror())); ++ errormessage("audio_open"); + exit(-1); + } + ++#endif /* NEW_IRIX_AUDIO */ ++ + /* Open the audio port */ + ai->port = alOpenPort("mpg123-VSC", "w", ai->config); + if(ai->port == NULL) { +- fprintf(stderr, "Unable to open audio channel: %s\n", +- alGetErrorString(oserror())); ++ errormessage("Unable to open audio channel"); + exit(-1); + } + +@@ -99,22 +130,30 @@ + + int audio_set_rate(struct audio_info_struct *ai) + { ++#ifdef NEW_IRIX_AUDIO + int dev = alGetDevice(ai->config); + ALpv params[1]; ++#else ++ int dev; ++ long params[2] = {AL_OUTPUT_RATE, AL_RATE_44100}; ++ params[1] = ai->rate; ++ dev=ALsetparams(AL_DEFAULT_DEVICE, params, 2); ++#endif + + /* Make sure the device is OK */ + if (dev < 0) + { +- fprintf(stderr,"audio_set_rate : %s\n",alGetErrorString(oserror())); ++ errormessage("audio_set_rate"); + return 1; + } + ++#ifdef NEW_IRIX_AUDIO + params[0].param = AL_OUTPUT_RATE; + params[0].value.ll = alDoubleToFixed(ai->rate); + + if (alSetParams(dev, params,1) < 0) +- fprintf(stderr,"audio_set_rate : %s\n",alGetErrorString(oserror())); +- ++ errormessage("audio_set_rate"); ++#endif + return 0; + } + +@@ -128,7 +167,7 @@ + ret = alSetChannels(ai->config, AL_MONO); + + if (ret < 0) +- fprintf(stderr,"audio_set_channels : %s\n",alGetErrorString(oserror())); ++ errormessage("audio_set_channels"); + + return 0; + } +@@ -136,10 +175,10 @@ + int audio_set_format(struct audio_info_struct *ai) + { + if (alSetSampFmt(ai->config,AL_SAMPFMT_TWOSCOMP) < 0) +- fprintf(stderr,"audio_set_format : %s\n",alGetErrorString(oserror())); ++ errormessage("audio_set_format"); + + if (alSetWidth(ai->config,AL_SAMPLE_16) < 0) +- fprintf(stderr,"audio_set_format : %s\n",alGetErrorString(oserror())); ++ errormessage("audio_set_format"); + + return 0; + } +@@ -153,9 +192,17 @@ + int audio_play_samples(struct audio_info_struct *ai,unsigned char *buf,int len) + { + if(ai->format == AUDIO_FORMAT_SIGNED_8) ++#ifdef NEW_IRIX_AUDIO + alWriteFrames(ai->port, buf, len>>1); ++#else ++ ALwritesamps(ai->port, buf, len); ++#endif + else ++#ifdef NEW_IRIX_AUDIO + alWriteFrames(ai->port, buf, len>>2); ++#else ++ ALwritesamps(ai->port, buf, len>>1); ++#endif + + return len; + } |