| 100 | |
| 101 | |
| 102 | XVFrame *XVTrans::getFrame(Display *dpy, Window win, int width, int height) |
| 103 | { |
| 104 | XVFrame *f = NULL; |
| 105 | |
| 106 | if(thread) thread->checkError(); |
| 107 | { |
| 108 | CriticalSection::SafeLock l(mutex); |
| 109 | |
| 110 | int index = -1; |
| 111 | for(int i = 0; i < NFRAMES; i++) |
| 112 | if(!frames[i] || (frames[i] && frames[i]->isComplete())) |
| 113 | index = i; |
| 114 | if(index < 0) THROW("No free buffers in pool"); |
| 115 | if(!frames[index]) |
| 116 | frames[index] = new XVFrame(dpy, win); |
| 117 | f = frames[index]; f->waitUntilComplete(); |
| 118 | } |
| 119 | |
| 120 | rrframeheader hdr; |
| 121 | memset(&hdr, 0, sizeof(hdr)); |
| 122 | hdr.x = hdr.y = 0; |
| 123 | hdr.width = hdr.framew = width; |
| 124 | hdr.height = hdr.frameh = height; |
| 125 | f->init(hdr); |
| 126 | return f; |
| 127 | } |
| 128 | |
| 129 | |
| 130 | bool XVTrans::isReady(void) |