ALLEGRO_VIDEO_POSITION_TYPE(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– ALLEGRO_VIDEO_POSITION_TYPE πŸ’–

okay bestie, this is a page straight out of the Allegro 5 API reference manual (that's the 3alleg5 bit in the title, iykyk) and it's honestly a lil niche but so important. it's a typedef enum, it's tiny, it's iconic, and if you get it wrong your video's audio and video start beefing with each other. let's get into it. ✨


✨ SYNOPSIS ✨

#include <allegro5/allegro_video.h>

typedef enum ALLEGRO_VIDEO_POSITION_TYPE ALLEGRO_VIDEO_POSITION_TYPE;

🌸 DESCRIPTION 🌸

so the whole point of this enum is: you pass it to al_get_video_position(3alleg5) to tell Allegro which position you want it to hand back. that's it, that's the job. 🫢

⚠️ but listen β€” if these positions get out of sync with each other, the audio and the video may end up out of sync when the video is displayed. no cap, it's giving chaos.

here are the three flavours, and yes, each one is a whole different vibe:

  • ALLEGRO_VIDEO_POSITION_ACTUAL β€” the amount of time the video has been playing. that's the real-time-ish one. πŸ’… but heads up: if the video has audio, this value can be ahead of ALLEGRO_VIDEO_POSITION_VIDEO_DECODE when video decoding lags. so she's ambitious, okay?
  • ALLEGRO_VIDEO_POSITION_VIDEO_DECODE β€” the amount of video that has actually been decoded. this may lag behind the "actual" position and the audio position if decoding is slower than realtime. she's doing her best, the decode queue is just long. 😭
  • ALLEGRO_VIDEO_POSITION_AUDIO_DECODE β€” the amount of audio that has been decoded. this may be the same as ALLEGRO_VIDEO_POSITION_ACTUAL if audio decode is driving the position β€” which, fun fact, is a super common way to keep audio and video in sync. main character energy fr fr. πŸ”₯

πŸŽ€ SINCE πŸŽ€

5.1.11 β€” so this has been serving since 5.1.11, periodt. πŸ‘‘


and that's the whole page, bestie! this little legend came to you from the Allegro reference manual, titled ALLEGRO_VIDEO_POSITION_TYPE(3alleg5) β€” and yeah, there's no date stamped on it, so we're just gonna assume she's timeless. πŸŒˆπŸ’œ go keep your audio and video in sync, you got this. πŸ¦‹βœ¨

πŸ“¦ where this page comes from