Commit 876736b5 authored by Thiago Santini's avatar Thiago Santini

Adds pixel aspect ratio information and latency metadata

parent 77902202
...@@ -53,11 +53,13 @@ void UVCCameraSession::callback(uvc_frame_t *frame) ...@@ -53,11 +53,13 @@ void UVCCameraSession::callback(uvc_frame_t *frame)
void UVCCameraSession::presentFrame(const QVideoFrame &frame, const qreal t) void UVCCameraSession::presentFrame(const QVideoFrame &frame, const qreal t)
{ {
QMutexLocker locker(&frameMutex); QMutexLocker locker(&frameMutex);
QVideoFrame tmp(frame);
qreal latency = frameReference.elapsed() - t; qreal latency = frameReference.elapsed() - t;
tmp.setMetaData("latency", latency);
if (latency < MAX_LATENCY_MS) if (latency < MAX_LATENCY_MS)
m_surface->present( frame ); m_surface->present( tmp );
else //else
qDebug() << "Dropping frame (" << latency << "ms old )"; // qDebug() << "Dropping frame (" << latency << "ms old )";
} }
bool UVCCameraSession::load() bool UVCCameraSession::load()
...@@ -145,6 +147,9 @@ bool UVCCameraSession::qPixelFormat2UVCFrameFormat(const QVideoFrame::PixelForma ...@@ -145,6 +147,9 @@ bool UVCCameraSession::qPixelFormat2UVCFrameFormat(const QVideoFrame::PixelForma
case QVideoFrame::Format_Jpeg: case QVideoFrame::Format_Jpeg:
uvcFormat = UVC_FRAME_FORMAT_MJPEG; uvcFormat = UVC_FRAME_FORMAT_MJPEG;
return true; return true;
// TODO: support for YUYV. See:
// bDescriptorSubtype (UVC_VS_FORMAT_UNCOMPRESSED)
// guidFormat
default: default:
return false; return false;
} }
...@@ -175,6 +180,7 @@ void UVCCameraSession::updateSourceCapabilities() ...@@ -175,6 +180,7 @@ void UVCCameraSession::updateSourceCapabilities()
QCameraViewfinderSettings settings; QCameraViewfinderSettings settings;
settings.setResolution(frameDesc->wWidth, frameDesc->wHeight); settings.setResolution(frameDesc->wWidth, frameDesc->wHeight);
settings.setPixelAspectRatio(frameDesc->wWidth, frameDesc->wHeight); settings.setPixelAspectRatio(frameDesc->wWidth, frameDesc->wHeight);
settings.setPixelAspectRatio(formatDesc->bAspectRatioX,formatDesc->bAspectRatioY);
settings.setPixelFormat(qFormat); settings.setPixelFormat(qFormat);
uint32_t *intervals = frameDesc->intervals; uint32_t *intervals = frameDesc->intervals;
......
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