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 "MediaKeySystemAccessBinding.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/MediaKeySystemAccess.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/PrototypeList.h"
namespace mozilla {
namespace dom {
struct AudioConfiguration;
struct AudioConfigurationAtoms;
struct KeySystemTrackConfiguration;
struct KeySystemTrackConfigurationAtoms;
class MediaCapabilities;
struct MediaCapabilitiesDecodingInfoAtoms;
struct MediaCapabilitiesInfoAtoms;
struct MediaCapabilitiesKeySystemConfiguration;
struct MediaCapabilitiesKeySystemConfigurationAtoms;
struct MediaConfigurationAtoms;
struct MediaDecodingConfigurationAtoms;
struct MediaEncodingConfigurationAtoms;
class MediaKeySystemAccess;
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 constexpr nsLiteralCString Values[2] {
"file"_ns,
"media-source"_ns,
};
};
} // 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 constexpr nsLiteralCString Values[2] {
"record"_ns,
"transmission"_ns,
};
};
} // 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 constexpr nsLiteralCString Values[3] {
"smpteSt2086"_ns,
"smpteSt2094-10"_ns,
"smpteSt2094-40"_ns,
};
};
} // 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 constexpr nsLiteralCString Values[3] {
"srgb"_ns,
"p3"_ns,
"rec2020"_ns,
};
};
} // 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 constexpr nsLiteralCString Values[3] {
"srgb"_ns,
"pq"_ns,
"hlg"_ns,
};
};
} // 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);
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 KeySystemTrackConfiguration : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR nsString mEncryptionScheme;
MOZ_INIT_OUTSIDE_CTOR nsString mRobustness;
KeySystemTrackConfiguration();
explicit inline KeySystemTrackConfiguration(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
KeySystemTrackConfiguration(KeySystemTrackConfiguration&& aOther) = default;
explicit inline KeySystemTrackConfiguration(const KeySystemTrackConfiguration& 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);
KeySystemTrackConfiguration&
operator=(const KeySystemTrackConfiguration& aOther);
private:
static bool
InitIds(JSContext* cx, KeySystemTrackConfigurationAtoms* atomsCache);
};
namespace binding_detail {
struct FastKeySystemTrackConfiguration : public KeySystemTrackConfiguration
{
inline FastKeySystemTrackConfiguration()
: KeySystemTrackConfiguration(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct MediaCapabilitiesInfo : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR bool mPowerEfficient;
MOZ_INIT_OUTSIDE_CTOR bool mSmooth;
MOZ_INIT_OUTSIDE_CTOR bool mSupported;
MediaCapabilitiesInfo();
explicit inline MediaCapabilitiesInfo(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
MediaCapabilitiesInfo(MediaCapabilitiesInfo&& aOther) = default;
explicit inline MediaCapabilitiesInfo(const MediaCapabilitiesInfo& aOther)
{
*this = aOther;
}
bool
Init(const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
void
TraceDictionary(JSTracer* trc);
MediaCapabilitiesInfo&
operator=(const MediaCapabilitiesInfo& aOther);
private:
static bool
InitIds(JSContext* cx, MediaCapabilitiesInfoAtoms* atomsCache);
};
namespace binding_detail {
struct FastMediaCapabilitiesInfo : public MediaCapabilitiesInfo
{
inline FastMediaCapabilitiesInfo()
: MediaCapabilitiesInfo(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 MediaCapabilitiesDecodingInfo : public MediaCapabilitiesInfo
{
MOZ_INIT_OUTSIDE_CTOR RefPtr<mozilla::dom::MediaKeySystemAccess> mKeySystemAccess;
MediaCapabilitiesDecodingInfo();
explicit inline MediaCapabilitiesDecodingInfo(const FastDictionaryInitializer& )
: MediaCapabilitiesInfo(FastDictionaryInitializer())
{
// Do nothing here; this is used by our "Fast" subclass
}
MediaCapabilitiesDecodingInfo(MediaCapabilitiesDecodingInfo&& aOther) = default;
explicit inline MediaCapabilitiesDecodingInfo(const MediaCapabilitiesDecodingInfo& aOther)
: MediaCapabilitiesInfo(FastDictionaryInitializer())
{
*this = aOther;
}
bool
Init(const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
void
TraceDictionary(JSTracer* trc);
inline void
TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags)
{
ImplCycleCollectionTraverse(aCallback, mKeySystemAccess, "mKeySystemAccess", aFlags);
}
inline void
UnlinkForCC()
{
ImplCycleCollectionUnlink(mKeySystemAccess);
}
MediaCapabilitiesDecodingInfo&
operator=(const MediaCapabilitiesDecodingInfo& aOther);
private:
static bool
InitIds(JSContext* cx, MediaCapabilitiesDecodingInfoAtoms* atomsCache);
};
namespace binding_detail {
struct FastMediaCapabilitiesDecodingInfo : public MediaCapabilitiesDecodingInfo
{
inline FastMediaCapabilitiesDecodingInfo()
: MediaCapabilitiesDecodingInfo(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct MediaCapabilitiesKeySystemConfiguration : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Optional<KeySystemTrackConfiguration> mAudio;
MOZ_INIT_OUTSIDE_CTOR MediaKeysRequirement mDistinctiveIdentifier;
MOZ_INIT_OUTSIDE_CTOR nsString mInitDataType;
MOZ_INIT_OUTSIDE_CTOR nsString mKeySystem;
MOZ_INIT_OUTSIDE_CTOR MediaKeysRequirement mPersistentState;
MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<nsString>> mSessionTypes;
MOZ_INIT_OUTSIDE_CTOR Optional<KeySystemTrackConfiguration> mVideo;
MediaCapabilitiesKeySystemConfiguration();
explicit inline MediaCapabilitiesKeySystemConfiguration(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
MediaCapabilitiesKeySystemConfiguration(MediaCapabilitiesKeySystemConfiguration&& aOther) = default;
explicit inline MediaCapabilitiesKeySystemConfiguration(const MediaCapabilitiesKeySystemConfiguration& 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);
MediaCapabilitiesKeySystemConfiguration&
operator=(const MediaCapabilitiesKeySystemConfiguration& aOther);
private:
static bool
InitIds(JSContext* cx, MediaCapabilitiesKeySystemConfigurationAtoms* atomsCache);
};
namespace binding_detail {
struct FastMediaCapabilitiesKeySystemConfiguration : public MediaCapabilitiesKeySystemConfiguration
{
inline FastMediaCapabilitiesKeySystemConfiguration()
: MediaCapabilitiesKeySystemConfiguration(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 Optional<MediaCapabilitiesKeySystemConfiguration> mKeySystemConfiguration;
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
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, 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::MediaCapabilities,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace MediaCapabilities_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(std::size(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(std::size(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(std::size(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(std::size(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(std::size(dom::binding_detail::EnumStrings<dom::TransferFunction>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
} // namespace mozilla
#endif // DOM_MEDIACAPABILITIESBINDING_H_