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..5f3266a1975789c259052a6f8d61f62e607f782a |
| --- /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; |
| + media::BufferEncodingMetadata metadata() const; |
|
Ami GONE FROM CHROMIUM
2013/03/19 18:01:49
Am I missing something or could this return a cons
vmr
2013/03/20 12:09:14
It could. I returned by value to make 100 % sure s
|
| + |
| + std::string ToDebugString() const; |
| + |
| + protected: |
| + virtual ~EncodedBitstreamBuffer(); |
| + friend class base::RefCountedThreadSafe<EncodedBitstreamBuffer>; |
| + |
| + private: |
| + scoped_ptr<base::SharedMemory> shm_; |
| + size_t size_; |
| + media::BufferEncodingMetadata metadata_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(EncodedBitstreamBuffer); |
| +}; |
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_BASE_ENCODED_BITSTREAM_BUFFER_H_ |
| + |