-
Notifications
You must be signed in to change notification settings - Fork 0
/
input_uvc_patch
60 lines (52 loc) · 2.4 KB
/
input_uvc_patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
--- plugins/input_uvc/input_uvc.c (revision 174)
+++ plugins/input_uvc/input_uvc.c (working copy)
@@ -405,9 +405,13 @@
if(pcontext->videoIn->formatIn == V4L2_PIX_FMT_YUYV) {
DBG("compressing frame from input: %d\n", (int)pcontext->id);
pglobal->in[pcontext->id].size = compress_yuyv_to_jpeg(pcontext->videoIn, pglobal->in[pcontext->id].buf, pcontext->videoIn->framesizeIn, gquality);
+ /* copy this frame's timestamp to user space */
+ pglobal->in[pcontext->id].timestamp = pcontext->videoIn->buf.timestamp;
} else {
DBG("copying frame from input: %d\n", (int)pcontext->id);
- pglobal->in[pcontext->id].size = memcpy_picture(pglobal->in[pcontext->id].buf, pcontext->videoIn->tmpbuffer, pcontext->videoIn->buf.bytesused);
+ pglobal->in[pcontext->id].size = memcpy_picture(pglobal->in[pcontext->id].buf, pcontext->videoIn->tmpbuffer, pcontext->videoIn->tmpbytesused);
+ /* copy this frame's timestamp to user space */
+ pglobal->in[pcontext->id].timestamp = pcontext->videoIn->tmptimestamp;
}
#if 0
@@ -418,8 +422,6 @@
prev_size = global->size;
#endif
- /* copy this frame's timestamp to user space */
- pglobal->in[pcontext->id].timestamp = pcontext->videoIn->buf.timestamp;
/* signal fresh_frame */
pthread_cond_broadcast(&pglobal->in[pcontext->id].db_update);
Index: plugins/input_uvc/v4l2uvc.c
===================================================================
--- plugins/input_uvc/v4l2uvc.c (revision 174)
+++ plugins/input_uvc/v4l2uvc.c (working copy)
@@ -450,6 +450,8 @@
*/
memcpy(vd->tmpbuffer, vd->mem[vd->buf.index], vd->buf.bytesused);
+ vd->tmpbytesused = vd->buf.bytesused;
+ vd->tmptimestamp = vd->buf.timestamp;
if(debug)
fprintf(stderr, "bytes in used %d \n", vd->buf.bytesused);
Index: plugins/input_uvc/v4l2uvc.h
===================================================================
--- plugins/input_uvc/v4l2uvc.h (revision 174)
+++ plugins/input_uvc/v4l2uvc.h (working copy)
@@ -28,6 +28,7 @@
#include <stdio.h>
+#include <stdint.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
@@ -105,6 +106,8 @@
int framecount;
int recordstart;
int recordtime;
+ uint32_t tmpbytesused;
+ struct timeval tmptimestamp;
};
/* context of each camera thread */