how can i instead of waitkey in MFC [closed]

asked 2018-07-09 23:57:02 -0600

chuliqiang gravatar image

We use MFC to play a video.

We can not use waitkey and sleep in main(UI) thread.waitkey and sleep will block main(UI) thread.

If we not use waitkey  and sleep,how can i control video playing with different FPS.
    1.Can we update UI and video output in other thread(I think it is not a good idea)?
    2.Waitkey or sleep in main(UI) (I think it is not a good idea)?
    3.Should we PostMessage from other thread to UI thread(is it the best solution)?
        can message guarantee the refresh interval?

Reference:

The function waitKey() waits for a key event infinitely (when delay <= 0) or for delay milliseconds, when it is positive.

If the FPS is equal to 20, then you should wait 0,05 seconds between the consecutive frames. So put waitKey(50) after imshow() and it will be displayed at normal speed.

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by berak
close date 2018-07-10 00:18:24.798059