libdvbv5: shared lib and installing headers

- move headers to subdirectory for correct install location
- fix includes in dvb table and descriptor parsers
- fix compile warnings

Signed-off-by: André Roth <neolynx@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
libdvbv5: remove header files from SOURCES in Makefile.am

The header files are not needed in the Makefile.am since
automake finds the dependencies automatically. This is not
needed for installing header files either.

Signed-off-by: André Roth <neolynx@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
libdvbv5: fix dvb_parse_descriptors and make dvb_desc_init private

- set list pointer to NULL in case of an error
- improve size checking
- dvb_desc_init is used only internal, remove from header

[m.chehab@samsung.com: revert the change from calloc() to malloc()]
Signed-off-by: André Roth <neolynx@gmail.com>

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
libdvbv5: add attribute packed to structs and unions

__attribute__((packed)) is needed for nested structs and
unions to get the correct size.

Signed-off-by: André Roth <neolynx@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
libdvbv5: add parser for CAT

Signed-off-by: André Roth <neolynx@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
libdvbv5: add parser for ca and ca_identifier descriptors

Signed-off-by: André Roth <neolynx@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
libdvbv5: fix PMT parser

- check for correct table ID
- parse all descriptos
- improve table printing

[m.chehab@samsung.com: fix the copyright line change]
Signed-off-by: André Roth <neolynx@gmail.com>

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
v4l2-compliance: add helper headers

In order to simplify working with single and multiple planar formats
these two helper headers were created: v4l-helpers.h is the C version
and cv4l-helpers.h is a C++ version on top of v4l-helpers.h.

For now this will only be used in v4l2-compliance, but the intention
is to use it elsewhere as well eventually.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
v4l2-compliance: use the new cv4l-helpers.h header.

This hides most of the single/multi planar differences, thus making it
easier to write test-cases.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
v4l2-compliance: m2m devices should have only one input and output

It makes no sense to have multiple inputs and outputs for a m2m device.
Check for this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
v4l2-compliance: test control/format/codec ioctls for all inputs/outputs

Different inputs or outputs can support different controls, formats and codec
ioctls. So iterate over all inputs/outputs to test this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
qv4l2: add support for V4L2_PIX_FMT_NV16M/61M

Add support for the NV16M and NV61M planar YUV 4:2:2 formats.

This is not the prettiest code. Once the (c)v4l-helpers.h are more
mature (particularly w.r.t. the v4l2-format handling) the qv4l2 code
will switch to that and that should greatly improve the code.

For now though it is good to have support for at least one multiplanar
format in qv4l2 to help testing the multiplanar API.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
v4l2-compliance: fix function pointer prototype.

There was a conflict between the mmap function pointer prototype of
struct v4l_fd and the actual function used. Make sure it is in sync
with the prototype of v4l2_mmap.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
libdvbv5: cleanup printing tables and descriptors

- log hex values where appropriate
- cleanup indents

Signed-off-by: André Roth <neolynx@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
libdvbv5: use DVB_DESC_HEADER macro in all descriptors

the first fields of a descriptor need to be the
type, length and the next pointer. in order to
prevent changing these fields by accident,
provide them in a macro.

Signed-off-by: André Roth <neolynx@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
libdvbv5: make dvb_desc_default_init and dvb_desc_default_print private

dvb_desc_default_init and dvb_desc_default_print are used
internaly only, remove them from the header file.
add extern "C" to the parser functions, so they can be used
from C++ directly.

Signed-off-by: André Roth <neolynx@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
libdvbv5: allow table parsers to get specific pointer to table struct

this will allow simplifying the parser functions and
to return the number of bytes read or an error code.

Signed-off-by: André Roth <neolynx@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
libdvbv5: descriptor parser return int

If parsing a descriptor fails, let the outside world know.
Returning 0 means success, negative values indicate a parsing
error.
Free allocated memory on error.

Signed-off-by: André Roth <neolynx@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
libdvbv5: remove unneeded includes

Signed-off-by: André Roth <neolynx@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
libdvbv5: fix lost ressource in atsc_eit

if the title of the EIT event is longer than the available data,
make sure the allocated buffer is not lost

Signed-off-by: André Roth <neolynx@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>