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

Side by Side Diff: media/filters/memory_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/file_data_source.cc ('k') | media/filters/memory_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 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 MEDIA_FILTERS_MEMORY_DATA_SOURCE_H_ 5 #ifndef MEDIA_FILTERS_MEMORY_DATA_SOURCE_H_
6 #define MEDIA_FILTERS_MEMORY_DATA_SOURCE_H_ 6 #define MEDIA_FILTERS_MEMORY_DATA_SOURCE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "media/base/data_source.h" 11 #include "media/base/data_source.h"
12 12
13 namespace media { 13 namespace media {
14 14
15 // Basic data source that treats the URL as a file path, and uses the file 15 // Basic data source that treats the URL as a file path, and uses the file
16 // system to read data for a media pipeline. 16 // system to read data for a media pipeline.
17 class MEDIA_EXPORT MemoryDataSource : public DataSource { 17 class MEDIA_EXPORT MemoryDataSource : public DataSource {
18 public: 18 public:
19 // Construct MemoryDataSource with |data| and |size|. The data is guaranteed 19 // Construct MemoryDataSource with |data| and |size|. The data is guaranteed
20 // to be valid during the lifetime of MemoryDataSource. 20 // to be valid during the lifetime of MemoryDataSource.
21 MemoryDataSource(const uint8_t* data, size_t size); 21 MemoryDataSource(const uint8_t* data, size_t size);
22 ~MemoryDataSource() final; 22 ~MemoryDataSource() final;
23 23
24 // Implementation of DataSource. 24 // Implementation of DataSource.
25 void Read(int64_t position, 25 void Read(int64_t position,
26 int size, 26 int size,
27 uint8_t* data, 27 uint8_t* data,
28 const DataSource::ReadCB& read_cb) final; 28 const DataSource::ReadCB& read_cb) final;
29 void Stop() final; 29 void Stop() final;
30 void Abort() final;
30 bool GetSize(int64_t* size_out) final; 31 bool GetSize(int64_t* size_out) final;
31 bool IsStreaming() final; 32 bool IsStreaming() final;
32 void SetBitrate(int bitrate) final; 33 void SetBitrate(int bitrate) final;
33 34
34 private: 35 private:
35 const uint8_t* data_ = nullptr; 36 const uint8_t* data_ = nullptr;
36 size_t size_ = 0; 37 size_t size_ = 0;
37 38
38 bool is_stopped_ = false; 39 bool is_stopped_ = false;
39 40
40 DISALLOW_COPY_AND_ASSIGN(MemoryDataSource); 41 DISALLOW_COPY_AND_ASSIGN(MemoryDataSource);
41 }; 42 };
42 43
43 } // namespace media 44 } // namespace media
44 45
45 #endif // MEDIA_FILTERS_MEMORY_DATA_SOURCE_H_ 46 #endif // MEDIA_FILTERS_MEMORY_DATA_SOURCE_H_
OLDNEW
« no previous file with comments | « media/filters/file_data_source.cc ('k') | media/filters/memory_data_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698