VideoFormatList.findNearestVideoFormat Method

Module: VideoFormatList

Definition

Searches the list to identify the video format that most closely matches the specified width, height, and frame rate criteria

This function is essential for applications needing to adapt to or choose from a device’s supported video formats without exact matches.

int findNearestVideoFormat(int width, int height, double framerate)

Parameters

width int
in Target frame width in pixels

height int
in Target frame height in pixels, serving as another criterion for the search.

framerate double
in Desired frame rate in frames per second (fps)

Returns

int
Outputs the index of the video format in the list that is closest to the specified criteria
Returns -1 if no suitable format is found, indicating that no available formats closely match the specified parameters.

Exceptions

An error has occurred during Devices Library execution.