| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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 media.mojom; |
| 6 |
| 7 import "media/mojo/interfaces/media_types.mojom"; |
| 8 |
| 9 // An HTML5 media element supports a canPlayType() query. This structure |
| 10 // represents a "matcher" for a set of possible container+codec pairs. |
| 11 struct RemotePlayType { |
| 12 // The base type (i.e., no extra parameters). |
| 13 string mime_type; // (e.g., 'video/webm') |
| 14 |
| 15 // List of regular expressions that each match one or more codecs. For |
| 16 // example, to represent that both VP8 and VP9 are supported, one entry |
| 17 // would be 'vp[89]'. |
| 18 array<string> supported_codecs; |
| 19 array<string> ambiguously_supported_codecs; |
| 20 }; |
| 21 |
| 22 // Inner structure used in the RemoteKeySystem struct. |
| 23 struct RemoteContentCapability { |
| 24 RemotePlayType play_type; |
| 25 string robustness; // Defined by key system scheme. |
| 26 }; |
| 27 |
| 28 // A MediaKeySystemConfiguration (see EME W3C spec) supported by the remote |
| 29 // media services. |
| 30 struct RemoteKeySystem { |
| 31 string name; // Reverse URI (e.g., "org.w3.clearkey") |
| 32 array<string> init_data_types; |
| 33 array<RemoteContentCapability> audio_capabilities; |
| 34 array<RemoteContentCapability> video_capabilities; |
| 35 enum Requirement { REQUIRED, OPTIONAL, NOT_ALLOWED }; |
| 36 Requirement distinctive_identifier; |
| 37 Requirement persistent_state; |
| 38 array<string> session_types; |
| 39 }; |
| 40 |
| 41 // Structure describing the capabilities of the remote media services. |
| 42 struct RemoteCapabilities { |
| 43 // List of RemotePlayTypes evaluated against canPlayType() queries to |
| 44 // determine whether the remote supports playback of a specific format/codec |
| 45 // of content (when not using an DRM key system). |
| 46 array<RemotePlayType> play_types; |
| 47 |
| 48 // List of supported DRM key system configurations. |
| 49 array<RemoteKeySystem> key_systems; |
| 50 }; |
| 51 |
| 52 interface Remoter { |
| 53 // Register the client that is to be notified when remote media services are |
| 54 // available/gone, and for session-level lifecycle events. |
| 55 RegisterClient(RemoterClient client); |
| 56 |
| 57 // Called to start remote media services. If |success| is true in the result, |
| 58 // calls to SendMessageToRemote() and SendBufferToRemote() can be made, and |
| 59 // any messages from the remote will be forwarded back to the client via |
| 60 // RemoterClient.OnMessageFromRemote(). |
| 61 // |
| 62 // |audio_pipe| and |video_pipe| provide handles to the consumer end of a data |
| 63 // pipe. These data pipes are used for the transport of the demuxed bitstream |
| 64 // data. The Remoter is instructed to read from these pipes and send the |
| 65 // bitstream data to the remote whenever SendBufferToRemote() is called. |
| 66 StartMediaServices(handle<data_pipe_consumer>? audio_pipe, |
| 67 handle<data_pipe_consumer>? video_pipe) => |
| 68 (bool success, uint32 audio_pipe_id, uint32 video_pipe_id); |
| 69 |
| 70 // Called to stop remote media services. Messages in both directions will be |
| 71 // dropped after this point, and the consumer end of the data pipes passed to |
| 72 // StartMediaServices() will be closed. If the optional |error_reason| is |
| 73 // missing, this is a normal stop command; otherwise, |error_reason| contains |
| 74 // a human-readable string indicating the failure(s) that forced remoting to |
| 75 // be stopped. |
| 76 StopMediaServices(string? error_reason); |
| 77 |
| 78 // Forward |message| to the remote endpoint over an encrypted, reliable |
| 79 // transport. |message| is a serialized protobuf from |
| 80 // src/media/remoting/proto/... |
| 81 SendMessageToRemote(array<uint8> message); |
| 82 |
| 83 // Forward |buffer| to the remote endpoint over an encrypted, reliable |
| 84 // transport. Before this is called, the client must write |buffer.data_size| |
| 85 // bytes into one of the data pipes. |pipe_id| selects which data pipe will be |
| 86 // read from (audio or video). |
| 87 SendBufferToRemote(uint32 pipe_id, DecoderBuffer buffer); |
| 88 }; |
| 89 |
| 90 interface RemoterClient { |
| 91 // Called to notify the client that remote media services are now available, |
| 92 // along with some information about their capabilities to help the client |
| 93 // decide whether/when to begin remoting (with sufficient support). When the |
| 94 // client is ready to start remoting media, it calls |
| 95 // Remoter.StartMediaServices(). |
| 96 OnRemoteServicesAvailable(RemoteCapabilities capabilities); |
| 97 |
| 98 // Called to notify the client the remote media services are no longer |
| 99 // available. Note that this is different from OnMediaServicesStopped() in |
| 100 // that it does not indicate active remoting of media services has been |
| 101 // stopped. |
| 102 OnRemoteServicesGone(); |
| 103 |
| 104 // Called while remoting is active to pass a |message| from the remote media |
| 105 // services to the local media stack. The |message| is guaranteed to have been |
| 106 // received over an encrypted, reliable transport and consists of a serialized |
| 107 // protobuf from src/media/remoting/proto/... |
| 108 OnMessageFromRemote(array<uint8> message); |
| 109 |
| 110 // Called when remote media services have terminated. This may or may not be a |
| 111 // response to a Remoter::StopMediaServices() call, as external causes may be |
| 112 // the reason remoting was ended. If |error_reason| is present, this indicates |
| 113 // remoting was ended due to a fatal error and the string provides a |
| 114 // human-readable reason message. |
| 115 OnMediaServicesStopped(string? error_reason); |
| 116 }; |
| OLD | NEW |