blob: 6b7e86e149b0f99c23ad80ec0719656f98bf6f43 [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module mojo;
import "media/mojo/interfaces/demuxer_stream.mojom";
import "media/mojo/interfaces/media_types.mojom";
[Client=MediaRendererClient]
interface MediaRenderer {
// Initializes the Renderer with one or both of an audio and video stream,
// calling back upon completion.
// NOTE: If an error occurs, MediaRendererClient::OnError() will be called
// before the callback is executed.
Initialize(DemuxerStream? audio, DemuxerStream? video) => ();
// Discards any buffered data, executing callback when completed.
// NOTE: If an error occurs, MediaRendererClient::OnError() can be called
// before the callback is executed.
Flush() => ();
// Starts rendering from |time_usec|.
StartPlayingFrom(int64 time_usec);
// Updates the current playback rate. The default playback rate should be 1.
SetPlaybackRate(float playback_rate);
// Sets the output volume. The default volume should be 1.
SetVolume(float volume);
};
interface MediaRendererClient {
// Called to report media time advancement by |time_usec|.
// |time_usec| and |max_time_usec| can be used to interpolate time between
// calls to OnTimeUpdate().
// |max_time_usec| is typically the media timestamp of the last audio frame
// buffered by the audio hardware.
// |max_time_usec| must be greater or equal to |time_usec|.
OnTimeUpdate(int64 time_usec, int64 max_time_usec);
// Called to report buffering state changes, see media_types.mojom.
OnBufferingStateChange(BufferingState state);
// Executed when rendering has reached the end of stream.
OnEnded();
// Executed if any error was encountered during decode or rendering. If
// this error happens during an operation that has a completion callback,
// OnError() will be called before firing the completion callback.
OnError();
};