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