Chromium Code Reviews| 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..d969c2d4b6ecebcbdde74af6d79c70bb99975296 |
| --- /dev/null |
| +++ b/media/base/encoded_bitstream_buffer.h |
| @@ -0,0 +1,74 @@ |
| +// Copyright (c) 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/time.h" |
| +#include "media/base/media_export.h" |
| + |
| +namespace media { |
| + |
| +// General encoded video bitstream buffer. |
| +class EncodedBitstreamBuffer : |
|
wjia(left Chromium)
2013/02/28 18:46:26
add MEDIA_EXPORT if this will be used outside medi
vmr
2013/03/01 14:24:00
Done.
|
| + public base::RefCountedThreadSafe<EncodedBitstreamBuffer> { |
| + public: |
| + // Constructor that allocates empty buffer of |size|. |
| + EncodedBitstreamBuffer(size_t size, base::Time timestamp, int temporal_layer); |
| + // Constructor that copies |size| bytes of data from |ptr| into newly |
| + // allocated buffer. |
| + EncodedBitstreamBuffer(uint8* ptr, size_t size, base::Time timestamp, |
| + int temporal_layer); |
|
wjia(left Chromium)
2013/02/28 18:46:26
For function declarations and definitions, put eac
vmr
2013/03/01 14:24:00
Done.
|
| + |
| + // Accessors for properties. |
| + uint8* ptr() const; |
| + size_t size() const; |
| + bool key_frame() const; |
| + bool altref_frame() const; |
| + bool golden_frame() const; |
| + base::Time timestamp() const; |
| + int temporal_layer() const; |
| + bool droppable() const; |
| + bool layer_sync() const; |
| + |
| + // Setters for properties. |
| + void MarkKeyFrame(); |
| + void MarkAltRef(); |
| + void MarkGolden(); |
| + void MarkDroppable(); |
| + void MarkLayerSync(); |
| + |
| + protected: |
| + virtual ~EncodedBitstreamBuffer(); // Destructor. Will deallocate the buffers. |
| + friend class base::RefCountedThreadSafe<EncodedBitstreamBuffer>; |
| + |
| + private: |
| + uint8* ptr_; |
|
wjia(left Chromium)
2013/02/28 18:46:26
use scoped_ptr<uint8[]>. how about changing name t
vmr
2013/03/01 14:24:00
Done.
|
| + size_t size_; |
| + base::Time timestamp_; |
| + bool key_frame_; |
| + int temporal_layer_; |
| + bool altref_frame_; |
| + bool golden_frame_; |
| + // Determines whether the buffer is droppable. With droppable buffers decoding |
| + // can be skipped without affecting the decoding of subsequent buffers. |
| + bool droppable_; |
| + // For temporal base layer, the field must be set to 0 only if it only depends |
| + // on previous key frame. For temporal enhancement layers the layer sync must |
| + // be set to true, if the buffer depends only on the previous temporal base |
| + // layer buffer. |
| + bool layer_sync_; |
| + DISALLOW_COPY_AND_ASSIGN(EncodedBitstreamBuffer); |
| +}; |
| + |
| +} // namespace media |
| + |
| +// Pretty print operator for the EncodedBitstreamBuffer. |
| +std::ostream& operator<<(std::ostream& output, |
| + const media::EncodedBitstreamBuffer& b); |
|
wjia(left Chromium)
2013/02/28 18:46:26
Is this for debugging purpose?
vmr
2013/03/01 14:24:00
Yes, debug/logging to see the key properties withi
|
| + |
| +#endif // MEDIA_BASE_ENCODED_BITSTREAM_BUFFER_H_ |