OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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 import "media/mojo/interfaces/media_types.mojom" |
| 6 |
| 7 module mojo { |
| 8 |
| 9 [Client=MediaRendererClient] |
| 10 interface MediaRenderer { |
| 11 // Initializes the Renderer, calling back upon completion. |
| 12 // NOTE: If an error occurs, MediaRendererClient::OnError() will be called |
| 13 // before the callback is executed. |
| 14 Initialize() => (); |
| 15 |
| 16 // Decodes and renders |buffer|, calling back when more data is required. |
| 17 // NOTE: If an error occurs, MediaRendererClient::OnError() will be called |
| 18 // before the callback is executed. |
| 19 // TODO(tim): Switch decoding model to use framed data pipe when available. |
| 20 // In that world, the signalling for more would be implicit by a writable |
| 21 // pipe handle on the client side so this entire method + callback goes away. |
| 22 DecodeAndRender(MediaDecoderBuffer buffer) => (); |
| 23 |
| 24 // Discards any buffered data, executing callback when completed. |
| 25 // NOTE: If an error occurs, MediaRendererClient::OnError() can be called |
| 26 // before the callback is executed. |
| 27 Flush() => (); |
| 28 |
| 29 // Starts rendering from |time_usec|. |
| 30 StartPlayingFrom(int64 time_usec); |
| 31 |
| 32 // Updates the current playback rate. The default playback rate should be 1. |
| 33 SetPlaybackRate(float playback_rate); |
| 34 |
| 35 // Sets the output volume. The default volume should be 1. |
| 36 SetVolume(float volume); |
| 37 }; |
| 38 |
| 39 interface MediaRendererClient { |
| 40 // Called to report media time advancement by |time_usec|. |
| 41 // |time_usec| and |max_time_usec| can be used to interpolate time between |
| 42 // calls to OnTimeUpdate(). |
| 43 // |max_time_usec| is typically the media timestamp of the last audio frame |
| 44 // buffered by the audio hardware. |
| 45 // |max_time_usec| must be greater or equal to |time_usec|. |
| 46 OnTimeUpdate(int64 time_usec, int64 max_time_usec); |
| 47 |
| 48 // Called to report buffering state changes, see media_types.mojom. |
| 49 OnBufferingStateChange(BufferingState state); |
| 50 |
| 51 // Executed when rendering has reached the end of stream. |
| 52 OnEnded(); |
| 53 |
| 54 // Executed if any error was encountered during decode or rendering. If |
| 55 // this error happens during an operation that has a completion callback, |
| 56 // OnError() will be called before firing the completion callback. |
| 57 OnError(); |
| 58 }; |
| 59 |
| 60 } // module mojo |
OLD | NEW |