dvb-file: Fix bandwidth handling at online write function

The conversion from bandwidth in Hz to bandwidth with the legacy
oneline files is wrong. It was always returning bandwidth auto,
instead of writing the proper values on it. Fix it.

Reported-by: Reynaldo H. Verdejo Pinochet <r.verdejo@sisa.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
libdvbv5: Find other TS in NIT pointer fix

dvb_scan_add_entry() is modified to return the pointer to the newly
created entry (the last in the list), so the add_update_nit_ functions
now modify the correct element, instead of the penultimate one.  This
fixes the finding of other TS in NIT scan feature.

Signed-off-by: Rob Barker <robert.barker@redembedded.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
rc_keymaps: Add a keymap for the remote shipped with allwinner ba10 tv boxes

This is an unbranded remote found with unbranded allwinner a10 based android
tv boxes, which are referred to as ba10 tv boxes since the pcb is marked ba10
(the ba10 name is also used in u-boot and for the devicetree files).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
rc_keymaps: Add a keymap for the remote shipped with allwinner i12-a20 tv boxes

This is an unbranded remote found with unbranded allwinner a20 based android
tv boxes, which are referred to as i12 tv boxes since the pcb is marked i12
(the i12 name is also used in u-boot and for the devicetree files).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
rc_keymaps: Add keymap for the remote shipped with the Wobo i5 tv box

The Wobo i5 is an allwinner based android tv box, with its own custom remote,
this adds a keymap for this remote (like all allwinner devices, the wobo i5
can run plain Linux).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
v4l2-compliance: fix broken querymenu check.

QUERYMENU can also return -ENOTTY if it isn't implemented at all.
Allow for that.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
qv4l2: add support for the V4L2_EVENT_SOURCE_CHANGE event.

Subscribe to the V4L2_EVENT_SOURCE_CHANGE event. When such an event
arrives for the current input the application will call QUERYSTD or
QUERY_DV_TIMINGS to update the standard/timings.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
v4l2-compliance: don't warn about missing frameintervals

Only warn about missing ENUM_FRAMEINTERVALS support for discrete
framesizes, not for stepwise or continuous. Those framesize types
can be used as well for video receivers where ENUM_FRAMEINTERVALS
may not make sense.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
libv4l2: release the lock before doing a DQBUF

In blocking mode, if there are no buffers available the DQBUF will block
waiting for a QBUF to be called but it will block holding the streaming
lock which will prevent any QBUF from happening, causing a deadlock.

Signed-off-by: Thiago Santos <ts.santos@sisa.samsung.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
v4l2-ctl: add support to try/set raw VBI formats

This was the last bit of missing functionality from v4l2-ctl, now that
this is in the full V4L2 API functionality is available through v4l2-ctl.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
libv4lconvert: Fix a regression when converting from Y10B

Fix a regression introduced in commit
efc29f1764a30808ebf7b3e1d9bfa27b909bf641 (libv4lconvert: Reject too
short source buffer before accessing it).

The old code:

case V4L2_PIX_FMT_Y10BPACK:
	...
	if (result == 0 && src_size < (width * height * 10 / 8)) {
		V4LCONVERT_ERR("short y10b data frame\n");
		errno = EPIPE;
		result = -1;
	}
	...

meant to say "If the conversion was *successful* _but_ the frame size
was invalid, then take the error path", but in
efc29f1764a30808ebf7b3e1d9bfa27b909bf641 this (maybe weird) logic was
misunderstood and v4lconvert_convert_pixfmt() was made to return an
error even in the case of a successful conversion from Y10B.

Drop the no longer needed second check to fix this.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Cc: Gregor Jasny <gjasny@googlemail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
media-ctl: libv4l2subdev: Add DV timings support

Expose the pad-level get caps, query, get and set DV timings ioctls.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
media-ctl: Move flags printing code to a new print_flags function

This will allow reusing the flag printing code for the DV timings flags.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
media-ctl: Add DV timings support

Support printing (with -p) and setting (with --set-dv) DV timings at the
pad level.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Update sync-with-kernel to use installed kernel headers

Kernel headers exported to userspace can contain kernel-specific
statements (such as __user annotations) that are removed when installing
the headers with 'make headers_install' in the kernel sources. Only
those headers must be used by userspace, raw headers are private to the
kernel.

Update the sync-with-kernel make target to use the installed headers.
The user must install the kernel headers by running

	make headers_install

in KERNEL_DIR prior to run sync-with-kernel.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
wip
media-ctl: Pass a positive error value to strerror()

Negative error values are passed to the strerror() function which takes
positive error value arguments. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
v4lgrab/vbi-test: remove these utilities

v4lgrab doesn't work anymore since the v4l1 compat layer has been
removed a long time ago.

vbi-test has been replaced by v4l2-ctl --get-fmt-vbi and serves no good
purpose anymore.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
qv4l2-qt3: remove utility

qv4l2-qt3 has been superseded by qv4l2. Nobody uses Qt3 anymore and this
qt3 version of qv4l2 hasn't been maintained for a long time. Time to
retire it.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
qv4l2: fix opengl support for RGB32/BGR32.

For whatever reason the GL_RGBA4 internal format was used instead of
GL_RGB8, so each color component was just 4 bits instead of 8.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>