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

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

Issue 9570014: Move some generic functions to AudioManagerBase to be inherited by platform-specific AudioManager*** (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix the memory leak in the alsa unittests Created 8 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) 2011 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 #ifndef MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_ 5 #ifndef MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_
6 #define MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_ 6 #define MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "media/audio/audio_manager_base.h" 14 #include "media/audio/audio_manager_base.h"
15 15
16 class PCMWaveOutAudioOutputStream; 16 class PCMWaveOutAudioOutputStream;
17 17
18 // Windows implementation of the AudioManager singleton. This class is internal 18 // Windows implementation of the AudioManager singleton. This class is internal
19 // to the audio output and only internal users can call methods not exposed by 19 // to the audio output and only internal users can call methods not exposed by
20 // the AudioManager class. 20 // the AudioManager class.
21 class MEDIA_EXPORT AudioManagerWin : public AudioManagerBase { 21 class MEDIA_EXPORT AudioManagerWin : public AudioManagerBase {
22 public: 22 public:
23 AudioManagerWin(); 23 AudioManagerWin();
24 // Implementation of AudioManager. 24 // Implementation of AudioManager.
25 virtual bool HasAudioOutputDevices() OVERRIDE; 25 virtual bool HasAudioOutputDevices() OVERRIDE;
26 virtual bool HasAudioInputDevices() OVERRIDE; 26 virtual bool HasAudioInputDevices() OVERRIDE;
27 virtual AudioOutputStream* MakeAudioOutputStream(
28 const AudioParameters& params) OVERRIDE;
29 virtual AudioInputStream* MakeAudioInputStream(
30 const AudioParameters& params, const std::string& device_id) OVERRIDE;
31 virtual void MuteAll() OVERRIDE; 27 virtual void MuteAll() OVERRIDE;
32 virtual void UnMuteAll() OVERRIDE; 28 virtual void UnMuteAll() OVERRIDE;
33 virtual string16 GetAudioInputDeviceModel() OVERRIDE; 29 virtual string16 GetAudioInputDeviceModel() OVERRIDE;
34 virtual bool CanShowAudioInputSettings() OVERRIDE; 30 virtual bool CanShowAudioInputSettings() OVERRIDE;
35 virtual void ShowAudioInputSettings() OVERRIDE; 31 virtual void ShowAudioInputSettings() OVERRIDE;
36 virtual void GetAudioInputDeviceNames(media::AudioDeviceNames* device_names) 32 virtual void GetAudioInputDeviceNames(media::AudioDeviceNames* device_names)
37 OVERRIDE; 33 OVERRIDE;
38 34
39 // Windows-only methods to free a stream created in MakeAudioStream. These 35 // Implementation of AudioManagerBase.
40 // are called internally by the audio stream when it has been closed. 36 virtual int GetMaxAudioOutputStreamsAllowed() OVERRIDE;
41 void ReleaseOutputStream(AudioOutputStream* stream); 37 virtual AudioOutputStream* MakeAudioLinearOutputStream(
42 38 const AudioParameters& params) OVERRIDE;
43 // Called internally by the audio stream when it has been closed. 39 virtual AudioOutputStream* MakeAudioLowLatencyOutputStream(
44 void ReleaseInputStream(AudioInputStream* stream); 40 const AudioParameters& params) OVERRIDE;
41 virtual AudioInputStream* MakeAudioLinearInputStream(
42 const AudioParameters& params, const std::string& device_id) OVERRIDE;
43 virtual AudioInputStream* MakeAudioLowLatencyInputStream(
44 const AudioParameters& params, const std::string& device_id) OVERRIDE;
45 45
46 protected: 46 protected:
47 virtual ~AudioManagerWin(); 47 virtual ~AudioManagerWin();
48 48
49 private: 49 private:
50 enum EnumerationType { 50 enum EnumerationType {
51 kUninitializedEnumeration = 0, 51 kUninitializedEnumeration = 0,
52 kMMDeviceEnumeration, 52 kMMDeviceEnumeration,
53 kWaveEnumeration, 53 kWaveEnumeration,
54 }; 54 };
55 55
56 // Allow unit test to modify the utilized enumeration API. 56 // Allow unit test to modify the utilized enumeration API.
57 friend class AudioInputDeviceTest; 57 friend class AudioInputDeviceTest;
58 58
59 EnumerationType enumeration_type_; 59 EnumerationType enumeration_type_;
60 EnumerationType enumeration_type() { return enumeration_type_; } 60 EnumerationType enumeration_type() { return enumeration_type_; }
61 void SetEnumerationType(EnumerationType type) { 61 void SetEnumerationType(EnumerationType type) {
62 enumeration_type_ = type; 62 enumeration_type_ = type;
63 } 63 }
64 64
65 // Number of currently open output streams.
66 int num_output_streams_;
67
68 DISALLOW_COPY_AND_ASSIGN(AudioManagerWin); 65 DISALLOW_COPY_AND_ASSIGN(AudioManagerWin);
69 }; 66 };
70 67
71 #endif // MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_ 68 #endif // MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698