2012-09-18 23:07:33 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2012-10-30 21:39:38 +00:00
|
|
|
#ifndef AudioDestinationNode_h_
|
|
|
|
#define AudioDestinationNode_h_
|
2012-09-18 23:07:33 +00:00
|
|
|
|
|
|
|
#include "AudioNode.h"
|
2013-10-08 18:20:33 +00:00
|
|
|
#include "nsIDOMEventListener.h"
|
|
|
|
#include "nsIAudioChannelAgent.h"
|
2012-09-18 23:07:33 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class AudioContext;
|
|
|
|
|
2013-04-15 01:52:55 +00:00
|
|
|
class AudioDestinationNode : public AudioNode
|
2013-10-08 18:20:33 +00:00
|
|
|
, public nsIDOMEventListener
|
|
|
|
, public nsIAudioChannelAgentCallback
|
2012-09-18 23:07:33 +00:00
|
|
|
{
|
|
|
|
public:
|
2013-05-16 23:30:42 +00:00
|
|
|
// This node type knows what MediaStreamGraph to use based on
|
|
|
|
// whether it's in offline mode.
|
|
|
|
AudioDestinationNode(AudioContext* aContext,
|
|
|
|
bool aIsOffline,
|
|
|
|
uint32_t aNumberOfChannels = 0,
|
|
|
|
uint32_t aLength = 0,
|
|
|
|
float aSampleRate = 0.0f);
|
2012-09-18 23:07:33 +00:00
|
|
|
|
2013-09-10 05:05:22 +00:00
|
|
|
virtual void DestroyMediaStream() MOZ_OVERRIDE;
|
|
|
|
|
2012-09-18 23:07:33 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2013-10-08 18:20:33 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AudioDestinationNode, AudioNode)
|
2012-09-18 23:07:33 +00:00
|
|
|
|
2013-04-25 16:29:54 +00:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
2012-09-18 23:07:33 +00:00
|
|
|
|
2013-05-05 15:48:45 +00:00
|
|
|
virtual uint16_t NumberOfOutputs() const MOZ_FINAL MOZ_OVERRIDE
|
2012-09-25 03:31:58 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-06-10 17:32:28 +00:00
|
|
|
uint32_t MaxChannelCount() const;
|
|
|
|
virtual void SetChannelCount(uint32_t aChannelCount,
|
|
|
|
ErrorResult& aRv) MOZ_OVERRIDE;
|
|
|
|
|
2013-07-04 00:44:32 +00:00
|
|
|
void Mute();
|
|
|
|
void Unmute();
|
|
|
|
|
2013-05-16 23:30:42 +00:00
|
|
|
void StartRendering();
|
|
|
|
|
2013-09-10 05:10:53 +00:00
|
|
|
void OfflineShutdown();
|
2013-05-16 23:31:08 +00:00
|
|
|
|
2013-10-08 18:20:33 +00:00
|
|
|
// nsIDOMEventListener
|
|
|
|
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
|
|
|
|
|
|
|
|
// nsIAudioChannelAgentCallback
|
|
|
|
NS_IMETHOD CanPlayChanged(int32_t aCanPlay);
|
|
|
|
|
2013-05-16 23:30:42 +00:00
|
|
|
private:
|
2013-10-08 18:20:33 +00:00
|
|
|
void SetCanPlay(bool aCanPlay);
|
|
|
|
|
2013-09-10 05:10:53 +00:00
|
|
|
SelfReference<AudioDestinationNode> mOfflineRenderingRef;
|
2013-05-16 23:30:42 +00:00
|
|
|
uint32_t mFramesToProduce;
|
2013-10-08 18:20:33 +00:00
|
|
|
|
|
|
|
nsCOMPtr<nsIAudioChannelAgent> mAudioChannelAgent;
|
2012-09-18 23:07:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-30 21:39:38 +00:00
|
|
|
#endif
|
|
|
|
|