| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 import "media/mojo/interfaces/demuxer_stream.mojom" | 5 import "media/mojo/interfaces/demuxer_stream.mojom" |
| 6 import "media/mojo/interfaces/media_types.mojom" | 6 import "media/mojo/interfaces/media_types.mojom" |
| 7 | 7 |
| 8 module mojo { | 8 module mojo { |
| 9 | 9 |
| 10 [Client=MediaRendererClient] | 10 [Client=MediaRendererClient] |
| 11 interface MediaRenderer { | 11 interface MediaRenderer { |
| 12 // Initializes the Renderer with |stream|, calling back upon completion. | 12 // Initializes the Renderer with |stream|, calling back upon completion. |
| 13 // NOTE: If an error occurs, MediaRendererClient::OnError() will be called | 13 // NOTE: If an error occurs, MediaRendererClient::OnError() will be called |
| 14 // before the callback is executed. | 14 // before the callback is executed. |
| 15 Initialize(DemuxerStream stream) => (); | 15 Initialize(DemuxerStream stream) => (); |
| 16 | 16 |
| 17 // Discards any buffered data, executing callback when completed. | 17 // Discards any buffered data, executing callback when completed. |
| 18 // NOTE: If an error occurs, MediaRendererClient::OnError() can be called | 18 // NOTE: If an error occurs, MediaRendererClient::OnError() can be called |
| 19 // before the callback is executed. | 19 // before the callback is executed. |
| 20 Flush() => (); | 20 Flush() => (); |
| 21 | 21 |
| 22 // Starts rendering from |time_usec|. | 22 // Starts rendering from |time_usec|. |
| 23 StartPlayingFrom(int64 time_usec); | 23 StartPlayingFrom(int64 time_usec); |
| 24 | 24 |
| 25 // Updates the current playback rate. The default playback rate should be 1. | 25 // Updates the current playback rate. The default playback rate should be 1. |
| 26 SetPlaybackRate(float playback_rate); | 26 SetPlaybackRate(float playback_rate); |
| 27 | 27 |
| 28 // Sets the output volume. The default volume should be 1. | 28 // Sets the output volume. The default volume should be 1. |
| 29 SetVolume(float volume); | 29 SetVolume(float volume); |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 interface MediaRendererClient { | 32 interface MediaRendererClient { |
| 33 // Called to report media time advancement by |time_usec|. | 33 // Called to report media time advancement by |time_usec|. |
| 34 // |time_usec| and |max_time_usec| can be used to interpolate time between | 34 // |time_usec| and |max_time_usec| can be used to interpolate time between |
| 35 // calls to OnTimeUpdate(). | 35 // calls to OnTimeUpdate(). |
| 36 // |max_time_usec| is typically the media timestamp of the last audio frame | 36 // |max_time_usec| is typically the media timestamp of the last audio frame |
| 37 // buffered by the audio hardware. | 37 // buffered by the audio hardware. |
| 38 // |max_time_usec| must be greater or equal to |time_usec|. | 38 // |max_time_usec| must be greater or equal to |time_usec|. |
| 39 OnTimeUpdate(int64 time_usec, int64 max_time_usec); | 39 OnTimeUpdate(int64 time_usec, int64 max_time_usec); |
| 40 | 40 |
| 41 // Called to report buffering state changes, see media_types.mojom. | 41 // Called to report buffering state changes, see media_types.mojom. |
| 42 OnBufferingStateChange(BufferingState state); | 42 OnBufferingStateChange(BufferingState state); |
| 43 | 43 |
| 44 // Executed when rendering has reached the end of stream. | 44 // Executed when rendering has reached the end of stream. |
| 45 OnEnded(); | 45 OnEnded(); |
| 46 | 46 |
| 47 // Executed if any error was encountered during decode or rendering. If | 47 // Executed if any error was encountered during decode or rendering. If |
| 48 // this error happens during an operation that has a completion callback, | 48 // this error happens during an operation that has a completion callback, |
| 49 // OnError() will be called before firing the completion callback. | 49 // OnError() will be called before firing the completion callback. |
| 50 OnError(); | 50 OnError(); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 } // module mojo | 53 } // module mojo |
| OLD | NEW |