/*!
* This file is part of CameraPlus.
*
- * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
+ * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
class VideoDoneHandler : public DoneHandler {
public:
VideoDoneHandler(QtCamModePrivate *d, QObject *parent = 0) :
- DoneHandler(d, "video-done", parent) {}
+ DoneHandler(d, "video-done", parent), m_done(false) {}
virtual void handleMessage(GstMessage *message) {
DoneHandler::handleMessage(message);
-
wake();
}
- void wake() {
- lock();
- m_cond.wakeOne();
- unlock();
- }
-
void lock() {
m_mutex.lock();
}
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;
};
g_object_set(d_ptr->dev->cameraBin, "location", file.toUtf8().data(), NULL);
g_signal_emit_by_name(d_ptr->dev->cameraBin, "start-capture", NULL);
+ VideoDoneHandler *handler = dynamic_cast<VideoDoneHandler *>(d_ptr->doneHandler);
+ handler->reset();
+
emit recordingStateChanged();
emit canCaptureChanged();
VideoDoneHandler *handler = dynamic_cast<VideoDoneHandler *>(d_ptr->doneHandler);
if (sync) {
handler->lock();
+
+ if (handler->isDone()) {
+ handler->unlock();
+ return;
+ }
}
g_signal_emit_by_name(d_ptr->dev->cameraBin, "stop-capture", NULL);
return d->settings;
}
+QtCamVideoResolution QtCamVideoMode::currentResolution() {
+ return d->resolution;
+}
+
#include "moc_qtcamvideomode.cpp"