Bug 1890793: Assert CallArgs::newTarget is not gray. r=spidermonkey-reviewers,sfink...
[gecko.git] / dom / media / AudioTrack.h
blob29104801caa9f5eca884ce8ecf1b019e9e71d54c
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"
12 namespace mozilla::dom {
14 class AudioStreamTrack;
16 class AudioTrack : public MediaTrack {
17 public:
18 AudioTrack(nsIGlobalObject* aOwnerGlobal, const nsAString& aId,
19 const nsAString& aKind, const nsAString& aLabel,
20 const nsAString& aLanguage, bool aEnabled,
21 AudioStreamTrack* aStreamTrack = nullptr);
23 NS_DECL_ISUPPORTS_INHERITED
24 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AudioTrack, MediaTrack)
26 JSObject* WrapObject(JSContext* aCx,
27 JS::Handle<JSObject*> aGivenProto) override;
29 AudioTrack* AsAudioTrack() override { return this; }
31 void SetEnabledInternal(bool aEnabled, int aFlags) override;
33 // Get associated audio stream track when the audio track comes from
34 // MediaStream. This might be nullptr when the src of owning HTMLMediaElement
35 // is not MediaStream.
36 AudioStreamTrack* GetAudioStreamTrack() { return mAudioStreamTrack; }
38 // WebIDL
39 bool Enabled() const { return mEnabled; }
41 void SetEnabled(bool aEnabled);
43 private:
44 virtual ~AudioTrack();
46 bool mEnabled;
47 RefPtr<AudioStreamTrack> mAudioStreamTrack;
50 } // namespace mozilla::dom
52 #endif // mozilla_dom_AudioTrack_h