Updated: October 28, 2024 |
Enable the viewfinder event
#include <camera/camera_api.h>
camera_error_t camera_enable_viewfinder_event(camera_handle_t handle, camera_eventmode_t eventmode, camera_eventkey_t *key, struct sigevent *event)
Use this function to enable the viewfinder event. The viewfinder event is delivered when a viewfinder frame is available. You can then retrieve the viewfinder frame using camera_get_viewfinder_buffers(). This is the same image data that is delivered to your viewfinder_callback function registered when you started the viewfinder using camera_start_viewfinder().
Call camera_enable_viewfinder_event() when you are using the Camera API in event mode. For more information, see Using event mode.
Use camera_disable_event() to disable this event when you no longer require viewfinder events to be delivered.
The viewfinder is automatically rendered to a display by the OS. It is not required to provide display code unless custom output is required using some other mechanism such as OpenGL.
There is a limit in the number of viewfinder events that can be registered for a given handle. If this limit is exceeded, the function will fail and return CAMERA_ENOMEM. Note as well that there is a limit of only one viewfinder event of CAMERA_EVENTMODE_READWRITE per given logical camera unit.
CAMERA_EOK when the function successfully completes, otherwise another camera_error_t value that provides the reason that the call failed.