[PATCH] Add (incomplete) decoder for Video4Linux ioctls
Dmitry V. Levin
ldv at altlinux.org
Mon Mar 10 22:28:02 UTC 2014
On Tue, Mar 04, 2014 at 05:41:27PM +0000, William Manley wrote:
> ---
> Makefile.am | 1 +
> defs.h | 1 +
> ioctl.c | 2 +
> v4l2.c | 529 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 533 insertions(+)
> create mode 100644 v4l2.c
I cannot say I've thoroughly read the patch, but I like it anyway.
There is a portability issue that has to be addressed, though.
> +#include "defs.h"
> +#include <sys/ioctl.h>
> +#include <linux/videodev2.h>
What if <linux/videodev2.h> is not installed?
> +static const struct xlat v4l2_control_classes[] = {
> + XLAT(V4L2_CTRL_CLASS_USER),
> + XLAT(V4L2_CTRL_CLASS_MPEG),
> + XLAT(V4L2_CTRL_CLASS_CAMERA),
> + XLAT(V4L2_CTRL_CLASS_FM_TX),
> + XLAT(V4L2_CTRL_CLASS_FLASH),
> + XLAT(V4L2_CTRL_CLASS_JPEG),
> + XLAT(V4L2_CTRL_CLASS_IMAGE_SOURCE),
> + XLAT(V4L2_CTRL_CLASS_IMAGE_PROC),
> + XLAT(V4L2_CTRL_CLASS_FM_RX),
> + XLAT_END
> +};
What if linux headers are not fresh enough?
This code expects linux 3.10 or newer.
> +#define PRINTF_FOURCC "%c%c%c%c"
> +#define FOURCC(x) (char) (x), (char) (x>>8), (char) (x>>16), (char) (x>>24)
> +
> +#define PRINTF_FRACT "%u/%u"
> +#define FRACT(x) ((x).numerator), ((x).denominator)
> +
> +#define PRINTF_RECT "{left=%i, top=%i, width=%i, height=%i}"
> +#define RECT(x) (x).left, (x).top, (x).width, (x).height
Let's rename them to FMT_xxx/ARGS_xxx pairs for clarity.
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20140311/099d1796/attachment.bin>
More information about the Strace-devel
mailing list