Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / media / mojo / interfaces / media_types.mojom
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.
4
5 module mojo {
6
7 // See media/base/buffering_state.h for descriptions.
8 // Kept in sync with media::BufferingState via COMPILE_ASSERTs.
9 enum BufferingState {
10   HAVE_NOTHING,
11   HAVE_ENOUGH,
12 };
13
14 // See media/base/audio_decoder_config.h for descriptions.
15 // Kept in sync with media::AudioCodec via COMPILE_ASSERTs.
16 enum AudioCodec {
17   UNKNOWN = 0,
18   AAC = 1,
19   MP3 = 2,
20   PCM = 3,
21   Vorbis = 4,
22   FLAC = 5,
23   AMR_NB = 6,
24   AMR_WB = 7,
25   PCM_MULAW = 8,
26   GSM_MS = 9,
27   PCM_S16BE = 10,
28   PCM_S24BE = 11,
29   Opus = 12,
30   // EAC3 = 13,
31   PCM_ALAW = 14,
32   MAX = PCM_ALAW,
33 };
34
35 // See media/base/channel_layout.h for descriptions.
36 // Kept in sync with media::ChannelLayout via COMPILE_ASSERTs.
37 // TODO(tim): The bindings generators will always prepend the enum name, should
38 // mojom therefore allow enum values starting with numbers?
39 enum ChannelLayout {
40   k_NONE = 0,
41   k_UNSUPPORTED = 1,
42   k_MONO = 2,
43   k_STEREO = 3,
44   k_2_1 = 4,
45   k_SURROUND = 5,
46   k_4_0 = 6,
47   k_2_2 = 7,
48   k_QUAD = 8,
49   k_5_0 = 9,
50   k_5_1 = 10,
51   k_5_0_BACK = 11,
52   k_5_1_BACK = 12,
53   k_7_0 = 13,
54   k_7_1 = 14,
55   k_7_1_WIDE = 15,
56   k_STEREO_DOWNMIX = 16,
57   k_2POINT1 = 17,
58   k_3_1 = 18,
59   k_4_1 = 19,
60   k_6_0 = 20,
61   k_6_0_FRONT = 21,
62   k_HEXAGONAL = 22,
63   k_6_1 = 23,
64   k_6_1_BACK = 24,
65   k_6_1_FRONT = 25,
66   k_7_0_FRONT = 26,
67   k_7_1_WIDE_BACK = 27,
68   k_OCTAGONAL = 28,
69   k_DISCRETE = 29,
70   k_STEREO_AND_KEYBOARD_MIC = 30,
71   k_MAX = k_STEREO_AND_KEYBOARD_MIC
72 };
73
74 // See media/base/sample_format.h for descriptions.
75 // Kept in sync with media::SampleFormat via COMPILE_ASSERTs.
76 enum SampleFormat {
77   UNKNOWN = 0,
78   U8,
79   S16,
80   S32,
81   F32,
82   PlanarS16,
83   PlanarF32,
84   Max = PlanarF32,
85 };
86
87 // This defines a mojo transport format for media::AudioDecoderConfig.
88 // See media/base/audio_decoder_config.h for descriptions.
89 struct AudioDecoderConfig {
90   AudioCodec codec;
91   SampleFormat sample_format;
92   ChannelLayout channel_layout;
93   int32 samples_per_second;
94   uint8[]? extra_data;
95   int64 seek_preroll_usec;
96   int32 codec_delay;
97 };
98
99 // This defines a mojo transport format for media::DecoderBuffer.
100 struct MediaDecoderBuffer {
101   // See media/base/buffers.h for details.
102   int64 timestamp_usec;
103   int64 duration_usec;
104
105   // The number of bytes in |data|.
106   uint32 data_size;
107
108   // This is backed by an std::vector and results in a few copies.
109   // Into the vector, onto and off the MessagePipe, back into a vector.
110   uint8[] side_data;
111   uint32 side_data_size;
112
113   // These fields indicate the amount of data to discard after decoding.
114   int64 front_discard_usec;
115   int64 back_discard_usec;
116
117   // Indicates this buffer is part of a splice around |splice_timestamp_usec|.
118   int64 splice_timestamp_usec;
119
120   // The payload.
121   // TODO(tim): This currently results in allocating a new, largeish DataPipe
122   // for each buffer. Remove this once framed data pipes exist, but using this
123   // for now for prototyping audio.
124   handle<data_pipe_consumer> data;
125 };
126
127 }  // module mojo