mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
80 lines
2.4 KiB
C++
80 lines
2.4 KiB
C++
/* Copyright 2012 Mozilla Foundation and Mozilla contributors
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#ifndef mozilla_dom_system_b2g_audiomanager_h__
|
|
#define mozilla_dom_system_b2g_audiomanager_h__
|
|
|
|
#include "mozilla/Observer.h"
|
|
#include "nsAutoPtr.h"
|
|
#include "nsIAudioManager.h"
|
|
#include "nsIObserver.h"
|
|
#include "AudioChannelAgent.h"
|
|
#include "android_audio/AudioSystem.h"
|
|
|
|
// {b2b51423-502d-4d77-89b3-7786b562b084}
|
|
#define NS_AUDIOMANAGER_CID {0x94f6fd70, 0x7615, 0x4af9, \
|
|
{0x89, 0x10, 0xf9, 0x3c, 0x55, 0xe6, 0x62, 0xec}}
|
|
#define NS_AUDIOMANAGER_CONTRACTID "@mozilla.org/telephony/audiomanager;1"
|
|
|
|
using namespace mozilla::dom;
|
|
|
|
namespace mozilla {
|
|
namespace hal {
|
|
class SwitchEvent;
|
|
typedef Observer<SwitchEvent> SwitchObserver;
|
|
} // namespace hal
|
|
|
|
namespace dom {
|
|
namespace gonk {
|
|
class RecoverTask;
|
|
class AudioChannelVolInitCallback;
|
|
class AudioManager : public nsIAudioManager
|
|
, public nsIObserver
|
|
{
|
|
public:
|
|
NS_DECL_ISUPPORTS
|
|
NS_DECL_NSIAUDIOMANAGER
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
AudioManager();
|
|
~AudioManager();
|
|
|
|
// When audio backend is dead, recovery task needs to read all volume
|
|
// settings then set back into audio backend.
|
|
friend class RecoverTask;
|
|
friend class AudioChannelVolInitCallback;
|
|
|
|
protected:
|
|
int32_t mPhoneState;
|
|
int mCurrentStreamVolumeTbl[AUDIO_STREAM_CNT];
|
|
|
|
android::status_t SetStreamVolumeIndex(int32_t aStream, int32_t aIndex);
|
|
android::status_t GetStreamVolumeIndex(int32_t aStream, int32_t *aIndex);
|
|
|
|
private:
|
|
nsAutoPtr<mozilla::hal::SwitchObserver> mObserver;
|
|
nsCOMPtr<AudioChannelAgent> mPhoneAudioAgent;
|
|
|
|
void HandleBluetoothStatusChanged(nsISupports* aSubject,
|
|
const char* aTopic,
|
|
const nsCString aAddress);
|
|
};
|
|
|
|
} /* namespace gonk */
|
|
} /* namespace dom */
|
|
} /* namespace mozilla */
|
|
|
|
#endif // mozilla_dom_system_b2g_audiomanager_h__
|