| // Copyright 2018 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| module cros.mojom; |
| |
| // The Mojo interfaces defined here should be sync'd with upstream Chromium: |
| // https://cs.chromium.org/chromium/src/components/chromeos_camera/common/mjpeg_decode_accelerator.mojom |
| |
| import "mojo/gpu/dmabuf.mojom"; |
| |
| // Decode errors. (see |
| // https://cs.chromium.org/chromium/src/media/video/jpeg_decode_accelerator.h) |
| enum DecodeError { |
| NO_ERRORS, |
| INVALID_ARGUMENT, |
| UNREADABLE_INPUT, |
| PARSE_JPEG_FAILED, |
| UNSUPPORTED_JPEG, |
| PLATFORM_FAILURE, |
| }; |
| |
| // GPU process interface exposed to the browser for decoding MJPEG streams. |
| // |
| // Reserved method IDs: 1 |
| // Deprecated method IDs: 2 |
| // Next method ID: 5 |
| interface MjpegDecodeAccelerator { |
| // Initializes the MJPEG decoder. Should be called once per decoder |
| // construction and before using Decode(). This call returns true if |
| // initialization is successful. |
| Initialize@0() => (bool success); |
| |
| // Decodes one MJPEG image with the given input and output buffers. |
| // |task_id| is used to distinguish different tasks. The input image is stored |
| // in the DMA buffer described by |src_dmabuf_fd|, |src_size|, and |
| // |src_offset|. The decoded result will be put into |dst_frame| backed by DMA |
| // buffer. Returns the decode status |error| in the Mojo callback. |
| DecodeWithDmaBuf@3(int32 task_id, handle src_dmabuf_fd, uint32 src_size, |
| uint32 src_offset, DmaBufVideoFrame dst_frame) |
| => (DecodeError error); |
| |
| // TODO(c.padhi): This method might not be required, see |
| // http://crbug.com/699255. |
| Uninitialize@4(); |
| }; |