On 28/01/17(Sat) 11:55, Ingo Feinerer wrote:
> Hi,
>
> in a previous commit
> (http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/sys/videoio.h?rev=1.12=text/x-cvsweb-markup)
> we updated our V4L2 API. However, one file (v4l2-common.h) could not be
> inlined as it was only GPL2 licensed.
>
> After discussion with the authors they agreed to dual license (GPL + BSD) this
> file as well
> (https://git.linuxtv.org/media_tree.git/commit/?id=80100fd9ebb9f2414892a1178d26a4253e6c0bcf)
> which allows us to fully comply with the V4L2 API. The attached diff
> implements this and syncs with videodev2.h from the Linux kernel version
> 4.10-rc5 at the same time
> (https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/include/uapi/linux/videodev2.h?id=refs/tags/v4.10-rc5).
>
> (The sync with a recent Linux videodev2.h is a prerequisite for updating the
> port multimedia/libv4l to 1.12.2.)
>
> I compiled a current kernel on amd64. My camera still works fine (tested with
> luvcview and baresip in combination with libv4l 1.12.2).
>
> OK?
This needs to go in a bulk since most users of this API are ports.
>
> Best regards,
> Ingo
>
> Index: sys/sys/videoio.h
> ===
> RCS file: /cvs/src/sys/sys/videoio.h,v
> retrieving revision 1.14
> diff -u -p -r1.14 videoio.h
> --- sys/sys/videoio.h 27 Jan 2016 13:07:09 - 1.14
> +++ sys/sys/videoio.h 28 Jan 2017 10:45:55 -
> @@ -3,6 +3,8 @@
> * Video for Linux Two header file
> *
> * Copyright (C) 1999-2012 the contributors
> + * Copyright (C) 2012 Nokia Corporation
> + * Contact: Sakari Ailus
> *
> * This program is free software; you can redistribute it and/or modify
> * it under the terms of the GNU General Public License as published by
> @@ -47,7 +49,7 @@
> * All kernel-specific stuff were moved to media/v4l2-dev.h, so
> * no #if __KERNEL tests are allowed here
> *
> - * See http://linuxtv.org for more info
> + * See https://linuxtv.org for more info
> *
> * Author: Bill Dirks
> * Justin Schoeman
> @@ -60,8 +62,84 @@
> #include
> #include
> #include
> -/* Ignore #include as it is GPL2.
> - * Inline #include
> +#ifndef __u8
> +typedef u_int8_t __u8;
> +#endif
> +#ifndef __u16
> +typedef u_int16_t __u16;
> +#endif
> +#ifndef __u32
> +typedef u_int32_t __u32;
> +#endif
> +#ifndef __u64
> +typedef u_int64_t __u64;
> +#endif
> +#ifndef __s32
> +typedef int32_t __s32;
> +#endif
> +#ifndef __s64
> +typedef int64_t __s64;
> +#endif
> +#ifndef __le32
> +typedef __u32 __le32;
> +#endif
> +/* Inline #include
> + * (v4l2-common.h was split off from videodev2.h and has the same BSD
> license.)
> + *
> + * Begin of v4l2-common.h
> + */
> +/*
> + *
> + * Selection interface definitions
> + *
> + */
> +
> +/* Current cropping area */
> +#define V4L2_SEL_TGT_CROP0x
> +/* Default cropping area */
> +#define V4L2_SEL_TGT_CROP_DEFAULT0x0001
> +/* Cropping bounds */
> +#define V4L2_SEL_TGT_CROP_BOUNDS 0x0002
> +/* Native frame size */
> +#define V4L2_SEL_TGT_NATIVE_SIZE 0x0003
> +/* Current composing area */
> +#define V4L2_SEL_TGT_COMPOSE 0x0100
> +/* Default composing area */
> +#define V4L2_SEL_TGT_COMPOSE_DEFAULT 0x0101
> +/* Composing bounds */
> +#define V4L2_SEL_TGT_COMPOSE_BOUNDS 0x0102
> +/* Current composing area plus all padding pixels */
> +#define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103
> +
> +/* Backward compatibility target definitions --- to be removed. */
> +#define V4L2_SEL_TGT_CROP_ACTIVE V4L2_SEL_TGT_CROP
> +#define V4L2_SEL_TGT_COMPOSE_ACTIVE V4L2_SEL_TGT_COMPOSE
> +#define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL V4L2_SEL_TGT_CROP
> +#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL V4L2_SEL_TGT_COMPOSE
> +#define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS V4L2_SEL_TGT_CROP_BOUNDS
> +#define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS V4L2_SEL_TGT_COMPOSE_BOUNDS
> +
> +/* Selection flags */
> +#define V4L2_SEL_FLAG_GE (1 << 0)
> +#define V4L2_SEL_FLAG_LE (1 << 1)
> +#define V4L2_SEL_FLAG_KEEP_CONFIG(1 << 2)
> +
> +/* Backward compatibility flag definitions --- to be removed. */
> +#define V4L2_SUBDEV_SEL_FLAG_SIZE_GE V4L2_SEL_FLAG_GE
> +#define V4L2_SUBDEV_SEL_FLAG_SIZE_LE V4L2_SEL_FLAG_LE
> +#define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG V4L2_SEL_FLAG_KEEP_CONFIG
> +
> +struct v4l2_edid {
> + __u32 pad;
> + __u32 start_block;
> + __u32 blocks;
> + __u32 reserved[5];
> + __u8 *edid;
> +};
> +/*
> + * End of v4l2-common.h
> + */
> +/* Inline #include
> * (v4l2-controls.h was split off from videodev2.h and has the same BSD
> license.)
> *
> * Begin of v4l2-controls.h
> @@ -175,8 +253,10 @@ enum v4l2_colorfx {
> * We reserve 16 controls for this driver. */
> #define V4L2_CID_USER_S2255_BASE (V4L2_CID_USER_BASE + 0x1030)
>
> -/* The base for the si476x driver controls. See include/media/si476x.h for
> the list
> -