Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: media/audio/win/audio_manager_win.cc

Issue 6628020: Cleaning up src/media to be consistent with static versus anonymous namespaces. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: fix namespaces Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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>
11 #include <setupapi.h> 11 #include <setupapi.h>
(...skipping 18 matching lines...) Expand all
30 #pragma comment(lib, "setupapi.lib") 30 #pragma comment(lib, "setupapi.lib")
31 31
32 // The following are defined in various DDK headers, and we (re)define them 32 // The following are defined in various DDK headers, and we (re)define them
33 // here to avoid adding the DDK as a chrome dependency. 33 // here to avoid adding the DDK as a chrome dependency.
34 #define DRV_QUERYDEVICEINTERFACE 0x80c 34 #define DRV_QUERYDEVICEINTERFACE 0x80c
35 #define DRVM_MAPPER_PREFERRED_GET 0x2015 35 #define DRVM_MAPPER_PREFERRED_GET 0x2015
36 #define DRV_QUERYDEVICEINTERFACESIZE 0x80d 36 #define DRV_QUERYDEVICEINTERFACESIZE 0x80d
37 DEFINE_GUID(AM_KSCATEGORY_AUDIO, 0x6994ad04, 0x93ef, 0x11d0, 37 DEFINE_GUID(AM_KSCATEGORY_AUDIO, 0x6994ad04, 0x93ef, 0x11d0,
38 0xa3, 0xcc, 0x00, 0xa0, 0xc9, 0x22, 0x31, 0x96); 38 0xa3, 0xcc, 0x00, 0xa0, 0xc9, 0x22, 0x31, 0x96);
39 39
40 namespace {
41
42 // Maximum number of output streams that can be open simultaneously. 40 // Maximum number of output streams that can be open simultaneously.
43 const size_t kMaxOutputStreams = 50; 41 static const size_t kMaxOutputStreams = 50;
44 42
45 // Up to 8 channels can be passed to the driver. 43 // Up to 8 channels can be passed to the driver.
46 // This should work, given the right drivers, but graceful error handling is 44 // This should work, given the right drivers, but graceful error handling is
47 // needed. 45 // needed.
48 const int kWinMaxChannels = 8; 46 static const int kWinMaxChannels = 8;
49 47
50 const int kWinMaxInputChannels = 2; 48 static const int kWinMaxInputChannels = 2;
51 // We use 3 buffers for recording audio so that if a recording callback takes 49 // We use 3 buffers for recording audio so that if a recording callback takes
52 // some time to return we won't lose audio. More buffers while recording are 50 // some time to return we won't lose audio. More buffers while recording are
53 // ok because they don't introduce any delay in recording, unlike in playback 51 // ok because they don't introduce any delay in recording, unlike in playback
54 // where you first need to fill in that number of buffers before starting to 52 // where you first need to fill in that number of buffers before starting to
55 // play. 53 // play.
56 const int kNumInputBuffers = 3; 54 static const int kNumInputBuffers = 3;
57 55
58 int GetVersionPartAsInt(DWORDLONG num) { 56 static int GetVersionPartAsInt(DWORDLONG num) {
59 return static_cast<int>(num & 0xffff); 57 return static_cast<int>(num & 0xffff);
60 } 58 }
61 59
62 // Returns a string containing the given device's description and installed 60 // Returns a string containing the given device's description and installed
63 // driver version. 61 // driver version.
64 string16 GetDeviceAndDriverInfo(HDEVINFO device_info, 62 static string16 GetDeviceAndDriverInfo(HDEVINFO device_info,
65 SP_DEVINFO_DATA* device_data) { 63 SP_DEVINFO_DATA* device_data) {
66 // Save the old install params setting and set a flag for the 64 // Save the old install params setting and set a flag for the
67 // SetupDiBuildDriverInfoList below to return only the installed drivers. 65 // SetupDiBuildDriverInfoList below to return only the installed drivers.
68 SP_DEVINSTALL_PARAMS old_device_install_params; 66 SP_DEVINSTALL_PARAMS old_device_install_params;
69 old_device_install_params.cbSize = sizeof(old_device_install_params); 67 old_device_install_params.cbSize = sizeof(old_device_install_params);
70 SetupDiGetDeviceInstallParams(device_info, device_data, 68 SetupDiGetDeviceInstallParams(device_info, device_data,
71 &old_device_install_params); 69 &old_device_install_params);
72 SP_DEVINSTALL_PARAMS device_install_params = old_device_install_params; 70 SP_DEVINSTALL_PARAMS device_install_params = old_device_install_params;
73 device_install_params.FlagsEx |= DI_FLAGSEX_INSTALLEDDRIVER; 71 device_install_params.FlagsEx |= DI_FLAGSEX_INSTALLEDDRIVER;
74 SetupDiSetDeviceInstallParams(device_info, device_data, 72 SetupDiSetDeviceInstallParams(device_info, device_data,
75 &device_install_params); 73 &device_install_params);
(...skipping 14 matching lines...) Expand all
90 } 88 }
91 SetupDiDestroyDriverInfoList(device_info, device_data, SPDIT_COMPATDRIVER); 89 SetupDiDestroyDriverInfoList(device_info, device_data, SPDIT_COMPATDRIVER);
92 } 90 }
93 91
94 SetupDiSetDeviceInstallParams(device_info, device_data, 92 SetupDiSetDeviceInstallParams(device_info, device_data,
95 &old_device_install_params); 93 &old_device_install_params);
96 94
97 return device_and_driver_info; 95 return device_and_driver_info;
98 } 96 }
99 97
100 } // namespace
101
102 AudioManagerWin::AudioManagerWin() 98 AudioManagerWin::AudioManagerWin()
103 : num_output_streams_(0) { 99 : num_output_streams_(0) {
104 } 100 }
105 101
106 AudioManagerWin::~AudioManagerWin() { 102 AudioManagerWin::~AudioManagerWin() {
107 } 103 }
108 104
109 bool AudioManagerWin::HasAudioOutputDevices() { 105 bool AudioManagerWin::HasAudioOutputDevices() {
110 return (::waveOutGetNumDevs() != 0); 106 return (::waveOutGetNumDevs() != 0);
111 } 107 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 path = path.Append(program); 250 path = path.Append(program);
255 CommandLine command_line(path); 251 CommandLine command_line(path);
256 command_line.AppendArg(argument); 252 command_line.AppendArg(argument);
257 base::LaunchApp(command_line, false, false, NULL); 253 base::LaunchApp(command_line, false, false, NULL);
258 } 254 }
259 255
260 // static 256 // static
261 AudioManager* AudioManager::CreateAudioManager() { 257 AudioManager* AudioManager::CreateAudioManager() {
262 return new AudioManagerWin(); 258 return new AudioManagerWin();
263 } 259 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698