void VideoRecordEffect::postPaintScreen() { effects->postPaintScreen(); if( client != NULL ) { #if 1 if( CapturyProcessRegionStart( client ) == CAPTURY_SUCCESS ) { capture_region &= QRect( 0, 0, displayWidth(), displayHeight()); // limit to screen foreach( const QRect &r, capture_region.rects()) { int gly = displayHeight() - r.y() - r.height(); // opengl coords CapturyProcessRegion( client, r.x(), gly, r.width(), r.height()); } CapturyProcessRegionCommit( client ); } #else CapturyProcessFrame( client ); #endif }
int main(int argc, char *argv[]) { for (int ch; (ch = getopt(argc, argv, "c:s:")) != -1; ) { switch (ch) { case 'c': scale = atoi(optarg); break; case 's': span = atoi(optarg); break; default: break; } } Display *dpy = XOpenDisplay(NULL); Window win = createWindow(dpy, span, span); captury_config_t config; bzero(&config, sizeof(config)); config.x = 0; config.y = 0; config.width = span; config.height = span; config.scale = scale; config.fps = 25.0; // average fps config.deviceType = CAPTURY_DEVICE_GLX; config.deviceHandle = dpy; config.windowHandle = win; config.cursor = true; captury_t *cd = CapturyOpen(&config); if (!cd) return die("cannot open capture device"); if (CapturySetOutputFileName(cd, "example.cps") == -1) return die(strerror(errno)); const int max = 10000; float step = (float) 1.0 / max; float color[3] = { 0.0, 1.0, 0.5 }; for (;;) { // for (time_t start = time(0); time(0) - start < 30; ) { // let's play for 30 seconds if (color[0] > 1.0) step = -step; else if (color[0] < 0.0) step = -step; color[0] += step; color[1] -= step; glClearColor(color[0], color[1], color[2], 1.0); glClear(GL_COLOR_BUFFER_BIT); CapturyProcessFrame(cd); glXSwapBuffers(dpy, win); } CapturyClose(cd); return 0; }