| // Copyright 2014 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.interfaces; |
| |
| import "ui/mojo/geometry/geometry.mojom"; |
| |
| // See media/base/buffering_state.h for descriptions. |
| // Kept in sync with media::BufferingState via static_asserts. |
| enum BufferingState { |
| HAVE_NOTHING, |
| HAVE_ENOUGH, |
| }; |
| |
| // See media/base/audio_decoder_config.h for descriptions. |
| // Kept in sync with media::AudioCodec via static_asserts. |
| enum AudioCodec { |
| UNKNOWN = 0, |
| AAC = 1, |
| MP3 = 2, |
| PCM = 3, |
| Vorbis = 4, |
| FLAC = 5, |
| AMR_NB = 6, |
| AMR_WB = 7, |
| PCM_MULAW = 8, |
| GSM_MS = 9, |
| PCM_S16BE = 10, |
| PCM_S24BE = 11, |
| Opus = 12, |
| EAC3 = 13, |
| PCM_ALAW = 14, |
| ALAC = 15, |
| AC3 = 16, |
| MAX = AC3, |
| }; |
| |
| // See media/base/channel_layout.h for descriptions. |
| // Kept in sync with media::ChannelLayout via static_asserts. |
| enum ChannelLayout { |
| k_NONE = 0, |
| k_UNSUPPORTED = 1, |
| k_MONO = 2, |
| k_STEREO = 3, |
| k_2_1 = 4, |
| k_SURROUND = 5, |
| k_4_0 = 6, |
| k_2_2 = 7, |
| k_QUAD = 8, |
| k_5_0 = 9, |
| k_5_1 = 10, |
| k_5_0_BACK = 11, |
| k_5_1_BACK = 12, |
| k_7_0 = 13, |
| k_7_1 = 14, |
| k_7_1_WIDE = 15, |
| k_STEREO_DOWNMIX = 16, |
| k_2POINT1 = 17, |
| k_3_1 = 18, |
| k_4_1 = 19, |
| k_6_0 = 20, |
| k_6_0_FRONT = 21, |
| k_HEXAGONAL = 22, |
| k_6_1 = 23, |
| k_6_1_BACK = 24, |
| k_6_1_FRONT = 25, |
| k_7_0_FRONT = 26, |
| k_7_1_WIDE_BACK = 27, |
| k_OCTAGONAL = 28, |
| k_DISCRETE = 29, |
| k_STEREO_AND_KEYBOARD_MIC = 30, |
| k_4_1_QUAD_SIDE = 31, |
| k_MAX = k_4_1_QUAD_SIDE, |
| }; |
| |
| // See media/base/sample_format.h for descriptions. |
| // Kept in sync with media::SampleFormat via static_asserts. |
| enum SampleFormat { |
| UNKNOWN = 0, |
| U8, |
| S16, |
| S32, |
| F32, |
| PlanarS16, |
| PlanarF32, |
| PlanarS32, |
| S24, |
| Max = S24, |
| }; |
| |
| // See media/base/video_types.h for descriptions. |
| // Kept in sync with media::VideoPixelFormat via static_asserts. |
| enum VideoFormat { |
| UNKNOWN = 0, |
| I420, |
| YV12, |
| YV16, |
| YV12A, |
| YV24, |
| NV12, |
| NV21, |
| UYVY, |
| YUY2, |
| ARGB, |
| XRGB, |
| RGB24, |
| RGB32, |
| MJPEG, |
| MT21, |
| YUV420P9, |
| YUV420P10, |
| YUV422P9, |
| YUV422P10, |
| YUV444P9, |
| YUV444P10, |
| FORMAT_MAX = YUV444P10, |
| }; |
| |
| // Kept in sync with media::ColorSpace via static_asserts. |
| enum ColorSpace { |
| UNSPECIFIED = 0, |
| JPEG = 1, |
| HD_REC709 = 2, |
| SD_REC601 = 3, |
| MAX = SD_REC601, |
| }; |
| |
| // See media/base/video_decoder_config.h for descriptions. |
| // Kept in sync with media::VideoCodec via static_asserts. |
| enum VideoCodec { |
| UNKNOWN = 0, |
| H264, |
| VC1, |
| MPEG2, |
| MPEG4, |
| Theora, |
| VP8, |
| VP9, |
| HEVC, |
| Max = HEVC, |
| }; |
| |
| // See media/base/video_decoder_config.h for descriptions. |
| // Kept in sync with media::VideoCodecProfile via static_asserts. |
| enum VideoCodecProfile { |
| VIDEO_CODEC_PROFILE_UNKNOWN = -1, |
| VIDEO_CODEC_PROFILE_MIN = VIDEO_CODEC_PROFILE_UNKNOWN, |
| H264PROFILE_MIN = 0, |
| H264PROFILE_BASELINE = H264PROFILE_MIN, |
| H264PROFILE_MAIN, |
| H264PROFILE_EXTENDED, |
| H264PROFILE_HIGH, |
| H264PROFILE_HIGH10PROFILE, |
| H264PROFILE_HIGH422PROFILE, |
| H264PROFILE_HIGH444PREDICTIVEPROFILE, |
| H264PROFILE_SCALABLEBASELINE, |
| H264PROFILE_SCALABLEHIGH, |
| H264PROFILE_STEREOHIGH, |
| H264PROFILE_MULTIVIEWHIGH, |
| H264PROFILE_MAX = H264PROFILE_MULTIVIEWHIGH, |
| VP8PROFILE_MIN, |
| VP8PROFILE_ANY = VP8PROFILE_MIN, |
| VP8PROFILE_MAX = VP8PROFILE_ANY, |
| VP9PROFILE_MIN, |
| VP9PROFILE_PROFILE0 = VP9PROFILE_MIN, |
| VP9PROFILE_PROFILE1, |
| VP9PROFILE_PROFILE2, |
| VP9PROFILE_PROFILE3, |
| VP9PROFILE_MAX = VP9PROFILE_PROFILE3, |
| HEVCPROFILE_MIN, |
| HEVCPROFILE_MAIN = HEVCPROFILE_MIN, |
| HEVCPROFILE_MAIN10, |
| HEVCPROFILE_MAIN_STILL_PICTURE, |
| HEVCPROFILE_MAX = HEVCPROFILE_MAIN_STILL_PICTURE, |
| VIDEO_CODEC_PROFILE_MAX = HEVCPROFILE_MAX, |
| }; |
| |
| // See media/base/encryption_scheme.h. |
| // Kept in sync with media::CipherMode via static_asserts. |
| enum CipherMode { |
| UNENCRYPTED = 0, |
| AES_CTR, |
| AES_CBC, |
| MAX = AES_CBC |
| }; |
| |
| // This defines a mojo transport format for media::EncryptionScheme::Pattern |
| // See media/base/encryption_scheme.h for description. |
| struct Pattern { |
| uint32 encrypt_blocks; |
| uint32 skip_blocks; |
| }; |
| |
| // This defines a mojo transport format for media::EncryptionScheme. |
| // See media/base/encryption_scheme.h for description. |
| struct EncryptionScheme { |
| CipherMode mode; |
| Pattern pattern; |
| }; |
| |
| // This defines a mojo transport format for media::AudioDecoderConfig. |
| // See media/base/audio_decoder_config.h for descriptions. |
| struct AudioDecoderConfig { |
| AudioCodec codec; |
| SampleFormat sample_format; |
| ChannelLayout channel_layout; |
| int32 samples_per_second; |
| array<uint8>? extra_data; |
| int64 seek_preroll_usec; |
| int32 codec_delay; |
| EncryptionScheme encryption_scheme; |
| }; |
| |
| // This defines a mojo transport format for media::VideoDecoderConfig. |
| // See media/base/video_decoder_config.h for descriptions. |
| struct VideoDecoderConfig { |
| VideoCodec codec; |
| VideoCodecProfile profile; |
| VideoFormat format; |
| ColorSpace color_space; |
| mojo.Size coded_size; |
| mojo.Rect visible_rect; |
| mojo.Size natural_size; |
| array<uint8>? extra_data; |
| EncryptionScheme encryption_scheme; |
| }; |
| |
| // This defines a mojo transport format for media::SubsampleEntry. |
| // See media/base/decrypt_config.h for descriptions. |
| struct SubsampleEntry { |
| uint32 clear_bytes; |
| uint32 cypher_bytes; |
| }; |
| |
| // This defines a mojo transport format for media::DecryptConfig. |
| // See media/base/decrypt_config.h for descriptions. |
| struct DecryptConfig { |
| string key_id; |
| string iv; |
| array<SubsampleEntry> subsamples; |
| }; |
| |
| // This defines a mojo transport format for media::DecoderBuffer. |
| struct DecoderBuffer { |
| int64 timestamp_usec; |
| int64 duration_usec; |
| |
| // The number of bytes present in this buffer. The data is not serialized |
| // along with this structure and must be read from a separate DataPipe. |
| uint32 data_size; |
| |
| // Indicates whether or not this buffer is a random access point. |
| bool is_key_frame; |
| |
| // This is backed by an std::vector and results in a few copies. |
| // Into the vector, onto and off the MessagePipe, back into a vector. |
| array<uint8>? side_data; |
| uint32 side_data_size; |
| |
| // DecryptConfig for a encrypted buffer. NULL if the buffer is not encrypted. |
| DecryptConfig? decrypt_config; |
| |
| // These fields indicate the amount of data to discard after decoding. |
| int64 front_discard_usec; |
| int64 back_discard_usec; |
| |
| // Indicates this buffer is part of a splice around |splice_timestamp_usec|. |
| int64 splice_timestamp_usec; |
| }; |
| |
| // This defines a mojo transport format for media::AudioBuffer. |
| struct AudioBuffer { |
| // Format of the audio. |
| SampleFormat sample_format; |
| |
| // How the channels are laid out. |
| ChannelLayout channel_layout; |
| |
| // Number of channels. |
| int32 channel_count; |
| |
| // Sample rate of the buffer. |
| int32 sample_rate; |
| |
| // Number of frames in the buffer. |
| int32 frame_count; |
| |
| // True if end of stream. |
| bool end_of_stream; |
| |
| // Timestamp in microseconds of the first frame. |
| int64 timestamp_usec; |
| |
| // Channel data. Will be null for EOS buffers. |
| array<uint8>? data; |
| }; |
| |
| // This defines a mojo transport format for media::VideoFrame. |
| struct VideoFrame { |
| // Format of the frame. |
| VideoFormat format; |
| |
| // Width and height of the video frame, in pixels. |
| mojo.Size coded_size; |
| |
| // Visible size of the frame. |
| mojo.Rect visible_rect; |
| |
| // Natural size of the frame. |
| mojo.Size natural_size; |
| |
| // True if end of stream. |
| bool end_of_stream; |
| |
| // Timestamp in microseconds of the associated frame. |
| int64 timestamp_usec; |
| |
| // Reference to the shared memory containing the frame's data. |
| handle<shared_buffer> frame_data; |
| uint64 frame_data_size; |
| |
| // Stride and offsets for each plane. Offsets are relative to the start |
| // of |frame_data|. |
| int32 y_stride; |
| int32 u_stride; |
| int32 v_stride; |
| uint64 y_offset; |
| uint64 u_offset; |
| uint64 v_offset; |
| }; |