get_preview_frame_func_t

Updated: April 19, 2023

Retrieve the next available preview frame

Synopsis:

#include <camera/external_camera_api.h>
typedef int(* get_preview_frame_func_t)(void *handle,
            void *bufferIn,
            camera_preview_frame_flags_t *flags,
            void **bufferOut,
            int64_t *timestamp,
            void *metaOut,
            uint64_t *metaSize);

Arguments:

handle
The handle that's returned from calling the function open_external_camera_func_t.
bufferIn
An empty buffer to provide to the camera to be filled now or in the future.
flags
The returned flags. See camera_preview_frame_flags_t for information.
bufferOut
If a filled buffer is available, this is set to point to the newly acquired preview image data.
timestamp
The returned timestamp, which indicates the capture time of the preview frame, in microseconds. The clock used to generate the timestamp is in the camera time domain. See get_time_func_t for more information.
metaOut
The metadata associated with this preview frame.
metaSize
A pointer to a value that serves as both an input and an output of this function. On input, it is set to the space available in the metaOut buffer, in bytes. On output, the value written by this function indicates how many bytes were actually populated with metadata.

Library:

libcamapi

Description:

This is the main interface between the preview thread and the camera. The Sensor service runs the preview thread that repeatedly calls this function to retrieve the next available frame from the camera. This operation both enqueues empty buffers for use by the camera (i.e., to pipeline) and expects to receive filled buffers from the camera. If the camera's hardware requires pipelining, this function doesn't return any new frames until enough empty buffers have been supplied.

Note:

This function call is blocking when the camera is fully pipelined.

Returns:

CAMERA_EOK when the function successfully completes, otherwise another camera_error_t value that provides the reason that the call failed.