dom/system/gonk/AudioManager.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Copyright 2012 Mozilla Foundation and Mozilla contributors
michael@0 2 *
michael@0 3 * Licensed under the Apache License, Version 2.0 (the "License");
michael@0 4 * you may not use this file except in compliance with the License.
michael@0 5 * You may obtain a copy of the License at
michael@0 6 *
michael@0 7 * http://www.apache.org/licenses/LICENSE-2.0
michael@0 8 *
michael@0 9 * Unless required by applicable law or agreed to in writing, software
michael@0 10 * distributed under the License is distributed on an "AS IS" BASIS,
michael@0 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
michael@0 12 * See the License for the specific language governing permissions and
michael@0 13 * limitations under the License.
michael@0 14 */
michael@0 15
michael@0 16 #ifndef mozilla_dom_system_b2g_audiomanager_h__
michael@0 17 #define mozilla_dom_system_b2g_audiomanager_h__
michael@0 18
michael@0 19 #include "mozilla/Observer.h"
michael@0 20 #include "nsAutoPtr.h"
michael@0 21 #include "nsIAudioManager.h"
michael@0 22 #include "nsIObserver.h"
michael@0 23 #include "AudioChannelAgent.h"
michael@0 24 #include "android_audio/AudioSystem.h"
michael@0 25
michael@0 26 // {b2b51423-502d-4d77-89b3-7786b562b084}
michael@0 27 #define NS_AUDIOMANAGER_CID {0x94f6fd70, 0x7615, 0x4af9, \
michael@0 28 {0x89, 0x10, 0xf9, 0x3c, 0x55, 0xe6, 0x62, 0xec}}
michael@0 29 #define NS_AUDIOMANAGER_CONTRACTID "@mozilla.org/telephony/audiomanager;1"
michael@0 30
michael@0 31 namespace mozilla {
michael@0 32 namespace hal {
michael@0 33 class SwitchEvent;
michael@0 34 typedef Observer<SwitchEvent> SwitchObserver;
michael@0 35 } // namespace hal
michael@0 36
michael@0 37 namespace dom {
michael@0 38 namespace gonk {
michael@0 39 class RecoverTask;
michael@0 40 class AudioChannelVolInitCallback;
michael@0 41 class AudioManager : public nsIAudioManager
michael@0 42 , public nsIObserver
michael@0 43 {
michael@0 44 public:
michael@0 45 NS_DECL_ISUPPORTS
michael@0 46 NS_DECL_NSIAUDIOMANAGER
michael@0 47 NS_DECL_NSIOBSERVER
michael@0 48
michael@0 49 AudioManager();
michael@0 50 ~AudioManager();
michael@0 51
michael@0 52 // When audio backend is dead, recovery task needs to read all volume
michael@0 53 // settings then set back into audio backend.
michael@0 54 friend class RecoverTask;
michael@0 55 friend class AudioChannelVolInitCallback;
michael@0 56
michael@0 57 protected:
michael@0 58 int32_t mPhoneState;
michael@0 59 int mCurrentStreamVolumeTbl[AUDIO_STREAM_CNT];
michael@0 60
michael@0 61 nsresult SetStreamVolumeIndex(int32_t aStream, int32_t aIndex);
michael@0 62 nsresult GetStreamVolumeIndex(int32_t aStream, int32_t *aIndex);
michael@0 63
michael@0 64 private:
michael@0 65 nsAutoPtr<mozilla::hal::SwitchObserver> mObserver;
michael@0 66 nsCOMPtr<nsIAudioChannelAgent> mPhoneAudioAgent;
michael@0 67 #ifdef MOZ_B2G_RIL
michael@0 68 bool mMuteCallToRIL;
michael@0 69 // mIsMicMuted is only used for toggling mute call to RIL.
michael@0 70 bool mIsMicMuted;
michael@0 71 #endif
michael@0 72
michael@0 73 void HandleBluetoothStatusChanged(nsISupports* aSubject,
michael@0 74 const char* aTopic,
michael@0 75 const nsCString aAddress);
michael@0 76 };
michael@0 77
michael@0 78 } /* namespace gonk */
michael@0 79 } /* namespace dom */
michael@0 80 } /* namespace mozilla */
michael@0 81
michael@0 82 #endif // mozilla_dom_system_b2g_audiomanager_h__

mercurial