Index: chromecast/media/cma/ipc/media_memory_chunk.h |
diff --git a/chromecast/media/cma/ipc/media_memory_chunk.h b/chromecast/media/cma/ipc/media_memory_chunk.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1b91c840a9d03aec0d870560868147edb4baecd3 |
--- /dev/null |
+++ b/chromecast/media/cma/ipc/media_memory_chunk.h |
@@ -0,0 +1,39 @@ |
+// Copyright 2014 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 CHROMECAST_MEDIA_CMA_IPC_MEDIA_MEMORY_CHUNK_H_ |
+#define CHROMECAST_MEDIA_CMA_IPC_MEDIA_MEMORY_CHUNK_H_ |
+ |
+#include "base/basictypes.h" |
+ |
+namespace chromecast { |
+namespace media { |
+ |
+// MediaMemoryChunk represents a block of memory without doing any assumption |
+// about the type of memory (e.g. shared memory) nor about the underlying |
+// memory ownership. |
+// The block of memory can be invalidated under the cover (e.g. if the derived |
+// class does not own the underlying memory), |
+// in that case, MediaMemoryChunk::valid() will return false. |
+class MediaMemoryChunk { |
+ public: |
+ virtual ~MediaMemoryChunk(); |
+ |
+ // Returns the start of the block of memory. |
+ virtual void* data() const = 0; |
+ |
+ // Returns the size of the block of memory. |
+ virtual size_t size() const = 0; |
+ |
+ // Returns whether the underlying block of memory is valid. |
+ // Since MediaMemoryChunk does not specify a memory ownership model, |
+ // the underlying block of memory might be invalidated by a third party. |
+ // In that case, valid() will return false. |
+ virtual bool valid() const = 0; |
+}; |
+ |
+} // namespace media |
+} // namespace chromecast |
+ |
+#endif // CHROMECAST_MEDIA_CMA_IPC_MEDIA_MEMORY_CHUNK_H_ |