+class VideoDoneHandler : public DoneHandler {
+public:
+ VideoDoneHandler(QtCamModePrivate *d, QObject *parent = 0) :
+ DoneHandler(d, "video-done", parent), m_done(false) {}
+
+ virtual void handleMessage(GstMessage *message) {
+ DoneHandler::handleMessage(message);
+ wake();
+ }
+
+ void lock() {
+ m_mutex.lock();
+ }
+
+ void unlock() {
+ m_mutex.unlock();
+ }
+
+ void wait() {
+ m_cond.wait(&m_mutex);
+ }
+
+ void reset() {
+ m_done = false;
+ }
+
+ bool isDone() {
+ return m_done;
+ }
+
+private:
+ void wake() {
+ lock();
+ m_done = true;
+ m_cond.wakeOne();
+ unlock();
+ }
+
+ bool m_done;
+ QMutex m_mutex;
+ QWaitCondition m_cond;
+};
+