| 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/audio_io.h" | 5 #include "media/audio/audio_io.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <objbase.h> // This has to be before initguid.h | 8 #include <objbase.h> // This has to be before initguid.h |
| 9 #include <initguid.h> | 9 #include <initguid.h> |
| 10 #include <mmsystem.h> | 10 #include <mmsystem.h> |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 ULONG device_interface_name_size = 0; | 190 ULONG device_interface_name_size = 0; |
| 191 waveInMessage(reinterpret_cast<HWAVEIN>(device_id), | 191 waveInMessage(reinterpret_cast<HWAVEIN>(device_id), |
| 192 DRV_QUERYDEVICEINTERFACESIZE, | 192 DRV_QUERYDEVICEINTERFACESIZE, |
| 193 reinterpret_cast<DWORD_PTR>(&device_interface_name_size), 0); | 193 reinterpret_cast<DWORD_PTR>(&device_interface_name_size), 0); |
| 194 size_t bytes_in_char16 = sizeof(base::string16::value_type); | 194 size_t bytes_in_char16 = sizeof(base::string16::value_type); |
| 195 DCHECK_EQ(0u, device_interface_name_size % bytes_in_char16); | 195 DCHECK_EQ(0u, device_interface_name_size % bytes_in_char16); |
| 196 if (device_interface_name_size <= bytes_in_char16) | 196 if (device_interface_name_size <= bytes_in_char16) |
| 197 return base::string16(); // No audio capture device. | 197 return base::string16(); // No audio capture device. |
| 198 | 198 |
| 199 base::string16 device_interface_name; | 199 base::string16 device_interface_name; |
| 200 base::string16::value_type* name_ptr = WriteInto(&device_interface_name, | 200 base::string16::value_type* name_ptr = base::WriteInto(&device_interface_name, |
| 201 device_interface_name_size / bytes_in_char16); | 201 device_interface_name_size / bytes_in_char16); |
| 202 waveInMessage(reinterpret_cast<HWAVEIN>(device_id), | 202 waveInMessage(reinterpret_cast<HWAVEIN>(device_id), |
| 203 DRV_QUERYDEVICEINTERFACE, | 203 DRV_QUERYDEVICEINTERFACE, |
| 204 reinterpret_cast<DWORD_PTR>(name_ptr), | 204 reinterpret_cast<DWORD_PTR>(name_ptr), |
| 205 static_cast<DWORD_PTR>(device_interface_name_size)); | 205 static_cast<DWORD_PTR>(device_interface_name_size)); |
| 206 | 206 |
| 207 // Enumerate all audio devices and find the one matching the above device | 207 // Enumerate all audio devices and find the one matching the above device |
| 208 // interface name. | 208 // interface name. |
| 209 HDEVINFO device_info = SetupDiGetClassDevs( | 209 HDEVINFO device_info = SetupDiGetClassDevs( |
| 210 &AM_KSCATEGORY_AUDIO, 0, 0, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT); | 210 &AM_KSCATEGORY_AUDIO, 0, 0, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT); |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers, | 533 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers, |
| 534 xp_device_id); | 534 xp_device_id); |
| 535 } | 535 } |
| 536 | 536 |
| 537 /// static | 537 /// static |
| 538 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { | 538 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { |
| 539 return new AudioManagerWin(audio_log_factory); | 539 return new AudioManagerWin(audio_log_factory); |
| 540 } | 540 } |
| 541 | 541 |
| 542 } // namespace media | 542 } // namespace media |
| OLD | NEW |