| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 [DartPackage="mojo_services"] | 5 [DartPackage="mojo_services"] |
| 6 module mojo.media; | 6 module mojo.media; |
| 7 | 7 |
| 8 import "mojo/services/media/common/interfaces/media_common.mojom"; | 8 import "mojo/services/media/common/interfaces/media_common.mojom"; |
| 9 | 9 |
| 10 // MediaPacketRegion | 10 // MediaPacketRegion |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 MediaPacketRegion payload; | 54 MediaPacketRegion payload; |
| 55 array<MediaPacketRegion>? extra_payload; | 55 array<MediaPacketRegion>? extra_payload; |
| 56 | 56 |
| 57 // TODO(johngro): do we need to describe the MediaType of this payload, or is | 57 // TODO(johngro): do we need to describe the MediaType of this payload, or is |
| 58 // its type implicit based on the channel over which it is being pushed? | 58 // its type implicit based on the channel over which it is being pushed? |
| 59 | 59 |
| 60 // TODO(johngro): how do we attach per-packet media specific metadata to this | 60 // TODO(johngro): how do we attach per-packet media specific metadata to this |
| 61 // packet? | 61 // packet? |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 // MediaPipeState | |
| 65 // | |
| 66 // A small structure used by the user of a media pipe to fetch the shared buffer | |
| 67 // used by the media pipe to move bulk data. | |
| 68 // | |
| 69 // TODO(johngro): Right now, the only real purpose for this struture is to | |
| 70 // bundle the size of the buffer with the buffer handle itself. When buffer | |
| 71 // handles can have their properties queried directly, it can go away. See | |
| 72 // domokit/mojo issue #501 | |
| 73 struct MediaPipeState { | |
| 74 const uint64 kMaxPayloadLen = 0x3FFFFFFFFFFFFFFF; | |
| 75 | |
| 76 handle<shared_buffer> payload_buffer; | |
| 77 | |
| 78 // TODO(johngro) : Why do I have to send this? Why can't I just query the | |
| 79 // shared_buffer handle for its length? | |
| 80 uint64 payload_buffer_len; | |
| 81 }; | |
| 82 | |
| 83 // MediaPipe | 64 // MediaPipe |
| 84 // | 65 // |
| 85 // An interface exposed by consumers of media which provides the means for | 66 // An interface exposed by consumers of media which provides the means for |
| 86 // producers to send media to consumers. A pipe logically consists of a shared | 67 // producers to send media to consumers. A pipe logically consists of a shared |
| 87 // memory region, and an ordered queue of MediaPackets. Users obtain access to | 68 // memory region, and an ordered queue of MediaPackets. Users obtain access to |
| 88 // the shared buffer via the GetState method. They may then send packet to the | 69 // the shared buffer via the GetState method. They may then send packet to the |
| 89 // other side of the pipe using the SendPacket method and be informed about when | 70 // other side of the pipe using the SendPacket method and be informed about when |
| 90 // the media has been consumed via the SendPacket callback they provide. | 71 // the media has been consumed via the SendPacket callback they provide. |
| 91 // Finally, the pipeline may be flushed using the Flush method. | 72 // Finally, the pipeline may be flushed using the Flush method. |
| 92 interface MediaPipe { | 73 interface MediaPipe { |
| 74 const uint64 kMaxBufferLen = 0x3FFFFFFFFFFFFFFF; |
| 75 |
| 93 // An enumeration used to indicate the ultimate fate of packets sent across | 76 // An enumeration used to indicate the ultimate fate of packets sent across |
| 94 // the pipe using the SendPacket method. | 77 // the pipe using the SendPacket method. |
| 95 enum SendResult { | 78 enum SendResult { |
| 96 CONSUMED, // Media was completely consumed. | 79 CONSUMED, // Media was completely consumed. |
| 97 FLUSHED, // Some or all of the media was flushed before being consumed. | 80 FLUSHED, // Some or all of the media was flushed before being consumed. |
| 98 }; | 81 }; |
| 99 | 82 |
| 100 // Request that a reference to the pipe's state be sent to the caller via | 83 // Sets the shared buffer in which sent Packet payloads will be located. |
| 101 // callback. | 84 SetBuffer(handle<shared_buffer> buffer, uint64 size); |
| 102 GetState() => (MediaPipeState state); | |
| 103 | 85 |
| 104 // Place a media packet into the pipeline to be consumed. When the consumer | 86 // Place a media packet into the pipeline to be consumed. When the consumer |
| 105 // is finished with the packet, it will invoke the supplied callback to | 87 // is finished with the packet, it will invoke the supplied callback to |
| 106 // indicate that the region of the shared buffer indicated by the MediaPacket | 88 // indicate that the region of the shared buffer indicated by the MediaPacket |
| 107 // object is now available for new data. In addition, a SendResult will be | 89 // object is now available for new data. In addition, a SendResult will be |
| 108 // providid indicating whether or not the packet was consumed or flushed. | 90 // providid indicating whether or not the packet was consumed or flushed. |
| 109 SendPacket(MediaPacket packet) => (SendResult result); | 91 SendPacket(MediaPacket packet) => (SendResult result); |
| 110 | 92 |
| 111 // Flush the pipe, discarding all queued packets in order (from front to back) | 93 // Flush the pipe, discarding all queued packets in order (from front to back) |
| 112 // as we go. When the flush operation is complete, the provided callback will | 94 // as we go. When the flush operation is complete, the provided callback will |
| 113 // be invoked to indicate that the consumer end of the pipe has finished | 95 // be invoked to indicate that the consumer end of the pipe has finished |
| 114 // flushing and that the pipeline is now empty. | 96 // flushing and that the pipeline is now empty. |
| 115 Flush() => (); | 97 Flush() => (); |
| 116 }; | 98 }; |
| OLD | NEW |