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

Side by Side Diff: media/audio/audio_manager_base.h

Issue 1186293003: Implement HasInputDevices in CrasAudioManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a comment in cras_audio_handler.h for GetAudioDevices Created 5 years, 5 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
« no previous file with comments | « media/DEPS ('k') | media/audio/cras/audio_manager_cras.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_
6 #define MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ 6 #define MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 30 matching lines...) Expand all
41 // AudioInputStream will be capturing audio currently being played on the 41 // AudioInputStream will be capturing audio currently being played on the
42 // default playback device. At the moment this feature is supported only on 42 // default playback device. At the moment this feature is supported only on
43 // some platforms. AudioInputStream::Intialize() will return an error on 43 // some platforms. AudioInputStream::Intialize() will return an error on
44 // platforms that don't support it. GetInputStreamParameters() must be used 44 // platforms that don't support it. GetInputStreamParameters() must be used
45 // to get the parameters of the loopback device before creating a loopback 45 // to get the parameters of the loopback device before creating a loopback
46 // stream, otherwise stream initialization may fail. 46 // stream, otherwise stream initialization may fail.
47 static const char kLoopbackInputDeviceId[]; 47 static const char kLoopbackInputDeviceId[];
48 48
49 ~AudioManagerBase() override; 49 ~AudioManagerBase() override;
50 50
51 // AudioManager:
51 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override; 52 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override;
52 scoped_refptr<base::SingleThreadTaskRunner> GetWorkerTaskRunner() override; 53 scoped_refptr<base::SingleThreadTaskRunner> GetWorkerTaskRunner() override;
53
54 base::string16 GetAudioInputDeviceModel() override; 54 base::string16 GetAudioInputDeviceModel() override;
55
56 void ShowAudioInputSettings() override; 55 void ShowAudioInputSettings() override;
57
58 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; 56 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override;
59
60 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; 57 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override;
61
62 AudioOutputStream* MakeAudioOutputStream( 58 AudioOutputStream* MakeAudioOutputStream(
63 const AudioParameters& params, 59 const AudioParameters& params,
64 const std::string& device_id) override; 60 const std::string& device_id) override;
65
66 AudioInputStream* MakeAudioInputStream(const AudioParameters& params, 61 AudioInputStream* MakeAudioInputStream(const AudioParameters& params,
67 const std::string& device_id) override; 62 const std::string& device_id) override;
68
69 AudioOutputStream* MakeAudioOutputStreamProxy( 63 AudioOutputStream* MakeAudioOutputStreamProxy(
70 const AudioParameters& params, 64 const AudioParameters& params,
71 const std::string& device_id) override; 65 const std::string& device_id) override;
72 66
67 // Listeners will be notified on the GetTaskRunner() task runner.
68 void AddOutputDeviceChangeListener(AudioDeviceListener* listener) override;
69 void RemoveOutputDeviceChangeListener(AudioDeviceListener* listener) override;
70
71 AudioParameters GetDefaultOutputStreamParameters() override;
72 AudioParameters GetOutputStreamParameters(
73 const std::string& device_id) override;
74 AudioParameters GetInputStreamParameters(
75 const std::string& device_id) override;
76 std::string GetAssociatedOutputDeviceID(
77 const std::string& input_device_id) override;
78 scoped_ptr<AudioLog> CreateAudioLog(
79 AudioLogFactory::AudioComponent component) override;
80 void SetHasKeyboardMic() override;
81
82 // AudioManagerBase:
83
73 // Called internally by the audio stream when it has been closed. 84 // Called internally by the audio stream when it has been closed.
74 virtual void ReleaseOutputStream(AudioOutputStream* stream); 85 virtual void ReleaseOutputStream(AudioOutputStream* stream);
75 virtual void ReleaseInputStream(AudioInputStream* stream); 86 virtual void ReleaseInputStream(AudioInputStream* stream);
76 87
77 // Creates the output stream for the |AUDIO_PCM_LINEAR| format. The legacy 88 // Creates the output stream for the |AUDIO_PCM_LINEAR| format. The legacy
78 // name is also from |AUDIO_PCM_LINEAR|. 89 // name is also from |AUDIO_PCM_LINEAR|.
79 virtual AudioOutputStream* MakeLinearOutputStream( 90 virtual AudioOutputStream* MakeLinearOutputStream(
80 const AudioParameters& params) = 0; 91 const AudioParameters& params) = 0;
81 92
82 // Creates the output stream for the |AUDIO_PCM_LOW_LATENCY| format. 93 // Creates the output stream for the |AUDIO_PCM_LOW_LATENCY| format.
83 virtual AudioOutputStream* MakeLowLatencyOutputStream( 94 virtual AudioOutputStream* MakeLowLatencyOutputStream(
84 const AudioParameters& params, 95 const AudioParameters& params,
85 const std::string& device_id) = 0; 96 const std::string& device_id) = 0;
86 97
87 // Creates the input stream for the |AUDIO_PCM_LINEAR| format. The legacy 98 // Creates the input stream for the |AUDIO_PCM_LINEAR| format. The legacy
88 // name is also from |AUDIO_PCM_LINEAR|. 99 // name is also from |AUDIO_PCM_LINEAR|.
89 virtual AudioInputStream* MakeLinearInputStream( 100 virtual AudioInputStream* MakeLinearInputStream(
90 const AudioParameters& params, const std::string& device_id) = 0; 101 const AudioParameters& params, const std::string& device_id) = 0;
91 102
92 // Creates the input stream for the |AUDIO_PCM_LOW_LATENCY| format. 103 // Creates the input stream for the |AUDIO_PCM_LOW_LATENCY| format.
93 virtual AudioInputStream* MakeLowLatencyInputStream( 104 virtual AudioInputStream* MakeLowLatencyInputStream(
94 const AudioParameters& params, const std::string& device_id) = 0; 105 const AudioParameters& params, const std::string& device_id) = 0;
95 106
96 // Listeners will be notified on the GetTaskRunner() task runner.
97 void AddOutputDeviceChangeListener(AudioDeviceListener* listener) override;
98 void RemoveOutputDeviceChangeListener(AudioDeviceListener* listener) override;
99
100 AudioParameters GetDefaultOutputStreamParameters() override;
101 AudioParameters GetOutputStreamParameters(
102 const std::string& device_id) override;
103
104 AudioParameters GetInputStreamParameters(
105 const std::string& device_id) override;
106
107 std::string GetAssociatedOutputDeviceID(
108 const std::string& input_device_id) override;
109
110 scoped_ptr<AudioLog> CreateAudioLog(
111 AudioLogFactory::AudioComponent component) override;
112
113 void SetHasKeyboardMic() override;
114
115 // Get number of input or output streams. 107 // Get number of input or output streams.
116 int input_stream_count() const { return num_input_streams_; } 108 int input_stream_count() const { return num_input_streams_; }
117 int output_stream_count() const { return num_output_streams_; } 109 int output_stream_count() const { return num_output_streams_; }
118 110
119 protected: 111 protected:
120 AudioManagerBase(AudioLogFactory* audio_log_factory); 112 AudioManagerBase(AudioLogFactory* audio_log_factory);
121 113
122 // Shuts down the audio thread and releases all the audio output dispatchers 114 // Shuts down the audio thread and releases all the audio output dispatchers
123 // on the audio thread. All audio streams should be freed before Shutdown() 115 // on the audio thread. All audio streams should be freed before Shutdown()
124 // is called. This must be called in the destructor of every AudioManagerBase 116 // is called. This must be called in the destructor of every AudioManagerBase
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 182
191 // Proxy for creating AudioLog objects. 183 // Proxy for creating AudioLog objects.
192 AudioLogFactory* const audio_log_factory_; 184 AudioLogFactory* const audio_log_factory_;
193 185
194 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); 186 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase);
195 }; 187 };
196 188
197 } // namespace media 189 } // namespace media
198 190
199 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ 191 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_
OLDNEW
« no previous file with comments | « media/DEPS ('k') | media/audio/cras/audio_manager_cras.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698