Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Side by Side Diff: media/filters/file_data_source.h

Issue 2267963002: Add support for cancellation of demuxer reads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix and add tests. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/filters/ffmpeg_demuxer_unittest.cc ('k') | media/filters/file_data_source.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_demuxer_unittest.cc ('k') | media/filters/file_data_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698