summaryrefslogtreecommitdiff
path: root/camera2/extensions/advancedSample/src/java/androidx/camera/extensions/impl/CaptureProcessorImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'camera2/extensions/advancedSample/src/java/androidx/camera/extensions/impl/CaptureProcessorImpl.java')
-rw-r--r--camera2/extensions/advancedSample/src/java/androidx/camera/extensions/impl/CaptureProcessorImpl.java50
1 files changed, 50 insertions, 0 deletions
diff --git a/camera2/extensions/advancedSample/src/java/androidx/camera/extensions/impl/CaptureProcessorImpl.java b/camera2/extensions/advancedSample/src/java/androidx/camera/extensions/impl/CaptureProcessorImpl.java
index 3eee146a..f4719b8b 100644
--- a/camera2/extensions/advancedSample/src/java/androidx/camera/extensions/impl/CaptureProcessorImpl.java
+++ b/camera2/extensions/advancedSample/src/java/androidx/camera/extensions/impl/CaptureProcessorImpl.java
@@ -21,6 +21,7 @@ import android.graphics.ImageFormat;
import android.hardware.camera2.TotalCaptureResult;
import android.media.Image;
import android.util.Pair;
+import android.util.Size;
import android.view.Surface;
import java.util.Map;
@@ -46,6 +47,29 @@ public interface CaptureProcessorImpl extends ProcessorImpl {
void process(Map<Integer, Pair<Image, TotalCaptureResult>> results);
/**
+ * Informs the CaptureProcessorImpl where it should write the postview output to.
+ * This will only be invoked once if a valid postview surface was set.
+ *
+ * @param surface A valid {@link ImageFormat#YUV_420_888} {@link Surface}
+ * that the CaptureProcessorImpl should write data into.
+ * @since 1.4
+ */
+ void onPostviewOutputSurface(Surface surface);
+
+ /**
+ * Invoked when the Camera Framework changes the configured output resolution for
+ * still capture and postview.
+ *
+ * <p>After this call, {@link CaptureProcessorImpl} should expect any {@link Image} received as
+ * input for still capture and postview to be at the specified resolutions.
+ *
+ * @param size for the surface for still capture.
+ * @param postviewSize for the surface for postview.
+ * @since 1.4
+ */
+ void onResolutionUpdate(Size size, Size postviewSize);
+
+ /**
* Process a set images captured that were requested.
*
* <p> The result of the processing step should be written to the {@link Surface} that was
@@ -63,4 +87,30 @@ public interface CaptureProcessorImpl extends ProcessorImpl {
*/
void process(Map<Integer, Pair<Image, TotalCaptureResult>> results,
ProcessResultImpl resultCallback, Executor executor);
+
+ /**
+ * Process a set images captured that were requested for both postview and
+ * still capture.
+ *
+ * <p> This processing method will be called if a postview was requested, therefore the
+ * processed postview should be written to the
+ * {@link Surface} received by {@link #onPostviewOutputSurface(Surface, int)}.
+ * The final result of the processing step should be written to the {@link Surface} that was
+ * received by {@link #onOutputSurface(Surface, int)}. Since postview should be available
+ * before the capture, it should be processed and written to the surface before
+ * the final capture is processed.
+ *
+ * @param results The map of {@link ImageFormat#YUV_420_888} format images and
+ * metadata to process. The {@link Image} that are contained within
+ * the map will become invalid after this method completes, so no
+ * references to them should be kept.
+ * @param resultCallback Capture result callback to be called once the capture result
+ * values of the processed image are ready.
+ * @param executor The executor to run the callback on. If null then the callback
+ * will run on any arbitrary executor.
+ * @throws RuntimeException if postview feature is not supported
+ * @since 1.4
+ */
+ void processWithPostview(Map<Integer, Pair<Image, TotalCaptureResult>> results,
+ ProcessResultImpl resultCallback, Executor executor);
}