MichaelQuigley
24th September 2012, 22:11
I apologize in advance if there's a thread lurking somewhere that contains the information I'm looking for. I searched. Honestly, I did.
I have a QWidget subclass which is meant to be the area where a DirectShow VMR9 draws its video output. The application is working perfectly--all of the DirectShow stuff is wired up happily and the VMR9 is drawing on my QWidget subclass. The problem is that when resizing the window, I'm getting a lot of flicker in the redraw. It looks to me like Qt and DirectShow are having a race during repainting. It looks like Qt is clearing the widget, and then DirectShow is repainting afterward. In my QWidget subclass I have a paintEvent() method something like this:
void VideoWidget::paintEvent(QPaintEvent*) {
RECT pos;
pos.top = 0;
pos.left = 0;
pos.bottom = height() - 1;
pos.right = width() - 1;
_impl->vmrWc->SetVideoPosition(NULL, &pos);
HWND hWnd = (HWND) winId();
HDC hDC = GetDC(hWnd);
_impl->vmrWc->RepaintVideo(hWnd, hDC);
}
"_impl->vmrWc" refers to the IVMRWindowlessControl9 for my VMR9 renderer.
Is there something I should be doing differently with my QWidget subclass to provoke it to not try to redraw the widget's contents?
Thanks in advance...
Michael
I have a QWidget subclass which is meant to be the area where a DirectShow VMR9 draws its video output. The application is working perfectly--all of the DirectShow stuff is wired up happily and the VMR9 is drawing on my QWidget subclass. The problem is that when resizing the window, I'm getting a lot of flicker in the redraw. It looks to me like Qt and DirectShow are having a race during repainting. It looks like Qt is clearing the widget, and then DirectShow is repainting afterward. In my QWidget subclass I have a paintEvent() method something like this:
void VideoWidget::paintEvent(QPaintEvent*) {
RECT pos;
pos.top = 0;
pos.left = 0;
pos.bottom = height() - 1;
pos.right = width() - 1;
_impl->vmrWc->SetVideoPosition(NULL, &pos);
HWND hWnd = (HWND) winId();
HDC hDC = GetDC(hWnd);
_impl->vmrWc->RepaintVideo(hWnd, hDC);
}
"_impl->vmrWc" refers to the IVMRWindowlessControl9 for my VMR9 renderer.
Is there something I should be doing differently with my QWidget subclass to provoke it to not try to redraw the widget's contents?
Thanks in advance...
Michael