Mercurial > mplayer.hg
comparison libao2/ao_pcm.c @ 14539:de08cc60fd7e
use MSTRZ suboption type
author | reimar |
---|---|
date | Wed, 19 Jan 2005 17:18:25 +0000 |
parents | 54e42c7eb713 |
children | 178b8b4a62c6 |
comparison
equal
deleted
inserted
replaced
14538:00c3c4111017 | 14539:de08cc60fd7e |
---|---|
78 | 78 |
79 // open & setup audio device | 79 // open & setup audio device |
80 // return: 1=success 0=fail | 80 // return: 1=success 0=fail |
81 static int init(int rate,int channels,int format,int flags){ | 81 static int init(int rate,int channels,int format,int flags){ |
82 int bits; | 82 int bits; |
83 strarg_t file; | |
84 opt_t subopts[] = { | 83 opt_t subopts[] = { |
85 {"waveheader", OPT_ARG_BOOL, &ao_pcm_waveheader, NULL}, | 84 {"waveheader", OPT_ARG_BOOL, &ao_pcm_waveheader, NULL}, |
86 {"file", OPT_ARG_STR, &file, NULL}, | 85 {"file", OPT_ARG_MSTRZ, &ao_outputfilename, NULL}, |
87 {NULL} | 86 {NULL} |
88 }; | 87 }; |
89 // set defaults | 88 // set defaults |
90 ao_pcm_waveheader = 1; | 89 ao_pcm_waveheader = 1; |
91 file.str = NULL; | 90 ao_outputfilename = |
92 file.len = 0; | 91 strdup((ao_pcm_waveheader)?"audiodump.wav":"audiodump.pcm"); |
93 if (subopt_parse(ao_subdevice, subopts) != 0) { | 92 if (subopt_parse(ao_subdevice, subopts) != 0) { |
94 return 0; | 93 return 0; |
95 } | 94 } |
96 if (file.len > 0) { | |
97 ao_outputfilename = malloc(file.len + 1); | |
98 memcpy(ao_outputfilename, file.str, file.len); | |
99 ao_outputfilename[file.len] = 0; | |
100 } | |
101 else | |
102 ao_outputfilename = | |
103 strdup((ao_pcm_waveheader)?"audiodump.wav":"audiodump.pcm"); | |
104 | 95 |
105 /* bits is only equal to format if (format == 8) or (format == 16); | 96 /* bits is only equal to format if (format == 8) or (format == 16); |
106 this means that the following "if" is a kludge and should | 97 this means that the following "if" is a kludge and should |
107 really be a switch to be correct in all cases */ | 98 really be a switch to be correct in all cases */ |
108 | 99 |