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