mjpeg_decode_accelerator.mojom 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Copyright 2017 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. module chromeos_camera.mojom;
  5. import "components/chromeos_camera/common/dmabuf.mojom";
  6. import "media/mojo/mojom/media_types.mojom";
  7. import "mojo/public/mojom/base/time.mojom";
  8. import "ui/gfx/geometry/mojom/geometry.mojom";
  9. // Decode errors (see media/video/jpeg_decode_accelerator.h).
  10. enum DecodeError {
  11. NO_ERRORS,
  12. INVALID_ARGUMENT,
  13. UNREADABLE_INPUT,
  14. PARSE_JPEG_FAILED,
  15. UNSUPPORTED_JPEG,
  16. PLATFORM_FAILURE,
  17. };
  18. // This defines a mojo transport format for media::BitstreamBuffer (see
  19. // media/base/bitstream_buffer.h).
  20. struct BitstreamBuffer {
  21. int32 id;
  22. handle<shared_buffer> memory_handle;
  23. uint32 size;
  24. int64 offset;
  25. mojo_base.mojom.TimeDelta timestamp;
  26. string key_id;
  27. string iv;
  28. array<media.mojom.SubsampleEntry> subsamples;
  29. };
  30. // GPU process interface exposed to the browser for decoding MJPEG streams.
  31. //
  32. // Deprecated method IDs: 2
  33. // Next method ID: 5
  34. interface MjpegDecodeAccelerator {
  35. // Initializes the MJPEG decoder. Should be called once per decoder
  36. // construction and before using Decode(). This call returns true if
  37. // initialization is successful.
  38. Initialize@0() => (bool success);
  39. // Decodes the given bitstream buffer that contains one JPEG image.
  40. // The image is decoded from shared memory |input_buffer.memory_handle|
  41. // with size |input_buffer.size|. The input buffer is associated with
  42. // |input_buffer.id|and the size of JPEG image is |coded_size|. Decoded I420
  43. // frame data will be put onto shared memory associated with |output_handle|
  44. // with allocated size |output_buffer_size|.
  45. // Returns |bitstream_buffer_id| and |error| in a callback to notify the
  46. // decode status. |bitstream_buffer_id| is the id of BitstreamBuffer
  47. // |input_buffer| and |error| is the error code.
  48. Decode@1(BitstreamBuffer input_buffer, gfx.mojom.Size coded_size,
  49. handle<shared_buffer> output_handle, uint32 output_buffer_size)
  50. => (int32 bitstream_buffer_id, DecodeError error);
  51. // Decodes one MJPEG image with the given input and output buffers.
  52. // |task_id| is used to distinguish different tasks. The input image is stored
  53. // in the DMA buffer described by |src_dmabuf_fd|, |src_size|, and
  54. // |src_offset|. The decoded result will be put into |dst_frame| backed by DMA
  55. // buffer. Returns the decode status |error| in the Mojo callback.
  56. DecodeWithDmaBuf@3(int32 task_id, handle src_dmabuf_fd, uint32 src_size,
  57. uint32 src_offset, DmaBufVideoFrame dst_frame)
  58. => (DecodeError error);
  59. // TODO(c.padhi): This method might not be required, see
  60. // http://crbug.com/699255.
  61. Uninitialize@4();
  62. };