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
intin Target frame width in pixelsheight
intin Target frame height in pixels, serving as another criterion for the search.framerate
floatin 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 criteriaReturns -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
intin Target frame width in pixelsheight
intin Target frame height in pixels, serving as another criterion for the search.framerate
doublein 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 criteriaReturns -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
intin Target frame width in pixelsheight
intin Target frame height in pixels, serving as another criterion for the search.framerate
floatin 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 criteriaReturns -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
intin Target frame width in pixelsheight
intin Target frame height in pixels, serving as another criterion for the search.framerate
floatin 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 criteriaReturns -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
hVideoFormatList
ID3_DEVICES_VIDEO_FORMAT_LISTin Handle to the VideoFormatList object.width
intin Target frame width in pixelsheight
intin Target frame height in pixels, serving as another criterion for the search.framerate
floatin 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