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

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: Build fixes 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..7203532140b2688458f06abed233d6700d7619a3
--- /dev/null
+++ b/media/base/encoded_bitstream_buffer.h
@@ -0,0 +1,67 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
Ami GONE FROM CHROMIUM 2013/03/18 22:53:45 Drop the (c) (here and elsewhere) https://code.goo
Ville-Mikko Rautio 2013/03/19 16:45:43 Done.
+// 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/time.h"
+#include "media/base/media_export.h"
+#include "media/video/video_encode_types.h"
+
+namespace media {
+
+// Class to represent 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.
Ami GONE FROM CHROMIUM 2013/03/18 22:53:45 The sentence of l.20-23 sounds like PR for scoped_
Ville-Mikko Rautio 2013/03/19 16:45:43 I am still defending the use of reference counting
+//
+// 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 copies |size| bytes of data from |buffer| into newly
+ // allocated buffer.
+ EncodedBitstreamBuffer(const uint8* buffer,
+ size_t size,
+ const media::BufferEncodingMetadata& metadata);
+ // TODO(vmr): SharedMemory handle in addition to (or instead of) copy
+ // constructor?
+
+ // Accessors for properties.
+ const uint8* buffer() const;
+ size_t size() const;
+ const base::Time timestamp() const;
Ami GONE FROM CHROMIUM 2013/03/18 22:53:45 For this and all the following accessors, why not
Ville-Mikko Rautio 2013/03/19 16:45:43 Done.
+ int temporal_layer_id() const;
+ bool is_key_frame() const;
+ bool is_altref_frame() const;
+ bool is_golden_frame() const;
+ bool is_droppable() const;
+ bool is_layer_sync() const;
+
+ protected:
+ virtual ~EncodedBitstreamBuffer();
+ friend class base::RefCountedThreadSafe<EncodedBitstreamBuffer>;
+
+ private:
+ scoped_ptr<uint8[]> buffer_;
+ size_t size_;
+ media::BufferEncodingMetadata metadata_;
+
+ DISALLOW_COPY_AND_ASSIGN(EncodedBitstreamBuffer);
+};
+
+} // namespace media
+
+// Pretty print operator for the EncodedBitstreamBuffer.
+std::ostream& operator<<(std::ostream& output,
+ const media::EncodedBitstreamBuffer& b);
Ami GONE FROM CHROMIUM 2013/03/18 22:53:45 This isn't landable. You want a ToDebugString() me
Ville-Mikko Rautio 2013/03/19 16:45:43 Done.
+
+#endif // MEDIA_BASE_ENCODED_BITSTREAM_BUFFER_H_

Powered by Google App Engine
This is Rietveld 408576698