Chromium Code Reviews| Index: media/audio/pulse/audio_manager_pulse.h |
| diff --git a/media/audio/linux/audio_manager_linux.h b/media/audio/pulse/audio_manager_pulse.h |
| similarity index 56% |
| copy from media/audio/linux/audio_manager_linux.h |
| copy to media/audio/pulse/audio_manager_pulse.h |
| index cbcfe6251977b399144a718c50af10c585d21c18..af3880d43cfeaff67619d2d7bb94c5a82e75ac34 100644 |
| --- a/media/audio/linux/audio_manager_linux.h |
| +++ b/media/audio/pulse/audio_manager_pulse.h |
| @@ -1,27 +1,30 @@ |
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_ |
| -#define MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_ |
| +#ifndef MEDIA_AUDIO_PULSE_AUDIO_MANAGER_PULSE_H_ |
| +#define MEDIA_AUDIO_PULSE_AUDIO_MANAGER_PULSE_H_ |
| +#include <pulse/pulseaudio.h> |
| #include <string> |
| + |
| #include "base/compiler_specific.h" |
| #include "base/memory/ref_counted.h" |
| -#include "base/threading/thread.h" |
| #include "media/audio/audio_manager_base.h" |
| namespace media { |
| -class AlsaWrapper; |
| - |
| -class MEDIA_EXPORT AudioManagerLinux : public AudioManagerBase { |
| +class MEDIA_EXPORT AudioManagerPulse : public AudioManagerBase { |
| public: |
| - AudioManagerLinux(); |
| + AudioManagerPulse(); |
| + virtual ~AudioManagerPulse(); |
| + |
| + static AudioManager* Create(); |
| // Implementation of AudioManager. |
| virtual bool HasAudioOutputDevices() OVERRIDE; |
| virtual bool HasAudioInputDevices() OVERRIDE; |
| + virtual bool CanShowAudioInputSettings() OVERRIDE; |
|
DaleCurtis
2013/02/20 00:17:38
You'll need to rebase, this was deleted a few revi
no longer working on chromium
2013/02/20 14:43:38
Yes, I realized when Dylan pointed it out in anoth
|
| virtual void ShowAudioInputSettings() OVERRIDE; |
| virtual void GetAudioInputDeviceNames(media::AudioDeviceNames* device_names) |
| OVERRIDE; |
| @@ -38,32 +41,22 @@ class MEDIA_EXPORT AudioManagerLinux : public AudioManagerBase { |
| virtual AudioParameters GetPreferredLowLatencyOutputStreamParameters( |
| const AudioParameters& input_params) OVERRIDE; |
| - protected: |
| - virtual ~AudioManagerLinux(); |
| + int GetNativeSampleRate(); |
| private: |
| - enum StreamType { |
| - kStreamPlayback = 0, |
| - kStreamCapture, |
| - }; |
| - |
| - // Returns true if cras should be used for input/output. |
| - bool UseCras(); |
| - |
| - // Gets a list of available cras input devices. |
| - void GetCrasAudioInputDevices(media::AudioDeviceNames* device_names); |
| - |
| - // Gets a list of available ALSA input devices. |
| - void GetAlsaAudioInputDevices(media::AudioDeviceNames* device_names); |
| - |
| - // Gets the ALSA devices' names and ids. |
| - void GetAlsaDevicesInfo(void** hint, media::AudioDeviceNames* device_names); |
| + bool Init(); |
| + void Terminate(); |
| - // Checks if the specific ALSA device is available. |
| - bool IsAlsaDeviceAvailable(const char* device_name); |
| + // Callback to get the devices' info like names, used by GetInputDevices(). |
| + static void DevicesInfoCallback(pa_context* context, |
| + const pa_source_info* info, |
| + int error, void* user_data); |
| - // Returns true if a device is present for the given stream type. |
| - bool HasAnyAlsaAudioDevice(StreamType stream); |
| + // Callback to get the native sample rate of PulseAudio, used by |
| + // GetNativeSampleRate(). |
| + static void SamplerateInfoCallback(pa_context* context, |
|
DaleCurtis
2013/02/20 00:17:38
s/Samplerate/SampleRate/
Is there a reason you di
no longer working on chromium
2013/02/20 14:43:38
Done.
|
| + const pa_server_info* info, |
| + void* user_data); |
| // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream. |
| AudioOutputStream* MakeOutputStream(const AudioParameters& params); |
| @@ -72,11 +65,14 @@ class MEDIA_EXPORT AudioManagerLinux : public AudioManagerBase { |
| AudioInputStream* MakeInputStream(const AudioParameters& params, |
| const std::string& device_id); |
| - scoped_ptr<AlsaWrapper> wrapper_; |
| + pa_threaded_mainloop* input_mainloop_; |
| + pa_context* input_context_; |
| + AudioDeviceNames* devices_; |
| + int native_input_sample_rate_; |
| - DISALLOW_COPY_AND_ASSIGN(AudioManagerLinux); |
| + DISALLOW_COPY_AND_ASSIGN(AudioManagerPulse); |
| }; |
| } // namespace media |
| -#endif // MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_ |
| +#endif // MEDIA_AUDIO_PULSE_AUDIO_MANAGER_PULSE_H_ |