Move key frame flag from StreamParserBuffer to DecoderBuffer
[chromium-blink-merge.git] / media / mojo / interfaces / media_types.mojom
blobeb10aedb8290f6f8e4e5a905d7e0c71f61dad287
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 module mojo;
7 import "mojo/services/public/interfaces/geometry/geometry.mojom";
9 // See media/base/buffering_state.h for descriptions.
10 // Kept in sync with media::BufferingState via COMPILE_ASSERTs.
11 enum BufferingState {
12   HAVE_NOTHING,
13   HAVE_ENOUGH,
16 // See media/base/audio_decoder_config.h for descriptions.
17 // Kept in sync with media::AudioCodec via COMPILE_ASSERTs.
18 enum AudioCodec {
19   UNKNOWN = 0,
20   AAC = 1,
21   MP3 = 2,
22   PCM = 3,
23   Vorbis = 4,
24   FLAC = 5,
25   AMR_NB = 6,
26   AMR_WB = 7,
27   PCM_MULAW = 8,
28   GSM_MS = 9,
29   PCM_S16BE = 10,
30   PCM_S24BE = 11,
31   Opus = 12,
32   // EAC3 = 13,
33   PCM_ALAW = 14,
34   MAX = PCM_ALAW,
37 // See media/base/channel_layout.h for descriptions.
38 // Kept in sync with media::ChannelLayout via COMPILE_ASSERTs.
39 // TODO(tim): The bindings generators will always prepend the enum name, should
40 // mojom therefore allow enum values starting with numbers?
41 enum ChannelLayout {
42   k_NONE = 0,
43   k_UNSUPPORTED = 1,
44   k_MONO = 2,
45   k_STEREO = 3,
46   k_2_1 = 4,
47   k_SURROUND = 5,
48   k_4_0 = 6,
49   k_2_2 = 7,
50   k_QUAD = 8,
51   k_5_0 = 9,
52   k_5_1 = 10,
53   k_5_0_BACK = 11,
54   k_5_1_BACK = 12,
55   k_7_0 = 13,
56   k_7_1 = 14,
57   k_7_1_WIDE = 15,
58   k_STEREO_DOWNMIX = 16,
59   k_2POINT1 = 17,
60   k_3_1 = 18,
61   k_4_1 = 19,
62   k_6_0 = 20,
63   k_6_0_FRONT = 21,
64   k_HEXAGONAL = 22,
65   k_6_1 = 23,
66   k_6_1_BACK = 24,
67   k_6_1_FRONT = 25,
68   k_7_0_FRONT = 26,
69   k_7_1_WIDE_BACK = 27,
70   k_OCTAGONAL = 28,
71   k_DISCRETE = 29,
72   k_STEREO_AND_KEYBOARD_MIC = 30,
73   k_4_1_QUAD_SIDE = 31,
74   k_MAX = k_4_1_QUAD_SIDE,
77 // See media/base/sample_format.h for descriptions.
78 // Kept in sync with media::SampleFormat via COMPILE_ASSERTs.
79 enum SampleFormat {
80   UNKNOWN = 0,
81   U8,
82   S16,
83   S32,
84   F32,
85   PlanarS16,
86   PlanarF32,
87   Max = PlanarF32,
90 // See media/base/video_frame.h for descriptions.
91 // Kept in sync with media::VideoFrame::Format via COMPILE_ASSERTs.
92 enum VideoFormat {
93   UNKNOWN = 0,
94   YV12,
95   YV16,
96   I420,
97   YV12A,
98   HOLE,
99   NATIVE_TEXTURE,
100   YV12J,
101   NV12,
102   YV24,
103   FORMAT_MAX = YV24,
106 // See media/base/video_decoder_config.h for descriptions.
107 // Kept in sync with media::VideoCodec via COMPILE_ASSERTs.
108 enum VideoCodec {
109   UNKNOWN = 0,
110   H264,
111   VC1,
112   MPEG2,
113   MPEG4,
114   Theora,
115   VP8,
116   VP9,
117   Max = VP9,
120 // See media/base/video_decoder_config.h for descriptions.
121 // Kept in sync with media::VideoCodecProfile via COMPILE_ASSERTs.
122 enum VideoCodecProfile {
123   VIDEO_CODEC_PROFILE_UNKNOWN = -1,
124   VIDEO_CODEC_PROFILE_MIN = VIDEO_CODEC_PROFILE_UNKNOWN,
125   H264PROFILE_MIN = 0,
126   H264PROFILE_BASELINE = H264PROFILE_MIN,
127   H264PROFILE_MAIN = 1,
128   H264PROFILE_EXTENDED = 2,
129   H264PROFILE_HIGH = 3,
130   H264PROFILE_HIGH10PROFILE = 4,
131   H264PROFILE_HIGH422PROFILE = 5,
132   H264PROFILE_HIGH444PREDICTIVEPROFILE = 6,
133   H264PROFILE_SCALABLEBASELINE = 7,
134   H264PROFILE_SCALABLEHIGH = 8,
135   H264PROFILE_STEREOHIGH = 9,
136   H264PROFILE_MULTIVIEWHIGH = 10,
137   H264PROFILE_MAX = H264PROFILE_MULTIVIEWHIGH,
138   VP8PROFILE_MIN = 11,
139   VP8PROFILE_ANY = VP8PROFILE_MIN,
140   VP8PROFILE_MAX = VP8PROFILE_ANY,
141   VP9PROFILE_MIN = 12,
142   VP9PROFILE_ANY = VP9PROFILE_MIN,
143   VP9PROFILE_MAX = VP9PROFILE_ANY,
144   VIDEO_CODEC_PROFILE_MAX = VP9PROFILE_MAX,
147 // This defines a mojo transport format for media::AudioDecoderConfig.
148 // See media/base/audio_decoder_config.h for descriptions.
149 struct AudioDecoderConfig {
150   AudioCodec codec;
151   SampleFormat sample_format;
152   ChannelLayout channel_layout;
153   int32 samples_per_second;
154   array<uint8>? extra_data;
155   int64 seek_preroll_usec;
156   int32 codec_delay;
159 // This defines a mojo transport format for media::VideoDecoderConfig.
160 // See media/base/video_decoder_config.h for descriptions.
161 struct VideoDecoderConfig {
162   VideoCodec codec;
163   VideoCodecProfile profile;
164   VideoFormat format;
165   Size coded_size;
166   Rect visible_rect;
167   Size natural_size;
168   array<uint8>? extra_data;
169   bool is_encrypted;
172 // This defines a mojo transport format for media::DecoderBuffer.
173 struct MediaDecoderBuffer {
174   // See media/base/buffers.h for details.
175   int64 timestamp_usec;
176   int64 duration_usec;
178   // The number of bytes in |data|.
179   uint32 data_size;
181   // Indicates whether or not this buffer is a random access point.
182   bool is_key_frame;
184   // This is backed by an std::vector and results in a few copies.
185   // Into the vector, onto and off the MessagePipe, back into a vector.
186   array<uint8>? side_data;
187   uint32 side_data_size;
189   // These fields indicate the amount of data to discard after decoding.
190   int64 front_discard_usec;
191   int64 back_discard_usec;
193   // Indicates this buffer is part of a splice around |splice_timestamp_usec|.
194   int64 splice_timestamp_usec;
196   // The payload. Invalid handle indicates an end-of-stream (EOS) buffer.
197   // TODO(tim): This currently results in allocating a new, largeish DataPipe
198   // for each buffer. Remove this once framed data pipes exist, but using this
199   // for now for prototyping audio.
200   handle<data_pipe_consumer>? data;