CRM32Pro SDK  v5.22
List of all members | Public Member Functions

IVideo. More...

Detailed Description

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...
 

Member Function Documentation

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)

Parameters
fileMPEG file to play
bSound0: do not play audio stream - 1: play audio stream (by default)
bFilterSee definition of VIDEO_FILTER_xx. VIDEO_FILTER_NULL by default.
Returns
0 Failed
1 Ok
Examples:
Example05_VideoPlayer.cpp.
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.

Parameters
MyFunctionpointer to function that will be executed each frame update. The function always must return 1 or it will stop the playback
Examples:
Example05_VideoPlayer.cpp.
void CRM32Pro_IVideo::SetFX ( int  effect)

Set a special fx for video stream.
It needs a fast CPU.

Parameters
effectAny of the FXSCREEN_xxx flag.
Examples:
Example05_VideoPlayer.cpp.
void CRM32Pro_IVideo::SetPosition ( int  x,
int  y 
)

Set position on screen to play the video. By default, the video positions is (0,0).

Parameters
xdesired X of the video playback. Use VIDEO_PLAY_CENTER to center on X axis.
ydesired Y of the video playback. Use VIDEO_PLAY_CENTER to center on Y axis.
Examples:
Example05_VideoPlayer.cpp.
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.

Parameters
widthdesired width of the video playback. 0 means do not scale the video on X axis.
heightdesired height of the video playback. 0 means do not scale the video on Y axis.

The documentation for this class was generated from the following files: