camera_start_viewfinder()

Updated: April 19, 2023

Start the viewfinder on the camera

Synopsis:

#include <camera/camera_api.h>
camera_error_t camera_start_viewfinder(camera_handle_t handle,
                                       void(*viewfinder_callback)
                                               (camera_handle_t, camera_buffer_t *, void *),
                                       void(*status_callback)
                                    (camera_handle_t, camera_devstatus_t, uint16_t, void *),
                                       void *arg)

Arguments:

handle
The handle returned by a call to the camera_open() function.
viewfinder_callback
A pointer to a function with the following signature:
 void function_name( camera_handle_t,
                     camera_buffer_t*,
                     void* );
The function is a callback that is invoked when an image buffer becomes available. Set this argument to NULL if no function needs to be called. For information about the callback arguments, see Using callback mode.
status_callback
A pointer to a function with the following signature:
 void function_name( camera_handle_t,
                     camera_devstatus_t,
                     uint16_t,
                     void* );
The function is a callback that is invoked when status events occur. Set this argument to NULL if no function needs to be called. For information about the callback arguments, see Using callback mode.
arg
The argument passed to all callback functions, which is the last argument.

Library:

libcamapi

Description:

Use this function to start the viewfinder on the camera. Only call this function if the viewfinder mode has been set to a value other than CAMERA_VFMODE_DEFAULT using camera_set_vf_mode().

Before calling this function, ensure that you:

When the viewfinder is running, you can adjust zoom levels and other camera operations. In addition, you can reposition or resize the viewfinder window using the Screen API. In order to retrieve a window handle to the viewfinder window that is created, you must listen for the appropriate SCREEN_EVENT_CREATE event using the Screen API. For more information, see “Screen library reference” in the Screen Developer's Guide.

Returns:

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