-
#include "quakedef.h"
#include "dpvsimpledecode.h"
{
qfile_t *file;
hz_bitstream_read_t *stream;
- if ((file = FS_Open (filename, "rb", false, false)))
+ if ((file = FS_OpenVirtualFile(filename, false)))
{
stream = (hz_bitstream_read_t *)Z_Malloc(sizeof(hz_bitstream_read_t));
memset(stream, 0, sizeof(*stream));
default:
s->error = DPVSIMPLEDECODEERROR_UNSUPPORTEDBPP;
return s->error;
- break;
}
for (Rshift = 0;!(Rmask & 1);Rshift++, Rmask >>= 1);
for (Gshift = 0;!(Gmask & 1);Gshift++, Gmask >>= 1);
// opening and closing streams
// opens a stream
-void *dpvsimpledecode_open(char *filename, char **errorstring)
+void *dpvsimpledecode_open(clvideo_t *video, char *filename, const char **errorstring)
{
dpvsimpledecodestream_t *s;
char t[8], *wavename;
if (s->videopixels != NULL)
{
size_t namelen;
-
+
namelen = strlen(filename) + 10;
wavename = (char *)Z_Malloc(namelen);
if (wavename)
Z_Free(wavename);
}
// all is well...
+ // set the module functions
s->videoframenum = -10000;
+ video->close = dpvsimpledecode_close;
+ video->getwidth = dpvsimpledecode_getwidth;
+ video->getheight = dpvsimpledecode_getheight;
+ video->getframerate = dpvsimpledecode_getframerate;
+ video->decodeframe = dpvsimpledecode_video;
+
return s;
}
else if (errorstring != NULL)
if (s->videopixels)
Z_Free(s->videopixels);
if (s->sndchan != -1)
- S_StopChannel (s->sndchan);
+ S_StopChannel (s->sndchan, true);
if (s->framedatablocks)
hz_bitstream_read_blocks_free(s->framedatablocks);
if (s->bitstream)
// number to DPVSIMPLEDECODEERROR_NONE
// if the supplied string pointer variable is not NULL, it will be set to the
// error message
-int dpvsimpledecode_error(void *stream, char **errorstring)
+int dpvsimpledecode_error(void *stream, const char **errorstring)
{
dpvsimpledecodestream_t *s = (dpvsimpledecodestream_t *)stream;
int e;
return s->info_framerate;
}
-
-
-
-
static int dpvsimpledecode_convertpixels(dpvsimpledecodestream_t *s, void *imagedata, int imagebytesperrow)
{
unsigned int a, x, y, width, height;