1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #ifndef AUDIOSTREAMTRACK_H_ 7 #define AUDIOSTREAMTRACK_H_ 8 9 #include "MediaStreamTrack.h" 10 #include "DOMMediaStream.h" 11 12 namespace mozilla { 13 namespace dom { 14 15 class AudioStreamTrack : public MediaStreamTrack { 16 public: 17 AudioStreamTrack( 18 DOMMediaStream* aStream, TrackID aTrackID, TrackID aInputTrackID, 19 MediaStreamTrackSource* aSource, 20 const MediaTrackConstraints& aConstraints = MediaTrackConstraints()) MediaStreamTrack(aStream,aTrackID,aInputTrackID,aSource,aConstraints)21 : MediaStreamTrack(aStream, aTrackID, aInputTrackID, aSource, 22 aConstraints) {} 23 24 JSObject* WrapObject(JSContext* aCx, 25 JS::Handle<JSObject*> aGivenProto) override; 26 AsAudioStreamTrack()27 AudioStreamTrack* AsAudioStreamTrack() override { return this; } 28 AsAudioStreamTrack()29 const AudioStreamTrack* AsAudioStreamTrack() const override { return this; } 30 31 // WebIDL GetKind(nsAString & aKind)32 void GetKind(nsAString& aKind) override { aKind.AssignLiteral("audio"); } 33 34 void GetLabel(nsAString& aLabel, CallerType aCallerType) override; 35 36 protected: CloneInternal(DOMMediaStream * aOwningStream,TrackID aTrackID)37 already_AddRefed<MediaStreamTrack> CloneInternal( 38 DOMMediaStream* aOwningStream, TrackID aTrackID) override { 39 return do_AddRef(new AudioStreamTrack( 40 aOwningStream, aTrackID, mInputTrackID, mSource, mConstraints)); 41 } 42 }; 43 44 } // namespace dom 45 } // namespace mozilla 46 47 #endif /* AUDIOSTREAMTRACK_H_ */ 48