1 2 #ifndef CL_VIDEO_H 3 #define CL_VIDEO_H 4 5 #define CLVIDEOPREFIX "video/" 6 #define CLTHRESHOLD 2.0 7 8 #define MENUOWNER 1 9 10 typedef enum clvideostate_e 11 { 12 CLVIDEO_UNUSED, 13 CLVIDEO_PLAY, 14 CLVIDEO_LOOP, 15 CLVIDEO_PAUSE, 16 CLVIDEO_FIRSTFRAME, 17 CLVIDEO_RESETONWAKEUP, 18 CLVIDEO_STATECOUNT 19 } clvideostate_t; 20 21 #define CLVIDEO_MAX_SUBTITLES 512 22 23 extern cvar_t cl_video_subtitles; 24 extern cvar_t cl_video_subtitles_lines; 25 extern cvar_t cl_video_subtitles_textsize; 26 extern cvar_t cl_video_scale; 27 extern cvar_t cl_video_scale_vpos; 28 extern cvar_t cl_video_stipple; 29 extern cvar_t cl_video_brightness; 30 extern cvar_t cl_video_keepaspectratio; 31 32 typedef struct clvideo_s 33 { 34 int ownertag; 35 clvideostate_t state; 36 37 // private stuff 38 void *stream; 39 40 double starttime; 41 int framenum; 42 double framerate; 43 44 void *imagedata; 45 46 // cachepic holds the relevant texture_t and we simply update the texture as needed 47 cachepic_t *cachepic; 48 char name[MAX_QPATH]; // name of this video UI element (not the filename) 49 int width; 50 int height; 51 52 // VorteX: subtitles array 53 int subtitles; 54 char *subtitle_text[CLVIDEO_MAX_SUBTITLES]; 55 float subtitle_start[CLVIDEO_MAX_SUBTITLES]; 56 float subtitle_end[CLVIDEO_MAX_SUBTITLES]; 57 58 // this functions gets filled by video format module 59 void (*close) (void *stream); 60 unsigned int (*getwidth) (void *stream); 61 unsigned int (*getheight) (void *stream); 62 double (*getframerate) (void *stream); 63 double (*getaspectratio) (void *stream); 64 int (*decodeframe) (void *stream, void *imagedata, unsigned int Rmask, unsigned int Gmask, unsigned int Bmask, unsigned int bytesperpixel, int imagebytesperrow); 65 66 // if a video is suspended, it is automatically paused (else we'd still have to process the frames) 67 // used to determine whether the video's resources should be freed or not 68 double lasttime; 69 // when lasttime - realtime > THRESHOLD, all but the stream is freed 70 qboolean suspended; 71 72 char filename[MAX_QPATH]; 73 } clvideo_t; 74 75 clvideo_t* CL_OpenVideo( const char *filename, const char *name, int owner, const char *subtitlesfile ); 76 clvideo_t* CL_GetVideoByName( const char *name ); 77 void CL_SetVideoState( clvideo_t *video, clvideostate_t state ); 78 void CL_RestartVideo( clvideo_t *video ); 79 80 void CL_CloseVideo( clvideo_t * video ); 81 void CL_PurgeOwner( int owner ); 82 83 void CL_Video_Frame( void ); // update all videos 84 void CL_Video_Init( void ); 85 void CL_Video_Shutdown( void ); 86 87 // old interface 88 extern int cl_videoplaying; 89 90 void CL_DrawVideo( void ); 91 void CL_VideoStart( char *filename, const char *subtitlesfile ); 92 void CL_VideoStop( void ); 93 94 // new function used for fullscreen videos 95 // TODO: Andreas Kirsch: move this subsystem somewhere else (preferably host) since the cl_video system shouldnt do such work like managing key events.. 96 void CL_Video_KeyEvent( int key, int ascii, qboolean down ); 97 98 #endif 99