| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/audio/win/wavein_input_win.h" | 5 #include "media/audio/win/wavein_input_win.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "media/audio/audio_device_description.h" |
| 8 #include "media/audio/audio_io.h" | 9 #include "media/audio/audio_io.h" |
| 9 #include "media/audio/win/audio_manager_win.h" | 10 #include "media/audio/win/audio_manager_win.h" |
| 10 #include "media/audio/win/device_enumeration_win.h" | 11 #include "media/audio/win/device_enumeration_win.h" |
| 11 #include "media/base/audio_bus.h" | 12 #include "media/base/audio_bus.h" |
| 12 | 13 |
| 13 namespace media { | 14 namespace media { |
| 14 | 15 |
| 15 // Our sound buffers are allocated once and kept in a linked list using the | 16 // Our sound buffers are allocated once and kept in a linked list using the |
| 16 // the WAVEHDR::dwUser variable. The last buffer points to the first buffer. | 17 // the WAVEHDR::dwUser variable. The last buffer points to the first buffer. |
| 17 static WAVEHDR* GetNextBuffer(WAVEHDR* current) { | 18 static WAVEHDR* GetNextBuffer(WAVEHDR* current) { |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 | 239 |
| 239 void PCMWaveInAudioInputStream::QueueNextPacket(WAVEHDR *buffer) { | 240 void PCMWaveInAudioInputStream::QueueNextPacket(WAVEHDR *buffer) { |
| 240 MMRESULT res = ::waveInAddBuffer(wavein_, buffer, sizeof(WAVEHDR)); | 241 MMRESULT res = ::waveInAddBuffer(wavein_, buffer, sizeof(WAVEHDR)); |
| 241 if (res != MMSYSERR_NOERROR) | 242 if (res != MMSYSERR_NOERROR) |
| 242 HandleError(res); | 243 HandleError(res); |
| 243 } | 244 } |
| 244 | 245 |
| 245 bool PCMWaveInAudioInputStream::GetDeviceId(UINT* device_index) { | 246 bool PCMWaveInAudioInputStream::GetDeviceId(UINT* device_index) { |
| 246 // Deliver the default input device id (WAVE_MAPPER) if the default | 247 // Deliver the default input device id (WAVE_MAPPER) if the default |
| 247 // device has been selected. | 248 // device has been selected. |
| 248 if (device_id_ == AudioManagerBase::kDefaultDeviceId) { | 249 if (device_id_ == AudioDeviceDescription::kDefaultDeviceId) { |
| 249 *device_index = WAVE_MAPPER; | 250 *device_index = WAVE_MAPPER; |
| 250 return true; | 251 return true; |
| 251 } | 252 } |
| 252 | 253 |
| 253 // Get list of all available and active devices. | 254 // Get list of all available and active devices. |
| 254 AudioDeviceNames device_names; | 255 AudioDeviceNames device_names; |
| 255 if (!media::GetInputDeviceNamesWinXP(&device_names)) | 256 if (!media::GetInputDeviceNamesWinXP(&device_names)) |
| 256 return false; | 257 return false; |
| 257 | 258 |
| 258 if (device_names.empty()) | 259 if (device_names.empty()) |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 ::SetEvent(obj->stopped_event_.Get()); | 316 ::SetEvent(obj->stopped_event_.Get()); |
| 316 } | 317 } |
| 317 } else if (msg == WIM_CLOSE) { | 318 } else if (msg == WIM_CLOSE) { |
| 318 // Intentionaly no-op for now. | 319 // Intentionaly no-op for now. |
| 319 } else if (msg == WIM_OPEN) { | 320 } else if (msg == WIM_OPEN) { |
| 320 // Intentionaly no-op for now. | 321 // Intentionaly no-op for now. |
| 321 } | 322 } |
| 322 } | 323 } |
| 323 | 324 |
| 324 } // namespace media | 325 } // namespace media |
| OLD | NEW |