1 // Copyright 2020 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 ANDROID_V4L2_CODEC2_COMPONENTS_BITSTREAMBUFFER_H 6 #define ANDROID_V4L2_CODEC2_COMPONENTS_BITSTREAMBUFFER_H 7 8 #include <stdint.h> 9 10 #include <C2Buffer.h> 11 12 namespace android { 13 14 // The ConstBitstreamBuffer class can be used to store non-modifiable encoded video data. 15 struct ConstBitstreamBuffer { ConstBitstreamBufferConstBitstreamBuffer16 ConstBitstreamBuffer(const int32_t id, C2ConstLinearBlock dmabuf, const size_t offset, 17 const size_t size) 18 : id(id), dmabuf(std::move(dmabuf)), offset(offset), size(size) {} 19 ~ConstBitstreamBuffer() = default; 20 21 const int32_t id; 22 C2ConstLinearBlock dmabuf; 23 const size_t offset; 24 const size_t size; 25 }; 26 27 // The BitstreamBuffer class can be used to store modifiable encoded video data. 28 struct BitstreamBuffer { BitstreamBufferBitstreamBuffer29 BitstreamBuffer(std::shared_ptr<C2LinearBlock> dmabuf, const size_t offset, const size_t size) 30 : dmabuf(std::move(dmabuf)), offset(offset), size(size) {} 31 ~BitstreamBuffer() = default; 32 33 std::shared_ptr<C2LinearBlock> dmabuf; 34 const size_t offset; 35 const size_t size; 36 }; 37 38 } // namespace android 39 40 #endif // ANDROID_V4L2_CODEC2_COMPONENTS_BITSTREAMBUFFER_H 41