platform/upstream/v4l-utils.git
10 years agoFix desc_frequency_list descriptor
Mauro Carvalho Chehab [Sun, 17 Nov 2013 22:40:38 +0000 (20:40 -0200)]
Fix desc_frequency_list descriptor

This descriptor is commented. Fix it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5/dvb-file: fix parameters for dvb_vchannel()
Mauro Carvalho Chehab [Sun, 17 Nov 2013 21:58:12 +0000 (19:58 -0200)]
libdvbv5/dvb-file: fix parameters for dvb_vchannel()

Passed parameters were wrong. Fix them.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5/dvb-file: fix allocation of dvb_file
Mauro Carvalho Chehab [Sun, 17 Nov 2013 21:31:55 +0000 (19:31 -0200)]
libdvbv5/dvb-file: fix allocation of dvb_file

Correct a few allocation issues reported by Valgrind:

- Size of dvb_file is wrong;
- getline requires a free after end using it;
- entries should be freed at dvb_file_free().

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5/dvb-file: use the new descriptors for virtual channel
Mauro Carvalho Chehab [Sun, 17 Nov 2013 20:35:40 +0000 (18:35 -0200)]
libdvbv5/dvb-file: use the new descriptors for virtual channel

Search for the LCN and TS info descriptors at the NIT table, for
the virtual channel information.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: produce dvb data from the new structures
Mauro Carvalho Chehab [Sun, 17 Nov 2013 15:49:44 +0000 (13:49 -0200)]
libdvbv5: produce dvb data from the new structures

Now that dvb-scan uses the new descriptor structures, convert
dvb-file to rely on them to produce the scanned file data.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5/dvb-scan-table-handler: remove free of unallocated structs
Mauro Carvalho Chehab [Sun, 17 Nov 2013 12:55:44 +0000 (10:55 -0200)]
libdvbv5/dvb-scan-table-handler: remove free of unallocated structs

While those old structs are still part of struct dvb_v5_descriptors,
they are not allocated anymore. So, we don't need to fix them. Get
rid of those structs.

We can't remove them from the main struct yet, as dvb-file and
dvbv5-scan still use.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5/dvb-scan: fix memory leak
Mauro Carvalho Chehab [Sun, 17 Nov 2013 12:51:03 +0000 (10:51 -0200)]
libdvbv5/dvb-scan: fix memory leak

As pointed by Valgrind, there are still some memory leaks at
dvb_get_ts_tables().

That happens because pmt is allocated by dvb_read_section().
Fix it.

While here, fix the error condition to not mangle with the main
dvb_scan_handler->program pointer.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5/descriptors: descriptors data should always be freed
Mauro Carvalho Chehab [Sun, 17 Nov 2013 11:31:00 +0000 (09:31 -0200)]
libdvbv5/descriptors: descriptors data should always be freed

It is up to each descriptor's free function to free data allocated
during its init phase. However, the container of the descriptor
itself was allocated by dvb_parse_descriptors(). So, it should be
up to dvb_free_descriptors() to deallocate.

This error was detected by Valgrind.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5/dvb-fe: make valgrind happy
Mauro Carvalho Chehab [Sun, 17 Nov 2013 11:18:25 +0000 (09:18 -0200)]
libdvbv5/dvb-fe: make valgrind happy

clean prop before using it. This makes valgrind happy.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Better handle program data
Mauro Carvalho Chehab [Sun, 17 Nov 2013 11:13:35 +0000 (09:13 -0200)]
libdvbv5: Better handle program data

Program data tables (pmt) are associated with the program
inside the pat table.

Keep that association, in order to make life easier for scanning
programs that may need it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Add some missing code to free data
Mauro Carvalho Chehab [Sat, 16 Nov 2013 11:39:12 +0000 (09:39 -0200)]
libdvbv5: Add some missing code to free data

On some descriptors that I added recently, the free function
is missing, causing memory leak.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5/dvb-scan-table-handler:free the new table descriptors
Mauro Carvalho Chehab [Sat, 16 Nov 2013 11:10:20 +0000 (09:10 -0200)]
libdvbv5/dvb-scan-table-handler:free the new table descriptors

Free memory for the table descriptors.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: avoid playing with memory
Mauro Carvalho Chehab [Sat, 16 Nov 2013 10:56:08 +0000 (08:56 -0200)]
libdvbv5: avoid playing with memory

Instead of reallocating the memory size for every single table,
just use the known size of the structure, as this is fixed.

The pat table here is an special case, due to the way its struct
is mapped. It is probably a good idea to use malloc there for the
struct dvb_table_pat_program program, but this would break compatibility
with libdvbv5 apps. So, let's keep it as-is.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: add suport for DVB-T2 delivery descriptor
Mauro Carvalho Chehab [Fri, 15 Nov 2013 20:35:06 +0000 (18:35 -0200)]
libdvbv5: add suport for DVB-T2 delivery descriptor

ETSI EN 300 468 V1.11.1 defines an special descriptor for DVB-T2.
Add support for it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Add support for partial reception
Mauro Carvalho Chehab [Fri, 15 Nov 2013 19:43:54 +0000 (17:43 -0200)]
libdvbv5: Add support for partial reception

Partial reception is a feature for ISDB streams. Add support for
its descriptor.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Add descriptors for virtual channel number
Mauro Carvalho Chehab [Fri, 15 Nov 2013 19:15:39 +0000 (17:15 -0200)]
libdvbv5: Add descriptors for virtual channel number

Those descriptors are present in some european countries and
in Brazil.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: add parser for TS information descriptor
Mauro Carvalho Chehab [Fri, 15 Nov 2013 18:27:20 +0000 (16:27 -0200)]
libdvbv5: add parser for TS information descriptor

This descriptor is used on ISDB-T.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: add support for ISDBT terrestrial system descriptor
Mauro Carvalho Chehab [Fri, 15 Nov 2013 14:38:03 +0000 (12:38 -0200)]
libdvbv5: add support for ISDBT terrestrial system descriptor

This descriptor contains the frequency tables on ISDB-T.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5/descriptors: Make easier to read/edit the descriptors table
Mauro Carvalho Chehab [Fri, 15 Nov 2013 13:32:57 +0000 (11:32 -0200)]
libdvbv5/descriptors: Make easier to read/edit the descriptors table

Instead of one big line per descriptor, break it into several lines.

This was generated by this script:

cat lib/libdvbv5/descriptors.c |perl -ne 's/(\[.*\]\s*\=\s*\{)\s*([^\,]+)\,\s*([^\,]+)\,\s*([^\,]+)\,\s*([^\,]+)\,\s*(.*)\s+(\}\,)/$1\n\t\t.name  = $2,\n\t\t.init  = $3,\n\t\t.print = $4,\n\t\t.free  = $5\n\t\t.size  = $6,\n\t$7/g; print $_' >a && mv a lib/libdvbv5/descriptors.c
cat lib/libdvbv5/descriptors/desc_extension.c |perl -ne 's/(\[.*\]\s*\=\s*\{)\s*([^\,]+)\,\s*([^\,]+)\,\s*([^\,]+)\,\s*([^\,]+)\,\s*(.*)\s+(\}\,)/$1\n\t\t.name  = $2,\n\t\t.init  = $3,\n\t\t.print = $4,\n\t\t.free  = $5\n\t\t.size  = $6,\n\t$7/g; print $_' >a && mv a lib/libdvbv5/descriptors/desc_extension.c

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agodescriptors/nit: byte struct should be packed
Mauro Carvalho Chehab [Fri, 15 Nov 2013 12:44:27 +0000 (10:44 -0200)]
descriptors/nit: byte struct should be packed

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5/descriptors: print descriptor number in hexadecimal
Mauro Carvalho Chehab [Fri, 15 Nov 2013 12:42:20 +0000 (10:42 -0200)]
libdvbv5/descriptors: print descriptor number in hexadecimal

Descriptors are tabled in hexadecimal. Put them in this format,
to make easier to compare with DTV and MPEG tables.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: better handle memory errors
Mauro Carvalho Chehab [Fri, 15 Nov 2013 12:29:54 +0000 (10:29 -0200)]
libdvbv5: better handle memory errors

Avoid the risk of filling past of the buffers, by checking i
are there any space available before filling the buffers.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5/parse_string: don't free twice
Mauro Carvalho Chehab [Fri, 15 Nov 2013 12:27:13 +0000 (10:27 -0200)]
libdvbv5/parse_string: don't free twice

As reported by valgrind, sometimes, it was freeing the same
data twice, with was causing random troubles elsewhere.

Fix it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5/dvb-scan: Fix a series of checks at buffer handling
Mauro Carvalho Chehab [Fri, 15 Nov 2013 11:18:43 +0000 (09:18 -0200)]
libdvbv5/dvb-scan: Fix a series of checks at buffer handling

The logic inside dvb_read_section_with_id() is rather complex,
as the same buffer is de-allocated/re-allocated multiple times.

Simplify it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5/dvb-scan: be more verbose in debug mode
Mauro Carvalho Chehab [Fri, 15 Nov 2013 10:54:43 +0000 (08:54 -0200)]
libdvbv5/dvb-scan: be more verbose in debug mode

That helps to know what's happening, especially when there are
some crashes on it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5/dvb-scan: handle allocation errors
Mauro Carvalho Chehab [Fri, 15 Nov 2013 10:54:33 +0000 (08:54 -0200)]
libdvbv5/dvb-scan: handle allocation errors

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Add a parser for extension descriptors
Mauro Carvalho Chehab [Thu, 14 Nov 2013 02:57:00 +0000 (00:57 -0200)]
libdvbv5: Add a parser for extension descriptors

There are some descriptors that are extensions, e. g. they
use a new descriptor range.

Add support for them, as the DVB-T2 table is one of such
extensions.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: fixup parsing of PMT tables
Mauro Carvalho Chehab [Thu, 14 Nov 2013 02:11:50 +0000 (00:11 -0200)]
libdvbv5: fixup parsing of PMT tables

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: move all tables structs to the handler data
Mauro Carvalho Chehab [Thu, 14 Nov 2013 01:29:26 +0000 (23:29 -0200)]
libdvbv5: move all tables structs to the handler data

As we'll use the data there, move everything parsed from
the MPEG TS tables into struct dvb_v5_descriptors.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: move handler code to a separate file
Mauro Carvalho Chehab [Thu, 14 Nov 2013 01:13:15 +0000 (23:13 -0200)]
libdvbv5: move handler code to a separate file

Move the functions that allocate/deallocate memory for the
DVB scan description data to a separate file, and better
name them, to avoid confusion with the dvb_desc used
inside the descriptors parsing API.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: move DVB scan handler code to a separate file
Mauro Carvalho Chehab [Thu, 14 Nov 2013 00:54:13 +0000 (22:54 -0200)]
libdvbv5: move DVB scan handler code to a separate file

This were polluting the DVB descriptors API. They don't belong
to it anymore, with the new descriptors parsing code.

Move to a separate file.

It should be noticed that, right now, the DVB scan code is
not producing a valid scan file anymore, as those structs are
not properly initialized.

Latter patches will fix that.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5/dvb-scan: Modify to use the newer TS tables parser
Mauro Carvalho Chehab [Thu, 14 Nov 2013 00:26:44 +0000 (22:26 -0200)]
libdvbv5/dvb-scan: Modify to use the newer TS tables parser

This code has an incomplete MPEG TS tables parser.

Also, it is not endiannes-aware.

Replace it by the newer one.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Add table ID of extra NIT/SDT tables
Mauro Carvalho Chehab [Thu, 14 Nov 2013 00:21:42 +0000 (22:21 -0200)]
libdvbv5: Add table ID of extra NIT/SDT tables

At least on dvb-apps, those two extra table IDs are present.
Add there at the header files, for completeness.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Fix compiler warning about signedness
Gregor Jasny [Tue, 19 Nov 2013 21:46:02 +0000 (22:46 +0100)]
libdvbv5: Fix compiler warning about signedness

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
10 years agobuildsystem: Fix configure.ac --disable-v4l-utils option
Alain VOLMAT [Tue, 19 Nov 2013 13:28:27 +0000 (14:28 +0100)]
buildsystem: Fix configure.ac --disable-v4l-utils option

When using AC_ARG_ENABLE with a string containing - in it, the variable created will contains a _ instead of the -.
Thus for AC_ARG_ENABLE(v4l-utils ..., the variable enable_v4l_utils must be checked.

Signed-off-by: Alain Volmat <alain.volmat@st.com>
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
10 years agolibdvbv5: Add support for additional descriptors at VCT table
Mauro Carvalho Chehab [Wed, 13 Nov 2013 23:33:07 +0000 (21:33 -0200)]
libdvbv5: Add support for additional descriptors at VCT table

Document A/65:2009 allows extra descriptors at the Virtual
Channel Table.

While I don't have it on my test streams, it is better to
add support for it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: add parser for ATSC service location
Mauro Carvalho Chehab [Wed, 13 Nov 2013 22:08:08 +0000 (20:08 -0200)]
libdvbv5: add parser for ATSC service location

This is needed to properly parse TVCT and CVCT tables on
ATSC, as it contains the video/audio/program PIDs.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: Add ATSC specific descriptors
Mauro Carvalho Chehab [Wed, 13 Nov 2013 20:54:33 +0000 (18:54 -0200)]
libdvbv5: Add ATSC specific descriptors

Add the ATSC descriptors described at ATSC Document A/65:2009.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: fix VCT parsing
Mauro Carvalho Chehab [Wed, 13 Nov 2013 20:42:22 +0000 (18:42 -0200)]
libdvbv5: fix VCT parsing

While converting dvb-scan to use the new descriptors approach, I
was able to test the VCT table parsing. So, fix them. It should now
parse properly the ATSC CVCT/TVCT tables:

INFO     TVCT
INFO     | table_id       200
INFO     | section_length 154
INFO     | zero           0
INFO     | one            3
INFO     | zero2          1
INFO     | syntax         1
INFO     | id             1399
INFO     | current_next   1
INFO     | version        4
INFO     | one2           3
INFO     | section_id     0
INFO     | last_section   0
INFO     |- Protocol version 0
INFO     |- #channels        3
INFO     |\  channel_id
INFO     |- Channel                256.496: WMAR HD
INFO     |   modulation mode       8
INFO     |   carrier frequency     698000000
INFO     |   TS ID                 1399
INFO     |   program number        2
INFO     |   ETM location          0
INFO     |   access controlled     0
INFO     |   hidden                0
INFO     |   hide guide            1
INFO     |   service type          2
INFO     |   source id            33
INFO     |                   Unknown descriptor (161)
INFO     |                       e0 21 02 02 e0 21 65 6e  67 81 e0 24 65 6e 67      .!...!eng..$eng
INFO     |- Channel                256.752: WMAR SD
INFO     |   modulation mode       8
INFO     |   carrier frequency     698000000
INFO     |   TS ID                 1399
INFO     |   program number        3
INFO     |   ETM location          0
INFO     |   access controlled     0
INFO     |   hidden                0
INFO     |   hide guide            1
INFO     |   service type          2
INFO     |   source id            49
INFO     |                   Unknown descriptor (161)
INFO     |                       e0 31 02 02 e0 31 65 6e  67 81 e0 34 65 6e 67      .1...1eng..4eng
INFO     |- Channel                256.1008: WMAR SD
INFO     |   modulation mode       8
INFO     |   carrier frequency     698000000
INFO     |   TS ID                 1399
INFO     |   program number        4
INFO     |   ETM location          0
INFO     |   access controlled     0
INFO     |   hidden                0
INFO     |   hide guide            1
INFO     |   service type          2
INFO     |   source id            65
INFO     |                   Unknown descriptor (161)
INFO     |                       e0 41 01 02 e0 41 65 6e  67                        .A...Aeng
INFO     |_  3 channels

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agolibdvbv5: add descriptor parser for ATSC TVCT/CVCT tables
Mauro Carvalho Chehab [Wed, 13 Nov 2013 17:22:26 +0000 (15:22 -0200)]
libdvbv5: add descriptor parser for ATSC TVCT/CVCT tables

Add parser code for ATSC Terrestrial/Cable Virtual Channel
Table.

Compile-tested only, as the current userspace tools don't use the
descriptors lib yet.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agodvbv5-scan: Allow using separate adapter for FE and demux
Mauro Carvalho Chehab [Mon, 11 Nov 2013 15:09:13 +0000 (13:09 -0200)]
dvbv5-scan: Allow using separate adapter for FE and demux

Complex embedded devices may have more than one adapter, and some
pipelines between them.

Allow specifying a different adapter for FE than the one for demux.

In order to use multiple adapters, the -a option should apeear
twice, each just before the frontend/demod option (-f and -d),
like:

dvbv5-scan -a 0 -f 0 -a 2 -d 2 some_scan_file

If only one -a (or --adapter) is found, the same adapter will
be used by both frontends and demuxes, and the -a can be on any
order at the command line. This way, it preserves backward
compatibility.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agov4l2-compliance: check that streaming will fail for overlays
Hans Verkuil [Mon, 4 Nov 2013 09:04:00 +0000 (10:04 +0100)]
v4l2-compliance: check that streaming will fail for overlays

Overlay buftypes do not support streaming. Check for this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agov4l2-compliance: check for invalid m2m + overlay caps
Hans Verkuil [Mon, 4 Nov 2013 09:02:31 +0000 (10:02 +0100)]
v4l2-compliance: check for invalid m2m + overlay caps

The m2m + overlay capabilities combination makes no sense. Check for that.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agobuildsystem: Use C99 by default
Gregor Jasny [Sun, 13 Oct 2013 11:36:49 +0000 (13:36 +0200)]
buildsystem: Use C99 by default

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
10 years agobuildsystem: Use autoconf variable for symbol visibility flag
Gregor Jasny [Sun, 13 Oct 2013 11:22:10 +0000 (13:22 +0200)]
buildsystem: Use autoconf variable for symbol visibility flag

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
10 years agobuildsystem: Do not specify library version for static libs
Gregor Jasny [Sun, 13 Oct 2013 11:17:53 +0000 (13:17 +0200)]
buildsystem: Do not specify library version for static libs

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
10 years agobuildsystem: use subdir-objects automake option as suggested by automake
Gregor Jasny [Sun, 13 Oct 2013 10:46:59 +0000 (12:46 +0200)]
buildsystem: use subdir-objects automake option as suggested by automake

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
10 years agoqv4l2: crop: take pixel aspect ratio into account.
Hans Verkuil [Fri, 4 Oct 2013 08:43:27 +0000 (10:43 +0200)]
qv4l2: crop: take pixel aspect ratio into account.

When cropping to a desired letterboxed/pillarboxed picture ratio you
need to take the pixel aspect ratio into account as well.

Also use 4.0/3.0 instead of 1.33 due to rounding errors (ditto for 1.57
and 1.78).

Finally the pillarbox ratio was calculated the wrong way around.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: Add cropping option to remove pillarbox
Baard Eirik Winther [Mon, 16 Sep 2013 09:06:52 +0000 (11:06 +0200)]
qv4l2: Add cropping option to remove pillarbox

Signed-off-by: Baard Eirik Winther <baard.e.winther@wintherstormer.no>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agov4l2-ctl: set b.num_planes to 1 for single plane output formats.
Hans Verkuil [Thu, 26 Sep 2013 09:32:41 +0000 (11:32 +0200)]
v4l2-ctl: set b.num_planes to 1 for single plane output formats.

For normal non-multiplanar output formats b.num_planes was never set to 1,
so fill_buffer_from_file() wouldn't actually read any data from a file, since
b.num_planes was uninitialized (usually 0).

The same situation for capture formats was handled correctly, it was only the
output that failed.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agov4l-utils: sync with latest kernel.
Hans Verkuil [Wed, 25 Sep 2013 11:16:59 +0000 (13:16 +0200)]
v4l-utils: sync with latest kernel.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agov4l2-ctl: properly close filehandles on error
Hans Verkuil [Mon, 23 Sep 2013 08:56:14 +0000 (10:56 +0200)]
v4l2-ctl: properly close filehandles on error

The capture and output filehandles weren't closed explicitly if an
error occurs.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agolibv4lconvert: Reject too short source buffer before accessing it
Gregor Jasny [Thu, 15 Aug 2013 20:40:39 +0000 (22:40 +0200)]
libv4lconvert: Reject too short source buffer before accessing it

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
10 years agolibv4lconvert: Support for RGB32 and BGR32 format
Ricardo Ribalda Delgado [Fri, 2 Aug 2013 22:42:52 +0000 (00:42 +0200)]
libv4lconvert: Support for RGB32 and BGR32 format

This patch adds support for V4L2_PIX_FMT_RGB32 and V4L2_PIX_FMT_BGR32
formats.

Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
10 years agolibv4lconvert: Support for Y16 pixel format
Ricardo Ribalda Delgado [Fri, 2 Aug 2013 22:42:51 +0000 (00:42 +0200)]
libv4lconvert: Support for Y16 pixel format

This patch adds support for V4L2_PIX_FMT_Y16 format.

Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
10 years agov4l2-ctl: fix '--set-dv-bt-timings query' option.
Hans Verkuil [Thu, 15 Aug 2013 12:50:38 +0000 (14:50 +0200)]
v4l2-ctl: fix '--set-dv-bt-timings query' option.

An earlier bug fix in parse_subopt broke the '--set-dv-bt-timings query' parsing.
The way it was parsed was also buggy, but the parse_subopt bug hid that.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agords-ctl: fix segfault in list_devices()
Hans Verkuil [Thu, 15 Aug 2013 08:29:22 +0000 (10:29 +0200)]
rds-ctl: fix segfault in list_devices()

You can't use files.erase() in list_devices, since if the last element
is removed, then the for-loop will still do a ++iter, which will cause
a segfault the next time iter is derefenced.

This situation happens if there are radio *transmitter* devices, which
do not support G_TUNER.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: call setFrame before resize to get correct frame size calculation
Hans Verkuil [Mon, 12 Aug 2013 08:36:22 +0000 (10:36 +0200)]
qv4l2: call setFrame before resize to get correct frame size calculation

Going from PAL to NTSC and back to PAL would cause an incorrect size
calculation since resize was called without the capture window being
informed about the new frame size.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: fix GeneralTab layout
Bård Eirik Winther [Fri, 9 Aug 2013 12:03:22 +0000 (12:03 +0000)]
qv4l2: fix GeneralTab layout

This moves the layout items for cropping, scaling and ALSA
to not interfere with driver specific controls.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: updated about window
Bård Eirik Winther [Fri, 9 Aug 2013 11:12:12 +0000 (11:12 +0000)]
qv4l2: updated about window

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: add manpage
Bård Eirik Winther [Fri, 9 Aug 2013 11:12:11 +0000 (11:12 +0000)]
qv4l2: add manpage

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: fix program input parameters
Bård Eirik Winther [Fri, 9 Aug 2013 11:12:10 +0000 (11:12 +0000)]
qv4l2: fix program input parameters

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: fix missing status tips
Bård Eirik Winther [Fri, 9 Aug 2013 11:12:09 +0000 (11:12 +0000)]
qv4l2: fix missing status tips

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: add cropping to CaptureWin and Qt render
Hans Verkuil [Mon, 12 Aug 2013 08:16:31 +0000 (10:16 +0200)]
qv4l2: add cropping to CaptureWin and Qt render

Allows for removal of letterboxes from common video formats.
The Qt renderer has been rewritten to increase performance required
when applying cropping. No longer uses memcpy.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
[hans.verkuil@cisco.com: fix crop calculation when cropcap is unsupported]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: change m_scaledFrame to m_scaledSize
Bård Eirik Winther [Fri, 9 Aug 2013 11:12:07 +0000 (11:12 +0000)]
qv4l2: change m_scaledFrame to m_scaledSize

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: add pixel aspect ratio support for CaptureWin
Bård Eirik Winther [Thu, 8 Aug 2013 11:31:27 +0000 (11:31 +0000)]
qv4l2: add pixel aspect ratio support for CaptureWin

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: add hotkey for reset scaling to frame size
Bård Eirik Winther [Thu, 8 Aug 2013 11:31:26 +0000 (11:31 +0000)]
qv4l2: add hotkey for reset scaling to frame size

Adds hotkey CTRL + F for both CaptureWin and main Capture menu.
Resets the scaling of CaptureWin to fit frame size.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: added resize to frame size in Capture menu
Bård Eirik Winther [Thu, 8 Aug 2013 11:31:25 +0000 (11:31 +0000)]
qv4l2: added resize to frame size in Capture menu

This will resize the CaptureWin to the original frame size.
It also works with maximized windows.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: add video scaling for CaptureWin
Bård Eirik Winther [Thu, 8 Aug 2013 11:31:24 +0000 (11:31 +0000)]
qv4l2: add video scaling for CaptureWin

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: create function getMargins
Bård Eirik Winther [Thu, 8 Aug 2013 11:31:23 +0000 (11:31 +0000)]
qv4l2: create function getMargins

Created a function to get the total margins (window frame) in pixels
outside the actual video frame beeing displayed.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: show frames option can be toggled during capture
Bård Eirik Winther [Thu, 8 Aug 2013 11:31:22 +0000 (11:31 +0000)]
qv4l2: show frames option can be toggled during capture

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: fix black screen with opengl after capture
Bård Eirik Winther [Thu, 8 Aug 2013 11:31:21 +0000 (11:31 +0000)]
qv4l2: fix black screen with opengl after capture

Fixes the issue when the window was beeing resized/moved
and the frame image would become black.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: fix YUY2 shader
Bård Eirik Winther [Thu, 8 Aug 2013 11:31:20 +0000 (11:31 +0000)]
qv4l2: fix YUY2 shader

Fixed the YUY2 shaders to support scaling.
The new solution has cleaner shader code and texture upload
uses a better format for OpenGL.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: generalized opengl include guards
Bård Eirik Winther [Thu, 8 Aug 2013 11:31:19 +0000 (11:31 +0000)]
qv4l2: generalized opengl include guards

Created a general QtGL makefile condition and using config.h
to check in code if QtGL is present.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoRevert "qv4l2: fix YUY2 shader"
Hans Verkuil [Thu, 8 Aug 2013 11:51:33 +0000 (13:51 +0200)]
Revert "qv4l2: fix YUY2 shader"

This reverts commit bd0acd541929d4bbdd52a96791cdd01fe71b087f.

I unfortunately merged the wrong patch series, so all 7 patches are now
reverted.

10 years agoRevert "qv4l2: fix black screen with opengl after capture"
Hans Verkuil [Thu, 8 Aug 2013 11:51:28 +0000 (13:51 +0200)]
Revert "qv4l2: fix black screen with opengl after capture"

This reverts commit 5c1ee0137709ea1091c108ad771cf1a7c5b8a267.

10 years agoRevert "qv4l2: show frames option can be toggled during capture"
Hans Verkuil [Thu, 8 Aug 2013 11:51:22 +0000 (13:51 +0200)]
Revert "qv4l2: show frames option can be toggled during capture"

This reverts commit d8310e6898578807a5fb60e347084514c3b10ded.

10 years agoRevert "qv4l2: add function getMargins"
Hans Verkuil [Thu, 8 Aug 2013 11:51:12 +0000 (13:51 +0200)]
Revert "qv4l2: add function getMargins"

This reverts commit 603229f177942d47f9de3fcfb748143ec8a8fb92.

10 years agoRevert "qv4l2: add video scaling for CaptureWin"
Hans Verkuil [Thu, 8 Aug 2013 11:51:04 +0000 (13:51 +0200)]
Revert "qv4l2: add video scaling for CaptureWin"

This reverts commit 5c4ae96417ef434444d8bf93a0b135d0d5aa9013.

10 years agoRevert "qv4l2: add hotkey for reset scaling to frame size"
Hans Verkuil [Thu, 8 Aug 2013 11:50:57 +0000 (13:50 +0200)]
Revert "qv4l2: add hotkey for reset scaling to frame size"

This reverts commit 2171fb34bca67004e843c6b6ae4cf2be809f0315.

10 years agoRevert "qv4l2: add aspect ratio support"
Hans Verkuil [Thu, 8 Aug 2013 11:50:46 +0000 (13:50 +0200)]
Revert "qv4l2: add aspect ratio support"

This reverts commit 6b6a5ec8e0b1caa9f4f87b4aa7397b869bdd6f69.

10 years agoqv4l2: add aspect ratio support
Bård Eirik Winther [Mon, 5 Aug 2013 07:56:57 +0000 (07:56 +0000)]
qv4l2: add aspect ratio support

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: add hotkey for reset scaling to frame size
Bård Eirik Winther [Mon, 5 Aug 2013 07:56:56 +0000 (07:56 +0000)]
qv4l2: add hotkey for reset scaling to frame size

Adds hotkey CTRL + F for both CaptureWin and main Capture menu.
Resets the scaling of CaptureWin to fit frame size.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: add video scaling for CaptureWin
Bård Eirik Winther [Mon, 5 Aug 2013 07:56:55 +0000 (07:56 +0000)]
qv4l2: add video scaling for CaptureWin

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: add function getMargins
Bård Eirik Winther [Mon, 5 Aug 2013 07:56:54 +0000 (07:56 +0000)]
qv4l2: add function getMargins

Created a function to get the total margins (window frame) in pixels
outside the actual video frame beeing displayed.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: show frames option can be toggled during capture
Bård Eirik Winther [Mon, 5 Aug 2013 07:56:53 +0000 (07:56 +0000)]
qv4l2: show frames option can be toggled during capture

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: fix black screen with opengl after capture
Bård Eirik Winther [Mon, 5 Aug 2013 07:56:52 +0000 (07:56 +0000)]
qv4l2: fix black screen with opengl after capture

Fixes the issue when the window was beeing resized/moved
and the frame image would become black.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: fix YUY2 shader
Bård Eirik Winther [Mon, 5 Aug 2013 07:56:51 +0000 (07:56 +0000)]
qv4l2: fix YUY2 shader

Fixed the YUY2 shaders to support scaling.
The new solution has cleaner shader code and texture upload
uses a better format for OpenGL.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: add ALSA audio playback
Bård Eirik Winther [Tue, 6 Aug 2013 09:18:46 +0000 (09:18 +0000)]
qv4l2: add ALSA audio playback

The qv4l2 test utility now supports ALSA playback of audio.
This allows for PCM playback during capture for supported devices.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: add ALSA stream to qv4l2
Bård Eirik Winther [Tue, 6 Aug 2013 09:18:45 +0000 (09:18 +0000)]
qv4l2: add ALSA stream to qv4l2

Changes the ALSA streaming code to work with qv4l2 and allows it to
be compiled in. qv4l2 does not use the streaming function yet.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: fix a bug where the alsa thread never stops
Bård Eirik Winther [Tue, 6 Aug 2013 09:18:44 +0000 (09:18 +0000)]
qv4l2: fix a bug where the alsa thread never stops

If the output audio device never read the buffer then the alsa thread
would continue to fill it up and never stop when the capture stops.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: new ALSA stream source code
Bård Eirik Winther [Tue, 6 Aug 2013 09:18:43 +0000 (09:18 +0000)]
qv4l2: new ALSA stream source code

Code copied from xawtv3

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: alter capture menu
Bård Eirik Winther [Tue, 6 Aug 2013 09:18:42 +0000 (09:18 +0000)]
qv4l2: alter capture menu

Corrected Use OpenGL Render to Rendering and removed the separation line.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: fix a segfault for native 32 bpp formats
Hans Verkuil [Sat, 3 Aug 2013 13:27:06 +0000 (15:27 +0200)]
qv4l2: fix a segfault for native 32 bpp formats

If the native image format is 32 bits per pixels, then the QImage that
provides the initial black image is too small since the QImage format was
fixed at 24 bpp.

Change it to 32 bpp for this particular corner case.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: add OpenGL rendering
Bård Eirik Winther [Tue, 30 Jul 2013 08:15:24 +0000 (10:15 +0200)]
qv4l2: add OpenGL rendering

Adds OpenGL-accelerated display of video.
This allows for using the graphics card to render
the video content to screen and to perform color space conversion.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: new modular capture window design
Bård Eirik Winther [Tue, 30 Jul 2013 08:15:23 +0000 (10:15 +0200)]
qv4l2: new modular capture window design

The display of video has been divided into classes to
easier implement other ways to render frames on screen.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: add Capture menu
Bård Eirik Winther [Tue, 30 Jul 2013 08:15:22 +0000 (10:15 +0200)]
qv4l2: add Capture menu

Created a new Capture menu that contains both capture controls and audio/video settings for capture.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: fix minimum size in capture win to frame size
Bård Eirik Winther [Tue, 30 Jul 2013 08:15:21 +0000 (10:15 +0200)]
qv4l2: fix minimum size in capture win to frame size

CaptureWin's setMinimumSize() sets the minimum size for the video frame viewport
and not for the window itself. If the minimum size is larger than the monitor resolution,
it will reduce the minimum size to match this.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: add hotkeys for common operations
Bård Eirik Winther [Tue, 30 Jul 2013 08:15:20 +0000 (10:15 +0200)]
qv4l2: add hotkeys for common operations

CTRL + V : When main window is selected start capture.
           This gives an option other than the button to start recording,
           as this is a frequent operation when using the utility.
CTRL + W : When CaptureWin is selected close capture window
           It makes it easier to deal with high resolutions video on
           small screen, especially when the window close button may
           be outside the monitor when repositioning the window.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
10 years agoqv4l2: move function ctrlEvent
Bård Eirik Winther [Tue, 30 Jul 2013 08:15:19 +0000 (10:15 +0200)]
qv4l2: move function ctrlEvent

Moved the ctrlEvent() function in qv4l2.cpp to be grouped with GUI function
and to group capFrame() and capVbiFrame() together.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>