XvListImageFormats(3)
โจ XvListImageFormats โจ
okay bestie, welcome to XvListImageFormats โ a lil function from the libXv crew (that's part of X Version 11, we're fancy here ๐
). She's a libXv Function and she's about to spill the whole tea on what image formats a video port can handle. no cap.
๐ธ NAME ๐ธ
XvListImageFormats โ gimme the list of image formats that a video port supports, bestie ๐โจ
๐ SYNTAX ๐
#include <X11/extensions/Xvlib.h>
XvImageFormatValues * XvListImageFormats (Display *dpy,
XvPortID port, int *p_num_formats);
like, that's the whole incantation. copy it exactly, don't freestyle it ๐
๐ฆ ARGUMENTS ๐ฆ
dpyโ the connection to the X server. your whole vibe link to the server, basically ๐portโ the port whose adaptor we're gonna interrogate about its list of attributes. we're asking this one specifically, main character energy ๐p_num_formatsโ a pointer to where the number of formats returned in the array gets written. so she hands you the array, and she writes the count over here so you know how many you got ๐งฎ
๐ DESCRIPTION ๐
XvListImageFormats(3) returns the XvImageFormatValues that the specified port supports. that's it, that's the whole job. she ate and left no crumbs ๐ฅ
โ ๏ธ important bestie: this list needs to be freed with XFree(3). she's handing you malloc'd memory, so you gotta let her go. don't just leave her hanging ๐ญ
๐ RETURN VALUES ๐
XvImageFormatValues has the following structure, and it's literally giving struct realness:
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;
and now, field by field, because every single one matters ๐ซถ
idโ a unique descriptor for the format. it's often the FOURCC for the format, when that applies. this id is what describes the format when you're doingXvImagecreation. it's her government name fr fr ๐ชชtypeโXvRGBorXvYUV. pick your fighter ๐byte_orderโ the byte order of the image. eitherLSBFirstorMSBFirst. which way do the bytes go, bestie? ๐คguidโ the Globally Unique IDentifier (aka the Universally Unique IDentifier, same thing, different wig). when it's not applicable, all the characters are NULL. so like, empty. nothing. void. ๐bits_per_pixelโ the bits taken up (but not necessarily used) by each pixel. and heads up: for some planar formats with fractional bits per pixel (likeIF09) this number may be rounded _down_. rounded down!! keep that in your notes ๐formatโXvPackedorXvPlanarโจnum_planesโ the number of planes in planar formats. planes on planes on planes โ๏ธdepthโ significant bits per pixel ๐งred_mask,green_mask,blue_maskโ the red, green and blue bitmasks. RGB formats only, so if you're on YUV this part is not for you ๐ซ?_sample_bitsโ the size of each sample in bits. YUV formats only ๐horz_?_period,vert_?_periodโ the period (in pixels) on which samples occur in the horizontal and vertical directions. YUV formats only ๐component_orderโ upper case ascii characters representing the order that samples are stored within packed formats. for planar formats, this represents the ordering of the planes. so like,UYVYvibes ๐คscanline_orderโXvTopToBottomorXvBottomToTop. which way do we scroll? โฌ๏ธโฌ๏ธ
โญ NOTES โญ
since some formats (particularly some planar YUV formats) may not be completely defined by the parameters above, the guid โ when it's available โ should give you the most accurate description of the format. so when in doubt, trust the guid, she knows ๐
๐จ DIAGNOSTICS ๐จ
[XvBadPort]โ generated if the requested port does not exist. you asked for a port that isn't real, bestie, and the server said no ๐
๐ SEE ALSO ๐
XvCreateImage(3)XvCreateShmImage(3)
go read those next, iykyk ๐โจ
k bye ily, that's the whole page ๐ โ this was libXv 1.0.13 from X Version 11, dated whenever this got shipped, and you just read XvListImageFormats(3). slay, go free that array with XFree(3) ๐๐ฆ
๐ฆ where this page comes from
- alpine 3.22: libxv-doc 1.0.13-r0 ยท MIT
- alpine 3.23: libxv-doc 1.0.13-r0 ยท MIT
- alpine 3.24: libxv-doc 1.0.13-r0 ยท MIT
- arch rolling: libxv 1.0.13-1 ยท SMLNJ AND HPND-sell-variant
- fedora 43: libXv-devel 1.0.13-3.fc43 ยท SMLNJ AND HPND-sell-variant
- fedora 43: libXv-devel 1.0.13-3.fc43 ยท SMLNJ AND HPND-sell-variant
- fedora 44: libXv-devel 1.0.13-4.fc44 ยท SMLNJ AND HPND-sell-variant
- fedora 44: libXv-devel 1.0.13-4.fc44 ยท SMLNJ AND HPND-sell-variant
- ubuntu resolute: libxv-dev 2:1.0.13-1 ยท MIT
- ubuntu stonking: libxv-dev 2:1.0.13-1 ยท MIT
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms