XvQueryEncodings(3)

๐Ÿ“ฆ
version 1.0.13 ยท 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, fedora 43, fedora 44, ubuntu resolute, ubuntu stonking

๐Ÿ’– 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. And XvEncodingInfo has 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 if XvQueryEncodings(3) completed successfully. we love a happy ending. ๐Ÿฅณ
  • [XvBadExtension] โ€” returned if the Xv extension is unavailable. not the extension ghosting you ๐Ÿ˜ญ
  • [XvBadAlloc] โ€” returned if XvQueryEncodings(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