1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef VTS_VNDK_HIDL_BUFFERPOOL_V1_0_ALLOCATOR_H 18 #define VTS_VNDK_HIDL_BUFFERPOOL_V1_0_ALLOCATOR_H 19 20 #include <bufferpool/BufferPoolTypes.h> 21 22 using android::hardware::media::bufferpool::V1_0::ResultStatus; 23 using android::hardware::media::bufferpool::V1_0::implementation:: 24 BufferPoolAllocation; 25 using android::hardware::media::bufferpool::V1_0::implementation:: 26 BufferPoolAllocator; 27 28 // buffer allocator for the tests 29 class VtsBufferPoolAllocator : public BufferPoolAllocator { 30 public: VtsBufferPoolAllocator(const std::shared_ptr<C2Allocator> & allocator)31 VtsBufferPoolAllocator(const std::shared_ptr<C2Allocator> &allocator) 32 : mAllocator(allocator) {} 33 ~VtsBufferPoolAllocator()34 ~VtsBufferPoolAllocator() override {} 35 36 ResultStatus allocate(const std::vector<uint8_t> ¶ms, 37 std::shared_ptr<BufferPoolAllocation> *alloc, 38 size_t *allocSize) override; 39 40 bool compatible(const std::vector<uint8_t> &newParams, 41 const std::vector<uint8_t> &oldParams) override; 42 43 private: 44 const std::shared_ptr<C2Allocator> mAllocator; 45 }; 46 47 // retrieve buffer allocator paramters 48 void getVtsAllocatorParams(std::vector<uint8_t> *params); 49 50 #endif // VTS_VNDK_HIDL_BUFFERPOOL_V1_0_ALLOCATOR_H 51