1 /* 2 * Copyright 2021 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 package androidx.camera.extensions.impl.advanced; 18 19 import android.annotation.SuppressLint; 20 21 /** 22 * A interface to receive and process the upcoming next available Image. 23 * 24 * <p>Implemented by OEM. 25 */ 26 @SuppressLint("UnknownNullness") 27 public interface ImageProcessorImpl { 28 /** 29 * The reference count will be decremented when this method returns. If an extension wants 30 * to hold onto the image it should increment the reference count in this method and 31 * decrement it when the image is no longer needed. 32 * 33 * <p>If OEM is not closing(decrement) the image fast enough, the imageReference passed 34 * in this method might contain null image meaning that the Image was closed to prevent 35 * preview from stalling. 36 * 37 * @param outputConfigId the id of {@link Camera2OutputConfigImpl} which identifies 38 * corresponding Surface 39 * @param timestampNs the timestamp in nanoseconds associated with this image 40 * @param imageReference A reference to the {@link android.media.Image} which might contain 41 * null if OEM close(decrement) the image too slowly 42 * @param physicalCameraId used to distinguish which physical camera id the image comes from 43 * when the output configuration is 44 * MultiResolutionImageReaderOutputConfigImpl. It is also set if 45 * physicalCameraId is set in other Camera2OutputConfigImpl types. 46 * 47 */ onNextImageAvailable( int outputConfigId, long timestampNs, ImageReferenceImpl imageReference, String physicalCameraId )48 void onNextImageAvailable( 49 int outputConfigId, 50 long timestampNs, 51 ImageReferenceImpl imageReference, 52 String physicalCameraId 53 ); 54 } 55