XvQueryEncodings(3)
๐ XvQueryEncodings โ bestie, let's go get the encoding list ๐
okay so picture this: you're deep in libXv (that's the X Video extension library, the one that lives in X11/extensions/Xvlib.h), and you need to know every encoding an adaptor supports. That's literally what XvQueryEncodings(3) does. She's a libXv function, she's a queen, and she's about to hand you the whole list. ๐
โจ SYNOPSIS โจ
#include <X11/extensions/Xvlib.h>
int XvQueryEncodings(Display *dpy, XvPortID port,
unsigned int *p_num_encodings,
XvEncodingInfo **pp_encoding_info);
๐ธ ARGUMENTS ๐ธ
dpyโ the connection to the X server. Your lil lifeline to the server, bestie. ๐ซถportโ the port whose adaptor we're interrogating about its list of encodings.p_num_encodingsโ a pointer to where the number of encodings supported by the adaptor gets written. So after this call, that's your count. ๐pp_encoding_infoโ a pointer to where the list of returned encoding information is returned. AndXvEncodingInfohas this exact structure:
typedef struct {
XvEncodingID encoding_id;
char *name;
unsigned long width;
unsigned long height;
XvRational rate;
unsigned long num_encodings;
} XvEncodingInfo;
Let's break down those fields, no gatekeeping:
encoding_idโ the encoding-id of the encoding. This is the ID you use to identify an encoding when you change a port's encoding attribute. So like, remember it. ๐nameโ a pointer to a formatted string that identifies the encoding. The string has the format"timing-signaltype". For example"ntsc-composite". Cute, right? ๐width,heightโ the width and height, in pixels, of the decoded video image.rateโ the field rate of the decoded video.
And speaking of rate โ the XvRational structure is what specifies a fractional number. It looks like this:
typedef struct {
int numerator;
int denominator;
} XvRational;
The numerator and denominator fields specify the appropriate parts of a fractional number. Math but make it slay. ๐งฎโจ
๐ DESCRIPTION ๐
XvQueryEncodings(3) returns encoding information about an adaptor. Each encoding is described by the XvEncodingInfo structure we just went over up there. The encodings are identified by an encoding-id, which you can use to set or get the encoding attribute of a port. So basically: ask once, get the whole menu, then reference stuff by ID forever. main character behavior fr fr. ๐
๐ RETURN VALUES ๐
[Success]โ returned ifXvQueryEncodings(3)completed successfully. we love a happy ending. ๐ฅณ[XvBadExtension]โ returned if the Xv extension is unavailable. not the extension ghosting you ๐ญ[XvBadAlloc]โ returned ifXvQueryEncodings(3)failed to allocate memory to process the request. rip, the memory said no. ๐
๐จ DIAGNOSTICS ๐จ
[XvBadPort]โ generated if the requested port does not exist. bestie. that port is not real. check your port ID. ๐
๐ SEE ALSO ๐
lowkey important: there's a whole other function for freeing this encoding info, so don't just vibe and forget about it. iykyk. ๐ฆ
and that's the whole page, bestie!! this was XvQueryEncodings(3) from the libXv Functions crew โ X Version 11, libXv 1.0.13. go query some encodings, hydrate, and free your encoding info afterwards. periodt. ๐
๐โจ
๐ฆ 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