| 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.mojom; | 5 module media.mojom; |
| 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 import "mojo/common/common_custom_types.mojom"; |
| 9 import "ui/gfx/geometry/mojo/geometry.mojom"; | 10 import "ui/gfx/geometry/mojo/geometry.mojom"; |
| 10 import "url/mojo/url.mojom"; | 11 import "url/mojo/url.mojom"; |
| 11 | 12 |
| 12 interface Renderer { | 13 interface Renderer { |
| 13 // Initializes the Renderer with one or both of an audio and video stream, | 14 // Initializes the Renderer with one or both of an audio and video stream, |
| 14 // executing the callback with whether the initialization succeeded. | 15 // executing the callback with whether the initialization succeeded. |
| 15 Initialize(RendererClient client, | 16 Initialize(RendererClient client, |
| 16 DemuxerStream? audio, | 17 DemuxerStream? audio, |
| 17 DemuxerStream? video, | 18 DemuxerStream? video, |
| 18 url.mojom.Url? url) => (bool success); | 19 url.mojom.Url? url) => (bool success); |
| 19 | 20 |
| 20 // Discards any buffered data, executing callback when completed. | 21 // Discards any buffered data, executing callback when completed. |
| 21 // NOTE: If an error occurs, RendererClient::OnError() can be called | 22 // NOTE: If an error occurs, RendererClient::OnError() can be called |
| 22 // before the callback is executed. | 23 // before the callback is executed. |
| 23 Flush() => (); | 24 Flush() => (); |
| 24 | 25 |
| 25 // Starts rendering from |time_usec|. | 26 // Starts rendering from |time|. |
| 26 StartPlayingFrom(int64 time_usec); | 27 StartPlayingFrom(mojo.common.mojom.TimeDelta time); |
| 27 | 28 |
| 28 // Updates the current playback rate. The default playback rate should be 1. | 29 // Updates the current playback rate. The default playback rate should be 1. |
| 29 SetPlaybackRate(double playback_rate); | 30 SetPlaybackRate(double playback_rate); |
| 30 | 31 |
| 31 // Sets the output volume. The default volume should be 1. | 32 // Sets the output volume. The default volume should be 1. |
| 32 SetVolume(float volume); | 33 SetVolume(float volume); |
| 33 | 34 |
| 34 // Attaches the CDM associated with |cdm_id| to the renderer service, | 35 // Attaches the CDM associated with |cdm_id| to the renderer service, |
| 35 // executing the callback with whether the CDM was successfully attached. | 36 // executing the callback with whether the CDM was successfully attached. |
| 36 SetCdm(int32 cdm_id) => (bool success); | 37 SetCdm(int32 cdm_id) => (bool success); |
| 37 }; | 38 }; |
| 38 | 39 |
| 39 interface RendererClient { | 40 interface RendererClient { |
| 40 // Called to report media time advancement by |time_usec|. | 41 // Called to report media time advancement by |time|. |
| 41 // |time_usec| and |max_time_usec| can be used to interpolate time between | 42 // |time| and |max_time| can be used to interpolate time between |
| 42 // calls to OnTimeUpdate(). | 43 // calls to OnTimeUpdate(). |
| 43 // |max_time_usec| is typically the media timestamp of the last audio frame | 44 // |max_time| is typically the media timestamp of the last audio frame |
| 44 // buffered by the audio hardware. | 45 // buffered by the audio hardware. |
| 45 // |max_time_usec| must be greater or equal to |time_usec|. | 46 // |max_time| must be greater or equal to |time|. |
| 46 OnTimeUpdate(int64 time_usec, int64 max_time_usec); | 47 OnTimeUpdate(mojo.common.mojom.TimeDelta time, |
| 48 mojo.common.mojom.TimeDelta max_time); |
| 47 | 49 |
| 48 // Called to report buffering state changes, see media_types.mojom. | 50 // Called to report buffering state changes, see media_types.mojom. |
| 49 OnBufferingStateChange(BufferingState state); | 51 OnBufferingStateChange(BufferingState state); |
| 50 | 52 |
| 51 // Executed when rendering has reached the end of stream. | 53 // Executed when rendering has reached the end of stream. |
| 52 OnEnded(); | 54 OnEnded(); |
| 53 | 55 |
| 54 // Executed if any error was encountered during decode or rendering. If | 56 // Executed if any error was encountered during decode or rendering. If |
| 55 // this error happens during an operation that has a completion callback, | 57 // this error happens during an operation that has a completion callback, |
| 56 // OnError() will be called before firing the completion callback. | 58 // OnError() will be called before firing the completion callback. |
| 57 OnError(); | 59 OnError(); |
| 58 | 60 |
| 59 // Executed for the first video frame and whenever natural size changes. | 61 // Executed for the first video frame and whenever natural size changes. |
| 60 OnVideoNaturalSizeChange(gfx.mojom.Size size); | 62 OnVideoNaturalSizeChange(gfx.mojom.Size size); |
| 61 | 63 |
| 62 // Executed for the first video frame and whenever opacity changes. | 64 // Executed for the first video frame and whenever opacity changes. |
| 63 OnVideoOpacityChange(bool opaque); | 65 OnVideoOpacityChange(bool opaque); |
| 64 | 66 |
| 65 // Called periodically to pass statistics to the web player. See | 67 // Called periodically to pass statistics to the web player. See |
| 66 // media_types.mojom. | 68 // media_types.mojom. |
| 67 OnStatisticsUpdate(PipelineStatistics stats); | 69 OnStatisticsUpdate(PipelineStatistics stats); |
| 68 | 70 |
| 69 // Called when the remote renderering service is waiting on the decryption | 71 // Called when the remote renderering service is waiting on the decryption |
| 70 // key. | 72 // key. |
| 71 OnWaitingForDecryptionKey(); | 73 OnWaitingForDecryptionKey(); |
| 72 | 74 |
| 73 // Executed the first time the metadata is updated, and whenever the duration | 75 // Executed the first time the metadata is updated, and whenever the duration |
| 74 // changes. | 76 // changes. |
| 75 OnDurationChange(int64 duration_usec); | 77 OnDurationChange(mojo.common.mojom.TimeDelta duration); |
| 76 }; | 78 }; |
| OLD | NEW |