| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef SERVICES_MEDIA_FRAMEWORK_PARTS_FILE_READER_H_ | 5 #ifndef SERVICES_MEDIA_FRAMEWORK_PARTS_FILE_READER_H_ |
| 6 #define SERVICES_MEDIA_FRAMEWORK_PARTS_FILE_READER_H_ | 6 #define SERVICES_MEDIA_FRAMEWORK_PARTS_FILE_READER_H_ |
| 7 | 7 |
| 8 #include "services/media/framework/parts/reader.h" | 8 #include "services/media/framework/parts/reader.h" |
| 9 | 9 |
| 10 namespace mojo { | 10 namespace mojo { |
| 11 namespace media { | 11 namespace media { |
| 12 | 12 |
| 13 // Reads raw data from a file. | 13 // Reads raw data from a file. |
| 14 class FileReader : public Reader { | 14 class FileReader : public Reader { |
| 15 public: | 15 public: |
| 16 static ReaderPtr Create() { | 16 static std::shared_ptr<Reader> Create() { |
| 17 return ReaderPtr(new FileReader()); | 17 return std::shared_ptr<Reader>(new FileReader()); |
| 18 } | 18 } |
| 19 | 19 |
| 20 ~FileReader() override; | 20 ~FileReader() override; |
| 21 | 21 |
| 22 // Reader implementation. | 22 // Reader implementation. |
| 23 Result Init(const GURL& gurl) override; | 23 Result Init(const GURL& gurl) override; |
| 24 | 24 |
| 25 size_t Read(uint8* buffer, int bytes_to_read) override; | 25 size_t Read(uint8* buffer, int bytes_to_read) override; |
| 26 | 26 |
| 27 int64_t GetPosition() const override; | 27 int64_t GetPosition() const override; |
| 28 | 28 |
| 29 int64_t SetPosition(int64 position) override; | 29 int64_t SetPosition(int64 position) override; |
| 30 | 30 |
| 31 size_t GetSize() const override; | 31 size_t GetSize() const override; |
| 32 | 32 |
| 33 bool CanSeek() const override; | 33 bool CanSeek() const override; |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 FileReader() {} | 36 FileReader() {} |
| 37 | 37 |
| 38 FILE* file_; | 38 FILE* file_; |
| 39 int64 size_; | 39 int64 size_; |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 } // namespace media | 42 } // namespace media |
| 43 } // namespace mojo | 43 } // namespace mojo |
| 44 | 44 |
| 45 #endif // SERVICES_MEDIA_FRAMEWORK_PARTS_FILE_READER_H_ | 45 #endif // SERVICES_MEDIA_FRAMEWORK_PARTS_FILE_READER_H_ |
| OLD | NEW |