Return list of image formats supported by a video port
#include <X11/extensions/Xvlib.h>
XvImageFormatValues * XvListImageFormats (Display *dpy, XvPortID port, int *p_num_formats);
Specifies the connection to the X server.
Specifies the port whose adaptor is to be queried for its list of attributes.
A pointer to where the number of formats returned in the array is written.
XvListImageFormats(3) returns the XvImageFormatValues supported by the specified port. This list should be freed with XFree(3).
XvImageFormatValues has the following structure:
typedef struct { int id; /* Unique descriptor for the format */ int type; /* XvRGB, XvYUV */ int byte_order; /* LSBFirst, MSBFirst */ char guid[16]; /* Globally Unique IDentifier */ int bits_per_pixel; int format; /* XvPacked, XvPlanar */ int num_planes; /* for RGB formats */ int depth; unsigned int red_mask; unsigned int green_mask; unsigned int blue_mask; /* for YUV formats */ unsigned int y_sample_bits; unsigned int u_sample_bits; unsigned int v_sample_bits; unsigned int horz_y_period; unsigned int horz_u_period; unsigned int horz_v_period; unsigned int vert_y_period; unsigned int vert_u_period; unsigned int vert_v_period; char component_order[32]; /* eg. UYVY */ int scanline_order; /* XvTopToBottom, XvBottomToTop */ } XvImageFormatValues;
A unique descriptor for the format. This is often the FOURCC for the format, when applicable. This id is used to describe the format during XvImage creation.
XvRGB or XvYUV.
The byte order of the image. It is either LSBFirst or MSBFirst.
The Globally Unique IDentifier (also known as Universally Unique IDentifier). When not applicable, all characters are NULL.
The bits taken up (but not necessarily used) by each pixel. Note that for some planar formats which have fractional bits per pixel (such as IF09) this number may be rounded _down_.
XvPacked or XvPlanar.
The number of planes in planar formats.
Significant bits per pixel.
The red, green and blue bitmasks (RGB formats only).
The size of each sample in bits (YUV formats only).
The period (in pixels) on which samples occur in the horizontal and vertical directions (YUV formats only).
Upper case ascii characters representing the order that samples are stored within packed formats. For planar formats this represents the ordering of the planes.
XvTopToBottom or XvBottomToTop.
Since some formats (particularly some planar YUV formats) may not be completely defined by the parameters above, the guid, when available, should provide the most accurate description of the format.
Generated if the requested port does not exist.
XvCreateImage(3), XvCreateShmImage(3)