]> icculus.org git repositories - divverent/darkplaces.git/blob - cl_video.h
Fixed the x axis flipped shadows, 1 step closer to getting all this to work perfecty...
[divverent/darkplaces.git] / cl_video.h
1
2 #ifndef CL_VIDEO_H
3 #define CL_VIDEO_H
4
5 #include "cl_dyntexture.h"
6
7 // yields DYNAMIC_TEXTURE_PATH_PREFIX CLVIDEOPREFIX video name for a path
8 #define CLVIDEOPREFIX   CLDYNTEXTUREPREFIX "video/"
9 #define CLTHRESHOLD             2.0
10
11 #define MENUOWNER               1
12
13 typedef enum clvideostate_e
14 {
15         CLVIDEO_UNUSED,
16         CLVIDEO_PLAY,
17         CLVIDEO_LOOP,
18         CLVIDEO_PAUSE,
19         CLVIDEO_FIRSTFRAME,
20         CLVIDEO_RESETONWAKEUP,
21         CLVIDEO_STATECOUNT
22 } clvideostate_t;
23
24 #define CLVIDEO_MAX_SUBTITLES 512
25
26 extern cvar_t cl_video_subtitles;
27 extern cvar_t cl_video_subtitles_lines;
28 extern cvar_t cl_video_subtitles_textsize;
29 extern cvar_t cl_video_scale;
30 extern cvar_t cl_video_scale_vpos;
31 extern cvar_t cl_video_stipple;
32 extern cvar_t cl_video_brightness;
33
34 typedef struct clvideo_s
35 {
36         int             ownertag;
37         clvideostate_t state;
38
39         // private stuff
40         void    *stream;
41
42         double  starttime;
43         int             framenum;
44         double  framerate;
45
46         void    *imagedata;
47
48         cachepic_t cpif;
49
50         // VorteX: subtitles array
51         int             subtitles;
52         char    *subtitle_text[CLVIDEO_MAX_SUBTITLES];
53         float   subtitle_start[CLVIDEO_MAX_SUBTITLES];
54         float   subtitle_end[CLVIDEO_MAX_SUBTITLES];
55
56         // if a video is suspended, it is automatically paused (else we'd still have to process the frames)
57
58         // used to determine whether the video's resources should be freed or not
59     double  lasttime;
60         // when lasttime - realtime > THRESHOLD, all but the stream is freed
61         qboolean suspended;
62
63         char    filename[MAX_QPATH];
64 } clvideo_t;
65
66 clvideo_t*      CL_OpenVideo( const char *filename, const char *name, int owner, const char *subtitlesfile );
67 clvideo_t*      CL_GetVideoByName( const char *name );
68 void            CL_SetVideoState( clvideo_t *video, clvideostate_t state );
69 void            CL_RestartVideo( clvideo_t *video );
70
71 void            CL_CloseVideo( clvideo_t * video );
72 void            CL_PurgeOwner( int owner );
73
74 void            CL_Video_Frame( void ); // update all videos
75 void            CL_Video_Init( void );
76 void            CL_Video_Shutdown( void );
77
78 // old interface
79 extern int cl_videoplaying;
80
81 void CL_DrawVideo( void );
82 void CL_VideoStart( char *filename, const char *subtitlesfile );
83 void CL_VideoStop( void );
84
85 // new function used for fullscreen videos
86 // TODO: Andreas Kirsch: move this subsystem somewhere else (preferably host) since the cl_video system shouldnt do such work like managing key events..
87 void CL_Video_KeyEvent( int key, int ascii, qboolean down );
88
89 #endif