VideoColorSpace.h (1834B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim:set ts=2 sw=2 sts=2 et cindent: */ 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/. */ 6 7 #ifndef mozilla_dom_VideoColorSpace_h 8 #define mozilla_dom_VideoColorSpace_h 9 10 #include "js/TypeDecls.h" 11 #include "mozilla/ErrorResult.h" 12 #include "mozilla/dom/BindingDeclarations.h" 13 #include "mozilla/dom/VideoColorSpaceBinding.h" 14 #include "nsCycleCollectionParticipant.h" 15 #include "nsWrapperCache.h" 16 17 class nsIGlobalObject; 18 19 namespace mozilla::dom { 20 21 class VideoColorSpace final : public nsISupports, public nsWrapperCache { 22 public: 23 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 24 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(VideoColorSpace) 25 26 public: 27 VideoColorSpace(nsIGlobalObject* aParent, const VideoColorSpaceInit& aInit); 28 29 protected: 30 ~VideoColorSpace() = default; 31 32 public: 33 nsIGlobalObject* GetParentObject() const; 34 35 JSObject* WrapObject(JSContext* aCx, 36 JS::Handle<JSObject*> aGivenProto) override; 37 38 static already_AddRefed<VideoColorSpace> Constructor( 39 const GlobalObject& aGlobal, const VideoColorSpaceInit& aInit, 40 ErrorResult& aRv); 41 42 const Nullable<VideoColorPrimaries>& GetPrimaries() const { 43 return mInit.mPrimaries; 44 } 45 46 const Nullable<VideoTransferCharacteristics>& GetTransfer() const { 47 return mInit.mTransfer; 48 } 49 50 const Nullable<VideoMatrixCoefficients>& GetMatrix() const { 51 return mInit.mMatrix; 52 } 53 54 const Nullable<bool>& GetFullRange() const { return mInit.mFullRange; } 55 56 private: 57 nsCOMPtr<nsIGlobalObject> mParent; 58 const VideoColorSpaceInit mInit; 59 }; 60 61 } // namespace mozilla::dom 62 63 #endif // mozilla_dom_VideoColorSpace_h