2 #ifndef DPVSIMPLEDECODE_H
3 #define DPVSIMPLEDECODE_H
5 #define DPVSIMPLEDECODEERROR_NONE 0
6 #define DPVSIMPLEDECODEERROR_EOF 1
7 #define DPVSIMPLEDECODEERROR_READERROR 2
8 #define DPVSIMPLEDECODEERROR_SOUNDBUFFERTOOSMALL 3
9 #define DPVSIMPLEDECODEERROR_INVALIDRMASK 4
10 #define DPVSIMPLEDECODEERROR_INVALIDGMASK 5
11 #define DPVSIMPLEDECODEERROR_INVALIDBMASK 6
12 #define DPVSIMPLEDECODEERROR_COLORMASKSOVERLAP 7
13 #define DPVSIMPLEDECODEERROR_COLORMASKSEXCEEDBPP 8
14 #define DPVSIMPLEDECODEERROR_UNSUPPORTEDBPP 9
16 // opening and closing streams
19 void *dpvsimpledecode_open(char *filename, char **errorstring);
21 void dpvsimpledecode_close(void *stream);
23 // utilitarian functions
25 // returns the current error number for the stream, and resets the error
26 // number to DPVDECODEERROR_NONE
27 // if the supplied string pointer variable is not NULL, it will be set to the
29 int dpvsimpledecode_error(void *stream, char **errorstring);
31 // returns the width of the image data
32 unsigned int dpvsimpledecode_getwidth(void *stream);
34 // returns the height of the image data
35 unsigned int dpvsimpledecode_getheight(void *stream);
37 // returns the sound sample rate of the stream
38 unsigned int dpvsimpledecode_getsoundrate(void *stream);
40 // returns the framerate of the stream
41 double dpvsimpledecode_getframerate(void *stream);
43 // decodes a video frame to the supplied output pixels
44 int dpvsimpledecode_video(void *stream, void *imagedata, unsigned int Rmask, unsigned int Gmask, unsigned int Bmask, unsigned int bytesperpixel, int imagebytesperrow);
46 // (note: sound is 16bit stereo native-endian, left channel first)
47 int dpvsimpledecode_audio(void *stream, short *soundbuffer, int requestedlength);