X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=cl_video.h;h=7c6140fa26545a34e5b028d2156bac69d48924b3;hp=5d9cd2f16f0d55e8e398ce698be960f9891aca5a;hb=a66ee73e39edd25878ca5f5a58f35b125fffca29;hpb=59d5ffaf49cffaec27871bfe53c9472d1f3d4259 diff --git a/cl_video.h b/cl_video.h index 5d9cd2f1..7c6140fa 100644 --- a/cl_video.h +++ b/cl_video.h @@ -2,8 +2,10 @@ #ifndef CL_VIDEO_H #define CL_VIDEO_H -#define MAXCLVIDEOS 64 + 1 // 1 video is reserved for the cinematic mode -#define CLVIDEOPREFIX "_video/" +#include "qtypes.h" +#include "qdefs.h" + +#define CLVIDEOPREFIX "video/" #define CLTHRESHOLD 2.0 #define MENUOWNER 1 @@ -19,6 +21,17 @@ typedef enum clvideostate_e CLVIDEO_STATECOUNT } clvideostate_t; +#define CLVIDEO_MAX_SUBTITLES 512 + +extern struct cvar_s cl_video_subtitles; +extern struct cvar_s cl_video_subtitles_lines; +extern struct cvar_s cl_video_subtitles_textsize; +extern struct cvar_s cl_video_scale; +extern struct cvar_s cl_video_scale_vpos; +extern struct cvar_s cl_video_stipple; +extern struct cvar_s cl_video_brightness; +extern struct cvar_s cl_video_keepaspectratio; + typedef struct clvideo_s { int ownertag; @@ -33,24 +46,44 @@ typedef struct clvideo_s void *imagedata; - cachepic_t cpif; + // cachepic holds the relevant texture_t and we simply update the texture as needed + struct cachepic_s *cachepic; + char name[MAX_QPATH]; // name of this video UI element (not the filename) + int width; + int height; + + // VorteX: subtitles array + int subtitles; + char *subtitle_text[CLVIDEO_MAX_SUBTITLES]; + float subtitle_start[CLVIDEO_MAX_SUBTITLES]; + float subtitle_end[CLVIDEO_MAX_SUBTITLES]; + + // this functions gets filled by video format module + void (*close) (void *stream); + unsigned int (*getwidth) (void *stream); + unsigned int (*getheight) (void *stream); + double (*getframerate) (void *stream); + double (*getaspectratio) (void *stream); + int (*decodeframe) (void *stream, void *imagedata, unsigned int Rmask, unsigned int Gmask, unsigned int Bmask, unsigned int bytesperpixel, int imagebytesperrow); // if a video is suspended, it is automatically paused (else we'd still have to process the frames) - double lasttime; // used to determine whether the video's resources should be freed or not - qboolean suspended; // when lasttime - realtime > THRESHOLD, all but the stream is freed + // used to determine whether the video's resources should be freed or not + double lasttime; + // when lasttime - realtime > THRESHOLD, all but the stream is freed + qbool suspended; char filename[MAX_QPATH]; } clvideo_t; -clvideo_t* CL_OpenVideo( char *filename, char *name, int owner ); -clvideo_t* CL_GetVideo( char *name ); +clvideo_t* CL_OpenVideo( const char *filename, const char *name, int owner, const char *subtitlesfile ); +clvideo_t* CL_GetVideoByName( const char *name ); void CL_SetVideoState( clvideo_t *video, clvideostate_t state ); void CL_RestartVideo( clvideo_t *video ); void CL_CloseVideo( clvideo_t * video ); void CL_PurgeOwner( int owner ); -void CL_VideoFrame( void ); // update all videos +void CL_Video_Frame( void ); // update all videos void CL_Video_Init( void ); void CL_Video_Shutdown( void ); @@ -58,7 +91,11 @@ void CL_Video_Shutdown( void ); extern int cl_videoplaying; void CL_DrawVideo( void ); -void CL_VideoStart( char *filename ); +void CL_VideoStart( char *filename, const char *subtitlesfile ); void CL_VideoStop( void ); +// new function used for fullscreen videos +// TODO: Andreas Kirsch: move this subsystem somewhere else (preferably host) since the cl_video system shouldnt do such work like managing key events.. +void CL_Video_KeyEvent( int key, int ascii, qbool down ); + #endif