Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / media / base / eme_constants.h
blobba49c7d6a72d9e3307f64449ee37d4821550ce00
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_BASE_EME_CONSTANTS_H_
6 #define MEDIA_BASE_EME_CONSTANTS_H_
8 #include <stdint.h>
10 namespace media {
12 // Defines values that specify registered Initialization Data Types used
13 // in Encrypted Media Extensions (EME).
14 // http://w3c.github.io/encrypted-media/initdata-format-registry.html#registry
15 // The mask values are stored in a InitDataTypeMask.
16 enum class EmeInitDataType {
17 UNKNOWN,
18 WEBM,
19 CENC,
20 KEYIDS
23 typedef uint32_t InitDataTypeMask;
24 const InitDataTypeMask kInitDataTypeMaskNone = 0;
25 const InitDataTypeMask kInitDataTypeMaskWebM = 1 << 0;
26 const InitDataTypeMask kInitDataTypeMaskCenc = 1 << 1;
27 const InitDataTypeMask kInitDataTypeMaskKeyIds = 1 << 2;
29 // Defines bitmask values that specify codecs used in Encrypted Media Extension
30 // (EME). Each value represents a codec within a specific container.
31 // The mask values are stored in a SupportedCodecs.
32 enum EmeCodec {
33 // *_ALL values should only be used for masking, do not use them to specify
34 // codec support because they may be extended to include more codecs.
35 EME_CODEC_NONE = 0,
36 EME_CODEC_WEBM_OPUS = 1 << 0,
37 EME_CODEC_WEBM_VORBIS = 1 << 1,
38 EME_CODEC_WEBM_AUDIO_ALL = EME_CODEC_WEBM_OPUS | EME_CODEC_WEBM_VORBIS,
39 EME_CODEC_WEBM_VP8 = 1 << 2,
40 EME_CODEC_WEBM_VP9 = 1 << 3,
41 EME_CODEC_WEBM_VIDEO_ALL = (EME_CODEC_WEBM_VP8 | EME_CODEC_WEBM_VP9),
42 EME_CODEC_WEBM_ALL = (EME_CODEC_WEBM_AUDIO_ALL | EME_CODEC_WEBM_VIDEO_ALL),
43 #if defined(USE_PROPRIETARY_CODECS)
44 EME_CODEC_MP4_AAC = 1 << 4,
45 EME_CODEC_MP4_AUDIO_ALL = EME_CODEC_MP4_AAC,
46 EME_CODEC_MP4_AVC1 = 1 << 5,
47 EME_CODEC_MP4_VIDEO_ALL = EME_CODEC_MP4_AVC1,
48 EME_CODEC_MP4_ALL = (EME_CODEC_MP4_AUDIO_ALL | EME_CODEC_MP4_VIDEO_ALL),
49 EME_CODEC_AUDIO_ALL = (EME_CODEC_WEBM_AUDIO_ALL | EME_CODEC_MP4_AUDIO_ALL),
50 EME_CODEC_VIDEO_ALL = (EME_CODEC_WEBM_VIDEO_ALL | EME_CODEC_MP4_VIDEO_ALL),
51 EME_CODEC_ALL = (EME_CODEC_WEBM_ALL | EME_CODEC_MP4_ALL),
52 #else
53 EME_CODEC_AUDIO_ALL = EME_CODEC_WEBM_AUDIO_ALL,
54 EME_CODEC_VIDEO_ALL = EME_CODEC_WEBM_VIDEO_ALL,
55 EME_CODEC_ALL = EME_CODEC_WEBM_ALL,
56 #endif // defined(USE_PROPRIETARY_CODECS)
59 typedef uint32_t SupportedCodecs;
61 enum class EmeSessionTypeSupport {
62 // Invalid default value.
63 INVALID,
64 // The session type is not supported.
65 NOT_SUPPORTED,
66 // The session type is supported if a distinctive identifier is available.
67 SUPPORTED_WITH_IDENTIFIER,
68 // The session type is always supported.
69 SUPPORTED,
72 // Used to declare support for distinctive identifier and persistent state.
73 // These are purposefully limited to not allow one to require the other, so that
74 // transitive requirements are not possible. Non-trivial refactoring would be
75 // required to support transitive requirements.
76 enum class EmeFeatureSupport {
77 // Invalid default value.
78 INVALID,
79 // Access to the feature is not supported at all.
80 NOT_SUPPORTED,
81 // Access to the feature may be requested.
82 REQUESTABLE,
83 // Access to the feature cannot be blocked.
84 ALWAYS_ENABLED,
87 enum class EmeMediaType {
88 AUDIO,
89 VIDEO,
92 // Robustness values understood by KeySystems.
93 // Note: key_systems.cc expects this ordering in GetRobustnessConfigRule(),
94 // make sure to correct that code if this list changes.
95 enum class EmeRobustness {
96 INVALID,
97 EMPTY,
98 SW_SECURE_CRYPTO,
99 SW_SECURE_DECODE,
100 HW_SECURE_CRYPTO,
101 HW_SECURE_DECODE,
102 HW_SECURE_ALL,
105 // Configuration rules indicate the configuration state required to support a
106 // configuration option (note: a configuration option may be disallowing a
107 // feature). Configuration rules are used to answer queries about distinctive
108 // identifier, persistent state, and robustness requirements, as well as to
109 // describe support for different session types.
111 // If in the future there are reasons to request user permission other than
112 // access to a distinctive identifier, then additional rules should be added.
113 // Rules are implemented in ConfigState and are otherwise opaque.
114 enum class EmeConfigRule {
115 // The configuration option is not supported.
116 NOT_SUPPORTED,
117 // The configuration option prevents use of a distinctive identifier.
118 IDENTIFIER_NOT_ALLOWED,
119 // The configuration option is supported if a distinctive identifier is
120 // available.
121 IDENTIFIER_REQUIRED,
122 // The configuration option is supported, but the user experience may be
123 // improved if a distinctive identifier is available.
124 IDENTIFIER_RECOMMENDED,
125 // The configuration option prevents use of persistent state.
126 PERSISTENCE_NOT_ALLOWED,
127 // The configuration option is supported if persistent state is available.
128 PERSISTENCE_REQUIRED,
129 // The configuration option is supported if both a distinctive identifier and
130 // persistent state are available.
131 IDENTIFIER_AND_PERSISTENCE_REQUIRED,
132 // The configuration option prevents use of hardware-secure codecs.
133 // This rule only has meaning on platforms that distinguish hardware-secure
134 // codecs (ie. Android).
135 HW_SECURE_CODECS_NOT_ALLOWED,
136 // The configuration option is supported if hardware-secure codecs are used.
137 // This rule only has meaning on platforms that distinguish hardware-secure
138 // codecs (ie. Android).
139 HW_SECURE_CODECS_REQUIRED,
140 // The configuration option is supported without conditions.
141 SUPPORTED,
144 } // namespace media
146 #endif // MEDIA_BASE_EME_CONSTANTS_H_