Chromium Code Reviews| Index: chrome/browser/chromeos/audio_mixer_pulse.h |
| diff --git a/chrome/browser/chromeos/pulse_audio_mixer.h b/chrome/browser/chromeos/audio_mixer_pulse.h |
| similarity index 65% |
| rename from chrome/browser/chromeos/pulse_audio_mixer.h |
| rename to chrome/browser/chromeos/audio_mixer_pulse.h |
| index 33f7c1ca68dd5ffa4ff8d1d4c023b70191036442..91d906ee5d74b4bc9bf371ae244eb5eba8be2fc1 100644 |
| --- a/chrome/browser/chromeos/pulse_audio_mixer.h |
| +++ b/chrome/browser/chromeos/audio_mixer_pulse.h |
| @@ -2,8 +2,8 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef CHROME_BROWSER_CHROMEOS_PULSE_AUDIO_MIXER_H_ |
| -#define CHROME_BROWSER_CHROMEOS_PULSE_AUDIO_MIXER_H_ |
| +#ifndef CHROME_BROWSER_CHROMEOS_AUDIO_MIXER_PULSE_H_ |
| +#define CHROME_BROWSER_CHROMEOS_AUDIO_MIXER_PULSE_H_ |
| #pragma once |
| #include "base/basictypes.h" |
| @@ -12,6 +12,8 @@ |
| #include "base/scoped_ptr.h" |
| #include "base/thread.h" |
|
scherkus (not reviewing)
2010/12/22 22:31:58
nit: no blank line
|
| +#include "chrome/browser/chromeos/audio_mixer_base.h" |
| + |
| struct pa_context; |
| struct pa_cvolume; |
| struct pa_threaded_mainloop; |
| @@ -20,56 +22,27 @@ struct pa_sink_info; |
| namespace chromeos { |
| -class PulseAudioMixer { |
| +class AudioMixerPulse : public AudioMixerBase { |
| public: |
| - enum State { |
| - UNINITIALIZED = 0, |
| - INITIALIZING, |
| - READY, |
| - SHUTTING_DOWN, |
| - IN_ERROR |
| - }; |
| - |
| - PulseAudioMixer(); |
| - ~PulseAudioMixer(); |
| - |
| - // Non-blocking, connect to PulseAudio and find a default device, and call |
| - // callback when complete with success code. |
| - typedef Callback1<bool>::Type InitDoneCallback; |
| - bool Init(InitDoneCallback* callback); |
| - |
| - // Blocking init call guarantees PulseAudio is started before returning. |
| - bool InitSync(); |
| - |
| - // Blocking call. Returns a default of -inf on error. |
| - double GetVolumeDb() const; |
| - |
| - // Non-blocking, volume sent in as first param to callback. The callback is |
| - // only called if the function returns true. |
| - typedef Callback2<double, void*>::Type GetVolumeCallback; |
| - bool GetVolumeDbAsync(GetVolumeCallback* callback, void* user); |
| - |
| - // Non-blocking call. |
| - void SetVolumeDb(double vol_db); |
| - |
| - // Gets the mute state of the default device (true == mute). Blocking call. |
| - // Returns a default of false on error. |
| - bool IsMute() const; |
| - // Non-Blocking call. |
| - void SetMute(bool mute); |
| + AudioMixerPulse(); |
| + ~AudioMixerPulse(); |
|
scherkus (not reviewing)
2010/12/22 22:31:58
add virtual
|
| - // Returns READY if we have a valid working connection to PulseAudio. |
| - // This can return IN_ERROR if we lose the connection, even after an original |
| - // successful init. Non-blocking call. |
| - State CheckState() const; |
| + // Implementation of AudioMixer, see AudioMixerBase for explanations. |
| + virtual bool Init(InitDoneCallback* callback); |
| + virtual bool InitSync(); |
| + virtual double GetVolumeDb() const; |
| + virtual void GetVolumeLimits(double* vol_min, double* vol_max); |
| + virtual void SetVolumeDb(double vol_db); |
| + virtual bool IsMute() const; |
| + virtual void SetMute(bool mute); |
| + virtual State CheckState() const; |
| private: |
| struct AudioInfo; |
| - // These are the tasks to be run in the background on the worker thread. |
| + // The initialization task is run in the background on the worker thread. |
| void DoInit(InitDoneCallback* callback); |
| - void DoGetVolume(GetVolumeCallback* callback, void* user); |
| static void ConnectToPulseCallbackThunk(pa_context* c, void* userdata); |
| void OnConnectToPulseCallback(pa_context* c, bool* connect_done); |
| @@ -137,12 +110,12 @@ class PulseAudioMixer { |
| scoped_ptr<base::Thread> thread_; |
| - DISALLOW_COPY_AND_ASSIGN(PulseAudioMixer); |
| + DISALLOW_COPY_AND_ASSIGN(AudioMixerPulse); |
| }; |
| } // namespace chromeos |
| -DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::PulseAudioMixer); |
| +DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::AudioMixerPulse); |
| -#endif // CHROME_BROWSER_CHROMEOS_PULSE_AUDIO_MIXER_H_ |
| +#endif // CHROME_BROWSER_CHROMEOS_AUDIO_MIXER_PULSE_H_ |