- case CAPTUREVIDEOFORMAT_RAWYV12:
- // if there's no videofile we have to just give up, and abort saving if there's no video or sound file
- if (!cls.capturevideo.videofile)
- return cls.capturevideo.soundfile != NULL;
- // FIXME: width/height must be multiple of 2, enforce this?
- qglReadPixels (x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, cls.capturevideo.buffer);CHECKGLERROR
- in = cls.capturevideo.buffer;
- out = cls.capturevideo.buffer + width*height*3;
- SCR_CaptureVideo_ConvertFrame_RGB_to_YV12_flip(width, height, in, out);
- x = width*height+(width/2)*(height/2)*2;
- for (;cls.capturevideo.frame < newframenum;cls.capturevideo.frame++)
- if (!FS_Write (cls.capturevideo.videofile, out, x))
- return false;
- return true;
- case CAPTUREVIDEOFORMAT_RAWRGB:
- // if there's no videofile we have to just give up, and abort saving if there's no video or sound file
- if (!cls.capturevideo.videofile)
- return cls.capturevideo.soundfile != NULL;
- // FIXME: this should flip the images... ?
- qglReadPixels (x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, cls.capturevideo.buffer);CHECKGLERROR
- for (;cls.capturevideo.frame < newframenum;cls.capturevideo.frame++)
- if (!FS_Write (cls.capturevideo.videofile, cls.capturevideo.buffer, width*height*3))
- return false;
- return true;
- case CAPTUREVIDEOFORMAT_JPEG:
- qglReadPixels (x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, cls.capturevideo.buffer);CHECKGLERROR
- for (;cls.capturevideo.frame < newframenum;cls.capturevideo.frame++)
- {
- sprintf(filename, "%s_%06d.jpg", cls.capturevideo.basename, cls.capturevideo.frame);
- if (!JPEG_SaveImage_preflipped (filename, width, height, cls.capturevideo.buffer))
- return false;
- }
- return true;
- case CAPTUREVIDEOFORMAT_TARGA:
- //return Image_WriteTGARGB_preflipped (filename, width, height, cls.capturevideo.buffer, cls.capturevideo.buffer + vid.width * vid.height * 3, );
- memset (cls.capturevideo.buffer, 0, 18);
- cls.capturevideo.buffer[2] = 2; // uncompressed type
- cls.capturevideo.buffer[12] = (width >> 0) & 0xFF;
- cls.capturevideo.buffer[13] = (width >> 8) & 0xFF;
- cls.capturevideo.buffer[14] = (height >> 0) & 0xFF;
- cls.capturevideo.buffer[15] = (height >> 8) & 0xFF;
- cls.capturevideo.buffer[16] = 24; // pixel size
- qglReadPixels (x, y, width, height, GL_BGR, GL_UNSIGNED_BYTE, cls.capturevideo.buffer + 18);CHECKGLERROR
- for (;cls.capturevideo.frame < newframenum;cls.capturevideo.frame++)
- {
- sprintf(filename, "%s_%06d.tga", cls.capturevideo.basename, cls.capturevideo.frame);
- if (!FS_WriteFile (filename, cls.capturevideo.buffer, width*height*3 + 18))
- return false;
- }
- return true;