| OLD | NEW |
| (Empty) |
| 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 | |
| 5 module media.mojom; | |
| 6 | |
| 7 import "media/mojo/interfaces/media_types.mojom"; | |
| 8 import "mojo/common/time.mojom"; | |
| 9 import "ui/gfx/geometry/mojo/geometry.mojom"; | |
| 10 | |
| 11 // Decode errors (see media/video/jpeg_decode_accelerator.h). | |
| 12 enum Error { | |
| 13 NO_ERRORS, | |
| 14 INVALID_ARGUMENT, | |
| 15 UNREADABLE_INPUT, | |
| 16 PARSE_JPEG_FAILED, | |
| 17 UNSUPPORTED_JPEG, | |
| 18 PLATFORM_FAILURE, | |
| 19 }; | |
| 20 | |
| 21 // This defines a mojo transport format for media::BitstreamBuffer (see | |
| 22 // media/base/bitstream_buffer.h). | |
| 23 struct BitstreamBuffer { | |
| 24 int32 id; | |
| 25 handle<shared_buffer> memory_handle; | |
| 26 uint32 size; | |
| 27 uint64 offset; | |
| 28 mojo.common.mojom.TimeDelta timestamp; | |
| 29 string key_id; | |
| 30 string iv; | |
| 31 array<SubsampleEntry> subsamples; | |
| 32 }; | |
| 33 | |
| 34 // GPU process interface exposed to the browser for decoding JPEG images. | |
| 35 interface GpuJpegDecodeAccelerator { | |
| 36 // Initializes the JPEG decoder. Should be called once per decoder | |
| 37 // construction and before using Decode(). This call returns true if | |
| 38 // initialization is successful. | |
| 39 // TODO(c.padhi): Make this method asynchronous. | |
| 40 [Sync] | |
| 41 Initialize() => (bool success); | |
| 42 | |
| 43 // Decodes the given bitstream buffer that contains one JPEG image. | |
| 44 // The image is decoded from shared memory |input_buffer.memory_handle| | |
| 45 // with size |input_buffer.size|. The input buffer is associated with | |
| 46 // |input_buffer.id|and the size of JPEG image is |coded_size|. Decoded I420 | |
| 47 // frame data will be put onto shared memory associated with |output_handle| | |
| 48 // with allocated size |output_buffer_size|. | |
| 49 // Returns |bitstream_buffer_id| and |error| in a callback to notify the | |
| 50 // decode status. |bitstream_buffer_id| is the id of BitstreamBuffer | |
| 51 // |input_buffer| and |error| is the error code. | |
| 52 Decode(BitstreamBuffer input_buffer, gfx.mojom.Size coded_size, | |
| 53 handle<shared_buffer> output_handle, uint32 output_buffer_size) | |
| 54 => (int32 bitstream_buffer_id, Error error); | |
| 55 | |
| 56 // TODO(c.padhi): This method might not be required, see | |
| 57 // http://crbug.com/699255. | |
| 58 Uninitialize(); | |
| 59 }; | |
| OLD | NEW |