1 Answer
1

Well, of course that's happening...you are in a tight loop on the GUI thread that never yields control to the message pump until the loop is over! :-)

It may be possible to synchronously call some kind of update function on your widget after updateFrame(), and you could watch the playback...but the GUI would still be frozen w.r.t. buttons you might want to push (e.g. "pause").

Consider using a timer instead, so the GUI thread can run the message pump between frames:

The Player object runs in a separate thread, so my understanding is that it would emit colorFrameEvent every 33 ms, while in between the GUI thread is free to do whatever it wants. Could you explain a bit more why it doesn't happen?
–
jahoDec 4 '12 at 20:53

You edited your question since when I started to answer it. :) If the UI is locked, that means your GUI pump is not running. Are you certain that Player::play is NOT running on the GUI thread? Have you made sure your thread affinity is correct? Check by printing out the thread IDs you are working with to confirm things are running on the threads you expect they are.
–
HostileForkDec 4 '12 at 21:09

1

Of course, you were right. Obviously only stuff that's inside Player::run() method runs in a separate thread. I somehow imagined that after calling Player::start() the object will just seat there in its thread and wait for the signals from the GUI thread... So I can now get it to work with yet another thread (timer-like), but how could I do it so that Player::play() slot executes in separate thread when on_btnPlay_clicked() is emitted from the GUI? Many thanks.
–
jahoDec 4 '12 at 22:19

@Marian Read what I linked about moveToThread, but...my instincts say that trying to spawn an msleep-based frame updating thread isn't actually what you want. Yet practical multimedia has always been a minefield for me, and this is why I like to live in the deeper levels of the stack. :-/ If you're finding yourself reinventing the video-player-wheel you might want to ask a more general question and get advice from folks who are more informed on the practice side of the theory/practice distinction with video than I.
–
HostileForkDec 4 '12 at 22:33