[xiph-cvs] cvs commit: vorbis-tools/ogg123 ogg123rc-example ogg123.c

Jack Moffitt jack at icecast.org
Mon Oct 30 19:21:34 PST 2000



> Is that constant guaranteed to be there? curious.

I believe so, at least on unix.  It's defined in unistd.h i think.

> > +	strncpy(filename, getenv("HOME"), NAME_MAX);
> > +	strcat(filename, "/.ogg123rc");
> 
> Remember, ogg123's goal is not to be Unix-specific. This should be ifdef'ed
> or something (yes, the horror!)

Heh.  When you have a win32 libao module I'll care :)

> > +
> > +	fp = fopen(filename, "r");
> > +	if (fp) {
> > +		if (fgets(line, 100, fp)) {
> > +			if (strncmp(line, "default_device=", 15) == 0) {
> 
> This should be more extensible... I don't know what to, though. Perhaps if
> libao is going to be used in other projects, it should be managing its own
> default device in an rc file?

Maybe, i figured different apps might have different preferences.  Ie,
you might have something that always used the wav driver.  

No it's not extensible, but it works for now.  It should theoretically
search every line in the file :)

> > +	if (device) {
> > +		fprintf(stderr, "device short name = %s\n", device);
> > +		fprintf(stderr, "device_id is = %d\n", ao_get_driver_id(device));
> > +		return ao_get_driver_id(device);
> 
> It's not clear here ... are you checking the return value of this function?
> 
> > +	}
> > +
> > +	return -1;
> 
> Ditto... but there should be at least 2 return values: one for an invalid
> default device, and one for no default device.

ack.. i didn't know those printf's got committed... damn me!

-1 is an invalid device.  Why do you care? :)
We could easily do 

#define AO_EBADDEVICE -1
#define AO_NODEFAULT -2

is that what you want? :)

jack.

--- >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 'cvs-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 commits mailing list