Commit 027ecdff authored by Thiago Santini's avatar Thiago Santini

Documents clocks, adds inter-frame period to meta data, and adds version info

parent c4534fb1
......@@ -166,6 +166,31 @@ void UVCCameraSession::callback(uvc_frame_t *frame)
hybrid.update(t);
hybrid.correct(hw, settings.maximumFrameRate());
/* TODO:
*
* Consider changing the time reference here when hybrid has been tested.
* For now, we just export delta t (dt)
*
* 1) SW only.
* Pros: does not drift (same source as EyeRecToo).
* Cons: unprecise.
*
* t = sw.cur;
*
* 2) HW only.
* Pros: precise (after libuvc fix; seehttps://github.com/pupil-labs/libuvc/commit/ec5837e538aad0357c22a806eb8ea40ff73e6a33)
* Cons: drifts!
*
* t = hw.cur;
*
* 3) Hybrid.
* Pros: shouldn't drift, precise.
* Cons: Untested!
*
* t = hybrid.cur;
*
*/
if (!streaming)
return;
......@@ -187,7 +212,12 @@ void UVCCameraSession::callback(uvc_frame_t *frame)
break;
default:
return;
}
}
// Meta data
qFrame.setMetaData("timestamp", t);
qFrame.setMetaData("dt", hybrid.isp);
#ifdef BLOCKING_FRAME_GRABBING
m_surface->present( qFrame );
#else
......@@ -198,7 +228,7 @@ void UVCCameraSession::callback(uvc_frame_t *frame)
void UVCCameraSession::presentFrame(QVideoFrame frame, const qreal t)
{
frame.setMetaData("timestamp", t);
(void) t;
if (m_surface)
m_surface->present(frame);
//else
......
......@@ -30,6 +30,12 @@ QT_BEGIN_NAMESPACE
class Timing {
public:
Timing() :
cur(0),
prev(0),
isp(0)
{}
void update(const qreal &t) {
prev = cur;
cur = t;
......
......@@ -105,3 +105,14 @@ unix:{
LIBS += -lpthread
LIBS += -lusb-1.0
}
system("git --version"):{
GIT_BRANCH=$$system(git rev-parse --abbrev-ref HEAD)
GIT_COMMIT_HASH=$$system(git rev-parse --short HEAD)
} else {
GIT_BRANCH="unknown"
GIT_COMMIT_HASH="unknown"
}
DEFINES += VERSION=\\\"$$VERSION\\\"
DEFINES += GIT_BRANCH=\\\"$$GIT_BRANCH\\\"
DEFINES += GIT_COMMIT_HASH=\\\"$$GIT_COMMIT_HASH\\\"
......@@ -2,8 +2,8 @@
QMediaService* UVCServicePlugin::create(const QString &key)
{
if (key == Q_MEDIASERVICE_CAMERA)
return new UVCCameraService();
if (key == Q_MEDIASERVICE_CAMERA)
return new UVCCameraService();
return nullptr;
}
......
......@@ -4,20 +4,19 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC(QList<UVCVideoDeviceInfo>, deviceList)
bool UVCVideoDeviceControl::loaded = false;
bool UVCVideoDeviceControl::printVersion = true;
UVCVideoDeviceControl::UVCVideoDeviceControl(QObject *parent)
: QVideoDeviceSelectorControl(parent),
ctx(nullptr),
selected(0)
selected(0),
ctx(nullptr)
{
if (printVersion) {
qInfo() << QString("uvcengine version: %1 %2").arg(GIT_BRANCH).arg(GIT_COMMIT_HASH);
printVersion = false;
}
m_session = qobject_cast<UVCCameraSession*>(parent);
updateDevices();
if (!loaded) {
loaded = true;
qInfo() << "Loaded uvcengine!";
}
}
UVCVideoDeviceControl::~UVCVideoDeviceControl()
......
......@@ -33,12 +33,13 @@ public Q_SLOTS:
void setSelectedDevice(int index);
private:
static bool printVersion;
static void updateDevices();
UVCCameraSession* m_session;
int selected;
uvc_context_t* ctx;
static bool loaded;
};
QT_END_NAMESPACE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment