summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/Makefile19
-rw-r--r--v4l2-apps/COPYING356
-rw-r--r--v4l2-apps/INSTALL12
-rw-r--r--v4l2-apps/Make.rules48
-rw-r--r--v4l2-apps/Makefile8
-rw-r--r--v4l2-apps/README14
-rw-r--r--v4l2-apps/lib/COPYING.LIB510
-rw-r--r--v4l2-apps/lib/Makefile33
-rw-r--r--v4l2-apps/lib/frequencies.c1505
-rw-r--r--v4l2-apps/lib/v4l2.h45
-rw-r--r--v4l2-apps/test/Makefile20
-rw-r--r--v4l2-apps/test/ioctl-test.c (renamed from test/ioctl-test.c)5
-rw-r--r--v4l2-apps/test/sliced-vbi-detect.c (renamed from test/sliced-vbi-detect.c)2
-rw-r--r--v4l2-apps/test/sliced-vbi-test.c (renamed from test/sliced-vbi-test.c)2
-rw-r--r--v4l2-apps/test/v4lgrab.c (renamed from test/v4lgrab.c)212
-rw-r--r--v4l2-apps/test/vbi-test.c (renamed from test/vbi-test.c)0
-rw-r--r--v4l2-apps/util/Makefile22
-rw-r--r--v4l2-apps/util/qv4l2/ctrl-tab.cpp (renamed from test/qv4l2/qv4l2.cpp)356
-rw-r--r--v4l2-apps/util/qv4l2/fileopen.xpm (renamed from test/qv4l2/fileopen.xpm)0
-rw-r--r--v4l2-apps/util/qv4l2/general-tab.cpp326
-rw-r--r--v4l2-apps/util/qv4l2/general-tab.h71
-rw-r--r--v4l2-apps/util/qv4l2/qv4l2.cpp178
-rw-r--r--v4l2-apps/util/qv4l2/qv4l2.h (renamed from test/qv4l2/qv4l2.h)54
-rw-r--r--v4l2-apps/util/qv4l2/qv4l2.pro (renamed from test/qv4l2/qv4l2.pro)8
-rw-r--r--v4l2-apps/util/v4l2-ctl.cpp (renamed from test/v4l2-ctl.cpp)924
25 files changed, 4067 insertions, 663 deletions
diff --git a/test/Makefile b/test/Makefile
deleted file mode 100644
index 30c3edff6..000000000
--- a/test/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-FILES = ioctl-test sliced-vbi-test sliced-vbi-detect vbi-test v4lgrab v4l2-ctl
-CC = gcc
-LIBS =
-CFLAGS = -O3 -Wall -fomit-frame-pointer -funroll-loops -g -I ../linux/include
-CXXFLAGS = $(CFLAGS)
-LDFLAGS =
-
-all: $(FILES) qv4l2
-
-clean:
- -rm -f core core.[0123456789]* *~ *.o $(FILES)
- -if [ -f qv4l2/Makefile ]; then make -C qv4l2 $@; fi
- -rm -f qv4l2/qv4l2 qv4l2/Makefile
-
-qv4l2:
- if [ ! -f qv4l2/Makefile ]; then (cd qv4l2; qmake); fi
- make -C qv4l2
-
-.PHONY: qv4l2
diff --git a/v4l2-apps/COPYING b/v4l2-apps/COPYING
new file mode 100644
index 000000000..21ae0cda4
--- /dev/null
+++ b/v4l2-apps/COPYING
@@ -0,0 +1,356 @@
+
+ NOTE! This copyright does *not* cover user programs that use kernel
+ services by normal system calls - this is merely considered normal use
+ of the kernel, and does *not* fall under the heading of "derived work".
+ Also note that the GPL below is copyrighted by the Free Software
+ Foundation, but the instance of code that it refers to (the Linux
+ kernel) is copyrighted by me and others who actually wrote it.
+
+ Also note that the only valid version of the GPL as far as the kernel
+ is concerned is _this_ particular version of the license (ie v2, not
+ v2.2 or v3.x or whatever), unless explicitly otherwise stated.
+
+ Linus Torvalds
+
+----------------------------------------
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/v4l2-apps/INSTALL b/v4l2-apps/INSTALL
new file mode 100644
index 000000000..0645a076d
--- /dev/null
+++ b/v4l2-apps/INSTALL
@@ -0,0 +1,12 @@
+Building:
+
+simply type
+$ make
+
+Installing:
+
+$ make install
+installs libraries and utils to /usr/[bin,include,lib]
+
+$ make install prefix=<path>
+installs libraries and utils to <path>/[bin,include,lib]
diff --git a/v4l2-apps/Make.rules b/v4l2-apps/Make.rules
new file mode 100644
index 000000000..0b6a76e98
--- /dev/null
+++ b/v4l2-apps/Make.rules
@@ -0,0 +1,48 @@
+# dvb-apps common build rules
+
+ifeq ($(origin CC),default)
+CC := gcc
+endif
+export CC
+
+ifeq ($(origin CFLAGS),undefined)
+CFLAGS := -g -O1
+endif
+CFLAGS += -Wall -W -Wno-unused -Wshadow -Wpointer-arith -Wstrict-prototypes
+CFLAGS += -fPIC
+export CFLAGS
+
+ifeq ($(V),1)
+%.o: %.c
+ $(CC) -c -MMD $(CPPFLAGS) $(CFLAGS) -o $@ $<
+%: %.o
+ $(CC) $(LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@
+%: %.c
+ $(CC) -MMD $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(filter %.o %.c,$^) $(LOADLIBES) $(LDLIBS) -o $@
+%.so:
+ $(LD) -shared -o $@ $^
+%.a:
+ $(AR) rcs $@ $^
+else
+%.o: %.c
+ @echo CC $@
+ @$(CC) -c -MMD $(CPPFLAGS) $(CFLAGS) -o $@ $<
+%: %.o
+ @echo LD $@
+ @$(CC) $(LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@
+%: %.c
+ @echo CC $@
+ @$(CC) -MMD $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(filter %.o %.c,$^) $(LOADLIBES) $(LDLIBS) -o $@
+%.so:
+ @echo LD $@
+ @$(LD) -shared -o $@ $^
+%.a:
+ @echo AR $@
+ @$(AR) rcs $@ $^
+endif
+
+clean::
+ -rm -f core core.[0123456789]* *~ *.o
+ rm -f *.d
+
+-include *.d ...dummy
diff --git a/v4l2-apps/Makefile b/v4l2-apps/Makefile
new file mode 100644
index 000000000..fc7d21650
--- /dev/null
+++ b/v4l2-apps/Makefile
@@ -0,0 +1,8 @@
+# Makefile for linuxtv.org v4l2-apps
+
+.PHONY: all clean install
+
+all clean install:
+ $(MAKE) -C lib $@
+ $(MAKE) -C test $@
+ $(MAKE) -C util $@
diff --git a/v4l2-apps/README b/v4l2-apps/README
new file mode 100644
index 000000000..d8af644d0
--- /dev/null
+++ b/v4l2-apps/README
@@ -0,0 +1,14 @@
+linuxtv-v4l2-apps-0.0.1
+=======================
+
+Linux V4L2 API test/demo applications, utilities and library.
+
+You find a README in each subdirectory explaining what the code there does.
+
+The v4l2 library uses the GNU Lesser General Public License, all other code is
+released under the GNU General Public License.
+
+This code is still in its infancy and is not yet suitable for general
+use. However, it is a start.
+
+Hans Verkuil <hverkuil@xs4all.nl>
diff --git a/v4l2-apps/lib/COPYING.LIB b/v4l2-apps/lib/COPYING.LIB
new file mode 100644
index 000000000..1dd325d2b
--- /dev/null
+++ b/v4l2-apps/lib/COPYING.LIB
@@ -0,0 +1,510 @@
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations
+below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+^L
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it
+becomes a de-facto standard. To achieve this, non-free programs must
+be allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+^L
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control
+compilation and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+^L
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+^L
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at least
+ three years, to give the same user the materials specified in
+ Subsection 6a, above, for a charge no more than the cost of
+ performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+^L
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+^L
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply, and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License
+may add an explicit geographical distribution limitation excluding those
+countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+^L
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+^L
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms
+of the ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library.
+It is safest to attach them to the start of each source file to most
+effectively convey the exclusion of warranty; and each file should
+have at least the "copyright" line and a pointer to where the full
+notice is found.
+
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or
+your school, if any, to sign a "copyright disclaimer" for the library,
+if necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James
+ Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/v4l2-apps/lib/Makefile b/v4l2-apps/lib/Makefile
new file mode 100644
index 000000000..a69615bdc
--- /dev/null
+++ b/v4l2-apps/lib/Makefile
@@ -0,0 +1,33 @@
+# Makefile for linuxtv.org v4l2-apps/lib
+
+CPPFLAGS += -I../../linux/include -I..
+
+includes = v4l2.h
+
+objects = frequencies.o
+
+sharedlib = libv4l2.so
+staticlib = libv4l2.a
+
+ifeq ($(prefix),)
+prefix = /usr
+endif
+
+.PHONY: all clean install
+
+all: $(sharedlib) $(staticlib)
+
+$(sharedlib): $(objects)
+
+$(staticlib): $(objects)
+
+clean::
+ rm -f $(objects) $(sharedlib) $(staticlib)
+
+install:
+ mkdir -p $(prefix)/include
+ cp $(includes) $(prefix)/include
+ mkdir -p $(prefix)/lib
+ cp $(sharedlib) $(staticlib) $(prefix)/lib
+
+include ../Make.rules
diff --git a/v4l2-apps/lib/frequencies.c b/v4l2-apps/lib/frequencies.c
new file mode 100644
index 000000000..29fa5d2b9
--- /dev/null
+++ b/v4l2-apps/lib/frequencies.c
@@ -0,0 +1,1505 @@
+/* Copyright (C) 2006 Nathan Laredo <laredo@gnu.org>
+ Nathan contributed the frequency tables.
+
+ Copyright (C) 2006 Hans Verkuil <hverkuil@xs4all.nl>
+ Added the iso-std table.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdlib.h>
+
+#include "linux/videodev2.h"
+#include "v4l2.h"
+
+/* This source was originally written by Nathan Laredo <laredo@gnu.org>.
+ He kindly gave permission to release this source under the LGPL
+ license. */
+
+/* --------------------------------------------------------------------- */
+
+/* US broadcast */
+static const struct v4l2_channel_list ntsc_bcast[] = {
+ { "2", 55250 },
+ { "3", 61250 },
+ { "4", 67250 },
+ { "5", 77250 },
+ { "6", 83250 },
+ { "7", 175250 },
+ { "8", 181250 },
+ { "9", 187250 },
+ { "10", 193250 },
+ { "11", 199250 },
+ { "12", 205250 },
+ { "13", 211250 },
+ { "14", 471250 },
+ { "15", 477250 },
+ { "16", 483250 },
+ { "17", 489250 },
+ { "18", 495250 },
+ { "19", 501250 },
+ { "20", 507250 },
+ { "21", 513250 },
+ { "22", 519250 },
+ { "23", 525250 },
+ { "24", 531250 },
+ { "25", 537250 },
+ { "26", 543250 },
+ { "27", 549250 },
+ { "28", 555250 },
+ { "29", 561250 },
+ { "30", 567250 },
+ { "31", 573250 },
+ { "32", 579250 },
+ { "33", 585250 },
+ { "34", 591250 },
+ { "35", 597250 },
+ { "36", 603250 },
+ { "37", 609250 },
+ { "38", 615250 },
+ { "39", 621250 },
+ { "40", 627250 },
+ { "41", 633250 },
+ { "42", 639250 },
+ { "43", 645250 },
+ { "44", 651250 },
+ { "45", 657250 },
+ { "46", 663250 },
+ { "47", 669250 },
+ { "48", 675250 },
+ { "49", 681250 },
+ { "50", 687250 },
+ { "51", 693250 },
+ { "52", 699250 },
+ { "53", 705250 },
+ { "54", 711250 },
+ { "55", 717250 },
+ { "56", 723250 },
+ { "57", 729250 },
+ { "58", 735250 },
+ { "59", 741250 },
+ { "60", 747250 },
+ { "61", 753250 },
+ { "62", 759250 },
+ { "63", 765250 },
+ { "64", 771250 },
+ { "65", 777250 },
+ { "66", 783250 },
+ { "67", 789250 },
+ { "68", 795250 },
+ { "69", 801250 },
+
+ { "70", 807250 },
+ { "71", 813250 },
+ { "72", 819250 },
+ { "73", 825250 },
+ { "74", 831250 },
+ { "75", 837250 },
+ { "76", 843250 },
+ { "77", 849250 },
+ { "78", 855250 },
+ { "79", 861250 },
+ { "80", 867250 },
+ { "81", 873250 },
+ { "82", 879250 },
+ { "83", 885250 },
+};
+
+/* US cable */
+static const struct v4l2_channel_list ntsc_cable[] = {
+ { "1", 73250 },
+ { "2", 55250 },
+ { "3", 61250 },
+ { "4", 67250 },
+ { "5", 77250 },
+ { "6", 83250 },
+ { "7", 175250 },
+ { "8", 181250 },
+ { "9", 187250 },
+ { "10", 193250 },
+ { "11", 199250 },
+ { "12", 205250 },
+
+ { "13", 211250 },
+ { "14", 121250 },
+ { "15", 127250 },
+ { "16", 133250 },
+ { "17", 139250 },
+ { "18", 145250 },
+ { "19", 151250 },
+ { "20", 157250 },
+
+ { "21", 163250 },
+ { "22", 169250 },
+ { "23", 217250 },
+ { "24", 223250 },
+ { "25", 229250 },
+ { "26", 235250 },
+ { "27", 241250 },
+ { "28", 247250 },
+ { "29", 253250 },
+ { "30", 259250 },
+ { "31", 265250 },
+ { "32", 271250 },
+ { "33", 277250 },
+ { "34", 283250 },
+ { "35", 289250 },
+ { "36", 295250 },
+ { "37", 301250 },
+ { "38", 307250 },
+ { "39", 313250 },
+ { "40", 319250 },
+ { "41", 325250 },
+ { "42", 331250 },
+ { "43", 337250 },
+ { "44", 343250 },
+ { "45", 349250 },
+ { "46", 355250 },
+ { "47", 361250 },
+ { "48", 367250 },
+ { "49", 373250 },
+ { "50", 379250 },
+ { "51", 385250 },
+ { "52", 391250 },
+ { "53", 397250 },
+ { "54", 403250 },
+ { "55", 409250 },
+ { "56", 415250 },
+ { "57", 421250 },
+ { "58", 427250 },
+ { "59", 433250 },
+ { "60", 439250 },
+ { "61", 445250 },
+ { "62", 451250 },
+ { "63", 457250 },
+ { "64", 463250 },
+ { "65", 469250 },
+ { "66", 475250 },
+ { "67", 481250 },
+ { "68", 487250 },
+ { "69", 493250 },
+
+ { "70", 499250 },
+ { "71", 505250 },
+ { "72", 511250 },
+ { "73", 517250 },
+ { "74", 523250 },
+ { "75", 529250 },
+ { "76", 535250 },
+ { "77", 541250 },
+ { "78", 547250 },
+ { "79", 553250 },
+ { "80", 559250 },
+ { "81", 565250 },
+ { "82", 571250 },
+ { "83", 577250 },
+ { "84", 583250 },
+ { "85", 589250 },
+ { "86", 595250 },
+ { "87", 601250 },
+ { "88", 607250 },
+ { "89", 613250 },
+ { "90", 619250 },
+ { "91", 625250 },
+ { "92", 631250 },
+ { "93", 637250 },
+ { "94", 643250 },
+ { "95", 91250 },
+ { "96", 97250 },
+ { "97", 103250 },
+ { "98", 109250 },
+ { "99", 115250 },
+ { "100", 649250 },
+ { "101", 655250 },
+ { "102", 661250 },
+ { "103", 667250 },
+ { "104", 673250 },
+ { "105", 679250 },
+ { "106", 685250 },
+ { "107", 691250 },
+ { "108", 697250 },
+ { "109", 703250 },
+ { "110", 709250 },
+ { "111", 715250 },
+ { "112", 721250 },
+ { "113", 727250 },
+ { "114", 733250 },
+ { "115", 739250 },
+ { "116", 745250 },
+ { "117", 751250 },
+ { "118", 757250 },
+ { "119", 763250 },
+ { "120", 769250 },
+ { "121", 775250 },
+ { "122", 781250 },
+ { "123", 787250 },
+ { "124", 793250 },
+ { "125", 799250 },
+
+ { "T7", 8250 },
+ { "T8", 14250 },
+ { "T9", 20250 },
+ { "T10", 26250 },
+ { "T11", 32250 },
+ { "T12", 38250 },
+ { "T13", 44250 },
+ { "T14", 50250 }
+};
+
+/* US HRC */
+static const struct v4l2_channel_list ntsc_hrc[] = {
+ { "1", 72000 },
+
+ { "2", 54000 },
+ { "3", 60000 },
+ { "4", 66000 },
+
+ { "5", 78000 },
+ { "6", 84000 },
+
+ { "7", 174000 },
+ { "8", 180000 },
+ { "9", 186000 },
+ { "10", 192000 },
+ { "11", 198000 },
+ { "12", 204000 },
+ { "13", 210000 },
+ { "14", 120000 },
+ { "15", 126000 },
+ { "16", 132000 },
+ { "17", 138000 },
+ { "18", 144000 },
+ { "19", 150000 },
+ { "20", 156000 },
+ { "21", 162000 },
+ { "22", 168000 },
+ { "23", 216000 },
+ { "24", 222000 },
+ { "25", 228000 },
+ { "26", 234000 },
+ { "27", 240000 },
+ { "28", 246000 },
+ { "29", 252000 },
+ { "30", 258000 },
+ { "31", 264000 },
+ { "32", 270000 },
+ { "33", 276000 },
+ { "34", 282000 },
+ { "35", 288000 },
+ { "36", 294000 },
+ { "37", 300000 },
+ { "38", 306000 },
+ { "39", 312000 },
+ { "40", 318000 },
+ { "41", 324000 },
+ { "42", 330000 },
+ { "43", 336000 },
+ { "44", 342000 },
+ { "45", 348000 },
+ { "46", 354000 },
+ { "47", 360000 },
+ { "48", 366000 },
+ { "49", 372000 },
+ { "50", 378000 },
+ { "51", 384000 },
+ { "52", 390000 },
+ { "53", 396000 },
+ { "54", 402000 },
+ { "55", 408000 },
+ { "56", 414000 },
+ { "57", 420000 },
+ { "58", 426000 },
+ { "59", 432000 },
+ { "60", 438000 },
+ { "61", 444000 },
+ { "62", 450000 },
+ { "63", 456000 },
+ { "64", 462000 },
+ { "65", 468000 },
+ { "66", 474000 },
+ { "67", 480000 },
+ { "68", 486000 },
+ { "69", 492000 },
+ { "70", 498000 },
+ { "71", 504000 },
+ { "72", 510000 },
+ { "73", 516000 },
+ { "74", 522000 },
+ { "75", 528000 },
+ { "76", 534000 },
+ { "77", 540000 },
+ { "78", 546000 },
+ { "79", 552000 },
+ { "80", 558000 },
+ { "81", 564000 },
+ { "82", 570000 },
+ { "83", 576000 },
+ { "84", 582000 },
+ { "85", 588000 },
+ { "86", 594000 },
+ { "87", 600000 },
+ { "88", 606000 },
+ { "89", 612000 },
+ { "90", 618000 },
+ { "91", 624000 },
+ { "92", 630000 },
+ { "93", 636000 },
+ { "94", 642000 },
+
+ { "95", 90000 },
+ { "96", 96000 },
+ { "97", 102000 },
+ { "98", 108000 },
+ { "99", 114000 },
+
+ { "100", 648000 },
+ { "101", 654000 },
+ { "102", 660000 },
+ { "103", 666000 },
+ { "104", 672000 },
+ { "105", 678000 },
+ { "106", 684000 },
+ { "107", 690000 },
+ { "108", 696000 },
+ { "109", 702000 },
+ { "110", 708000 },
+ { "111", 714000 },
+ { "112", 720000 },
+ { "113", 726000 },
+ { "114", 732000 },
+ { "115", 738000 },
+ { "116", 744000 },
+ { "117", 750000 },
+ { "118", 756000 },
+ { "119", 762000 },
+ { "120", 768000 },
+ { "121", 774000 },
+ { "122", 780000 },
+ { "123", 786000 },
+ { "124", 792000 },
+ { "125", 798000 },
+
+ { "T7", 7000 },
+ { "T8", 13000 },
+ { "T9", 19000 },
+ { "T10", 25000 },
+ { "T11", 31000 },
+ { "T12", 37000 },
+ { "T13", 43000 },
+ { "T14", 49000 },
+};
+
+/* US IRC */
+static const struct v4l2_channel_list ntsc_irc[] = {
+ { "1", 73250 },
+ { "2", 55250 },
+ { "3", 61250 },
+ { "4", 67250 },
+ { "5", 79250 },
+ { "6", 85250 },
+ { "7", 175250 },
+ { "8", 181250 },
+ { "9", 187250 },
+ { "10", 193250 },
+ { "11", 199250 },
+ { "12", 205250 },
+ { "13", 211250 },
+
+ { "14", 121150 },
+ { "15", 127150 },
+ { "16", 133150 },
+ { "17", 139150 },
+ { "18", 145150 },
+ { "19", 151150 },
+ { "20", 157150 },
+ { "21", 163150 },
+ { "22", 169150 },
+
+ { "23", 217250 },
+ { "24", 223250 },
+ { "25", 229250 },
+ { "26", 235250 },
+ { "27", 241250 },
+ { "28", 247250 },
+ { "29", 253250 },
+ { "30", 259250 },
+ { "31", 265250 },
+ { "32", 271250 },
+ { "33", 277250 },
+ { "34", 283250 },
+ { "35", 289250 },
+ { "36", 295250 },
+ { "37", 301250 },
+ { "38", 307250 },
+ { "39", 313250 },
+ { "40", 319250 },
+ { "41", 325250 },
+ { "42", 331250 },
+ { "43", 337250 },
+ { "44", 343250 },
+ { "45", 349250 },
+ { "46", 355250 },
+ { "47", 361250 },
+ { "48", 367250 },
+ { "49", 373250 },
+ { "50", 379250 },
+ { "51", 385250 },
+ { "52", 391250 },
+ { "53", 397250 },
+ { "54", 403250 },
+ { "55", 409250 },
+ { "56", 415250 },
+ { "57", 421250 },
+ { "58", 427250 },
+ { "59", 433250 },
+ { "60", 439250 },
+ { "61", 445250 },
+ { "62", 451250 },
+ { "63", 457250 },
+ { "64", 463250 },
+ { "65", 469250 },
+ { "66", 475250 },
+ { "67", 481250 },
+ { "68", 487250 },
+ { "69", 493250 },
+ { "70", 499250 },
+ { "71", 505250 },
+ { "72", 511250 },
+ { "73", 517250 },
+ { "74", 523250 },
+ { "75", 529250 },
+ { "76", 535250 },
+ { "77", 541250 },
+ { "78", 547250 },
+ { "79", 553250 },
+ { "80", 559250 },
+ { "81", 565250 },
+ { "82", 571250 },
+ { "83", 577250 },
+ { "84", 583250 },
+ { "85", 589250 },
+ { "86", 595250 },
+ { "87", 601250 },
+ { "88", 607250 },
+ { "89", 613250 },
+ { "90", 619250 },
+ { "91", 625250 },
+ { "92", 631250 },
+ { "93", 637250 },
+ { "94", 643250 },
+
+ { "95", 91250 },
+ { "96", 97250 },
+ { "97", 103250 },
+ { "98", 109250 },
+ { "99", 115250 },
+ { "100", 649250 },
+ { "101", 655250 },
+ { "102", 661250 },
+ { "103", 667250 },
+ { "104", 673250 },
+ { "105", 679250 },
+ { "106", 685250 },
+ { "107", 691250 },
+ { "108", 697250 },
+ { "109", 703250 },
+ { "110", 709250 },
+ { "111", 715250 },
+ { "112", 721250 },
+ { "113", 727250 },
+ { "114", 733250 },
+ { "115", 739250 },
+ { "116", 745250 },
+ { "117", 751250 },
+ { "118", 757250 },
+ { "119", 763250 },
+ { "120", 769250 },
+ { "121", 775250 },
+ { "122", 781250 },
+ { "123", 787250 },
+ { "124", 793250 },
+ { "125", 799250 },
+
+ { "T7", 8250 },
+ { "T8", 14250 },
+ { "T9", 20250 },
+ { "T10", 26250 },
+ { "T11", 32250 },
+ { "T12", 38250 },
+ { "T13", 44250 },
+ { "T14", 50250 }
+};
+
+
+/* --------------------------------------------------------------------- */
+
+/* JP broadcast */
+static const struct v4l2_channel_list ntsc_bcast_jp[] = {
+ { "1", 91250 },
+ { "2", 97250 },
+ { "3", 103250 },
+ { "4", 171250 },
+ { "5", 177250 },
+ { "6", 183250 },
+ { "7", 189250 },
+ { "8", 193250 },
+ { "9", 199250 },
+ { "10", 205250 },
+ { "11", 211250 },
+ { "12", 217250 },
+
+ { "13", 471250 },
+ { "14", 477250 },
+ { "15", 483250 },
+ { "16", 489250 },
+ { "17", 495250 },
+ { "18", 501250 },
+ { "19", 507250 },
+ { "20", 513250 },
+ { "21", 519250 },
+ { "22", 525250 },
+ { "23", 531250 },
+ { "24", 537250 },
+ { "25", 543250 },
+ { "26", 549250 },
+ { "27", 555250 },
+ { "28", 561250 },
+ { "29", 567250 },
+ { "30", 573250 },
+ { "31", 579250 },
+ { "32", 585250 },
+ { "33", 591250 },
+ { "34", 597250 },
+ { "35", 603250 },
+ { "36", 609250 },
+ { "37", 615250 },
+ { "38", 621250 },
+ { "39", 627250 },
+ { "40", 633250 },
+ { "41", 639250 },
+ { "42", 645250 },
+ { "43", 651250 },
+ { "44", 657250 },
+
+ { "45", 663250 },
+ { "46", 669250 },
+ { "47", 675250 },
+ { "48", 681250 },
+ { "49", 687250 },
+ { "50", 693250 },
+ { "51", 699250 },
+ { "52", 705250 },
+ { "53", 711250 },
+ { "54", 717250 },
+ { "55", 723250 },
+ { "56", 729250 },
+ { "57", 735250 },
+ { "58", 741250 },
+ { "59", 747250 },
+ { "60", 753250 },
+ { "61", 759250 },
+ { "62", 765250 },
+};
+
+/* JP cable */
+static const struct v4l2_channel_list ntsc_cable_jp[] = {
+ { "13", 109250 },
+ { "14", 115250 },
+ { "15", 121250 },
+ { "16", 127250 },
+ { "17", 133250 },
+ { "18", 139250 },
+ { "19", 145250 },
+ { "20", 151250 },
+
+ { "21", 157250 },
+ { "22", 165250 },
+ { "23", 223250 },
+ { "24", 231250 },
+ { "25", 237250 },
+ { "26", 243250 },
+ { "27", 249250 },
+ { "28", 253250 },
+ { "29", 259250 },
+ { "30", 265250 },
+ { "31", 271250 },
+ { "32", 277250 },
+ { "33", 283250 },
+ { "34", 289250 },
+ { "35", 295250 },
+ { "36", 301250 },
+ { "37", 307250 },
+ { "38", 313250 },
+ { "39", 319250 },
+ { "40", 325250 },
+ { "41", 331250 },
+ { "42", 337250 },
+ { "43", 343250 },
+ { "44", 349250 },
+ { "45", 355250 },
+ { "46", 361250 },
+ { "47", 367250 },
+ { "48", 373250 },
+ { "49", 379250 },
+ { "50", 385250 },
+ { "51", 391250 },
+ { "52", 397250 },
+ { "53", 403250 },
+ { "54", 409250 },
+ { "55", 415250 },
+ { "56", 421250 },
+ { "57", 427250 },
+ { "58", 433250 },
+ { "59", 439250 },
+ { "60", 445250 },
+ { "61", 451250 },
+ { "62", 457250 },
+ { "63", 463250 },
+};
+
+/* --------------------------------------------------------------------- */
+
+/* australia */
+static const struct v4l2_channel_list pal_australia[] = {
+ { "0", 46250 },
+ { "1", 57250 },
+ { "2", 64250 },
+ { "3", 86250 },
+ { "4", 95250 },
+ { "5", 102250 },
+ { "5A", 138250 },
+ { "6", 175250 },
+ { "7", 182250 },
+ { "8", 189250 },
+ { "9", 196250 },
+ { "10", 209250 },
+ { "11", 216250 },
+ { "28", 527250 },
+ { "29", 534250 },
+ { "30", 541250 },
+ { "31", 548250 },
+ { "32", 555250 },
+ { "33", 562250 },
+ { "34", 569250 },
+ { "35", 576250 },
+ { "36", 591250 },
+ { "39", 604250 },
+ { "40", 611250 },
+ { "41", 618250 },
+ { "42", 625250 },
+ { "43", 632250 },
+ { "44", 639250 },
+ { "45", 646250 },
+ { "46", 653250 },
+ { "47", 660250 },
+ { "48", 667250 },
+ { "49", 674250 },
+ { "50", 681250 },
+ { "51", 688250 },
+ { "52", 695250 },
+ { "53", 702250 },
+ { "54", 709250 },
+ { "55", 716250 },
+ { "56", 723250 },
+ { "57", 730250 },
+ { "58", 737250 },
+ { "59", 744250 },
+ { "60", 751250 },
+ { "61", 758250 },
+ { "62", 765250 },
+ { "63", 772250 },
+ { "64", 779250 },
+ { "65", 786250 },
+ { "66", 793250 },
+ { "67", 800250 },
+ { "68", 807250 },
+ { "69", 814250 },
+};
+
+static const struct v4l2_channel_list pal_australia_optus[] = {
+ { "1", 138250 },
+ { "2", 147250 },
+ { "3", 154250 },
+ { "4", 161250 },
+ { "5", 168250 },
+ { "6", 175250 },
+ { "7", 182250 },
+ { "8", 189250 },
+ { "9", 196250 },
+ { "10", 209250 },
+ { "11", 216250 },
+ { "12", 224250 },
+ { "13", 231250 },
+ { "14", 238250 },
+ { "15", 245250 },
+ { "16", 252250 },
+ { "17", 259250 },
+ { "18", 266250 },
+ { "19", 273250 },
+ { "20", 280250 },
+ { "21", 287250 },
+ { "22", 294250 },
+ { "23", 303250 },
+ { "24", 310250 },
+ { "25", 317250 },
+ { "26", 324250 },
+ { "27", 338250 },
+ { "28", 345250 },
+ { "29", 352250 },
+ { "30", 359250 },
+ { "31", 366250 },
+ { "32", 373250 },
+ { "33", 380250 },
+ { "34", 387250 },
+ { "35", 394250 },
+ { "36", 401250 },
+ { "37", 408250 },
+ { "38", 415250 },
+ { "39", 422250 },
+ { "40", 429250 },
+ { "41", 436250 },
+ { "42", 443250 },
+ { "43", 450250 },
+ { "44", 457250 },
+ { "45", 464250 },
+ { "46", 471250 },
+ { "47", 478250 },
+ { "48", 485250 },
+ { "49", 492250 },
+ { "50", 499250 },
+ { "51", 506250 },
+ { "52", 513250 },
+ { "53", 520250 },
+ { "54", 527250 },
+ { "55", 534250 },
+};
+
+
+/* --------------------------------------------------------------------- */
+/* europe */
+
+/* CCIR frequencies */
+
+#define FREQ_CCIR_I_III \
+ { "E2", 48250 }, \
+ { "E3", 55250 }, \
+ { "E4", 62250 }, \
+ \
+ { "S01", 69250 }, \
+ { "S02", 76250 }, \
+ { "S03", 83250 }, \
+ \
+ { "E5", 175250 }, \
+ { "E6", 182250 }, \
+ { "E7", 189250 }, \
+ { "E8", 196250 }, \
+ { "E9", 203250 }, \
+ { "E10", 210250 }, \
+ { "E11", 217250 }, \
+ { "E12", 224250 }
+
+#define FREQ_CCIR_SL_SH \
+ { "SE1", 105250 }, \
+ { "SE2", 112250 }, \
+ { "SE3", 119250 }, \
+ { "SE4", 126250 }, \
+ { "SE5", 133250 }, \
+ { "SE6", 140250 }, \
+ { "SE7", 147250 }, \
+ { "SE8", 154250 }, \
+ { "SE9", 161250 }, \
+ { "SE10", 168250 }, \
+ \
+ { "SE11", 231250 }, \
+ { "SE12", 238250 }, \
+ { "SE13", 245250 }, \
+ { "SE14", 252250 }, \
+ { "SE15", 259250 }, \
+ { "SE16", 266250 }, \
+ { "SE17", 273250 }, \
+ { "SE18", 280250 }, \
+ { "SE19", 287250 }, \
+ { "SE20", 294250 }
+
+#define FREQ_CCIR_H \
+ { "S21", 303250 }, \
+ { "S22", 311250 }, \
+ { "S23", 319250 }, \
+ { "S24", 327250 }, \
+ { "S25", 335250 }, \
+ { "S26", 343250 }, \
+ { "S27", 351250 }, \
+ { "S28", 359250 }, \
+ { "S29", 367250 }, \
+ { "S30", 375250 }, \
+ { "S31", 383250 }, \
+ { "S32", 391250 }, \
+ { "S33", 399250 }, \
+ { "S34", 407250 }, \
+ { "S35", 415250 }, \
+ { "S36", 423250 }, \
+ { "S37", 431250 }, \
+ { "S38", 439250 }, \
+ { "S39", 447250 }, \
+ { "S40", 455250 }, \
+ { "S41", 463250 }
+
+/* OIRT frequencies */
+
+#define FREQ_OIRT_I_III \
+ { "R1", 49750 }, \
+ { "R2", 59250 }, \
+ \
+ { "R3", 77250 }, \
+ { "R4", 85250 }, \
+ { "R5", 93250 }, \
+ \
+ { "R6", 175250 }, \
+ { "R7", 183250 }, \
+ { "R8", 191250 }, \
+ { "R9", 199250 }, \
+ { "R10", 207250 }, \
+ { "R11", 215250 }, \
+ { "R12", 223250 }
+
+#define FREQ_OIRT_SL_SH \
+ { "SR1", 111250 }, \
+ { "SR2", 119250 }, \
+ { "SR3", 127250 }, \
+ { "SR4", 135250 }, \
+ { "SR5", 143250 }, \
+ { "SR6", 151250 }, \
+ { "SR7", 159250 }, \
+ { "SR8", 167250 }, \
+ \
+ { "SR11", 231250 }, \
+ { "SR12", 239250 }, \
+ { "SR13", 247250 }, \
+ { "SR14", 255250 }, \
+ { "SR15", 263250 }, \
+ { "SR16", 271250 }, \
+ { "SR17", 279250 }, \
+ { "SR18", 287250 }, \
+ { "SR19", 295250 }
+
+#define FREQ_UHF \
+ { "21", 471250 }, \
+ { "22", 479250 }, \
+ { "23", 487250 }, \
+ { "24", 495250 }, \
+ { "25", 503250 }, \
+ { "26", 511250 }, \
+ { "27", 519250 }, \
+ { "28", 527250 }, \
+ { "29", 535250 }, \
+ { "30", 543250 }, \
+ { "31", 551250 }, \
+ { "32", 559250 }, \
+ { "33", 567250 }, \
+ { "34", 575250 }, \
+ { "35", 583250 }, \
+ { "36", 591250 }, \
+ { "37", 599250 }, \
+ { "38", 607250 }, \
+ { "39", 615250 }, \
+ { "40", 623250 }, \
+ { "41", 631250 }, \
+ { "42", 639250 }, \
+ { "43", 647250 }, \
+ { "44", 655250 }, \
+ { "45", 663250 }, \
+ { "46", 671250 }, \
+ { "47", 679250 }, \
+ { "48", 687250 }, \
+ { "49", 695250 }, \
+ { "50", 703250 }, \
+ { "51", 711250 }, \
+ { "52", 719250 }, \
+ { "53", 727250 }, \
+ { "54", 735250 }, \
+ { "55", 743250 }, \
+ { "56", 751250 }, \
+ { "57", 759250 }, \
+ { "58", 767250 }, \
+ { "59", 775250 }, \
+ { "60", 783250 }, \
+ { "61", 791250 }, \
+ { "62", 799250 }, \
+ { "63", 807250 }, \
+ { "64", 815250 }, \
+ { "65", 823250 }, \
+ { "66", 831250 }, \
+ { "67", 839250 }, \
+ { "68", 847250 }, \
+ { "69", 855250 }
+
+static const struct v4l2_channel_list europe_west[] = {
+ FREQ_CCIR_I_III,
+ FREQ_CCIR_SL_SH,
+ FREQ_CCIR_H,
+ FREQ_UHF
+};
+
+static const struct v4l2_channel_list europe_east[] = {
+ FREQ_OIRT_I_III,
+ FREQ_OIRT_SL_SH,
+ FREQ_CCIR_I_III,
+ FREQ_CCIR_SL_SH,
+ FREQ_CCIR_H,
+ FREQ_UHF
+};
+
+static const struct v4l2_channel_list pal_italy[] = {
+ { "A", 53750 },
+ { "B", 62250 },
+ { "C", 82250 },
+ { "D", 175250 },
+ { "E", 183750 },
+ { "F", 192250 },
+ { "G", 201250 },
+ { "H", 210250 },
+ { "H1", 217250 },
+ { "H2", 224250 },
+ FREQ_UHF
+};
+
+static const struct v4l2_channel_list pal_ireland[] = {
+ { "A0", 45750 },
+ { "A1", 48000 },
+ { "A2", 53750 },
+ { "A3", 56000 },
+ { "A4", 61750 },
+ { "A5", 64000 },
+ { "A6", 175250 },
+ { "A7", 176000 },
+ { "A8", 183250 },
+ { "A9", 184000 },
+ { "A10", 191250 },
+ { "A11", 192000 },
+ { "A12", 199250 },
+ { "A13", 200000 },
+ { "A14", 207250 },
+ { "A15", 208000 },
+ { "A16", 215250 },
+ { "A17", 216000 },
+ { "A18", 224000 },
+ { "A19", 232000 },
+ { "A20", 248000 },
+ { "A21", 256000 },
+ { "A22", 264000 },
+ { "A23", 272000 },
+ { "A24", 280000 },
+ { "A25", 288000 },
+ { "A26", 296000 },
+ { "A27", 304000 },
+ { "A28", 312000 },
+ { "A29", 320000 },
+ { "A30", 344000 },
+ { "A31", 352000 },
+ { "A32", 408000 },
+ { "A33", 416000 },
+ { "A34", 448000 },
+ { "A35", 480000 },
+ { "A36", 520000 },
+ FREQ_UHF,
+};
+
+static const struct v4l2_channel_list secam_france[] = {
+ { "K01", 47750 },
+ { "K02", 55750 },
+ { "K03", 60500 },
+ { "K04", 63750 },
+ { "K05", 176000 },
+ { "K06", 184000 },
+ { "K07", 192000 },
+ { "K08", 200000 },
+ { "K09", 208000 },
+ { "K10", 216000 },
+ { "KB", 116750 },
+ { "KC", 128750 },
+ { "KD", 140750 },
+ { "KE", 159750 },
+ { "KF", 164750 },
+ { "KG", 176750 },
+ { "KH", 188750 },
+ { "KI", 200750 },
+ { "KJ", 212750 },
+ { "KK", 224750 },
+ { "KL", 236750 },
+ { "KM", 248750 },
+ { "KN", 260750 },
+ { "KO", 272750 },
+ { "KP", 284750 },
+ { "KQ", 296750 },
+ { "H01", 303250 },
+ { "H02", 311250 },
+ { "H03", 319250 },
+ { "H04", 327250 },
+ { "H05", 335250 },
+ { "H06", 343250 },
+ { "H07", 351250 },
+ { "H08", 359250 },
+ { "H09", 367250 },
+ { "H10", 375250 },
+ { "H11", 383250 },
+ { "H12", 391250 },
+ { "H13", 399250 },
+ { "H14", 407250 },
+ { "H15", 415250 },
+ { "H16", 423250 },
+ { "H17", 431250 },
+ { "H18", 439250 },
+ { "H19", 447250 },
+ FREQ_UHF,
+};
+
+/* --------------------------------------------------------------------- */
+
+static const struct v4l2_channel_list pal_newzealand[] = {
+ { "1", 45250 },
+ { "2", 55250 },
+ { "3", 62250 },
+ { "4", 175250 },
+ { "5", 182250 },
+ { "6", 189250 },
+ { "7", 196250 },
+ { "8", 203250 },
+ { "9", 210250 },
+ { "10", 217250 },
+ { "11", 224250 },
+ FREQ_UHF,
+};
+
+/* --------------------------------------------------------------------- */
+
+/* China broadcast */
+static const struct v4l2_channel_list pal_bcast_cn[] = {
+ { "1", 49750 },
+ { "2", 57750 },
+ { "3", 65750 },
+ { "4", 77250 },
+ { "5", 85250 },
+ { "6", 112250 },
+ { "7", 120250 },
+ { "8", 128250 },
+ { "9", 136250 },
+ { "10", 144250 },
+ { "11", 152250 },
+ { "12", 160250 },
+ { "13", 168250 },
+ { "14", 176250 },
+ { "15", 184250 },
+ { "16", 192250 },
+ { "17", 200250 },
+ { "18", 208250 },
+ { "19", 216250 },
+ { "20", 224250 },
+ { "21", 232250 },
+ { "22", 240250 },
+ { "23", 248250 },
+ { "24", 256250 },
+ { "25", 264250 },
+ { "26", 272250 },
+ { "27", 280250 },
+ { "28", 288250 },
+ { "29", 296250 },
+ { "30", 304250 },
+ { "31", 312250 },
+ { "32", 320250 },
+ { "33", 328250 },
+ { "34", 336250 },
+ { "35", 344250 },
+ { "36", 352250 },
+ { "37", 360250 },
+ { "38", 368250 },
+ { "39", 376250 },
+ { "40", 384250 },
+ { "41", 392250 },
+ { "42", 400250 },
+ { "43", 408250 },
+ { "44", 416250 },
+ { "45", 424250 },
+ { "46", 432250 },
+ { "47", 440250 },
+ { "48", 448250 },
+ { "49", 456250 },
+ { "50", 463250 },
+ { "51", 471250 },
+ { "52", 479250 },
+ { "53", 487250 },
+ { "54", 495250 },
+ { "55", 503250 },
+ { "56", 511250 },
+ { "57", 519250 },
+ { "58", 527250 },
+ { "59", 535250 },
+ { "60", 543250 },
+ { "61", 551250 },
+ { "62", 559250 },
+ { "63", 607250 },
+ { "64", 615250 },
+ { "65", 623250 },
+ { "66", 631250 },
+ { "67", 639250 },
+ { "68", 647250 },
+ { "69", 655250 },
+ { "70", 663250 },
+ { "71", 671250 },
+ { "72", 679250 },
+ { "73", 687250 },
+ { "74", 695250 },
+ { "75", 703250 },
+ { "76", 711250 },
+ { "77", 719250 },
+ { "78", 727250 },
+ { "79", 735250 },
+ { "80", 743250 },
+ { "81", 751250 },
+ { "82", 759250 },
+ { "83", 767250 },
+ { "84", 775250 },
+ { "85", 783250 },
+ { "86", 791250 },
+ { "87", 799250 },
+ { "88", 807250 },
+ { "89", 815250 },
+ { "90", 823250 },
+ { "91", 831250 },
+ { "92", 839250 },
+ { "93", 847250 },
+ { "94", 855250 },
+};
+
+/* --------------------------------------------------------------------- */
+/* South Africa Broadcast */
+
+static const struct v4l2_channel_list pal_bcast_za[] ={
+ { "1", 175250 },
+ { "2", 183250 },
+ { "3", 191250 },
+ { "4", 199250 },
+ { "5", 207250 },
+ { "6", 215250 },
+ { "7", 223250 },
+ { "8", 231250 },
+ { "9", 239250 },
+ { "10", 247250 },
+ { "11", 255250 },
+ { "12", 263250 },
+ { "13", 271250 },
+ FREQ_UHF
+};
+
+/* --------------------------------------------------------------------- */
+
+static const struct v4l2_channel_list argentina[] = {
+ { "001", 56250 },
+ { "002", 62250 },
+ { "003", 68250 },
+ { "004", 78250 },
+ { "005", 84250 },
+ { "006", 176250 },
+ { "007", 182250 },
+ { "008", 188250 },
+ { "009", 194250 },
+ { "010", 200250 },
+ { "011", 206250 },
+ { "012", 212250 },
+ { "013", 122250 },
+ { "014", 128250 },
+ { "015", 134250 },
+ { "016", 140250 },
+ { "017", 146250 },
+ { "018", 152250 },
+ { "019", 158250 },
+ { "020", 164250 },
+ { "021", 170250 },
+ { "022", 218250 },
+ { "023", 224250 },
+ { "024", 230250 },
+ { "025", 236250 },
+ { "026", 242250 },
+ { "027", 248250 },
+ { "028", 254250 },
+ { "029", 260250 },
+ { "030", 266250 },
+ { "031", 272250 },
+ { "032", 278250 },
+ { "033", 284250 },
+ { "034", 290250 },
+ { "035", 296250 },
+ { "036", 302250 },
+ { "037", 308250 },
+ { "038", 314250 },
+ { "039", 320250 },
+ { "040", 326250 },
+ { "041", 332250 },
+ { "042", 338250 },
+ { "043", 344250 },
+ { "044", 350250 },
+ { "045", 356250 },
+ { "046", 362250 },
+ { "047", 368250 },
+ { "048", 374250 },
+ { "049", 380250 },
+ { "050", 386250 },
+ { "051", 392250 },
+ { "052", 398250 },
+ { "053", 404250 },
+ { "054", 410250 },
+ { "055", 416250 },
+ { "056", 422250 },
+ { "057", 428250 },
+ { "058", 434250 },
+ { "059", 440250 },
+ { "060", 446250 },
+ { "061", 452250 },
+ { "062", 458250 },
+ { "063", 464250 },
+ { "064", 470250 },
+ { "065", 476250 },
+ { "066", 482250 },
+ { "067", 488250 },
+ { "068", 494250 },
+ { "069", 500250 },
+ { "070", 506250 },
+ { "071", 512250 },
+ { "072", 518250 },
+ { "073", 524250 },
+ { "074", 530250 },
+ { "075", 536250 },
+ { "076", 542250 },
+ { "077", 548250 },
+ { "078", 554250 },
+ { "079", 560250 },
+ { "080", 566250 },
+ { "081", 572250 },
+ { "082", 578250 },
+ { "083", 584250 },
+ { "084", 590250 },
+ { "085", 596250 },
+ { "086", 602250 },
+ { "087", 608250 },
+ { "088", 614250 },
+ { "089", 620250 },
+ { "090", 626250 },
+ { "091", 632250 },
+ { "092", 638250 },
+ { "093", 644250 },
+};
+
+/* --------------------------------------------------------------------- */
+
+#define CHAN_COUNT(x) (sizeof(x)/sizeof(struct v4l2_channel_list))
+
+const struct v4l2_channel_lists v4l2_channel_lists[] = {
+ { "us-bcast", ntsc_bcast, CHAN_COUNT(ntsc_bcast) },
+ { "us-cable", ntsc_cable, CHAN_COUNT(ntsc_cable) },
+ { "us-cable-hrc", ntsc_hrc, CHAN_COUNT(ntsc_hrc) },
+ { "us-cable-irc", ntsc_irc, CHAN_COUNT(ntsc_irc) },
+ { "japan-bcast", ntsc_bcast_jp, CHAN_COUNT(ntsc_bcast_jp) },
+ { "japan-cable", ntsc_cable_jp, CHAN_COUNT(ntsc_cable_jp) },
+ { "europe-west", europe_west, CHAN_COUNT(europe_west) },
+ { "europe-east", europe_east, CHAN_COUNT(europe_east) },
+ { "italy", pal_italy, CHAN_COUNT(pal_italy) },
+ { "newzealand", pal_newzealand, CHAN_COUNT(pal_newzealand) },
+ { "australia", pal_australia, CHAN_COUNT(pal_australia) },
+ { "ireland", pal_ireland, CHAN_COUNT(pal_ireland) },
+ { "france", secam_france, CHAN_COUNT(secam_france) },
+ { "china-bcast", pal_bcast_cn, CHAN_COUNT(pal_bcast_cn) },
+ { "southafrica", pal_bcast_za, CHAN_COUNT(pal_bcast_za) },
+ { "argentina", argentina, CHAN_COUNT(argentina) },
+ { "australia-optus", pal_australia_optus, CHAN_COUNT(pal_australia_optus) },
+ { NULL, NULL, 0 } /* EOF */
+};
+
+/* This list contains omissions and almost certainly incorrect information.
+ Please provide me (Hans Verkuil, <hverkuil@xs4all.nl>) with corrections. */
+const struct v4l2_country_std_map v4l2_country_std_map[] = {
+ { "AE", V4L2_STD_PAL_BG }, /* United Arab Emirates */
+ { "AF", V4L2_STD_SECAM_D }, /* Afghanistan */
+ { "AG", V4L2_STD_NTSC_M }, /* Antigua */
+ { "AL", V4L2_STD_PAL_BG }, /* Albania */
+ { "AM", V4L2_STD_SECAM_DK }, /* Armenia */
+ { "AN", V4L2_STD_NTSC_M }, /* Netherlands Antilles */
+ { "AO", V4L2_STD_PAL_I }, /* Angola */
+ { "AR", V4L2_STD_PAL_Nc }, /* Argentina */
+ { "AT", V4L2_STD_PAL_BG }, /* Austria */
+ { "AU", V4L2_STD_PAL_B }, /* Australia */
+ { "AW", V4L2_STD_NTSC_M }, /* Aruba */
+ { "AZ", V4L2_STD_SECAM_DK }, /* Azerbaijan */
+ { "BA", V4L2_STD_PAL_BG }, /* Bosnia and Herzegovina */
+ { "BB", V4L2_STD_NTSC_M }, /* Barbados */
+ { "BD", V4L2_STD_PAL_B }, /* Bangladesh */
+ { "BE", V4L2_STD_PAL_B | V4L2_STD_PAL_H }, /* Belgium */
+ { "BF", V4L2_STD_SECAM_K1 }, /* Burkina Faso */
+ { "BG", V4L2_STD_SECAM_DK }, /* Bulgaria */
+ { "BH", V4L2_STD_PAL_BG }, /* Bahrain */
+ { "BI", V4L2_STD_SECAM_K1 }, /* Burundi */
+ { "BJ", V4L2_STD_SECAM_K1 }, /* Benin */
+ { "BM", V4L2_STD_NTSC_M }, /* Bermuda */
+ { "BN", V4L2_STD_PAL_B }, /* Brunei Darussalam */
+ { "BO", V4L2_STD_NTSC_M }, /* Bolivia */
+ { "BR", V4L2_STD_PAL_M }, /* Brazil */
+ { "BS", V4L2_STD_NTSC_M }, /* Bahamas */
+ { "BW", V4L2_STD_PAL_I }, /* Botswana */
+ { "BY", V4L2_STD_SECAM_D }, /* Belarus */
+ { "BZ", V4L2_STD_NTSC_M }, /* Belize */
+ { "CA", V4L2_STD_NTSC_M }, /* Canada */
+ { "CD", V4L2_STD_SECAM_K1 }, /* The Democratic Republic of the Congo */
+ { "CF", V4L2_STD_SECAM_K1 }, /* Central African Republic */
+ { "CG", V4L2_STD_SECAM_K1 }, /* Republic of the Congo */
+ { "CH", V4L2_STD_PAL_BG }, /* Switzerland */
+ { "CL", V4L2_STD_NTSC_M }, /* Chile */
+ { "CM", V4L2_STD_PAL_BG }, /* Cameroon */
+ { "CN", V4L2_STD_PAL_D }, /* China */
+ { "CO", V4L2_STD_NTSC_M }, /* Colombia */
+ { "CR", V4L2_STD_NTSC_M }, /* Costa Rica */
+ { "CU", V4L2_STD_NTSC_M }, /* Cuba */
+ { "CY", V4L2_STD_PAL_BG }, /* Cyprus */
+ { "CZ", V4L2_STD_PAL_D }, /* Czech Republic */
+ { "DE", V4L2_STD_PAL_BG }, /* Germany */
+ { "DJ", V4L2_STD_SECAM_B }, /* Djibouti */
+ { "DK", V4L2_STD_PAL_BG }, /* Denmark */
+ { "DO", V4L2_STD_NTSC_M }, /* Dominican Republic */
+ { "DZ", V4L2_STD_PAL_BG }, /* Algeria */
+ { "EC", V4L2_STD_NTSC_M }, /* Ecuador */
+ { "EE", V4L2_STD_SECAM_DK }, /* Estonia */
+ { "EG", V4L2_STD_PAL_BG }, /* Egypt */
+ { "ES", V4L2_STD_PAL_BG }, /* Spain */
+ { "ET", V4L2_STD_PAL_BG }, /* Ethiopia */
+ { "FI", V4L2_STD_PAL_BG }, /* Finland */
+ { "FR", V4L2_STD_SECAM_L }, /* France */
+ { "GA", V4L2_STD_SECAM_K1 }, /* Gabon */
+ { "GB", V4L2_STD_PAL_I }, /* United Kingdom */
+ { "GE", V4L2_STD_SECAM_DK }, /* Georgia */
+ { "GH", V4L2_STD_PAL_B }, /* Ghana */
+ { "GI", V4L2_STD_PAL_BG }, /* Gibraltar */
+ { "GL", V4L2_STD_PAL_BG }, /* Greenland */
+ { "GM", V4L2_STD_PAL_I }, /* Gambia */
+ { "GQ", V4L2_STD_PAL_BG }, /* Equatorial Guinea */
+ { "GR", V4L2_STD_SECAM_B }, /* Greece */
+ { "GR", V4L2_STD_SECAM_G }, /* Greece */
+ { "GT", V4L2_STD_NTSC_M }, /* Guatemala */
+ { "GU", V4L2_STD_NTSC_M }, /* Guam */
+ { "GW", V4L2_STD_PAL_I }, /* Guinea-Bissau */
+ { "HK", V4L2_STD_PAL_I }, /* Hong Kong */
+ { "HN", V4L2_STD_NTSC_M }, /* Honduras */
+ { "HR", V4L2_STD_PAL_BG }, /* Croatia */
+ { "HU", V4L2_STD_SECAM_DK }, /* Hungary */
+ { "ID", V4L2_STD_PAL_B }, /* Indonesia */
+ { "IE", V4L2_STD_PAL_I }, /* Ireland */
+ { "IL", V4L2_STD_PAL_BG }, /* Israel */
+ { "IN", V4L2_STD_PAL_B }, /* India */
+ { "IQ", V4L2_STD_SECAM_B | V4L2_STD_SECAM_G }, /* Iraq */
+ { "IR", V4L2_STD_SECAM_B | V4L2_STD_SECAM_G }, /* Iran */
+ { "IS", V4L2_STD_PAL_BG }, /* Iceland */
+ { "IT", V4L2_STD_PAL_BG }, /* Italy */
+ { "JM", V4L2_STD_NTSC_M }, /* Jamaica */
+ { "JO", V4L2_STD_PAL_BG }, /* Jordan */
+ { "JP", V4L2_STD_NTSC_M_JP }, /* Japan */
+ { "KE", V4L2_STD_PAL_BG }, /* Kenya */
+ { "KH", V4L2_STD_PAL_BG }, /* Cambodia */
+ { "KM", V4L2_STD_SECAM_K1 }, /* Comoros */
+ { "KN", V4L2_STD_NTSC_M }, /* Saint Kitts and Nevis */
+ { "KP", V4L2_STD_PAL_D }, /* North Korea */
+ { "KR", V4L2_STD_NTSC_M_KR }, /* South Korea */
+ { "KW", V4L2_STD_PAL_BG }, /* Kuwait */
+ { "KZ", V4L2_STD_SECAM_D }, /* Kazakhstan */
+ { "KZ", V4L2_STD_SECAM_K }, /* Kazakhstan */
+ { "LB", V4L2_STD_SECAM_B }, /* Lebanon */
+ { "LK", V4L2_STD_PAL_BG }, /* Sri Lanka */
+ { "LR", V4L2_STD_PAL_BG }, /* Liberia */
+ { "LS", V4L2_STD_PAL_I }, /* Lesotho */
+ { "LT", V4L2_STD_SECAM_DK }, /* Lithuania */
+ { "LU", V4L2_STD_PAL_BG }, /* Luxembourg */
+ { "LY", V4L2_STD_PAL_BG }, /* Libya */
+ { "MA", V4L2_STD_SECAM_B | V4L2_STD_SECAM_G }, /* Morocco */
+ { "MC", V4L2_STD_PAL_G }, /* Monaco */
+ { "MD", V4L2_STD_SECAM_DK }, /* Moldova */
+ { "MG", V4L2_STD_SECAM_K | V4L2_STD_SECAM_K1 }, /* Madagascar */
+ { "ML", V4L2_STD_SECAM_B | V4L2_STD_SECAM_G }, /* Mali */
+ { "MM", V4L2_STD_NTSC_M }, /* Myanmar */
+ { "MN", V4L2_STD_SECAM_D }, /* Mongolia */
+ { "MR", V4L2_STD_SECAM_B }, /* Mauritania */
+ { "MS", V4L2_STD_NTSC_M }, /* Montserrat */
+ { "MT", V4L2_STD_PAL_B }, /* Malta */
+ { "MU", V4L2_STD_SECAM_B | V4L2_STD_SECAM_G }, /* Mauritius */
+ { "MV", V4L2_STD_PAL_B }, /* Maldives */
+ { "MW", V4L2_STD_PAL_I }, /* Malawi */
+ { "MX", V4L2_STD_NTSC_M }, /* Mexico */
+ { "MY", V4L2_STD_PAL_BG }, /* Malaysia */
+ { "MZ", V4L2_STD_PAL_G }, /* Mozambique */
+ { "NA", V4L2_STD_PAL_I }, /* Namibia */
+ { "NE", V4L2_STD_SECAM_K1 }, /* Niger */
+ { "NG", V4L2_STD_PAL_BG }, /* Nigeria */
+ { "NI", V4L2_STD_NTSC_M }, /* Nicaragua */
+ { "NL", V4L2_STD_PAL_BG }, /* Netherlands */
+ { "NO", V4L2_STD_PAL_BG }, /* Norway */
+ { "NP", V4L2_STD_PAL_B }, /* Nepal */
+ { "NZ", V4L2_STD_PAL_BG }, /* New Zealand */
+ { "OM", V4L2_STD_PAL_BG }, /* Oman */
+ { "PA", V4L2_STD_NTSC_M }, /* Panama */
+ { "PE", V4L2_STD_NTSC_M }, /* Peru */
+ { "PG", V4L2_STD_PAL_BG }, /* Papua New Guinea */
+ { "PH", V4L2_STD_NTSC_M }, /* Philippines */
+ { "PK", V4L2_STD_PAL_BG }, /* Pakistan */
+ { "PL", V4L2_STD_SECAM_K }, /* Poland */
+ { "PR", V4L2_STD_NTSC_M }, /* Puerto Rico */
+ { "PT", V4L2_STD_PAL_BG }, /* Portugal */
+ { "PY", V4L2_STD_PAL_N }, /* Paraguay */
+ { "QA", V4L2_STD_PAL_BG }, /* Qatar */
+ { "RO", V4L2_STD_PAL_DK }, /* Romania */
+ { "RU", V4L2_STD_SECAM_DK }, /* Russia */
+ { "RW", V4L2_STD_SECAM_K1 }, /* Rwanda */
+ { "SA", V4L2_STD_PAL_BG | V4L2_STD_SECAM_B | V4L2_STD_SECAM_G }, /* Saudi Arabia */
+ { "SC", V4L2_STD_PAL_B }, /* Seychelles */
+ { "SD", V4L2_STD_PAL_BG }, /* Sudan */
+ { "SE", V4L2_STD_PAL_BG }, /* Sweden */
+ { "SG", V4L2_STD_PAL_BG }, /* Singapore */
+ { "SI", V4L2_STD_PAL_BG }, /* Slovenia */
+ { "SK", V4L2_STD_SECAM_DK }, /* Slovak Republic */
+ { "SL", V4L2_STD_PAL_BG }, /* Sierra Leone */
+ { "SN", V4L2_STD_SECAM_K1 }, /* Senegal */
+ { "SO", V4L2_STD_PAL_BG }, /* Somalia */
+ { "SR", V4L2_STD_NTSC_M }, /* Suriname */
+ { "ST", V4L2_STD_PAL_B }, /* Sao Tome and Principe */
+ { "SV", V4L2_STD_NTSC_M }, /* El Salvador */
+ { "SY", V4L2_STD_PAL_BG }, /* Syria */
+ { "SZ", V4L2_STD_PAL_BG }, /* Swaziland */
+ { "TD", V4L2_STD_SECAM_K1 }, /* Chad */
+ { "TG", V4L2_STD_SECAM_K1 }, /* Togo */
+ { "TH", V4L2_STD_PAL_BG }, /* Thailand */
+ { "TN", V4L2_STD_PAL_BG }, /* Tunisia */
+ { "TR", V4L2_STD_PAL_BG }, /* Turkey */
+ { "TT", V4L2_STD_NTSC_M }, /* Trinidad and Tobago */
+ { "TW", V4L2_STD_NTSC_M }, /* Taiwan */
+ { "TZ", V4L2_STD_PAL_I }, /* Tanzania */
+ { "UA", V4L2_STD_SECAM_DK }, /* Ukraine */
+ { "UG", V4L2_STD_PAL_B }, /* Uganda */
+ { "US", V4L2_STD_NTSC_M }, /* United States */
+ { "UY", V4L2_STD_PAL_N }, /* Uruguay */
+ { "VC", V4L2_STD_SECAM_K1 }, /* Cape Verde */
+ { "VE", V4L2_STD_NTSC_M }, /* Venezuela */
+ { "VG", V4L2_STD_NTSC_M }, /* Virgin Islands, British */
+ { "VI", V4L2_STD_NTSC_M }, /* Virgin Islands, U.S. */
+ { "VN", V4L2_STD_SECAM_DK }, /* Vietnam */
+ { "WS", V4L2_STD_NTSC_M }, /* Samoa */
+ { "YE", V4L2_STD_PAL_BG }, /* Yemen */
+ { "ZA", V4L2_STD_PAL_I }, /* South Africa */
+ { "ZM", V4L2_STD_PAL_G }, /* Zambia */
+ { "ZW", V4L2_STD_PAL_G }, /* Zimbabwe */
+ { NULL, 0 }
+};
diff --git a/v4l2-apps/lib/v4l2.h b/v4l2-apps/lib/v4l2.h
new file mode 100644
index 000000000..172688853
--- /dev/null
+++ b/v4l2-apps/lib/v4l2.h
@@ -0,0 +1,45 @@
+/* Copyright (C) 2006 Hans Verkuil <hverkuil@xs4all.nl>
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _V4L2_H_
+#define _V4L2_H_
+
+/* --------------------------------------------------------------------- */
+
+struct v4l2_channel_list {
+ const char * const name; /* channel name */
+ unsigned freq; /* channel frequency in kHz */
+};
+
+struct v4l2_channel_lists {
+ const char * const name; /* channel list name */
+ const struct v4l2_channel_list * const list;
+ unsigned count; /* number of channels in channel list */
+};
+
+extern const struct v4l2_channel_lists v4l2_channel_lists[];
+
+/* This list is sorted alphabetically on ISO code. The last item is
+ denoted by a NULL pointer for the iso_code. */
+struct v4l2_country_std_map {
+ const char * const iso_code; /* The 2-character upper case ISO-3166 country code */
+ v4l2_std_id std; /* The TV standard(s) in use */
+};
+
+extern const struct v4l2_country_std_map v4l2_country_std_map[];
+
+#endif
diff --git a/v4l2-apps/test/Makefile b/v4l2-apps/test/Makefile
new file mode 100644
index 000000000..b6a83b2b3
--- /dev/null
+++ b/v4l2-apps/test/Makefile
@@ -0,0 +1,20 @@
+# Makefile for linuxtv.org v4l2-apps/test
+
+CPPFLAGS += -I../../linux/include
+
+binaries = ioctl-test \
+ sliced-vbi-test \
+ sliced-vbi-detect \
+ vbi-test \
+ v4lgrab
+
+.PHONY: all clean install
+
+all: $(binaries)
+
+clean::
+ rm -f $(binaries)
+
+install:
+
+include ../Make.rules
diff --git a/test/ioctl-test.c b/v4l2-apps/test/ioctl-test.c
index 4b47cd9e7..61659dc78 100644
--- a/test/ioctl-test.c
+++ b/v4l2-apps/test/ioctl-test.c
@@ -36,7 +36,7 @@
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
-#include "../linux/include/linux/videodev.h"
+#include "linux/videodev.h"
#ifdef INTERNAL
typedef __u8 u8;
@@ -201,7 +201,8 @@ int ioctls[] = {
/********************************************************************/
int main (void)
{
- int fd=0, ret=0,i;
+ int fd=0, ret=0;
+ unsigned i;
char *device="/dev/video0";
union v4l_parms p;
diff --git a/test/sliced-vbi-detect.c b/v4l2-apps/test/sliced-vbi-detect.c
index 22c9c2461..f6d8da01f 100644
--- a/test/sliced-vbi-detect.c
+++ b/v4l2-apps/test/sliced-vbi-detect.c
@@ -49,7 +49,7 @@ static void detect(int fh, struct v4l2_sliced_vbi_format *fmt)
for (cnt = 0; cnt < 5; cnt++) {
int size = read(fh, buf, fmt->io_size);
- int i;
+ unsigned i;
if (size <= 0) {
printf("size = %d\n", size);
diff --git a/test/sliced-vbi-test.c b/v4l2-apps/test/sliced-vbi-test.c
index 3b4a7fc8f..c8877de30 100644
--- a/test/sliced-vbi-test.c
+++ b/v4l2-apps/test/sliced-vbi-test.c
@@ -455,7 +455,7 @@ int main(int argc, char **argv)
buf = malloc(fmt.fmt.sliced.io_size);
for (;;) {
int size = read(fh, buf, fmt.fmt.sliced.io_size);
- int i;
+ unsigned i;
if (size <= 0)
break;
diff --git a/test/v4lgrab.c b/v4l2-apps/test/v4lgrab.c
index 079b62848..c8d433c1d 100644
--- a/test/v4lgrab.c
+++ b/v4l2-apps/test/v4lgrab.c
@@ -43,7 +43,7 @@
\
case 16: \
(r) = (g) = (b) = \
- *((unsigned short *) buf); \
+ *((unsigned short *) buf); \
buf += 2; \
break; \
} \
@@ -80,113 +80,115 @@
} \
}
-int get_brightness_adj(unsigned char *image, long size, int *brightness) {
- long i, tot = 0;
- for (i=0;i<size*3;i++)
- tot += image[i];
- *brightness = (128 - tot/(size*3))/3;
- return !((tot/(size*3)) >= 126 && (tot/(size*3)) <= 130);
+int get_brightness_adj(unsigned char *image, long size, int *brightness)
+{
+ long i, tot = 0;
+ for (i=0;i<size*3;i++)
+ tot += image[i];
+ *brightness = (128 - tot/(size*3))/3;
+ return !((tot/(size*3)) >= 126 && (tot/(size*3)) <= 130);
}
-int main(int argc, char ** argv)
+int main(int argc, char **argv)
{
- int fd = open(FILE, O_RDONLY), f;
- struct video_capability cap;
- struct video_window win;
- struct video_picture vpic;
-
- unsigned char *buffer, *src;
- int bpp = 24, r, g, b;
- unsigned int i, src_depth;
-
- if (fd < 0) {
- perror(FILE);
- exit(1);
- }
-
- if (ioctl(fd, VIDIOCGCAP, &cap) < 0) {
- perror("VIDIOGCAP");
- fprintf(stderr, "(" FILE " not a video4linux device?)\n");
- close(fd);
- exit(1);
- }
-
- if (ioctl(fd, VIDIOCGWIN, &win) < 0) {
- perror("VIDIOCGWIN");
- close(fd);
- exit(1);
- }
-
- if (ioctl(fd, VIDIOCGPICT, &vpic) < 0) {
- perror("VIDIOCGPICT");
- close(fd);
- exit(1);
- }
-
- if (cap.type & VID_TYPE_MONOCHROME) {
- vpic.depth=8;
- vpic.palette=VIDEO_PALETTE_GREY; /* 8bit grey */
- if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) {
- vpic.depth=6;
- if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) {
- vpic.depth=4;
- if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) {
- fprintf(stderr, "Unable to find a supported capture format.\n");
- close(fd);
- exit(1);
+ int fd = open(FILE, O_RDONLY), f;
+ struct video_capability cap;
+ struct video_window win;
+ struct video_picture vpic;
+
+ unsigned char *buffer, *src;
+ int bpp = 24, r, g, b;
+ unsigned int i, src_depth;
+
+ if (fd < 0) {
+ perror(FILE);
+ exit(1);
+ }
+
+ if (ioctl(fd, VIDIOCGCAP, &cap) < 0) {
+ perror("VIDIOGCAP");
+ fprintf(stderr, "(" FILE " not a video4linux device?)\n");
+ close(fd);
+ exit(1);
+ }
+
+ if (ioctl(fd, VIDIOCGWIN, &win) < 0) {
+ perror("VIDIOCGWIN");
+ close(fd);
+ exit(1);
+ }
+
+ if (ioctl(fd, VIDIOCGPICT, &vpic) < 0) {
+ perror("VIDIOCGPICT");
+ close(fd);
+ exit(1);
}
- }
- }
- } else {
- vpic.depth=24;
- vpic.palette=VIDEO_PALETTE_RGB24;
-
- if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) {
- vpic.palette=VIDEO_PALETTE_RGB565;
- vpic.depth=16;
-
- if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) {
- vpic.palette=VIDEO_PALETTE_RGB555;
- vpic.depth=15;
-
- if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) {
- fprintf(stderr, "Unable to find a supported capture format.\n");
- return -1;
+
+ if (cap.type & VID_TYPE_MONOCHROME) {
+ vpic.depth=8;
+ vpic.palette=VIDEO_PALETTE_GREY; /* 8bit grey */
+ if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) {
+ vpic.depth=6;
+ if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) {
+ vpic.depth=4;
+ if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) {
+ fprintf(stderr, "Unable to find a supported capture format.\n");
+ close(fd);
+ exit(1);
+ }
+ }
+ }
+ }
+ else {
+ vpic.depth=24;
+ vpic.palette=VIDEO_PALETTE_RGB24;
+
+ if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) {
+ vpic.palette=VIDEO_PALETTE_RGB565;
+ vpic.depth=16;
+
+ if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) {
+ vpic.palette=VIDEO_PALETTE_RGB555;
+ vpic.depth=15;
+
+ if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) {
+ fprintf(stderr, "Unable to find a supported capture format.\n");
+ return -1;
+ }
+ }
+ }
+ }
+
+ buffer = malloc(win.width * win.height * bpp);
+ if (!buffer) {
+ fprintf(stderr, "Out of memory.\n");
+ exit(1);
}
- }
- }
- }
-
- buffer = malloc(win.width * win.height * bpp);
- if (!buffer) {
- fprintf(stderr, "Out of memory.\n");
- exit(1);
- }
-
- do {
- int newbright;
- read(fd, buffer, win.width * win.height * bpp);
- f = get_brightness_adj(buffer, win.width * win.height, &newbright);
- if (f) {
- vpic.brightness += (newbright << 8);
- if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) {
- perror("VIDIOSPICT");
- break;
- }
- }
- } while (f);
-
- fprintf(stdout, "P6\n%d %d 255\n", win.width, win.height);
-
- src = buffer;
-
- for (i = 0; i < win.width * win.height; i++) {
- READ_VIDEO_PIXEL(src, vpic.palette, src_depth, r, g, b);
- fputc(r>>8, stdout);
- fputc(g>>8, stdout);
- fputc(b>>8, stdout);
- }
-
- close(fd);
- return 0;
+
+ do {
+ int newbright;
+ read(fd, buffer, win.width * win.height * bpp);
+ f = get_brightness_adj(buffer, win.width * win.height, &newbright);
+ if (f) {
+ vpic.brightness += (newbright << 8);
+ if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) {
+ perror("VIDIOSPICT");
+ break;
+ }
+ }
+ } while (f);
+
+ fprintf(stdout, "P6\n%d %d 255\n", win.width, win.height);
+
+ src = buffer;
+
+ for (i = 0; i < win.width * win.height; i++) {
+ READ_VIDEO_PIXEL(src, vpic.palette, src_depth, r, g, b);
+ fputc(r>>8, stdout);
+ fputc(g>>8, stdout);
+ fputc(b>>8, stdout);
+ }
+
+ close(fd);
+ return 0;
}
diff --git a/test/vbi-test.c b/v4l2-apps/test/vbi-test.c
index c1a141bff..c1a141bff 100644
--- a/test/vbi-test.c
+++ b/v4l2-apps/test/vbi-test.c
diff --git a/v4l2-apps/util/Makefile b/v4l2-apps/util/Makefile
new file mode 100644
index 000000000..8555ef5b6
--- /dev/null
+++ b/v4l2-apps/util/Makefile
@@ -0,0 +1,22 @@
+# Makefile for linuxtv.org v4l2-apps/util
+
+CPPFLAGS += -I../../linux/include
+
+binaries = v4l2-ctl
+
+.PHONY: all clean install qv4l2
+
+all: $(binaries) qv4l2
+
+clean::
+ rm -f $(binaries)
+ -if [ -f qv4l2/Makefile ]; then make -C qv4l2 $@; fi
+ -rm -f qv4l2/qv4l2 qv4l2/Makefile
+
+qv4l2:
+ if [ ! -f qv4l2/Makefile ]; then (cd qv4l2; qmake); fi
+ make -C qv4l2
+
+install:
+
+include ../Make.rules
diff --git a/test/qv4l2/qv4l2.cpp b/v4l2-apps/util/qv4l2/ctrl-tab.cpp
index ba43ad5c8..c7d1a275c 100644
--- a/test/qv4l2/qv4l2.cpp
+++ b/v4l2-apps/util/qv4l2/ctrl-tab.cpp
@@ -1,18 +1,8 @@
#include "qv4l2.h"
+#include "v4l2.h"
-#include <qimage.h>
-#include <qpixmap.h>
-#include <qtoolbar.h>
-#include <qtoolbutton.h>
-#include <qpopupmenu.h>
-#include <qmenubar.h>
-#include <qfile.h>
-#include <qfiledialog.h>
#include <qstatusbar.h>
-#include <qmessagebox.h>
-#include <qapplication.h>
-#include <qaccel.h>
#include <qlineedit.h>
#include <qvalidator.h>
#include <qlayout.h>
@@ -24,185 +14,13 @@
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qpushbutton.h>
-#include <qpainter.h>
-#include <qpaintdevicemetrics.h>
+#include <qtooltip.h>
#include <qwhatsthis.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
-#include "fileopen.xpm"
-
-ApplicationWindow::ApplicationWindow()
- : QMainWindow( 0, "V4L2 main window", WDestructiveClose | WGroupLeader )
-{
- QPixmap openIcon, saveIcon;
-
- fd = -1;
-
- sigMapper = NULL;
- QToolBar * fileTools = new QToolBar( this, "file operations" );
- fileTools->setLabel( "File Operations" );
-
- openIcon = QPixmap( fileopen );
- QToolButton * fileOpen
- = new QToolButton( openIcon, "Open File", QString::null,
- this, SLOT(choose()), fileTools, "open file" );
-
- (void)QWhatsThis::whatsThisButton( fileTools );
-
- const char * fileOpenText = "<p><img source=\"fileopen\"> "
- "Click this button to open a <em>new v4l device</em>.<br>"
- "You can also select the <b>Open</b> command "
- "from the <b>File</b> menu.</p>";
-
- QWhatsThis::add( fileOpen, fileOpenText );
-
- QMimeSourceFactory::defaultFactory()->setPixmap( "fileopen", openIcon );
-
- QPopupMenu * file = new QPopupMenu( this );
- menuBar()->insertItem( "&File", file );
-
-
- int id;
- id = file->insertItem( openIcon, "&Open...",
- this, SLOT(choose()), CTRL+Key_O );
- file->setWhatsThis( id, fileOpenText );
-
- file->insertSeparator();
-
- file->insertItem( "&Close", this, SLOT(close()), CTRL+Key_W );
-
- file->insertItem( "&Quit", qApp, SLOT( closeAllWindows() ), CTRL+Key_Q );
-
- menuBar()->insertSeparator();
-
- QPopupMenu * help = new QPopupMenu( this );
- menuBar()->insertItem( "&Help", help );
-
- help->insertItem( "&About", this, SLOT(about()), Key_F1 );
- help->insertItem( "What's &This", this, SLOT(whatsThis()), SHIFT+Key_F1 );
-
- statusBar()->message( "Ready", 2000 );
-
- tabs = new QTabWidget(this);
- tabs->setMargin(3);
-
- //resize( 450, 600 );
-}
-
-
-ApplicationWindow::~ApplicationWindow()
-{
- if (fd >= 0) ::close(fd);
-}
-
-
-void ApplicationWindow::setDevice(const QString &device)
-{
- if (fd >= 0) ::close(fd);
- while (QWidget *page = tabs->page(0)) {
- tabs->removePage(page);
- delete page;
- }
- delete tabs;
- delete sigMapper;
- tabs = new QTabWidget(this);
- tabs->setMargin(3);
- sigMapper = new QSignalMapper(this);
- connect(sigMapper, SIGNAL(mapped(int)), this, SLOT(ctrlAction(int)));
- ctrlMap.clear();
- widgetMap.clear();
- classMap.clear();
- audioInput = NULL;
-
- fd = ::open(device, O_RDONLY);
- if (fd >= 0) {
- addGeneralTab();
- addTabs();
- }
- if (QWidget *current = tabs->currentPage()) {
- current->show();
- }
- tabs->show();
- tabs->setFocus();
- setCentralWidget(tabs);
-}
-
-void ApplicationWindow::addGeneralTab()
-{
- int cnt = 0;
- QVBox *vbox = new QVBox(tabs);
- QGrid *grid = new QGrid(4, vbox);
- grid->setSpacing(3);
- tabs->addTab(vbox, "General");
-
- struct v4l2_input vin;
- memset(&vin, 0, sizeof(vin));
- if (ioctl(fd, VIDIOC_ENUMINPUT, &vin) >= 0) {
- QLabel *label = new QLabel("Input", grid);
- label->setAlignment(Qt::AlignRight);
- QComboBox *combo = new QComboBox(grid);
- while (ioctl(fd, VIDIOC_ENUMINPUT, &vin) >= 0) {
- combo->insertItem((char *)vin.name);
- vin.index++;
- }
- connect(combo, SIGNAL(activated(int)), SLOT(inputChanged(int)));
- cnt++;
- }
-
- struct v4l2_output vout;
- memset(&vout, 0, sizeof(vout));
- if (ioctl(fd, VIDIOC_ENUMOUTPUT, &vout) >= 0) {
- QLabel *label = new QLabel("Output", grid);
- label->setAlignment(Qt::AlignRight);
- QComboBox *combo = new QComboBox(grid);
- while (ioctl(fd, VIDIOC_ENUMOUTPUT, &vout) >= 0) {
- combo->insertItem((char *)vout.name);
- vout.index++;
- }
- connect(combo, SIGNAL(activated(int)), SLOT(outputChanged(int)));
- cnt++;
- }
-
- struct v4l2_audio vaudio;
- memset(&vaudio, 0, sizeof(vaudio));
- if (ioctl(fd, VIDIOC_ENUMAUDIO, &vaudio) >= 0) {
- QLabel *label = new QLabel("Input Audio", grid);
- label->setAlignment(Qt::AlignRight);
- audioInput = new QComboBox(grid);
- vaudio.index = 0;
- while (ioctl(fd, VIDIOC_ENUMAUDIO, &vaudio) >= 0) {
- audioInput->insertItem((char *)vaudio.name);
- vaudio.index++;
- }
- connect(audioInput, SIGNAL(activated(int)), SLOT(inputAudioChanged(int)));
- cnt++;
- }
-
- struct v4l2_audioout vaudioout;
- memset(&vaudioout, 0, sizeof(vaudioout));
- if (ioctl(fd, VIDIOC_ENUMAUDOUT, &vaudioout) >= 0) {
- QLabel *label = new QLabel("Output Audio", grid);
- label->setAlignment(Qt::AlignRight);
- QComboBox *combo = new QComboBox(grid);
- while (ioctl(fd, VIDIOC_ENUMAUDOUT, &vaudioout) >= 0) {
- combo->insertItem((char *)vaudioout.name);
- vaudioout.index++;
- }
- connect(combo, SIGNAL(activated(int)), SLOT(outputAudioChanged(int)));
- cnt++;
- }
-
- if (cnt & 1) {
- new QWidget(grid);
- new QWidget(grid);
- }
- QWidget *stretch = new QWidget(grid);
- stretch->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored);
-}
-
void ApplicationWindow::addTabs()
{
struct v4l2_queryctrl qctrl;
@@ -468,13 +286,17 @@ long long ApplicationWindow::getVal64(unsigned id)
{
const v4l2_queryctrl &qctrl = ctrlMap[id];
QWidget *w = widgetMap[qctrl.id];
+ long long v = 0;
switch (qctrl.type) {
case V4L2_CTRL_TYPE_INTEGER64:
- return static_cast<QLineEdit *>(w)->text().toLongLong();
+ v = static_cast<QLineEdit *>(w)->text().toLongLong();
+ break;
default:
- return 0;
+ break;
}
+ setWhat(w, id, v);
+ return v;
}
int ApplicationWindow::getVal(unsigned id)
@@ -483,20 +305,25 @@ int ApplicationWindow::getVal(unsigned id)
QWidget *w = widgetMap[qctrl.id];
v4l2_querymenu qmenu;
int i, idx;
+ int v = 0;
switch (qctrl.type) {
case V4L2_CTRL_TYPE_INTEGER:
if (qctrl.flags & V4L2_CTRL_FLAG_SLIDER) {
- return static_cast<QSlider *>(w)->value();
+ v = static_cast<QSlider *>(w)->value();
+ break;
}
if (qctrl.maximum - qctrl.minimum <= 255) {
- return static_cast<QSpinBox *>(w)->value();
+ v = static_cast<QSpinBox *>(w)->value();
+ break;
}
- return static_cast<QLineEdit *>(w)->text().toInt();
+ v = static_cast<QLineEdit *>(w)->text().toInt();
+ break;
case V4L2_CTRL_TYPE_BOOLEAN:
- return static_cast<QCheckBox *>(w)->isChecked();
+ v = static_cast<QCheckBox *>(w)->isChecked();
+ break;
case V4L2_CTRL_TYPE_MENU:
idx = static_cast<QComboBox *>(w)->currentItem();
@@ -508,12 +335,14 @@ int ApplicationWindow::getVal(unsigned id)
if (idx-- == 0)
break;
}
- return i;
+ v = i;
+ break;
default:
break;
}
- return 0;
+ setWhat(w, id, v);
+ return v;
}
void ApplicationWindow::updateCtrl(unsigned id)
@@ -532,9 +361,11 @@ void ApplicationWindow::updateCtrl(unsigned id)
c.value = getVal(id);
if (::ioctl(fd, VIDIOC_S_CTRL, &c)) {
int err = errno;
+ char buf[200];
- printf("error %08x (%s): %s\n", id,
+ sprintf(buf, "Error %08x (%s): %s", id,
ctrlMap[id].name, strerror(err));
+ statusBar()->message(buf, 10000);
}
return;
}
@@ -553,9 +384,11 @@ void ApplicationWindow::updateCtrl(unsigned id)
ctrls.controls = &c;
if (::ioctl(fd, VIDIOC_S_EXT_CTRLS, &ctrls)) {
int err = errno;
+ char buf[200];
- printf("error %08x (%s): %s\n", id,
+ sprintf(buf, "Error %08x (%s): %s", id,
ctrlMap[id].name, strerror(err));
+ statusBar()->message(buf, 10000);
}
else if (ctrlMap[id].flags & V4L2_CTRL_FLAG_UPDATE)
refresh(ctrl_class);
@@ -578,9 +411,11 @@ void ApplicationWindow::refresh(unsigned ctrl_class)
c.id = id;
if (::ioctl(fd, VIDIOC_G_CTRL, &c)) {
int err = errno;
+ char buf[200];
- printf("error %08x (%s): %s\n", id,
+ sprintf(buf, "Error %08x (%s): %s", id,
ctrlMap[id].name, strerror(err));
+ statusBar()->message(buf, 10000);
}
setVal(id, c.value);
}
@@ -601,12 +436,15 @@ void ApplicationWindow::refresh(unsigned ctrl_class)
int err = errno;
if (ctrls.error_idx >= ctrls.count) {
- printf("error: %s\n", strerror(err));
+ statusBar()->message(strerror(err), 10000);
}
else {
unsigned id = c[ctrls.error_idx].id;
- printf("error %08x (%s): %s\n", id,
+ char buf[200];
+
+ sprintf(buf, "Error %08x (%s): %s", id,
ctrlMap[id].name, strerror(err));
+ statusBar()->message(buf, 10000);
}
}
else {
@@ -624,6 +462,51 @@ void ApplicationWindow::refresh(unsigned ctrl_class)
delete [] c;
}
+void ApplicationWindow::setWhat(QWidget *w, unsigned id, long long v)
+{
+ const v4l2_queryctrl &qctrl = ctrlMap[id];
+ QString what;
+ QString flags = getCtrlFlags(qctrl.flags);
+
+ switch (qctrl.type) {
+ case V4L2_CTRL_TYPE_INTEGER:
+ QWhatsThis::add(w, what.sprintf("Integer type control\n"
+ "Minimum: %d\n"
+ "Maximum: %d\n"
+ "Current: %d\n"
+ "Default: %d\n",
+ qctrl.minimum, qctrl.maximum, (int)v, qctrl.default_value) + flags);
+ break;
+
+ case V4L2_CTRL_TYPE_INTEGER64:
+ QWhatsThis::add(w, what.sprintf("64-bit Integer type control\n"
+ "Current: %lld\n", v) + flags);
+ break;
+
+ case V4L2_CTRL_TYPE_BUTTON:
+ QWhatsThis::add(w, what.sprintf("Button type control\n") + flags);
+ break;
+
+ case V4L2_CTRL_TYPE_BOOLEAN:
+ QWhatsThis::add(w, what.sprintf("Boolean type control\n"
+ "Current: %d\n"
+ "Default: %d\n",
+ (int)v, qctrl.default_value) + flags);
+ break;
+
+ case V4L2_CTRL_TYPE_MENU:
+ QWhatsThis::add(w, what.sprintf("Menu type control\n"
+ "Minimum: %d\n"
+ "Maximum: %d\n"
+ "Current: %d\n"
+ "Default: %d\n",
+ qctrl.minimum, qctrl.maximum, (int)v, qctrl.default_value) + flags);
+ break;
+ default:
+ break;
+ }
+}
+
void ApplicationWindow::setVal(unsigned id, int v)
{
const v4l2_queryctrl &qctrl = ctrlMap[id];
@@ -659,6 +542,7 @@ void ApplicationWindow::setVal(unsigned id, int v)
default:
break;
}
+ setWhat(w, id, v);
}
void ApplicationWindow::setVal64(unsigned id, long long v)
@@ -673,6 +557,7 @@ void ApplicationWindow::setVal64(unsigned id, long long v)
default:
break;
}
+ setWhat(w, id, v);
}
void ApplicationWindow::setDefaults(unsigned ctrl_class)
@@ -687,68 +572,21 @@ void ApplicationWindow::setDefaults(unsigned ctrl_class)
ctrlAction(ctrl_class | CTRL_UPDATE);
}
-void ApplicationWindow::choose()
-{
- QString fn = QFileDialog::getOpenFileName( "/dev/v4l", QString::null,
- this);
- if ( !fn.isEmpty() ) {
- setDevice(fn);
- }
- else
- statusBar()->message( "Loading aborted", 2000 );
-}
-
-
-void ApplicationWindow::closeEvent( QCloseEvent* ce )
+QString ApplicationWindow::getCtrlFlags(unsigned flags)
{
- ce->accept();
+ QString s;
+
+ if (flags & V4L2_CTRL_FLAG_GRABBED)
+ s += "grabbed ";
+ if (flags & V4L2_CTRL_FLAG_READ_ONLY)
+ s += "readonly ";
+ if (flags & V4L2_CTRL_FLAG_UPDATE)
+ s += "update ";
+ if (flags & V4L2_CTRL_FLAG_INACTIVE)
+ s += "inactive ";
+ if (flags & V4L2_CTRL_FLAG_SLIDER)
+ s += "slider ";
+ if (s.length()) s = QString("Flags: ") + s;
+ return s;
}
-void ApplicationWindow::inputChanged(int input)
-{
- ioctl(fd, VIDIOC_S_INPUT, &input);
- struct v4l2_audio vaudio;
- memset(&vaudio, 0, sizeof(vaudio));
- if (audioInput && ioctl(fd, VIDIOC_G_AUDIO, &vaudio) >= 0) {
- audioInput->setCurrentItem(vaudio.index);
- }
-}
-
-void ApplicationWindow::outputChanged(int output)
-{
- ioctl(fd, VIDIOC_S_OUTPUT, &output);
-}
-
-void ApplicationWindow::inputAudioChanged(int input)
-{
- struct v4l2_audio vaudio;
- memset(&vaudio, 0, sizeof(vaudio));
- vaudio.index = input;
- ioctl(fd, VIDIOC_S_AUDIO, &vaudio);
-}
-
-void ApplicationWindow::outputAudioChanged(int output)
-{
- struct v4l2_audioout vaudioout;
- memset(&vaudioout, 0, sizeof(vaudioout));
- vaudioout.index = output;
- ioctl(fd, VIDIOC_S_AUDOUT, &vaudioout);
-}
-
-void ApplicationWindow::about()
-{
- QMessageBox::about( this, "V4L2 Control Panel",
- "This program allows easy experimenting with video4linux devices.");
-}
-
-
-int main(int argc, char **argv)
-{
- QApplication a(argc, argv);
- ApplicationWindow *mw = new ApplicationWindow();
- mw->setCaption( "V4L2 Control Panel" );
- mw->setDevice("/dev/video0");
- mw->show();
- a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
- return a.exec();
-}
diff --git a/test/qv4l2/fileopen.xpm b/v4l2-apps/util/qv4l2/fileopen.xpm
index 880417eee..880417eee 100644
--- a/test/qv4l2/fileopen.xpm
+++ b/v4l2-apps/util/qv4l2/fileopen.xpm
diff --git a/v4l2-apps/util/qv4l2/general-tab.cpp b/v4l2-apps/util/qv4l2/general-tab.cpp
new file mode 100644
index 000000000..a19cf911b
--- /dev/null
+++ b/v4l2-apps/util/qv4l2/general-tab.cpp
@@ -0,0 +1,326 @@
+/* qv4l2: a control panel controlling v4l2 devices.
+ *
+ * Copyright (C) 2006 Hans Verkuil <hverkuil@xs4all.nl>
+ *
+ * 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 the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+#include "qv4l2.h"
+#include "general-tab.h"
+#include "v4l2.h"
+
+#include <qlabel.h>
+#include <qspinbox.h>
+#include <qcombobox.h>
+#include <qwhatsthis.h>
+
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+
+GeneralTab::GeneralTab(int _fd, int n, QWidget *parent) :
+ QGrid(n, parent),
+ fd(_fd)
+{
+ int cnt = 0;
+
+ setSpacing(3);
+
+ memset(&tuner, 0, sizeof(tuner));
+ ioctl(fd, VIDIOC_G_TUNER, &tuner);
+
+ struct v4l2_input vin;
+ memset(&vin, 0, sizeof(vin));
+ if (ioctl(fd, VIDIOC_ENUMINPUT, &vin) >= 0) {
+ QLabel *label = new QLabel("Input", this);
+ label->setAlignment(Qt::AlignRight);
+ videoInput = new QComboBox(this);
+ while (ioctl(fd, VIDIOC_ENUMINPUT, &vin) >= 0) {
+ videoInput->insertItem((char *)vin.name);
+ vin.index++;
+ }
+ connect(videoInput, SIGNAL(activated(int)), SLOT(inputChanged(int)));
+ updateVideoInput();
+ cnt++;
+ }
+
+ struct v4l2_output vout;
+ memset(&vout, 0, sizeof(vout));
+ if (ioctl(fd, VIDIOC_ENUMOUTPUT, &vout) >= 0) {
+ QLabel *label = new QLabel("Output", this);
+ label->setAlignment(Qt::AlignRight);
+ videoOutput = new QComboBox(this);
+ while (ioctl(fd, VIDIOC_ENUMOUTPUT, &vout) >= 0) {
+ videoOutput->insertItem((char *)vout.name);
+ vout.index++;
+ }
+ connect(videoOutput, SIGNAL(activated(int)), SLOT(outputChanged(int)));
+ updateVideoOutput();
+ cnt++;
+ }
+
+ struct v4l2_audio vaudio;
+ memset(&vaudio, 0, sizeof(vaudio));
+ if (ioctl(fd, VIDIOC_ENUMAUDIO, &vaudio) >= 0) {
+ QLabel *label = new QLabel("Input Audio", this);
+ label->setAlignment(Qt::AlignRight);
+ audioInput = new QComboBox(this);
+ vaudio.index = 0;
+ while (ioctl(fd, VIDIOC_ENUMAUDIO, &vaudio) >= 0) {
+ audioInput->insertItem((char *)vaudio.name);
+ vaudio.index++;
+ }
+ connect(audioInput, SIGNAL(activated(int)), SLOT(inputAudioChanged(int)));
+ updateAudioInput();
+ cnt++;
+ }
+
+ struct v4l2_audioout vaudioout;
+ memset(&vaudioout, 0, sizeof(vaudioout));
+ if (ioctl(fd, VIDIOC_ENUMAUDOUT, &vaudioout) >= 0) {
+ QLabel *label = new QLabel("Output Audio", this);
+ label->setAlignment(Qt::AlignRight);
+ audioOutput = new QComboBox(this);
+ while (ioctl(fd, VIDIOC_ENUMAUDOUT, &vaudioout) >= 0) {
+ audioOutput->insertItem((char *)vaudioout.name);
+ vaudioout.index++;
+ }
+ connect(audioOutput, SIGNAL(activated(int)), SLOT(outputAudioChanged(int)));
+ updateAudioOutput();
+ cnt++;
+ }
+
+ struct v4l2_standard vs;
+ memset(&vs, 0, sizeof(vs));
+ if (ioctl(fd, VIDIOC_ENUMSTD, &vs) >= 0) {
+ QLabel *label = new QLabel("TV Standard", this);
+ label->setAlignment(Qt::AlignRight);
+ tvStandard = new QComboBox(this);
+ while (ioctl(fd, VIDIOC_ENUMSTD, &vs) >= 0) {
+ tvStandard->insertItem((char *)vs.name);
+ vs.index++;
+ }
+ connect(tvStandard, SIGNAL(activated(int)), SLOT(standardChanged(int)));
+ updateStandard();
+ cnt++;
+ }
+
+ bool first = cnt & 1;
+
+ if (first) {
+ QString what;
+ QLabel *label = new QLabel("Frequency", this);
+ label->setAlignment(Qt::AlignRight);
+ freq = new QSpinBox(tuner.rangelow, tuner.rangehigh, 1, this);
+ QWhatsThis::add(freq, what.sprintf("Frequency\n"
+ "Low: %d\n"
+ "High: %d\n",
+ tuner.rangelow, tuner.rangehigh));
+ connect(freq, SIGNAL(valueChanged(int)), SLOT(freqChanged(int)));
+ updateFreq();
+ cnt++;
+ }
+
+ {
+ QLabel *label = new QLabel("Frequency Tables", this);
+ label->setAlignment(Qt::AlignRight);
+ freqTable = new QComboBox(this);
+ for (int i = 0; v4l2_channel_lists[i].name; i++) {
+ freqTable->insertItem(v4l2_channel_lists[i].name);
+ }
+ connect(freqTable, SIGNAL(activated(int)), SLOT(freqTableChanged(int)));
+
+ label = new QLabel("Channels", this);
+ label->setAlignment(Qt::AlignRight);
+ freqChannel = new QComboBox(this);
+ connect(freqChannel, SIGNAL(activated(int)), SLOT(freqChannelChanged(int)));
+ updateFreqChannel();
+ }
+
+ if (!first) {
+ QString what;
+ QLabel *label = new QLabel("Frequency", this);
+ label->setAlignment(Qt::AlignRight);
+ freq = new QSpinBox(tuner.rangelow, tuner.rangehigh, 1, this);
+ QWhatsThis::add(freq, what.sprintf("Frequency\n"
+ "Low: %d\n"
+ "High: %d\n",
+ tuner.rangelow, tuner.rangehigh));
+ connect(freq, SIGNAL(valueChanged(int)), SLOT(freqChanged(int)));
+ updateFreq();
+ cnt++;
+ }
+
+ if (cnt & 1) {
+ new QWidget(this);
+ new QWidget(this);
+ }
+ QWidget *stretch = new QWidget(this);
+ stretch->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored);
+}
+
+void GeneralTab::inputChanged(int input)
+{
+ g_mw->doIoctl("Set Input", VIDIOC_S_INPUT, &input);
+ struct v4l2_audio vaudio;
+ memset(&vaudio, 0, sizeof(vaudio));
+ if (audioInput && ioctl(fd, VIDIOC_G_AUDIO, &vaudio) >= 0) {
+ audioInput->setCurrentItem(vaudio.index);
+ updateAudioInput();
+ }
+ updateVideoInput();
+}
+
+void GeneralTab::outputChanged(int output)
+{
+ g_mw->doIoctl("Set Output", VIDIOC_S_OUTPUT, &output);
+ updateVideoOutput();
+}
+
+void GeneralTab::inputAudioChanged(int input)
+{
+ struct v4l2_audio vaudio;
+ memset(&vaudio, 0, sizeof(vaudio));
+ vaudio.index = input;
+ g_mw->doIoctl("Set Audio Input", VIDIOC_S_AUDIO, &vaudio);
+ updateAudioInput();
+}
+
+void GeneralTab::outputAudioChanged(int output)
+{
+ struct v4l2_audioout vaudioout;
+ memset(&vaudioout, 0, sizeof(vaudioout));
+ vaudioout.index = output;
+ g_mw->doIoctl("Set Audio Output", VIDIOC_S_AUDOUT, &vaudioout);
+ updateAudioOutput();
+}
+
+void GeneralTab::standardChanged(int std)
+{
+ struct v4l2_standard vs;
+ memset(&vs, 0, sizeof(vs));
+ vs.index = std;
+ ioctl(fd, VIDIOC_ENUMSTD, &vs);
+ g_mw->doIoctl("Set TV Standard", VIDIOC_S_STD, &vs.id);
+ updateStandard();
+}
+
+void GeneralTab::freqTableChanged(int)
+{
+ updateFreqChannel();
+ freqChannelChanged(0);
+}
+
+void GeneralTab::freqChannelChanged(int idx)
+{
+ freq->setValue((int)(v4l2_channel_lists[freqTable->currentItem()].list[idx].freq / 62.5));
+}
+
+void GeneralTab::freqChanged(int val)
+{
+ struct v4l2_frequency f;
+
+ memset(&f, 0, sizeof(f));
+ f.type = V4L2_TUNER_ANALOG_TV;
+ f.frequency = val;
+ g_mw->doIoctl("Set frequency", VIDIOC_S_FREQUENCY, &f);
+}
+
+void GeneralTab::updateVideoInput()
+{
+ int input;
+
+ ioctl(fd, VIDIOC_G_INPUT, &input);
+ videoInput->setCurrentItem(input);
+}
+
+void GeneralTab::updateVideoOutput()
+{
+ int output;
+
+ ioctl(fd, VIDIOC_G_OUTPUT, &output);
+ videoOutput->setCurrentItem(output);
+}
+
+void GeneralTab::updateAudioInput()
+{
+ struct v4l2_audio audio;
+ QString what;
+
+ memset(&audio, 0, sizeof(audio));
+ ioctl(fd, VIDIOC_G_AUDIO, &audio);
+ audioInput->setCurrentItem(audio.index);
+ if (audio.capability & V4L2_AUDCAP_STEREO)
+ what = "stereo input";
+ else
+ what = "mono input";
+ if (audio.capability & V4L2_AUDCAP_AVL)
+ what += ", has AVL";
+ if (audio.mode & V4L2_AUDMODE_AVL)
+ what += ", AVL is on";
+ QWhatsThis::add(audioInput, what);
+}
+
+void GeneralTab::updateAudioOutput()
+{
+ struct v4l2_audioout audio;
+
+ memset(&audio, 0, sizeof(audio));
+ ioctl(fd, VIDIOC_G_AUDOUT, &audio);
+ audioOutput->setCurrentItem(audio.index);
+}
+
+void GeneralTab::updateStandard()
+{
+ v4l2_std_id std;
+ struct v4l2_standard vs;
+ QString what;
+ ioctl(fd, VIDIOC_G_STD, &std);
+ memset(&vs, 0, sizeof(vs));
+ while (ioctl(fd, VIDIOC_ENUMSTD, &vs) != -1) {
+ if (vs.id & std) {
+ tvStandard->setCurrentItem(vs.index);
+ what.sprintf("TV Standard (0x%llX)\n"
+ "Frame period: %f (%d/%d)\n"
+ "Frame lines: %d\n", std,
+ (double)vs.frameperiod.numerator / vs.frameperiod.denominator,
+ vs.frameperiod.numerator, vs.frameperiod.denominator,
+ vs.framelines);
+ QWhatsThis::add(tvStandard, what);
+ return;
+ }
+ vs.index++;
+ }
+}
+
+void GeneralTab::updateFreq()
+{
+ struct v4l2_frequency f;
+
+ memset(&f, 0, sizeof(f));
+ ioctl(fd, VIDIOC_G_FREQUENCY, &f);
+ freq->setValue(f.frequency);
+}
+
+void GeneralTab::updateFreqChannel()
+{
+ freqChannel->clear();
+ int tbl = freqTable->currentItem();
+ const struct v4l2_channel_list *list = v4l2_channel_lists[tbl].list;
+ for (unsigned i = 0; i < v4l2_channel_lists[tbl].count; i++)
+ freqChannel->insertItem(list[i].name);
+}
+
diff --git a/v4l2-apps/util/qv4l2/general-tab.h b/v4l2-apps/util/qv4l2/general-tab.h
new file mode 100644
index 000000000..44003fd40
--- /dev/null
+++ b/v4l2-apps/util/qv4l2/general-tab.h
@@ -0,0 +1,71 @@
+/* qv4l2: a control panel controlling v4l2 devices.
+ *
+ * Copyright (C) 2006 Hans Verkuil <hverkuil@xs4all.nl>
+ *
+ * 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 the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef GENERAL_TAB_H
+#define GENERAL_TAB_H
+
+#include <linux/videodev2.h>
+#include <qgrid.h>
+
+class QComboBox;
+class QSpinBox;
+
+class GeneralTab: public QGrid
+{
+ Q_OBJECT
+
+public:
+ GeneralTab(int fd, int n, QWidget *parent = 0);
+ virtual ~GeneralTab() {}
+
+private slots:
+ void inputChanged(int);
+ void outputChanged(int);
+ void inputAudioChanged(int);
+ void outputAudioChanged(int);
+ void standardChanged(int);
+ void freqTableChanged(int);
+ void freqChannelChanged(int);
+ void freqChanged(int);
+
+private:
+ void updateVideoInput();
+ void updateVideoOutput();
+ void updateAudioInput();
+ void updateAudioOutput();
+ void updateStandard();
+ void updateFreq();
+ void updateFreqChannel();
+
+ int fd;
+ struct v4l2_tuner tuner;
+
+ // General tab
+ QComboBox *videoInput;
+ QComboBox *videoOutput;
+ QComboBox *audioInput;
+ QComboBox *audioOutput;
+ QComboBox *tvStandard;
+ QSpinBox *freq;
+ QComboBox *freqTable;
+ QComboBox *freqChannel;
+};
+
+#endif
diff --git a/v4l2-apps/util/qv4l2/qv4l2.cpp b/v4l2-apps/util/qv4l2/qv4l2.cpp
new file mode 100644
index 000000000..f9fb07e09
--- /dev/null
+++ b/v4l2-apps/util/qv4l2/qv4l2.cpp
@@ -0,0 +1,178 @@
+
+#include "qv4l2.h"
+#include "general-tab.h"
+#include "v4l2.h"
+
+#include <qimage.h>
+#include <qpixmap.h>
+#include <qtoolbar.h>
+#include <qtoolbutton.h>
+#include <qpopupmenu.h>
+#include <qmenubar.h>
+#include <qfile.h>
+#include <qfiledialog.h>
+#include <qstatusbar.h>
+#include <qapplication.h>
+#include <qmessagebox.h>
+#include <qlineedit.h>
+#include <qvalidator.h>
+#include <qlayout.h>
+#include <qvbox.h>
+#include <qhbox.h>
+#include <qlabel.h>
+#include <qslider.h>
+#include <qspinbox.h>
+#include <qcombobox.h>
+#include <qcheckbox.h>
+#include <qpushbutton.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+
+#include "fileopen.xpm"
+
+ApplicationWindow::ApplicationWindow()
+ : QMainWindow( 0, "V4L2 main window", WDestructiveClose | WGroupLeader )
+{
+ QPixmap openIcon, saveIcon;
+
+ fd = -1;
+
+ sigMapper = NULL;
+ QToolBar * fileTools = new QToolBar( this, "file operations" );
+ fileTools->setLabel( "File Operations" );
+
+ openIcon = QPixmap( fileopen );
+ QToolButton * fileOpen
+ = new QToolButton( openIcon, "Open File", QString::null,
+ this, SLOT(choose()), fileTools, "open file" );
+
+ (void)QWhatsThis::whatsThisButton( fileTools );
+
+ const char * fileOpenText = "<p><img source=\"fileopen\"> "
+ "Click this button to open a <em>new v4l device</em>.<br>"
+ "You can also select the <b>Open</b> command "
+ "from the <b>File</b> menu.</p>";
+
+ QWhatsThis::add( fileOpen, fileOpenText );
+
+ QMimeSourceFactory::defaultFactory()->setPixmap( "fileopen", openIcon );
+
+ QPopupMenu * file = new QPopupMenu( this );
+ menuBar()->insertItem( "&File", file );
+
+
+ int id;
+ id = file->insertItem( openIcon, "&Open...",
+ this, SLOT(choose()), CTRL+Key_O );
+ file->setWhatsThis( id, fileOpenText );
+
+ file->insertSeparator();
+
+ file->insertItem( "&Close", this, SLOT(close()), CTRL+Key_W );
+
+ file->insertItem( "&Quit", qApp, SLOT( closeAllWindows() ), CTRL+Key_Q );
+
+ menuBar()->insertSeparator();
+
+ QPopupMenu * help = new QPopupMenu( this );
+ menuBar()->insertItem( "&Help", help );
+
+ help->insertItem( "&About", this, SLOT(about()), Key_F1 );
+ help->insertItem( "What's &This", this, SLOT(whatsThis()), SHIFT+Key_F1 );
+
+ statusBar()->message( "Ready", 2000 );
+
+ tabs = new QTabWidget(this);
+ tabs->setMargin(3);
+
+ //resize( 450, 600 );
+}
+
+
+ApplicationWindow::~ApplicationWindow()
+{
+ if (fd >= 0) ::close(fd);
+}
+
+
+void ApplicationWindow::setDevice(const QString &device)
+{
+ if (fd >= 0) ::close(fd);
+ while (QWidget *page = tabs->page(0)) {
+ tabs->removePage(page);
+ delete page;
+ }
+ delete tabs;
+ delete sigMapper;
+ tabs = new QTabWidget(this);
+ tabs->setMargin(3);
+ sigMapper = new QSignalMapper(this);
+ connect(sigMapper, SIGNAL(mapped(int)), this, SLOT(ctrlAction(int)));
+ ctrlMap.clear();
+ widgetMap.clear();
+ classMap.clear();
+
+ fd = ::open(device, O_RDONLY);
+ if (fd >= 0) {
+ tabs->addTab(new GeneralTab(fd, 4, tabs), "General");
+ addTabs();
+ }
+ if (QWidget *current = tabs->currentPage()) {
+ current->show();
+ }
+ tabs->show();
+ tabs->setFocus();
+ setCentralWidget(tabs);
+}
+
+void ApplicationWindow::choose()
+{
+ QString fn = QFileDialog::getOpenFileName( "/dev/v4l", QString::null,
+ this);
+ if ( !fn.isEmpty() ) {
+ setDevice(fn);
+ }
+ else
+ statusBar()->message( "Loading aborted", 2000 );
+}
+
+
+void ApplicationWindow::closeEvent( QCloseEvent* ce )
+{
+ ce->accept();
+}
+
+bool ApplicationWindow::doIoctl(QString descr, unsigned cmd, void *arg)
+{
+ statusBar()->clear();
+ int err = ioctl(fd, cmd, arg);
+
+ if (err == -1) {
+ QString s = strerror(errno);
+ statusBar()->message(descr + ": " + s, 10000);
+ }
+ return err != -1;
+}
+
+void ApplicationWindow::about()
+{
+ QMessageBox::about( this, "V4L2 Control Panel",
+ "This program allows easy experimenting with video4linux devices.");
+}
+
+ApplicationWindow *g_mw;
+
+int main(int argc, char **argv)
+{
+ QApplication a(argc, argv);
+ g_mw = new ApplicationWindow();
+ g_mw->setCaption( "V4L2 Control Panel" );
+ g_mw->setDevice("/dev/video0");
+ g_mw->show();
+ a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
+ return a.exec();
+}
diff --git a/test/qv4l2/qv4l2.h b/v4l2-apps/util/qv4l2/qv4l2.h
index 1b3bc4ed6..1a0a8e15d 100644
--- a/test/qv4l2/qv4l2.h
+++ b/v4l2-apps/util/qv4l2/qv4l2.h
@@ -1,15 +1,24 @@
-/****************************************************************************
-** $Id: qt/application.h 3.3.6 edited Aug 31 2005 $
-**
-** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
-**
-** This file is part of an example program for Qt. This example
-** program may be used, distributed and modified without limitation.
-**
-*****************************************************************************/
-
-#ifndef APPLICATION_H
-#define APPLICATION_H
+/* qv4l2: a control panel controlling v4l2 devices.
+ *
+ * Copyright (C) 2006 Hans Verkuil <hverkuil@xs4all.nl>
+ *
+ * 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 the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef QV4L2_H
+#define QV4L2_H
#include <qmainwindow.h>
#include <qtabwidget.h>
@@ -18,10 +27,10 @@
#include <map>
#include <vector>
-#define __user
#include <linux/videodev2.h>
class QComboBox;
+class QSpinBox;
typedef std::vector<unsigned> ClassIDVec;
typedef std::map<unsigned, ClassIDVec> ClassMap;
@@ -44,6 +53,7 @@ public:
~ApplicationWindow();
void setDevice(const QString &device);
+ bool doIoctl(QString descr, unsigned cmd, void *arg);
protected:
void closeEvent( QCloseEvent* );
@@ -51,16 +61,11 @@ protected:
private slots:
void choose();
void ctrlAction(int);
- void inputChanged(int);
- void outputChanged(int);
- void inputAudioChanged(int);
- void outputAudioChanged(int);
void about();
private:
void addTabs();
- void addGeneralTab();
void finishGrid(QWidget *vbox, QGrid *grid, unsigned ctrl_class, bool odd);
void addCtrl(QGrid *grid, const struct v4l2_queryctrl &qctrl);
void updateCtrl(unsigned id);
@@ -70,6 +75,15 @@ private:
long long getVal64(unsigned id);
void setVal(unsigned id, int v);
void setVal64(unsigned id, long long v);
+ QString getCtrlFlags(unsigned flags);
+ void setWhat(QWidget *w, unsigned id, long long v);
+ void updateVideoInput();
+ void updateVideoOutput();
+ void updateAudioInput();
+ void updateAudioOutput();
+ void updateStandard();
+ void updateFreq();
+ void updateFreqChannel();
QString filename;
QSignalMapper *sigMapper;
@@ -78,10 +92,8 @@ private:
CtrlMap ctrlMap;
WidgetMap widgetMap;
ClassMap classMap;
-
- // General tab
- QComboBox *audioInput;
};
+extern ApplicationWindow *g_mw;
#endif
diff --git a/test/qv4l2/qv4l2.pro b/v4l2-apps/util/qv4l2/qv4l2.pro
index 62eb56b07..c53a098b5 100644
--- a/test/qv4l2/qv4l2.pro
+++ b/v4l2-apps/util/qv4l2/qv4l2.pro
@@ -3,8 +3,10 @@
######################################################################
TEMPLATE = app
-INCLUDEPATH += . ../../linux/include
+INCLUDEPATH += . ../../../linux/include ../../lib
+CONFIG += debug
# Input
-HEADERS += qv4l2.h
-SOURCES += qv4l2.cpp
+HEADERS += qv4l2.h general-tab.h
+SOURCES += qv4l2.cpp general-tab.cpp ctrl-tab.cpp
+LIBS += -lv4l2 -L../../lib
diff --git a/test/v4l2-ctl.cpp b/v4l2-apps/util/v4l2-ctl.cpp
index 63bc3e82a..bb7b4bd81 100644
--- a/test/v4l2-ctl.cpp
+++ b/v4l2-apps/util/v4l2-ctl.cpp
@@ -78,17 +78,31 @@ enum Option {
OptSetTuner = 't',
OptGetVideoFormat = 'V',
OptSetVideoFormat = 'v',
- OptLast = 128
+
+ OptGetSlicedVbiFormat = 128,
+ OptSetSlicedVbiFormat,
+ OptGetSlicedVbiOutFormat,
+ OptSetSlicedVbiOutFormat,
+ OptGetOverlayFormat,
+ //OptSetOverlayFormat, TODO
+ OptGetVbiFormat,
+ //OptSetVbiFormat, TODO
+ OptGetVbiOutFormat,
+ //OptSetVbiOutFormat, TODO
+ OptAll,
+ OptStreamOff,
+ OptStreamOn,
+ OptListStandards,
+ OptLogStatus,
+ OptVerbose,
+ OptGetVideoOutFormat,
+ OptSetVideoOutFormat,
+ OptGetSlicedVbiCap,
+ OptGetSlicedVbiOutCap,
+ OptLast = 256
};
static char options[OptLast];
-static int option_all = 0;
-static int option_streamoff = 0;
-static int option_streamon = 0;
-static int option_list_stds = 0;
-static int option_version = 0;
-static int option_log_status = 0;
-static int option_verbose = 0;
typedef std::vector<struct v4l2_ext_control> ctrl_list;
static ctrl_list user_ctrls;
@@ -105,6 +119,19 @@ static ctrl_get_list get_ctrls;
typedef std::map<std::string,std::string> ctrl_set_map;
static ctrl_set_map set_ctrls;
+typedef struct {
+ unsigned flag;
+ const char *str;
+} flag_def;
+
+static const flag_def service_def[] = {
+ { V4L2_SLICED_TELETEXT_B, "teletext" },
+ { V4L2_SLICED_VPS, "vps" },
+ { V4L2_SLICED_CAPTION_525, "cc" },
+ { V4L2_SLICED_WSS_625, "wss" },
+ { 0, NULL }
+};
+
/* fmts specified */
#define FMTWidth (1L<<0)
#define FMTHeight (1L<<1)
@@ -112,10 +139,12 @@ static ctrl_set_map set_ctrls;
static struct option long_options[] = {
{"list-audio-inputs", no_argument, 0, OptListAudioInputs},
{"list-audio-outputs", no_argument, 0, OptListAudioOutputs},
- {"all", no_argument, &option_all, 1},
+ {"all", no_argument, 0, OptAll},
{"device", required_argument, 0, OptSetDevice},
- {"get-format", no_argument, 0, OptGetVideoFormat},
- {"set-format", required_argument, 0, OptSetVideoFormat},
+ {"get-fmt-video", no_argument, 0, OptGetVideoFormat},
+ {"set-fmt-video", required_argument, 0, OptSetVideoFormat},
+ {"get-fmt-video-out", no_argument, 0, OptGetVideoOutFormat},
+ {"set-fmt-video-out", required_argument, 0, OptSetVideoOutFormat},
{"help", no_argument, 0, OptHelp},
{"get-output", no_argument, 0, OptGetOutput},
{"set-output", required_argument, 0, OptSetOutput},
@@ -129,9 +158,9 @@ static struct option long_options[] = {
{"set-audio-output", required_argument, 0, OptSetAudioOutput},
{"get-freq", no_argument, 0, OptGetFreq},
{"set-freq", required_argument, 0, OptSetFreq},
- {"streamoff", no_argument, &option_streamoff, 1},
- {"streamon", no_argument, &option_streamon, 1},
- {"list-standards", no_argument, &option_list_stds, 1},
+ {"streamoff", no_argument, 0, OptStreamOff},
+ {"streamon", no_argument, 0, OptStreamOn},
+ {"list-standards", no_argument, 0, OptListStandards},
{"get-standard", no_argument, 0, OptGetStandard},
{"set-standard", required_argument, 0, OptSetStandard},
{"info", no_argument, 0, OptGetDriverInfo},
@@ -141,24 +170,32 @@ static struct option long_options[] = {
{"get-ctrl", required_argument, 0, OptGetCtrl},
{"get-tuner", no_argument, 0, OptGetTuner},
{"set-tuner", required_argument, 0, OptSetTuner},
- {"version", no_argument, &option_version, 1},
- {"verbose", no_argument, &option_verbose, 1},
- {"log-status", no_argument, &option_log_status, 1},
+ {"verbose", no_argument, 0, OptVerbose},
+ {"log-status", no_argument, 0, OptLogStatus},
+ {"get-fmt-overlay", no_argument, 0, OptGetOverlayFormat},
+ {"get-fmt-sliced-vbi", no_argument, 0, OptGetSlicedVbiFormat},
+ {"set-fmt-sliced-vbi", required_argument, 0, OptSetSlicedVbiFormat},
+ {"get-fmt-sliced-vbi-out", no_argument, 0, OptGetSlicedVbiOutFormat},
+ {"set-fmt-sliced-vbi-out", required_argument, 0, OptSetSlicedVbiOutFormat},
+ {"get-fmt-vbi", no_argument, 0, OptGetVbiFormat},
+ {"get-fmt-vbi-out", no_argument, 0, OptGetVbiOutFormat},
+ {"get-sliced-vbi-cap", no_argument, 0, OptGetSlicedVbiCap},
+ {"get-sliced-vbi-out-cap", no_argument, 0, OptGetSlicedVbiOutCap},
{0, 0, 0, 0}
};
-void usage(void)
+static void usage(void)
{
printf("Usage:\n");
printf(" --all display all information available\n");
printf(" -A, --get-audio-input\n");
- printf(" query the current audio input [VIDIOC_G_AUDIO]\n");
+ printf(" query the audio input [VIDIOC_G_AUDIO]\n");
printf(" -a, --set-audio-input=<num>\n");
- printf(" set the current audio input to <num> [VIDIOC_S_AUDIO]\n");
+ printf(" set the audio input to <num> [VIDIOC_S_AUDIO]\n");
printf(" -B, --get-audio-output\n");
- printf(" query the current audio output [VIDIOC_G_AUDOUT]\n");
+ printf(" query the audio output [VIDIOC_G_AUDOUT]\n");
printf(" -b, --set-audio-output=<num>\n");
- printf(" set the current audio output to <num> [VIDIOC_S_AUDOUT]\n");
+ printf(" set the audio output to <num> [VIDIOC_S_AUDOUT]\n");
printf(" -C, --get-ctrl=<ctrl>[,<ctrl>...]\n");
printf(" get the value of the controls [VIDIOC_G_EXT_CTRLS]\n");
printf(" -c, --set-ctrl=<ctrl>=<val>[,<ctrl>=<val>...]\n");
@@ -166,43 +203,75 @@ void usage(void)
printf(" -D, --info show driver info [VIDIOC_QUERYCAP]\n");
printf(" -d, --device=<dev> use device <dev> instead of /dev/video0\n");
printf(" if <dev> is a single digit, then /dev/video<dev> is used\n");
- printf(" -F, --get-freq query the current frequency [VIDIOC_G_FREQUENCY]\n");
+ printf(" -F, --get-freq query the frequency [VIDIOC_G_FREQUENCY]\n");
printf(" -f, --set-freq=<freq>\n");
- printf(" set the current frequency to <freq> MHz [VIDIOC_S_FREQUENCY]\n");
+ printf(" set the frequency to <freq> MHz [VIDIOC_S_FREQUENCY]\n");
printf(" -h, --help display this help message\n");
- printf(" -I, --get-input query the current video input [VIDIOC_G_INPUT]\n");
+ printf(" -I, --get-input query the video input [VIDIOC_G_INPUT]\n");
printf(" -i, --set-input=<num>\n");
- printf(" set the current video input to <num> [VIDIOC_S_INPUT]\n");
+ printf(" set the video input to <num> [VIDIOC_S_INPUT]\n");
printf(" -l, --list-ctrls display all controls and their values [VIDIOC_QUERYCTRL]\n");
printf(" -L, --list-ctrls-menus\n");
printf(" display all controls, their values and the menus [VIDIOC_QUERYMENU]\n");
printf(" -N, --list-outputs display video outputs [VIDIOC_ENUMOUTPUT]\n");
printf(" -n, --list-inputs display video inputs [VIDIOC_ENUMINPUT]\n");
- printf(" -O, --get-output query the current video output [VIDIOC_G_OUTPUT]\n");
+ printf(" -O, --get-output query the video output [VIDIOC_G_OUTPUT]\n");
printf(" -o, --set-output=<num>\n");
- printf(" set the current video output to <num> [VIDIOC_S_OUTPUT]\n");
+ printf(" set the video output to <num> [VIDIOC_S_OUTPUT]\n");
printf(" -Q, --list-audio-outputs\n");
printf(" display audio outputs [VIDIOC_ENUMAUDOUT]\n");
printf(" -q, --list-audio-inputs\n");
printf(" display audio inputs [VIDIOC_ENUMAUDIO]\n");
printf(" -S, --get-standard\n");
- printf(" query the current video standard [VIDIOC_G_STD]\n");
+ printf(" query the video standard [VIDIOC_G_STD]\n");
printf(" -s, --set-standard=<num>\n");
- printf(" set the current video standard to <num> [VIDIOC_S_STD]\n");
+ printf(" set the video standard to <num> [VIDIOC_S_STD]\n");
printf(" <num> can be a numerical v4l2_std value, or it can be one of:\n");
printf(" pal-X (X = B/G/H/N/Nc/I/D/K/M) or just 'pal' (V4L2_STD_PAL)\n");
printf(" ntsc-X (X = M/J/K) or just 'ntsc' (V4L2_STD_NTSC)\n");
printf(" secam-X (X = B/G/H/D/K/L/Lc) or just 'secam' (V4L2_STD_SECAM)\n");
printf(" --list-standards display supported video standards [VIDIOC_ENUMSTD]\n");
- printf(" -T, --get-tuner query the current tuner settings [VIDIOC_G_TUNER]\n");
+ printf(" -T, --get-tuner query the tuner settings [VIDIOC_G_TUNER]\n");
printf(" -t, --set-tuner=<mode>\n");
printf(" set the audio mode of the tuner [VIDIOC_S_TUNER]\n");
- printf(" -V, --get-format query the current data format [VIDIOC_G_FMT]\n");
- printf(" -v, --set-format=width=<x>,height=<y>\n");
- printf(" set the current data format [VIDIOC_S_FMT]\n");
printf(" Possible values: 0 (mono), 1 (stereo), 2 (lang2), 3 (lang1), 4 (both)\n");
+ printf(" -V, --get-fmt-video\n");
+ printf(" query the video capture format [VIDIOC_G_FMT]\n");
+ printf(" -v, --set-fmt-video=width=<x>,height=<y>\n");
+ printf(" set the video capture format [VIDIOC_S_FMT]\n");
+ printf(" --get-fmt-video-out\n");
+ printf(" query the video output format [VIDIOC_G_FMT]\n");
+ printf(" --set-fmt-video-out=width=<x>,height=<y>\n");
+ printf(" set the video output format [VIDIOC_S_FMT]\n");
+ printf(" --get-fmt-overlay\n");
+ printf(" query the video overlay format [VIDIOC_G_FMT]\n");
+ printf(" --get-sliced-vbi-cap\n");
+ printf(" query the sliced VBI capture capabilities [VIDIOC_G_SLICED_VBI_CAP]\n");
+ printf(" --get-sliced-vbi-out-cap\n");
+ printf(" query the sliced VBI output capabilities [VIDIOC_G_SLICED_VBI_CAP]\n");
+ printf(" --get-fmt-sliced-vbi\n");
+ printf(" query the sliced VBI capture format [VIDIOC_G_FMT]\n");
+ printf(" --set-fmt-sliced-vbi=<mode>\n");
+ printf(" set the sliced VBI capture format to <mode> [VIDIOC_S_FMT]\n");
+ printf(" <mode> is a comma separated list of:\n");
+ printf(" off: turn off sliced VBI (cannot be combined with other modes)\n");
+ printf(" teletext: teletext (PAL/SECAM)\n");
+ printf(" cc: closed caption (NTSC)\n");
+ printf(" wss: widescreen signal (PAL/SECAM)\n");
+ printf(" vps: VPS (PAL/SECAM)\n");
+ printf(" --get-fmt-sliced-vbi-out\n");
+ printf(" query the sliced VBI output format [VIDIOC_G_FMT]\n");
+ printf(" --set-fmt-sliced-vbi-out=<mode>\n");
+ printf(" set the sliced VBI output format to <mode> [VIDIOC_S_FMT]\n");
+ printf(" <mode> is a comma separated list of:\n");
+ printf(" off: turn off sliced VBI (cannot be combined with other modes)\n");
+ printf(" teletext: teletext (PAL/SECAM)\n");
+ printf(" cc: closed caption (NTSC)\n");
+ printf(" wss: widescreen signal (PAL/SECAM)\n");
+ printf(" vps: VPS (PAL/SECAM)\n");
+ printf(" --get-fmt-vbi query the VBI capture format [VIDIOC_G_FMT]\n");
+ printf(" --get-fmt-vbi-out query the VBI output format [VIDIOC_G_FMT]\n");
printf(" --verbose turn on verbose ioctl error reporting.\n");
- printf(" --version shows the version number of this utility.\n");
printf("\n");
printf("Expert options:\n");
printf(" --streamoff turn the stream off [VIDIOC_STREAMOFF]\n");
@@ -211,6 +280,122 @@ void usage(void)
exit(0);
}
+static std::string num2s(unsigned num)
+{
+ char buf[10];
+
+ sprintf(buf, "%08x", num);
+ return buf;
+}
+
+static std::string buftype2s(int type)
+{
+ switch (type) {
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+ return "Video Capture";
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+ return "Video Output";
+ case V4L2_BUF_TYPE_VIDEO_OVERLAY:
+ return "Video Overlay";
+ case V4L2_BUF_TYPE_VBI_CAPTURE:
+ return "VBI Capture";
+ case V4L2_BUF_TYPE_VBI_OUTPUT:
+ return "VBI Output";
+ case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
+ return "Sliced VBI Capture";
+ case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
+ return "Sliced VBI Output";
+ case V4L2_BUF_TYPE_PRIVATE:
+ return "Private";
+ default:
+ return "Unknown (" + num2s(type) + ")";
+ }
+}
+
+static std::string fcc2s(unsigned int val)
+{
+ std::string s;
+
+ s += val & 0xff;
+ s += (val >> 8) & 0xff;
+ s += (val >> 16) & 0xff;
+ s += (val >> 24) & 0xff;
+ return s;
+}
+
+static std::string field2s(int val)
+{
+ switch (val) {
+ case V4L2_FIELD_ANY:
+ return "Any";
+ case V4L2_FIELD_NONE:
+ return "None";
+ case V4L2_FIELD_TOP:
+ return "Top";
+ case V4L2_FIELD_BOTTOM:
+ return "Bottom";
+ case V4L2_FIELD_INTERLACED:
+ return "Interlaced";
+ case V4L2_FIELD_SEQ_TB:
+ return "Sequential Top-Bottom";
+ case V4L2_FIELD_SEQ_BT:
+ return "Sequential Bottom-Top";
+ case V4L2_FIELD_ALTERNATE:
+ return "Alternating";
+ default:
+ return "Unknown (" + num2s(val) + ")";
+ }
+}
+
+static std::string colorspace2s(int val)
+{
+ switch (val) {
+ case V4L2_COLORSPACE_SMPTE170M:
+ return "Broadcast NTSC/PAL (SMPTE170M/ITU601)";
+ case V4L2_COLORSPACE_SMPTE240M:
+ return "1125-Line (US) HDTV (SMPTE240M)";
+ case V4L2_COLORSPACE_REC709:
+ return "HDTV and modern devices (ITU709)";
+ case V4L2_COLORSPACE_BT878:
+ return "Broken Bt878";
+ case V4L2_COLORSPACE_470_SYSTEM_M:
+ return "NTSC/M (ITU470/ITU601)";
+ case V4L2_COLORSPACE_470_SYSTEM_BG:
+ return "PAL/SECAM BG (ITU470/ITU601)";
+ case V4L2_COLORSPACE_JPEG:
+ return "JPEG (JFIF/ITU601)";
+ case V4L2_COLORSPACE_SRGB:
+ return "SRGB";
+ default:
+ return "Unknown (" + num2s(val) + ")";
+ }
+}
+
+static std::string flags2s(unsigned val, const flag_def *def)
+{
+ std::string s;
+
+ while (def->flag) {
+ if (val & def->flag) {
+ if (s.length()) s += " ";
+ s += def->str;
+ }
+ def++;
+ }
+ return s;
+}
+
+static void print_sliced_vbi_cap(struct v4l2_sliced_vbi_cap &cap)
+{
+// printf("\tType : %s\n", buftype2s(vfmt.type).c_str());
+ printf("\tService Set : %s\n",
+ flags2s(cap.service_set, service_def).c_str());
+ for (int i = 0; i < 24; i++) {
+ printf("\tService Line %2d: %8s / %-8s\n", i,
+ flags2s(cap.service_lines[0][i], service_def).c_str(),
+ flags2s(cap.service_lines[1][i], service_def).c_str());
+ }
+}
static std::string name2var(unsigned char *name)
{
@@ -260,17 +445,15 @@ static void print_qctrl(int fd, struct v4l2_queryctrl *queryctrl,
default: break;
}
if (queryctrl->flags) {
- printf(" flags=");
- if (queryctrl->flags & V4L2_CTRL_FLAG_GRABBED)
- printf("grabbed ");
- if (queryctrl->flags & V4L2_CTRL_FLAG_READ_ONLY)
- printf("readonly ");
- if (queryctrl->flags & V4L2_CTRL_FLAG_UPDATE)
- printf("update ");
- if (queryctrl->flags & V4L2_CTRL_FLAG_INACTIVE)
- printf("inactive ");
- if (queryctrl->flags & V4L2_CTRL_FLAG_SLIDER)
- printf("slider ");
+ const flag_def def[] = {
+ { V4L2_CTRL_FLAG_GRABBED, "grabbed" },
+ { V4L2_CTRL_FLAG_READ_ONLY, "readonly" },
+ { V4L2_CTRL_FLAG_UPDATE, "update" },
+ { V4L2_CTRL_FLAG_INACTIVE, "inactive" },
+ { V4L2_CTRL_FLAG_SLIDER, "slider" },
+ { 0, NULL }
+ };
+ printf(" flags=%s", flags2s(queryctrl->flags, def).c_str());
}
printf("\n");
if (queryctrl->type == V4L2_CTRL_TYPE_MENU && show_menus) {
@@ -367,40 +550,78 @@ static void find_controls(int fd)
}
}
-int printfmt(struct v4l2_format vfmt)
+static int printfmt(struct v4l2_format vfmt)
{
+ const flag_def vbi_def[] = {
+ { V4L2_VBI_UNSYNC, "unsynchronized" },
+ { V4L2_VBI_INTERLACED, "interlaced" },
+ { 0, NULL }
+ };
printf("Format:\n");
switch (vfmt.type) {
- case 1:
- printf("\tType : Video Capture\n");
- printf("\tWidth : %d\n", vfmt.fmt.pix.width);
- printf("\tHeight : %d\n", vfmt.fmt.pix.height);
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+ printf("\tType : %s\n", buftype2s(vfmt.type).c_str());
+ printf("\tWidth/Height : %u/%u\n", vfmt.fmt.pix.width, vfmt.fmt.pix.height);
+ printf("\tPixel Format : %s\n", fcc2s(vfmt.fmt.pix.pixelformat).c_str());
+ printf("\tField : %s\n", field2s(vfmt.fmt.pix.field).c_str());
+ printf("\tBytes per Line: %u\n", vfmt.fmt.pix.bytesperline);
+ printf("\tSize Image : %u\n", vfmt.fmt.pix.sizeimage);
+ printf("\tColorspace : %s\n", colorspace2s(vfmt.fmt.pix.colorspace).c_str());
+ if (vfmt.fmt.pix.priv)
+ printf("\tCustom Info : %08x\n", vfmt.fmt.pix.priv);
break;
- case 2:
- printf("\tType : Video Output\n");
+ case V4L2_BUF_TYPE_VIDEO_OVERLAY:
+ printf("\tType : %s\n", buftype2s(vfmt.type).c_str());
+ printf("\tLeft/Top : %d/%d\n",
+ vfmt.fmt.win.w.left, vfmt.fmt.win.w.top);
+ printf("\tWidth/Height: %d/%d\n",
+ vfmt.fmt.win.w.width, vfmt.fmt.win.w.height);
+ printf("\tField : %s\n", field2s(vfmt.fmt.win.field).c_str());
+ // TODO: check G_FBUF capabilities
+ printf("\tChroma Key : %08x\n", vfmt.fmt.win.chromakey);
+ printf("\tClip Count : %u\n", vfmt.fmt.win.clipcount);
break;
- case 3:
- printf("\tType : Video Overlay\n");
+ case V4L2_BUF_TYPE_VBI_CAPTURE:
+ case V4L2_BUF_TYPE_VBI_OUTPUT:
+ printf("\tType : %s\n", buftype2s(vfmt.type).c_str());
+ printf("\tSampling Rate : %u Hz\n", vfmt.fmt.vbi.sampling_rate);
+ printf("\tOffset : %u samples (%g secs after leading edge)\n",
+ vfmt.fmt.vbi.offset,
+ (double)vfmt.fmt.vbi.offset / (double)vfmt.fmt.vbi.sampling_rate);
+ printf("\tSamples per Line: %u\n", vfmt.fmt.vbi.samples_per_line);
+ printf("\tSample Format : %s\n", fcc2s(vfmt.fmt.vbi.sample_format).c_str());
+ printf("\tStart 1st Field : %u\n", vfmt.fmt.vbi.start[0]);
+ printf("\tCount 1st Field : %u\n", vfmt.fmt.vbi.count[0]);
+ printf("\tStart 2nd Field : %u\n", vfmt.fmt.vbi.start[1]);
+ printf("\tCount 2nd Field : %u\n", vfmt.fmt.vbi.count[1]);
+ if (vfmt.fmt.vbi.flags)
+ printf("\tFlags : %s\n", flags2s(vfmt.fmt.vbi.flags, vbi_def).c_str());
break;
- case 4:
- printf("\tType : VBI Capture\n");
- break;
- case 5:
- printf("\tType : VBI Output\n");
+ case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
+ case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
+ printf("\tType : %s\n", buftype2s(vfmt.type).c_str());
+ printf("\tService Set : %s\n",
+ flags2s(vfmt.fmt.sliced.service_set, service_def).c_str());
+ for (int i = 0; i < 24; i++) {
+ printf("\tService Line %2d: %8s / %-8s\n", i,
+ flags2s(vfmt.fmt.sliced.service_lines[0][i], service_def).c_str(),
+ flags2s(vfmt.fmt.sliced.service_lines[1][i], service_def).c_str());
+ }
+ printf("\tI/O Size : %u\n", vfmt.fmt.sliced.io_size);
break;
- case 0x80:
- printf("\tType : Private\n");
+ case V4L2_BUF_TYPE_PRIVATE:
+ printf("\tType: %s\n", buftype2s(vfmt.type).c_str());
break;
default:
- printf("\tType : Unknown: %d\n", vfmt.type);
+ printf("\tType: %s\n", buftype2s(vfmt.type).c_str());
return -1;
- break;
}
return 0;
}
-char *pts_to_string(char *str, unsigned long pts)
+static char *pts_to_string(char *str, unsigned long pts)
{
static char buf[256];
int hours, minutes, seconds, fracsec;
@@ -597,7 +818,7 @@ static int doioctl(int fd, int request, void *parm, const char *name)
{
int retVal;
- if (!option_verbose) return ioctl(fd, request, parm);
+ if (!options[OptVerbose]) return ioctl(fd, request, parm);
retVal = ioctl(fd, request, parm);
printf("%s: ", name);
if (retVal < 0)
@@ -668,18 +889,25 @@ int main(int argc, char **argv)
/* bitfield for fmts */
unsigned int set_fmts = 0;
+ unsigned int set_fmts_out = 0;
int mode = V4L2_TUNER_MODE_STEREO; /* set audio mode */
/* command args */
- char ch, *device = strdup("/dev/video0"); /* -d device */
- struct v4l2_format vfmt; /* set_format/get_format */
- struct v4l2_tuner tuner = { 0 };/* set_tuner/get_tuner */
+ int ch;
+ char *device = strdup("/dev/video0"); /* -d device */
+ struct v4l2_format vfmt; /* set_format/get_format for video */
+ struct v4l2_format vfmt_out; /* set_format/get_format video output */
+ struct v4l2_format vbi_fmt; /* set_format/get_format for sliced VBI */
+ struct v4l2_format vbi_fmt_out; /* set_format/get_format for sliced VBI output */
+ struct v4l2_format raw_fmt; /* set_format/get_format for VBI */
+ struct v4l2_format raw_fmt_out; /* set_format/get_format for VBI output */
+ struct v4l2_tuner tuner; /* set_tuner/get_tuner */
struct v4l2_capability vcap; /* list_cap */
struct v4l2_input vin; /* list_inputs */
struct v4l2_output vout; /* list_outputs */
struct v4l2_audio vaudio; /* list audio inputs */
- struct v4l2_audioout vaudout = { 0 }; /* audio outputs */
+ struct v4l2_audioout vaudout; /* audio outputs */
int input; /* set_input/get_input */
int output; /* set_output/get_output */
v4l2_std_id std; /* get_std/set_std */
@@ -689,6 +917,21 @@ int main(int argc, char **argv)
char short_options[26 * 2 * 2 + 1];
int idx = 0;
+ memset(&vfmt, 0, sizeof(vfmt));
+ memset(&vbi_fmt, 0, sizeof(vbi_fmt));
+ memset(&raw_fmt, 0, sizeof(raw_fmt));
+ memset(&vfmt_out, 0, sizeof(vfmt_out));
+ memset(&vbi_fmt_out, 0, sizeof(vbi_fmt_out));
+ memset(&raw_fmt_out, 0, sizeof(raw_fmt_out));
+ memset(&tuner, 0, sizeof(tuner));
+ memset(&vcap, 0, sizeof(vcap));
+ memset(&vin, 0, sizeof(vin));
+ memset(&vout, 0, sizeof(vout));
+ memset(&vaudio, 0, sizeof(vaudio));
+ memset(&vaudout, 0, sizeof(vaudout));
+ memset(&vf, 0, sizeof(vf));
+ memset(&vs, 0, sizeof(vs));
+
if (argc == 1) {
usage();
return 0;
@@ -743,6 +986,27 @@ int main(int argc, char **argv)
}
}
break;
+ case OptSetVideoOutFormat:
+ subs = optarg;
+ while (*subs != '\0') {
+ static char *const subopts[] = {
+ "width",
+ "height",
+ NULL
+ };
+
+ switch (parse_subopt(&subs, subopts, &value)) {
+ case 0:
+ vfmt_out.fmt.pix.width = strtol(value, 0L, 0);
+ set_fmts_out |= FMTWidth;
+ break;
+ case 1:
+ vfmt_out.fmt.pix.height = strtol(value, 0L, 0);
+ set_fmts_out |= FMTHeight;
+ break;
+ }
+ }
+ break;
case OptSetInput:
input = strtol(optarg, 0L, 0);
break;
@@ -824,6 +1088,55 @@ int main(int argc, char **argv)
return 1;
}
break;
+ case OptSetSlicedVbiFormat:
+ case OptSetSlicedVbiOutFormat:
+ {
+ bool foundOff = false;
+ v4l2_format *fmt = &vbi_fmt;
+
+ if (ch == OptSetSlicedVbiOutFormat)
+ fmt = &vbi_fmt_out;
+ fmt->fmt.sliced.service_set = 0;
+ subs = optarg;
+ while (*subs != '\0') {
+ static char *const subopts[] = {
+ "off",
+ "teletext",
+ "cc",
+ "wss",
+ "vps",
+ NULL
+ };
+
+ switch (parse_subopt(&subs, subopts, &value)) {
+ case 0:
+ foundOff = true;
+ break;
+ case 1:
+ fmt->fmt.sliced.service_set |=
+ V4L2_SLICED_TELETEXT_B;
+ break;
+ case 2:
+ fmt->fmt.sliced.service_set |=
+ V4L2_SLICED_CAPTION_525;
+ break;
+ case 3:
+ fmt->fmt.sliced.service_set |=
+ V4L2_SLICED_WSS_625;
+ break;
+ case 4:
+ fmt->fmt.sliced.service_set |=
+ V4L2_SLICED_VPS;
+ break;
+ }
+ }
+ if (foundOff && fmt->fmt.sliced.service_set) {
+ fprintf(stderr, "Sliced VBI mode 'off' cannot be combined with other modes\n");
+ usage();
+ return 1;
+ }
+ break;
+ }
case ':':
fprintf(stderr, "Option `%s' requires a value\n",
argv[optind]);
@@ -852,6 +1165,7 @@ int main(int argc, char **argv)
}
free(device);
+ doioctl(fd, VIDIOC_QUERYCAP, &vcap, "VIDIOC_QUERYCAP");
find_controls(fd);
for (ctrl_get_list::iterator iter = get_ctrls.begin(); iter != get_ctrls.end(); ++iter) {
if (ctrl_str2id.find(*iter) == ctrl_str2id.end()) {
@@ -866,8 +1180,9 @@ int main(int argc, char **argv)
}
}
- if (option_all) {
+ if (options[OptAll]) {
options[OptGetVideoFormat] = 1;
+ options[OptGetVideoOutFormat] = 1;
options[OptGetDriverInfo] = 1;
options[OptGetInput] = 1;
options[OptGetOutput] = 1;
@@ -876,40 +1191,28 @@ int main(int argc, char **argv)
options[OptGetStandard] = 1;
options[OptGetFreq] = 1;
options[OptGetTuner] = 1;
+ options[OptGetOverlayFormat] = 1;
+ options[OptGetVbiFormat] = 1;
+ options[OptGetVbiOutFormat] = 1;
+ options[OptGetSlicedVbiFormat] = 1;
+ options[OptGetSlicedVbiOutFormat] = 1;
}
+ /* Information Opts */
- /* Setting Opts */
-
- if (options[OptSetVideoFormat]) {
- struct v4l2_format in_vfmt;
- printf("ioctl: VIDIOC_S_FMT\n");
- in_vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- if (ioctl(fd, VIDIOC_G_FMT, &in_vfmt) < 0)
- fprintf(stderr, "ioctl: VIDIOC_G_FMT failed\n");
- else {
- printf("\tBefore:\n");
- if (printfmt(in_vfmt) != 0)
- fprintf(stderr, "error printing result\n");
- if (set_fmts & FMTWidth)
- in_vfmt.fmt.pix.width = vfmt.fmt.pix.width;
- if (set_fmts & FMTHeight)
- in_vfmt.fmt.pix.height = vfmt.fmt.pix.height;
- if (ioctl(fd, VIDIOC_S_FMT, &in_vfmt) < 0)
- fprintf(stderr, "ioctl: VIDIOC_S_FMT failed\n");
- vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- if (ioctl(fd, VIDIOC_G_FMT, &vfmt) < 0)
- fprintf(stderr, "ioctl: VIDIOC_G_FMT failed\n");
- else {
- printf("\n\tAfter:\n");
- if (printfmt(vfmt) != 0)
- fprintf(stderr,
- "error printing result\n");
- }
- }
+ if (options[OptGetDriverInfo]) {
+ printf("Driver info:\n");
+ printf("\tDriver name : %s\n", vcap.driver);
+ printf("\tCard type : %s\n", vcap.card);
+ printf("\tBus info : %s\n", vcap.bus_info);
+ printf("\tDriver version: %d\n", vcap.version);
+ printf("\tCapabilities : 0x%08X\n", vcap.capabilities);
+ printf("%s", cap2s(vcap.capabilities).c_str());
}
- if (option_streamoff) {
+ /* Set options */
+
+ if (options[OptStreamOff]) {
int dummy = 0;
doioctl(fd, VIDIOC_STREAMOFF, &dummy, "VIDIOC_STREAMOFF");
}
@@ -940,6 +1243,105 @@ int main(int argc, char **argv)
printf("Standard set to %08llx\n", (unsigned long long)std);
}
+ if (options[OptSetInput]) {
+ if (doioctl(fd, VIDIOC_S_INPUT, &input, "VIDIOC_S_INPUT") == 0) {
+ printf("Video input set to %d", input);
+ vin.index = input;
+ if (ioctl(fd, VIDIOC_ENUMINPUT, &vin) >= 0)
+ printf(" (%s)", vin.name);
+ printf("\n");
+ }
+ }
+
+ if (options[OptSetOutput]) {
+ if (doioctl(fd, VIDIOC_S_OUTPUT, &output, "VIDIOC_S_OUTPUT") == 0)
+ printf("Output set to %d\n", output);
+ }
+
+ if (options[OptSetAudioInput]) {
+ if (doioctl(fd, VIDIOC_S_AUDIO, &vaudio, "VIDIOC_S_AUDIO") == 0)
+ printf("Audio input set to %d\n", vaudio.index);
+ }
+
+ if (options[OptSetAudioOutput]) {
+ if (doioctl(fd, VIDIOC_S_AUDOUT, &vaudout, "VIDIOC_S_AUDOUT") == 0)
+ printf("Audio output set to %d\n", vaudout.index);
+ }
+
+ if (options[OptSetTuner]) {
+ struct v4l2_tuner vt;
+
+ memset(&vt, 0, sizeof(struct v4l2_tuner));
+ if (ioctl(fd, VIDIOC_G_TUNER, &vt) < 0) {
+ fprintf(stderr, "ioctl: VIDIOC_G_TUNER failed\n");
+ exit(1);
+ }
+ vt.audmode = mode;
+ doioctl(fd, VIDIOC_S_TUNER, &vt, "VIDIOC_S_TUNER");
+ }
+
+ if (options[OptSetVideoFormat]) {
+ struct v4l2_format in_vfmt;
+ printf("ioctl: VIDIOC_S_FMT\n");
+ in_vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ if (ioctl(fd, VIDIOC_G_FMT, &in_vfmt) < 0)
+ fprintf(stderr, "ioctl: VIDIOC_G_FMT failed\n");
+ else {
+ if (set_fmts & FMTWidth)
+ in_vfmt.fmt.pix.width = vfmt.fmt.pix.width;
+ if (set_fmts & FMTHeight)
+ in_vfmt.fmt.pix.height = vfmt.fmt.pix.height;
+ if (ioctl(fd, VIDIOC_S_FMT, &in_vfmt) < 0)
+ fprintf(stderr, "ioctl: VIDIOC_S_FMT failed\n");
+ vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ if (ioctl(fd, VIDIOC_G_FMT, &vfmt) < 0)
+ fprintf(stderr, "ioctl: VIDIOC_G_FMT failed\n");
+ }
+ }
+
+ if (options[OptSetVideoOutFormat]) {
+ struct v4l2_format in_vfmt;
+ printf("ioctl: VIDIOC_S_FMT\n");
+ in_vfmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
+ if (ioctl(fd, VIDIOC_G_FMT, &in_vfmt) < 0)
+ fprintf(stderr, "ioctl: VIDIOC_G_FMT failed\n");
+ else {
+ if (set_fmts & FMTWidth)
+ in_vfmt.fmt.pix.width = vfmt.fmt.pix.width;
+ if (set_fmts & FMTHeight)
+ in_vfmt.fmt.pix.height = vfmt.fmt.pix.height;
+ if (ioctl(fd, VIDIOC_S_FMT, &in_vfmt) < 0)
+ fprintf(stderr, "ioctl: VIDIOC_S_FMT failed\n");
+ vfmt_out.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
+ if (ioctl(fd, VIDIOC_G_FMT, &vfmt_out) < 0)
+ fprintf(stderr, "ioctl: VIDIOC_G_FMT failed\n");
+ }
+ }
+
+ if (options[OptSetSlicedVbiFormat]) {
+ if (vbi_fmt.fmt.sliced.service_set == 0) {
+ // switch to raw mode
+ vbi_fmt.type = V4L2_BUF_TYPE_VBI_CAPTURE;
+ if (doioctl(fd, VIDIOC_G_FMT, &vbi_fmt, "VIDIOC_G_FMT") == 0)
+ doioctl(fd, VIDIOC_S_FMT, &vbi_fmt, "VIDIOC_S_FMT");
+ } else {
+ vbi_fmt.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE;
+ doioctl(fd, VIDIOC_S_FMT, &vbi_fmt, "VIDIOC_S_FMT");
+ }
+ }
+
+ if (options[OptSetSlicedVbiOutFormat]) {
+ if (vbi_fmt_out.fmt.sliced.service_set == 0) {
+ // switch to raw mode
+ vbi_fmt_out.type = V4L2_BUF_TYPE_VBI_OUTPUT;
+ if (doioctl(fd, VIDIOC_G_FMT, &vbi_fmt_out, "VIDIOC_G_FMT") == 0)
+ doioctl(fd, VIDIOC_S_FMT, &vbi_fmt_out, "VIDIOC_S_FMT");
+ } else {
+ vbi_fmt_out.type = V4L2_BUF_TYPE_SLICED_VBI_OUTPUT;
+ doioctl(fd, VIDIOC_S_FMT, &vbi_fmt_out, "VIDIOC_S_FMT");
+ }
+ }
+
if (options[OptSetCtrl] && !set_ctrls.empty()) {
struct v4l2_ext_controls ctrls = { 0 };
@@ -959,7 +1361,7 @@ int main(int argc, char **argv)
ctrl.id = user_ctrls[i].id;
ctrl.value = user_ctrls[i].value;
- if (ioctl(fd, VIDIOC_S_CTRL, &ctrl)) {
+ if (doioctl(fd, VIDIOC_S_CTRL, &ctrl, "VIDIOC_S_CTRL")) {
fprintf(stderr, "%s: %s\n",
ctrl_id2str[ctrl.id].c_str(),
strerror(errno));
@@ -969,7 +1371,7 @@ int main(int argc, char **argv)
ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG;
ctrls.count = mpeg_ctrls.size();
ctrls.controls = &mpeg_ctrls[0];
- if (ioctl(fd, VIDIOC_S_EXT_CTRLS, &ctrls)) {
+ if (doioctl(fd, VIDIOC_S_EXT_CTRLS, &ctrls, "VIDIOC_S_EXT_CTRLS")) {
if (ctrls.error_idx >= ctrls.count) {
fprintf(stderr, "Error setting MPEG controls: %s\n",
strerror(errno));
@@ -982,20 +1384,8 @@ int main(int argc, char **argv)
}
}
}
-
- /* informational opts */
-
- if (options[OptGetDriverInfo]) {
- if (doioctl(fd, VIDIOC_QUERYCAP, &vcap, "VIDIOC_QUERYCAP") == 0) {
- printf("Driver info:\n");
- printf("\tDriver name : %s\n", vcap.driver);
- printf("\tCard type : %s\n", vcap.card);
- printf("\tBus info : %s\n", vcap.bus_info);
- printf("\tDriver version: %d\n", vcap.version);
- printf("\tCapabilities : 0x%08X\n", vcap.capabilities);
- printf("%s", cap2s(vcap.capabilities).c_str());
- }
- }
+
+ /* Get options */
if (options[OptGetVideoFormat]) {
vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
@@ -1004,38 +1394,56 @@ int main(int argc, char **argv)
fprintf(stderr, "error printing result\n");
}
- if (options[OptListInputs]) {
- vin.index = 0;
- printf("ioctl: VIDIOC_ENUMINPUT\n");
- while (ioctl(fd, VIDIOC_ENUMINPUT, &vin) >= 0) {
- if (vin.index)
- printf("\n");
- printf("\tInput : %d\n", vin.index);
- printf("\tName : %s\n", vin.name);
- printf("\tType : 0x%08X\n", vin.type);
- printf("\tAudioset: 0x%08X\n", vin.audioset);
- printf("\tTuner : 0x%08X\n", vin.tuner);
- printf("\tStandard: 0x%016llX ( ", (unsigned long long)vin.std);
- if (vin.std & 0x000FFF)
- printf("PAL "); // hack
- if (vin.std & 0x00F000)
- printf("NTSC "); // hack
- if (vin.std & 0x7F0000)
- printf("SECAM "); // hack
- printf(")\n");
- printf("\tStatus : %d\n", vin.status);
- vin.index++;
- }
+ if (options[OptGetVideoOutFormat]) {
+ vfmt_out.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
+ if (doioctl(fd, VIDIOC_G_FMT, &vfmt_out, "VIDIOC_G_FMT") == 0)
+ if (printfmt(vfmt_out) != 0)
+ fprintf(stderr, "error printing result\n");
}
- if (options[OptSetInput]) {
- if (doioctl(fd, VIDIOC_S_INPUT, &input, "VIDIOC_S_INPUT") == 0) {
- printf("Video input set to %d", input);
- vin.index = input;
- if (ioctl(fd, VIDIOC_ENUMINPUT, &vin) >= 0)
- printf(" (%s)", vin.name);
- printf("\n");
- }
+ if (options[OptGetOverlayFormat]) {
+ struct v4l2_format fmt;
+ memset(&fmt, 0, sizeof(fmt));
+ fmt.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
+ if (doioctl(fd, VIDIOC_G_FMT, &fmt, "VIDIOC_G_FMT") == 0)
+ if (printfmt(fmt) != 0)
+ fprintf(stderr, "error printing result\n");
+ }
+
+ if (options[OptGetSlicedVbiFormat]) {
+ vbi_fmt.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE;
+ if (doioctl(fd, VIDIOC_G_FMT, &vbi_fmt,
+ "VIDIOC_G_FMT") == 0)
+ if (printfmt(vbi_fmt) != 0)
+ fprintf(stderr,
+ "error printing result\n");
+ }
+
+ if (options[OptGetSlicedVbiOutFormat]) {
+ vbi_fmt_out.type = V4L2_BUF_TYPE_SLICED_VBI_OUTPUT;
+ if (doioctl(fd, VIDIOC_G_FMT, &vbi_fmt_out,
+ "VIDIOC_G_FMT") == 0)
+ if (printfmt(vbi_fmt_out) != 0)
+ fprintf(stderr,
+ "error printing result\n");
+ }
+
+ if (options[OptGetVbiFormat]) {
+ raw_fmt.type = V4L2_BUF_TYPE_VBI_CAPTURE;
+ if (doioctl(fd, VIDIOC_G_FMT, &raw_fmt,
+ "VIDIOC_G_FMT") == 0)
+ if (printfmt(raw_fmt) != 0)
+ fprintf(stderr,
+ "error printing result\n");
+ }
+
+ if (options[OptGetVbiOutFormat]) {
+ raw_fmt_out.type = V4L2_BUF_TYPE_VBI_OUTPUT;
+ if (doioctl(fd, VIDIOC_G_FMT, &raw_fmt_out,
+ "VIDIOC_G_FMT") == 0)
+ if (printfmt(raw_fmt_out) != 0)
+ fprintf(stderr,
+ "error printing result\n");
}
if (options[OptGetInput]) {
@@ -1048,33 +1456,6 @@ int main(int argc, char **argv)
}
}
- if (options[OptListOutputs]) {
- vout.index = 0;
- printf("ioctl: VIDIOC_ENUMOUTPUT\n");
- while (ioctl(fd, VIDIOC_ENUMOUTPUT, &vout) >= 0) {
- if (vout.index)
- printf("\n");
- printf("\tOutput : %d\n", vout.index);
- printf("\tName : %s\n", vout.name);
- printf("\tType : 0x%08X\n", vout.type);
- printf("\tAudioset: 0x%08X\n", vout.audioset);
- printf("\tStandard: 0x%016llX ( ", (unsigned long long)vout.std);
- if (vout.std & 0x000FFF)
- printf("PAL "); // hack
- if (vout.std & 0x00F000)
- printf("NTSC "); // hack
- if (vout.std & 0x7F0000)
- printf("SECAM "); // hack
- printf(")\n");
- vout.index++;
- }
- }
-
- if (options[OptSetOutput]) {
- if (doioctl(fd, VIDIOC_S_OUTPUT, &output, "VIDIOC_S_OUTPUT") == 0)
- printf("Output set to %d\n", output);
- }
-
if (options[OptGetOutput]) {
if (doioctl(fd, VIDIOC_G_OUTPUT, &output, "VIDIOC_G_OUTPUT") == 0) {
printf("Video output: %d", output);
@@ -1086,47 +1467,11 @@ int main(int argc, char **argv)
}
}
- if (options[OptListAudioInputs]) {
- struct v4l2_audio vaudio; /* list audio inputs */
- vaudio.index = 0;
- printf("ioctl: VIDIOC_ENUMAUDIO\n");
- while (ioctl(fd, VIDIOC_ENUMAUDIO, &vaudio) >= 0) {
- if (vaudio.index)
- printf("\n");
- printf("\tInput : %d\n", vaudio.index);
- printf("\tName : %s\n", vaudio.name);
- vaudio.index++;
- }
- }
-
- if (options[OptListAudioOutputs]) {
- struct v4l2_audioout vaudio; /* list audio outputs */
- vaudio.index = 0;
- printf("ioctl: VIDIOC_ENUMAUDOUT\n");
- while (ioctl(fd, VIDIOC_ENUMAUDOUT, &vaudio) >= 0) {
- if (vaudio.index)
- printf("\n");
- printf("\tOutput : %d\n", vaudio.index);
- printf("\tName : %s\n", vaudio.name);
- vaudio.index++;
- }
- }
-
- if (options[OptSetAudioInput]) {
- if (doioctl(fd, VIDIOC_S_AUDIO, &vaudio, "VIDIOC_S_AUDIO") == 0)
- printf("Audio input set to %d\n", vaudio.index);
- }
-
if (options[OptGetAudioInput]) {
if (doioctl(fd, VIDIOC_G_AUDIO, &vaudio, "VIDIOC_G_AUDIO") == 0)
printf("Audio input : %d (%s)\n", vaudio.index, vaudio.name);
}
- if (options[OptSetAudioOutput]) {
- if (doioctl(fd, VIDIOC_S_AUDOUT, &vaudout, "VIDIOC_S_AUDOUT") == 0)
- printf("Audio output set to %d\n", vaudout.index);
- }
-
if (options[OptGetAudioOutput]) {
if (doioctl(fd, VIDIOC_G_AUDOUT, &vaudout, "VIDIOC_G_AUDOUT") == 0)
printf("Audio output: %d (%s)\n", vaudout.index, vaudout.name);
@@ -1144,23 +1489,6 @@ int main(int argc, char **argv)
vf.frequency / fac);
}
- if (option_list_stds) {
- printf("ioctl: VIDIOC_ENUMSTD\n");
- vs.index = 0;
- while (ioctl(fd, VIDIOC_ENUMSTD, &vs) >= 0) {
- if (vs.index)
- printf("\n");
- printf("\tindex : %d\n", vs.index);
- printf("\tID : 0x%016llX\n", (unsigned long long)vs.id);
- printf("\tName : %s\n", vs.name);
- printf("\tFrame period: %d/%d\n",
- vs.frameperiod.numerator,
- vs.frameperiod.denominator);
- printf("\tFrame lines : %d\n", vs.framelines);
- vs.index++;
- }
- }
-
if (options[OptGetStandard]) {
if (doioctl(fd, VIDIOC_G_STD, &std, "VIDIOC_G_STD") == 0) {
static const char *pal[] = {
@@ -1197,10 +1525,6 @@ int main(int argc, char **argv)
}
}
- if (options[OptListCtrlsMenus]) {
- list_controls(fd, 1);
- }
-
if (options[OptGetCtrl] && !get_ctrls.empty()) {
struct v4l2_ext_controls ctrls = { 0 };
@@ -1227,7 +1551,7 @@ int main(int argc, char **argv)
ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG;
ctrls.count = mpeg_ctrls.size();
ctrls.controls = &mpeg_ctrls[0];
- doioctl(fd, VIDIOC_S_EXT_CTRLS, &ctrls, "VIDIOC_S_EXT_CTRLS");
+ doioctl(fd, VIDIOC_G_EXT_CTRLS, &ctrls, "VIDIOC_G_EXT_CTRLS");
for (unsigned i = 0; i < mpeg_ctrls.size(); i++) {
struct v4l2_ext_control ctrl = mpeg_ctrls[i];
@@ -1254,27 +1578,8 @@ int main(int argc, char **argv)
rxsubchans2s(vt.rxsubchans).c_str());
}
}
- if (options[OptSetTuner]) {
- struct v4l2_tuner vt;
-
- memset(&vt, 0, sizeof(struct v4l2_tuner));
- if (ioctl(fd, VIDIOC_G_TUNER, &vt) < 0) {
- fprintf(stderr, "ioctl: VIDIOC_G_TUNER failed\n");
- exit(1);
- }
- vt.audmode = mode;
- doioctl(fd, VIDIOC_S_TUNER, &vt, "VIDIOC_S_TUNER");
- }
-
- if (option_version) {
- //printf("ivtvctl version " IVTV_VERSION "\n");
- }
-
- if (options[OptListCtrls]) {
- list_controls(fd, 0);
- }
- if (option_log_status) {
+ if (options[OptLogStatus]) {
static char buf[40960];
int len;
@@ -1301,7 +1606,122 @@ int main(int argc, char **argv)
}
}
- if (option_streamon) {
+ /* List options */
+
+ if (options[OptListInputs]) {
+ vin.index = 0;
+ printf("ioctl: VIDIOC_ENUMINPUT\n");
+ while (ioctl(fd, VIDIOC_ENUMINPUT, &vin) >= 0) {
+ if (vin.index)
+ printf("\n");
+ printf("\tInput : %d\n", vin.index);
+ printf("\tName : %s\n", vin.name);
+ printf("\tType : 0x%08X\n", vin.type);
+ printf("\tAudioset: 0x%08X\n", vin.audioset);
+ printf("\tTuner : 0x%08X\n", vin.tuner);
+ printf("\tStandard: 0x%016llX ( ", (unsigned long long)vin.std);
+ if (vin.std & 0x000FFF)
+ printf("PAL "); // hack
+ if (vin.std & 0x00F000)
+ printf("NTSC "); // hack
+ if (vin.std & 0x7F0000)
+ printf("SECAM "); // hack
+ printf(")\n");
+ printf("\tStatus : %d\n", vin.status);
+ vin.index++;
+ }
+ }
+
+ if (options[OptListOutputs]) {
+ vout.index = 0;
+ printf("ioctl: VIDIOC_ENUMOUTPUT\n");
+ while (ioctl(fd, VIDIOC_ENUMOUTPUT, &vout) >= 0) {
+ if (vout.index)
+ printf("\n");
+ printf("\tOutput : %d\n", vout.index);
+ printf("\tName : %s\n", vout.name);
+ printf("\tType : 0x%08X\n", vout.type);
+ printf("\tAudioset: 0x%08X\n", vout.audioset);
+ printf("\tStandard: 0x%016llX ( ", (unsigned long long)vout.std);
+ if (vout.std & 0x000FFF)
+ printf("PAL "); // hack
+ if (vout.std & 0x00F000)
+ printf("NTSC "); // hack
+ if (vout.std & 0x7F0000)
+ printf("SECAM "); // hack
+ printf(")\n");
+ vout.index++;
+ }
+ }
+
+ if (options[OptListAudioInputs]) {
+ struct v4l2_audio vaudio; /* list audio inputs */
+ vaudio.index = 0;
+ printf("ioctl: VIDIOC_ENUMAUDIO\n");
+ while (ioctl(fd, VIDIOC_ENUMAUDIO, &vaudio) >= 0) {
+ if (vaudio.index)
+ printf("\n");
+ printf("\tInput : %d\n", vaudio.index);
+ printf("\tName : %s\n", vaudio.name);
+ vaudio.index++;
+ }
+ }
+
+ if (options[OptListAudioOutputs]) {
+ struct v4l2_audioout vaudio; /* list audio outputs */
+ vaudio.index = 0;
+ printf("ioctl: VIDIOC_ENUMAUDOUT\n");
+ while (ioctl(fd, VIDIOC_ENUMAUDOUT, &vaudio) >= 0) {
+ if (vaudio.index)
+ printf("\n");
+ printf("\tOutput : %d\n", vaudio.index);
+ printf("\tName : %s\n", vaudio.name);
+ vaudio.index++;
+ }
+ }
+
+ if (options[OptListStandards]) {
+ printf("ioctl: VIDIOC_ENUMSTD\n");
+ vs.index = 0;
+ while (ioctl(fd, VIDIOC_ENUMSTD, &vs) >= 0) {
+ if (vs.index)
+ printf("\n");
+ printf("\tindex : %d\n", vs.index);
+ printf("\tID : 0x%016llX\n", (unsigned long long)vs.id);
+ printf("\tName : %s\n", vs.name);
+ printf("\tFrame period: %d/%d\n",
+ vs.frameperiod.numerator,
+ vs.frameperiod.denominator);
+ printf("\tFrame lines : %d\n", vs.framelines);
+ vs.index++;
+ }
+ }
+
+ if (options[OptGetSlicedVbiCap]) {
+ struct v4l2_sliced_vbi_cap cap;
+
+ if (doioctl(fd, VIDIOC_G_SLICED_VBI_CAP, &cap, "VIDIOC_G_SLICED_VBI_CAP") == 0) {
+ print_sliced_vbi_cap(cap);
+ }
+ }
+
+ if (options[OptGetSlicedVbiOutCap]) {
+ struct v4l2_sliced_vbi_cap cap;
+
+ if (doioctl(fd, VIDIOC_G_SLICED_VBI_CAP, &cap, "VIDIOC_G_SLICED_VBI_CAP") == 0) {
+ print_sliced_vbi_cap(cap);
+ }
+ }
+
+ if (options[OptListCtrlsMenus]) {
+ list_controls(fd, 1);
+ }
+
+ if (options[OptListCtrls]) {
+ list_controls(fd, 0);
+ }
+
+ if (options[OptStreamOn]) {
int dummy = 0;
doioctl(fd, VIDIOC_STREAMON, &dummy, "VIDIOC_STREAMON");
}