| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_ANDROID_AUDIO_MANAGER_ANDROID_H_ | 5 #ifndef MEDIA_AUDIO_ANDROID_AUDIO_MANAGER_ANDROID_H_ |
| 6 #define MEDIA_AUDIO_ANDROID_AUDIO_MANAGER_ANDROID_H_ | 6 #define MEDIA_AUDIO_ANDROID_AUDIO_MANAGER_ANDROID_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 13 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
| 14 #include "media/audio/audio_manager_base.h" | 14 #include "media/audio/audio_manager_base.h" |
| 15 | 15 |
| 16 namespace media { | 16 namespace media { |
| 17 | 17 |
| 18 class OpenSLESOutputStream; | 18 class OpenSLESOutputStream; |
| 19 | 19 |
| 20 // Android implemention of AudioManager. | 20 // Android implemention of AudioManager. |
| 21 class MEDIA_EXPORT AudioManagerAndroid : public AudioManagerBase { | 21 class MEDIA_EXPORT AudioManagerAndroid : public AudioManagerBase { |
| 22 public: | 22 public: |
| 23 AudioManagerAndroid( | 23 AudioManagerAndroid( |
| 24 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 24 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 25 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, | 25 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, |
| 26 AudioLogFactory* audio_log_factory); | 26 AudioLogFactory* audio_log_factory); |
| 27 ~AudioManagerAndroid() override; |
| 27 | 28 |
| 28 void InitializeIfNeeded(); | 29 void InitializeIfNeeded(); |
| 29 | 30 |
| 30 // Implementation of AudioManager. | 31 // Implementation of AudioManager. |
| 32 void Shutdown() override; |
| 31 bool HasAudioOutputDevices() override; | 33 bool HasAudioOutputDevices() override; |
| 32 bool HasAudioInputDevices() override; | 34 bool HasAudioInputDevices() override; |
| 33 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; | 35 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; |
| 34 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; | 36 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; |
| 35 AudioParameters GetInputStreamParameters( | 37 AudioParameters GetInputStreamParameters( |
| 36 const std::string& device_id) override; | 38 const std::string& device_id) override; |
| 37 | 39 |
| 38 AudioOutputStream* MakeAudioOutputStream( | 40 AudioOutputStream* MakeAudioOutputStream( |
| 39 const AudioParameters& params, | 41 const AudioParameters& params, |
| 40 const std::string& device_id, | 42 const std::string& device_id, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 69 void SetMute(JNIEnv* env, | 71 void SetMute(JNIEnv* env, |
| 70 const base::android::JavaParamRef<jobject>& obj, | 72 const base::android::JavaParamRef<jobject>& obj, |
| 71 jboolean muted); | 73 jboolean muted); |
| 72 | 74 |
| 73 // Sets a volume that applies to all this manager's output audio streams. | 75 // Sets a volume that applies to all this manager's output audio streams. |
| 74 // This overrides other SetVolume calls (e.g. through AudioHostMsg_SetVolume). | 76 // This overrides other SetVolume calls (e.g. through AudioHostMsg_SetVolume). |
| 75 void SetOutputVolumeOverride(double volume); | 77 void SetOutputVolumeOverride(double volume); |
| 76 bool HasOutputVolumeOverride(double* out_volume) const; | 78 bool HasOutputVolumeOverride(double* out_volume) const; |
| 77 | 79 |
| 78 protected: | 80 protected: |
| 79 ~AudioManagerAndroid() override; | |
| 80 | |
| 81 AudioParameters GetPreferredOutputStreamParameters( | 81 AudioParameters GetPreferredOutputStreamParameters( |
| 82 const std::string& output_device_id, | 82 const std::string& output_device_id, |
| 83 const AudioParameters& input_params) override; | 83 const AudioParameters& input_params) override; |
| 84 | 84 |
| 85 private: | 85 private: |
| 86 jobject GetJavaAudioManager(); | 86 jobject GetJavaAudioManager(); |
| 87 bool HasNoAudioInputStreams(); | 87 bool HasNoAudioInputStreams(); |
| 88 void SetCommunicationAudioModeOn(bool on); | 88 void SetCommunicationAudioModeOn(bool on); |
| 89 bool SetAudioDevice(const std::string& device_id); | 89 bool SetAudioDevice(const std::string& device_id); |
| 90 int GetNativeOutputSampleRate(); | 90 int GetNativeOutputSampleRate(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 108 // If set, overrides volume level on output streams | 108 // If set, overrides volume level on output streams |
| 109 bool output_volume_override_set_; | 109 bool output_volume_override_set_; |
| 110 double output_volume_override_; | 110 double output_volume_override_; |
| 111 | 111 |
| 112 DISALLOW_COPY_AND_ASSIGN(AudioManagerAndroid); | 112 DISALLOW_COPY_AND_ASSIGN(AudioManagerAndroid); |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 } // namespace media | 115 } // namespace media |
| 116 | 116 |
| 117 #endif // MEDIA_AUDIO_ANDROID_AUDIO_MANAGER_ANDROID_H_ | 117 #endif // MEDIA_AUDIO_ANDROID_AUDIO_MANAGER_ANDROID_H_ |
| OLD | NEW |