blob: 3684e5d0fdc8486a584caaf4e0ff5b5906b2d68b [file] [log] [blame]
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module media.stable.mojom;
import "media/mojo/mojom/media_types.mojom";
import "mojo/public/mojom/base/time.mojom";
import "mojo/public/mojom/base/values.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "ui/gfx/mojom/buffer_types.mojom";
import "ui/gfx/mojom/native_handle_types.mojom";
// Maps to |media.mojom.VideoCodec|.
[Stable, Extensible]
enum VideoCodec {
[Default] kUnknown = 0,
kH264,
kVC1,
kMPEG2,
kMPEG4,
kTheora,
kVP8,
kVP9,
kHEVC,
kDolbyVision,
kAV1,
// DO NOT ADD RANDOM VIDEO CODECS!
//
// The only acceptable time to add a new codec is if there is production code
// that uses said codec in the same CL.
};
// Maps to |media.mojom.VideoCodecProfile|.
[Stable, Extensible]
enum VideoCodecProfile {
// Keep the values in this enum unique, as they imply format (h.264 vs. VP8,
// for example), and keep the values for a particular format grouped
// together for clarity.
[Default] kVideoCodecProfileUnknown = -1,
kH264ProfileMin = 0,
kH264ProfileBaseline = kH264ProfileMin,
kH264ProfileMain = 1,
kH264ProfileExtended = 2,
kH264ProfileHigh = 3,
kH264ProfileHigh10 = 4,
kH264ProfileHigh422 = 5,
kH264ProfileHigh444Predictive = 6,
kH264ProfileScalableBaseline = 7,
kH264ProfileScalableHigh = 8,
kH264ProfileStereoHigh = 9,
kH264ProfileMultiviewHigh = 10,
kH264ProfileMax = kH264ProfileMultiviewHigh,
kVP8ProfileMin = 11,
kVP8ProfileAny = kVP8ProfileMin,
kVP8ProfileMax = kVP8ProfileAny,
kVP9ProfileMin = 12,
kVP9Profile0 = kVP9ProfileMin,
kVP9Profile1 = 13,
kVP9Profile2 = 14,
kVP9Profile3 = 15,
kVP9ProfileMax = kVP9Profile3,
kHEVCProfileMin = 16,
kHEVCProfileMain = kHEVCProfileMin,
kHEVCProfileMain10 = 17,
kHEVCProfileMainStillPicture = 18,
kHEVCProfileMax = kHEVCProfileMainStillPicture,
kDolbyVisionProfile0 = 19,
kDolbyVisionProfile4 = 20,
kDolbyVisionProfile5 = 21,
kDolbyVisionProfile7 = 22,
kTheoraProfileMin = 23,
kTheoraProfileAny = kTheoraProfileMin,
kTheoraProfileMax = kTheoraProfileAny,
kAV1ProfileMin = 24,
kAV1ProfileMain = kAV1ProfileMin,
kAV1ProfileHigh = 25,
kAV1ProfilePro = 26,
kAV1ProfileMax = kAV1ProfilePro,
kDolbyVisionProfile8 = 27,
kDolbyVisionProfile9 = 28,
};
// Based on |media.mojom.SubsampleEntry|.
// Next min field ID: 2
[Stable]
struct SubsampleEntry {
uint32 clear_bytes@0;
uint32 cypher_bytes@1;
};
// Maps to |media.mojom.EncryptionScheme|.
[Stable, Extensible]
enum EncryptionScheme {
[Default] kUnencrypted = 0,
kCenc, // 'cenc' subsample encryption using AES-CTR mode.
kCbcs, // 'cbcs' pattern encryption using AES-CBC mode.
};
// Based on |media.mojom.DecryptConfig| but does not depend on
// |media.mojom.EncryptionScheme| and |media.mojom.SubsampleEntry|.
// Next min field ID: 5
[Stable]
struct DecryptConfig {
EncryptionScheme encryption_scheme@0;
string key_id@1;
string iv@2;
array<SubsampleEntry> subsamples@3;
media.mojom.EncryptionPattern? encryption_pattern@4;
};
// Based on |gfx.mojom.ColorVolumeMetadata|.
// Next min field ID: 6
[Stable]
struct ColorVolumeMetadata {
gfx.mojom.PointF primary_r@0;
gfx.mojom.PointF primary_g@1;
gfx.mojom.PointF primary_b@2;
gfx.mojom.PointF white_point@3;
float luminance_max@4;
float luminance_min@5;
};
// Based on |gfx.mojom.HDRMetadata| but does not depend on
// |gfx.mojom.ColorVolumeMetadata|.
// Next min field ID: 3
[Stable]
struct HDRMetadata {
ColorVolumeMetadata color_volume_metadata@0;
uint32 max_content_light_level@1;
uint32 max_frame_average_light_level@2;
};
// Based on |media.mojom.VideoDecoderConfig| but does not depend on
// |media.mojom.VideoCodec|, |media.mojom.VideoCodecProfile|,
// |media.mojom.VideoTransformation|, |media.mojom.EncryptionScheme|,
// |media.mojom.VideoColorSpace| and |gfx.mojom.HDRMetadata|.
// Next min field ID: 11
[Stable]
struct VideoDecoderConfig {
VideoCodec codec@0;
VideoCodecProfile profile@1;
uint32 level@2;
bool has_alpha@3;
gfx.mojom.Size coded_size@4;
gfx.mojom.Rect visible_rect@5;
gfx.mojom.Size natural_size@6;
array<uint8> extra_data@7;
EncryptionScheme encryption_scheme@8;
ColorSpace color_space_info@9;
HDRMetadata? hdr_metadata@10;
};
// Based on |media.mojom.SupportedVideoDecoderConfig| but does not
// depend on |media.mojom.VideoCodecProfile|
// Next min field ID: 6
[Stable]
struct SupportedVideoDecoderConfig {
// Range of VideoCodecProfiles to match, inclusive.
VideoCodecProfile profile_min@0;
VideoCodecProfile profile_max@1;
// Range of coded sizes to match, inclusive in each dimension.
gfx.mojom.Size coded_size_min@2;
gfx.mojom.Size coded_size_max@3;
// Match configs that have encryption configured.
bool allow_encrypted@4;
// Do not match configs that do not have encryption configured.
bool require_encrypted@5;
};
[Stable, Extensible]
enum StatusCode {
kOk,
kAborted,
[Default] kError,
};
// Based on |media.mojom.StatusData|.
// Next min field ID: 6
[Stable]
struct StatusData {
string group@0;
StatusCode code@1;
string message@2;
array<mojo_base.mojom.Value> frames@3;
array<StatusData> causes@4;
mojo_base.mojom.Value data@5;
};
// Based on |media.mojom.Status|.
// Next min field ID: 1
[Stable]
struct Status {
StatusData? internal@0;
};
// Based on |media.mojom.DecoderBuffer| but does not depend on
// |media.mojom.DecryptConfig|.
// Next min field ID: 9
[Stable]
struct DecoderBuffer {
mojo_base.mojom.TimeDelta timestamp@0;
mojo_base.mojom.TimeDelta duration@1;
bool is_end_of_stream@2;
uint32 data_size@3;
bool is_key_frame@4;
array<uint8> side_data@5;
DecryptConfig? decrypt_config@6;
mojo_base.mojom.TimeDelta front_discard@7;
mojo_base.mojom.TimeDelta back_discard@8;
};
// Maps to |media.mojom.VideoDecoderType|.
[Stable, Extensible]
enum VideoDecoderType {
[Default] kUnknown,
kVaapi,
kVda,
kV4L2,
kTesting,
};
// Maps to |gfx.mojom.ColorSpacePrimaryID|.
[Stable, Extensible]
enum ColorSpacePrimaryID {
[Default] kInvalid,
kBT709,
kBT470M,
kBT470BG,
kSMPTE170M,
kSMPTE240M,
kFilm,
kBT2020,
kSMPTEST428_1,
kSMPTEST431_2,
kSMPTEST432_1,
kXYZ_D50,
kAdobeRGB,
kAppleGenericRGB,
kWideGamutColorSpin,
kCustom,
};
// Maps to |gfx.mojom.ColorSpaceTransferID|.
[Stable, Extensible]
enum ColorSpaceTransferID {
[Default] kInvalid,
kBT709,
kBT709Apple,
kGamma18,
kGamma22,
kGamma24,
kGamma28,
kSMPTE170M,
kSMPTE240M,
kLinear,
kLog,
kLogSqrt,
kIEC61966_2_4,
kBT1361_ECG,
kIEC61966_2_1,
kBT2020_10,
kBT2020_12,
kSMPTEST2084,
kSMPTEST428_1,
kARIB_STD_B67,
kIEC61966_2_1_HDR,
kLinearHDR,
kCustom,
kCustomHDR,
kPiecewiseHDR,
};
// Maps to |gfx.mojom.ColorSpaceMatrixID|.
[Stable, Extensible]
enum ColorSpaceMatrixID {
[Default] kInvalid,
kRGB,
kBT709,
kFCC,
kBT470BG,
kSMPTE170M,
kSMPTE240M,
kYCOCG,
kBT2020_NCL,
kBT2020_CL,
kYDZDX,
kGBR,
};
// Maps to |gfx.mojom.ColorSpaceRangeID|.
[Stable, Extensible]
enum ColorSpaceRangeID {
[Default] kInvalid,
kLimited,
kFull,
kDerived,
};
// Based on |gfx.mojom.ColorSpace| but does not depend on
// |gfx.mojom.ColorSpacePrimaryID|, |gfx.mojom.ColorSpaceTransferID|,
// |gfx.mojom.ColorSpaceMatrixID| and |gfx.mojom.ColorSpaceRangeID|.
// Next min field ID: 6
[Stable]
struct ColorSpace {
ColorSpacePrimaryID primaries@0;
ColorSpaceTransferID transfer@1;
ColorSpaceMatrixID matrix@2;
ColorSpaceRangeID range@3;
array<float, 9> custom_primary_matrix@4;
array<float, 7> transfer_params@5;
};
// Maps to |media.mojom.VideoPixelFormat|.
[Stable, Extensible]
enum VideoPixelFormat {
[Default] kPixelFormatUnknown = 0, // Unknown or unspecified format value.
kPixelFormatI420 =
1, // 12bpp YUV planar 1x1 Y, 2x2 UV samples, a.k.a. YU12.
// Note: Chrome does not actually support YVU compositing, so you probably
// don't actually want to use this. See http://crbug.com/784627.
kPixelFormatYV12 = 2, // 12bpp YVU planar 1x1 Y, 2x2 VU samples.
kPixelFormatI422 = 3, // 16bpp YUV planar 1x1 Y, 2x1 UV samples.
kPixelFormatI420A = 4, // 20bpp YUVA planar 1x1 Y, 2x2 UV, 1x1 A samples.
kPixelFormatI444 = 5, // 24bpp YUV planar, no subsampling.
kPixelFormatNV12 =
6, // 12bpp with Y plane followed by a 2x2 interleaved UV plane.
kPixelFormatNV21 =
7, // 12bpp with Y plane followed by a 2x2 interleaved VU plane.
kPixelFormatUYVY =
8, // 16bpp interleaved 2x1 U, 1x1 Y, 2x1 V, 1x1 Y samples.
kPixelFormatYUY2 =
9, // 16bpp interleaved 1x1 Y, 2x1 U, 1x1 Y, 2x1 V samples.
kPixelFormatARGB = 10, // 32bpp BGRA (byte-order), 1 plane.
kPixelFormatXRGB = 11, // 24bpp BGRX (byte-order), 1 plane.
kPixelFormatRGB24 = 12, // 24bpp BGR (byte-order), 1 plane.
kPixelFormatMJPEG = 14, // MJPEG compressed.
// The P* in the formats below designates the number of bits per pixel
// component. I.e. P9 is 9-bits per pixel component, P10 is 10-bits per pixel
// component, etc.
kPixelFormatYUV420P9 = 16,
kPixelFormatYUV420P10 = 17,
kPixelFormatYUV422P9 = 18,
kPixelFormatYUV422P10 = 19,
kPixelFormatYUV444P9 = 20,
kPixelFormatYUV444P10 = 21,
kPixelFormatYUV420P12 = 22,
kPixelFormatYUV422P12 = 23,
kPixelFormatYUV444P12 = 24,
kPixelFormatY16 = 26, // single 16bpp plane.
kPixelFormatABGR = 27, // 32bpp RGBA (byte-order), 1 plane.
kPixelFormatXBGR = 28, // 24bpp RGBX (byte-order), 1 plane.
kPixelFormatP016LE = 29, // 24bpp NV12, 16 bits per channel
kPixelFormatXR30 =
30, // 32bpp BGRX, 10 bits per channel, 2 bits ignored, 1 plane
kPixelFormatXB30 =
31, // 32bpp RGBX, 10 bits per channel, 2 bits ignored, 1 plane
kPixelFormatBGRA = 32, // 32bpp ARGB (byte-order), 1 plane.
kPixelFormatRGBAF16 = 33, // Half float RGBA, 1 plane.
};
// Based on |media.mojom.EosVideoFrameData|.
[Stable]
struct EosVideoFrameData {
};
// Based on |gfx.mojom.NativePixmapHandle|.
// Next min field ID: 2
[EnableIf=supports_native_pixmap, Stable]
struct NativePixmapHandle {
array<gfx.mojom.NativePixmapPlane> planes@0;
uint64 modifier@1;
};
// Based on |gfx.mojom.GpuMemoryBufferHandle| but does not depend on
// |gfx.mojom.GpuMemoryBufferPlatformHandle|.
// Next min field ID: 2
[Stable]
struct NativeGpuMemoryBufferHandle {
gfx.mojom.GpuMemoryBufferId id@0;
[EnableIf=supports_native_pixmap]
NativePixmapHandle? platform_handle@1;
};
// Based on |media.mojom.GpuMemoryBufferVideoFrameData| but does not depend
// on |gfx.mojom.GpuMemoryBufferHandle| or |gpu.mojom.MailboxHolder|.
// Next min field ID: 1
[Stable]
struct GpuMemoryBufferVideoFrameData {
NativeGpuMemoryBufferHandle gpu_memory_buffer_handle@0;
};
// Based on |media.mojom.VideoFrameMetadata| but does not depend on
// |media.mojom.VideoTransformation| or |media.mojom.CopyMode|.
// Next min field ID: 6
[Stable]
struct VideoFrameMetadata {
bool allow_overlay@0;
bool end_of_stream@1;
bool read_lock_fences_enabled@2;
bool protected_video@3;
bool hw_protected@4;
bool power_efficient@5;
};
// Based on |media.mojom.VideoFrameData| but does not depend on
// |media.mojom.EosVideoFrameData|, |media.mojom.SharedBufferVideoFrameData|,
// |media.mojom.GpuMemoryBufferVideoFrameData| or
// |media.mojom.MailboxVideoFrameData|.
[Stable]
union VideoFrameData {
EosVideoFrameData eos_data;
GpuMemoryBufferVideoFrameData gpu_memory_buffer_data;
};
// Based on |media.mojom.VideoFrame| but does not depend on
// |media.mojom.VideoPixelFormat|, |media.mojom.VideoFrameData|,
// |media.mojom.VideoFrameMetadata|, |gfx.mojom.ColorSpace| or
// or |gfx.mojom.HDRMetadata|.
// Next min field ID: 9
[Stable]
struct VideoFrame {
// Format of the frame.
VideoPixelFormat format@0;
// Width and height of the video frame, in pixels.
gfx.mojom.Size coded_size@1;
// Visible size of the frame.
gfx.mojom.Rect visible_rect@2;
// Natural size of the frame.
gfx.mojom.Size natural_size@3;
// Timestamp in microseconds of the associated frame.
mojo_base.mojom.TimeDelta timestamp@4;
// Contents of the video frame (or EOS marker).
VideoFrameData data@5;
// Extra properties associated with the VideoFrame.
VideoFrameMetadata metadata@6;
ColorSpace color_space@7;
HDRMetadata? hdr_metadata@8;
};
// Maps to |media.mojom.WaitingReason|.
[Stable, Extensible]
enum WaitingReason {
// The playback cannot start because "Media Data May Contain Encrypted Blocks"
// and no CDM is available. The playback will start after a CDM is set. See
// https://www.w3.org/TR/encrypted-media/#media-may-contain-encrypted-blocks
[Default] kNoCdm,
// The playback cannot proceed because some decryption key is not available.
// This could happen when the license exchange is delayed or failed. The
// playback will resume after the decryption key becomes available.
// See https://www.w3.org/TR/encrypted-media/#encrypted-block-encountered
kNoDecryptionKey,
// The playback cannot proceed because the decoder has lost its state, e.g.
// information about reference frames. Usually this only happens to hardware
// decoders. To recover from this state, reset the decoder and start decoding
// from a key frame, which can typically be accomplished by a pipeline seek.
kDecoderStateLost,
};
// Based on |media.mojom.MediaLogRecord|.
// Next min field ID: 4
[Stable]
struct MediaLogRecord {
[Stable, Extensible]
enum Type {
// See media/base/media_log_message_levels.h for info.
[Default] kMessage,
// See media/base/media_log_properties.h for info.
kMediaPropertyChange,
// See media/base/media_log_events.h for info.
kMediaEventTriggered,
kMediaStatus,
};
int32 id@0;
Type type@1;
mojo_base.mojom.DictionaryValue params@2;
mojo_base.mojom.TimeTicks time@3;
};