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

Unified Diff: media/filters/memory_data_source.h

Issue 1748333003: media: Add MemoryDataSource. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/BUILD.gn ('k') | media/filters/memory_data_source.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/memory_data_source.h
diff --git a/media/filters/memory_data_source.h b/media/filters/memory_data_source.h
new file mode 100644
index 0000000000000000000000000000000000000000..012b4bbf2a2b1e5881a06a6eacfabc86964afd8b
--- /dev/null
+++ b/media/filters/memory_data_source.h
@@ -0,0 +1,45 @@
+// 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 MEDIA_FILTERS_MEMORY_DATA_SOURCE_H_
+#define MEDIA_FILTERS_MEMORY_DATA_SOURCE_H_
+
+#include <stdint.h>
+
+#include "base/macros.h"
+#include "media/base/data_source.h"
+
+namespace media {
+
+// Basic data source that treats the URL as a file path, and uses the file
+// system to read data for a media pipeline.
+class MEDIA_EXPORT MemoryDataSource : public DataSource {
+ public:
+ // Construct MemoryDataSource with |data| and |size|. The data is guaranteed
+ // to be valid during the lifetime of MemoryDataSource.
+ MemoryDataSource(const uint8_t* data, size_t size);
+ ~MemoryDataSource() final;
+
+ // Implementation of DataSource.
+ void Read(int64_t position,
+ int size,
+ uint8_t* data,
+ const DataSource::ReadCB& read_cb) final;
+ void Stop() final;
+ bool GetSize(int64_t* size_out) final;
+ bool IsStreaming() final;
+ void SetBitrate(int bitrate) final;
+
+ private:
+ const uint8_t* data_ = nullptr;
+ size_t size_ = 0;
+
+ bool is_stopped_ = false;
+
+ DISALLOW_COPY_AND_ASSIGN(MemoryDataSource);
+};
+
+} // namespace media
+
+#endif // MEDIA_FILTERS_MEMORY_DATA_SOURCE_H_
« no previous file with comments | « media/BUILD.gn ('k') | media/filters/memory_data_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698