Tscope5
video.c File Reference

Definitions of video functions. More...

Go to the source code of this file.

Functions

Loading videos

Videos can be read from a file using the functions below.

TS5_VIDEO * ts5_read_video (const char *file)
 Open a video from a file. More...
 
void ts5_free_video (TS5_VIDEO *video)
 Free the memory used by a video. More...
 
Playing videos

Videos can be played using the functions below.

The audio part is played in the background automatically so the user doesn't need to do anything special do make the audio audible.

The video is not displayed automatically but is provided frame by frame as a TS5_BITMAP.

The user will need to draw each frame on the screen using the bitmap drawing functions to make the video visible.

see video01.c for an example that shows how this works.

void ts5_play_video (TS5_VIDEO *video)
 Start playing a video. More...
 
void ts5_pause_video (TS5_VIDEO *video)
 Pause playing a video. More...
 
void ts5_stop_video (TS5_VIDEO *video)
 Stop playing a video. More...
 
TS5_BITMAP * ts5_get_video_frame (TS5_VIDEO *video)
 Get the next frame of a video. More...
 
Video parameters

For each video the parameters can be queried/set using the functions below:

Video position and video gain can be adjusted at any time, even when the video is playing.

There is no function available to query the length of a video.

int ts5_get_video_status (TS5_VIDEO *video)
 Query whether a video is playing. More...
 
double ts5_get_video_aspect_ratio (TS5_VIDEO *video)
 Get the aspect ratio of a video. More...
 
double ts5_get_video_width (TS5_VIDEO *video)
 Get the width of a video. More...
 
double ts5_get_video_height (TS5_VIDEO *video)
 Get the height of a video. More...
 
double ts5_get_video_samplerate (TS5_VIDEO *video)
 Get the audio samplerate of a video. More...
 
double ts5_get_video_framerate (TS5_VIDEO *video)
 Get the framerate of a video. More...
 
double ts5_set_video_position (TS5_VIDEO *video, double position)
 Set the playback position of a video. More...
 
double ts5_get_video_position (TS5_VIDEO *video)
 Get the playback position of a video. More...
 
double ts5_set_video_gain (TS5_VIDEO *video, double gain)
 Set the playback gain of a video. More...
 
double ts5_get_video_gain (TS5_VIDEO *video)
 Get the playback gain of a video. More...
 

Detailed Description

Definitions of video functions.

Definition in file video.c.

Function Documentation

TS5_VIDEO* ts5_read_video ( const char *  file)

Open a video from a file.

Parameters
filePath to the video file.
Returns
A pointer to the newly created video.

Available video types are: ogv.

Examples:
video01.c.

Definition at line 37 of file video.c.

void ts5_free_video ( TS5_VIDEO *  video)

Free the memory used by a video.

Parameters
videoPointer to the video that will be freed.

This function should be called at the end of the program for each video allocated or read by the user.

Examples:
video01.c.

Definition at line 112 of file video.c.

void ts5_play_video ( TS5_VIDEO *  video)

Start playing a video.

Parameters
videoPointer to the video that will be played.
Examples:
video01.c.

Definition at line 164 of file video.c.

void ts5_pause_video ( TS5_VIDEO *  video)

Pause playing a video.

Parameters
videoPointer to the video that will be paused.

Definition at line 197 of file video.c.

void ts5_stop_video ( TS5_VIDEO *  video)

Stop playing a video.

Parameters
videoPointer to the video that will be stopped.

Definition at line 226 of file video.c.

TS5_BITMAP* ts5_get_video_frame ( TS5_VIDEO *  video)

Get the next frame of a video.

Parameters
videoPointer to the video that will be queried.
Examples:
video01.c.

Definition at line 256 of file video.c.

int ts5_get_video_status ( TS5_VIDEO *  video)

Query whether a video is playing.

Parameters
videoPointer to the video that will queried.
Returns
1 if the video is playing, 0 if not.

Definition at line 308 of file video.c.

double ts5_get_video_aspect_ratio ( TS5_VIDEO *  video)

Get the aspect ratio of a video.

Parameters
videoPointer to the video that will queried.
Returns
aspect ratio of the video.
Examples:
video01.c.

Definition at line 328 of file video.c.

double ts5_get_video_width ( TS5_VIDEO *  video)

Get the width of a video.

Parameters
videoPointer to the video that will queried.
Returns
width of the video in pixels.
Examples:
video01.c.

Definition at line 358 of file video.c.

double ts5_get_video_height ( TS5_VIDEO *  video)

Get the height of a video.

Parameters
videoPointer to the video that will queried.
Returns
height of the video in pixels.
Examples:
video01.c.

Definition at line 388 of file video.c.

double ts5_get_video_samplerate ( TS5_VIDEO *  video)

Get the audio samplerate of a video.

Parameters
videoPointer to the video that will queried.
Returns
audio samplerate of the video.
Examples:
video01.c.

Definition at line 419 of file video.c.

double ts5_get_video_framerate ( TS5_VIDEO *  video)

Get the framerate of a video.

Parameters
videoPointer to the video that will queried.
Returns
frame rate of the video.
Examples:
video01.c.

Definition at line 439 of file video.c.

double ts5_set_video_position ( TS5_VIDEO *  video,
double  position 
)

Set the playback position of a video.

Parameters
videoPointer to the video that will be adjusted.
positionThe new playback position.
Returns
the old playback position of the video in seconds.

Definition at line 460 of file video.c.

double ts5_get_video_position ( TS5_VIDEO *  video)

Get the playback position of a video.

Parameters
videoPointer to the video that will be queried.
Returns
the current playback position of the video in seconds.

Definition at line 484 of file video.c.

double ts5_set_video_gain ( TS5_VIDEO *  video,
double  gain 
)

Set the playback gain of a video.

Parameters
videoPointer to the video that will be adjusted.
gainThe new playback gain (1.0 is normal gain).
Returns
The old gain setting.

Definition at line 505 of file video.c.

double ts5_get_video_gain ( TS5_VIDEO *  video)

Get the playback gain of a video.

Parameters
videoPointer to the video that will be queried.
Returns
the current playback gain.

Definition at line 528 of file video.c.