| // Copyright 2016 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| library fuchsia.mediaplayer; |
| |
| // Reader with seek semantics. |
| // TODO(dalesat): Report problems using Problem rather than SeekingReaderResult. |
| interface SeekingReader { |
| // Describes the content. If there’s a problem accessing the content, this |
| // is expressed by using result. The size_in_bytes may be reported as |
| // UNKNOWN_SIZE if the size of the content is unknown. |
| Describe() -> (SeekingReaderResult result, uint64 size, bool can_seek); |
| |
| // Reads the content. If there’s a problem performing the read, this is |
| // expressed using result. If the read succeeded, the reply must contain a |
| // valid socket from which the content can be read. |
| ReadAt(uint64 position) -> (SeekingReaderResult SeekingReaderResult, |
| handle<socket>? socket); |
| }; |
| |
| const uint64 UNKNOWN_SIZE = 0xffffffffffffffff; |
| |
| enum SeekingReaderResult : int32 { |
| OK = 0; |
| UNKNOWN_ERROR = -1; |
| |
| // Returned by ReadAt if non-zero position is specified and source cannot |
| // seek. |
| INVALID_ARGUMENT = -2; |
| |
| // Returned by either method if the content cannot be found. |
| NOT_FOUND = -3; |
| }; |