SDL_Overlay(3)

✨ SDL_Overlay ✨

okay bestie, welcome to the YUV video overlay page πŸ’– this is from the SDL API Reference and it's lowkey iconic.


πŸŽ€ NAME πŸŽ€

SDL_Overlay β€” YUV video overlay. that's it, that's the whole vibe πŸ¦‹


🧚 STRUCTURE DEFINITION 🧚

here's the whole struct, no cap, every field exactly as it is:

typedef struct{
  Uint32 format;
  int w, h;
  int planes;
  Uint16 *pitches;
  Uint8 **pixels;
  Uint32 hw_overlay:1;
} SDL_Overlay;

🌸 STRUCTURE DATA 🌸

  • format β€” the overlay format, and there's a whole list of those down below πŸ‘‡
  • w, h β€” width and height of the overlay, obviously πŸ’…
  • planes β€” how many planes are in the overlay. usually it's either 1 or 3, no in-between energy
  • pitches β€” an array of pitches, one for each plane. a pitch is the length of a row, in bytes πŸ“
  • pixels β€” an array of pointers to the data of each plane. bestie, listen: the overlay should be locked before you touch these pointers, fr fr πŸ”’
  • hw_overlay β€” this gets set to 1 if the overlay is hardware accelerated ⚑ main character energy

πŸ’œ DESCRIPTION πŸ’œ

so a SDL_Overlay is basically a SDL_Surface's cousin, except instead of regular pixel data it stores a YUV overlay. same family, different vibe 🫢

every single field is read only β€” all of them β€” except pixels, which you gotta lock before you use it. the format field stores the format of the overlay, and it's one of these:

#define SDL_YV12_OVERLAY  0x32315659  /* Planar mode: Y + V + U */
#define SDL_IYUV_OVERLAY  0x56555949  /* Planar mode: Y + U + V */
#define SDL_YUY2_OVERLAY  0x32595559  /* Packed mode: Y0+U0+Y1+V0 */
#define SDL_UYVY_OVERLAY  0x59565955  /* Packed mode: U0+Y0+V0+Y1 */
#define SDL_YVYU_OVERLAY  0x55595659  /* Packed mode: Y0+V0+Y1+U0 */

if you want more info on YUV formats (and honestly, who doesn't), it's at http://www.webartz.com/fourcc/indexyuv.htm (link to URL http://www.webartz.com/fourcc/indexyuv.htm) 🌈


πŸ”₯ SEE ALSO πŸ”₯

  • SDL_CreateYUVOverlay
  • SDL_LockYUVOverlay
  • SDL_UnlockYUVOverlay
  • SDL_FreeYUVOverlay

and that's the page!! mwah πŸ’‹ this was SDL, from the SDL API Reference, dated Tue 11 Sep 2001, 23:01 β€” yeah she's vintage but she ate and left no crumbs πŸ‘‘βœ¨ go lock your overlays bestie, ily πŸ“

πŸ“¦ where this page comes from