1 /* 2 * Copyright (C) 2019 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 HARDWARE_GOOGLE_CAMERA_HAL_UTILS_HAL_BUFFER_ALLOCATOR_H 18 #define HARDWARE_GOOGLE_CAMERA_HAL_UTILS_HAL_BUFFER_ALLOCATOR_H 19 20 #include "hal_types.h" 21 22 #include <utils/Errors.h> 23 #include <vector> 24 25 namespace android { 26 namespace google_camera_hal { 27 28 // IHalBufferAllocator defines an interface for HAL to allocate HW accessible 29 // buffers 30 class IHalBufferAllocator { 31 public: ~IHalBufferAllocator()32 virtual ~IHalBufferAllocator(){}; 33 34 // Allocate buffers and return buffer via buffers. 35 // The buffers is owned by caller 36 virtual status_t AllocateBuffers(const HalBufferDescriptor& buffer_descriptor, 37 std::vector<buffer_handle_t>* buffers) = 0; 38 39 // free the list of buffers 40 virtual void FreeBuffers(std::vector<buffer_handle_t>* buffers) = 0; 41 }; 42 43 } // namespace google_camera_hal 44 } // namespace android 45 46 #endif // HARDWARE_GOOGLE_CAMERA_HAL_UTILS_HAL_BUFFER_ALLOCATOR_H 47