MCPcopy Create free account
hub / github.com/VirtualGL/virtualgl / sendXV

Method sendXV

server/VirtualWin.cpp:577–626  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

575#ifdef USEXV
576
577void VirtualWin::sendXV(GLint drawBuf, bool spoilLast, bool sync,
578 bool doStereo, int stereoMode)
579{
580 int width = oglDraw->getWidth(), height = oglDraw->getHeight();
581
582 XVFrame *f;
583 if(!xvtrans) xvtrans = new XVTrans();
584 if(spoilLast && fconfig.spoil && !xvtrans->isReady()) return;
585 if(!fconfig.spoil) xvtrans->synchronize();
586 ERRIFNOT(f = xvtrans->getFrame(dpy, x11Draw, width, height));
587 rrframeheader hdr;
588 hdr.x = hdr.y = 0;
589 hdr.width = hdr.framew = width;
590 hdr.height = hdr.frameh = height;
591
592 if(oglDraw->getRGBSize() != 24)
593 THROW("The XV Transport requires 8 bits per component");
594 int glFormat = oglDraw->getFormat(), pixelFormat = PF_RGB;
595 if(glFormat == GL_RGBA) pixelFormat = PF_RGBX;
596 else if(glFormat == GL_BGR) pixelFormat = PF_BGR;
597 else if(glFormat == GL_BGRA) pixelFormat = PF_BGRX;
598
599 frame.init(hdr, pixelFormat, FRAME_BOTTOMUP, false);
600
601 if(doStereo && IS_ANAGLYPHIC(stereoMode))
602 {
603 stereoFrame.deInit();
604 makeAnaglyph(&frame, drawBuf, stereoMode);
605 }
606 else if(doStereo && IS_PASSIVE(stereoMode))
607 {
608 rFrame.deInit(); gFrame.deInit(); bFrame.deInit();
609 makePassive(&frame, drawBuf, glFormat, stereoMode);
610 }
611 else
612 {
613 rFrame.deInit(); gFrame.deInit(); bFrame.deInit(); stereoFrame.deInit();
614 GLint readBuf = drawBuf;
615 if(stereoMode == RRSTEREO_REYE) readBuf = REYE(drawBuf);
616 else if(stereoMode == RRSTEREO_LEYE) readBuf = LEYE(drawBuf);
617 readPixels(0, 0, min(width, frame.hdr.framew), frame.pitch,
618 min(height, frame.hdr.frameh), glFormat, frame.pf, frame.bits, readBuf,
619 false);
620 }
621
622 if(fconfig.logo) frame.addLogo();
623
624 *f = frame;
625 xvtrans->sendFrame(f, sync);
626}
627
628#endif
629

Callers

nothing calls this directly

Calls 13

readPixelsFunction · 0.85
getRGBSizeMethod · 0.80
getFormatMethod · 0.80
deInitMethod · 0.80
addLogoMethod · 0.80
minFunction · 0.50
getWidthMethod · 0.45
getHeightMethod · 0.45
isReadyMethod · 0.45
synchronizeMethod · 0.45
getFrameMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected