]> git.xonotic.org Git - xonotic/darkplaces.git/blob - cl_video.h
8439e92cc65ba80ceac47048f3c2439258779814
[xonotic/darkplaces.git] / cl_video.h
1
2 #ifndef CL_VIDEO_H
3 #define CL_VIDEO_H
4
5 #define MAXCLVIDEOS             64 + 1 // 1 video is reserved for the cinematic mode
6 #define CLVIDEOPREFIX   "_video/"
7 #define CLTHRESHOLD             2.0
8
9 #define MENUOWNER               1
10
11 typedef enum clvideostate_e
12 {
13         CLVIDEO_UNUSED,
14         CLVIDEO_PLAY,
15         CLVIDEO_LOOP,
16         CLVIDEO_PAUSE,
17         CLVIDEO_FIRSTFRAME,
18         CLVIDEO_RESETONWAKEUP,
19         CLVIDEO_STATECOUNT
20 } clvideostate_t;
21
22 typedef struct clvideo_s
23 {
24         int             ownertag;
25         clvideostate_t state;
26
27         // private stuff
28         void    *stream;
29
30         double  starttime;
31         int             framenum;
32         double  framerate;
33
34         void    *imagedata;
35
36         cachepic_t cpif;
37
38         // if a video is suspended, it is automatically paused (else we'd still have to process the frames)
39
40         // used to determine whether the video's resources should be freed or not
41     double  lasttime;
42         // when lasttime - realtime > THRESHOLD, all but the stream is freed
43         qboolean suspended;
44
45         char    filename[MAX_QPATH];
46 } clvideo_t;
47
48 clvideo_t*      CL_OpenVideo( const char *filename, const char *name, int owner );
49 clvideo_t*      CL_GetVideo( const char *name );
50 void            CL_SetVideoState( clvideo_t *video, clvideostate_t state );
51 void            CL_RestartVideo( clvideo_t *video );
52
53 void            CL_CloseVideo( clvideo_t * video );
54 void            CL_PurgeOwner( int owner );
55
56 void            CL_VideoFrame( void ); // update all videos
57 void            CL_Video_Init( void );
58 void            CL_Video_Shutdown( void );
59
60 // old interface
61 extern int cl_videoplaying;
62
63 void CL_DrawVideo( void );
64 void CL_VideoStart( char *filename );
65 void CL_VideoStop( void );
66
67 #endif