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.

find_nearest_video_format(self, width: int, height: int, framerate: float) -> int

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 float
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.
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.
public int FindNearestVideoFormat(int width, int height, float 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 float
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.
public int findNearestVideoFormat(int width, int height, float framerate) throws DevicesException

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 float
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.
int id3DevicesVideoFormatList_FindNearestVideoFormat (
    ID3_DEVICES_VIDEO_FORMAT_LIST hVideoFormatList,
    int width,
    int height,
    float framerate,
    int * index)

Parameters

in Handle to the VideoFormatList object.

width int
in Target frame width in pixels

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

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

index int *
out Outputs the index of the video format in the list that is closest to the specified criteria

Returns

int
An error code.
See id3DevicesError file for the list of possible error codes.