Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ppapi / shared_impl / media_stream_buffer.h
blob8b0ebe1cc40bec8f45ac007415a994e210d68634
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 PPAPI_SHARED_IMPL_MEDIA_STREAM_BUFFER_H_
6 #define PPAPI_SHARED_IMPL_MEDIA_STREAM_BUFFER_H_
8 #include "ppapi/c/ppb_audio_buffer.h"
9 #include "ppapi/c/ppb_video_frame.h"
11 namespace ppapi {
13 union MediaStreamBuffer {
14 enum Type { TYPE_UNKNOWN = 0, TYPE_AUDIO = 1, TYPE_VIDEO = 2, };
16 struct Header {
17 Type type;
18 uint32_t size;
21 struct Audio {
22 Header header;
23 PP_TimeDelta timestamp;
24 PP_AudioBuffer_SampleRate sample_rate;
25 uint32_t number_of_channels;
26 uint32_t number_of_samples;
27 uint32_t data_size;
28 // Uses 8 bytes to make sure the Audio struct has consistent size between
29 // NaCl code and renderer code.
30 uint8_t data[8];
33 struct Video {
34 Header header;
35 PP_TimeDelta timestamp;
36 PP_VideoFrame_Format format;
37 PP_Size size;
38 uint32_t data_size;
39 // Uses 8 bytes to make sure the Video struct has consistent size between
40 // NaCl code and renderer code.
41 uint8_t data[8];
44 // Because these structs are written and read in shared memory, we need
45 // the size and alighment to be consistent between NaCl and its host trusted
46 // platform.
47 PP_COMPILE_ASSERT_SIZE_IN_BYTES(Header, 8);
48 PP_COMPILE_ASSERT_SIZE_IN_BYTES(Audio, 40);
49 PP_COMPILE_ASSERT_SIZE_IN_BYTES(Video, 40);
51 Header header;
52 Video video;
53 Audio audio;
56 } // namespace ppapi
58 #endif // PPAPI_SHARED_IMPL_MEDIA_STREAM_BUFFER_H_