NAME
al_open_video_f - Allegro 5 API
SYNOPSIS
-
#include <allegro5/allegro_video.h> ALLEGRO_VIDEO* al_open_video_f(ALLEGRO_FILE *fp, const char *ident)
DESCRIPTION
Opens a video file from an existing ALLEGRO_FILE* using the Allegro file interface system. This allows videos to be loaded from custom sources such as memory streams, virtual file systems, archives, or any other source supported by a custom ALLEGRO_FILE_INTERFACE.
Parameters:
- •
-
file: A pointer to anALLEGRO_FILEobject. Ownership of this file is transferred to the video object; the file will be closed automatically whenal_close_videois called.
Returns: A pointer to a new ALLEGRO_VIDEO object if successful, or NULL on failure.
Remarks:
- •
-
The function does not require the file to be seeked or rewound; it reads from the current position.
- •
-
After calling
al_open_video_f, you must not manually close theALLEGRO_FILE; callal_close_videoto free all associated resources.
- •
-
This function mirrors the behavior of other
_fvariants in the Allegro API, enabling video streaming from custom file systems.
Example:
-
ALLEGRO_FILE *f = al_fopen("video.ogv", "rb"); if (f) { ALLEGRO_VIDEO *vid = al_open_video_f(f); if (vid) { float fps = al_get_video_fps(vid); // ... use the video ... al_close_video(vid); // also closes f } }
SEE ALSO
SINCE
5.2.11