OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 MEDIA_FILTERS_FILE_DATA_SOURCE_H_ | 5 #ifndef MEDIA_FILTERS_FILE_DATA_SOURCE_H_ |
6 #define MEDIA_FILTERS_FILE_DATA_SOURCE_H_ | 6 #define MEDIA_FILTERS_FILE_DATA_SOURCE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 11 matching lines...) Expand all Loading... |
22 class MEDIA_EXPORT FileDataSource : public DataSource { | 22 class MEDIA_EXPORT FileDataSource : public DataSource { |
23 public: | 23 public: |
24 FileDataSource(); | 24 FileDataSource(); |
25 explicit FileDataSource(base::File file); | 25 explicit FileDataSource(base::File file); |
26 ~FileDataSource() override; | 26 ~FileDataSource() override; |
27 | 27 |
28 bool Initialize(const base::FilePath& file_path); | 28 bool Initialize(const base::FilePath& file_path); |
29 | 29 |
30 // Implementation of DataSource. | 30 // Implementation of DataSource. |
31 void Stop() override; | 31 void Stop() override; |
| 32 void Abort() override; |
32 void Read(int64_t position, | 33 void Read(int64_t position, |
33 int size, | 34 int size, |
34 uint8_t* data, | 35 uint8_t* data, |
35 const DataSource::ReadCB& read_cb) override; | 36 const DataSource::ReadCB& read_cb) override; |
36 bool GetSize(int64_t* size_out) override; | 37 bool GetSize(int64_t* size_out) override; |
37 bool IsStreaming() override; | 38 bool IsStreaming() override; |
38 void SetBitrate(int bitrate) override; | 39 void SetBitrate(int bitrate) override; |
39 | 40 |
40 // Unit test helpers. Recreate the object if you want the default behaviour. | 41 // Unit test helpers. Recreate the object if you want the default behaviour. |
41 void force_read_errors_for_testing() { force_read_errors_ = true; } | 42 void force_read_errors_for_testing() { force_read_errors_ = true; } |
42 void force_streaming_for_testing() { force_streaming_ = true; } | 43 void force_streaming_for_testing() { force_streaming_ = true; } |
43 uint64_t bytes_read_for_testing() { return bytes_read_; } | 44 uint64_t bytes_read_for_testing() { return bytes_read_; } |
44 void reset_bytes_read_for_testing() { bytes_read_ = 0; } | 45 void reset_bytes_read_for_testing() { bytes_read_ = 0; } |
45 | 46 |
46 private: | 47 private: |
47 base::MemoryMappedFile file_; | 48 base::MemoryMappedFile file_; |
48 | 49 |
49 bool force_read_errors_; | 50 bool force_read_errors_; |
50 bool force_streaming_; | 51 bool force_streaming_; |
51 uint64_t bytes_read_; | 52 uint64_t bytes_read_; |
52 | 53 |
53 DISALLOW_COPY_AND_ASSIGN(FileDataSource); | 54 DISALLOW_COPY_AND_ASSIGN(FileDataSource); |
54 }; | 55 }; |
55 | 56 |
56 } // namespace media | 57 } // namespace media |
57 | 58 |
58 #endif // MEDIA_FILTERS_FILE_DATA_SOURCE_H_ | 59 #endif // MEDIA_FILTERS_FILE_DATA_SOURCE_H_ |
OLD | NEW |