OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 [DartPackage="mojo_services"] |
| 6 module mojo.media; |
| 7 |
| 8 import "mojo/services/media/common/interfaces/media_common.mojom"; |
| 9 import "mojo/services/media/common/interfaces/media_pipe.mojom"; |
| 10 import "mojo/services/media/common/interfaces/media_types.mojom"; |
| 11 |
| 12 // Models a stream producer. A MediaProducer allows a client to connect the |
| 13 // producer to a MediaConsumer so packets flow from the producer to the |
| 14 // consumer. Clients who want to receive packets directly from the producer |
| 15 // should use MediaPullModeProducer instead. |
| 16 // |
| 17 // The client calls Connect to connect producer and consumer. The producer then |
| 18 // calls PushPacket on the consumer to deliver packets. |
| 19 interface MediaProducer { |
| 20 // Connects this MediaProducer to a MediaConsumer. |
| 21 Connect(MediaConsumer consumer) => (); |
| 22 |
| 23 // Disconnects this MediaProducer from a previously-connected MediaConsumer. |
| 24 Disconnect(); |
| 25 }; |
| 26 |
| 27 // Models a stream producer. A MediaPullModeProducer allows a client to receive |
| 28 // packets directly from the producer. Clients who want to connect the producer |
| 29 // to a MediaConsumer should use MediaProducer instead. |
| 30 // |
| 31 // The client calls PullPacket to get a packet. Once the client is done with |
| 32 // the packet, it calls ReleasePacket to let the producer know that the packet |
| 33 // buffer region can be reused. |
| 34 interface MediaPullModeProducer { |
| 35 // Gets the shared buffer in which packet payload will be located. |
| 36 GetBuffer() => (handle<shared_buffer> buffer); |
| 37 |
| 38 // Pulls a packet from the producer. When the client is done with the |
| 39 // packet buffer region, it should call ReleasePacket or PullPacket passing |
| 40 // the locator. Note that the optional locator passed in PullPacket is |
| 41 // a locator to be released and probably won't be the same locator passed |
| 42 // back in the callback. |
| 43 PullPacket(MediaPacket? to_release) => (MediaPacket packet); |
| 44 |
| 45 // Signals the producer that the client is done with the buffer region. |
| 46 ReleasePacket(MediaPacket to_release); |
| 47 }; |
| 48 |
| 49 // Models a stream consumer. A MediaConsumer allows a client to send packets |
| 50 // directly to the consumer or to connect the consumer to a MediaProducer so |
| 51 // packets flow from the producer to the consumer. |
| 52 // |
| 53 // In the former scenario, the client calls PushPacket to deliver a packet. The |
| 54 // callback notifies the client that the consumer is done with the packet |
| 55 // buffer region. |
| 56 // |
| 57 // In the latter scenario, the client calls Connect on the producer to connect |
| 58 // producer and consumer. The producer then calls PushPacket on the consumer to |
| 59 // deliver packets. |
| 60 interface MediaConsumer { |
| 61 // Sets the shared buffer in which packet payload will be located. |
| 62 SetBuffer(handle<shared_buffer> buffer, uint64 size) => (); |
| 63 |
| 64 // Pushes a packet to the consumer. The callback signals that the consumer |
| 65 // is done with the packet buffer region. |
| 66 PushPacket(MediaPacket packet) => (); |
| 67 }; |
OLD | NEW |