1 // Copyright 2014 The Chromium Authors
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/mojom/demuxer_stream.mojom";
8 import "media/mojo/mojom/media_types.mojom";
9 import "mojo/public/mojom/base/time.mojom";
10 import "mojo/public/mojom/base/unguessable_token.mojom";
11 import "services/network/public/mojom/site_for_cookies.mojom";
12 import "ui/gfx/geometry/mojom/geometry.mojom";
13 import "url/mojom/url.mojom";
14 import "url/mojom/origin.mojom";
16 // See media/base/media_url_params.h for descriptions.
17 struct MediaUrlParams {
18 url.mojom.Url media_url;
19 network.mojom.SiteForCookies site_for_cookies;
20 url.mojom.Origin top_frame_origin;
21 bool has_storage_access;
22 bool allow_credentials;
26 // A Mojo equivalent of media::Renderer. Used when audio and video decoding
27 // happens outside of the sandboxed render process.
28 // See media/mojo/README.md
30 // Initializes the Renderer with one or more audio / video `streams`, or a URL
31 // via `media_url_params`. Exactly one of `streams` and `media_urls_params`
33 // TODO(sandersd): These should be separate methods or a union type.
34 Initialize(pending_associated_remote<RendererClient> client,
35 array<pending_remote<DemuxerStream>>? streams,
36 MediaUrlParams? media_url_params) => (bool success);
38 // Discards any buffered data, executing callback when completed.
39 // NOTE: If an error occurs, RendererClient::OnError() can be called
40 // before the callback is executed.
43 [EnableIf=tizen_multimedia]
44 Seek(mojo_base.mojom.TimeDelta time) => ();
46 [EnableIf=tizen_multimedia]
49 // Starts rendering from `time`.
50 StartPlayingFrom(mojo_base.mojom.TimeDelta time);
52 // Updates the current playback rate. The default playback rate should be 1.
53 SetPlaybackRate(double playback_rate);
55 // Sets the output volume. The default volume should be 1.
56 SetVolume(float volume);
58 // Attaches the CDM associated with `cdm_id` to the renderer service,
59 // executing the callback with whether the CDM was successfully attached.
60 SetCdm(mojo_base.mojom.UnguessableToken? cdm_id) => (bool success);
62 [EnableIf=tizen_video_hole]
63 SetVideoHole(bool is_video_hole);
65 [EnableIf=tizen_video_hole]
66 SetMediaGeometry(gfx.mojom.RectF rect);
68 [EnableIf=tizen_multimedia]
69 ToggleFullscreenMode(bool is_fullscreen) => ();
71 [EnableIf=is_tizen_tv]
72 SetContentMimeType(string mime_type);
74 [EnableIf=is_tizen_tv]
75 SetParentalRatingResult(bool is_pass);
78 // A Mojo equivalent of media::RendererClient. See media/mojo/README.md
79 interface RendererClient {
80 // Called to report media time advancement by `time`.
81 // `time` and `max_time` can be used to interpolate time between
82 // calls to OnTimeUpdate().
83 // `max_time` is typically the media timestamp of the last audio frame
84 // buffered by the audio hardware.
85 // `capture_time` is monotonic clock time at which the times were captured.
86 // `max_time` must be greater or equal to `time`.
87 OnTimeUpdate(mojo_base.mojom.TimeDelta time,
88 mojo_base.mojom.TimeDelta max_time,
89 mojo_base.mojom.TimeTicks capture_time);
91 // Called to report buffering state changes, see media_types.mojom.
92 OnBufferingStateChange(BufferingState state,
93 BufferingStateChangeReason reason);
95 // Executed when rendering has reached the end of stream.
98 // Executed if any error was encountered during decode or rendering. If
99 // this error happens during an operation that has a completion callback,
100 // OnError() will be called before firing the completion callback.
101 OnError(PipelineStatus status);
103 // Executed whenever DemuxerStream status returns kConfigChange. Initial
104 // configs provided by OnMetadata.
105 OnAudioConfigChange(AudioDecoderConfig config);
106 OnVideoConfigChange(VideoDecoderConfig config);
108 // Executed for the first video frame and whenever natural size changes.
109 OnVideoNaturalSizeChange(gfx.mojom.Size size);
111 // Executed for the first video frame and whenever opacity changes.
112 OnVideoOpacityChange(bool opaque);
114 // Called periodically to pass statistics to the web player. See
115 // media_types.mojom.
116 OnStatisticsUpdate(PipelineStatistics stats);
118 // Called when the remote rendering service is waiting for `reason`,
119 // e.g. waiting for decryption key.
120 OnWaiting(WaitingReason reason);
122 [EnableIf=tizen_multimedia]
123 OnRequestSuspend(bool resource_conflicted);
125 [EnableIf=tizen_multimedia]
126 OnRequestSeek(mojo_base.mojom.TimeDelta time);
128 [EnableIf=tizen_multimedia]
129 OnSeekableTimeChange(mojo_base.mojom.TimeDelta min_time,
130 mojo_base.mojom.TimeDelta max_time,
133 [EnableIf=tizen_multimedia]
134 OnLivePlaybackComplete();