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 module arc; |
| 6 |
| 7 [Client=VideoAcceleratorServiceClient] |
| 8 |
| 9 enum HalPixelFormatExtension { |
| 10 HAL_PIXEL_FORMAT_H264 = 0x34363248, |
| 11 HAL_PIXEL_FORMAT_VP8 = 0x00385056, |
| 12 }; |
| 13 |
| 14 enum PortType { |
| 15 PORT_INPUT = 0, |
| 16 PORT_OUTPUT = 1, |
| 17 }; |
| 18 |
| 19 // TODO(kcwu): move into VideoAcceleratorService |
| 20 enum DeviceType { |
| 21 DEVICE_ENCODER = 0, |
| 22 DEVICE_DECODER = 1, |
| 23 }; |
| 24 |
| 25 // TODO(kcwu): move into BufferFormat |
| 26 enum MemoryType { |
| 27 MEMORY_SHARED_MEMORY = 1, |
| 28 MEMORY_DMABUF = 2, |
| 29 }; |
| 30 |
| 31 enum BufferFlag { |
| 32 BUFFER_FLAG_EOS = 1, |
| 33 }; |
| 34 |
| 35 struct BufferMetadata { |
| 36 int64 timestamp; // in microseconds |
| 37 uint32 flags; |
| 38 uint32 bytes_used; |
| 39 }; |
| 40 |
| 41 struct BufferFormat { |
| 42 uint32 pixel_format; // the v4l2 fourcc format |
| 43 MemoryType memory_type; |
| 44 }; |
| 45 |
| 46 struct VideoFormat { |
| 47 uint32 pixel_format; |
| 48 uint32 image_size; |
| 49 |
| 50 // minimal number of buffers required to process the video. |
| 51 uint32 min_num_buffers; |
| 52 uint32 coded_width; |
| 53 uint32 coded_height; |
| 54 uint32 crop_left; |
| 55 uint32 crop_width; |
| 56 uint32 crop_top; |
| 57 uint32 crop_height; |
| 58 }; |
| 59 |
| 60 interface VideoAcceleratorService { |
| 61 Initialize(DeviceType device) => (bool result); |
| 62 |
| 63 BindSharedMemory(PortType port, uint32 index, handle ashmem_fd, |
| 64 uint64 offset, uint64 length) => (bool result); |
| 65 |
| 66 BindDmabuf(PortType port, uint32 index, handle dmabuf_fd) => (bool result); |
| 67 |
| 68 UseBuffer(PortType port, uint32 index, BufferMetadata metadata); |
| 69 |
| 70 SetBufferCount(PortType port, uint64 set_count) => (bool result, uint64 reply_
count); |
| 71 |
| 72 Reset() => (); |
| 73 |
| 74 SetBufferFormat(PortType port, BufferFormat format) => (bool result); |
| 75 }; |
| 76 |
| 77 interface VideoAcceleratorServiceClient { |
| 78 enum Error { |
| 79 NO_ERROR = 0, |
| 80 ILLEGAL_STATE = 1, |
| 81 INVALID_ARGUMENT = 2, |
| 82 UNREADABLE_INPUT = 3, |
| 83 PLATFORM_FAILURE = 4, |
| 84 }; |
| 85 |
| 86 SetService(VideoAcceleratorService service_ptr); |
| 87 |
| 88 OnError(Error error); |
| 89 |
| 90 OnBufferDone(PortType port, uint32 index, BufferMetadata metadata); |
| 91 |
| 92 OnOutputFormatChanged(VideoFormat format); |
| 93 }; |
OLD | NEW |