platform/upstream/v4l-utils.git
10 years agolibdvbv5: fix parsing of the default_value
Mauro Carvalho Chehab [Fri, 5 Sep 2014 02:46:14 +0000 (23:46 -0300)]
libdvbv5: fix parsing of the default_value

The parameters were wrong filled. Fix it. While here, add some
parenthesis at the expressions that check for it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoStop using the legacy name for PLP/MIS property
Mauro Carvalho Chehab [Fri, 5 Sep 2014 02:38:14 +0000 (23:38 -0300)]
Stop using the legacy name for PLP/MIS property

Use DTV_STREAM_ID instead of the legacy name.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Fix delivery system for channel on DVB-T2 format
Mauro Carvalho Chehab [Fri, 5 Sep 2014 02:22:45 +0000 (23:22 -0300)]
libdvbv5: Fix delivery system for channel on DVB-T2 format

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Add support for parsing DVB-T2 channel format
Mauro Carvalho Chehab [Fri, 5 Sep 2014 01:34:26 +0000 (22:34 -0300)]
libdvbv5: Add support for parsing DVB-T2 channel format

Some tables at dtv-scan-tables use T2 as a delimiter for
DVB-T2. Add support for it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: add support for optional MIS parameter
Mauro Carvalho Chehab [Fri, 5 Sep 2014 01:32:23 +0000 (22:32 -0300)]
libdvbv5: add support for optional MIS parameter

Some files at dtv-scan-tables have some optional fields.
The first one is part of the DVBv5 API. It is called
Multistream (MIS), and it is mapped as DTV_STREAM_ID
at the DVBv5 API.

Add support for it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: add support for optional parameters on oneline formats
Mauro Carvalho Chehab [Fri, 5 Sep 2014 01:27:58 +0000 (22:27 -0300)]
libdvbv5: add support for optional parameters on oneline formats

Some oneline formats have optional parameters. Add support
for them.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: remove some commented dead code
Mauro Carvalho Chehab [Fri, 5 Sep 2014 01:26:40 +0000 (22:26 -0300)]
libdvbv5: remove some commented dead code

There are some dead code at dvb-file.c. Remove them

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: only use emulated formats if the original one is not found
Mauro Carvalho Chehab [Fri, 5 Sep 2014 00:40:31 +0000 (21:40 -0300)]
libdvbv5: only use emulated formats if the original one is not found

Now that we've added DVB-S2 scan-s2 format, we want that the
format conversion tool to be able to write to that format too.

So, instead of emulating DVB-S channels, write them using
the new format.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Fix modulation formats for legacy channel on DVB-S2
Mauro Carvalho Chehab [Thu, 4 Sep 2014 22:49:36 +0000 (19:49 -0300)]
libdvbv5: Fix modulation formats for legacy channel on DVB-S2

DVB scan-s2 format uses a different names from the ones originally
defined. Fix it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: don't write polarization and user parms twice
Mauro Carvalho Chehab [Thu, 4 Sep 2014 21:41:00 +0000 (18:41 -0300)]
libdvbv5: don't write polarization and user parms twice

Currently, there are two loops printing user cmds. This is not
needed, and will just write duplicate values at the output.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: add support for parsing scan-s2 DVB-S2 channels
Mauro Carvalho Chehab [Thu, 4 Sep 2014 21:24:27 +0000 (18:24 -0300)]
libdvbv5: add support for parsing scan-s2 DVB-S2 channels

This format also specifies rolloff and modulation. Add
support for it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Improve parsing of dvb channel format
Mauro Carvalho Chehab [Thu, 4 Sep 2014 21:02:21 +0000 (18:02 -0300)]
libdvbv5: Improve parsing of dvb channel format

Some channel files also use tabs as delimiter, like
dvb-c/ch-GGA-Pratteln

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoCopy the vivid-tpg* sources from the kernel
Hans Verkuil [Wed, 3 Sep 2014 09:24:33 +0000 (11:24 +0200)]
Copy the vivid-tpg* sources from the kernel

This keeps the test pattern generator in v4l-utils in sync with the
tpg in the vivid kernel driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoAdd the generated lib/include/dvb-frontend.h to .gitignore
Hans Verkuil [Wed, 3 Sep 2014 09:23:44 +0000 (11:23 +0200)]
Add the generated lib/include/dvb-frontend.h to .gitignore

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agov4l-utils: sync-with-kernel
Hans Verkuil [Wed, 3 Sep 2014 09:15:21 +0000 (11:15 +0200)]
v4l-utils: sync-with-kernel

Update headers to the latest kernel version.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agov4l2-ctl/qv4l2: sync to latest vivid-tpg code
Hans Verkuil [Wed, 3 Sep 2014 09:14:10 +0000 (11:14 +0200)]
v4l2-ctl/qv4l2: sync to latest vivid-tpg code

This updates vivid-tpg to the latest kernel version.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agodvbv5-zap: close dvr_fd at the end of do_traffic_monitor()
Mauro Carvalho Chehab [Tue, 2 Sep 2014 01:48:22 +0000 (22:48 -0300)]
dvbv5-zap: close dvr_fd at the end of do_traffic_monitor()

As reported by Coverity:

685        close (fd);
CID 1054585 (#1-3 of 3): Resource leak (RESOURCE_LEAK)35. leaked_handle: Handle variable dvr_fd going out of scope leaks the handle.
686        return 0;
687}
688

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: add a missing return
Mauro Carvalho Chehab [Mon, 1 Sep 2014 23:39:45 +0000 (20:39 -0300)]
libdvbv5: add a missing return

Changeset 0097e30 fixed a Coverity bug that were causing a
memory leak in the case that the DVB dummy logic happens.
However, I forgot to add a return there, causing another
bug, also reported by Coverity:

*** CID 1233758:  Use after free  (USE_AFTER_FREE)
/lib/libdvbv5/descriptors.c: 81 in dvb_desc_default_print()
75     {
76      if (!parms) {
77      parms = dvb_fe_dummy();
78      dvb_hexdump(parms, "|           ", desc->data, desc->length);
79      free(parms);
80      }

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Allocate channel earlier
Mauro Carvalho Chehab [Mon, 1 Sep 2014 00:01:56 +0000 (21:01 -0300)]
libdvbv5: Allocate channel earlier

As reported by Coverity:

CID 1228897 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)14. var_deref_model: Passing null pointer channel to get_program_and_store, which dereferences it. [show details]
1129                        rc = get_program_and_store(parms, *dvb_file, dvb_scan_handler,
1130                                                   service_id, channel, NULL,
1131                                                   get_detected, get_nit);

Well, get_program_and_store() explicitly tests if channel is null or
not, but it does it too late.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Fix changeset 04accf23
Mauro Carvalho Chehab [Mon, 1 Sep 2014 00:06:40 +0000 (21:06 -0300)]
libdvbv5: Fix changeset 04accf23

The check for the array size is wrong. Fix it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Don't go past the size of dvb_v5_attr_names
Mauro Carvalho Chehab [Sun, 31 Aug 2014 23:57:51 +0000 (20:57 -0300)]
libdvbv5: Don't go past the size of dvb_v5_attr_names

As reported by Coverity:

4. cond_between: Checking cmd < 256 implies that cmd has the value which is between 0 and 255 (inclusive) on the true branch.
469        if (cmd >= 0 && cmd < DTV_USER_COMMAND_START)

CID 1054610 (#1 of 1): Out-of-bounds read (OVERRUN)5. overrun-local: Overrunning array dvb_v5_attr_names of 70 8-byte elements at element index 255 (byte offset 2040) using index cmd (which evaluates to 255).
470                return dvb_v5_attr_names[cmd];
471        else if (cmd >= 0 && cmd <= DTV_MAX_STAT_COMMAND)
472                return dvb_user_attr_names[cmd - DTV_USER_COMMAND_START];
473        return NULL;

This wouldn't be a problem if the function was just internal,
but this is part of the public functions.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Don't go past the size of dvb_v5_name
Mauro Carvalho Chehab [Sun, 31 Aug 2014 23:53:30 +0000 (20:53 -0300)]
libdvbv5: Don't go past the size of dvb_v5_name

As reported by Coverity:

4. cond_between: Checking cmd < 256 implies that cmd has the value which is between 0 and 255 (inclusive) on the true branch.
460        if (cmd >= 0 && cmd < DTV_USER_COMMAND_START)
CID 1054605 (#1 of 1): Out-of-bounds read (OVERRUN)5. overrun-local: Overrunning array dvb_v5_name of 71 8-byte elements at element index 255 (byte offset 2040) using index cmd (which evaluates to 255).
461                return dvb_v5_name[cmd];
462        else if (cmd >= 0 && cmd <= DTV_MAX_STAT_COMMAND)
463                return dvb_user_name[cmd - DTV_USER_COMMAND_START];
464        return NULL;

This wouldn't be a problem if the function was just internal,
but this is part of the public functions.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: reimplement the spaces filling logic
Mauro Carvalho Chehab [Sun, 31 Aug 2014 23:08:53 +0000 (20:08 -0300)]
libdvbv5: reimplement the spaces filling logic

Coverity doesn't like this construction:

1371 for (i = strlen(hex); i < 49; i++)
CID 1228899 (#1 of 1): Out-of-bounds access (OVERRUN)20. overrun-buffer-arg: Overrunning array spaces of 50 bytes by passing it to a function which accesses it at byte offset 50 using argument 50UL.
1372                        strncat(spaces, " ", sizeof(spaces));
1373                ascii[j] = '\0';
1374                dvb_loginfo("%s%s %s %s", prefix, hex, spaces, ascii);

Neither do I: strncat implementation is complex and have likely
a loop inside it, in order to find the end of the array. So, this
likely have O(n^2) complexity for no good reason.

Reimplement the logic. This should likely make coverty happy too.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: fix a memory leak at descriptors
Mauro Carvalho Chehab [Sun, 31 Aug 2014 22:55:12 +0000 (19:55 -0300)]
libdvbv5: fix a memory leak at descriptors

If we call dvb_fe_dummy(), we need to free it latter.

*** CID 1233565:  Resource leak  (RESOURCE_LEAK)
/lib/libdvbv5/descriptors.c: 79 in dvb_desc_default_print()
73
74     static void dvb_desc_default_print(struct dvb_v5_fe_parms *parms, const struct dvb_desc *desc)
75     {
76      if (!parms)
77      parms = dvb_fe_dummy();
78      dvb_hexdump(parms, "|           ", desc->data, desc->length);
>>>     CID 1233565:  Resource leak  (RESOURCE_LEAK)
>>>     Returning without freeing "parms" leaks the storage that it points to.
79     }
80

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Rename internally-defined poll function as dvb_poll
Mauro Carvalho Chehab [Sun, 31 Aug 2014 22:49:08 +0000 (19:49 -0300)]
libdvbv5: Rename internally-defined poll function as dvb_poll

poll() is the name of a glibc function. Rename it as dvb_poll().

That should likely fix a Coverity warning:

278      do {
>>>     CID 1233564:  Out-of-bounds access  (ARRAY_VS_SINGLETON)
>>>     Passing "&parms->p" to function "poll" which uses it as an array. This might corrupt or misinterpret adjacent memory locations. [Note: The source code implementation of the function has been overridden by a builtin model.]
279      available = poll(&parms->p, dmx_fd, timeout);
280      } while (available < 0 && errno == EOVERFLOW);

Also, as this function is static, use the private struct directly.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: add the private structure to the tree
Mauro Carvalho Chehab [Sat, 30 Aug 2014 20:29:06 +0000 (17:29 -0300)]
libdvbv5: add the private structure to the tree

Changeset b8c9e78 forgot to include dvb-fe-priv.h.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Add documentation for dvb-fe.h
Mauro Carvalho Chehab [Sat, 30 Aug 2014 20:22:03 +0000 (17:22 -0300)]
libdvbv5: Add documentation for dvb-fe.h

Add documentation for the functions and data structures that should
be used for DVB frontend setup with dvb-fe.h

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Fix return values for dvb_fe_get_event()
Mauro Carvalho Chehab [Sat, 30 Aug 2014 20:16:45 +0000 (17:16 -0300)]
libdvbv5: Fix return values for dvb_fe_get_event()

On most places at dvb-fe, the error values are positive
numbers. Fix it also at dvb_fe_get_event().

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Fix parameters dvb_add_parms_for_sys()
Mauro Carvalho Chehab [Sat, 30 Aug 2014 20:15:35 +0000 (17:15 -0300)]
libdvbv5: Fix parameters dvb_add_parms_for_sys()

The way this function is declared, userspace cannot
actually use, as the properties are opaque.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Properly document struct dvb_v5_fe_parms
Mauro Carvalho Chehab [Sat, 30 Aug 2014 18:18:32 +0000 (15:18 -0300)]
libdvbv5: Properly document struct dvb_v5_fe_parms

Now that all elements there are public, document the contents
of the structure.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: move internal parameters to a separate structure
Mauro Carvalho Chehab [Sat, 30 Aug 2014 16:41:32 +0000 (13:41 -0300)]
libdvbv5: move internal parameters to a separate structure

We don't want that struct dvb_v5_fe_parms size to change on
future versions of the API. Due to that, move all parameters
that shouldn't be visible to userspace into a private structure,
called struct dvb_v5_fe_parms_priv.

With this change, the dvb-fe will now allocate memory for the
private struct, but only the non-priv fields are visible at
the external structure.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Move charsets to be inside the parms struct
Mauro Carvalho Chehab [Sat, 30 Aug 2014 14:05:37 +0000 (11:05 -0300)]
libdvbv5: Move charsets to be inside the parms struct

Instead of using global vars and expose them to the library API,
move the charset definition to be part of the parms struct.

The default changesets can vary from Country to Country.

Also, the output changeset should match whatever is defined at
the system. So, applications may need to change them.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: be coherent with parse_string.h header
Mauro Carvalho Chehab [Sat, 30 Aug 2014 14:03:05 +0000 (11:03 -0300)]
libdvbv5: be coherent with parse_string.h header

This header is included on several places without being
used. Also, always use it with as <parse_string.h>.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agov4l2-compliance: require G/S_PRIORITY support for m2m devices
Hans Verkuil [Mon, 25 Aug 2014 12:53:47 +0000 (14:53 +0200)]
v4l2-compliance: require G/S_PRIORITY support for m2m devices

M2M devices didn't support G/S_PRIORITY in the past, but after a
recent kernel change they gained prio support. While that was
actually unintended I realized that it does make sense there as well
since it makes it possible for a filehandle to get exclusive access
to the M2M hardware. So drop the exception for M2M devices.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agolibdvbv5: Make dummy_fe static
Gregor Jasny [Sat, 23 Aug 2014 16:42:43 +0000 (13:42 -0300)]
libdvbv5: Make dummy_fe static

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Hide unused and unexposed cnr_to_qual_s tables
Gregor Jasny [Sat, 23 Aug 2014 16:42:41 +0000 (13:42 -0300)]
libdvbv5: Hide unused and unexposed cnr_to_qual_s tables

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Rename and hide charset definitions
Gregor Jasny [Sat, 23 Aug 2014 16:42:40 +0000 (13:42 -0300)]
libdvbv5: Rename and hide charset definitions

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Remove dvbsat_polarization_name (same as dvb_sat_pol_name)
Gregor Jasny [Sat, 23 Aug 2014 16:42:39 +0000 (13:42 -0300)]
libdvbv5: Remove dvbsat_polarization_name (same as dvb_sat_pol_name)

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoStart v4l-utils 1.3.91 development cycle
Gregor Jasny [Fri, 22 Aug 2014 15:41:30 +0000 (17:41 +0200)]
Start v4l-utils 1.3.91 development cycle

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
10 years agoPrepare for 1.3.90 release v4l-utils-1.3.90
Gregor Jasny [Fri, 22 Aug 2014 15:03:39 +0000 (17:03 +0200)]
Prepare for 1.3.90 release

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
10 years agoqv4l2: Clean up icon distribution list
Gregor Jasny [Fri, 22 Aug 2014 15:20:12 +0000 (17:20 +0200)]
qv4l2: Clean up icon distribution list

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
10 years agoqv4l2: reset bytesperline when changing pixelformat.
Hans Verkuil [Wed, 13 Aug 2014 14:20:19 +0000 (16:20 +0200)]
qv4l2: reset bytesperline when changing pixelformat.

When changing the width or the pixelformat, make sure to zero bytesperline
when setting the format to force the driver to recalculate bytesperline.

This was done for the width, but not the pixelformat.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: fix broken SDR support
Hans Verkuil [Mon, 11 Aug 2014 15:18:27 +0000 (17:18 +0200)]
qv4l2: fix broken SDR support

Commit fb1334e60cf2541c630e15c4883cd0eabf0581b5 broke the SDR support.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agov4l2-ctl/qv4l2: fix movement counter calculation
Hans Verkuil [Mon, 11 Aug 2014 14:06:17 +0000 (16:06 +0200)]
v4l2-ctl/qv4l2: fix movement counter calculation

The calculation that determines the 'scrolling' of the test pattern
could 'jump': the counters could become negative and taking the
modulus of a negative number doesn't always do what you expect.

Ensure that the step values are always positive to prevent this issue.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: allow '-d1' option
Hans Verkuil [Mon, 11 Aug 2014 13:25:35 +0000 (15:25 +0200)]
qv4l2: allow '-d1' option

The v4l2-ctl utility supports -d1 to select /dev/video1. qv4l2 requires
you to write '-d 1'. I do that wrong all the time, so now qv4l2 supports both
versions.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: fix audio looping
Hans Verkuil [Sun, 10 Aug 2014 11:02:07 +0000 (13:02 +0200)]
qv4l2: fix audio looping

The audio loopback never really works well with qv4l2. After comparing it
with the xawtv3 implementation it became clear that the core problem was
that the wrong alsa device was chosen as the capture device.

The alsa handling has been simplified and only 'hw' devices are shown as
this is what the alsa loop code wants. The "Show All Audio Devices" menu
option has been removed.

In addition, a bug was fixed for radio devices: no associated alsa device
was found and the 'Play' button was disabled, so the audio loop was never
started.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: fix segfault when openGL is not compiled in.
Hans Verkuil [Sat, 9 Aug 2014 09:36:33 +0000 (11:36 +0200)]
qv4l2: fix segfault when openGL is not compiled in.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agov4l2-compliance: reset control counters
Hans Verkuil [Fri, 8 Aug 2014 12:10:05 +0000 (14:10 +0200)]
v4l2-compliance: reset control counters

The controls are checked for every input, but the counters that count
the number of standard and private controls are not reset to 0 before
doing the check for the current input. This gave wrong control counts.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: Add option to enable linear scaling filter
Ove Brynestad [Fri, 8 Aug 2014 06:22:48 +0000 (08:22 +0200)]
qv4l2: Add option to enable linear scaling filter

New menu option to enable linear scaling filter when using OpenGL. Default is to
use nearest neighbour

Signed-off-by: Ove Brynestad <ovebryne@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: Fixed cropping bug
Ove Brynestad [Thu, 7 Aug 2014 10:58:39 +0000 (12:58 +0200)]
qv4l2: Fixed cropping bug

Pillar/letterboxing was assumed given by m_cropMethod, but is also depending on
pixelAspectRatio and frame aspect ratio

Signed-off-by: Ove Brynestad <ovebryne@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: refactored cropSize to deliver cropped size
Ove Brynestad [Mon, 4 Aug 2014 13:31:29 +0000 (15:31 +0200)]
qv4l2: refactored cropSize to deliver cropped size

cropFrameSize returned the delta between the full frame and the cropped frame
instead of just returning the cropped frame. This made the code hard to read,
so switch to returning the cropped frame.

Signed-off-by: Ove Brynestad <ovebryne@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agov4l2-compliance: allow EIO for control ioctls
Hans Verkuil [Fri, 8 Aug 2014 09:04:50 +0000 (11:04 +0200)]
v4l2-compliance: allow EIO for control ioctls

The uvc driver has to pass on the new control values to the hardware,
and that may not always accept the new value, even though it was
reported as within the valid range. In that case EIO is returned
and v4l2-compliance should accept that as a valid error code. It's
not the uvc driver's fault that there are many devices with crappy
firmware.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2/v4l2-ctl: add support for 14x9 video aspect ratio.
Hans Verkuil [Fri, 8 Aug 2014 08:34:26 +0000 (10:34 +0200)]
qv4l2/v4l2-ctl: add support for 14x9 video aspect ratio.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agov4l2-compliance: add test for S_EDID and the E2BIG corner case
Hans Verkuil [Fri, 8 Aug 2014 08:06:30 +0000 (10:06 +0200)]
v4l2-compliance: add test for S_EDID and the E2BIG corner case

If you try to write a larger EDID than the driver/hardware can handle,
the driver should return E2BIG and edid.blocks should be set to the
maximum number of blocks allowed.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: Adding width and height scaling to the status bar
Anton Arbring [Tue, 5 Aug 2014 13:38:27 +0000 (15:38 +0200)]
qv4l2: Adding width and height scaling to the status bar

Signed-off-by: Anton Arbring <aarbring@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: correct PAL pixel aspect values
Hans Verkuil [Wed, 6 Aug 2014 09:31:51 +0000 (11:31 +0200)]
qv4l2: correct PAL pixel aspect values

There are two almost-identical-but-not-quite possible pixel aspect
ratios in use for PAL: either 59:54 or 12:11. Since all our drivers
report 59:54 this is the one we should use in qv4l2 as well.

See also http://en.wikipedia.org/wiki/Pixel_aspect_ratio for more
information on why there are two competing pixel aspect ratios.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agov4l2-ctl/qv4l2: sync to latest vivid-tpg.c
Hans Verkuil [Wed, 6 Aug 2014 09:30:28 +0000 (11:30 +0200)]
v4l2-ctl/qv4l2: sync to latest vivid-tpg.c

Main change: the 16x9 widescreen vertical lines for PAL/NTSC have been
corrected.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: keep the "Controls" text
Hans Verkuil [Tue, 5 Aug 2014 09:14:20 +0000 (11:14 +0200)]
qv4l2: keep the "Controls" text

Don't chop off the "Controls" text in the tab name: it turns out that
leaving that off makes it hard to tell the difference between tabs
that are setup by qv4l2 and tabs that contain controls from the driver.

If someone can come up with a better way of doing this then that would
be welcome, but for now this is the best I can come up with.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: Removed bottom layout from capturewin
Anton Arbring [Mon, 4 Aug 2014 09:24:51 +0000 (11:24 +0200)]
qv4l2: Removed bottom layout from capturewin

The information shown can be seen in the status bar
of the main window. The eventfilter that shows the bottom
layout can also be percieved as annoying.

Signed-off-by: Anton Arbring <aarbring@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agolibv4l2: valgrind fixes
Hans Verkuil [Mon, 4 Aug 2014 07:22:50 +0000 (09:22 +0200)]
libv4l2: valgrind fixes

Initialize reserved fields and a v4l2_format struct.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: fix valgrind warnings
Hans Verkuil [Mon, 4 Aug 2014 07:21:08 +0000 (09:21 +0200)]
qv4l2: fix valgrind warnings

Mostly uninitialized fields, but there was also one inverted get_interval result
check.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: use "ADC Frequency" for SDR instead of just "Frequency"
Hans Verkuil [Wed, 30 Jul 2014 09:28:38 +0000 (11:28 +0200)]
qv4l2: use "ADC Frequency" for SDR instead of just "Frequency"

This makes it more obvious what is going on.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: zero m_tpgLimRGBRange when the device is closed
Hans Verkuil [Wed, 30 Jul 2014 07:34:05 +0000 (09:34 +0200)]
qv4l2: zero m_tpgLimRGBRange when the device is closed

The m_tpgLimRGBRange pointer was non-NULL when it shouldn't
be. Set it to NULL when the device is closed, that's the correct
place since after that it is invalid until a new device is opened.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agolibv4l2: Lazily allocate convert_mmap_buf
Gregor Jasny [Sat, 26 Jul 2014 19:36:16 +0000 (21:36 +0200)]
libv4l2: Lazily allocate convert_mmap_buf

From Hans de Goede:

Originally this was not possible, which is why I went with the fixed buffer
(IIRC). But later on we started dis-allowing changing various parameters
with buffers mapped, because allowing that was just a bad idea.

In order to allow dynamic allocation of convert_mmap_buf, we need to make
sure that:

a) It is not used whenever dest_fmt changes, since it is used
to store destination fmt data and should always be at least
dest_fmt.fmt.pix.sizeimage bytes. I've just checked and all
places which change dest_fmt first call v4l2_check_buffer_change_ok()
which ensures that convert_mmap_buf is not used, frees it and marks
it as MAP_FAILED.

b) It is not allocated before dest_fmt gets set. It is allocated in
2 places:

1) On DQBUF, which only can be done after a stream-on, at which point
dest_fmt must be set.

2) on v4l2_mmap, which requires the caller having done a QUERYBUF,
and thus a REQBUFS, so dest_fmt must be set at this point.

So long story short, yes doing dynamic alloc should work fine. I
suggest introducing a v4l2_ensure_convert_mmap_buf function for
this which checks if convert_mmap_buf == MAP_FAILED and when it
is allocs a buffer of dest_fmt.fmt.pix.sizeimage bytes rounded
up to a multiple PAGE_SIZE. If convert_mmap_buf != MAP_FAILED
and thus the buffer is already allocated it should simply
return success.

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
10 years agolibv4l-mplane: make it aware of the extended pix_format fields
Hans Verkuil [Fri, 25 Jul 2014 09:48:44 +0000 (11:48 +0200)]
libv4l-mplane: make it aware of the extended pix_format fields

The v4l2_pix_format struct has been extended with new fields. Let libv4l-mplane
make use of that so that the v4l2_pix_format_mplane 'flags' field can be reported
in v4l2_pix_format as well.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: convert the last direct ioctl calls to a cv4l-helper.
Hans Verkuil [Mon, 28 Jul 2014 14:21:56 +0000 (16:21 +0200)]
qv4l2: convert the last direct ioctl calls to a cv4l-helper.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years ago(c)v4l-helpers: fix broken tests for existence of ioctls.
Hans Verkuil [Mon, 28 Jul 2014 14:15:25 +0000 (16:15 +0200)]
(c)v4l-helpers: fix broken tests for existence of ioctls.

Instead of checking for success, check for a result != ENOTTY.

Unfortunately this will fail for kernels older than 3.1 when the
default return code for a non-existing ioctl was EINVAL. All I
can say is: upgrade your kernel, there is a reason EINVAL was a
bad idea...

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: missed one more place where QLineEdits were disabled.
Hans Verkuil [Sun, 27 Jul 2014 21:02:13 +0000 (23:02 +0200)]
qv4l2: missed one more place where QLineEdits were disabled.

Use setReadOnly instead for QLineEdit widgets.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: use setResdOnly for disabled QLineEdit controls
Hans Verkuil [Sun, 27 Jul 2014 20:27:07 +0000 (22:27 +0200)]
qv4l2: use setResdOnly for disabled QLineEdit controls

This allows you to copy-and-paste the text and to scroll through
it if the text is longer than the widget.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agolibv4l2rds: DI segment order was swapped
Hans Verkuil [Sun, 27 Jul 2014 19:31:16 +0000 (21:31 +0200)]
libv4l2rds: DI segment order was swapped

The segment number of bit 3 of the DI code is 0, increasing to segment
number 3 for bit 0. The code assumed segment S matched bit S, but it
is bit (3 - S) instead.

Very confusing choice in the standard, so I'm not surprised this was
broken.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agords-ctl: changes in the TA bit weren't detected.
Hans Verkuil [Sun, 27 Jul 2014 18:57:28 +0000 (20:57 +0200)]
rds-ctl: changes in the TA bit weren't detected.

If just the TA bit changed, then nothing was printed by rds-ctl.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: implement cropping and composing for video output.
Hans Verkuil [Sun, 27 Jul 2014 13:30:59 +0000 (15:30 +0200)]
qv4l2: implement cropping and composing for video output.

To simplify this work g/s_selection helper functions are added to the
helper headers that will fallback to S/G_CROP if necessary.

This patch also fixes a bug where the buffer field was never set when
generating a FIELD_ALTERNATE video output stream.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agov4l2-ctl: the field setting of the initially queued buffer is wrong.
Hans Verkuil [Sun, 27 Jul 2014 13:28:03 +0000 (15:28 +0200)]
v4l2-ctl: the field setting of the initially queued buffer is wrong.

buf.field was set to the next field instead of the current field.
Reordered the code to keep both buf.field and tpg_s_field in sync.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agov4l2-ctl/qv4l2: init mv_hor/vert_mode correctly.
Hans Verkuil [Sun, 27 Jul 2014 11:46:45 +0000 (13:46 +0200)]
v4l2-ctl/qv4l2: init mv_hor/vert_mode correctly.

Those fields were initialized to 0 instead of to TPG_MOVE_NONE.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agov4l2-ctl: --clear-bitmap or --clear-clips didn't actually clear it
Hans Verkuil [Sun, 27 Jul 2014 11:44:16 +0000 (13:44 +0200)]
v4l2-ctl: --clear-bitmap or --clear-clips didn't actually clear it

If --clear-bitmap or --clear-clips were combined with --set-fmt-overlay without
any other changes, then those options were ignored and VIDIOC_S_FMT was never
called. Add a check whether those options were defined to ensure S_FMT is
actually called.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoir-keytable.1: add XMP protocol at manpage
Mauro Carvalho Chehab [Sat, 26 Jul 2014 22:40:40 +0000 (19:40 -0300)]
ir-keytable.1: add XMP protocol at manpage

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years ago[v4l-utils] keytable: add support for XMP IR protocol
Marcel J.E. Mol [Sat, 26 Jul 2014 20:47:25 +0000 (17:47 -0300)]
[v4l-utils] keytable: add support for XMP IR protocol

Signed-off-by: Marcel Mol <marcel@mesa.nl>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: provide crc32 to c++
André Roth [Sun, 6 Jul 2014 18:20:30 +0000 (15:20 -0300)]
libdvbv5: provide crc32 to c++

allow C++ apps to use crc32

Signed-off-by: André Roth <neolynx@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years ago[libdvbv5] dvb-sat: add universal Ku band (extended) LNBF def
Reynaldo H. Verdejo Pinochet [Tue, 24 Jun 2014 21:35:40 +0000 (18:35 -0300)]
[libdvbv5] dvb-sat: add universal Ku band (extended) LNBF def

These are quite common and off the shelf, universal
Ku band LBNFs. They started been used in Europe
after the lunch of the Astra 1E and can be found
pretty much everywhere.

Signed-off-by: Reynaldo H. Verdejo Pinochet <r.verdejo@sisa.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoPrefix exported functions with dvb_
Gregor Jasny [Sun, 22 Jun 2014 12:49:47 +0000 (09:49 -0300)]
Prefix exported functions with dvb_

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoHide parse_string.h content in shared library interface
Gregor Jasny [Sun, 22 Jun 2014 12:49:46 +0000 (09:49 -0300)]
Hide parse_string.h content in shared library interface

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agov4l2grab: Add threaded producer/consumer option
Thiago Santos [Mon, 9 Jun 2014 13:51:55 +0000 (10:51 -0300)]
v4l2grab: Add threaded producer/consumer option

Adds options to allow the buffer dqbuf to happen on one thread while
the qbuf happens on another. This is useful to test concurrency access to
the v4l2 features. To enable this, 3 new options were added:

t: enable threaded mode (off by default and will use the loop)
b: enable blocking io mode (off by default
s: how much the consumer thread will sleep after reading a buffer, this is to
   simulate the time that it takes to process a buffer in a real application
   (in ms)

For example, you can simulate an application that takes 1s to process a buffer
with:

v4l2grab -t -b -s 1000

Signed-off-by: Thiago Santos <ts.santos@sisa.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agodescriptors.h: include <arpa/inet.h> for ntohs
Hans Verkuil [Sat, 26 Jul 2014 05:34:28 +0000 (07:34 +0200)]
descriptors.h: include <arpa/inet.h> for ntohs

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agov4l-utils: sync with latest kernel headers
Hans Verkuil [Sat, 26 Jul 2014 05:30:05 +0000 (07:30 +0200)]
v4l-utils: sync with latest kernel headers

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agov4l-utils: libdvbv5: fix compilation issue
Rob Barker [Thu, 29 May 2014 14:47:16 +0000 (11:47 -0300)]
v4l-utils: libdvbv5: fix compilation issue

Removed unnecessary header file to fix issue with some compilers.

Signed-off-by: Rob Barker <robert.barker@redembedded.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agokeytable: Mask selected protocols with the supported ones
Mauro Carvalho Chehab [Sat, 26 Jul 2014 02:02:00 +0000 (23:02 -0300)]
keytable: Mask selected protocols with the supported ones

It should never try to enable a protocol not supported, as
the Kernel will give an error and reset to none.

That's a problem when -p all option is used. So, mask the
protocols to make this option to work.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoparse_au0828.pl: fix I2C read payload
Mauro Carvalho Chehab [Sat, 26 Jul 2014 01:47:47 +0000 (22:47 -0300)]
parse_au0828.pl: fix I2C read payload

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agodvb-file: fix memory-deallocation bug
Mauro Carvalho Chehab [Sat, 26 Jul 2014 01:45:55 +0000 (22:45 -0300)]
dvb-file: fix memory-deallocation bug

channel should be a pointer, as it will be allocated internally,
otherwise we'll have a double de-allocation when freeing DVB
scan structures.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoparse_au0828.pl: Add a parser to help with au0828 debug
Mauro Carvalho Chehab [Sat, 26 Jul 2014 01:42:42 +0000 (22:42 -0300)]
parse_au0828.pl: Add a parser to help with au0828 debug

This parser is not 100%, but it properly handles the I2C
registers, making easier to understand the parsed logic.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agokeytable: add support for sharp and mce-kbd protocols
Mauro Carvalho Chehab [Sat, 26 Jul 2014 01:39:57 +0000 (22:39 -0300)]
keytable: add support for sharp and mce-kbd protocols

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoir-keytable: add the list of supported protocols at man page
Mauro Carvalho Chehab [Sat, 26 Jul 2014 01:25:05 +0000 (22:25 -0300)]
ir-keytable: add the list of supported protocols at man page

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agokeytable: add a way to add all protocols on raw decoders
Mauro Carvalho Chehab [Sat, 26 Jul 2014 01:21:00 +0000 (22:21 -0300)]
keytable: add a way to add all protocols on raw decoders

With raw decoders, sometimes it is interesting to be able to
select all decoders, as it helps to use a raw driver to test if
a given IR is producing scancodes.

Add "all" to the list of accepted protocols.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoqv4l2: add support for output video devices
Hans Verkuil [Fri, 25 Jul 2014 14:24:39 +0000 (16:24 +0200)]
qv4l2: add support for output video devices

Hook the test pattern generator into qv4l2, allowing it to be used
as a generator for video output devices. Careful attention has been
given to correct colorspace and RGB quantization handling.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoparse_usb.pl: fix handling of ./parse_tcpdump_log.pl logs
Mauro Carvalho Chehab [Fri, 25 Jul 2014 14:17:13 +0000 (11:17 -0300)]
parse_usb.pl: fix handling of ./parse_tcpdump_log.pl logs

The regex were not parsing right those logs. Fix it, and add
the timestamps to the dumps.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agov4l2-ctl: fix csc colorbar color pre-calculation
Hans Verkuil [Thu, 24 Jul 2014 12:37:54 +0000 (14:37 +0200)]
v4l2-ctl: fix csc colorbar color pre-calculation

Colors not belonging to the CSC colorbar should just be accepted as is.

The contrast color for the CSC colorbar should be suitable for CSC
conversion as well.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
10 years agoqv4l2: add SDR visualization.
Hans Verkuil [Wed, 23 Jul 2014 16:59:40 +0000 (18:59 +0200)]
qv4l2: add SDR visualization.

Just show a simple waveform of the first 1025 samples of the I and Q samples
in each captured buffer. It's simple but remarkably effective.

Currently only the CU8 format is supported.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agov4l2-ctl: upgrade to the latest version of the test pattern generator
Hans Verkuil [Wed, 23 Jul 2014 15:27:37 +0000 (17:27 +0200)]
v4l2-ctl: upgrade to the latest version of the test pattern generator

Very minor changes only, mostly a file rename, but this makes it easier
to keep things synchronized.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: fix layout issues related to stacked widgets
Hans Verkuil [Wed, 23 Jul 2014 13:47:50 +0000 (15:47 +0200)]
qv4l2: fix layout issues related to stacked widgets

I've been digging into why on my laptop the stacked frames in the Input section
appear shifted to the right.

The reason is that the initial loop in fixWidth() sets the minimumwidth
without looking at what the widget is. After some debugging I found out that it
was setting the minimumwidth for the wFrameSR widget.

So I added checks that it only changes it for comboboxes, spinboxes and sliders.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: fix querystd and query_dv_timings
Hans Verkuil [Wed, 23 Jul 2014 11:35:15 +0000 (13:35 +0200)]
qv4l2: fix querystd and query_dv_timings

Error messages in case of a missing signal were not displayed, and the
querystd return code check was inverted.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: support output devices
Hans Verkuil [Tue, 22 Jul 2014 11:29:28 +0000 (13:29 +0200)]
qv4l2: support output devices

Rework qv4l2 so that output devices (vbi and video out) are supported.

Also disable the streaming option for devices that do not support it.
This is (for now) also disabled for SDR since I don't know how to show
the captured SDR data in a meaningful way.

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