Use patches supplied by Andrew Hobgood in pkg/12159 to support NetBSD's

native audio system instead of liboss emulation.
Fix PLIST while I'm here.
This commit is contained in:
wiz 2001-05-05 10:05:34 +00:00
parent f4141cd9fb
commit f8ed6311b0
6 changed files with 228 additions and 29 deletions

View file

@ -1,12 +1,12 @@
$NetBSD: distinfo,v 1.2 2001/04/18 12:14:33 agc Exp $
$NetBSD: distinfo,v 1.3 2001/05/05 10:05:34 wiz Exp $
SHA1 (liveice-0.20001121/liveice.tar.gz) = 029657129e98d837e3c978885cfb52772d4551c9
Size (liveice-0.20001121/liveice.tar.gz) = 85171 bytes
SHA1 (patch-aa) = ac203f84011c1c7d2d0212f74612975620802b53
SHA1 (patch-ab) = f51d021070c6cc2d1d7ff45d3b08433ab02c6ae9
SHA1 (patch-ac) = 4c34e79b391a9ab5feb3323cd1a44951ac25628a
SHA1 (patch-aa) = 367d7fa0b9cc20420814dad2db398a0f84b04982
SHA1 (patch-ab) = ced8f48ce395f93d7322ef756feb28614664b7b5
SHA1 (patch-ac) = 60963cab7c823e81170e64dfaee074845aa8f0cc
SHA1 (patch-ad) = 0747e01148f1aa5fa72bc3262e3fbbd0c9118dca
SHA1 (patch-ae) = 4ab165f7780732e2e3c0aa5201126a93004de070
SHA1 (patch-ae) = 1b6655761340f2dc894f5f837e9b07d56584e470
SHA1 (patch-af) = 1eff5e733457accfeb298eb314cbaf21cbdecde0
SHA1 (patch-ag) = afd356eb44cbfef37c32a2bc92bc3cea155b0a67
SHA1 (patch-ah) = 58be03b1970f8ebe2f32936bef9c1989342aed2d

View file

@ -1,8 +1,8 @@
$NetBSD: patch-aa,v 1.1.1.1 2000/11/21 06:01:49 hubertf Exp $
$NetBSD: patch-aa,v 1.2 2001/05/05 10:05:34 wiz Exp $
--- liveice.h.orig Tue Nov 21 03:29:51 2000
--- liveice.h.orig Wed May 24 15:49:56 2000
+++ liveice.h
@@ -39,7 +39,9 @@
@@ -39,11 +39,16 @@
#include <signal.h>
#include <netdb.h>
#include <arpa/inet.h>
@ -12,3 +12,32 @@ $NetBSD: patch-aa,v 1.1.1.1 2000/11/21 06:01:49 hubertf Exp $
#include <unistd.h>
#include <termios.h>
#include <sys/wait.h>
#include <ctype.h>
+#ifdef __NetBSD__
+#include <sys/audioio.h>
+#endif
/* curses interface support */
@@ -268,6 +273,10 @@
char *recording_file;
char *remote_dumpfile;
char *sound_input_file; /* the file to read sound input from */
+#ifdef __NetBSD__
+ char *netbsd_audio_file;
+ char *netbsd_audioctl_file;
+#endif /* __NetBSD__ */
char *random_content_id;
char *encoder_args;
int sound_device; /* set to 1 if the sound file is a device */
@@ -278,6 +287,10 @@
int sample_rate;
int stereo;
int audio_fd; /* only one soundcard - only one audiofd */
+#ifdef __NetBSD__
+ int audioctl_fd;
+ audio_info_t ctlrestore;
+#endif /* __NetBSD__ */
int full_duplex;
int soundcard; /* Are we using the soundcard? */
char *decoder_cmd;

View file

@ -1,16 +1,135 @@
$NetBSD: patch-ab,v 1.1.1.1 2000/11/21 06:01:49 hubertf Exp $
$NetBSD: patch-ab,v 1.2 2001/05/05 10:05:34 wiz Exp $
--- streams.c.orig Tue Nov 21 03:30:12 2000
--- streams.c.orig Tue May 23 20:08:00 2000
+++ streams.c
@@ -36,7 +36,11 @@
#ifdef HAVE_SYS_SOUNDCARD_H
#include <sys/soundcard.h>
#else
+#ifdef __NetBSD__
+#include <soundcard.h>
+#include <sys/audioio.h>
+#else
#include <machine/soundcard.h>
+#endif /* __NetBSD__ */
#endif
#endif
#include <sys/ioctl.h>
@@ -77,11 +81,23 @@
{
int format,stereo,speed,caps;
#ifdef SOUNDCARD_SUPPORT
+
+#ifdef __NetBSD__
+ audio_info_t ctlinfo;
+#endif /* __NetBSD__ */
+
fprintf(stderr,"Initialising Soundcard\n");
+#ifdef __NetBSD__
+ if((g_conf.audioctl_fd=open(g_conf.netbsd_audioctl_file,O_RDWR))==-1)
+ fatal("Failed to open audioctl device");
+ if((g_conf.audio_fd=open(g_conf.netbsd_audio_file,O_RDONLY))==-1)
+#else
if((g_conf.audio_fd=open(g_conf.sound_input_file,O_RDWR))==-1)
+#endif /* __NetBSD__ */
fatal("Failed to open sound device");
+#ifndef __NetBSD__
/* see if the card can do full_duplex */
if(g_conf.full_duplex){
ioctl(g_conf.audio_fd, SNDCTL_DSP_GETCAPS, &caps);
@@ -97,7 +113,33 @@
g_conf.full_duplex=0;
}
}
+#endif /* __NetBSD__ */
+#ifdef __NetBSD__
+ if(ioctl(g_conf.audioctl_fd, AUDIO_GETINFO, &(g_conf.ctlrestore)) < 0)
+ fatal("ioctl(AUDIO_GETINFO) failed");
+
+ /* in theory, we should pull ctlrestore.record.buffer_size and use
+ that to malloc() our audio buffer, but in practice, this has
+ shown to be unneccesary. This will minimize impact to the
+ original source and reduce the amount of patching we need.
+ */
+
+ /* somewhere in here, we should be able to check/set full duplex,
+ but I don't know enough about the internals of this driver yet.
+ */
+ g_conf.full_duplex = 0;
+
+ AUDIO_INITINFO(&ctlinfo);
+ ctlinfo.record.sample_rate = g_conf.sample_rate;
+ ctlinfo.record.channels = (g_conf.stereo ? 2 : 1);
+ ctlinfo.record.precision = 16;
+ ctlinfo.record.encoding = AUDIO_ENCODING_SLINEAR_LE;
+ ctlinfo.mode = AUMODE_RECORD;
+
+ if(ioctl(g_conf.audioctl_fd, AUDIO_SETINFO, &ctlinfo) < 0)
+ fatal("ioctl(AUDIO_SETINFO) failed");
+#else
ioctl(g_conf.audio_fd, SNDCTL_DSP_GETFMTS, &format);
if(!(format&AFMT_S16_LE))
fatal("16bit mode not supported by driver");
@@ -113,6 +155,7 @@
speed=g_conf.sample_rate;
if(ioctl(g_conf.audio_fd,SNDCTL_DSP_SPEED,&speed)==-1)
fatal("Speed Setting failed\n");
+#endif /* __NetBSD__ */
fprintf(stderr,"16Bit %dHz ",g_conf.sample_rate);
@@ -121,8 +164,10 @@
if(g_conf.full_duplex)
fprintf(stderr,"Full Duplex ");
fprintf(stderr,"\n");
+#ifndef __NetBSD__
close(g_conf.audio_fd);
g_conf.audio_fd=0;
+#endif /* __NetBSD__ */
#else
write_message("This executable Doesn't Support Soundcards",0);
#endif
@@ -136,9 +181,10 @@
#ifdef SOUNDCARD_SUPPORT
write_message("Opening Soundcard",1);
+#ifndef __NetBSD__
if((g_conf.audio_fd=open(g_conf.sound_input_file,flags))==-1)
fatal("Failed to open sound device");
-
+
if(g_conf.full_duplex)
#ifdef HAVE_SYS_SOUNDCARD_H
ioctl(g_conf.audio_fd, SNDCTL_DSP_SETDUPLEX, 0);
@@ -157,6 +203,7 @@
speed=g_conf.sample_rate;
if(ioctl(g_conf.audio_fd,SNDCTL_DSP_SPEED,&speed)==-1)
fatal("Speed Setting failed\n");
+#endif /* __NetBSD__ */
#else
write_message("This executable Doesn't Support Soundcards",0);
#endif
@@ -166,8 +213,21 @@
{
#ifdef SOUNDCARD_SUPPORT
write_message("Closing Soundcard",1);
+#ifdef __NetBSD__
+ close(g_conf.audio_fd);
+
+ /* In theory, we should reset the device. In practice, this
+ segfaults. I haven't figured out why.
+
+ if(ioctl(g_conf.audioctl_fd, AUDIO_SETINFO, &(g_conf.ctlrestore)) < 0)
+ fatal("ioctl(AUDIO_SETINFO) failed");
+ */
+
+ close(g_conf.audioctl_fd);
+#else
ioctl(g_conf.audio_fd, SNDCTL_DSP_RESET, 0);
close(g_conf.audio_fd);
+#endif /* __NetBSD__ */
#else
write_message("This executable Doesn't Support Soundcards",0);
#endif

View file

@ -1,14 +1,35 @@
$NetBSD: patch-ac,v 1.1.1.1 2000/11/21 06:01:49 hubertf Exp $
$NetBSD: patch-ac,v 1.2 2001/05/05 10:05:34 wiz Exp $
--- Makefile.in.orig Tue Nov 21 03:31:42 2000
+++ Makefile.in
@@ -1,6 +1,9 @@
CC = @CC@
CFLAGS = @CFLAGS@
LDFLAGS = @LIBS@
+.if ${OPSYS} == "NetBSD"
+LDFLAGS+= -lossaudio # Not needed on Solaris
+.endif
SHELL=/bin/sh
srcdir = @srcdir@
--- README.NetBSD.orig Sat May 5 12:00:35 2001
+++ README.NetBSD
@@ -0,0 +1,30 @@
+I've patched this to handle the NetBSD audio driver natively.
+
+Therefore, there are some new config variables which you have to worry
+about if you intend to use the soundcard-based streaming features.
+
+# SOUND_DEVICE /dev/sound
+
+SOUND_DEVICE is no longer used when compiling under NetBSD.
+
+Instead:
+
+NETBSD_AUDIO_FILE /dev/audio0
+NETBSD_AUDIOCTL_FILE /dev/audioctl0
+
+Or something of that nature should be used.
+
+=== Last Updated: 09 February 2001
+=== Andrew Hobgood <chaos@strange.net>
+
+This has been tested on NetBSD-current (1.5 cvs 06 Feb 2001) with my SB
+AWE64 Gold ISA.
+
+NetBSD schizo 1.5 NetBSD 1.5 (SCHIZO) #4: Tue Feb 6 13:40:31 EST 2001 root@schizo:/usr/src/sys/arch/alpha/compile/SCHIZO alpha
+
+isapnp0: read port 0x203
+sb0 at isapnp0 port 0x220/16,0x330/2,0x388/4 irq 5 drq 1,5
+sb0: Creative SB AWE64 Gold Audio: dsp v4.16
+audio0 at sb0: full duplex, mmap, independent
+isapnp0: <Creative SB AWE64 Gold, CTL7002, PNPB02F, Game> port 0x200/8 not configured
+isapnp0: <Creative SB AWE64 Gold, CTL0023, , WaveTable> port 0x620/4 not configured

View file

@ -1,20 +1,22 @@
$NetBSD: patch-ae,v 1.1.1.1 2000/11/21 06:01:49 hubertf Exp $
$NetBSD: patch-ae,v 1.2 2001/05/05 10:05:34 wiz Exp $
--- setup.c.orig Wed May 24 15:50:02 2000
+++ setup.c
@@ -38,7 +38,11 @@
@@ -38,7 +38,13 @@
char default_mountpoint[] = "liveice";
char default_description[] = "LiveIce";
char default_pipe_directory[] = ".liveice_temp_files";
+#ifdef __NetBSD__
+char default_sound_input_file[] = "/dev/sound";
+char default_sound_input_file[] = "/dev/audio";
+char default_netbsd_audio_file[] = "/dev/audio";
+char default_netbsd_audioctl_file[] = "/dev/audioctl";
+#else
char default_sound_input_file[] = "/dev/dsp";
+#endif
/* default encoder commands */
char AJ_encoder_command[] = "encoder";
@@ -46,7 +50,7 @@
@@ -46,7 +52,7 @@
char MP3ENC_encoder_command[] = "mp3enc";
char SCREAMER_encoder_command[] = "lamer";
char XING_encoder_command[] = "xingmp3enc";
@ -23,3 +25,30 @@ $NetBSD: patch-ae,v 1.1.1.1 2000/11/21 06:01:49 hubertf Exp $
char GOGO_encoder_command[] = "gogo";
static int in_stream_set;
@@ -244,6 +250,13 @@
g_conf.sound_input_file=malloc(strlen(default_sound_input_file)+2);
strcpy(g_conf.sound_input_file,default_sound_input_file);
+#ifdef __NetBSD__
+ g_conf.netbsd_audio_file=malloc(strlen(default_netbsd_audio_file)+2);
+ strcpy(g_conf.netbsd_audio_file,default_netbsd_audio_file);
+
+ g_conf.netbsd_audioctl_file=malloc(strlen(default_netbsd_audioctl_file)+2);
+ strcpy(g_conf.netbsd_audioctl_file,default_netbsd_audioctl_file);
+#endif
g_conf.icy_public=1;
g_conf.bitrate=BITRATE;
@@ -407,6 +420,12 @@
string_copy(&(g_conf.update_script),line);
} else if(!strcmp(cmd,"URL")) {
string_copy(&(g_conf.icy_url),line);
+#ifdef __NetBSD__
+ } else if(!strcmp(cmd,"NETBSD_AUDIO_FILE")) {
+ string_copy(&(g_conf.netbsd_audio_file),line);
+ } else if(!strcmp(cmd,"NETBSD_AUDIOCTL_FILE")) {
+ string_copy(&(g_conf.netbsd_audioctl_file),line);
+#endif
} else if(!strcmp(cmd,"MIXER_CMD")) {
string_copy(&g_conf.mixer_cmd,line);
g_conf.mixer=COMMAND_MODE;

View file

@ -1,4 +1,4 @@
@comment $NetBSD: PLIST,v 1.1.1.1 2000/11/21 06:01:49 hubertf Exp $
@comment $NetBSD: PLIST,v 1.2 2001/05/05 10:05:34 wiz Exp $
bin/liveice
bin/liveiceconfigure.tk
share/doc/liveice/README.frontend
@ -6,3 +6,4 @@ share/doc/liveice/README.liveice
share/doc/liveice/README.quickstart
share/doc/liveice/README.xingmp3enc
share/doc/liveice/README_new_mixer.txt
@dirrm share/doc/liveice