1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 et tw=78: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_AudioTrack_h
8 #define mozilla_dom_AudioTrack_h
10 #include "MediaTrack.h"
15 class AudioStreamTrack
;
17 class AudioTrack
: public MediaTrack
{
19 AudioTrack(nsIGlobalObject
* aOwnerGlobal
, const nsAString
& aId
,
20 const nsAString
& aKind
, const nsAString
& aLabel
,
21 const nsAString
& aLanguage
, bool aEnabled
,
22 AudioStreamTrack
* aStreamTrack
= nullptr);
24 NS_DECL_ISUPPORTS_INHERITED
25 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AudioTrack
, MediaTrack
)
27 JSObject
* WrapObject(JSContext
* aCx
,
28 JS::Handle
<JSObject
*> aGivenProto
) override
;
30 AudioTrack
* AsAudioTrack() override
{ return this; }
32 void SetEnabledInternal(bool aEnabled
, int aFlags
) override
;
34 // Get associated audio stream track when the audio track comes from
35 // MediaStream. This might be nullptr when the src of owning HTMLMediaElement
36 // is not MediaStream.
37 AudioStreamTrack
* GetAudioStreamTrack() { return mAudioStreamTrack
; }
40 bool Enabled() const { return mEnabled
; }
42 void SetEnabled(bool aEnabled
);
45 virtual ~AudioTrack();
48 RefPtr
<AudioStreamTrack
> mAudioStreamTrack
;
52 } // namespace mozilla
54 #endif // mozilla_dom_AudioTrack_h