Message ID | 1353017384-472-2-git-send-email-sakari.ailus@iki.fi (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Sakari, Thanks for the patch. On Friday 16 November 2012 00:09:44 Sakari Ailus wrote: > Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> > --- > yavta.c | 12 +++++++++++- > 1 files changed, 11 insertions(+), 1 deletions(-) > > diff --git a/yavta.c b/yavta.c > index bf3e096..a50f11e 100644 > --- a/yavta.c > +++ b/yavta.c > @@ -464,6 +464,7 @@ static int video_alloc_buffers(struct device *dev, int > nbufs, > > /* Map the buffers. */ > for (i = 0; i < rb.count; ++i) { > + const char *ts_type = "invalid"; Any reason for not moving this to a default case ? That shouldn't be the most common case, it will nearly always get overwritten so that's hardly an optimization :-) > memset(&buf, 0, sizeof buf); > buf.index = i; > buf.type = dev->type; > @@ -474,7 +475,16 @@ static int video_alloc_buffers(struct device *dev, int > nbufs, strerror(errno), errno); > return ret; > } > - printf("length: %u offset: %u\n", buf.length, buf.m.offset); > + switch (buf.flags & V4L2_BUF_FLAG_TIMESTAMP_MASK) { > + case V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN: > + ts_type = "unknown"; > + break; > + case V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC: > + ts_type = "monotonic"; > + break; > + } > + printf("length: %u offset: %u timestamp type: %s\n", > + buf.length, buf.m.offset, ts_type); > > switch (dev->memtype) { > case V4L2_MEMORY_MMAP:
diff --git a/yavta.c b/yavta.c index bf3e096..a50f11e 100644 --- a/yavta.c +++ b/yavta.c @@ -464,6 +464,7 @@ static int video_alloc_buffers(struct device *dev, int nbufs, /* Map the buffers. */ for (i = 0; i < rb.count; ++i) { + const char *ts_type = "invalid"; memset(&buf, 0, sizeof buf); buf.index = i; buf.type = dev->type; @@ -474,7 +475,16 @@ static int video_alloc_buffers(struct device *dev, int nbufs, strerror(errno), errno); return ret; } - printf("length: %u offset: %u\n", buf.length, buf.m.offset); + switch (buf.flags & V4L2_BUF_FLAG_TIMESTAMP_MASK) { + case V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN: + ts_type = "unknown"; + break; + case V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC: + ts_type = "monotonic"; + break; + } + printf("length: %u offset: %u timestamp type: %s\n", + buf.length, buf.m.offset, ts_type); switch (dev->memtype) { case V4L2_MEMORY_MMAP:
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> --- yavta.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)