1 // Copyright (c) 2011 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.
5 #ifndef MEDIA_BASE_BITSTREAM_BUFFER_H_
6 #define MEDIA_BASE_BITSTREAM_BUFFER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/shared_memory.h"
10 #include "base/time/time.h"
11 #include "media/base/timestamp_constants.h"
15 // Class for passing bitstream buffers around. Does not take ownership of the
16 // data. This is the media-namespace equivalent of PP_VideoBitstreamBuffer_Dev.
17 class BitstreamBuffer
{
19 BitstreamBuffer(int32 id
, base::SharedMemoryHandle handle
, size_t size
)
23 presentation_timestamp_(kNoTimestamp()) {}
25 BitstreamBuffer(int32 id
,
26 base::SharedMemoryHandle handle
,
28 base::TimeDelta presentation_timestamp
)
32 presentation_timestamp_(presentation_timestamp
) {}
34 int32
id() const { return id_
; }
35 base::SharedMemoryHandle
handle() const { return handle_
; }
36 size_t size() const { return size_
; }
38 // The timestamp is only valid if it's not equal to |media::kNoTimestamp()|.
39 base::TimeDelta
presentation_timestamp() const {
40 return presentation_timestamp_
;
45 base::SharedMemoryHandle handle_
;
48 // This is only set when necessary. For example, AndroidVideoDecodeAccelerator
49 // needs the timestamp because the underlying decoder may require it to
50 // determine the output order.
51 base::TimeDelta presentation_timestamp_
;
53 // Allow compiler-generated copy & assign constructors.
58 #endif // MEDIA_BASE_BITSTREAM_BUFFER_H_