OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 // This file defined the mojo interface between Android and Chromium for video |
| 6 // decoding and encoding. See comments of ArcVideoAccelerator for more info. |
| 7 |
| 8 module arc; |
| 9 |
| 10 [Extensible] |
| 11 enum HalPixelFormatExtension { |
| 12 HAL_PIXEL_FORMAT_YCbCr_420_888 = 0x23, |
| 13 HAL_PIXEL_FORMAT_H264 = 0x34363248, |
| 14 HAL_PIXEL_FORMAT_VP8 = 0x00385056, |
| 15 }; |
| 16 |
| 17 enum PortType { |
| 18 PORT_INPUT = 0, |
| 19 PORT_OUTPUT = 1, |
| 20 }; |
| 21 |
| 22 [Extensible] |
| 23 enum BufferFlag { |
| 24 BUFFER_FLAG_EOS = 1, |
| 25 }; |
| 26 |
| 27 struct BufferMetadata { |
| 28 int64 timestamp; // in microseconds |
| 29 uint32 flags; |
| 30 uint32 bytes_used; |
| 31 }; |
| 32 |
| 33 struct VideoFormat { |
| 34 uint32 pixel_format; |
| 35 uint32 buffer_size; |
| 36 |
| 37 // minimal number of buffers required to process the video. |
| 38 uint32 min_num_buffers; |
| 39 uint32 coded_width; |
| 40 uint32 coded_height; |
| 41 uint32 crop_left; |
| 42 uint32 crop_width; |
| 43 uint32 crop_top; |
| 44 uint32 crop_height; |
| 45 }; |
| 46 |
| 47 struct ArcVideoAcceleratorConfig { |
| 48 enum DeviceType { |
| 49 DEVICE_ENCODER = 0, |
| 50 DEVICE_DECODER = 1, |
| 51 }; |
| 52 |
| 53 DeviceType device_type; |
| 54 uint32 num_input_buffers; |
| 55 uint32 input_pixel_format; |
| 56 }; |
| 57 |
| 58 interface VideoAcceleratorService { |
| 59 Initialize@0(ArcVideoAcceleratorConfig config) => (bool result); |
| 60 |
| 61 BindSharedMemory@1(PortType port, uint32 index, handle ashmem_fd, |
| 62 uint32 offset, uint32 length); |
| 63 |
| 64 BindDmabuf@2(PortType port, uint32 index, handle dmabuf_fd); |
| 65 |
| 66 UseBuffer@3(PortType port, uint32 index, BufferMetadata metadata); |
| 67 |
| 68 SetNumberOfOutputBuffers@4(uint32 number); |
| 69 |
| 70 Reset@5(); |
| 71 }; |
| 72 |
| 73 interface VideoAcceleratorServiceClient { |
| 74 enum Error { |
| 75 NO_ERROR = 0, |
| 76 ILLEGAL_STATE = 1, |
| 77 INVALID_ARGUMENT = 2, |
| 78 UNREADABLE_INPUT = 3, |
| 79 PLATFORM_FAILURE = 4, |
| 80 }; |
| 81 |
| 82 Init@0(VideoAcceleratorService service_ptr); |
| 83 |
| 84 OnError@1(Error error); |
| 85 |
| 86 OnBufferDone@2(PortType port, uint32 index, BufferMetadata metadata); |
| 87 |
| 88 OnResetDone@3(); |
| 89 |
| 90 OnOutputFormatChanged@4(VideoFormat format); |
| 91 }; |
OLD | NEW |