Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM MediaCapabilities.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_MEDIACAPABILITIESBINDING_H_
#define DOM_MEDIACAPABILITIESBINDING_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 AudioConfiguration;
struct AudioConfigurationAtoms;
class MediaCapabilities;
class MediaCapabilitiesInfo;
struct MediaConfigurationAtoms;
struct MediaDecodingConfigurationAtoms;
struct MediaEncodingConfigurationAtoms;
struct NativePropertyHooks;
class ProtoAndIfaceCache;
struct VideoConfiguration;
struct VideoConfigurationAtoms;
} // namespace dom
} // namespace mozilla
namespace mozilla {
namespace dom {
enum class MediaDecodingType : uint8_t {
File,
Media_source,
};
namespace binding_detail {
template <> struct EnumStrings<MediaDecodingType> {
static const nsLiteralCString Values[2];
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, MediaDecodingType aArgument, JS::MutableHandle<JS::Value> aValue);
enum class MediaEncodingType : uint8_t {
Record,
Transmission,
};
namespace binding_detail {
template <> struct EnumStrings<MediaEncodingType> {
static const nsLiteralCString Values[2];
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, MediaEncodingType aArgument, JS::MutableHandle<JS::Value> aValue);
enum class HdrMetadataType : uint8_t {
SmpteSt2086,
SmpteSt2094_10,
SmpteSt2094_40,
};
namespace binding_detail {
template <> struct EnumStrings<HdrMetadataType> {
static const nsLiteralCString Values[3];
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, HdrMetadataType aArgument, JS::MutableHandle<JS::Value> aValue);
enum class ColorGamut : uint8_t {
Srgb,
P3,
Rec2020,
};
namespace binding_detail {
template <> struct EnumStrings<ColorGamut> {
static const nsLiteralCString Values[3];
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, ColorGamut aArgument, JS::MutableHandle<JS::Value> aValue);
enum class TransferFunction : uint8_t {
Srgb,
Pq,
Hlg,
};
namespace binding_detail {
template <> struct EnumStrings<TransferFunction> {
static const nsLiteralCString Values[3];
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, TransferFunction aArgument, JS::MutableHandle<JS::Value> aValue);
struct AudioConfiguration : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Optional<uint64_t> mBitrate;
MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mChannels;
MOZ_INIT_OUTSIDE_CTOR nsString mContentType;
MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mSamplerate;
AudioConfiguration();
explicit inline AudioConfiguration(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
AudioConfiguration(AudioConfiguration&& aOther) = default;
explicit inline AudioConfiguration(const AudioConfiguration& 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);
AudioConfiguration&
operator=(const AudioConfiguration& aOther);
bool
operator==(const AudioConfiguration& aOther) const;
private:
static bool
InitIds(JSContext* cx, AudioConfigurationAtoms* atomsCache);
};
namespace binding_detail {
struct FastAudioConfiguration : public AudioConfiguration
{
inline FastAudioConfiguration()
: AudioConfiguration(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct VideoConfiguration : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR uint64_t mBitrate;
MOZ_INIT_OUTSIDE_CTOR Optional<ColorGamut> mColorGamut;
MOZ_INIT_OUTSIDE_CTOR nsString mContentType;
MOZ_INIT_OUTSIDE_CTOR double mFramerate;
MOZ_INIT_OUTSIDE_CTOR Optional<bool> mHasAlphaChannel;
MOZ_INIT_OUTSIDE_CTOR Optional<HdrMetadataType> mHdrMetadataType;
MOZ_INIT_OUTSIDE_CTOR uint32_t mHeight;
MOZ_INIT_OUTSIDE_CTOR Optional<nsString> mScalabilityMode;
MOZ_INIT_OUTSIDE_CTOR Optional<TransferFunction> mTransferFunction;
MOZ_INIT_OUTSIDE_CTOR uint32_t mWidth;
VideoConfiguration();
explicit inline VideoConfiguration(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
VideoConfiguration(VideoConfiguration&& aOther) = default;
explicit inline VideoConfiguration(const VideoConfiguration& 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);
VideoConfiguration&
operator=(const VideoConfiguration& aOther);
private:
static bool
InitIds(JSContext* cx, VideoConfigurationAtoms* atomsCache);
};
namespace binding_detail {
struct FastVideoConfiguration : public VideoConfiguration
{
inline FastVideoConfiguration()
: VideoConfiguration(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct MediaConfiguration : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Optional<AudioConfiguration> mAudio;
MOZ_INIT_OUTSIDE_CTOR Optional<VideoConfiguration> mVideo;
MediaConfiguration();
explicit inline MediaConfiguration(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
MediaConfiguration(MediaConfiguration&& aOther) = default;
explicit inline MediaConfiguration(const MediaConfiguration& 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);
MediaConfiguration&
operator=(const MediaConfiguration& aOther);
private:
static bool
InitIds(JSContext* cx, MediaConfigurationAtoms* atomsCache);
};
namespace binding_detail {
struct FastMediaConfiguration : public MediaConfiguration
{
inline FastMediaConfiguration()
: MediaConfiguration(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct MediaDecodingConfiguration : public MediaConfiguration
{
MOZ_INIT_OUTSIDE_CTOR MediaDecodingType mType;
MediaDecodingConfiguration();
explicit inline MediaDecodingConfiguration(const FastDictionaryInitializer& )
: MediaConfiguration(FastDictionaryInitializer())
{
// Do nothing here; this is used by our "Fast" subclass
}
MediaDecodingConfiguration(MediaDecodingConfiguration&& aOther) = default;
explicit inline MediaDecodingConfiguration(const MediaDecodingConfiguration& aOther)
: MediaConfiguration(FastDictionaryInitializer())
{
*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);
MediaDecodingConfiguration&
operator=(const MediaDecodingConfiguration& aOther);
private:
static bool
InitIds(JSContext* cx, MediaDecodingConfigurationAtoms* atomsCache);
};
namespace binding_detail {
struct FastMediaDecodingConfiguration : public MediaDecodingConfiguration
{
inline FastMediaDecodingConfiguration()
: MediaDecodingConfiguration(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct MediaEncodingConfiguration : public MediaConfiguration
{
MOZ_INIT_OUTSIDE_CTOR MediaEncodingType mType;
MediaEncodingConfiguration();
explicit inline MediaEncodingConfiguration(const FastDictionaryInitializer& )
: MediaConfiguration(FastDictionaryInitializer())
{
// Do nothing here; this is used by our "Fast" subclass
}
MediaEncodingConfiguration(MediaEncodingConfiguration&& aOther) = default;
explicit inline MediaEncodingConfiguration(const MediaEncodingConfiguration& aOther)
: MediaConfiguration(FastDictionaryInitializer())
{
*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);
MediaEncodingConfiguration&
operator=(const MediaEncodingConfiguration& aOther);
private:
static bool
InitIds(JSContext* cx, MediaEncodingConfigurationAtoms* atomsCache);
};
namespace binding_detail {
struct FastMediaEncodingConfiguration : public MediaEncodingConfiguration
{
inline FastMediaEncodingConfiguration()
: MediaEncodingConfiguration(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
namespace MediaCapabilities_Binding {
typedef mozilla::dom::MediaCapabilities NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::MediaCapabilities* 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, bool aDefineOnGlobal);
inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
{
/* Get the interface prototype object for this class. This will create the
object as needed. */
return GetPerInterfaceObjectHandle(aCx, prototypes::id::MediaCapabilities,
&CreateInterfaceObjects,
/* aDefineOnGlobal = */ true);
}
inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
{
/* Get the interface object for this class. This will create the object as
needed. */
return GetPerInterfaceObjectHandle(aCx, constructors::id::MediaCapabilities,
&CreateInterfaceObjects,
aDefineOnGlobal);
}
JSObject*
GetConstructorObject(JSContext* aCx);
} // namespace MediaCapabilities_Binding
namespace MediaCapabilitiesInfo_Binding {
typedef mozilla::dom::MediaCapabilitiesInfo NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::MediaCapabilitiesInfo* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
void
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
{
/* Get the interface prototype object for this class. This will create the
object as needed. */
return GetPerInterfaceObjectHandle(aCx, prototypes::id::MediaCapabilitiesInfo,
&CreateInterfaceObjects,
/* aDefineOnGlobal = */ true);
}
inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
{
/* Get the interface object for this class. This will create the object as
needed. */
return GetPerInterfaceObjectHandle(aCx, constructors::id::MediaCapabilitiesInfo,
&CreateInterfaceObjects,
aDefineOnGlobal);
}
JSObject*
GetConstructorObject(JSContext* aCx);
} // namespace MediaCapabilitiesInfo_Binding
} // namespace dom
template <>
struct MaxContiguousEnumValue<dom::MediaDecodingType>
{
static constexpr dom::MediaDecodingType value = dom::MediaDecodingType::Media_source;
static_assert(static_cast<uint8_t>(dom::MediaDecodingType::File) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(mozilla::ArrayLength(dom::binding_detail::EnumStrings<dom::MediaDecodingType>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
template <>
struct MaxContiguousEnumValue<dom::MediaEncodingType>
{
static constexpr dom::MediaEncodingType value = dom::MediaEncodingType::Transmission;
static_assert(static_cast<uint8_t>(dom::MediaEncodingType::Record) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(mozilla::ArrayLength(dom::binding_detail::EnumStrings<dom::MediaEncodingType>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
template <>
struct MaxContiguousEnumValue<dom::HdrMetadataType>
{
static constexpr dom::HdrMetadataType value = dom::HdrMetadataType::SmpteSt2094_40;
static_assert(static_cast<uint8_t>(dom::HdrMetadataType::SmpteSt2086) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(mozilla::ArrayLength(dom::binding_detail::EnumStrings<dom::HdrMetadataType>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
template <>
struct MaxContiguousEnumValue<dom::ColorGamut>
{
static constexpr dom::ColorGamut value = dom::ColorGamut::Rec2020;
static_assert(static_cast<uint8_t>(dom::ColorGamut::Srgb) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(mozilla::ArrayLength(dom::binding_detail::EnumStrings<dom::ColorGamut>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
template <>
struct MaxContiguousEnumValue<dom::TransferFunction>
{
static constexpr dom::TransferFunction value = dom::TransferFunction::Hlg;
static_assert(static_cast<uint8_t>(dom::TransferFunction::Srgb) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(mozilla::ArrayLength(dom::binding_detail::EnumStrings<dom::TransferFunction>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
} // namespace mozilla
#endif // DOM_MEDIACAPABILITIESBINDING_H_