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 interface Remoter { | |
Ken Rockot(use gerrit already)
2016/07/27 22:31:15
Rather than use a client ID, an idiomatic design w
miu
2016/09/02 22:13:29
Great ideas. I reworked the Mojo interfaces here p
| |
8 // Register a new client that is to be notified when remote media services are | |
9 // available/gone, and for lifecycle events. The caller provides a distinct | |
10 // |client_id| to reference the client. More than one client may exist. | |
11 RegisterClient(uint32 client_id, RemoterClient client); | |
DaleCurtis
2016/07/27 21:09:59
Mojo is typically a way to avoid needing id's like
miu
2016/09/02 22:13:29
Done. (See reply to rockot's comment above.)
| |
12 | |
13 // Called to notify the Remoter that the client has gone away. | |
14 DeregisterClient(uint32 client_id); | |
15 | |
16 // Called to start remote media services. If |success| is true in the result, | |
17 // calls to SendMessageToRemote() and SendBufferToRemote() can be made, and | |
18 // any messages from the remote will be forwarded back to the client via | |
19 // RemoterClient.OnMessageFromRemote(). | |
20 // | |
21 // |audio_pipe| and |video_pipe| provide handles to the consumer end of a data | |
22 // pipe. These data pipes are used for the transport of the demuxed bitstream | |
23 // data. The Remoter is instructed to read from these pipes and send the | |
24 // bitstream data to the remote whenever SendBufferToRemote() is called. | |
25 StartMediaServices(uint32 client_id, | |
26 handle<data_pipe_consumer>? audio_pipe, | |
27 handle<data_pipe_consumer>? video_pipe) => | |
28 (bool success, uint32 audio_pipe_id, uint32 video_pipe_id); | |
DaleCurtis
2016/07/27 21:09:59
Again, generally we should be able to avoid ids by
| |
29 | |
30 // Called to stop remote media services. Messages in both directions will be | |
31 // dropped after this point, and the consumer end of the data pipes passed to | |
32 // StartMediaServices() will be closed. If the optional |error_reason| is | |
33 // missing, this is a normal stop command; otherwise, |error_reason| contains | |
34 // a human-readable string indicating the failure(s) that forced remoting to | |
35 // be stopped. | |
36 StopMediaServices(uint32 client_id, string? error_reason); | |
37 | |
38 // Forward |message| to the remote endpoint. |message| is a serialized | |
39 // protobuf from src/media/remoting/remoting.proto. | |
40 SendMessageToRemote(uint32 client_id, array<uint8> message); | |
41 | |
42 // Forward |buffer| to the remote endpoint. Before this is called, the client | |
43 // must write |num_bytes| bytes into one of the data pipes. |pipe_id| selects | |
44 // which data pipe will be read from. | |
45 SendBufferToRemote(uint32 client_id, uint32 pipe_id, uint32 num_bytes); | |
46 | |
47 // Discard all buffers currently queued for sending to the remote. This is | |
48 // used to optimize seeking. | |
49 DiscardPendingBuffers(uint32 client_id, uint32 pipe_id); | |
50 }; | |
51 | |
52 interface RemoterClient { | |
53 // Called to notify the client that remote media services are now | |
54 // available. The client will decide whether/when to begin remoting, and later | |
55 // will call Remoter.StartMediaServices() to initiate that. | |
56 // | |
57 // TODO(miu): In a later change, also pass information about the remote's | |
58 // capabilities (e.g., codec support, DRM keysystem support, etc.). | |
59 OnRemoteServicesAvailable(); | |
60 | |
61 // Called to notify the client the remote media services are no longer | |
62 // available. Note that this is different from OnMediaServicesStopped() in | |
63 // that it does not indicate active remoting of media services has been | |
64 // stopped. | |
65 OnRemoteServicesGone(); | |
66 | |
67 // Called while remoting is active to pass a |message| from the remote media | |
68 // services back to the local media stack. The |message| consists of a | |
69 // serialized protobuf from src/media/remoting/remoting.proto. | |
70 OnMessageFromRemote(array<uint8> message); | |
71 | |
72 // Called when remote media services have terminated. This may or may not be a | |
73 // response to a Remoter::StopMediaServices() call, as external events may | |
74 // have caused remoting to end. If |error_reason| is present, this indicates | |
75 // remoting was ended due to a fatal error and the string provides a | |
76 // human-readable reason message. | |
77 OnMediaServicesStopped(string? error_reason); | |
78 }; | |
OLD | NEW |