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