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

Side by Side Diff: media/audio/pulse/audio_manager_pulse.h

Issue 12316131: Moved AudioUtil static functions to AudioManager interfaces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: made the GetPreferredOutputStreamParameters protected Created 7 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
« no previous file with comments | « media/audio/openbsd/audio_manager_openbsd.cc ('k') | media/audio/pulse/audio_manager_pulse.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_PULSE_AUDIO_MANAGER_PULSE_H_ 5 #ifndef MEDIA_AUDIO_PULSE_AUDIO_MANAGER_PULSE_H_
6 #define MEDIA_AUDIO_PULSE_AUDIO_MANAGER_PULSE_H_ 6 #define MEDIA_AUDIO_PULSE_AUDIO_MANAGER_PULSE_H_
7 7
8 #include <pulse/pulseaudio.h> 8 #include <pulse/pulseaudio.h>
9 #include <string> 9 #include <string>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "media/audio/audio_manager_base.h" 13 #include "media/audio/audio_manager_base.h"
14 14
15 namespace media { 15 namespace media {
16 16
17 class MEDIA_EXPORT AudioManagerPulse : public AudioManagerBase { 17 class MEDIA_EXPORT AudioManagerPulse : public AudioManagerBase {
18 public: 18 public:
19 AudioManagerPulse(); 19 AudioManagerPulse();
20 virtual ~AudioManagerPulse(); 20 virtual ~AudioManagerPulse();
21 21
22 static AudioManager* Create(); 22 static AudioManager* Create();
23 23
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 void ShowAudioInputSettings() OVERRIDE; 27 virtual void ShowAudioInputSettings() OVERRIDE;
28 virtual void GetAudioInputDeviceNames(media::AudioDeviceNames* device_names) 28 virtual void GetAudioInputDeviceNames(media::AudioDeviceNames* device_names)
29 OVERRIDE; 29 OVERRIDE;
30 virtual AudioParameters GetInputStreamParameters(
31 const std::string& device_id) OVERRIDE;
30 32
31 // Implementation of AudioManagerBase. 33 // Implementation of AudioManagerBase.
32 virtual AudioOutputStream* MakeLinearOutputStream( 34 virtual AudioOutputStream* MakeLinearOutputStream(
33 const AudioParameters& params) OVERRIDE; 35 const AudioParameters& params) OVERRIDE;
34 virtual AudioOutputStream* MakeLowLatencyOutputStream( 36 virtual AudioOutputStream* MakeLowLatencyOutputStream(
35 const AudioParameters& params) OVERRIDE; 37 const AudioParameters& params) OVERRIDE;
36 virtual AudioInputStream* MakeLinearInputStream( 38 virtual AudioInputStream* MakeLinearInputStream(
37 const AudioParameters& params, const std::string& device_id) OVERRIDE; 39 const AudioParameters& params, const std::string& device_id) OVERRIDE;
38 virtual AudioInputStream* MakeLowLatencyInputStream( 40 virtual AudioInputStream* MakeLowLatencyInputStream(
39 const AudioParameters& params, const std::string& device_id) OVERRIDE; 41 const AudioParameters& params, const std::string& device_id) OVERRIDE;
40 virtual AudioParameters GetPreferredLowLatencyOutputStreamParameters( 42
43 protected:
44 virtual AudioParameters GetPreferredOutputStreamParameters(
41 const AudioParameters& input_params) OVERRIDE; 45 const AudioParameters& input_params) OVERRIDE;
42 46
43 int GetNativeSampleRate();
44
45 private: 47 private:
46 bool Init(); 48 bool Init();
47 void DestroyPulse(); 49 void DestroyPulse();
48 50
49 // Callback to get the devices' info like names, used by GetInputDevices(). 51 // Callback to get the devices' info like names, used by GetInputDevices().
50 static void DevicesInfoCallback(pa_context* context, 52 static void DevicesInfoCallback(pa_context* context,
51 const pa_source_info* info, 53 const pa_source_info* info,
52 int error, void* user_data); 54 int error, void* user_data);
53 55
54 // Callback to get the native sample rate of PulseAudio, used by 56 // Callback to get the native sample rate of PulseAudio, used by
55 // GetNativeSampleRate(). 57 // GetNativeSampleRate().
56 static void SampleRateInfoCallback(pa_context* context, 58 static void SampleRateInfoCallback(pa_context* context,
57 const pa_server_info* info, 59 const pa_server_info* info,
58 void* user_data); 60 void* user_data);
59 61
60 // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream. 62 // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream.
61 AudioOutputStream* MakeOutputStream(const AudioParameters& params); 63 AudioOutputStream* MakeOutputStream(const AudioParameters& params);
62 64
63 // Called by MakeLinearInputStream and MakeLowLatencyInputStream. 65 // Called by MakeLinearInputStream and MakeLowLatencyInputStream.
64 AudioInputStream* MakeInputStream(const AudioParameters& params, 66 AudioInputStream* MakeInputStream(const AudioParameters& params,
65 const std::string& device_id); 67 const std::string& device_id);
66 68
69 // Gets the native sample rate of Pulse.
70 int GetNativeSampleRate();
71
67 pa_threaded_mainloop* input_mainloop_; 72 pa_threaded_mainloop* input_mainloop_;
68 pa_context* input_context_; 73 pa_context* input_context_;
69 AudioDeviceNames* devices_; 74 AudioDeviceNames* devices_;
70 int native_input_sample_rate_; 75 int native_input_sample_rate_;
71 76
72 DISALLOW_COPY_AND_ASSIGN(AudioManagerPulse); 77 DISALLOW_COPY_AND_ASSIGN(AudioManagerPulse);
73 }; 78 };
74 79
75 } // namespace media 80 } // namespace media
76 81
77 #endif // MEDIA_AUDIO_PULSE_AUDIO_MANAGER_PULSE_H_ 82 #endif // MEDIA_AUDIO_PULSE_AUDIO_MANAGER_PULSE_H_
OLDNEW
« no previous file with comments | « media/audio/openbsd/audio_manager_openbsd.cc ('k') | media/audio/pulse/audio_manager_pulse.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698