| // Copyright 2016 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #ifndef SERVICES_MEDIA_FRAMEWORK_PARTS_READER_H_ |
| #define SERVICES_MEDIA_FRAMEWORK_PARTS_READER_H_ |
| #include "services/media/framework/result.h" |
| // Abstract base class for objects that read raw data on behalf of demuxes. |
| std::function<void(Result result, size_t size, bool can_seek)>; |
| using ReadAtCallback = std::function<void(Result result, size_t bytes_read)>; |
| static constexpr size_t kUnknownSize = std::numeric_limits<size_t>::max(); |
| // Returns a result, the file size and whether the reader supports seeking |
| // via a callback. The returned size is kUnknownSize if the content size isn't |
| virtual void Describe(const DescribeCallback& callback) = 0; |
| // Reads the specified number of bytes into the buffer from the specified |
| // position and returns a result and the number of bytes read via the |
| virtual void ReadAt(size_t position, |
| const ReadAtCallback& callback) = 0; |
| #endif // MOJO_SERVICES_MEDIA_READER_H_ |