VideoStreamTrack.h (1722B)
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 VIDEOSTREAMTRACK_H_ 7 #define VIDEOSTREAMTRACK_H_ 8 9 #include "DOMMediaStream.h" 10 #include "MediaStreamTrack.h" 11 12 namespace mozilla { 13 14 class VideoFrameContainer; 15 class VideoOutput; 16 17 namespace dom { 18 19 class VideoStreamTrack : public MediaStreamTrack { 20 public: 21 VideoStreamTrack( 22 nsPIDOMWindowInner* aWindow, mozilla::MediaTrack* aInputTrack, 23 MediaStreamTrackSource* aSource, 24 MediaStreamTrackState aState = MediaStreamTrackState::Live, 25 bool aMuted = false, 26 const MediaTrackConstraints& aConstraints = MediaTrackConstraints()); 27 28 already_AddRefed<MediaStreamTrack> Clone() override; 29 30 void Destroy() override; 31 32 VideoStreamTrack* AsVideoStreamTrack() override { return this; } 33 const VideoStreamTrack* AsVideoStreamTrack() const override { return this; } 34 35 void AddVideoOutput(VideoFrameContainer* aSink); 36 void AddVideoOutput(VideoOutput* aOutput); 37 void RemoveVideoOutput(VideoFrameContainer* aSink); 38 void RemoveVideoOutput(VideoOutput* aOutput); 39 40 /** 41 * Whether this VideoStreamTrack's video frames will have an alpha channel. 42 */ 43 bool HasAlpha() const { return GetSource().HasAlpha(); } 44 45 // WebIDL 46 void GetKind(nsAString& aKind) override { aKind.AssignLiteral("video"); } 47 48 void GetLabel(nsAString& aLabel, CallerType aCallerType) override; 49 50 private: 51 nsTArray<RefPtr<VideoOutput>> mVideoOutputs; 52 }; 53 54 } // namespace dom 55 } // namespace mozilla 56 57 #endif /* VIDEOSTREAMTRACK_H_ */