1 /* 2 * Copyright (C) 2020 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 ANDROID_SERVERS_CAMERA_FRAMEPRODUCER_H 18 #define ANDROID_SERVERS_CAMERA_FRAMEPRODUCER_H 19 20 #include <utils/RefBase.h> 21 #include <utils/Timers.h> 22 23 #include "camera/CameraMetadata.h" 24 #include "camera/CaptureResult.h" 25 26 namespace android { 27 28 /** 29 * Abstract class for HAL frame producers 30 */ 31 class FrameProducer : public virtual RefBase { 32 public: 33 /** 34 * Retrieve the static characteristics metadata buffer 35 */ 36 virtual const CameraMetadata& info() const = 0; 37 38 /** 39 * Retrieve the device camera ID 40 */ 41 virtual const std::string& getId() const = 0; 42 43 /** 44 * Wait for a new frame to be produced, with timeout in nanoseconds. 45 * Returns TIMED_OUT when no frame produced within the specified duration 46 * May be called concurrently to most methods, except for getNextFrame 47 */ 48 virtual status_t waitForNextFrame(nsecs_t timeout) = 0; 49 50 /** 51 * Get next capture result frame from the result queue. Returns NOT_ENOUGH_DATA 52 * if the queue is empty; caller takes ownership of the metadata buffer inside 53 * the capture result object's metadata field. 54 * May be called concurrently to most methods, except for waitForNextFrame. 55 */ 56 virtual status_t getNextResult(CaptureResult *frame) = 0; 57 58 }; // class FrameProducer 59 60 } // namespace android 61 62 #endif 63