dom/system/gonk/AudioManager.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/system/gonk/AudioManager.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,82 @@
     1.4 +/* Copyright 2012 Mozilla Foundation and Mozilla contributors
     1.5 + *
     1.6 + * Licensed under the Apache License, Version 2.0 (the "License");
     1.7 + * you may not use this file except in compliance with the License.
     1.8 + * You may obtain a copy of the License at
     1.9 + *
    1.10 + *     http://www.apache.org/licenses/LICENSE-2.0
    1.11 + *
    1.12 + * Unless required by applicable law or agreed to in writing, software
    1.13 + * distributed under the License is distributed on an "AS IS" BASIS,
    1.14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    1.15 + * See the License for the specific language governing permissions and
    1.16 + * limitations under the License.
    1.17 + */
    1.18 +
    1.19 +#ifndef mozilla_dom_system_b2g_audiomanager_h__
    1.20 +#define mozilla_dom_system_b2g_audiomanager_h__
    1.21 +
    1.22 +#include "mozilla/Observer.h"
    1.23 +#include "nsAutoPtr.h"
    1.24 +#include "nsIAudioManager.h"
    1.25 +#include "nsIObserver.h"
    1.26 +#include "AudioChannelAgent.h"
    1.27 +#include "android_audio/AudioSystem.h"
    1.28 +
    1.29 +// {b2b51423-502d-4d77-89b3-7786b562b084}
    1.30 +#define NS_AUDIOMANAGER_CID {0x94f6fd70, 0x7615, 0x4af9, \
    1.31 +      {0x89, 0x10, 0xf9, 0x3c, 0x55, 0xe6, 0x62, 0xec}}
    1.32 +#define NS_AUDIOMANAGER_CONTRACTID "@mozilla.org/telephony/audiomanager;1"
    1.33 +
    1.34 +namespace mozilla {
    1.35 +namespace hal {
    1.36 +class SwitchEvent;
    1.37 +typedef Observer<SwitchEvent> SwitchObserver;
    1.38 +} // namespace hal
    1.39 +
    1.40 +namespace dom {
    1.41 +namespace gonk {
    1.42 +class RecoverTask;
    1.43 +class AudioChannelVolInitCallback;
    1.44 +class AudioManager : public nsIAudioManager
    1.45 +                   , public nsIObserver
    1.46 +{
    1.47 +public:
    1.48 +  NS_DECL_ISUPPORTS
    1.49 +  NS_DECL_NSIAUDIOMANAGER
    1.50 +  NS_DECL_NSIOBSERVER
    1.51 +
    1.52 +  AudioManager();
    1.53 +  ~AudioManager();
    1.54 +
    1.55 +  // When audio backend is dead, recovery task needs to read all volume
    1.56 +  // settings then set back into audio backend.
    1.57 +  friend class RecoverTask;
    1.58 +  friend class AudioChannelVolInitCallback;
    1.59 +
    1.60 +protected:
    1.61 +  int32_t mPhoneState;
    1.62 +  int mCurrentStreamVolumeTbl[AUDIO_STREAM_CNT];
    1.63 +
    1.64 +  nsresult SetStreamVolumeIndex(int32_t aStream, int32_t aIndex);
    1.65 +  nsresult GetStreamVolumeIndex(int32_t aStream, int32_t *aIndex);
    1.66 +
    1.67 +private:
    1.68 +  nsAutoPtr<mozilla::hal::SwitchObserver> mObserver;
    1.69 +  nsCOMPtr<nsIAudioChannelAgent>          mPhoneAudioAgent;
    1.70 +#ifdef MOZ_B2G_RIL
    1.71 +  bool                                    mMuteCallToRIL;
    1.72 +  // mIsMicMuted is only used for toggling mute call to RIL.
    1.73 +  bool                                    mIsMicMuted;
    1.74 +#endif
    1.75 +
    1.76 +  void HandleBluetoothStatusChanged(nsISupports* aSubject,
    1.77 +                                    const char* aTopic,
    1.78 +                                    const nsCString aAddress);
    1.79 +};
    1.80 +
    1.81 +} /* namespace gonk */
    1.82 +} /* namespace dom */
    1.83 +} /* namespace mozilla */
    1.84 +
    1.85 +#endif // mozilla_dom_system_b2g_audiomanager_h__

mercurial