Commit 4e6ce096 authored by Stan Seibert's avatar Stan Seibert

- Removed support for .ogg123rc. .libao should be used instead. Made this

more clear in the man page.
- Made explanation of WAV pipe problem more clear in man page.
- Fixed bug that caused ogg123 to crash if -f was used without specifying
a driver.

svn path=/trunk/vorbis-tools/; revision=1755
parent dea83147
......@@ -57,44 +57,3 @@ int add_option(ao_option ** op_h, const char *optstring)
return (result);
}
int get_default_device(void)
{
FILE *fp;
char filename[FILENAME_MAX];
char line[100];
char *device = NULL;
char *homedir = getenv("HOME");
int i;
/* Maybe I'm being extremely paranoid, but if ogg123 is ever suid
root (to access audio devices), this is a possible buffer overflow. */
if (homedir == NULL || strlen(homedir) >= FILENAME_MAX - 10)
return -1;
strncpy(filename, homedir, FILENAME_MAX);
strcat(filename, "/.ogg123rc");
fp = fopen(filename, "r");
/* if no ~/.ogg123rc can be found, try /etc/ogg123rc instead */
if (!fp) fp = fopen("/etc/ogg123rc", "r");
/* This is a very simplistic parser. If more options are ever added,
it will need a serious overhaul. */
if (fp) {
while (fgets(line, 100, fp)) {
if (strncmp(line, "default_device=", 15) == 0) {
device = &line[15];
for (i = 0; i < strlen(device); i++)
if (device[i] == '\n' || device[i] == '\r')
device[i] = 0;
}
}
fclose(fp);
}
if (device)
return ao_driver_id(device);
return -1;
}
......@@ -250,7 +250,7 @@ The use of
.B /etc/ogg123rc
and
.B ~/.ogg123rc
has been deprecated in favor of the configuration system provided by
has been removed in favor of the configuration system provided by
libao.
.SH FILES
......@@ -266,9 +266,11 @@ Per-user config file to override the system wide output device settings.
.SH BUGS
Note that there are issues with streaming WAV-format audio, so there
is no way to fix this properly. Use the raw or au output driver if you
need to use ogg123 in a pipe.
Piped WAV files may cause strange behavior in other programs. This is
because WAV files store the data length in the header. However, the
output driver does not know the length when it writes the header, and
there is no value that means "length unknown". Use the raw or au
output driver if you need to use ogg123 in a pipe.
.SH SEE ALSO
.BR libao.conf(5)
......
......@@ -14,7 +14,7 @@
* *
********************************************************************
last mod: $Id: ogg123.c,v 1.44 2001/08/07 21:37:50 volsung Exp $
last mod: $Id: ogg123.c,v 1.45 2001/08/12 14:04:21 volsung Exp $
********************************************************************/
......@@ -163,14 +163,19 @@ int main(int argc, char **argv)
current_options = &current->options;
break;
case 'f':
info = ao_driver_info(temp_driver_id);
if (info->type == AO_TYPE_FILE) {
free(current->filename);
if (temp_driver_id >= 0) {
info = ao_driver_info(temp_driver_id);
if (info->type == AO_TYPE_FILE) {
free(current->filename);
current->filename = strdup(optarg);
} else {
} else {
fprintf(stderr, "Driver %s is not a file output driver.\n",
info->short_name);
exit(1);
}
} else {
fprintf(stderr, "Cannot specify output file without specifying a driver.\n");
exit (1);
}
break;
case 'k':
......@@ -209,19 +214,16 @@ int main(int argc, char **argv)
}
/* Add last device to device list or use the default device */
if (temp_driver_id < 0)
temp_driver_id = ao_default_driver_id();
if (temp_driver_id < 0) {
temp_driver_id = get_default_device();
if(temp_driver_id < 0) {
temp_driver_id = ao_default_driver_id();
}
if (temp_driver_id < 0) {
fprintf(stderr,
"Could not load default driver and no ~/.ogg123rc found. Exiting.\n");
exit(1);
}
opt.outdevices = append_device(opt.outdevices, temp_driver_id,
temp_options, NULL);
fprintf(stderr,
"Could not load default driver. Audio devices may be already in use.\nExiting.\n");
exit(1);
}
opt.outdevices = append_device(opt.outdevices, temp_driver_id,
temp_options, NULL);
if (optind == argc) {
usage();
......
......@@ -43,7 +43,6 @@ devices_t *append_device(devices_t * devices_list, int driver_id,
void devices_write(void *ptr, size_t size, devices_t * d);
void usage(void);
int add_option(ao_option ** op_h, const char *optstring);
int get_default_device(void);
void play_file(ogg123_options_t opt);
int get_tcp_socket(void); /* Will be going soon. */
FILE *http_open(char *server, int port, char *path); /* ditto */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment