Scroll to navigation

al_get_video_frame(3) al_get_video_frame(3)

NAME

al_get_video_frame - Allegro 5 API

SYNOPSIS

#include <allegro5/allegro_video.h>
ALLEGRO_BITMAP *al_get_video_frame(ALLEGRO_VIDEO *video)
    

DESCRIPTION

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);
    

SINCE

5.1.0

SEE ALSO

al_get_video_scaled_width(3), al_get_video_scaled_height(3)

Allegro reference manual