chromium/media/base/eme_constants.h

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef MEDIA_BASE_EME_CONSTANTS_H_
#define MEDIA_BASE_EME_CONSTANTS_H_

#include <stdint.h>

#include <optional>

#include "media/base/media_export.h"
#include "media/media_buildflags.h"

namespace media {

// Defines values that specify registered Initialization Data Types used
// in Encrypted Media Extensions (EME).
// http://w3c.github.io/encrypted-media/initdata-format-registry.html#registry
enum class EmeInitDataType {};

// Defines bitmask values that specify codecs used in Encrypted Media Extensions
// (EME). Generally codec profiles are not specified and it is assumed that the
// profile support for encrypted playback is the same as for clear playback.
// For VP9 we have older CDMs only supporting profile 0, while new CDMs could
// support profile 2. Profile 1 and 3 are not supported by EME, see
// https://crbug.com/898298.
enum EmeCodec : uint32_t {};

// *_ALL values should only be used for masking, do not use them to specify
// codec support because they may be extended to include more codecs.

SupportedCodecs;

// Dolby Vision profile 0 and 9 are based on AVC while profile 4, 5, 7 and 8 are
// based on HEVC.
constexpr SupportedCodecs EME_CODEC_DOLBY_VISION_AVC =;
constexpr SupportedCodecs EME_CODEC_DOLBY_VISION_HEVC =;

namespace {

constexpr SupportedCodecs GetMp4AudioCodecs() {}

constexpr SupportedCodecs GetMp4VideoCodecs() {}

}  // namespace

constexpr SupportedCodecs EME_CODEC_WEBM_AUDIO_ALL =;

constexpr SupportedCodecs EME_CODEC_WEBM_VIDEO_ALL =;

constexpr SupportedCodecs EME_CODEC_WEBM_ALL =;

constexpr SupportedCodecs EME_CODEC_MP4_AUDIO_ALL =;
constexpr SupportedCodecs EME_CODEC_MP4_VIDEO_ALL =;

constexpr SupportedCodecs EME_CODEC_MP4_ALL =;

constexpr SupportedCodecs EME_CODEC_AUDIO_ALL =;

constexpr SupportedCodecs EME_CODEC_VIDEO_ALL =;

constexpr SupportedCodecs EME_CODEC_ALL =;

#if BUILDFLAG(USE_PROPRIETARY_CODECS)
#if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER)
constexpr SupportedCodecs EME_CODEC_MP2T_VIDEO_ALL = EME_CODEC_AVC1;
static_assert(
    (EME_CODEC_MP2T_VIDEO_ALL & EME_CODEC_VIDEO_ALL) ==
        EME_CODEC_MP2T_VIDEO_ALL,
    "EME_CODEC_MP2T_VIDEO_ALL should be a subset of EME_CODEC_MP4_ALL");
#endif  // BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER)
#endif  // BUILDFLAG(USE_PROPRIETARY_CODECS)

// Used to declare support for distinctive identifier and persistent state.
// These are purposefully limited to not allow one to require the other, so that
// transitive requirements are not possible. Non-trivial refactoring would be
// required to support transitive requirements.
enum class EmeFeatureSupport {};

enum class EmeMediaType {};

enum class EmeConfigRuleState {};

struct MEDIA_EXPORT EmeConfig {};

inline bool operator==(EmeConfig const& lhs, EmeConfig const& rhs) {}

}  // namespace media

#endif  // MEDIA_BASE_EME_CONSTANTS_H_