]> icculus.org git repositories - btb/d2x.git/blob - include/mvelib.h
okay, maybe it needs to be this way
[btb/d2x.git] / include / mvelib.h
1 #ifndef INCLUDED_MVELIB_H
2 #define INCLUDED_MVELIB_H
3
4 #include <stdio.h>
5 #include <stdlib.h>
6
7 /*
8  * structure for maintaining info on a MVEFILE stream
9  */
10 typedef struct MVEFILE
11 {
12     int             stream;
13     unsigned char  *cur_chunk;
14     int             buf_size;
15     int             cur_fill;
16     int             next_segment;
17 } MVEFILE;
18
19 /*
20  * open a .MVE file
21  */
22 MVEFILE *mvefile_open(int filehandle);
23
24 /*
25  * close a .MVE file
26  */
27 void mvefile_close(MVEFILE *movie);
28
29 /*
30  * get size of next segment in chunk (-1 if no more segments in chunk)
31  */
32 int mvefile_get_next_segment_size(MVEFILE *movie);
33
34 /*
35  * get type of next segment in chunk (0xff if no more segments in chunk)
36  */
37 unsigned char mvefile_get_next_segment_major(MVEFILE *movie);
38
39 /*
40  * get subtype (version) of next segment in chunk (0xff if no more segments in
41  * chunk)
42  */
43 unsigned char mvefile_get_next_segment_minor(MVEFILE *movie);
44
45 /*
46  * see next segment (return NULL if no next segment)
47  */
48 unsigned char *mvefile_get_next_segment(MVEFILE *movie);
49
50 /*
51  * advance to next segment
52  */
53 void mvefile_advance_segment(MVEFILE *movie);
54
55 /*
56  * fetch the next chunk (return 0 if at end of stream)
57  */
58 int mvefile_fetch_next_chunk(MVEFILE *movie);
59
60 /*
61  * callback for segment type
62  */
63 typedef int (*MVESEGMENTHANDLER)(unsigned char major, unsigned char minor, unsigned char *data, int len, void *context);
64
65 /*
66  * structure for maintaining an MVE stream
67  */
68 typedef struct MVESTREAM
69 {
70     MVEFILE                    *movie;
71     void                       *context;
72     MVESEGMENTHANDLER           handlers[32];
73 } MVESTREAM;
74
75 /*
76  * open an MVE stream
77  */
78 MVESTREAM *mve_open(int filehandle);
79
80 /*
81  * close an MVE stream
82  */
83 void mve_close(MVESTREAM *movie);
84
85 /*
86  * set segment type handler
87  */
88 void mve_set_handler(MVESTREAM *movie, unsigned char major, MVESEGMENTHANDLER handler);
89
90 /*
91  * set segment handler context
92  */
93 void mve_set_handler_context(MVESTREAM *movie, void *context);
94
95 /*
96  * play next chunk
97  */
98 int mve_play_next_chunk(MVESTREAM *movie);
99
100 #endif /* INCLUDED_MVELIB_H */