# HG changeset patch # User reimar # Date 1106155105 0 # Node ID de08cc60fd7e18c3bb5d6213290629622b85958b # Parent 00c3c411101779f3561ebdce784b9cd2192f2824 use MSTRZ suboption type diff -r 00c3c4111017 -r de08cc60fd7e libao2/ao_pcm.c --- a/libao2/ao_pcm.c Wed Jan 19 17:10:20 2005 +0000 +++ b/libao2/ao_pcm.c Wed Jan 19 17:18:25 2005 +0000 @@ -80,27 +80,18 @@ // return: 1=success 0=fail static int init(int rate,int channels,int format,int flags){ int bits; - strarg_t file; opt_t subopts[] = { {"waveheader", OPT_ARG_BOOL, &ao_pcm_waveheader, NULL}, - {"file", OPT_ARG_STR, &file, NULL}, + {"file", OPT_ARG_MSTRZ, &ao_outputfilename, NULL}, {NULL} }; // set defaults ao_pcm_waveheader = 1; - file.str = NULL; - file.len = 0; + ao_outputfilename = + strdup((ao_pcm_waveheader)?"audiodump.wav":"audiodump.pcm"); if (subopt_parse(ao_subdevice, subopts) != 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); this means that the following "if" is a kludge and should