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