Unit al5video

Uses
Classes, Interfaces, Objects and Records
Variables

Description

Video playback.

Currently we have an Ogg backend (Theora + Vorbis). See http://xiph.org/ for installation instructions, licensing information and supported video formats..

Overview

Functions and Procedures

function al_init_video_addon: AL_BOOL; CDECL; external ALLEGRO_VIDEO_LIB_NAME;
procedure al_shutdown_video_addon; CDECL; external ALLEGRO_VIDEO_LIB_NAME;
function al_get_allegro_video_version: AL_UINT32; CDECL; external ALLEGRO_VIDEO_LIB_NAME;
function al_open_video (filename: AL_STR): ALLEGRO_VIDEOptr; CDECL; external ALLEGRO_VIDEO_LIB_NAME;
procedure al_close_video (video: ALLEGRO_VIDEOptr); CDECL; external ALLEGRO_VIDEO_LIB_NAME;
procedure al_start_video (video: ALLEGRO_VIDEOptr; mixer: ALLEGRO_MIXERptr); CDECL; external ALLEGRO_VIDEO_LIB_NAME;
procedure al_start_video_with_voice (video: ALLEGRO_VIDEOptr; voice: ALLEGRO_VOICEptr); CDECL; external ALLEGRO_VIDEO_LIB_NAME;
function al_get_video_event_source (video: ALLEGRO_VIDEOptr): ALLEGRO_EVENT_SOURCEptr; CDECL; external ALLEGRO_VIDEO_LIB_NAME;
procedure al_set_video_playing (video: ALLEGRO_VIDEOptr; playing: AL_BOOL); CDECL; external ALLEGRO_VIDEO_LIB_NAME;
function al_is_video_playing (video: ALLEGRO_VIDEOptr): AL_BOOL; CDECL; external ALLEGRO_VIDEO_LIB_NAME;
function al_get_video_audio_rate (video: ALLEGRO_VIDEOptr): AL_DOUBLE; CDECL; external ALLEGRO_VIDEO_LIB_NAME;
function al_get_video_fps (video: ALLEGRO_VIDEOptr): AL_DOUBLE; CDECL; external ALLEGRO_VIDEO_LIB_NAME;
function al_get_video_scaled_width (video: ALLEGRO_VIDEOptr): AL_FLOAT; CDECL; external ALLEGRO_VIDEO_LIB_NAME;
function al_get_video_scaled_height (video: ALLEGRO_VIDEOptr): AL_FLOAT; CDECL; external ALLEGRO_VIDEO_LIB_NAME;
function al_get_video_frame (video: ALLEGRO_VIDEOptr): ALLEGRO_BITMAPptr; CDECL; external ALLEGRO_VIDEO_LIB_NAME;
function al_get_video_position (video: ALLEGRO_VIDEOptr; which: ALLEGRO_VIDEO_POSITION_TYPE): AL_DOUBLE; CDECL; external ALLEGRO_VIDEO_LIB_NAME;
function al_seek_video (video: ALLEGRO_VIDEOptr; pos_in_seconds: AL_DOUBLE): AL_BOOL; CDECL; external ALLEGRO_VIDEO_LIB_NAME;

Types

ALLEGRO_VIDEO_POSITION_TYPE = (...);
ALLEGRO_VIDEOptr = type AL_POINTER;

Constants

ALLEGRO_EVENT_VIDEO_FRAME_SHOW = 550;
ALLEGRO_EVENT_VIDEO_FINISHED = 551;

Description

Functions and Procedures

function al_init_video_addon: AL_BOOL; CDECL; external ALLEGRO_VIDEO_LIB_NAME;

Initializes the video addon.

procedure al_shutdown_video_addon; CDECL; external ALLEGRO_VIDEO_LIB_NAME;

Shuts down the video addon. This is done automatically at program exit, but can be called any time the user wishes as well.

function al_get_allegro_video_version: AL_UINT32; CDECL; external ALLEGRO_VIDEO_LIB_NAME;

Returns the (compiled) version of the addon, in the same format as al_get_allegro_version.

function al_open_video (filename: AL_STR): ALLEGRO_VIDEOptr; CDECL; external ALLEGRO_VIDEO_LIB_NAME;

Reads a video file. This does not start streaming yet but reads the meta info so you can query e.g. the size or audio rate.

See also
al_close_video
Closes the video and frees all allocated resources.
al_start_video
Starts streaming the video from the beginning.
procedure al_close_video (video: ALLEGRO_VIDEOptr); CDECL; external ALLEGRO_VIDEO_LIB_NAME;

Closes the video and frees all allocated resources. The video pointer is invalid after the function returns.

See also
al_open_video
Reads a video file.
procedure al_start_video (video: ALLEGRO_VIDEOptr; mixer: ALLEGRO_MIXERptr); CDECL; external ALLEGRO_VIDEO_LIB_NAME;

Starts streaming the video from the beginning.

See also
al_open_video
Reads a video file.
al_start_video_with_voice
Like al_start_video but audio is routed to the provided voice.
al_get_video_event_source
Gets an event source for the video.
al_set_voice_playing
Changes whether a voice is playing or not.
procedure al_start_video_with_voice (video: ALLEGRO_VIDEOptr; voice: ALLEGRO_VOICEptr); CDECL; external ALLEGRO_VIDEO_LIB_NAME;

Like al_start_video but audio is routed to the provided voice.

function al_get_video_event_source (video: ALLEGRO_VIDEOptr): ALLEGRO_EVENT_SOURCEptr; CDECL; external ALLEGRO_VIDEO_LIB_NAME;

Gets an event source for the video. The possible events are ALLEGRO_EVENT_VIDEO_FRAME_SHOW and ALLEGRO_EVENT_VIDEO_FINISHED.

procedure al_set_video_playing (video: ALLEGRO_VIDEOptr; playing: AL_BOOL); CDECL; external ALLEGRO_VIDEO_LIB_NAME;

Paused or resumes playback.

See also
al_is_video_playing
Returns True if the video is currently playing.
function al_is_video_playing (video: ALLEGRO_VIDEOptr): AL_BOOL; CDECL; external ALLEGRO_VIDEO_LIB_NAME;

Returns True if the video is currently playing.

function al_get_video_audio_rate (video: ALLEGRO_VIDEOptr): AL_DOUBLE; CDECL; external ALLEGRO_VIDEO_LIB_NAME;

Returns the audio rate of the video, in Hz.

function al_get_video_fps (video: ALLEGRO_VIDEOptr): AL_DOUBLE; CDECL; external ALLEGRO_VIDEO_LIB_NAME;

Returns the speed of the video in frames per second. Often this will not be an integer value.

function al_get_video_scaled_width (video: ALLEGRO_VIDEOptr): AL_FLOAT; CDECL; external ALLEGRO_VIDEO_LIB_NAME;

Returns the width with which the video frame should be drawn. Videos often do not use square pixels, so this will may return a value larger than the width of the frame bitmap.

See also
al_get_video_frame
Returns the current video frame.
function al_get_video_scaled_height (video: ALLEGRO_VIDEOptr): AL_FLOAT; CDECL; external ALLEGRO_VIDEO_LIB_NAME;

Returns the height with which the video frame should be drawn. Videos often do not use square pixels, so this will may return a value larger than the height of the frame bitmap.

See also
al_get_video_frame
Returns the current video frame.
function al_get_video_frame (video: ALLEGRO_VIDEOptr): ALLEGRO_BITMAPptr; CDECL; external ALLEGRO_VIDEO_LIB_NAME;

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:

CONST
  Scale: 1.0; { Adjust this to fit your target bitmap dimensions. }
VAR
  Frame: ALLEGRO_BITMAPptr;
  sw, sh, dw, dh: REAL;
BEGIN
  frame = al_get_video_frame (Video);
  sw = al_get_bitmap_width (Frame);
  sh = al_get_bitmap_height (Frame);
  dw = Scale * al_get_video_scaled_width (Video);
  dh = Scale * al_get_video_scaled_height (Video);
  al_draw_scaled_bitmap (Frame, 0, 0, sw, sh, 0, 0, dw, dh, 0);
END;

See also
al_get_video_scaled_width
Returns the width with which the video frame should be drawn.
al_get_video_scaled_height
Returns the height with which the video frame should be drawn.
function al_get_video_position (video: ALLEGRO_VIDEOptr; which: ALLEGRO_VIDEO_POSITION_TYPE): AL_DOUBLE; CDECL; external ALLEGRO_VIDEO_LIB_NAME;

Returns the current position of the video stream in seconds since the beginning. The parameter is one of the ALLEGRO_VIDEO_POSITION_TYPE constants.

function al_seek_video (video: ALLEGRO_VIDEOptr; pos_in_seconds: AL_DOUBLE): AL_BOOL; CDECL; external ALLEGRO_VIDEO_LIB_NAME;

Seeks to a different position in the video. Currently only seeking to the beginning of the video is supported.

Types

ALLEGRO_VIDEO_POSITION_TYPE = (...);

Used with al_get_video_position to specify which position to retrieve. If these get out of sync, audio and video may be out of sync in the display of the video.

Values
  • ALLEGRO_VIDEO_POSITION_ACTUAL = 0: The amount of time the video has been playing. If the video has audio then this value can be ahead of ALLEGRO_VIDEO_POSITION_VIDEO_DECODE when video decoding lags.
  • ALLEGRO_VIDEO_POSITION_VIDEO_DECODE = 1: The amount of video that has been decoded. This may lag behind the "actual" and audio positions if decoding is slower than realtime.
  • ALLEGRO_VIDEO_POSITION_AUDIO_DECODE = 2: 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 is common to keep audio and video in sync.
ALLEGRO_VIDEOptr = type AL_POINTER;

Pointer to the video description.

Constants

ALLEGRO_EVENT_VIDEO_FRAME_SHOW = 550;

This event is sent when it is time to show a new frame. Once you receive this event, you can draw the current frame (as returned by al_get_video_frame). al_get_video_frame will continue returning the same frame until the next ALLEGRO_EVENT_VIDEO_FRAME_SHOW is sent.

user.data1 will contain a pointer to the video which generated the event.

ALLEGRO_EVENT_VIDEO_FINISHED = 551;

This event is sent when the video is finished. Depending on the backend, it may be possible to seek to an earlier part of the video and set the video to play to resume playback.

user.data1 will contain a pointer to the video which generated the event.


Generated by PasDoc 0.15.0. Generated on 2024-11-10 15:15:06.