use MSTRZ suboption type

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14540 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2005-01-19 17:18:25 +00:00
parent ca8fc9929b
commit 64489b4d0c
1 changed files with 3 additions and 12 deletions

View File

@ -80,27 +80,18 @@ static int control(int cmd,void *arg){
// return: 1=success 0=fail // return: 1=success 0=fail
static int init(int rate,int channels,int format,int flags){ static int init(int rate,int channels,int format,int flags){
int bits; int bits;
strarg_t file;
opt_t subopts[] = { opt_t subopts[] = {
{"waveheader", OPT_ARG_BOOL, &ao_pcm_waveheader, NULL}, {"waveheader", OPT_ARG_BOOL, &ao_pcm_waveheader, NULL},
{"file", OPT_ARG_STR, &file, NULL}, {"file", OPT_ARG_MSTRZ, &ao_outputfilename, NULL},
{NULL} {NULL}
}; };
// set defaults // set defaults
ao_pcm_waveheader = 1; ao_pcm_waveheader = 1;
file.str = NULL; ao_outputfilename =
file.len = 0; strdup((ao_pcm_waveheader)?"audiodump.wav":"audiodump.pcm");
if (subopt_parse(ao_subdevice, subopts) != 0) { if (subopt_parse(ao_subdevice, subopts) != 0) {
return 0; return 0;
} }
if (file.len > 0) {
ao_outputfilename = malloc(file.len + 1);
memcpy(ao_outputfilename, file.str, file.len);
ao_outputfilename[file.len] = 0;
}
else
ao_outputfilename =
strdup((ao_pcm_waveheader)?"audiodump.wav":"audiodump.pcm");
/* bits is only equal to format if (format == 8) or (format == 16); /* bits is only equal to format if (format == 8) or (format == 16);
this means that the following "if" is a kludge and should this means that the following "if" is a kludge and should