Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef MEDIA_BASE_ENCODED_BITSTREAM_BUFFER_H_ |
| 6 | #define MEDIA_BASE_ENCODED_BITSTREAM_BUFFER_H_ |
| 7 | |
| 8 | #include "base/callback_forward.h" |
| 9 | #include "base/memory/ref_counted.h" |
Ben Murdoch | 9ab5563 | 2013-07-18 11:57:30 +0100 | [diff] [blame] | 10 | #include "base/memory/shared_memory.h" |
Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 11 | #include "base/time/time.h" |
| 12 | #include "media/base/media_export.h" |
| 13 | #include "media/video/video_encode_types.h" |
| 14 | |
| 15 | namespace media { |
| 16 | |
| 17 | // General encoded video bitstream buffer. |
| 18 | class MEDIA_EXPORT EncodedBitstreamBuffer : |
| 19 | public base::RefCountedThreadSafe<EncodedBitstreamBuffer> { |
| 20 | public: |
| 21 | EncodedBitstreamBuffer(int buffer_id, |
| 22 | uint8* buffer, |
| 23 | uint32 size, |
| 24 | base::SharedMemoryHandle handle, |
| 25 | const media::BufferEncodingMetadata& metadata, |
| 26 | const base::Closure& destroy_cb); |
| 27 | // Accessors for properties. |
| 28 | int buffer_id() const; |
| 29 | const uint8* buffer() const; |
| 30 | uint32 size() const; |
| 31 | base::SharedMemoryHandle shared_memory_handle() const; |
| 32 | const media::BufferEncodingMetadata& metadata() const; |
| 33 | |
| 34 | protected: |
| 35 | // Destructor that deallocates the buffers. |
| 36 | virtual ~EncodedBitstreamBuffer(); |
| 37 | friend class base::RefCountedThreadSafe<EncodedBitstreamBuffer>; |
| 38 | |
| 39 | private: |
| 40 | int buffer_id_; |
| 41 | uint8* buffer_; |
| 42 | uint32 size_; |
| 43 | const base::SharedMemoryHandle shared_memory_handle_; |
| 44 | media::BufferEncodingMetadata metadata_; |
| 45 | const base::Closure destroy_cb_; |
| 46 | |
| 47 | DISALLOW_COPY_AND_ASSIGN(EncodedBitstreamBuffer); |
| 48 | }; |
| 49 | |
| 50 | } // namespace media |
| 51 | |
| 52 | #endif // MEDIA_BASE_ENCODED_BITSTREAM_BUFFER_H_ |