[vorbis-dev] Patch for ogg123 (default devices)

Kenneth C. Arnold kcarnold at arnoldnet.net
Wed Nov 8 17:36:14 PST 2000



On Wed, Nov 08, 2000 at 09:34:38PM +0100, Nils Philippsen wrote:
> Hi there,
> 
> I've got another one (this time no real bug). The attached patch lets
> ogg123 choose a sensible default device if the user hasn't chosen one by
> her/himself or hans't set it in ~/.ogg123rc. At the moment the order in
> which devices will be tried is
> 
> 1. ~/.ogg123rc
> 2. esd (libesd will use oss if no esd is running)
> 3. oss
> 
> ESD and OSS are the only real targets (I don't count null and wav as
> sensible) I have here, so feel free to enhance :-).

Quick scan looks ok, too busy to commit right now.

Alsa driver needs fixing for latest CVS. If you annoy me long enough about
it I might actually have a whack at it, which should be frightening enough
for somebody more experienced to try. And I found a message from back in
June of an ogg123 port to Windows; I'm working on putting that into the
ao framework. dlopen is going to be a problem there, though... it'll probably
have to be statically linked. I'll get all that stuff resolved when I don't
have hours of homework in front of me.

> PS: I'm on the list now.
> 
> Nils
> -- 
>          Nils Philippsen / +49.711.96437.250 / nils at redhat.de
>        Red Hat GmbH / Hauptstätter Straße 58 / D70178 Stuttgart
> The use of COBOL cripples the mind; its teaching should, therefore, be
> regarded as a criminal offence.                  -- Edsger W. Dijkstra

> --- vorbis-tools-1.0beta3/ogg123/ogg123.c.defaultdevice	Sat Nov  4 07:23:21 2000
> +++ vorbis-tools-1.0beta3/ogg123/ogg123.c	Wed Nov  8 21:30:14 2000
> @@ -175,6 +175,12 @@
>  	char filename[NAME_MAX];
>  	char line[100];
>  	char *device = NULL;
> +	char *devices[] = {
> +		NULL,
> +		"esd",
> +		"oss"
> +	};
> +	const int num_devices = sizeof (devices) / sizeof (devices[0]);
>  	int i;
>  
>  	strncpy(filename, getenv("HOME"), NAME_MAX);
> @@ -193,7 +199,13 @@
>  		fclose(fp);
>  	}
>  
> -	if (device) return ao_get_driver_id(device);
> +	devices[0] = device;
> +
> +	for (i=0; i<num_devices; i++) {
> +		int id=ao_get_driver_id(devices[i]);

I'm assuming ao_get_driver_id(NULL) < 0? Or am I understanding what
you're trying to do incorrectly?

> +		if (i>0)
> +			return id;
> +	}
>  
>  	return -1;
>  }
> @@ -207,6 +219,7 @@
>    int option_index = 1;
>    ao_option_t *temp_options = NULL;
>    int temp_driver_id = -1;
> +  int driver_chosen = 0;
>    devices *current;
>    int bits, rate, channels;
>  
> @@ -226,11 +239,12 @@
>  	case 'd':
>  	  /* Need to store previous device before gathering options for
>  	     this device */
> -	  if (temp_driver_id != -1)
> +	  if (driver_chosen)
>  	    {
>  	      append_device(&param.outdevices, temp_driver_id, temp_options);
>  	      temp_options = NULL;
>  	    }
> +	  driver_chosen = 1;
>  	  temp_driver_id = ao_get_driver_id(optarg);
>  	  if (temp_driver_id < 0)
>  	    {


-- 
Kenneth Arnold <ken at arnoldnet.net> / kcarnold / Linux user #180115
http://arnoldnet.net/~kcarnold/

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.




More information about the Vorbis-dev mailing list