From owner-freebsd-multimedia Tue Feb 22 11:23:27 2000 Delivered-To: freebsd-multimedia@freebsd.org Received: from kumr.lns.com (kumr.lns.com [140.174.7.1]) by hub.freebsd.org (Postfix) with ESMTP id B1F3237B781 for ; Tue, 22 Feb 2000 11:23:21 -0800 (PST) (envelope-from pozar@kumr.lns.com) Received: (from pozar@localhost) by kumr.lns.com (8.9.3/8.9.3) id LAA70677; Tue, 22 Feb 2000 11:24:36 -0800 (PST) (envelope-from pozar) Date: Tue, 22 Feb 2000 11:24:36 -0800 From: Tim Pozar To: Thomas Runge Cc: multimedia@FreeBSD.ORG Subject: Re: API for the bk848 driver Message-ID: <20000222112436.A70343@lns.com> References: <20000207212734.A65913@lns.com> <389FAAA8.EBE87E1@cs.strath.ac.uk> <20000207221041.A66557@lns.com> <389FC9D5.B2D3E98A@rostock.zgdv.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <389FC9D5.B2D3E98A@rostock.zgdv.de>; from runge@rostock.zgdv.de on Tue, Feb 08, 2000 at 08:46:29AM +0100 Sender: owner-freebsd-multimedia@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Tue, Feb 08, 2000 at 08:46:29AM +0100, Thomas Runge wrote: > Tim Pozar wrote: > > I looked at the meteor man page and it describes capturing video > > but it doesn't address the tuner. I am looking for info on the > > radio tuner in cards like the Hauppauge WinTV-radio (model 401). > > Well, there is no book "Programming the FM tuner of TV cards > using FreeBSD" ;-) > What we have are the sources. And some programs that already use > the radio part, like xmradio. > > Look into /sys/dev/bktr, http://vulture.dmem.strath.ac.uk/bt848/ , > especially ftp://vulture.dmem.strath.ac.uk/pub/bt848/spec > and maybe into xmradio: http://www.rostock.zgdv.de/~runge/radio Thanks for the pointer folks. The reason for all of this, I have a number of boxes out there that do MP3 streaming of FM stations and wanted them to start to stream from a boot and not have to rely on an Xwindows application to open the tuner and set the frequency. To that I have this simple program now... Tim -- /* * * TUNERADIO * * Opens the the tuner device (ie. /dev/tuner) sets the frequency, * stereo/mono and AFC modes. It then sits in a while loop to * keep the device open. * * I needed this program to run on remote computers that stream * MP3 streams out to the net of radio stations. This program * assumes the Brooktree 848 card and interface for *BSD. * * Copyright (C) 2000 Timothy Pozar pozar@lns.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id: tuneradio.c,v 1.2 2000/02/22 19:20:02 pozar Exp $ * */ #include #include #include #include #include #define TRUE 1 #define FALSE 0 #define BUF_SIZE 4096 char device[BUF_SIZE] = "/dev/tuner"; int mono = FALSE; int afc = FALSE; int frequency = 8850; /* 8850 = 88.5Mhz */ int devfh; int main(argc,argv) int argc; char *argv[]; { int gotmask, setmask, gotfreq, setfreq, i; /* scan command line arguments, and look for files to work on. */ for (i = 1; i < argc; i++) { switch (argv[i][1]){ /* be case indepenent... */ case 'A': /* Run with AFC... */ case 'a': afc = TRUE; break; case 'D': /* dsp file name... */ case 'd': i++; strncpy(device,argv[i],BUF_SIZE); break; case 'F': /* Frequency in 10 KHz... */ case 'f': i++; frequency = atoi(argv[i]); if((frequency < 8800) || (frequency > 10800)){ printf("Frequency %i is out of range of 8800 to 10800\n",frequency); exit(1); } break; case 'H': /* Help... */ case 'h': banner(); exit(0); case 'M': /* Run in mono... */ case 'm': mono = TRUE; break; default: printf("I don't know the meaning of the command line argument: \"%s\".\n",argv[i]); banner(); exit(1); } } if((devfh = open(device, O_RDONLY)) == -1){ perror("opening dsp device"); exit(1); } /* What state is the tuner in now? */ if(ioctl(devfh, RADIO_GETMODE, &gotmask) == -1){ perror("get dsp mask"); exit(1); } setmask = gotmask; if(mono) setmask |= RADIO_MONO; else setmask &= ~RADIO_MONO; if(afc) setmask |= RADIO_AFC; else setmask &= ~RADIO_AFC; if(ioctl(devfh, RADIO_SETMODE, &setmask) == -1){ perror("set mode"); exit(1); } if(ioctl(devfh, RADIO_SETFREQ, &frequency) == -1){ perror("set frequency"); exit(1); } while(1){} exit(0); } banner() { printf("tuneradio: Set \"%s\" frequency, AFC and stereo/mono mode,\n",device); printf(" and then keep the tuner open.\n"); printf(" -a Sets tuner to run with AFC. Default is off.\n"); printf(" -d device Sets device name for the tuner. Default is \"%s\".\n",device); printf(" -f frequency Sets tuner frequency (10Khz ie 88.1Mhz = 8810).\n"); printf(" Default is \"%i\".\n",frequency); printf(" -m Sets tuner to run in mono. Default is stereo.\n"); return; } -- Snail: Tim Pozar / LNS / 1978 45th Ave / San Francisco CA 94116 / USA POTS: +1 415 665 3790 Radio: KC6GNJ / KAE6247 "It's a damn poor mind that can only think of one way to spell a word." - Andrew Jackson "What is wanted is not the will to believe, but the will to find out, which is the exact opposite." - Bertrand Russel To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-multimedia" in the body of the message