Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uvcengine
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Thiago Santini
uvcengine
Commits
876736b5
Commit
876736b5
authored
Feb 27, 2017
by
Thiago Santini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds pixel aspect ratio information and latency metadata
parent
77902202
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
uvccamerasession.cpp
uvcengine/uvccamerasession.cpp
+9
-3
No files found.
uvcengine/uvccamerasession.cpp
View file @
876736b5
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment