al_get_video_frame man page

al_get_video_frame — Allegro 5 API


#include <allegro5/allegro_video.h>

ALLEGRO_BITMAP *al_get_video_frame(ALLEGRO_VIDEO *video)


Returns the current video frame. The bitmap is owned by the video so do not attempt to free it. The bitmap will stay valid until the next call to al_get_video_frame.

Videos often do not use square pixels so the recommended way to draw a video frame would be using code like this:

float scale = 1.0; /* Adjust this to fit your target bitmap dimensions. */
ALLEGRO_BITMAP* frame = al_get_video_frame(video);
float sw = al_get_bitmap_width(frame);
float sh = al_get_bitmap_height(frame);
float dw = scale * al_get_video_scaled_width(video);
float dh = scale * al_get_video_scaled_height(video);
al_draw_scaled_bitmap(frame, 0, 0, sw, sh, 0, 0, dw, dh, 0);



See Also

al_get_video_scaled_width(3), al_get_video_scaled_height(3)

Referenced By

al_get_video_scaled_height(3), al_get_video_scaled_width(3), ALLEGRO_VIDEO_EVENT_TYPE(3).

Explore man page connections for al_get_video_frame(3).