Mercurial > mplayer.hg
comparison libao2/ao_win32.c @ 14264:cb5fbade8a5c
af_fmt2str_short
author | alex |
---|---|
date | Tue, 28 Dec 2004 19:11:14 +0000 |
parents | 8f59f661f317 |
children | cae0dbeb44bb |
comparison
equal
deleted
inserted
replaced
14263:bc80d39d19e8 | 14264:cb5fbade8a5c |
---|---|
145 WAVEFORMATEXTENSIBLE wformat; | 145 WAVEFORMATEXTENSIBLE wformat; |
146 DWORD totalBufferSize = (BUFFER_SIZE + sizeof(WAVEHDR)) * BUFFER_COUNT; | 146 DWORD totalBufferSize = (BUFFER_SIZE + sizeof(WAVEHDR)) * BUFFER_COUNT; |
147 MMRESULT result; | 147 MMRESULT result; |
148 unsigned char* buffer; | 148 unsigned char* buffer; |
149 int i; | 149 int i; |
150 char buf[128]; | |
151 | 150 |
152 switch(format){ | 151 switch(format){ |
153 case AF_FORMAT_AC3: | 152 case AF_FORMAT_AC3: |
154 case AF_FORMAT_S24_LE: | 153 case AF_FORMAT_S24_LE: |
155 case AF_FORMAT_S16_LE: | 154 case AF_FORMAT_S16_LE: |
156 case AF_FORMAT_S8: | 155 case AF_FORMAT_S8: |
157 break; | 156 break; |
158 default: | 157 default: |
159 mp_msg(MSGT_AO, MSGL_V,"ao_win32: format %s not supported defaulting to Signed 16-bit Little-Endian\n",af_fmt2str(format, &buf, 128)); | 158 mp_msg(MSGT_AO, MSGL_V,"ao_win32: format %s not supported defaulting to Signed 16-bit Little-Endian\n",af_fmt2str_short(format)); |
160 format=AF_FORMAT_S16_LE; | 159 format=AF_FORMAT_S16_LE; |
161 } | 160 } |
162 //fill global ao_data | 161 //fill global ao_data |
163 ao_data.channels=channels; | 162 ao_data.channels=channels; |
164 ao_data.samplerate=rate; | 163 ao_data.samplerate=rate; |
166 ao_data.bps=channels*rate; | 165 ao_data.bps=channels*rate; |
167 if(format != AF_FORMAT_U8 && format != AF_FORMAT_S8) | 166 if(format != AF_FORMAT_U8 && format != AF_FORMAT_S8) |
168 ao_data.bps*=2; | 167 ao_data.bps*=2; |
169 if(ao_data.buffersize==-1) | 168 if(ao_data.buffersize==-1) |
170 { | 169 { |
171 ao_data.buffersize=audio_out_format_bits(format)/8; | 170 ao_data.buffersize=af_fmt2bits(format)/8; |
172 ao_data.buffersize*= channels; | 171 ao_data.buffersize*= channels; |
173 ao_data.buffersize*= SAMPLESIZE; | 172 ao_data.buffersize*= SAMPLESIZE; |
174 } | 173 } |
175 mp_msg(MSGT_AO, MSGL_V,"ao_win32: Samplerate:%iHz Channels:%i Format:%s\n",rate, channels, audio_out_format_name(format)); | 174 mp_msg(MSGT_AO, MSGL_V,"ao_win32: Samplerate:%iHz Channels:%i Format:%s\n",rate, channels, af_fmt2str_short(format)); |
176 mp_msg(MSGT_AO, MSGL_V,"ao_win32: Buffersize:%d\n",ao_data.buffersize); | 175 mp_msg(MSGT_AO, MSGL_V,"ao_win32: Buffersize:%d\n",ao_data.buffersize); |
177 | 176 |
178 //fill waveformatex | 177 //fill waveformatex |
179 ZeroMemory( &wformat, sizeof(WAVEFORMATEXTENSIBLE)); | 178 ZeroMemory( &wformat, sizeof(WAVEFORMATEXTENSIBLE)); |
180 wformat.Format.cbSize = (channels>2)?sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX):0; | 179 wformat.Format.cbSize = (channels>2)?sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX):0; |
187 wformat.Format.nBlockAlign = 4; | 186 wformat.Format.nBlockAlign = 4; |
188 } | 187 } |
189 else | 188 else |
190 { | 189 { |
191 wformat.Format.wFormatTag = (channels>2)?WAVE_FORMAT_EXTENSIBLE:WAVE_FORMAT_PCM; | 190 wformat.Format.wFormatTag = (channels>2)?WAVE_FORMAT_EXTENSIBLE:WAVE_FORMAT_PCM; |
192 wformat.Format.wBitsPerSample = audio_out_format_bits(format); | 191 wformat.Format.wBitsPerSample = af_fmt2bits(format); |
193 wformat.Format.nBlockAlign = wformat.Format.nChannels * (wformat.Format.wBitsPerSample >> 3); | 192 wformat.Format.nBlockAlign = wformat.Format.nChannels * (wformat.Format.wBitsPerSample >> 3); |
194 } | 193 } |
195 if(channels>2) | 194 if(channels>2) |
196 { | 195 { |
197 wformat.dwChannelMask = channel_mask[channels-3]; | 196 wformat.dwChannelMask = channel_mask[channels-3]; |
198 wformat.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; | 197 wformat.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; |
199 wformat.Samples.wValidBitsPerSample=audio_out_format_bits(format); | 198 wformat.Samples.wValidBitsPerSample=af_fmt2bits(format); |
200 } | 199 } |
201 | 200 |
202 wformat.Format.nAvgBytesPerSec = wformat.Format.nSamplesPerSec * wformat.Format.nBlockAlign; | 201 wformat.Format.nAvgBytesPerSec = wformat.Format.nSamplesPerSec * wformat.Format.nBlockAlign; |
203 | 202 |
204 //open sound device | 203 //open sound device |