diff --git a/ch7/input_uvc_patch b/ch7/input_uvc_patch new file mode 100644 index 0000000..2905456 --- /dev/null +++ b/ch7/input_uvc_patch @@ -0,0 +1,52 @@ +--- plugins/input_uvc/input_uvc.c (revision 182) ++++ plugins/input_uvc/input_uvc.c (working copy) +@@ -407,7 +407,7 @@ + pglobal->in[pcontext->id].size = compress_yuyv_to_jpeg(pcontext->videoIn, pglobal->in[pcontext->id].buf, pcontext->videoIn->framesizeIn, gquality); + } 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); + } + + #if 0 +@@ -419,7 +419,7 @@ + #endif + + /* copy this frame's timestamp to user space */ +- pglobal->in[pcontext->id].timestamp = pcontext->videoIn->buf.timestamp; ++ pglobal->in[pcontext->id].timestamp = pcontext->videoIn->tmptimestamp; + + /* signal fresh_frame */ + pthread_cond_broadcast(&pglobal->in[pcontext->id].db_update); +=================================================================== +--- plugins/input_uvc/v4l2uvc.c (revision 182) ++++ 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); +=================================================================== +--- plugins/input_uvc/v4l2uvc.h (revision 182) ++++ plugins/input_uvc/v4l2uvc.h (working copy) +@@ -28,6 +28,7 @@ + + + #include ++#include + #include + #include + #include +@@ -105,6 +106,8 @@ + int framecount; + int recordstart; + int recordtime; ++ uint32_t tmpbytesused; ++ struct timeval tmptimestamp; + }; + + /* context of each camera thread */