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

Unified Diff: media/base/data_buffer.h

Issue 13682: Checking in media::DataBuffer, a simple implementation of WritableBufferInterface. (Closed)
Patch Set: it try Created 12 years 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/base/buffers.h ('k') | media/base/data_buffer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/data_buffer.h
diff --git a/media/base/data_buffer.h b/media/base/data_buffer.h
new file mode 100755
index 0000000000000000000000000000000000000000..6e1a00476d57f305412cb5e2a937d2d270eef977
--- /dev/null
+++ b/media/base/data_buffer.h
@@ -0,0 +1,50 @@
+// Copyright (c) 2006-2008 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.
+
+// A simple implementation of WritableBufferInterface that takes ownership of
+// the given data pointer.
+//
+// DataBuffer assumes that memory was allocated with new char[].
+
+#ifndef MEDIA_BASE_DATA_BUFFER_H_
+#define MEDIA_BASE_DATA_BUFFER_H_
+
+#include "media/base/buffers.h"
+
+namespace media {
+
+class DataBuffer : public WritableBufferInterface {
+ public:
+ DataBuffer(char* data, size_t buffer_size, size_t data_size,
+ int64 timestamp, int64 duration);
+
+ // StreamSampleInterface
+ virtual int64 GetTimestamp() const;
+ virtual void SetTimestamp(int64 timestamp);
+ virtual int64 GetDuration() const;
+ virtual void SetDuration(int64 duration);
+
+ // BufferInterface
+ virtual const char* GetData() const;
+ virtual size_t GetDataSize() const;
+
+ // WritableBufferInterface
+ virtual char* GetWritableData();
+ virtual size_t GetBufferSize() const;
+ virtual void SetDataSize(size_t data_size);
+
+ protected:
+ virtual ~DataBuffer();
+
+ private:
+ char* data_;
+ size_t buffer_size_;
+ size_t data_size_;
+ int64 timestamp_;
+ int64 duration_;
+};
+
+} // namespace media
+
+#endif // MEDIA_BASE_DATA_BUFFER_H_
« no previous file with comments | « media/base/buffers.h ('k') | media/base/data_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698