#include <stdint.h>
#include <sys/ioctl.h>
+#include <linux/types.h>
#include <linux/videodev2.h>
/* some historical constants */
#ifndef V4L2_CID_HCENTER
static void print_pixelformat(uint32_t fourcc)
{
+ union {
+ uint32_t pixelformat;
+ unsigned char cc[sizeof(uint32_t)];
+ } u = {
+ .pixelformat =
#if WORDS_BIGENDIAN
- fourcc = htole32(fourcc);
+ htole32(fourcc)
+#else
+ fourcc
#endif
- tprintf("%.4s", (char*)&fourcc);
+ };
+ unsigned int i;
+
+ tprints("v4l2_fourcc(");
+ for (i = 0; i < sizeof(u.cc); ++i) {
+ unsigned int c = u.cc[i];
+
+ if (i)
+ tprints(", ");
+ if (c == ' ' ||
+ (c >= '0' && c <= '9') ||
+ (c >= 'A' && c <= 'Z') ||
+ (c >= 'a' && c <= 'z')) {
+ char sym[] = {
+ '\'',
+ u.cc[i],
+ '\''
+ };
+ tprints(sym);
+ } else {
+ char hex[] = {
+ '\'',
+ '\\',
+ 'x',
+ "0123456789abcdef"[c >> 4],
+ "0123456789abcdef"[c & 0xf],
+ '\'',
+ '\0'
+ };
+ tprints(hex);
+ }
+ }
+ tprints(")");
}
static void print_v4l2_format_fmt(const struct v4l2_format *f)
if (entering(tcp)
|| (exiting(tcp) && tcp->auxstr && !syserror(tcp))) {
tprints(exiting(tcp) ? " => " : ", {id=");
+#ifdef V4L2_CTRL_FLAG_NEXT_CTRL
tcp->auxstr = (c.id & V4L2_CTRL_FLAG_NEXT_CTRL) ? "" : NULL;
if (tcp->auxstr) {
tprints("V4L2_CTRL_FLAG_NEXT_CTRL|");
c.id &= ~V4L2_CTRL_FLAG_NEXT_CTRL;
}
+#endif
printxval(v4l2_control_ids, c.id, "V4L2_CID_???");
}
if (exiting(tcp)) {
return 1;
}
+#ifdef VIDIOC_S_EXT_CTRLS
case VIDIOC_S_EXT_CTRLS:
case VIDIOC_TRY_EXT_CTRLS:
case VIDIOC_G_EXT_CTRLS: {
}
tprints("{id=");
printxval(v4l2_control_ids, ctrl.id, "V4L2_CID_???");
-#if HAVE_DECL_V4L2_CTRL_TYPE_STRING
+# if HAVE_DECL_V4L2_CTRL_TYPE_STRING
tprintf(", size=%u", ctrl.size);
if (ctrl.size > 0) {
if (must_print_values) {
printstr(tcp, (long) ctrl.string, ctrl.size);
}
} else
-#endif
+# endif
{
if (must_print_values) {
- tprintf(", value=%i, value64=%lli", ctrl.value,
- ctrl.value64);
+ tprintf(", value=%i, value64=%lld", ctrl.value,
+ (long long) ctrl.value64);
}
}
tprints("}");
tprints("]}");
return 1;
}
+#endif /* VIDIOC_S_EXT_CTRLS */
case VIDIOC_ENUMSTD: {
struct v4l2_standard s;
if (umove(tcp, arg, &s) < 0)
return 0;
if ((code == VIDIOC_S_STD) == entering(tcp))
- tprintf(", std=%#llx", s);
+ tprintf(", std=%#llx", (unsigned long long) s);
return 1;
}
b.length, b.bytesused);
printflags(v4l2_buf_flags, b.flags, "V4L2_BUF_FLAG_???");
if (code == VIDIOC_DQBUF)
- tprintf(", timestamp = {%lu.%06lu}",
- b.timestamp.tv_sec,
- b.timestamp.tv_usec);
+ tprintf(", timestamp = {%ju.%06ju}",
+ (uintmax_t)b.timestamp.tv_sec,
+ (uintmax_t)b.timestamp.tv_usec);
tprints(", ...");
}
tprints("}");