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

Unified Diff: media/base/encoded_bitstream_buffer.h

Issue 12379011: Interfaces for encoded video sources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 9 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
Index: media/base/encoded_bitstream_buffer.h
diff --git a/media/base/encoded_bitstream_buffer.h b/media/base/encoded_bitstream_buffer.h
new file mode 100644
index 0000000000000000000000000000000000000000..8a0175f2418f0001e674fbbfd463cbaae3819409
--- /dev/null
+++ b/media/base/encoded_bitstream_buffer.h
@@ -0,0 +1,60 @@
+// Copyright 2013 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_BASE_ENCODED_BITSTREAM_BUFFER_H_
+#define MEDIA_BASE_ENCODED_BITSTREAM_BUFFER_H_
+
+#include <ostream>
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/shared_memory.h"
+#include "base/time.h"
+#include "media/base/media_export.h"
+#include "media/video/video_encode_types.h"
+
+namespace media {
+
+// Class to represent read-only encoded video bitstream buffers encapsulating
+// both the bitstream data and the metadata from the encoding context into
+// single object. Class implements reference counting mechanism so that
+// instances can be passed between threads (and possibly to multiple clients)
+// conveniently without requiring deep copies and lifetime of each object is
+// tied to scoped_refptrs held by the clients for the duration of the required
+// processing.
+//
+// As long as constantness of the buffer is respected by the clients class is
+// also thread safe.
+class MEDIA_EXPORT EncodedBitstreamBuffer :
+ public base::RefCountedThreadSafe<EncodedBitstreamBuffer> {
+ public:
+ // Constructor that maps the shared memory with the given size to the current
+ // process and associates the given metadata with the buffer.
+ EncodedBitstreamBuffer(base::SharedMemoryHandle handle,
+ size_t size,
+ const media::BufferEncodingMetadata& metadata);
+
+ // Accessors for properties.
+ const uint8* buffer() const;
+ size_t size() const;
+ const media::BufferEncodingMetadata& metadata() const;
+
+ std::string ToDebugString() const;
tommi (sloooow) - chröme 2013/03/21 14:48:05 #ifndef NDEBUG?
+
+ protected:
+ virtual ~EncodedBitstreamBuffer();
+ friend class base::RefCountedThreadSafe<EncodedBitstreamBuffer>;
+
+ private:
+ base::SharedMemory shm_;
+ size_t size_;
+ media::BufferEncodingMetadata metadata_;
+
+ DISALLOW_COPY_AND_ASSIGN(EncodedBitstreamBuffer);
+};
+
+} // namespace media
+
+#endif // MEDIA_BASE_ENCODED_BITSTREAM_BUFFER_H_
+

Powered by Google App Engine
This is Rietveld 408576698