| 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 69%
|
| rename from chrome/browser/chromeos/pulse_audio_mixer.h
|
| rename to chrome/browser/chromeos/audio_mixer_pulse.h
|
| index 33f7c1ca68dd5ffa4ff8d1d4c023b70191036442..898bccf9bc3866bcfc906f7d0900023cf1b50024 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"
|
|
|
| +#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();
|
| + AudioMixerPulse();
|
| + ~AudioMixerPulse();
|
|
|
| - // Blocking call. Returns a default of -inf on error.
|
| + // Implementation of AudioMixer, see AudioMixerBase for explanations.
|
| + bool Init(InitDoneCallback* callback);
|
| + bool InitSync();
|
| 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 GetVolumeLimits(double* vol_min, double* vol_max);
|
| 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);
|
| -
|
| - // 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;
|
|
|
| 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_
|
|
|
|
|