+
+ video->imagedata = Mem_Alloc( cl_mempool, video->cpif.width * video->cpif.height * cl_videobytesperpixel );
+ video->cpif.tex = R_LoadTexture2D( cl_videotexturepool, video->cpif.name,
+ video->cpif.width, video->cpif.height, NULL, TEXTYPE_RGBA, 0, NULL );
+
+ // update starttime
+ video->starttime += realtime - video->lasttime;
+
+ return true;
+}
+
+static clvideo_t* OpenVideo( clvideo_t *video, const char *filename, const char *name, int owner )
+{
+ strncpy( video->filename, filename, MAX_QPATH );
+ video->ownertag = owner;
+ if( strncmp( name, CLVIDEOPREFIX, sizeof( CLVIDEOPREFIX ) - 1 ) )
+ return NULL;
+ strncpy( video->cpif.name, name, MAX_QPATH );
+
+ if( !OpenStream( video ) )
+ return NULL;
+
+ video->state = CLVIDEO_FIRSTFRAME;
+ video->framenum = -1;
+ video->framerate = dpvsimpledecode_getframerate( video->stream );
+ video->lasttime = realtime;
+
+ video->cpif.width = dpvsimpledecode_getwidth( video->stream );
+ video->cpif.height = dpvsimpledecode_getheight( video->stream );
+ video->cpif.tex = R_LoadTexture2D( cl_videotexturepool, video->cpif.name,
+ video->cpif.width, video->cpif.height, NULL, TEXTYPE_RGBA, 0, NULL );
+
+ video->imagedata = Mem_Alloc( cl_mempool, video->cpif.width * video->cpif.height * cl_videobytesperpixel );
+
+ return video;
+}
+
+clvideo_t* CL_OpenVideo( const char *filename, const char *name, int owner )
+{
+ clvideo_t *video;
+
+ video = FindUnusedVid();
+ if( !video ) {
+ Con_Printf( "unable to open video \"%s\" - video limit reached\n", filename );
+ return NULL;