OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 module media.mojom; | 5 module media.mojom; |
6 | 6 |
7 import "media/mojo/interfaces/media_types.mojom"; | 7 import "media/mojo/interfaces/media_types.mojom"; |
8 | 8 |
9 interface VideoDecoder { | 9 interface VideoDecoder { |
10 // Initialize the decoder. This must be called before any other method. | 10 // Initialize the decoder. This must be called before any other method. |
11 // | 11 // |
12 // |decoder_buffer_pipe| will be used to transfer encoded data for each | 12 // |decoder_buffer_pipe| will be used to transfer encoded data for each |
13 // DecoderBuffer. | 13 // DecoderBuffer. |
14 // | 14 // |
15 // TODO(sandersd): Rename to Initialize() if/when | 15 // TODO(sandersd): Rename to Initialize() if/when |
16 // media::VideoDecoder::Initialize() is renamed to Configure(). | 16 // media::VideoDecoder::Initialize() is renamed to Configure(). |
17 Construct(associated VideoDecoderClient client, | 17 Construct(associated VideoDecoderClient client, |
18 handle<data_pipe_consumer> decoder_buffer_pipe); | 18 handle<data_pipe_consumer> decoder_buffer_pipe); |
19 | 19 |
20 // Configure (or reconfigure) the decoder. This must be called before decoding | 20 // Configure (or reconfigure) the decoder. This must be called before decoding |
21 // any frames, and must not be called while there are pending Initialize(), | 21 // any frames, and must not be called while there are pending Initialize(), |
22 // Decode(), or Reset() requests. | 22 // Decode(), or Reset() requests. |
23 // | 23 // |
24 // If |low_delay| is true, the decoder must output frames as soon as possible; | 24 // If |low_delay| is true, the decoder must output frames as soon as possible; |
25 // in particular, it must not wait for another Decode() request, except as | 25 // in particular, it must not wait for another Decode() request, except as |
26 // required for frame reordering. | 26 // required for frame reordering. Implementations must fail initialization if |
27 Initialize(VideoDecoderConfig config, bool low_delay) => (bool success); | 27 // they cannot satisfy this requirement. |
| 28 // |
| 29 // On completion, the callback also includes |needs_bitstream_conversion|, |
| 30 // indicating whether decode buffers need bitstream conversion, and |
| 31 // |max_decode_requests|, the maximum number of concurrent Decode() requests |
| 32 // the implementation supports. |
| 33 Initialize(VideoDecoderConfig config, bool low_delay) => |
| 34 (bool success, bool needs_bitstream_conversion, |
| 35 int32 max_decode_requests); |
28 | 36 |
29 // Request decoding of exactly one frame or an EOS buffer. This must not be | 37 // Request decoding of exactly one frame or an EOS buffer. This must not be |
30 // called while there are pending Configure(), Reset(), or Decode() requests. | 38 // called while there are pending Initialize(), Reset(), or Decode(EOS) |
| 39 // requests. |
31 // | 40 // |
32 // Implementations must eventually execute the callback, even if Decode() is | 41 // Implementations must eventually execute the callback, even if Decode() is |
33 // not called again. It is not required that the decode status match the | 42 // not called again. It is not required that the decode status match the |
34 // actual result of decoding a frame; only that decode errors are eventually | 43 // actual result of decoding the buffer, only that decode errors are |
35 // reported (such as at EOS). The purpose of the callback is primarily for | 44 // eventually reported (such as at EOS). |
36 // Decode() rate control. | |
37 // | 45 // |
38 // If |buffer| is an EOS buffer, implementations execute all other pending | 46 // If |buffer| is an EOS buffer, implementations must execute all other |
39 // Decode() callbacks and output all pending frames before executing the EOS | 47 // pending Decode() callbacks and output all pending frames before executing |
40 // buffer Decode() callback. (That is, they must flush.) | 48 // the Decode(EOS) callback. (That is, they must flush.) |
41 // | 49 Decode(DecoderBuffer buffer) => |
42 // TODO(sandersd): Plumb GetMaxDecodeRequests() so that parallel Decode() | 50 (DecodeStatus status, bool can_read_without_stalling); |
43 // requests can be allowed. | |
44 Decode(DecoderBuffer buffer) => (DecodeStatus status); | |
45 | 51 |
46 // Reset the decoder. All ongoing Decode() requests must be completed or | 52 // Reset the decoder. All ongoing Decode() requests must be completed or |
47 // aborted before executing the callback. This must not be called while there | 53 // aborted before executing the callback. This must not be called while there |
48 // is a pending Initialize() request. | 54 // is a pending Initialize() request. |
49 Reset() => (); | 55 Reset() => (); |
50 }; | 56 }; |
51 | 57 |
52 interface VideoDecoderClient { | 58 interface VideoDecoderClient { |
53 // Output a decoded frame. Frames must be output in presentation order. | 59 // Output a decoded frame. Frames must be output in presentation order. |
54 OnVideoFrameDecoded(VideoFrame frame); | 60 OnVideoFrameDecoded(VideoFrame frame); |
55 }; | 61 }; |
OLD | NEW |