CRM32Pro SDK
v5.22
|
IVideo. More...
IVideo.
Player MPEG interface.
Public Member Functions | |
char | PlayMPEG (char *file, char bSound=1, char bFilter=VIDEO_FILTER_NULL) |
Play MPEG-1 video and audio stream. More... | |
void | SetFunction (int(*MyFunction)(int kPressed, SDL_Surface *sFrame, SDL_Rect *rDst)) |
Set a function to be called each frame update. More... | |
void | SetFX (int) |
Set a special fx for video stream. It needs a fast CPU. More... | |
void | SetPosition (int x, int y) |
Set position on screen to play the video. By default, the video positions is (0,0). More... | |
void | SetScale (int width, int height) |
Set scaled size to play the video, call it before to play that video. More... | |
char CRM32Pro_IVideo::PlayMPEG | ( | char * | file, |
char | bSound = 1 , |
||
char | bFilter = VIDEO_FILTER_NULL |
||
) |
Play MPEG-1 video and audio stream.
The playback is performed on the foreground (this method does delay the execution till the end of the playback)
You can set/change FX effect while MPEG is playing (requires to use a callback function).
It always render the output to CRM32Pro.screen (that should be on system memory to avoid conversions).
It stops the playback with ESCAPE key or SDL_QUIT event (close the window)
file | MPEG file to play |
bSound | 0: do not play audio stream - 1: play audio stream (by default) |
bFilter | See definition of VIDEO_FILTER_xx. VIDEO_FILTER_NULL by default. |
void CRM32Pro_IVideo::SetFunction | ( | int(*)(int kPressed, SDL_Surface *sFrame, SDL_Rect *rDst) | MyFunction | ) |
Set a function to be called each frame update.
To disable a previous function, you have to use SetFunction(NULL).
The parameters of MyFunction() are: kPressed is the key pressed during the playback, sFrame is a surface pointer to current frame and rDst is the destination rect.
Using this function is optional but on OpenGL video modes it has to be used blitting the sFrame on CRM32Pro.screen due to SDL,OpenGL and SMPEG requirements. Note this process is quite intensive due to the frame is generated on memory system and converted to an OpenGL texture before to upload it to the video memory.
Check Example05_VideoPlayer for futher information.
MyFunction | pointer to function that will be executed each frame update. The function always must return 1 or it will stop the playback |
void CRM32Pro_IVideo::SetFX | ( | int | effect | ) |
Set a special fx for video stream.
It needs a fast CPU.
effect | Any of the FXSCREEN_xxx flag. |
void CRM32Pro_IVideo::SetPosition | ( | int | x, |
int | y | ||
) |
Set position on screen to play the video. By default, the video positions is (0,0).
x | desired X of the video playback. Use VIDEO_PLAY_CENTER to center on X axis. |
y | desired Y of the video playback. Use VIDEO_PLAY_CENTER to center on Y axis. |
void CRM32Pro_IVideo::SetScale | ( | int | width, |
int | height | ||
) |
Set scaled size to play the video, call it before to play that video.
While the video is playing, it doesnt do anything.
By default, the video is not scaled.
width | desired width of the video playback. 0 means do not scale the video on X axis. |
height | desired height of the video playback. 0 means do not scale the video on Y axis. |