| 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 module media.interfaces; | 5 module media.interfaces; |
| 6 | 6 |
| 7 import "media/mojo/interfaces/demuxer_stream.mojom"; | 7 import "media/mojo/interfaces/demuxer_stream.mojom"; |
| 8 import "media/mojo/interfaces/media_types.mojom"; | 8 import "media/mojo/interfaces/media_types.mojom"; |
| 9 | 9 |
| 10 interface MediaRenderer { | 10 interface Renderer { |
| 11 // Initializes the Renderer with one or both of an audio and video stream, | 11 // Initializes the Renderer with one or both of an audio and video stream, |
| 12 // executing the callback with whether the initialization succeeded. | 12 // executing the callback with whether the initialization succeeded. |
| 13 Initialize(MediaRendererClient client, | 13 Initialize(RendererClient client, |
| 14 DemuxerStream? audio, | 14 DemuxerStream? audio, |
| 15 DemuxerStream? video) => (bool success); | 15 DemuxerStream? video) => (bool success); |
| 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, RendererClient::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(double playback_rate); | 26 SetPlaybackRate(double 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 // Attaches the CDM associated with |cdm_id| to the renderer service, | 31 // Attaches the CDM associated with |cdm_id| to the renderer service, |
| 32 // executing the callback with whether the CDM was successfully attached. | 32 // executing the callback with whether the CDM was successfully attached. |
| 33 SetCdm(int32 cdm_id) => (bool success); | 33 SetCdm(int32 cdm_id) => (bool success); |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 interface MediaRendererClient { | 36 interface RendererClient { |
| 37 // Called to report media time advancement by |time_usec|. | 37 // Called to report media time advancement by |time_usec|. |
| 38 // |time_usec| and |max_time_usec| can be used to interpolate time between | 38 // |time_usec| and |max_time_usec| can be used to interpolate time between |
| 39 // calls to OnTimeUpdate(). | 39 // calls to OnTimeUpdate(). |
| 40 // |max_time_usec| is typically the media timestamp of the last audio frame | 40 // |max_time_usec| is typically the media timestamp of the last audio frame |
| 41 // buffered by the audio hardware. | 41 // buffered by the audio hardware. |
| 42 // |max_time_usec| must be greater or equal to |time_usec|. | 42 // |max_time_usec| must be greater or equal to |time_usec|. |
| 43 OnTimeUpdate(int64 time_usec, int64 max_time_usec); | 43 OnTimeUpdate(int64 time_usec, int64 max_time_usec); |
| 44 | 44 |
| 45 // Called to report buffering state changes, see media_types.mojom. | 45 // Called to report buffering state changes, see media_types.mojom. |
| 46 OnBufferingStateChange(BufferingState state); | 46 OnBufferingStateChange(BufferingState state); |
| 47 | 47 |
| 48 // Executed when rendering has reached the end of stream. | 48 // Executed when rendering has reached the end of stream. |
| 49 OnEnded(); | 49 OnEnded(); |
| 50 | 50 |
| 51 // Executed if any error was encountered during decode or rendering. If | 51 // Executed if any error was encountered during decode or rendering. If |
| 52 // this error happens during an operation that has a completion callback, | 52 // this error happens during an operation that has a completion callback, |
| 53 // OnError() will be called before firing the completion callback. | 53 // OnError() will be called before firing the completion callback. |
| 54 OnError(); | 54 OnError(); |
| 55 }; | 55 }; |
| OLD | NEW |