This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-utils.git tree:

Subject: v4l2-ctl: set timestamp for output buffers.
Author:  Hans Verkuil <[email protected]>
Date:    Mon Feb 24 15:53:49 2014 +0100

When streaming to a VIDEO_OUTPUT device, and if the timestamp mask of the
buffer is V4L2_BUF_FLAG_TIMESTAMP_COPY, then we need to set a timestamp.

Signed-off-by: Hans Verkuil <[email protected]>

 utils/v4l2-ctl/v4l2-ctl-streaming.cpp |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

---

http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=17ea88b11424e60080e24f1a655dae68d6546b35

diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp 
b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index 4918fa9..70aaebf 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -81,6 +81,17 @@ void streaming_usage(void)
               );
 }
 
+static void setTimeStamp(struct v4l2_buffer &buf)
+{
+       struct timespec ts;
+
+       if ((buf.flags & V4L2_BUF_FLAG_TIMESTAMP_MASK) != 
V4L2_BUF_FLAG_TIMESTAMP_COPY)
+               return;
+       clock_gettime(CLOCK_MONOTONIC, &ts);
+       buf.timestamp.tv_sec = ts.tv_sec;
+       buf.timestamp.tv_usec = ts.tv_nsec / 1000;
+}
+
 static const flag_def flags_def[] = {
        { V4L2_BUF_FLAG_MAPPED, "mapped" },
        { V4L2_BUF_FLAG_QUEUED, "queued" },
@@ -429,6 +440,8 @@ static int do_setup_out_buffers(int fd, buffers &b, FILE 
*fin)
                        if (!fin || !fill_buffer_from_file(b, buf.index, fin))
                                fill_buffer(b.bufs[i][0], &fmt.fmt.pix);
                }
+               if (V4L2_TYPE_IS_OUTPUT(buf.type))
+                       setTimeStamp(buf);
                if (doioctl(fd, VIDIOC_QBUF, &buf))
                        return -1;
        }
@@ -579,6 +592,8 @@ static int do_handle_out(int fd, buffers &b, FILE *fin,
        } else {
                buf.bytesused = buf.length;
        }
+       if (V4L2_TYPE_IS_OUTPUT(buf.type))
+               setTimeStamp(buf);
        if (test_ioctl(fd, VIDIOC_QBUF, &buf))
                return -1;
 

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to