Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM VideoFrame.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_VIDEOFRAMEBINDING_H_
#define DOM_VIDEOFRAMEBINDING_H_
#include "DOMRectBinding.h"
#include "VideoColorSpaceBinding.h"
#include "WebGLRenderingContextBinding.h"
#include "js/CallAndConstruct.h"
#include "js/RootingAPI.h"
#include "js/TypeDecls.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/EnumTypeTraits.h"
#include "mozilla/Span.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/PrototypeList.h"
namespace mozilla {
namespace dom {
struct DOMRectInit;
struct NativePropertyHooks;
struct PlaneLayout;
struct PlaneLayoutAtoms;
class ProtoAndIfaceCache;
struct VideoColorSpaceInit;
class VideoFrame;
struct VideoFrameBufferInitAtoms;
struct VideoFrameCopyToOptionsAtoms;
struct VideoFrameInitAtoms;
} // namespace dom
} // namespace mozilla
namespace mozilla {
namespace dom {
enum class AlphaOption : uint8_t {
Keep,
Discard,
};
namespace binding_detail {
template <> struct EnumStrings<AlphaOption> {
static constexpr nsLiteralCString Values[2] {
"keep"_ns,
"discard"_ns,
};
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, AlphaOption aArgument, JS::MutableHandle<JS::Value> aValue);
enum class VideoPixelFormat : uint8_t {
I420,
I420P10,
I420P12,
I420A,
I420AP10,
I420AP12,
I422,
I422P10,
I422P12,
I422A,
I422AP10,
I422AP12,
I444,
I444P10,
I444P12,
I444A,
I444AP10,
I444AP12,
NV12,
RGBA,
RGBX,
BGRA,
BGRX,
};
namespace binding_detail {
template <> struct EnumStrings<VideoPixelFormat> {
static constexpr nsLiteralCString Values[23] {
"I420"_ns,
"I420P10"_ns,
"I420P12"_ns,
"I420A"_ns,
"I420AP10"_ns,
"I420AP12"_ns,
"I422"_ns,
"I422P10"_ns,
"I422P12"_ns,
"I422A"_ns,
"I422AP10"_ns,
"I422AP12"_ns,
"I444"_ns,
"I444P10"_ns,
"I444P12"_ns,
"I444A"_ns,
"I444AP10"_ns,
"I444AP12"_ns,
"NV12"_ns,
"RGBA"_ns,
"RGBX"_ns,
"BGRA"_ns,
"BGRX"_ns,
};
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, VideoPixelFormat aArgument, JS::MutableHandle<JS::Value> aValue);
struct PlaneLayout : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR uint32_t mOffset;
MOZ_INIT_OUTSIDE_CTOR uint32_t mStride;
PlaneLayout();
explicit inline PlaneLayout(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
PlaneLayout(PlaneLayout&& aOther) = default;
explicit inline PlaneLayout(const PlaneLayout& aOther)
{
*this = aOther;
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
void
TraceDictionary(JSTracer* trc);
PlaneLayout&
operator=(const PlaneLayout& aOther);
private:
static bool
InitIds(JSContext* cx, PlaneLayoutAtoms* atomsCache);
};
namespace binding_detail {
struct FastPlaneLayout : public PlaneLayout
{
inline FastPlaneLayout()
: PlaneLayout(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct VideoFrameInit : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR AlphaOption mAlpha;
MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mDisplayHeight;
MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mDisplayWidth;
MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mDuration;
MOZ_INIT_OUTSIDE_CTOR Optional<int64_t> mTimestamp;
MOZ_INIT_OUTSIDE_CTOR Optional<DOMRectInit> mVisibleRect;
VideoFrameInit();
explicit inline VideoFrameInit(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
VideoFrameInit(VideoFrameInit&& aOther) = default;
explicit inline VideoFrameInit(const VideoFrameInit& aOther)
{
*this = aOther;
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
void
TraceDictionary(JSTracer* trc);
VideoFrameInit&
operator=(const VideoFrameInit& aOther);
private:
static bool
InitIds(JSContext* cx, VideoFrameInitAtoms* atomsCache);
};
namespace binding_detail {
struct FastVideoFrameInit : public VideoFrameInit
{
inline FastVideoFrameInit()
: VideoFrameInit(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct VideoFrameBufferInit : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR uint32_t mCodedHeight;
MOZ_INIT_OUTSIDE_CTOR uint32_t mCodedWidth;
MOZ_INIT_OUTSIDE_CTOR Optional<VideoColorSpaceInit> mColorSpace;
MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mDisplayHeight;
MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mDisplayWidth;
MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mDuration;
MOZ_INIT_OUTSIDE_CTOR VideoPixelFormat mFormat;
MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<PlaneLayout>> mLayout;
MOZ_INIT_OUTSIDE_CTOR int64_t mTimestamp;
MOZ_INIT_OUTSIDE_CTOR Optional<DOMRectInit> mVisibleRect;
VideoFrameBufferInit();
explicit inline VideoFrameBufferInit(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
VideoFrameBufferInit(VideoFrameBufferInit&& aOther) = default;
explicit inline VideoFrameBufferInit(const VideoFrameBufferInit& aOther)
{
*this = aOther;
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
void
TraceDictionary(JSTracer* trc);
VideoFrameBufferInit&
operator=(const VideoFrameBufferInit& aOther);
private:
static bool
InitIds(JSContext* cx, VideoFrameBufferInitAtoms* atomsCache);
};
namespace binding_detail {
struct FastVideoFrameBufferInit : public VideoFrameBufferInit
{
inline FastVideoFrameBufferInit()
: VideoFrameBufferInit(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct VideoFrameCopyToOptions : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Optional<PredefinedColorSpace> mColorSpace;
MOZ_INIT_OUTSIDE_CTOR Optional<VideoPixelFormat> mFormat;
MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<PlaneLayout>> mLayout;
MOZ_INIT_OUTSIDE_CTOR Optional<DOMRectInit> mRect;
VideoFrameCopyToOptions();
explicit inline VideoFrameCopyToOptions(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
VideoFrameCopyToOptions(VideoFrameCopyToOptions&& aOther) = default;
explicit inline VideoFrameCopyToOptions(const VideoFrameCopyToOptions& aOther)
{
*this = aOther;
}
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
void
TraceDictionary(JSTracer* trc);
VideoFrameCopyToOptions&
operator=(const VideoFrameCopyToOptions& aOther);
private:
static bool
InitIds(JSContext* cx, VideoFrameCopyToOptionsAtoms* atomsCache);
};
namespace binding_detail {
struct FastVideoFrameCopyToOptions : public VideoFrameCopyToOptions
{
inline FastVideoFrameCopyToOptions()
: VideoFrameCopyToOptions(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
namespace VideoFrame_Binding {
typedef mozilla::dom::VideoFrame NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::VideoFrame* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
template <class T>
inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
{
JS::Rooted<JSObject*> reflector(aCx);
return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
}
void
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, DefineInterfaceProperty aDefineOnGlobal);
JS::Handle<JSObject*>
GetConstructorObjectHandle(JSContext* aCx);
inline bool CreateAndDefineOnGlobal(JSContext* aCx)
{
// Get the interface or namespace object for this class. This will
// create the object as needed and always define the properties for
// it on the global. The caller should make sure the interface or
// namespace is exposed on the global before calling this.
return GetPerInterfaceObjectHandle(aCx, constructors::id::VideoFrame,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace VideoFrame_Binding
} // namespace dom
template <>
struct MaxContiguousEnumValue<dom::AlphaOption>
{
static constexpr dom::AlphaOption value = dom::AlphaOption::Discard;
static_assert(static_cast<uint8_t>(dom::AlphaOption::Keep) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(std::size(dom::binding_detail::EnumStrings<dom::AlphaOption>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
template <>
struct MaxContiguousEnumValue<dom::VideoPixelFormat>
{
static constexpr dom::VideoPixelFormat value = dom::VideoPixelFormat::BGRX;
static_assert(static_cast<uint8_t>(dom::VideoPixelFormat::I420) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(std::size(dom::binding_detail::EnumStrings<dom::VideoPixelFormat>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
} // namespace mozilla
#endif // DOM_VIDEOFRAMEBINDING_H_