| OLD | NEW |
| 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 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 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( | 30 virtual AudioParameters GetInputStreamParameters( |
| 31 const std::string& device_id) OVERRIDE; | 31 const std::string& device_id) OVERRIDE; |
| 32 | 32 |
| 33 // Implementation of AudioManagerBase. | 33 // Implementation of AudioManagerBase. |
| 34 virtual AudioOutputStream* MakeLinearOutputStream( | 34 virtual AudioOutputStream* MakeLinearOutputStream( |
| 35 const AudioParameters& params) OVERRIDE; | 35 const AudioParameters& params) OVERRIDE; |
| 36 virtual AudioOutputStream* MakeLowLatencyOutputStream( | 36 virtual AudioOutputStream* MakeLowLatencyOutputStream( |
| 37 const AudioParameters& params) OVERRIDE; | 37 const AudioParameters& params, |
| 38 const std::string& input_device_id) OVERRIDE; |
| 38 virtual AudioInputStream* MakeLinearInputStream( | 39 virtual AudioInputStream* MakeLinearInputStream( |
| 39 const AudioParameters& params, const std::string& device_id) OVERRIDE; | 40 const AudioParameters& params, const std::string& device_id) OVERRIDE; |
| 40 virtual AudioInputStream* MakeLowLatencyInputStream( | 41 virtual AudioInputStream* MakeLowLatencyInputStream( |
| 41 const AudioParameters& params, const std::string& device_id) OVERRIDE; | 42 const AudioParameters& params, const std::string& device_id) OVERRIDE; |
| 42 | 43 |
| 43 protected: | 44 protected: |
| 44 virtual AudioParameters GetPreferredOutputStreamParameters( | 45 virtual AudioParameters GetPreferredOutputStreamParameters( |
| 45 const AudioParameters& input_params) OVERRIDE; | 46 const AudioParameters& input_params) OVERRIDE; |
| 46 | 47 |
| 47 private: | 48 private: |
| 48 bool Init(); | 49 bool Init(); |
| 49 void DestroyPulse(); | 50 void DestroyPulse(); |
| 50 | 51 |
| 51 // Callback to get the devices' info like names, used by GetInputDevices(). | 52 // Callback to get the devices' info like names, used by GetInputDevices(). |
| 52 static void DevicesInfoCallback(pa_context* context, | 53 static void DevicesInfoCallback(pa_context* context, |
| 53 const pa_source_info* info, | 54 const pa_source_info* info, |
| 54 int error, void* user_data); | 55 int error, void* user_data); |
| 55 | 56 |
| 56 // Callback to get the native sample rate of PulseAudio, used by | 57 // Callback to get the native sample rate of PulseAudio, used by |
| 57 // GetNativeSampleRate(). | 58 // GetNativeSampleRate(). |
| 58 static void SampleRateInfoCallback(pa_context* context, | 59 static void SampleRateInfoCallback(pa_context* context, |
| 59 const pa_server_info* info, | 60 const pa_server_info* info, |
| 60 void* user_data); | 61 void* user_data); |
| 61 | 62 |
| 62 // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream. | 63 // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream. |
| 63 AudioOutputStream* MakeOutputStream(const AudioParameters& params); | 64 AudioOutputStream* MakeOutputStream(const AudioParameters& params, |
| 65 const std::string& input_device_id); |
| 64 | 66 |
| 65 // Called by MakeLinearInputStream and MakeLowLatencyInputStream. | 67 // Called by MakeLinearInputStream and MakeLowLatencyInputStream. |
| 66 AudioInputStream* MakeInputStream(const AudioParameters& params, | 68 AudioInputStream* MakeInputStream(const AudioParameters& params, |
| 67 const std::string& device_id); | 69 const std::string& device_id); |
| 68 | 70 |
| 69 // Gets the native sample rate of Pulse. | 71 // Gets the native sample rate of Pulse. |
| 70 int GetNativeSampleRate(); | 72 int GetNativeSampleRate(); |
| 71 | 73 |
| 72 pa_threaded_mainloop* input_mainloop_; | 74 pa_threaded_mainloop* input_mainloop_; |
| 73 pa_context* input_context_; | 75 pa_context* input_context_; |
| 74 AudioDeviceNames* devices_; | 76 AudioDeviceNames* devices_; |
| 75 int native_input_sample_rate_; | 77 int native_input_sample_rate_; |
| 76 | 78 |
| 77 DISALLOW_COPY_AND_ASSIGN(AudioManagerPulse); | 79 DISALLOW_COPY_AND_ASSIGN(AudioManagerPulse); |
| 78 }; | 80 }; |
| 79 | 81 |
| 80 } // namespace media | 82 } // namespace media |
| 81 | 83 |
| 82 #endif // MEDIA_AUDIO_PULSE_AUDIO_MANAGER_PULSE_H_ | 84 #endif // MEDIA_AUDIO_PULSE_AUDIO_MANAGER_PULSE_H_ |
| OLD | NEW |