Fix two bugs (everything should behave as usual now, when you're not using menu rende...
[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 #define MAXCLVIDEOS             64 + 1 // 1 video is reserved for the cinematic mode
8 // yields DYNAMIC_TEXTURE_PATH_PREFIX CLVIDEOPREFIX video name for a path
9 #define CLVIDEOPREFIX   CLDYNTEXTUREPREFIX "video/"
10 #define CLTHRESHOLD             2.0
11
12 #define MENUOWNER               1
13
14 typedef enum clvideostate_e
15 {
16         CLVIDEO_UNUSED,
17         CLVIDEO_PLAY,
18         CLVIDEO_LOOP,
19         CLVIDEO_PAUSE,
20         CLVIDEO_FIRSTFRAME,
21         CLVIDEO_RESETONWAKEUP,
22         CLVIDEO_STATECOUNT
23 } clvideostate_t;
24
25 typedef struct clvideo_s
26 {
27         int             ownertag;
28         clvideostate_t state;
29
30         // private stuff
31         void    *stream;
32
33         double  starttime;
34         int             framenum;
35         double  framerate;
36
37         void    *imagedata;
38
39         cachepic_t cpif;
40
41         // if a video is suspended, it is automatically paused (else we'd still have to process the frames)
42
43         // used to determine whether the video's resources should be freed or not
44     double  lasttime;
45         // when lasttime - realtime > THRESHOLD, all but the stream is freed
46         qboolean suspended;
47
48         char    filename[MAX_QPATH];
49 } clvideo_t;
50
51 clvideo_t*      CL_OpenVideo( const char *filename, const char *name, int owner );
52 clvideo_t*      CL_GetVideoByName( const char *name );
53 void            CL_SetVideoState( clvideo_t *video, clvideostate_t state );
54 void            CL_RestartVideo( clvideo_t *video );
55
56 void            CL_CloseVideo( clvideo_t * video );
57 void            CL_PurgeOwner( int owner );
58
59 void            CL_Video_Frame( void ); // update all videos
60 void            CL_Video_Init( void );
61 void            CL_Video_Shutdown( void );
62
63 // old interface
64 extern int cl_videoplaying;
65
66 void CL_DrawVideo( void );
67 void CL_VideoStart( char *filename );
68 void CL_VideoStop( void );
69
70 // new function used for fullscreen videos
71 // TODO: Andreas Kirsch: move this subsystem somewhere else (preferably host) since the cl_video system shouldnt do such work like managing key events..
72 void CL_Video_KeyEvent( int key, int ascii, qboolean down );
73
74 #endif