././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1724763002.3503494 v4l2-python3-0.3.5/0000755000076600000240000000000014663345572012577 5ustar00gregstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1649861969.0 v4l2-python3-0.3.5/AUTHORS0000644000076600000240000000041614225562521013635 0ustar00gregstaffpython-v4l2 maintainers and contributors ======================================== * Tamas Kemenczy * Pete Eberlein * Vesselin Petkov http://launchpad.net/~python-v4l2-devel maintainer of revised version on Github ======================================== * Jinle Zheng ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1649861969.0 v4l2-python3-0.3.5/LICENSE0000644000076600000240000004310314225562521013572 0ustar00gregstaff GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, 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 Lesser 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. Copyright (C) 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. 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. , 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 Lesser General Public License instead of this License. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1649861969.0 v4l2-python3-0.3.5/MANIFEST.in0000644000076600000240000000020214225562521014314 0ustar00gregstaffinclude NEWS include README include LICENSE include AUTHORS include MANIFEST.in include setup.py include tests.py include v4l2.py ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1649861969.0 v4l2-python3-0.3.5/NEWS0000644000076600000240000000140714225562521013265 0ustar00gregstaffpython-v4l2 Releases ==================== 0.2 --- * Updated to videodev2.h in Linux 2.6.34; closes `#608484`_ .. _`#608484`: https://bugs.launchpad.net/python-v4l2/+bug/608484 0.1.3 ----- * Applied patch for bug `#607996`_ .. _`#607996`: https://bugs.launchpad.net/python-v4l2/+bug/607996 0.1.2 ----- * Added missing ``_pack_`` attributes on ``v4l2_ext_control``, ``v4l2_register``, and ``v4l2_chip_ident`` structures; closes `#603311`_ (Thanks, Pete Eberlein) .. _`#603311`: https://bugs.launchpad.net/python-v4l2/+bug/603311 0.1.1 ----- * Fixed bug in ``v4l2_fourcc()`` that generated bad V4L2_PIX_FMT_* constants; closes `#510758`_ (Thanks, Vesselin Petkov). .. _`#510758`: https://bugs.launchpad.net/python-v4l2/+bug/510758 0.1 --- * Initial release. ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1724763002.3501945 v4l2-python3-0.3.5/PKG-INFO0000644000076600000240000000140414663345572013673 0ustar00gregstaffMetadata-Version: 2.1 Name: v4l2-python3 Version: 0.3.5 Summary: Python bindings for the v4l2 userspace api. Home-page: https://pypi.org/project/v4l2-python3/ Maintainer: Raspberry Pi Foundation Maintainer-email: web@raspberrypi.org License: GPLv2 Keywords: v4l2 video4linux video4linux2 binding ctypes Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: GNU General Public License (GPL) Classifier: Operating System :: POSIX :: Linux Classifier: Programming Language :: C Classifier: Programming Language :: Python Classifier: Topic :: Multimedia :: Video Classifier: Topic :: Multimedia :: Video :: Capture Requires: ctypes License-File: LICENSE License-File: AUTHORS UNKNOWN ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1706524617.0 v4l2-python3-0.3.5/README.md0000644000076600000240000000104414555677711014060 0ustar00gregstaff# python-v4l2 Provides Python bindings for Video4Linux2. Based on the work of [Jinlei Zheng](https://github.com/AlexJinlei/python-v4l2), which was based in turn on [python-v4l2](https://pypi.org/project/v4l2/). Additions have been made for the H264 format and for Python3. ## Installation Can be installed via: ``` pip3 install v4l2-python3 ``` Or alternatively on Raspberry Pi OS (bullseye): ``` sudo apt install python3-v4l2 ``` See the [Wiki](https://github.com/RaspberryPiFoundation/python-v4l2/wiki) for PyPI publishing instructions. ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1724763002.350409 v4l2-python3-0.3.5/setup.cfg0000644000076600000240000000004614663345572014420 0ustar00gregstaff[egg_info] tag_build = tag_date = 0 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1724762992.0 v4l2-python3-0.3.5/setup.py0000644000076600000240000000146114663345560014310 0ustar00gregstafffrom setuptools import setup setup( name='v4l2-python3', version='0.3.5', license='GPLv2', requires=('ctypes',), py_modules=('v4l2',), maintainer='Raspberry Pi Foundation', maintainer_email='web@raspberrypi.org', url='https://pypi.org/project/v4l2-python3/', keywords='v4l2 video4linux video4linux2 binding ctypes', description='Python bindings for the v4l2 userspace api.', classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'License :: OSI Approved :: GNU General Public License (GPL)', 'Operating System :: POSIX :: Linux', 'Programming Language :: C', 'Programming Language :: Python', 'Topic :: Multimedia :: Video', 'Topic :: Multimedia :: Video :: Capture', ], ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1649861969.0 v4l2-python3-0.3.5/tests.py0000644000076600000240000006644014225562521014312 0ustar00gregstaff# Tests for Python bindings for the v4l2 userspace api # Copyright (C) 1999-2009 the contributors # 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. # Alternatively you can redistribute this file under the terms of the # BSD license as stated below: # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the # distribution. # 3. The names of its contributors may not be used to endorse or promote # products derived from this software without specific prior written # permission. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ Tests for Python bindings for the v4l2 userspace api """ import v4l2 import errno from fcntl import ioctl # # validators # def valid_string(string): for char in string: if (ord(char) < 32 or 126 < ord(char)): return False return True def valid_v4l2_std_id(std_id): return std_id & ~ ( v4l2.V4L2_STD_PAL_B | v4l2.V4L2_STD_PAL_B1 | v4l2.V4L2_STD_PAL_G | v4l2.V4L2_STD_PAL_H | v4l2.V4L2_STD_PAL_I | v4l2.V4L2_STD_PAL_D | v4l2.V4L2_STD_PAL_D1 | v4l2.V4L2_STD_PAL_K | v4l2.V4L2_STD_PAL_M | v4l2.V4L2_STD_PAL_N | v4l2.V4L2_STD_PAL_Nc | v4l2.V4L2_STD_PAL_60 | v4l2.V4L2_STD_NTSC_M | v4l2.V4L2_STD_NTSC_M_JP | v4l2.V4L2_STD_NTSC_443 | v4l2.V4L2_STD_NTSC_M_KR | v4l2.V4L2_STD_SECAM_B | v4l2.V4L2_STD_SECAM_D | v4l2.V4L2_STD_SECAM_G | v4l2.V4L2_STD_SECAM_H | v4l2.V4L2_STD_SECAM_K | v4l2.V4L2_STD_SECAM_K1 | v4l2.V4L2_STD_SECAM_L | v4l2.V4L2_STD_SECAM_LC | v4l2.V4L2_STD_ATSC_8_VSB | v4l2.V4L2_STD_ATSC_16_VSB) == 0 def valid_capabilities(capabilities): return capabilities & ~ ( v4l2.V4L2_CAP_VIDEO_CAPTURE | v4l2.V4L2_CAP_VIDEO_OUTPUT | v4l2.V4L2_CAP_VIDEO_OVERLAY | v4l2.V4L2_CAP_VBI_CAPTURE | v4l2.V4L2_CAP_VBI_OUTPUT | v4l2.V4L2_CAP_SLICED_VBI_CAPTURE | v4l2.V4L2_CAP_SLICED_VBI_OUTPUT | v4l2.V4L2_CAP_RDS_CAPTURE | v4l2.V4L2_CAP_VIDEO_OUTPUT_OVERLAY | v4l2.V4L2_CAP_TUNER | v4l2.V4L2_CAP_AUDIO | v4l2.V4L2_CAP_RADIO | v4l2.V4L2_CAP_READWRITE | v4l2.V4L2_CAP_ASYNCIO | v4l2.V4L2_CAP_STREAMING) == 0 def valid_input_status(status): return status & ( v4l2.V4L2_IN_ST_NO_POWER | v4l2.V4L2_IN_ST_NO_SIGNAL | v4l2.V4L2_IN_ST_NO_COLOR | v4l2.V4L2_IN_ST_NO_H_LOCK | v4l2.V4L2_IN_ST_COLOR_KILL | v4l2.V4L2_IN_ST_NO_SYNC | v4l2.V4L2_IN_ST_NO_EQU | v4l2.V4L2_IN_ST_NO_CARRIER | v4l2.V4L2_IN_ST_MACROVISION | v4l2.V4L2_IN_ST_NO_ACCESS | v4l2.V4L2_IN_ST_VTR) # # helpers # def get_device_inputs(fd): index = 0 while True: input_ = v4l2.v4l2_input(index) try: ioctl(fd, v4l2.VIDIOC_ENUMINPUT, input_) except IOError, e: assert e.errno == errno.EINVAL break yield input_ index += 1 def get_device_outputs(fd): index = 0 while True: output = v4l2.v4l2_output(index) try: ioctl(fd, v4l2.VIDIOC_ENUMOUTPUT, output) except IOError, e: assert e.errno == errno.EINVAL break yield output index += 1 def foreach_device_input(fd, func): original_index = v4l2.c_int() ioctl(fd, v4l2.VIDIOC_G_INPUT, original_index) for input_ in get_device_inputs(fd): if input_.index != original_index.value: try: ioctl(fd, v4l2.VIDIOC_S_INPUT, v4l2.c_int(input_.index)) except IOError, e: if e.errno == errno.EBUSY: continue else: raise func(fd, input_) try: ioctl(fd, v4l2.VIDIOC_S_INPUT, original_index) except IOError, e: if not (e.errno == errno.EBUSY): raise def foreach_device_output(fd, func): original_index = v4l2.c_int() ioctl(fd, v4l2.VIDIOC_G_OUTPUT, original_index) for output in get_device_outputs(fd): if output_.index != original_index.value: try: ioctl(fd, v4l2.VIDIOC_S_OUTPUT, v4l2.c_int(output.index)) except IOError, e: if e.errno == errno.EBUSY: continue else: raise func(fd, output) try: ioctl(fd, v4l2.VIDIOC_S_INPUT, original_index) except IOError, e: if not (e.errno == errno.EBUSY): raise def get_device_standards(fd): # Note that according to the spec this is input/output specific, # and so the yielded standards reflect the active input/output. index = 0 while True: std = v4l2.v4l2_standard(index) try: ioctl(fd, v4l2.VIDIOC_ENUMSTD, std) except IOError, e: assert e.errno == errno.EINVAL break yield std index += 1 def get_device_controls(fd): # original enumeration method queryctrl = v4l2.v4l2_queryctrl(v4l2.V4L2_CID_BASE) while queryctrl.id < v4l2.V4L2_CID_LASTP1: try: ioctl(fd, v4l2.VIDIOC_QUERYCTRL, queryctrl) except IOError, e: # this predefined control is not supported by this device assert e.errno == errno.EINVAL queryctrl.id += 1 continue yield queryctrl queryctrl = v4l2.v4l2_queryctrl(queryctrl.id + 1) queryctrl.id = v4l2.V4L2_CID_PRIVATE_BASE while True: try: ioctl(fd, v4l2.VIDIOC_QUERYCTRL, queryctrl) except IOError, e: # no more custom controls available on this device assert e.errno == errno.EINVAL break yield queryctrl queryctrl = v4l2.v4l2_queryctrl(queryctrl.id + 1) def get_device_controls_by_class(fd, control_class): # enumeration by control class queryctrl = v4l2.v4l2_queryctrl( control_class | v4l2.V4L2_CTRL_FLAG_NEXT_CTRL) while True: try: ioctl(fd, v4l2.VIDIOC_QUERYCTRL, queryctrl) except IOError, e: assert e.errno == errno.EINVAL break if (v4l2.V4L2_CTRL_ID2CLASS(queryctrl.id) != control_class): break yield queryctrl queryctrl = v4l2.v4l2_queryctrl( queryctrl.id | v4l2.V4L2_CTRL_FLAG_NEXT_CTRL) def get_device_controls_menu(fd, queryctrl): querymenu = v4l2.v4l2_querymenu(queryctrl.id, queryctrl.minimum) while querymenu.index <= queryctrl.maximum: ioctl(fd, v4l2.VIDIOC_QUERYMENU, querymenu) yield querymenu querymenu.index += 1 # # tests # def test_VIDIOC_QUERYCAP(fd): cap = v4l2.v4l2_capability() ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap) assert 0 < len(cap.driver) assert valid_string(cap.card) # bus_info is allowed to be an empty string assert valid_string(cap.bus_info) assert valid_capabilities(cap.capabilities) assert cap.reserved[0] == 0 assert cap.reserved[1] == 0 assert cap.reserved[2] == 0 assert cap.reserved[3] == 0 def test_VIDIOC_G_INPUT(fd): cap = v4l2.v4l2_capability() ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap) if not cap.capabilities & v4l2.V4L2_CAP_VIDEO_CAPTURE: # test does not apply for this device return index = v4l2.c_int() ioctl(fd, v4l2.VIDIOC_G_INPUT, index) def test_VIDIOC_S_INPUT(fd): cap = v4l2.v4l2_capability() ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap) if not cap.capabilities & v4l2.V4L2_CAP_VIDEO_CAPTURE: # test does not apply for this device return index = v4l2.c_int(0) try: ioctl(fd, v4l2.VIDIOC_S_INPUT, index) except IOError, e: assert e.errno == errno.EBUSY return index.value = 1 << 31 try: ioctl(fd, v4l2.VIDIOC_S_INPUT, index) except IOError, e: assert e.errno == errno.EINVAL def test_VIDIOC_G_OUTPUT(fd): cap = v4l2.v4l2_capability() ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap) if not cap.capabilities & v4l2.V4L2_CAP_VIDEO_OUTPUT: # test does not apply for this device return index = v4l2.c_int() ioctl(fd, v4l2.VIDIOC_G_OUTPUT, index) def test_VIDIOC_S_OUTPUT(fd): cap = v4l2.v4l2_capability() ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap) if not cap.capabilities & v4l2.V4L2_CAP_VIDEO_OUTPUT: # test does not apply for this device return index = v4l2.c_int(0) ioctl(fd, v4l2.VIDIOC_S_OUTPUT, index) index.value = 1 << 31 try: ioctl(fd, v4l2.VIDIOC_S_OUTPUT, index) except IOError, e: assert e.errno == errno.EINVAL def test_VIDIOC_ENUMINPUT(fd): cap = v4l2.v4l2_capability() ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap) if not cap.capabilities & v4l2.V4L2_CAP_VIDEO_CAPTURE: # test does not apply for this device return def assert_valid_input(fd, input_): # assert input_.index == index assert valid_string(input_.name) assert input_.type & ( v4l2.V4L2_INPUT_TYPE_CAMERA | v4l2.V4L2_INPUT_TYPE_TUNER) assert input_.audioset < 32 assert valid_v4l2_std_id(input_.std) if input_.status: assert valid_input_status(status) assert input_.reserved[0] == 0 assert input_.reserved[1] == 0 assert input_.reserved[2] == 0 assert input_.reserved[3] == 0 foreach_device_input(fd, assert_valid_input) def test_VIDIOC_ENUMOUTPUT(fd): cap = v4l2.v4l2_capability() ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap) if not cap.capabilities & v4l2.V4L2_CAP_VIDEO_OUTPUT: # test does not apply for this device return def assert_valid_output(fd, output): # assert output.index == index assert valid_string(output.name) assert output.type & ( v4l2.V4L2_OUTPUT_TYPE_MODULATOR | v4l2.V4L2_OUTPUT_TYPE_ANALOG | v4l2.V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY) assert output.audioset < 32 # assert output.modulator ? assert valid_v4l2_std_id(output.std) assert output.reserved == 0 foreach_device_output(fd, assert_valid_ouput) def test_VIDIOC_ENUMSTD(fd): cap = v4l2.v4l2_capability() ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap) def assert_valid_standard(index, std): # assert std.index == index assert valid_v4l2_std_id(std.id) assert valid_string(std.name) assert std.frameperiod.numerator != 0 assert std.frameperiod.denominator != 0 assert std.framelines != 0 assert std.reserved[0] == 0 assert std.reserved[1] == 0 assert std.reserved[2] == 0 assert std.reserved[3] == 0 # The spec says that a different set of standards may be yielded # by different inputs and outputs, so we repeat the test for each # available input and output of the current device. def test_available_standards(fd, input_or_output): for index, std in enumerate(get_device_standards(fd)): assert_valid_standard(index, std) # test for input devices if cap.capabilities & v4l2.V4L2_CAP_VIDEO_CAPTURE: foreach_device_input(fd, test_available_standards) # test for output devices if cap.capabilities & v4l2.V4L2_CAP_VIDEO_OUTPUT: foreach_device_output(fd, test_available_standards) def test_VIDIOC_G_STD(fd): cap = v4l2.v4l2_capability() ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap) def test_get_standard(fd, input_or_output): std_id = v4l2.v4l2_std_id() try: ioctl(fd, v4l2.VIDIOC_G_STD, std_id) except IOError, e: assert e.errno == errno.EINVAL # input/output may not support a standard return assert valid_v4l2_std_id(std_id.value) # test for input devices if cap.capabilities & v4l2.V4L2_CAP_VIDEO_CAPTURE: foreach_device_input(fd, test_get_standard) # test for output devices if cap.capabilities & v4l2.V4L2_CAP_VIDEO_OUTPUT: foreach_device_output(fd, test_get_standard) def test_VIDIOC_S_STD(fd): cap = v4l2.v4l2_capability() ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap) def test_set_standard(fd, input_or_output): original_std_id = v4l2.v4l2_std_id() try: ioctl(fd, v4l2.VIDIOC_G_STD, original_std_id) except IOError, e: assert e.errno == errno.EINVAL return for std in get_device_standards(fd): std_id = v4l2.v4l2_std_id(std.id) ioctl(fd, v4l2.VIDIOC_S_STD, std_id) bad_std_id = v4l2.v4l2_std_id(1 << 31) try: ioctl(fd, v4l2.VIDIOC_S_STD, bad_std_id) except IOError, e: assert e.errno == errno.EINVAL ioctl(fd, v4l2.VIDIOC_S_STD, original_std_id) # test for input devices if cap.capabilities & v4l2.V4L2_CAP_VIDEO_CAPTURE: foreach_device_input(fd, test_set_standard) # test for output devices if cap.capabilities & v4l2.V4L2_CAP_VIDEO_OUTPUT: foreach_device_output(fd, test_set_standard) def test_VIDIOC_QUERYSTD(fd): cap = v4l2.v4l2_capability() ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap) def test_query_standard(fd, input_): std_id = v4l2.v4l2_std_id() try: ioctl(fd, v4l2.VIDIOC_QUERYSTD, std_id) except IOError, e: # this ioctl might not be supported on this device assert e.errno == errno.EINVAL return assert valid_v4l2_std_id(std_id.value) # test for input devices if cap.capabilities & v4l2.V4L2_CAP_VIDEO_CAPTURE: foreach_device_input(fd, test_query_standard) # Although the spec doesn't indicate this, device control tests # will be applied to all inputs and outputs available on device. def test_VIDIOC_QUERYCTRL(fd): cap = v4l2.v4l2_capability() ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap) def assert_valid_queryctrl(queryctrl): assert queryctrl.type & ( v4l2.V4L2_CTRL_TYPE_INTEGER | v4l2.V4L2_CTRL_TYPE_BOOLEAN | v4l2.V4L2_CTRL_TYPE_MENU | v4l2.V4L2_CTRL_TYPE_BUTTON | v4l2.V4L2_CTRL_TYPE_INTEGER64 | v4l2.V4L2_CTRL_TYPE_CTRL_CLASS) assert valid_string(queryctrl.name) assert queryctrl.minimum < queryctrl.maximum assert queryctrl.step > 0 if queryctrl.flags: assert queryctrl.flags & ( v4l2.V4L2_CTRL_FLAG_DISABLED | v4l2.V4L2_CTRL_FLAG_GRABBED | v4l2.V4L2_CTRL_FLAG_READ_ONLY | v4l2.V4L2_CTRL_FLAG_UPDATE | v4l2.V4L2_CTRL_FLAG_INACTIVE | v4l2.V4L2_CTRL_FLAG_SLIDER) assert queryctrl.reserved[0] == 0 assert queryctrl.reserved[1] == 0 def test_controls(fd, input_or_output): # original enumeration method for queryctrl in get_device_controls(fd): assert_valid_queryctrl(queryctrl) # enumeration by control class for class_ in ( v4l2.V4L2_CTRL_CLASS_USER, v4l2.V4L2_CTRL_CLASS_MPEG, v4l2.V4L2_CTRL_CLASS_CAMERA): for queryctrl in get_device_controls_by_class(fd, class_): assert_valid_queryctrl(queryctrl) # general test foreach_device_input(fd, test_controls) # test for each input devices if cap.capabilities & v4l2.V4L2_CAP_VIDEO_CAPTURE: foreach_device_input(fd, test_controls) # test for each output devices if cap.capabilities & v4l2.V4L2_CAP_VIDEO_OUTPUT: foreach_device_output(fd, test_controls) def test_VIDIOC_QUERYMENU(fd): cap = v4l2.v4l2_capability() ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap) def test_query_menu(fd, input_or_output): for queryctrl in get_device_controls(fd): if queryctrl.type == v4l2.V4L2_CTRL_TYPE_MENU: for querymenu in get_device_controls_menu(fd, queryctrl): assert valid_string(querymenu.name) assert querymenu.reserved == 0 # general test foreach_device_input(fd, test_query_menu) # test for each input devices if cap.capabilities & v4l2.V4L2_CAP_VIDEO_CAPTURE: foreach_device_input(fd, test_query_menu) # test for each output devices if cap.capabilities & v4l2.V4L2_CAP_VIDEO_OUTPUT: foreach_device_output(fd, test_query_menu) def test_VIDIOC_G_CTRL(fd): cap = v4l2.v4l2_capability() ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap) def test_get_control(fd, input_or_output): for queryctrl in get_device_controls(fd): if queryctrl.flags & v4l2.V4L2_CTRL_FLAG_DISABLED: continue control = v4l2.v4l2_control(queryctrl.id) ioctl(fd, v4l2.VIDIOC_G_CTRL, control) assert control.value >= queryctrl.minimum assert control.value <= queryctrl.maximum # general test foreach_device_input(fd, test_get_control) # test for each input devices if cap.capabilities & v4l2.V4L2_CAP_VIDEO_CAPTURE: foreach_device_input(fd, test_get_control) # test for each output devices if cap.capabilities & v4l2.V4L2_CAP_VIDEO_OUTPUT: foreach_device_output(fd, test_get_control) def test_VIDIOC_S_CTRL(fd): cap = v4l2.v4l2_capability() ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap) def test_set_control(fd, input_or_output): for queryctrl in get_device_controls(fd): if queryctrl.flags & v4l2.V4L2_CTRL_FLAG_DISABLED: continue original_control = v4l2.v4l2_control(queryctrl.id) ioctl(fd, v4l2.VIDIOC_G_CTRL, original_control) control = v4l2.v4l2_control(queryctrl.id, queryctrl.default) ioctl(fd, v4l2.VIDIOC_S_CTRL, control) control.value = queryctrl.minimum + queryctrl.step ioctl(fd, v4l2.VIDIOC_S_CTRL, control) control.value = queryctrl.minimum - queryctrl.step try: ioctl(fd, v4l2.VIDIOC_S_CTRL, control) except IOError, e: assert e.errno in ( errno.ERANGE, errno.EINVAL, errno.EIO) control.value = queryctrl.maximum + queryctrl.step try: ioctl(fd, v4l2.VIDIOC_S_CTRL, control) except IOError, e: assert e.errno in ( errno.ERANGE, errno.EINVAL, errno.EIO) if queryctrl.step > 1: control.value = queryctrl.default + queryctrl.step - 1 try: ioctl(fd, v4l2.VIDIOC_S_CTRL, control) except IOError, e: assert e.errno == errno.ERANGE ioctl(fd, v4l2.VIDIOC_S_CTRL, original_control) # general test foreach_device_input(fd, test_set_control) # test for each input devices if cap.capabilities & v4l2.V4L2_CAP_VIDEO_CAPTURE: foreach_device_input(fd, test_set_control) # test for each output devices if cap.capabilities & v4l2.V4L2_CAP_VIDEO_OUTPUT: foreach_device_output(fd, test_set_control) def test_VIDIOC_G_EXT_CTRLS(fd): cap = v4l2.v4l2_capability() ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap) for class_ in ( v4l2.V4L2_CTRL_CLASS_USER, v4l2.V4L2_CTRL_CLASS_MPEG, v4l2.V4L2_CTRL_CLASS_CAMERA): def get_controls(fd, input_or_output): # first we get the controls through enumeration # note, currently not distinguishing by disabled flag. queryctrls = list(get_device_controls_by_class(fd, class_)) control_array = (v4l2.v4l2_ext_control * len(queryctrls))() for index, queryctrl in enumerate(queryctrls): control_array[index].id = queryctrl.id ext_controls = v4l2.v4l2_ext_controls(class_, len(queryctrls)) ext_controls.controls = control_array try: ioctl(fd, v4l2.VIDIOC_G_EXT_CTRLS, ext_controls) except IOError, e: assert e.errno == errno.EINVAL assert not queryctrls return assert ext_controls.error_idx == 0 assert ext_controls.reserved[0] == 0 assert ext_controls.reserved[1] == 0 for index, control in enumerate(control_array): assert control.value >= queryctrls[index].minimum assert control.value <= queryctrls[index].maximum # general test foreach_device_input(fd, get_controls) # test for each input devices if cap.capabilities & v4l2.V4L2_CAP_VIDEO_CAPTURE: foreach_device_input(fd, get_controls) # test for each output devices if cap.capabilities & v4l2.V4L2_CAP_VIDEO_OUTPUT: foreach_device_output(fd, get_controls) def test_VIDIOC_S_EXT_CTRLS(fd): cap = v4l2.v4l2_capability() ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap) for class_ in ( v4l2.V4L2_CTRL_CLASS_USER, v4l2.V4L2_CTRL_CLASS_MPEG, v4l2.V4L2_CTRL_CLASS_CAMERA): def set_controls(fd, input_or_output): # first we get the controls through enumeration queryctrls = list(get_device_controls_by_class(fd, class_)) control_array = (v4l2.v4l2_ext_control * len(queryctrls))() for index, queryctrl in enumerate(queryctrls): control_array[index].id = queryctrl.id ext_controls = v4l2.v4l2_ext_controls(class_, len(queryctrls)) ext_controls.controls = control_array # we store the original values so we can set them back later try: ioctl(fd, v4l2.VIDIOC_G_EXT_CTRLS, ext_controls) except IOError, e: assert e.errno == errno.EINVAL assert not queryctrls return original_values = [(c.value, c.value64) for c in control_array] # set to minimum value for index, control in enumerate(control_array): control.value = queryctrls[index].minimum control.value64 = queryctrls[index].minimum ioctl(fd, v4l2.VIDIOC_S_EXT_CTRLS, ext_controls) # test invalid control if queryctrls: control_array[-1].value = 1 << 31 control_array[-1].value64 = 1 << 32 try: ioctl(fd, v4l2.VIDIOC_S_EXT_CTRLS, ext_controls) except IOError, e: # the driver may either prune the value or raise # ERANGE if control value is out of bounds assert e.errno == errno.ERANGE assert ext_controls.error_idx == len(control_array) - 1 # set back original values for index, control in enumerate(control_array): control.value = original_values[index][0] control.value64 = original_values[index][1] ioctl(fd, v4l2.VIDIOC_S_EXT_CTRLS, ext_controls) # general test foreach_device_input(fd, set_controls) # test for each input devices if cap.capabilities & v4l2.V4L2_CAP_VIDEO_CAPTURE: foreach_device_input(fd, set_controls) # test for each output devices if cap.capabilities & v4l2.V4L2_CAP_VIDEO_OUTPUT: foreach_device_output(fd, set_controls) def test_VIDIOC_TRY_EXT_CTRLS(fd): cap = v4l2.v4l2_capability() ioctl(fd, v4l2.VIDIOC_QUERYCAP, cap) for class_ in ( v4l2.V4L2_CTRL_CLASS_USER, v4l2.V4L2_CTRL_CLASS_MPEG, v4l2.V4L2_CTRL_CLASS_CAMERA): def try_controls(fd, input_or_output): # first we get the controls through enumeration queryctrls = list(get_device_controls_by_class(fd, class_)) # try sane values control_array = (v4l2.v4l2_ext_control * len(queryctrls))() for index, queryctrl in enumerate(queryctrls): control_array[index].id = queryctrl.id control_array[index].value = queryctrl.default ext_controls = v4l2.v4l2_ext_controls(class_, len(queryctrls)) ext_controls.controls = control_array try: ioctl(fd, v4l2.VIDIOC_TRY_EXT_CTRLS, ext_controls) except IOError, e: # driver may raise EINVAL if the control array has a # length of zero assert e.errno == errno.EINVAL assert not queryctrls return # try invalid values for index, control in enumerate(control_array): control.value = queryctrls[index].maximum + 1 control.value64 = queryctrls[index].maximum + 1 try: ioctl(fd, v4l2.VIDIOC_TRY_EXT_CTRLS, ext_controls) except IOError, e: assert e.errno == errno.EINVAL assert ext_controls.error_idx != 0 # general test foreach_device_input(fd, try_controls) # test for each input devices if cap.capabilities & v4l2.V4L2_CAP_VIDEO_CAPTURE: foreach_device_input(fd, try_controls) # test for each output devices if cap.capabilities & v4l2.V4L2_CAP_VIDEO_OUTPUT: foreach_device_output(fd, try_controls) # # bootstrap # devices = None def open_devices(): import glob global devices if devices is None: devices = [ open(device, 'rw') for device in glob.glob('/dev/video*')] assert devices, 'No video devices found.' def pytest_generate_tests(metafunc): open_devices() for fd in devices: metafunc.addcall(funcargs=dict(fd=fd)) def run(): import sys open_devices() tests = [ obj for member, obj in globals().items() if member.startswith('test_')] tests.sort(key=lambda t: id(t)) for testfunc in tests: for fd in devices: try: testfunc(fd) except: sys.stderr.write('fd = %r\n' % fd) raise if __name__ == '__main__': run() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1724762992.0 v4l2-python3-0.3.5/v4l2.py0000644000076600000240000020471214663345560013743 0ustar00gregstaff# Python bindings for the v4l2 userspace api # Copyright (C) 1999-2009 the contributors # 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. # Alternatively you can redistribute this file under the terms of the # BSD license as stated below: # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the # distribution. # 3. The names of its contributors may not be used to endorse or promote # products derived from this software without specific prior written # permission. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ Python bindings for the v4l2 userspace api in Linux 2.6.34 """ # see linux/videodev2.h import ctypes _IOC_NRBITS = 8 _IOC_TYPEBITS = 8 _IOC_SIZEBITS = 14 _IOC_DIRBITS = 2 _IOC_NRSHIFT = 0 _IOC_TYPESHIFT = _IOC_NRSHIFT + _IOC_NRBITS _IOC_SIZESHIFT = _IOC_TYPESHIFT + _IOC_TYPEBITS _IOC_DIRSHIFT = _IOC_SIZESHIFT + _IOC_SIZEBITS _IOC_NONE = 0 _IOC_WRITE = 1 _IOC_READ = 2 def _IOC(dir_, type_, nr, size): return ( ctypes.c_int32(dir_ << _IOC_DIRSHIFT).value | ctypes.c_int32(ord(type_) << _IOC_TYPESHIFT).value | ctypes.c_int32(nr << _IOC_NRSHIFT).value | ctypes.c_int32(size << _IOC_SIZESHIFT).value) def _IOC_TYPECHECK(t): return ctypes.sizeof(t) def _IO(type_, nr): return _IOC(_IOC_NONE, type_, nr, 0) def _IOW(type_, nr, size): return _IOC(_IOC_WRITE, type_, nr, _IOC_TYPECHECK(size)) def _IOR(type_, nr, size): return _IOC(_IOC_READ, type_, nr, _IOC_TYPECHECK(size)) def _IOWR(type_, nr, size): return _IOC(_IOC_READ | _IOC_WRITE, type_, nr, _IOC_TYPECHECK(size)) # # type alias # enum = ctypes.c_uint c_int = ctypes.c_int # # time # class timeval(ctypes.Structure): _fields_ = [ ('secs', ctypes.c_long), ('usecs', ctypes.c_long), ] # # v4l2 # VIDEO_MAX_FRAME = 32 VIDEO_MAX_PLANES = 8 VID_TYPE_CAPTURE = 1 VID_TYPE_TUNER = 2 VID_TYPE_TELETEXT = 4 VID_TYPE_OVERLAY = 8 VID_TYPE_CHROMAKEY = 16 VID_TYPE_CLIPPING = 32 VID_TYPE_FRAMERAM = 64 VID_TYPE_SCALES = 128 VID_TYPE_MONOCHROME = 256 VID_TYPE_SUBCAPTURE = 512 VID_TYPE_MPEG_DECODER = 1024 VID_TYPE_MPEG_ENCODER = 2048 VID_TYPE_MJPEG_DECODER = 4096 VID_TYPE_MJPEG_ENCODER = 8192 def v4l2_fourcc(a, b, c, d): return ord(a) | (ord(b) << 8) | (ord(c) << 16) | (ord(d) << 24) def v4l2_fourcc2str(fourcc): a = chr(fourcc & 0xFF) b = chr((fourcc >> 8) & 0xFF) c = chr((fourcc >> 16) & 0xFF) d = chr((fourcc >> 24) & 0xFF) return ''.join([a, b, c, d]) v4l2_field = enum ( V4L2_FIELD_ANY, V4L2_FIELD_NONE, V4L2_FIELD_TOP, V4L2_FIELD_BOTTOM, V4L2_FIELD_INTERLACED, V4L2_FIELD_SEQ_TB, V4L2_FIELD_SEQ_BT, V4L2_FIELD_ALTERNATE, V4L2_FIELD_INTERLACED_TB, V4L2_FIELD_INTERLACED_BT, ) = range(10) def V4L2_FIELD_HAS_TOP(field): return ( field == V4L2_FIELD_TOP or field == V4L2_FIELD_INTERLACED or field == V4L2_FIELD_INTERLACED_TB or field == V4L2_FIELD_INTERLACED_BT or field == V4L2_FIELD_SEQ_TB or field == V4L2_FIELD_SEQ_BT) def V4L2_FIELD_HAS_BOTTOM(field): return ( field == V4L2_FIELD_BOTTOM or field == V4L2_FIELD_INTERLACED or field == V4L2_FIELD_INTERLACED_TB or field == V4L2_FIELD_INTERLACED_BT or field == V4L2_FIELD_SEQ_TB or field == V4L2_FIELD_SEQ_BT) def V4L2_FIELD_HAS_BOTH(field): return ( field == V4L2_FIELD_INTERLACED or field == V4L2_FIELD_INTERLACED_TB or field == V4L2_FIELD_INTERLACED_BT or field == V4L2_FIELD_SEQ_TB or field == V4L2_FIELD_SEQ_BT) v4l2_buf_type = enum ( V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_BUF_TYPE_VIDEO_OUTPUT, V4L2_BUF_TYPE_VIDEO_OVERLAY, V4L2_BUF_TYPE_VBI_CAPTURE, V4L2_BUF_TYPE_VBI_OUTPUT, V4L2_BUF_TYPE_SLICED_VBI_CAPTURE, V4L2_BUF_TYPE_SLICED_VBI_OUTPUT, V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_BUF_TYPE_SDR_CAPTURE, V4L2_BUF_TYPE_SDR_OUTPUT, V4L2_BUF_TYPE_META_CAPTURE, V4L2_BUF_TYPE_PRIVATE, # Deprecated, do not use. ) = list(range(1, 14)) + [0x80] v4l2_ctrl_type = enum ( V4L2_CTRL_TYPE_INTEGER, V4L2_CTRL_TYPE_BOOLEAN, V4L2_CTRL_TYPE_MENU, V4L2_CTRL_TYPE_BUTTON, V4L2_CTRL_TYPE_INTEGER64, V4L2_CTRL_TYPE_CTRL_CLASS, V4L2_CTRL_TYPE_STRING, V4L2_CTRL_TYPE_BITMASK, V4L2_CTRL_TYPE_INTEGER_MENU, ) = range(1, 10) # Compound types are >= 0x0100 V4L2_CTRL_COMPOUND_TYPES = 0x0100 V4L2_CTRL_TYPE_U8 = 0x0100 V4L2_CTRL_TYPE_U16 = 0x0101 V4L2_CTRL_TYPE_U32 = 0x0102 v4l2_tuner_type = enum ( V4L2_TUNER_RADIO, V4L2_TUNER_ANALOG_TV, V4L2_TUNER_DIGITAL_TV, ) = range(1, 4) v4l2_memory = enum ( V4L2_MEMORY_MMAP, V4L2_MEMORY_USERPTR, V4L2_MEMORY_OVERLAY, V4L2_MEMORY_DMABUF, ) = range(1, 5) v4l2_colorspace = enum ( #Default colorspace, i.e. let the driver figure it out. #Can only be used with video capture. V4L2_COLORSPACE_DEFAULT, # SMPTE 170M: used for broadcast NTSC/PAL SDTV V4L2_COLORSPACE_SMPTE170M, # Obsolete pre-1998 SMPTE 240M HDTV standard, superseded by Rec 709 V4L2_COLORSPACE_SMPTE240M, # Rec.709: used for HDTV V4L2_COLORSPACE_REC709, #Deprecated, do not use. No driver will ever return this. This was #based on a misunderstanding of the bt878 datasheet. V4L2_COLORSPACE_BT878, #NTSC 1953 colorspace. This only makes sense when dealing with #really, really old NTSC recordings. Superseded by SMPTE 170M. V4L2_COLORSPACE_470_SYSTEM_M, #EBU Tech 3213 PAL/SECAM colorspace. This only makes sense when #dealing with really old PAL/SECAM recordings. Superseded by #SMPTE 170M. V4L2_COLORSPACE_470_SYSTEM_BG, #Effectively shorthand for V4L2_COLORSPACE_SRGB, V4L2_YCBCR_ENC_601 #and V4L2_QUANTIZATION_FULL_RANGE. To be used for (Motion-)JPEG. V4L2_COLORSPACE_JPEG, # For RGB colorspaces such as produces by most webcams. V4L2_COLORSPACE_SRGB, # AdobeRGB colorspace V4L2_COLORSPACE_ADOBERGB, # BT.2020 colorspace, used for UHDTV. V4L2_COLORSPACE_BT2020, # Raw colorspace: for RAW unprocessed images V4L2_COLORSPACE_RAW, # DCI-P3 colorspace, used by cinema projectors V4L2_COLORSPACE_DCI_P3, ) = range(0, 13) v4l2_priority = enum ( V4L2_PRIORITY_UNSET, V4L2_PRIORITY_BACKGROUND, V4L2_PRIORITY_INTERACTIVE, V4L2_PRIORITY_RECORD, V4L2_PRIORITY_DEFAULT, ) = list(range(0, 4)) + [2] class v4l2_rect(ctypes.Structure): _fields_ = [ ('left', ctypes.c_int32), ('top', ctypes.c_int32), ('width', ctypes.c_int32), ('height', ctypes.c_int32), ] class v4l2_fract(ctypes.Structure): _fields_ = [ ('numerator', ctypes.c_uint32), ('denominator', ctypes.c_uint32), ] # # Driver capabilities # class v4l2_capability(ctypes.Structure): _fields_ = [ ('driver', ctypes.c_char * 16), ('card', ctypes.c_char * 32), ('bus_info', ctypes.c_char * 32), ('version', ctypes.c_uint32), ('capabilities', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 4), ] # # Values for 'capabilities' field # V4L2_CAP_VIDEO_CAPTURE = 0x00000001 # Is a video capture device V4L2_CAP_VIDEO_OUTPUT = 0x00000002 # Is a video output device V4L2_CAP_VIDEO_OVERLAY = 0x00000004 # Can do video overlay V4L2_CAP_VBI_CAPTURE = 0x00000010 # Is a raw VBI capture device V4L2_CAP_VBI_OUTPUT = 0x00000020 # Is a raw VBI output device V4L2_CAP_SLICED_VBI_CAPTURE = 0x00000040 # Is a sliced VBI capture device V4L2_CAP_SLICED_VBI_OUTPUT = 0x00000080 # Is a sliced VBI output device V4L2_CAP_RDS_CAPTURE = 0x00000100 # RDS data capture V4L2_CAP_VIDEO_OUTPUT_OVERLAY = 0x00000200 # Can do video output overlay V4L2_CAP_HW_FREQ_SEEK = 0x00000400 # Can do hardware frequency seek V4L2_CAP_RDS_OUTPUT = 0x00000800 # Is an RDS encoder V4L2_CAP_VIDEO_CAPTURE_MPLANE = 0x00001000 # Is a video capture device that supports multiplanar formats V4L2_CAP_VIDEO_OUTPUT_MPLANE = 0x00002000 # Is a video output device that supports multiplanar formats V4L2_CAP_VIDEO_M2M_MPLANE = 0x00004000 # Is a video mem-to-mem device that supports multiplanar formats V4L2_CAP_VIDEO_M2M = 0x00008000 # Is a video mem-to-mem device V4L2_CAP_TUNER = 0x00010000 # has a tuner V4L2_CAP_AUDIO = 0x00020000 # has audio support V4L2_CAP_RADIO = 0x00040000 # is a radio device V4L2_CAP_MODULATOR = 0x00080000 # has a modulator V4L2_CAP_SDR_CAPTURE = 0x00100000 # Is a SDR capture device V4L2_CAP_EXT_PIX_FORMAT = 0x00200000 # Supports the extended pixel format V4L2_CAP_SDR_OUTPUT = 0x00400000 # Is a SDR output device V4L2_CAP_META_CAPTURE = 0x00800000 # Is a metadata capture device V4L2_CAP_READWRITE = 0x01000000 # read/write systemcalls V4L2_CAP_ASYNCIO = 0x02000000 # async I/O V4L2_CAP_STREAMING = 0x04000000 # streaming I/O ioctls V4L2_CAP_TOUCH = 0x10000000 # Is a touch device V4L2_CAP_DEVICE_CAPS = 0x80000000 # sets device capabilities field # # Video image format # class v4l2_pix_format(ctypes.Structure): _fields_ = [ ('width', ctypes.c_uint32), ('height', ctypes.c_uint32), ('pixelformat', ctypes.c_uint32), ('field', v4l2_field), ('bytesperline', ctypes.c_uint32), ('sizeimage', ctypes.c_uint32), ('colorspace', v4l2_colorspace), ('priv', ctypes.c_uint32), ] # RGB formats V4L2_PIX_FMT_RGB332 = v4l2_fourcc('R', 'G', 'B', '1') V4L2_PIX_FMT_RGB444 = v4l2_fourcc('R', '4', '4', '4') V4L2_PIX_FMT_RGB555 = v4l2_fourcc('R', 'G', 'B', 'O') V4L2_PIX_FMT_RGB565 = v4l2_fourcc('R', 'G', 'B', 'P') V4L2_PIX_FMT_RGB555X = v4l2_fourcc('R', 'G', 'B', 'Q') V4L2_PIX_FMT_RGB565X = v4l2_fourcc('R', 'G', 'B', 'R') V4L2_PIX_FMT_BGR24 = v4l2_fourcc('B', 'G', 'R', '3') V4L2_PIX_FMT_RGB24 = v4l2_fourcc('R', 'G', 'B', '3') V4L2_PIX_FMT_BGR32 = v4l2_fourcc('B', 'G', 'R', '4') V4L2_PIX_FMT_RGB32 = v4l2_fourcc('R', 'G', 'B', '4') V4L2_PIX_FMT_RGBX32 = v4l2_fourcc('X', 'B', '2', '4') V4L2_PIX_FMT_XRGB32 = v4l2_fourcc('B', 'X', '2', '4') V4L2_PIX_FMT_RGBA32 = v4l2_fourcc('A', 'B', '2', '4') # Grey formats V4L2_PIX_FMT_GREY = v4l2_fourcc('G', 'R', 'E', 'Y') V4L2_PIX_FMT_Y10 = v4l2_fourcc('Y', '1', '0', ' ') V4L2_PIX_FMT_Y16 = v4l2_fourcc('Y', '1', '6', ' ') # Palette formats V4L2_PIX_FMT_PAL8 = v4l2_fourcc('P', 'A', 'L', '8') # Luminance+Chrominance formats V4L2_PIX_FMT_YVU410 = v4l2_fourcc('Y', 'V', 'U', '9') V4L2_PIX_FMT_YVU420 = v4l2_fourcc('Y', 'V', '1', '2') V4L2_PIX_FMT_YUYV = v4l2_fourcc('Y', 'U', 'Y', 'V') V4L2_PIX_FMT_YYUV = v4l2_fourcc('Y', 'Y', 'U', 'V') V4L2_PIX_FMT_YVYU = v4l2_fourcc('Y', 'V', 'Y', 'U') V4L2_PIX_FMT_UYVY = v4l2_fourcc('U', 'Y', 'V', 'Y') V4L2_PIX_FMT_VYUY = v4l2_fourcc('V', 'Y', 'U', 'Y') V4L2_PIX_FMT_YUV422P = v4l2_fourcc('4', '2', '2', 'P') V4L2_PIX_FMT_YUV411P = v4l2_fourcc('4', '1', '1', 'P') V4L2_PIX_FMT_Y41P = v4l2_fourcc('Y', '4', '1', 'P') V4L2_PIX_FMT_YUV444 = v4l2_fourcc('Y', '4', '4', '4') V4L2_PIX_FMT_YUV555 = v4l2_fourcc('Y', 'U', 'V', 'O') V4L2_PIX_FMT_YUV565 = v4l2_fourcc('Y', 'U', 'V', 'P') V4L2_PIX_FMT_YUV32 = v4l2_fourcc('Y', 'U', 'V', '4') V4L2_PIX_FMT_YUV410 = v4l2_fourcc('Y', 'U', 'V', '9') V4L2_PIX_FMT_YUV420 = v4l2_fourcc('Y', 'U', '1', '2') V4L2_PIX_FMT_HI240 = v4l2_fourcc('H', 'I', '2', '4') V4L2_PIX_FMT_HM12 = v4l2_fourcc('H', 'M', '1', '2') # two planes -- one Y, one Cr + Cb interleaved V4L2_PIX_FMT_NV12 = v4l2_fourcc('N', 'V', '1', '2') V4L2_PIX_FMT_NV21 = v4l2_fourcc('N', 'V', '2', '1') V4L2_PIX_FMT_NV16 = v4l2_fourcc('N', 'V', '1', '6') V4L2_PIX_FMT_NV61 = v4l2_fourcc('N', 'V', '6', '1') # Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm V4L2_PIX_FMT_SBGGR8 = v4l2_fourcc('B', 'A', '8', '1') V4L2_PIX_FMT_SGBRG8 = v4l2_fourcc('G', 'B', 'R', 'G') V4L2_PIX_FMT_SGRBG8 = v4l2_fourcc('G', 'R', 'B', 'G') V4L2_PIX_FMT_SRGGB8 = v4l2_fourcc('R', 'G', 'G', 'B') V4L2_PIX_FMT_SBGGR10 = v4l2_fourcc('B', 'G', '1', '0') V4L2_PIX_FMT_SGBRG10 = v4l2_fourcc('G', 'B', '1', '0') V4L2_PIX_FMT_SGRBG10 = v4l2_fourcc('B', 'A', '1', '0') V4L2_PIX_FMT_SRGGB10 = v4l2_fourcc('R', 'G', '1', '0') V4L2_PIX_FMT_SGRBG10DPCM8 = v4l2_fourcc('B', 'D', '1', '0') V4L2_PIX_FMT_SBGGR16 = v4l2_fourcc('B', 'Y', 'R', '2') # compressed formats V4L2_PIX_FMT_MJPEG = v4l2_fourcc('M', 'J', 'P', 'G') V4L2_PIX_FMT_JPEG = v4l2_fourcc('J', 'P', 'E', 'G') V4L2_PIX_FMT_DV = v4l2_fourcc('d', 'v', 's', 'd') V4L2_PIX_FMT_MPEG = v4l2_fourcc('M', 'P', 'E', 'G') V4L2_PIX_FMT_H264 = v4l2_fourcc('H', '2', '6', '4') # Vendor-specific formats V4L2_PIX_FMT_CPIA1 = v4l2_fourcc('C', 'P', 'I', 'A') V4L2_PIX_FMT_WNVA = v4l2_fourcc('W', 'N', 'V', 'A') V4L2_PIX_FMT_SN9C10X = v4l2_fourcc('S', '9', '1', '0') V4L2_PIX_FMT_SN9C20X_I420 = v4l2_fourcc('S', '9', '2', '0') V4L2_PIX_FMT_PWC1 = v4l2_fourcc('P', 'W', 'C', '1') V4L2_PIX_FMT_PWC2 = v4l2_fourcc('P', 'W', 'C', '2') V4L2_PIX_FMT_ET61X251 = v4l2_fourcc('E', '6', '2', '5') V4L2_PIX_FMT_SPCA501 = v4l2_fourcc('S', '5', '0', '1') V4L2_PIX_FMT_SPCA505 = v4l2_fourcc('S', '5', '0', '5') V4L2_PIX_FMT_SPCA508 = v4l2_fourcc('S', '5', '0', '8') V4L2_PIX_FMT_SPCA561 = v4l2_fourcc('S', '5', '6', '1') V4L2_PIX_FMT_PAC207 = v4l2_fourcc('P', '2', '0', '7') V4L2_PIX_FMT_MR97310A = v4l2_fourcc('M', '3', '1', '0') V4L2_PIX_FMT_SN9C2028 = v4l2_fourcc('S', 'O', 'N', 'X') V4L2_PIX_FMT_SQ905C = v4l2_fourcc('9', '0', '5', 'C') V4L2_PIX_FMT_PJPG = v4l2_fourcc('P', 'J', 'P', 'G') V4L2_PIX_FMT_OV511 = v4l2_fourcc('O', '5', '1', '1') V4L2_PIX_FMT_OV518 = v4l2_fourcc('O', '5', '1', '8') V4L2_PIX_FMT_STV0680 = v4l2_fourcc('S', '6', '8', '0') # # Format enumeration # class v4l2_fmtdesc(ctypes.Structure): _fields_ = [ ('index', ctypes.c_uint32), ('type', ctypes.c_int), ('flags', ctypes.c_uint32), ('description', ctypes.c_char * 32), ('pixelformat', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 4), ] V4L2_FMT_FLAG_COMPRESSED = 0x0001 V4L2_FMT_FLAG_EMULATED = 0x0002 # # Experimental frame size and frame rate enumeration # v4l2_frmsizetypes = enum ( V4L2_FRMSIZE_TYPE_DISCRETE, V4L2_FRMSIZE_TYPE_CONTINUOUS, V4L2_FRMSIZE_TYPE_STEPWISE, ) = range(1, 4) class v4l2_frmsize_discrete(ctypes.Structure): _fields_ = [ ('width', ctypes.c_uint32), ('height', ctypes.c_uint32), ] class v4l2_frmsize_stepwise(ctypes.Structure): _fields_ = [ ('min_width', ctypes.c_uint32), ('min_height', ctypes.c_uint32), ('step_width', ctypes.c_uint32), ('min_height', ctypes.c_uint32), ('max_height', ctypes.c_uint32), ('step_height', ctypes.c_uint32), ] class v4l2_frmsizeenum(ctypes.Structure): class _u(ctypes.Union): _fields_ = [ ('discrete', v4l2_frmsize_discrete), ('stepwise', v4l2_frmsize_stepwise), ] _fields_ = [ ('index', ctypes.c_uint32), ('pixel_format', ctypes.c_uint32), ('type', ctypes.c_uint32), ('_u', _u), ('reserved', ctypes.c_uint32 * 2) ] _anonymous_ = ('_u',) # # Frame rate enumeration # v4l2_frmivaltypes = enum ( V4L2_FRMIVAL_TYPE_DISCRETE, V4L2_FRMIVAL_TYPE_CONTINUOUS, V4L2_FRMIVAL_TYPE_STEPWISE, ) = range(1, 4) class v4l2_frmival_stepwise(ctypes.Structure): _fields_ = [ ('min', v4l2_fract), ('max', v4l2_fract), ('step', v4l2_fract), ] class v4l2_frmivalenum(ctypes.Structure): class _u(ctypes.Union): _fields_ = [ ('discrete', v4l2_fract), ('stepwise', v4l2_frmival_stepwise), ] _fields_ = [ ('index', ctypes.c_uint32), ('pixel_format', ctypes.c_uint32), ('width', ctypes.c_uint32), ('height', ctypes.c_uint32), ('type', ctypes.c_uint32), ('_u', _u), ('reserved', ctypes.c_uint32 * 2), ] _anonymous_ = ('_u',) # # Timecode # class v4l2_timecode(ctypes.Structure): _fields_ = [ ('type', ctypes.c_uint32), ('flags', ctypes.c_uint32), ('frames', ctypes.c_uint8), ('seconds', ctypes.c_uint8), ('minutes', ctypes.c_uint8), ('hours', ctypes.c_uint8), ('userbits', ctypes.c_uint8 * 4), ] V4L2_TC_TYPE_24FPS = 1 V4L2_TC_TYPE_25FPS = 2 V4L2_TC_TYPE_30FPS = 3 V4L2_TC_TYPE_50FPS = 4 V4L2_TC_TYPE_60FPS = 5 V4L2_TC_FLAG_DROPFRAME = 0x0001 V4L2_TC_FLAG_COLORFRAME = 0x0002 V4L2_TC_USERBITS_field = 0x000C V4L2_TC_USERBITS_USERDEFINED = 0x0000 V4L2_TC_USERBITS_8BITCHARS = 0x0008 class v4l2_jpegcompression(ctypes.Structure): _fields_ = [ ('quality', ctypes.c_int), ('APPn', ctypes.c_int), ('APP_len', ctypes.c_int), ('APP_data', ctypes.c_char * 60), ('COM_len', ctypes.c_int), ('COM_data', ctypes.c_char * 60), ('jpeg_markers', ctypes.c_uint32), ] V4L2_JPEG_MARKER_DHT = 1 << 3 V4L2_JPEG_MARKER_DQT = 1 << 4 V4L2_JPEG_MARKER_DRI = 1 << 5 V4L2_JPEG_MARKER_COM = 1 << 6 V4L2_JPEG_MARKER_APP = 1 << 7 # # Memory-mapping buffers # # https://www.kernel.org/doc/html/v5.10/userspace-api/media/v4l/buffer.html#struct-v4l2-plane class v4l2_plane(ctypes.Structure): class _u(ctypes.Union): _fields_ = [("mem_offset", ctypes.c_uint32), ("userptr", ctypes.c_ulong), ("fd", ctypes.c_int32)] _fields_ = [ ('bytesused', ctypes.c_uint32), ('length', ctypes.c_uint32), ('m', _u), ('data_offset', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 11) ] class v4l2_requestbuffers(ctypes.Structure): _fields_ = [ ('count', ctypes.c_uint32), ('type', v4l2_buf_type), ('memory', v4l2_memory), ('reserved', ctypes.c_uint32 * 2), ] class v4l2_buffer(ctypes.Structure): class _u(ctypes.Union): _fields_ = [ ('offset', ctypes.c_uint32), ('userptr', ctypes.c_ulong), ('planes', ctypes.POINTER(v4l2_plane)), ('fd', ctypes.c_int32) ] _fields_ = [ ('index', ctypes.c_uint32), ('type', v4l2_buf_type), ('bytesused', ctypes.c_uint32), ('flags', ctypes.c_uint32), ('field', v4l2_field), ('timestamp', timeval), ('timecode', v4l2_timecode), ('sequence', ctypes.c_uint32), ('memory', v4l2_memory), ('m', _u), ('length', ctypes.c_uint32), ('input', ctypes.c_uint32), ('reserved', ctypes.c_uint32), ] V4L2_BUF_FLAG_MAPPED = 0x0001 V4L2_BUF_FLAG_QUEUED = 0x0002 V4L2_BUF_FLAG_DONE = 0x0004 V4L2_BUF_FLAG_KEYFRAME = 0x0008 V4L2_BUF_FLAG_PFRAME = 0x0010 V4L2_BUF_FLAG_BFRAME = 0x0020 V4L2_BUF_FLAG_TIMECODE = 0x0100 V4L2_BUF_FLAG_INPUT = 0x0200 # # Overlay preview # class v4l2_framebuffer(ctypes.Structure): _fields_ = [ ('capability', ctypes.c_uint32), ('flags', ctypes.c_uint32), ('base', ctypes.c_void_p), ('fmt', v4l2_pix_format), ] V4L2_FBUF_CAP_EXTERNOVERLAY = 0x0001 V4L2_FBUF_CAP_CHROMAKEY = 0x0002 V4L2_FBUF_CAP_LIST_CLIPPING = 0x0004 V4L2_FBUF_CAP_BITMAP_CLIPPING = 0x0008 V4L2_FBUF_CAP_LOCAL_ALPHA = 0x0010 V4L2_FBUF_CAP_GLOBAL_ALPHA = 0x0020 V4L2_FBUF_CAP_LOCAL_INV_ALPHA = 0x0040 V4L2_FBUF_CAP_SRC_CHROMAKEY = 0x0080 V4L2_FBUF_FLAG_PRIMARY = 0x0001 V4L2_FBUF_FLAG_OVERLAY = 0x0002 V4L2_FBUF_FLAG_CHROMAKEY = 0x0004 V4L2_FBUF_FLAG_LOCAL_ALPHA = 0x0008 V4L2_FBUF_FLAG_GLOBAL_ALPHA = 0x0010 V4L2_FBUF_FLAG_LOCAL_INV_ALPHA = 0x0020 V4L2_FBUF_FLAG_SRC_CHROMAKEY = 0x0040 class v4l2_clip(ctypes.Structure): pass v4l2_clip._fields_ = [ ('c', v4l2_rect), ('next', ctypes.POINTER(v4l2_clip)), ] class v4l2_window(ctypes.Structure): _fields_ = [ ('w', v4l2_rect), ('field', v4l2_field), ('chromakey', ctypes.c_uint32), ('clips', ctypes.POINTER(v4l2_clip)), ('clipcount', ctypes.c_uint32), ('bitmap', ctypes.c_void_p), ('global_alpha', ctypes.c_uint8), ] # # Capture parameters # class v4l2_captureparm(ctypes.Structure): _fields_ = [ ('capability', ctypes.c_uint32), ('capturemode', ctypes.c_uint32), ('timeperframe', v4l2_fract), ('extendedmode', ctypes.c_uint32), ('readbuffers', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 4), ] V4L2_MODE_HIGHQUALITY = 0x0001 V4L2_CAP_TIMEPERFRAME = 0x1000 class v4l2_outputparm(ctypes.Structure): _fields_ = [ ('capability', ctypes.c_uint32), ('outputmode', ctypes.c_uint32), ('timeperframe', v4l2_fract), ('extendedmode', ctypes.c_uint32), ('writebuffers', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 4), ] # # Input image cropping # class v4l2_cropcap(ctypes.Structure): _fields_ = [ ('type', v4l2_buf_type), ('bounds', v4l2_rect), ('defrect', v4l2_rect), ('pixelaspect', v4l2_fract), ] class v4l2_crop(ctypes.Structure): _fields_ = [ ('type', ctypes.c_int), ('c', v4l2_rect), ] # # Analog video standard # v4l2_std_id = ctypes.c_uint64 V4L2_STD_PAL_B = 0x00000001 V4L2_STD_PAL_B1 = 0x00000002 V4L2_STD_PAL_G = 0x00000004 V4L2_STD_PAL_H = 0x00000008 V4L2_STD_PAL_I = 0x00000010 V4L2_STD_PAL_D = 0x00000020 V4L2_STD_PAL_D1 = 0x00000040 V4L2_STD_PAL_K = 0x00000080 V4L2_STD_PAL_M = 0x00000100 V4L2_STD_PAL_N = 0x00000200 V4L2_STD_PAL_Nc = 0x00000400 V4L2_STD_PAL_60 = 0x00000800 V4L2_STD_NTSC_M = 0x00001000 V4L2_STD_NTSC_M_JP = 0x00002000 V4L2_STD_NTSC_443 = 0x00004000 V4L2_STD_NTSC_M_KR = 0x00008000 V4L2_STD_SECAM_B = 0x00010000 V4L2_STD_SECAM_D = 0x00020000 V4L2_STD_SECAM_G = 0x00040000 V4L2_STD_SECAM_H = 0x00080000 V4L2_STD_SECAM_K = 0x00100000 V4L2_STD_SECAM_K1 = 0x00200000 V4L2_STD_SECAM_L = 0x00400000 V4L2_STD_SECAM_LC = 0x00800000 V4L2_STD_ATSC_8_VSB = 0x01000000 V4L2_STD_ATSC_16_VSB = 0x02000000 # some common needed stuff V4L2_STD_PAL_BG = (V4L2_STD_PAL_B | V4L2_STD_PAL_B1 | V4L2_STD_PAL_G) V4L2_STD_PAL_DK = (V4L2_STD_PAL_D | V4L2_STD_PAL_D1 | V4L2_STD_PAL_K) V4L2_STD_PAL = (V4L2_STD_PAL_BG | V4L2_STD_PAL_DK | V4L2_STD_PAL_H | V4L2_STD_PAL_I) V4L2_STD_NTSC = (V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_JP | V4L2_STD_NTSC_M_KR) V4L2_STD_SECAM_DK = (V4L2_STD_SECAM_D | V4L2_STD_SECAM_K | V4L2_STD_SECAM_K1) V4L2_STD_SECAM = (V4L2_STD_SECAM_B | V4L2_STD_SECAM_G | V4L2_STD_SECAM_H | V4L2_STD_SECAM_DK | V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC) V4L2_STD_525_60 = (V4L2_STD_PAL_M | V4L2_STD_PAL_60 | V4L2_STD_NTSC | V4L2_STD_NTSC_443) V4L2_STD_625_50 = (V4L2_STD_PAL | V4L2_STD_PAL_N | V4L2_STD_PAL_Nc | V4L2_STD_SECAM) V4L2_STD_ATSC = (V4L2_STD_ATSC_8_VSB | V4L2_STD_ATSC_16_VSB) V4L2_STD_UNKNOWN = 0 V4L2_STD_ALL = (V4L2_STD_525_60 | V4L2_STD_625_50) # some merged standards V4L2_STD_MN = (V4L2_STD_PAL_M | V4L2_STD_PAL_N | V4L2_STD_PAL_Nc | V4L2_STD_NTSC) V4L2_STD_B = (V4L2_STD_PAL_B | V4L2_STD_PAL_B1 | V4L2_STD_SECAM_B) V4L2_STD_GH = (V4L2_STD_PAL_G | V4L2_STD_PAL_H|V4L2_STD_SECAM_G | V4L2_STD_SECAM_H) V4L2_STD_DK = (V4L2_STD_PAL_DK | V4L2_STD_SECAM_DK) class v4l2_standard(ctypes.Structure): _fields_ = [ ('index', ctypes.c_uint32), ('id', v4l2_std_id), ('name', ctypes.c_char * 24), ('frameperiod', v4l2_fract), ('framelines', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 4), ] # # Video timings dv preset # class v4l2_dv_preset(ctypes.Structure): _fields_ = [ ('preset', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 4) ] # # DV preset enumeration # class v4l2_dv_enum_preset(ctypes.Structure): _fields_ = [ ('index', ctypes.c_uint32), ('preset', ctypes.c_uint32), ('name', ctypes.c_char * 32), ('width', ctypes.c_uint32), ('height', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 4), ] # # DV preset values # V4L2_DV_INVALID = 0 V4L2_DV_480P59_94 = 1 V4L2_DV_576P50 = 2 V4L2_DV_720P24 = 3 V4L2_DV_720P25 = 4 V4L2_DV_720P30 = 5 V4L2_DV_720P50 = 6 V4L2_DV_720P59_94 = 7 V4L2_DV_720P60 = 8 V4L2_DV_1080I29_97 = 9 V4L2_DV_1080I30 = 10 V4L2_DV_1080I25 = 11 V4L2_DV_1080I50 = 12 V4L2_DV_1080I60 = 13 V4L2_DV_1080P24 = 14 V4L2_DV_1080P25 = 15 V4L2_DV_1080P30 = 16 V4L2_DV_1080P50 = 17 V4L2_DV_1080P60 = 18 # # DV BT timings # class v4l2_bt_timings(ctypes.Structure): _fields_ = [ ('width', ctypes.c_uint32), ('height', ctypes.c_uint32), ('interlaced', ctypes.c_uint32), ('polarities', ctypes.c_uint32), ('pixelclock', ctypes.c_uint64), ('hfrontporch', ctypes.c_uint32), ('hsync', ctypes.c_uint32), ('hbackporch', ctypes.c_uint32), ('vfrontporch', ctypes.c_uint32), ('vsync', ctypes.c_uint32), ('vbackporch', ctypes.c_uint32), ('il_vfrontporch', ctypes.c_uint32), ('il_vsync', ctypes.c_uint32), ('il_vbackporch', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 16), ] _pack_ = True # Interlaced or progressive format V4L2_DV_PROGRESSIVE = 0 V4L2_DV_INTERLACED = 1 # Polarities. If bit is not set, it is assumed to be negative polarity V4L2_DV_VSYNC_POS_POL = 0x00000001 V4L2_DV_HSYNC_POS_POL = 0x00000002 class v4l2_dv_timings(ctypes.Structure): class _u(ctypes.Union): _fields_ = [ ('bt', v4l2_bt_timings), ('reserved', ctypes.c_uint32 * 32), ] _fields_ = [ ('type', ctypes.c_uint32), ('_u', _u), ] _anonymous_ = ('_u',) _pack_ = True # Values for the type field V4L2_DV_BT_656_1120 = 0 # # Video inputs # class v4l2_input(ctypes.Structure): _fields_ = [ ('index', ctypes.c_uint32), ('name', ctypes.c_char * 32), ('type', ctypes.c_uint32), ('audioset', ctypes.c_uint32), ('tuner', ctypes.c_uint32), ('std', v4l2_std_id), ('status', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 4), ] V4L2_INPUT_TYPE_TUNER = 1 V4L2_INPUT_TYPE_CAMERA = 2 V4L2_IN_ST_NO_POWER = 0x00000001 V4L2_IN_ST_NO_SIGNAL = 0x00000002 V4L2_IN_ST_NO_COLOR = 0x00000004 V4L2_IN_ST_HFLIP = 0x00000010 V4L2_IN_ST_VFLIP = 0x00000020 V4L2_IN_ST_NO_H_LOCK = 0x00000100 V4L2_IN_ST_COLOR_KILL = 0x00000200 V4L2_IN_ST_NO_SYNC = 0x00010000 V4L2_IN_ST_NO_EQU = 0x00020000 V4L2_IN_ST_NO_CARRIER = 0x00040000 V4L2_IN_ST_MACROVISION = 0x01000000 V4L2_IN_ST_NO_ACCESS = 0x02000000 V4L2_IN_ST_VTR = 0x04000000 V4L2_IN_CAP_PRESETS = 0x00000001 V4L2_IN_CAP_CUSTOM_TIMINGS = 0x00000002 V4L2_IN_CAP_STD = 0x00000004 # # Video outputs # class v4l2_output(ctypes.Structure): _fields_ = [ ('index', ctypes.c_uint32), ('name', ctypes.c_char * 32), ('type', ctypes.c_uint32), ('audioset', ctypes.c_uint32), ('modulator', ctypes.c_uint32), ('std', v4l2_std_id), ('reserved', ctypes.c_uint32 * 4), ] V4L2_OUTPUT_TYPE_MODULATOR = 1 V4L2_OUTPUT_TYPE_ANALOG = 2 V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY = 3 V4L2_OUT_CAP_PRESETS = 0x00000001 V4L2_OUT_CAP_CUSTOM_TIMINGS = 0x00000002 V4L2_OUT_CAP_STD = 0x00000004 # # Controls # class v4l2_control(ctypes.Structure): _fields_ = [ ('id', ctypes.c_uint32), ('value', ctypes.c_int32), ] class v4l2_ext_control(ctypes.Structure): class _u(ctypes.Union): _fields_ = [ ('value', ctypes.c_int32), ('value64', ctypes.c_int64), ('string', ctypes.POINTER(ctypes.c_char)), ('p_u8', ctypes.POINTER(ctypes.c_uint8)), ('p_u16', ctypes.POINTER(ctypes.c_uint16)), ('p_u32', ctypes.POINTER(ctypes.c_uint32)), ('p_s32', ctypes.POINTER(ctypes.c_int32)), ('p_s64', ctypes.POINTER(ctypes.c_int64)), ('ptr', ctypes.POINTER(ctypes.c_void_p)), ] _fields_ = [ ('id', ctypes.c_uint32), ('size', ctypes.c_uint32), ('reserved2', ctypes.c_uint32 * 1), ('_u', _u), ] _anonymous_ = ('_u',) _pack_ = True class v4l2_ext_controls(ctypes.Structure): class _u(ctypes.Union): _fields_ = [ ('ctrl_class', ctypes.c_uint32), ('which', ctypes.c_uint32), ] _fields_ = [ ('_u', _u), ('count', ctypes.c_uint32), ('error_idx', ctypes.c_uint32), ('request_fd', ctypes.c_int32), ('reserved', ctypes.c_uint32 * 1), ('controls', ctypes.POINTER(v4l2_ext_control)), ] _anonymous_ = ('_u',) V4L2_CTRL_CLASS_USER = 0x00980000 V4L2_CTRL_CLASS_MPEG = 0x00990000 V4L2_CTRL_CLASS_CAMERA = 0x009a0000 V4L2_CTRL_CLASS_FM_TX = 0x009b0000 def V4L2_CTRL_ID_MASK(): return 0x0fffffff def V4L2_CTRL_ID2CLASS(id_): return id_ & 0x0fff0000 # unsigned long def V4L2_CTRL_ID2WHICH(id_): return id_ & 0x0fff0000 # unsigned long def V4L2_CTRL_DRIVER_PRIV(id_): return (id_ & 0xffff) >= 0x1000 class v4l2_queryctrl(ctypes.Structure): _fields_ = [ ('id', ctypes.c_uint32), ('type', v4l2_ctrl_type), ('name', ctypes.c_char * 32), ('minimum', ctypes.c_int32), ('maximum', ctypes.c_int32), ('step', ctypes.c_int32), ('default_value', ctypes.c_int32), ('flags', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 2), ] V4L2_CTRL_MAX_DIMS = 4 class v4l2_query_ext_ctrl(ctypes.Structure): _fields_ = [ ('id', ctypes.c_uint32), ('type', v4l2_ctrl_type), ('name', ctypes.c_char * 32), ('minimum', ctypes.c_int64), ('maximum', ctypes.c_int64), ('step', ctypes.c_uint64), ('default_value', ctypes.c_int64), ('flags', ctypes.c_uint32), ('elem_size', ctypes.c_uint32), ('elems', ctypes.c_uint32), ('nr_of_dims', ctypes.c_uint32), ('dims', ctypes.c_uint32 * V4L2_CTRL_MAX_DIMS), ('reserved', ctypes.c_uint32 * 32), ] class v4l2_querymenu(ctypes.Structure): _fields_ = [ ('id', ctypes.c_uint32), ('index', ctypes.c_uint32), ('name', ctypes.c_char * 32), ('reserved', ctypes.c_uint32), ] NONE = 0x0000 V4L2_CTRL_FLAG_DISABLED = 0x0001 V4L2_CTRL_FLAG_GRABBED = 0x0002 V4L2_CTRL_FLAG_READ_ONLY = 0x0004 V4L2_CTRL_FLAG_UPDATE = 0x0008 V4L2_CTRL_FLAG_INACTIVE = 0x0010 V4L2_CTRL_FLAG_SLIDER = 0x0020 V4L2_CTRL_FLAG_WRITE_ONLY = 0x0040 V4L2_CTRL_FLAG_VOLATILE = 0x0080 V4L2_CTRL_FLAG_HAS_PAYLOAD = 0x0100 V4L2_CTRL_FLAG_EXECUTE_ON_WRITE = 0x0200 V4L2_CTRL_FLAG_MODIFY_LAYOUT = 0x0400 V4L2_CTRL_FLAG_NEXT_CTRL = 0x80000000 V4L2_CTRL_FLAG_NEXT_COMPOUND = 0x40000000 V4L2_CID_BASE = V4L2_CTRL_CLASS_USER | 0x900 V4L2_CID_USER_BASE = V4L2_CID_BASE V4L2_CID_PRIVATE_BASE = 0x08000000 V4L2_CID_USER_CLASS = V4L2_CTRL_CLASS_USER | 1 V4L2_CID_BRIGHTNESS = V4L2_CID_BASE + 0 V4L2_CID_CONTRAST = V4L2_CID_BASE + 1 V4L2_CID_SATURATION = V4L2_CID_BASE + 2 V4L2_CID_HUE = V4L2_CID_BASE + 3 V4L2_CID_AUDIO_VOLUME = V4L2_CID_BASE + 5 V4L2_CID_AUDIO_BALANCE = V4L2_CID_BASE + 6 V4L2_CID_AUDIO_BASS = V4L2_CID_BASE + 7 V4L2_CID_AUDIO_TREBLE = V4L2_CID_BASE + 8 V4L2_CID_AUDIO_MUTE = V4L2_CID_BASE + 9 V4L2_CID_AUDIO_LOUDNESS = V4L2_CID_BASE + 10 V4L2_CID_BLACK_LEVEL = V4L2_CID_BASE + 11 # Deprecated V4L2_CID_AUTO_WHITE_BALANCE = V4L2_CID_BASE + 12 V4L2_CID_DO_WHITE_BALANCE = V4L2_CID_BASE + 13 V4L2_CID_RED_BALANCE = V4L2_CID_BASE + 14 V4L2_CID_BLUE_BALANCE = V4L2_CID_BASE + 15 V4L2_CID_GAMMA = V4L2_CID_BASE + 16 V4L2_CID_WHITENESS = V4L2_CID_GAMMA # Deprecated V4L2_CID_EXPOSURE = V4L2_CID_BASE + 17 V4L2_CID_AUTOGAIN = V4L2_CID_BASE + 18 V4L2_CID_GAIN = V4L2_CID_BASE + 19 V4L2_CID_HFLIP = V4L2_CID_BASE + 20 V4L2_CID_VFLIP = V4L2_CID_BASE + 21 # Deprecated; use V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET V4L2_CID_HCENTER = V4L2_CID_BASE + 22 V4L2_CID_VCENTER = V4L2_CID_BASE + 23 V4L2_CID_POWER_LINE_FREQUENCY = V4L2_CID_BASE + 24 v4l2_power_line_frequency = enum ( V4L2_CID_POWER_LINE_FREQUENCY_DISABLED, V4L2_CID_POWER_LINE_FREQUENCY_50HZ, V4L2_CID_POWER_LINE_FREQUENCY_60HZ, ) = range(3) V4L2_CID_HUE_AUTO = V4L2_CID_BASE + 25 V4L2_CID_WHITE_BALANCE_TEMPERATURE = V4L2_CID_BASE + 26 V4L2_CID_SHARPNESS = V4L2_CID_BASE + 27 V4L2_CID_BACKLIGHT_COMPENSATION = V4L2_CID_BASE + 28 V4L2_CID_CHROMA_AGC = V4L2_CID_BASE + 29 V4L2_CID_COLOR_KILLER = V4L2_CID_BASE + 30 V4L2_CID_COLORFX = V4L2_CID_BASE + 31 v4l2_colorfx = enum ( V4L2_COLORFX_NONE, V4L2_COLORFX_BW, V4L2_COLORFX_SEPIA, ) = range(3) V4L2_CID_AUTOBRIGHTNESS = V4L2_CID_BASE + 32 V4L2_CID_BAND_STOP_FILTER = V4L2_CID_BASE + 33 V4L2_CID_ROTATE = V4L2_CID_BASE + 34 V4L2_CID_BG_COLOR = V4L2_CID_BASE + 35 V4L2_CID_LASTP1 = V4L2_CID_BASE + 36 V4L2_CID_MPEG_BASE = V4L2_CTRL_CLASS_MPEG | 0x900 V4L2_CID_MPEG_CLASS = V4L2_CTRL_CLASS_MPEG | 1 # MPEG streams V4L2_CID_MPEG_STREAM_TYPE = V4L2_CID_MPEG_BASE + 0 v4l2_mpeg_stream_type = enum ( V4L2_MPEG_STREAM_TYPE_MPEG2_PS, V4L2_MPEG_STREAM_TYPE_MPEG2_TS, V4L2_MPEG_STREAM_TYPE_MPEG1_SS, V4L2_MPEG_STREAM_TYPE_MPEG2_DVD, V4L2_MPEG_STREAM_TYPE_MPEG1_VCD, V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD, ) = range(6) V4L2_CID_MPEG_STREAM_PID_PMT = V4L2_CID_MPEG_BASE + 1 V4L2_CID_MPEG_STREAM_PID_AUDIO = V4L2_CID_MPEG_BASE + 2 V4L2_CID_MPEG_STREAM_PID_VIDEO = V4L2_CID_MPEG_BASE + 3 V4L2_CID_MPEG_STREAM_PID_PCR = V4L2_CID_MPEG_BASE + 4 V4L2_CID_MPEG_STREAM_PES_ID_AUDIO = V4L2_CID_MPEG_BASE + 5 V4L2_CID_MPEG_STREAM_PES_ID_VIDEO = V4L2_CID_MPEG_BASE + 6 V4L2_CID_MPEG_STREAM_VBI_FMT = V4L2_CID_MPEG_BASE + 7 v4l2_mpeg_stream_vbi_fmt = enum ( V4L2_MPEG_STREAM_VBI_FMT_NONE, V4L2_MPEG_STREAM_VBI_FMT_IVTV, ) = range(2) V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ = V4L2_CID_MPEG_BASE + 100 v4l2_mpeg_audio_sampling_freq = enum ( V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100, V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000, V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000, ) = range(3) V4L2_CID_MPEG_AUDIO_ENCODING = V4L2_CID_MPEG_BASE + 101 v4l2_mpeg_audio_encoding = enum ( V4L2_MPEG_AUDIO_ENCODING_LAYER_1, V4L2_MPEG_AUDIO_ENCODING_LAYER_2, V4L2_MPEG_AUDIO_ENCODING_LAYER_3, V4L2_MPEG_AUDIO_ENCODING_AAC, V4L2_MPEG_AUDIO_ENCODING_AC3, ) = range(5) V4L2_CID_MPEG_AUDIO_L1_BITRATE = V4L2_CID_MPEG_BASE + 102 v4l2_mpeg_audio_l1_bitrate = enum ( V4L2_MPEG_AUDIO_L1_BITRATE_32K, V4L2_MPEG_AUDIO_L1_BITRATE_64K, V4L2_MPEG_AUDIO_L1_BITRATE_96K, V4L2_MPEG_AUDIO_L1_BITRATE_128K, V4L2_MPEG_AUDIO_L1_BITRATE_160K, V4L2_MPEG_AUDIO_L1_BITRATE_192K, V4L2_MPEG_AUDIO_L1_BITRATE_224K, V4L2_MPEG_AUDIO_L1_BITRATE_256K, V4L2_MPEG_AUDIO_L1_BITRATE_288K, V4L2_MPEG_AUDIO_L1_BITRATE_320K, V4L2_MPEG_AUDIO_L1_BITRATE_352K, V4L2_MPEG_AUDIO_L1_BITRATE_384K, V4L2_MPEG_AUDIO_L1_BITRATE_416K, V4L2_MPEG_AUDIO_L1_BITRATE_448K, ) = range(14) V4L2_CID_MPEG_AUDIO_L2_BITRATE = V4L2_CID_MPEG_BASE + 103 v4l2_mpeg_audio_l2_bitrate = enum ( V4L2_MPEG_AUDIO_L2_BITRATE_32K, V4L2_MPEG_AUDIO_L2_BITRATE_48K, V4L2_MPEG_AUDIO_L2_BITRATE_56K, V4L2_MPEG_AUDIO_L2_BITRATE_64K, V4L2_MPEG_AUDIO_L2_BITRATE_80K, V4L2_MPEG_AUDIO_L2_BITRATE_96K, V4L2_MPEG_AUDIO_L2_BITRATE_112K, V4L2_MPEG_AUDIO_L2_BITRATE_128K, V4L2_MPEG_AUDIO_L2_BITRATE_160K, V4L2_MPEG_AUDIO_L2_BITRATE_192K, V4L2_MPEG_AUDIO_L2_BITRATE_224K, V4L2_MPEG_AUDIO_L2_BITRATE_256K, V4L2_MPEG_AUDIO_L2_BITRATE_320K, V4L2_MPEG_AUDIO_L2_BITRATE_384K, ) = range(14) V4L2_CID_MPEG_AUDIO_L3_BITRATE = V4L2_CID_MPEG_BASE + 104 v4l2_mpeg_audio_l3_bitrate = enum ( V4L2_MPEG_AUDIO_L3_BITRATE_32K, V4L2_MPEG_AUDIO_L3_BITRATE_40K, V4L2_MPEG_AUDIO_L3_BITRATE_48K, V4L2_MPEG_AUDIO_L3_BITRATE_56K, V4L2_MPEG_AUDIO_L3_BITRATE_64K, V4L2_MPEG_AUDIO_L3_BITRATE_80K, V4L2_MPEG_AUDIO_L3_BITRATE_96K, V4L2_MPEG_AUDIO_L3_BITRATE_112K, V4L2_MPEG_AUDIO_L3_BITRATE_128K, V4L2_MPEG_AUDIO_L3_BITRATE_160K, V4L2_MPEG_AUDIO_L3_BITRATE_192K, V4L2_MPEG_AUDIO_L3_BITRATE_224K, V4L2_MPEG_AUDIO_L3_BITRATE_256K, V4L2_MPEG_AUDIO_L3_BITRATE_320K, ) = range(14) V4L2_CID_MPEG_AUDIO_MODE = V4L2_CID_MPEG_BASE + 105 v4l2_mpeg_audio_mode = enum ( V4L2_MPEG_AUDIO_MODE_STEREO, V4L2_MPEG_AUDIO_MODE_JOINT_STEREO, V4L2_MPEG_AUDIO_MODE_DUAL, V4L2_MPEG_AUDIO_MODE_MONO, ) = range(4) V4L2_CID_MPEG_AUDIO_MODE_EXTENSION = V4L2_CID_MPEG_BASE + 106 v4l2_mpeg_audio_mode_extension = enum ( V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4, V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8, V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12, V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16, ) = range(4) V4L2_CID_MPEG_AUDIO_EMPHASIS = V4L2_CID_MPEG_BASE + 107 v4l2_mpeg_audio_emphasis = enum ( V4L2_MPEG_AUDIO_EMPHASIS_NONE, V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS, V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17, ) = range(3) V4L2_CID_MPEG_AUDIO_CRC = V4L2_CID_MPEG_BASE + 108 v4l2_mpeg_audio_crc = enum ( V4L2_MPEG_AUDIO_CRC_NONE, V4L2_MPEG_AUDIO_CRC_CRC16, ) = range(2) V4L2_CID_MPEG_AUDIO_MUTE = V4L2_CID_MPEG_BASE + 109 V4L2_CID_MPEG_AUDIO_AAC_BITRATE = V4L2_CID_MPEG_BASE + 110 V4L2_CID_MPEG_AUDIO_AC3_BITRATE = V4L2_CID_MPEG_BASE + 111 v4l2_mpeg_audio_ac3_bitrate = enum ( V4L2_MPEG_AUDIO_AC3_BITRATE_32K, V4L2_MPEG_AUDIO_AC3_BITRATE_40K, V4L2_MPEG_AUDIO_AC3_BITRATE_48K, V4L2_MPEG_AUDIO_AC3_BITRATE_56K, V4L2_MPEG_AUDIO_AC3_BITRATE_64K, V4L2_MPEG_AUDIO_AC3_BITRATE_80K, V4L2_MPEG_AUDIO_AC3_BITRATE_96K, V4L2_MPEG_AUDIO_AC3_BITRATE_112K, V4L2_MPEG_AUDIO_AC3_BITRATE_128K, V4L2_MPEG_AUDIO_AC3_BITRATE_160K, V4L2_MPEG_AUDIO_AC3_BITRATE_192K, V4L2_MPEG_AUDIO_AC3_BITRATE_224K, V4L2_MPEG_AUDIO_AC3_BITRATE_256K, V4L2_MPEG_AUDIO_AC3_BITRATE_320K, V4L2_MPEG_AUDIO_AC3_BITRATE_384K, V4L2_MPEG_AUDIO_AC3_BITRATE_448K, V4L2_MPEG_AUDIO_AC3_BITRATE_512K, V4L2_MPEG_AUDIO_AC3_BITRATE_576K, V4L2_MPEG_AUDIO_AC3_BITRATE_640K, ) = range(19) V4L2_CID_MPEG_VIDEO_ENCODING = V4L2_CID_MPEG_BASE + 200 v4l2_mpeg_video_encoding = enum ( V4L2_MPEG_VIDEO_ENCODING_MPEG_1, V4L2_MPEG_VIDEO_ENCODING_MPEG_2, V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC, ) = range(3) V4L2_CID_MPEG_VIDEO_ASPECT = V4L2_CID_MPEG_BASE + 201 v4l2_mpeg_video_aspect = enum ( V4L2_MPEG_VIDEO_ASPECT_1x1, V4L2_MPEG_VIDEO_ASPECT_4x3, V4L2_MPEG_VIDEO_ASPECT_16x9, V4L2_MPEG_VIDEO_ASPECT_221x100, ) = range(4) V4L2_CID_MPEG_VIDEO_B_FRAMES = V4L2_CID_MPEG_BASE + 202 V4L2_CID_MPEG_VIDEO_GOP_SIZE = V4L2_CID_MPEG_BASE + 203 V4L2_CID_MPEG_VIDEO_GOP_CLOSURE = V4L2_CID_MPEG_BASE + 204 V4L2_CID_MPEG_VIDEO_PULLDOWN = V4L2_CID_MPEG_BASE + 205 V4L2_CID_MPEG_VIDEO_BITRATE_MODE = V4L2_CID_MPEG_BASE + 206 v4l2_mpeg_video_bitrate_mode = enum ( V4L2_MPEG_VIDEO_BITRATE_MODE_VBR, V4L2_MPEG_VIDEO_BITRATE_MODE_CBR, ) = range(2) V4L2_CID_MPEG_VIDEO_BITRATE = V4L2_CID_MPEG_BASE + 207 V4L2_CID_MPEG_VIDEO_BITRATE_PEAK = V4L2_CID_MPEG_BASE + 208 V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION = V4L2_CID_MPEG_BASE + 209 V4L2_CID_MPEG_VIDEO_MUTE = V4L2_CID_MPEG_BASE + 210 V4L2_CID_MPEG_VIDEO_MUTE_YUV = V4L2_CID_MPEG_BASE + 211 V4L2_CID_MPEG_VIDEO_VBV_SIZE = V4L2_CID_MPEG_BASE + 222 V4L2_CID_MPEG_VIDEO_DEC_PTS = V4L2_CID_MPEG_BASE + 223 V4L2_CID_MPEG_VIDEO_DEC_FRAME = V4L2_CID_MPEG_BASE + 224 V4L2_CID_MPEG_VIDEO_VBV_DELAY = V4L2_CID_MPEG_BASE + 225 V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER = V4L2_CID_MPEG_BASE + 226 V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE = V4L2_CID_MPEG_BASE + 227 V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE = V4L2_CID_MPEG_BASE + 228 V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME = V4L2_CID_MPEG_BASE + 229 V4L2_CID_MPEG_VIDEO_H264_MIN_QP = V4L2_CID_MPEG_BASE + 353 V4L2_CID_MPEG_VIDEO_H264_MAX_QP = V4L2_CID_MPEG_BASE + 354 V4L2_CID_MPEG_VIDEO_H264_I_PERIOD = V4L2_CID_MPEG_BASE + 358 V4L2_CID_MPEG_VIDEO_H264_LEVEL = V4L2_CID_MPEG_BASE + 359 v4l2_mpeg_video_h264_level = enum ( V4L2_MPEG_VIDEO_H264_LEVEL_1_0, V4L2_MPEG_VIDEO_H264_LEVEL_1B, V4L2_MPEG_VIDEO_H264_LEVEL_1_1, V4L2_MPEG_VIDEO_H264_LEVEL_1_2, V4L2_MPEG_VIDEO_H264_LEVEL_1_3, V4L2_MPEG_VIDEO_H264_LEVEL_2_0, V4L2_MPEG_VIDEO_H264_LEVEL_2_1, V4L2_MPEG_VIDEO_H264_LEVEL_2_2, V4L2_MPEG_VIDEO_H264_LEVEL_3_0, V4L2_MPEG_VIDEO_H264_LEVEL_3_1, V4L2_MPEG_VIDEO_H264_LEVEL_3_2, V4L2_MPEG_VIDEO_H264_LEVEL_4_0, V4L2_MPEG_VIDEO_H264_LEVEL_4_1, V4L2_MPEG_VIDEO_H264_LEVEL_4_2, V4L2_MPEG_VIDEO_H264_LEVEL_5_0, V4L2_MPEG_VIDEO_H264_LEVEL_5_1 ) = range(16) V4L2_CID_MPEG_VIDEO_H264_PROFILE = V4L2_CID_MPEG_BASE + 363 v4l2_mpeg_video_h264_profile = enum ( V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE, V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE, V4L2_MPEG_VIDEO_H264_PROFILE_MAIN, V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH ) = range(5) V4L2_CID_MPEG_CX2341X_BASE = V4L2_CTRL_CLASS_MPEG | 0x1000 V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE = V4L2_CID_MPEG_CX2341X_BASE + 0 v4l2_mpeg_cx2341x_video_spatial_filter_mode = enum ( V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL, V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO, ) = range(2) V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER = V4L2_CID_MPEG_CX2341X_BASE + 1 V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE = V4L2_CID_MPEG_CX2341X_BASE + 2 v4l2_mpeg_cx2341x_video_luma_spatial_filter_type = enum ( V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE, ) = range(5) V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE = V4L2_CID_MPEG_CX2341X_BASE + 3 v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type = enum ( V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF, V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR, ) = range(2) V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE = V4L2_CID_MPEG_CX2341X_BASE + 4 v4l2_mpeg_cx2341x_video_temporal_filter_mode = enum ( V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL, V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO, ) = range(2) V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER = V4L2_CID_MPEG_CX2341X_BASE + 5 V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE = V4L2_CID_MPEG_CX2341X_BASE + 6 v4l2_mpeg_cx2341x_video_median_filter_type = enum ( V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG, ) = range(5) V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM = V4L2_CID_MPEG_CX2341X_BASE + 7 V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP = V4L2_CID_MPEG_CX2341X_BASE + 8 V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM = V4L2_CID_MPEG_CX2341X_BASE + 9 V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP = V4L2_CID_MPEG_CX2341X_BASE + 10 V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS = V4L2_CID_MPEG_CX2341X_BASE + 11 V4L2_CID_CAMERA_CLASS_BASE = V4L2_CTRL_CLASS_CAMERA | 0x900 V4L2_CID_CAMERA_CLASS = V4L2_CTRL_CLASS_CAMERA | 1 V4L2_CID_EXPOSURE_AUTO = V4L2_CID_CAMERA_CLASS_BASE + 1 v4l2_exposure_auto_type = enum ( V4L2_EXPOSURE_AUTO, V4L2_EXPOSURE_MANUAL, V4L2_EXPOSURE_SHUTTER_PRIORITY, V4L2_EXPOSURE_APERTURE_PRIORITY, ) = range(4) V4L2_CID_EXPOSURE_ABSOLUTE = V4L2_CID_CAMERA_CLASS_BASE + 2 V4L2_CID_EXPOSURE_AUTO_PRIORITY = V4L2_CID_CAMERA_CLASS_BASE + 3 V4L2_CID_PAN_RELATIVE = V4L2_CID_CAMERA_CLASS_BASE + 4 V4L2_CID_TILT_RELATIVE = V4L2_CID_CAMERA_CLASS_BASE + 5 V4L2_CID_PAN_RESET = V4L2_CID_CAMERA_CLASS_BASE + 6 V4L2_CID_TILT_RESET = V4L2_CID_CAMERA_CLASS_BASE + 7 V4L2_CID_PAN_ABSOLUTE = V4L2_CID_CAMERA_CLASS_BASE + 8 V4L2_CID_TILT_ABSOLUTE = V4L2_CID_CAMERA_CLASS_BASE + 9 V4L2_CID_FOCUS_ABSOLUTE = V4L2_CID_CAMERA_CLASS_BASE + 10 V4L2_CID_FOCUS_RELATIVE = V4L2_CID_CAMERA_CLASS_BASE + 11 V4L2_CID_FOCUS_AUTO = V4L2_CID_CAMERA_CLASS_BASE + 12 V4L2_CID_ZOOM_ABSOLUTE = V4L2_CID_CAMERA_CLASS_BASE + 13 V4L2_CID_ZOOM_RELATIVE = V4L2_CID_CAMERA_CLASS_BASE + 14 V4L2_CID_ZOOM_CONTINUOUS = V4L2_CID_CAMERA_CLASS_BASE + 15 V4L2_CID_PRIVACY = V4L2_CID_CAMERA_CLASS_BASE + 16 V4L2_CID_FM_TX_CLASS_BASE = V4L2_CTRL_CLASS_FM_TX | 0x900 V4L2_CID_FM_TX_CLASS = V4L2_CTRL_CLASS_FM_TX | 1 V4L2_CID_RDS_TX_DEVIATION = V4L2_CID_FM_TX_CLASS_BASE + 1 V4L2_CID_RDS_TX_PI = V4L2_CID_FM_TX_CLASS_BASE + 2 V4L2_CID_RDS_TX_PTY = V4L2_CID_FM_TX_CLASS_BASE + 3 V4L2_CID_RDS_TX_PS_NAME = V4L2_CID_FM_TX_CLASS_BASE + 5 V4L2_CID_RDS_TX_RADIO_TEXT = V4L2_CID_FM_TX_CLASS_BASE + 6 V4L2_CID_AUDIO_LIMITER_ENABLED = V4L2_CID_FM_TX_CLASS_BASE + 64 V4L2_CID_AUDIO_LIMITER_RELEASE_TIME = V4L2_CID_FM_TX_CLASS_BASE + 65 V4L2_CID_AUDIO_LIMITER_DEVIATION = V4L2_CID_FM_TX_CLASS_BASE + 66 V4L2_CID_AUDIO_COMPRESSION_ENABLED = V4L2_CID_FM_TX_CLASS_BASE + 80 V4L2_CID_AUDIO_COMPRESSION_GAIN = V4L2_CID_FM_TX_CLASS_BASE + 81 V4L2_CID_AUDIO_COMPRESSION_THRESHOLD = V4L2_CID_FM_TX_CLASS_BASE + 82 V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME = V4L2_CID_FM_TX_CLASS_BASE + 83 V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME = V4L2_CID_FM_TX_CLASS_BASE + 84 V4L2_CID_PILOT_TONE_ENABLED = V4L2_CID_FM_TX_CLASS_BASE + 96 V4L2_CID_PILOT_TONE_DEVIATION = V4L2_CID_FM_TX_CLASS_BASE + 97 V4L2_CID_PILOT_TONE_FREQUENCY = V4L2_CID_FM_TX_CLASS_BASE + 98 V4L2_CID_TUNE_PREEMPHASIS = V4L2_CID_FM_TX_CLASS_BASE + 112 v4l2_preemphasis = enum ( V4L2_PREEMPHASIS_DISABLED, V4L2_PREEMPHASIS_50_uS, V4L2_PREEMPHASIS_75_uS, ) = range(3) V4L2_CID_TUNE_POWER_LEVEL = V4L2_CID_FM_TX_CLASS_BASE + 113 V4L2_CID_TUNE_ANTENNA_CAPACITOR = V4L2_CID_FM_TX_CLASS_BASE + 114 # # Tuning # class v4l2_tuner(ctypes.Structure): _fields_ = [ ('index', ctypes.c_uint32), ('name', ctypes.c_char * 32), ('type', v4l2_tuner_type), ('capability', ctypes.c_uint32), ('rangelow', ctypes.c_uint32), ('rangehigh', ctypes.c_uint32), ('rxsubchans', ctypes.c_uint32), ('audmode', ctypes.c_uint32), ('signal', ctypes.c_int32), ('afc', ctypes.c_int32), ('reserved', ctypes.c_uint32 * 4), ] class v4l2_modulator(ctypes.Structure): _fields_ = [ ('index', ctypes.c_uint32), ('name', ctypes.c_char * 32), ('capability', ctypes.c_uint32), ('rangelow', ctypes.c_uint32), ('rangehigh', ctypes.c_uint32), ('txsubchans', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 4), ] V4L2_TUNER_CAP_LOW = 0x0001 V4L2_TUNER_CAP_NORM = 0x0002 V4L2_TUNER_CAP_STEREO = 0x0010 V4L2_TUNER_CAP_LANG2 = 0x0020 V4L2_TUNER_CAP_SAP = 0x0020 V4L2_TUNER_CAP_LANG1 = 0x0040 V4L2_TUNER_CAP_RDS = 0x0080 V4L2_TUNER_SUB_MONO = 0x0001 V4L2_TUNER_SUB_STEREO = 0x0002 V4L2_TUNER_SUB_LANG2 = 0x0004 V4L2_TUNER_SUB_SAP = 0x0004 V4L2_TUNER_SUB_LANG1 = 0x0008 V4L2_TUNER_SUB_RDS = 0x0010 V4L2_TUNER_MODE_MONO = 0x0000 V4L2_TUNER_MODE_STEREO = 0x0001 V4L2_TUNER_MODE_LANG2 = 0x0002 V4L2_TUNER_MODE_SAP = 0x0002 V4L2_TUNER_MODE_LANG1 = 0x0003 V4L2_TUNER_MODE_LANG1_LANG2 = 0x0004 class v4l2_frequency(ctypes.Structure): _fields_ = [ ('tuner', ctypes.c_uint32), ('type', v4l2_tuner_type), ('frequency', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 8), ] class v4l2_hw_freq_seek(ctypes.Structure): _fields_ = [ ('tuner', ctypes.c_uint32), ('type', v4l2_tuner_type), ('seek_upward', ctypes.c_uint32), ('wrap_around', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 8), ] # # RDS # class v4l2_rds_data(ctypes.Structure): _fields_ = [ ('lsb', ctypes.c_char), ('msb', ctypes.c_char), ('block', ctypes.c_char), ] _pack_ = True V4L2_RDS_BLOCK_MSK = 0x7 V4L2_RDS_BLOCK_A = 0 V4L2_RDS_BLOCK_B = 1 V4L2_RDS_BLOCK_C = 2 V4L2_RDS_BLOCK_D = 3 V4L2_RDS_BLOCK_C_ALT = 4 V4L2_RDS_BLOCK_INVALID = 7 V4L2_RDS_BLOCK_CORRECTED = 0x40 V4L2_RDS_BLOCK_ERROR = 0x80 # # Audio # class v4l2_audio(ctypes.Structure): _fields_ = [ ('index', ctypes.c_uint32), ('name', ctypes.c_char * 32), ('capability', ctypes.c_uint32), ('mode', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 2), ] V4L2_AUDCAP_STEREO = 0x00001 V4L2_AUDCAP_AVL = 0x00002 V4L2_AUDMODE_AVL = 0x00001 class v4l2_audioout(ctypes.Structure): _fields_ = [ ('index', ctypes.c_uint32), ('name', ctypes.c_char * 32), ('capability', ctypes.c_uint32), ('mode', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 2), ] # # Mpeg services (experimental) # V4L2_ENC_IDX_FRAME_I = 0 V4L2_ENC_IDX_FRAME_P = 1 V4L2_ENC_IDX_FRAME_B = 2 V4L2_ENC_IDX_FRAME_MASK = 0xf class v4l2_enc_idx_entry(ctypes.Structure): _fields_ = [ ('offset', ctypes.c_uint64), ('pts', ctypes.c_uint64), ('length', ctypes.c_uint32), ('flags', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 2), ] V4L2_ENC_IDX_ENTRIES = 64 class v4l2_enc_idx(ctypes.Structure): _fields_ = [ ('entries', ctypes.c_uint32), ('entries_cap', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 4), ('entry', v4l2_enc_idx_entry * V4L2_ENC_IDX_ENTRIES), ] V4L2_ENC_CMD_START = 0 V4L2_ENC_CMD_STOP = 1 V4L2_ENC_CMD_PAUSE = 2 V4L2_ENC_CMD_RESUME = 3 V4L2_ENC_CMD_STOP_AT_GOP_END = 1 << 0 class v4l2_encoder_cmd(ctypes.Structure): class _u(ctypes.Union): class _s(ctypes.Structure): _fields_ = [ ('data', ctypes.c_uint32 * 8), ] _fields_ = [ ('raw', _s), ] _fields_ = [ ('cmd', ctypes.c_uint32), ('flags', ctypes.c_uint32), ('_u', _u), ] _anonymous_ = ('_u',) # # Data services (VBI) # class v4l2_vbi_format(ctypes.Structure): _fields_ = [ ('sampling_rate', ctypes.c_uint32), ('offset', ctypes.c_uint32), ('samples_per_line', ctypes.c_uint32), ('sample_format', ctypes.c_uint32), ('start', ctypes.c_int32 * 2), ('count', ctypes.c_uint32 * 2), ('flags', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 2), ] V4L2_VBI_UNSYNC = 1 << 0 V4L2_VBI_INTERLACED = 1 << 1 class v4l2_sliced_vbi_format(ctypes.Structure): _fields_ = [ ('service_set', ctypes.c_uint16), ('service_lines', ctypes.c_uint16 * 2 * 24), ('io_size', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 2), ] V4L2_SLICED_TELETEXT_B = 0x0001 V4L2_SLICED_VPS = 0x0400 V4L2_SLICED_CAPTION_525 = 0x1000 V4L2_SLICED_WSS_625 = 0x4000 V4L2_SLICED_VBI_525 = V4L2_SLICED_CAPTION_525 V4L2_SLICED_VBI_625 = ( V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625) class v4l2_sliced_vbi_cap(ctypes.Structure): _fields_ = [ ('service_set', ctypes.c_uint16), ('service_lines', ctypes.c_uint16 * 2 * 24), ('type', v4l2_buf_type), ('reserved', ctypes.c_uint32 * 3), ] class v4l2_sliced_vbi_data(ctypes.Structure): _fields_ = [ ('id', ctypes.c_uint32), ('field', ctypes.c_uint32), ('line', ctypes.c_uint32), ('reserved', ctypes.c_uint32), ('data', ctypes.c_char * 48), ] # # Sliced VBI data inserted into MPEG Streams # V4L2_MPEG_VBI_IVTV_TELETEXT_B = 1 V4L2_MPEG_VBI_IVTV_CAPTION_525 = 4 V4L2_MPEG_VBI_IVTV_WSS_625 = 5 V4L2_MPEG_VBI_IVTV_VPS = 7 class v4l2_mpeg_vbi_itv0_line(ctypes.Structure): _fields_ = [ ('id', ctypes.c_char), ('data', ctypes.c_char * 42), ] _pack_ = True class v4l2_mpeg_vbi_itv0(ctypes.Structure): _fields_ = [ ('linemask', ctypes.c_uint32 * 2), # how to define __le32 in ctypes? ('line', v4l2_mpeg_vbi_itv0_line * 35), ] _pack_ = True class v4l2_mpeg_vbi_ITV0(ctypes.Structure): _fields_ = [ ('line', v4l2_mpeg_vbi_itv0_line * 36), ] _pack_ = True V4L2_MPEG_VBI_IVTV_MAGIC0 = "itv0" V4L2_MPEG_VBI_IVTV_MAGIC1 = "ITV0" class v4l2_mpeg_vbi_fmt_ivtv(ctypes.Structure): class _u(ctypes.Union): _fields_ = [ ('itv0', v4l2_mpeg_vbi_itv0), ('ITV0', v4l2_mpeg_vbi_ITV0), ] _fields_ = [ ('magic', ctypes.c_char * 4), ('_u', _u) ] _anonymous_ = ('_u',) _pack_ = True # # Aggregate structures # class v4l2_plane_pix_format(ctypes.Structure): _fields_ = [ ('sizeimage', ctypes.c_uint32), ('bytesperline', ctypes.c_uint32), ('reserved', ctypes.c_uint16 * 6) ] class v4l2_sdr_format(ctypes.Structure): _fields_ = [ ('pixelformat', ctypes.c_uint32), ('buffersize', ctypes.c_uint32), ('reserved', ctypes.c_uint8 * 24) ] class v4l2_meta_format(ctypes.Structure): _fields_ = [ ('dataformat', ctypes.c_uint32), ('buffersize', ctypes.c_uint32) ] class v4l2_pix_format_mplane(ctypes.Structure): class _u(ctypes.Union): _fields_ = [ ('ycbcr_enc', ctypes.c_uint8), ('hsv_enc', ctypes.c_uint8) ] _fields_ = [ ('width', ctypes.c_uint32), ('height', ctypes.c_uint32), ('pixelformat', ctypes.c_uint32), ('field', ctypes.c_uint32), ('colorspace', ctypes.c_uint32), ('plane_fmt', v4l2_plane_pix_format * VIDEO_MAX_PLANES), ('num_planes', ctypes.c_uint8), ('flags', ctypes.c_uint8), ('_u', _u), ('quantization', ctypes.c_uint8), ('xfer_func', ctypes.c_uint8), ('reserved', ctypes.c_uint8 * 7) ] class v4l2_format(ctypes.Structure): class _u(ctypes.Union): _fields_ = [ ('pix', v4l2_pix_format), ('pix_mp', v4l2_pix_format_mplane), ('win', v4l2_window), ('vbi', v4l2_vbi_format), ('sliced', v4l2_sliced_vbi_format), ('sdr', v4l2_sdr_format), ('meta', v4l2_meta_format), ('raw_data', ctypes.c_char * 200) ] _fields_ = [ ('type', v4l2_buf_type), ('fmt', _u) ] class v4l2_streamparm(ctypes.Structure): class _u(ctypes.Union): _fields_ = [ ('capture', v4l2_captureparm), ('output', v4l2_outputparm), ('raw_data', ctypes.c_char * 200), ] _fields_ = [ ('type', v4l2_buf_type), ('parm', _u) ] # # Advanced debugging # V4L2_CHIP_MATCH_HOST = 0 V4L2_CHIP_MATCH_I2C_DRIVER = 1 V4L2_CHIP_MATCH_I2C_ADDR = 2 V4L2_CHIP_MATCH_AC97 = 3 class v4l2_dbg_match(ctypes.Structure): class _u(ctypes.Union): _fields_ = [ ('addr', ctypes.c_uint32), ('name', ctypes.c_char * 32), ] _fields_ = [ ('type', ctypes.c_uint32), ('_u', _u), ] _anonymous_ = ('_u',) _pack_ = True class v4l2_dbg_register(ctypes.Structure): _fields_ = [ ('match', v4l2_dbg_match), ('size', ctypes.c_uint32), ('reg', ctypes.c_uint64), ('val', ctypes.c_uint64), ] _pack_ = True class v4l2_dbg_chip_ident(ctypes.Structure): _fields_ = [ ('match', v4l2_dbg_match), ('ident', ctypes.c_uint32), ('revision', ctypes.c_uint32), ] _pack_ = True # # ioctl codes for video devices # VIDIOC_QUERYCAP = _IOR('V', 0, v4l2_capability) VIDIOC_RESERVED = _IO('V', 1) VIDIOC_ENUM_FMT = _IOWR('V', 2, v4l2_fmtdesc) VIDIOC_G_FMT = _IOWR('V', 4, v4l2_format) VIDIOC_S_FMT = _IOWR('V', 5, v4l2_format) VIDIOC_REQBUFS = _IOWR('V', 8, v4l2_requestbuffers) VIDIOC_QUERYBUF = _IOWR('V', 9, v4l2_buffer) VIDIOC_G_FBUF = _IOR('V', 10, v4l2_framebuffer) VIDIOC_S_FBUF = _IOW('V', 11, v4l2_framebuffer) VIDIOC_OVERLAY = _IOW('V', 14, ctypes.c_int) VIDIOC_QBUF = _IOWR('V', 15, v4l2_buffer) VIDIOC_DQBUF = _IOWR('V', 17, v4l2_buffer) VIDIOC_STREAMON = _IOW('V', 18, ctypes.c_int) VIDIOC_STREAMOFF = _IOW('V', 19, ctypes.c_int) VIDIOC_G_PARM = _IOWR('V', 21, v4l2_streamparm) VIDIOC_S_PARM = _IOWR('V', 22, v4l2_streamparm) VIDIOC_G_STD = _IOR('V', 23, v4l2_std_id) VIDIOC_S_STD = _IOW('V', 24, v4l2_std_id) VIDIOC_ENUMSTD = _IOWR('V', 25, v4l2_standard) VIDIOC_ENUMINPUT = _IOWR('V', 26, v4l2_input) VIDIOC_G_CTRL = _IOWR('V', 27, v4l2_control) VIDIOC_S_CTRL = _IOWR('V', 28, v4l2_control) VIDIOC_G_TUNER = _IOWR('V', 29, v4l2_tuner) VIDIOC_S_TUNER = _IOW('V', 30, v4l2_tuner) VIDIOC_G_AUDIO = _IOR('V', 33, v4l2_audio) VIDIOC_S_AUDIO = _IOW('V', 34, v4l2_audio) VIDIOC_QUERYCTRL = _IOWR('V', 36, v4l2_queryctrl) VIDIOC_QUERYMENU = _IOWR('V', 37, v4l2_querymenu) VIDIOC_G_INPUT = _IOR('V', 38, ctypes.c_int) VIDIOC_S_INPUT = _IOWR('V', 39, ctypes.c_int) VIDIOC_G_OUTPUT = _IOR('V', 46, ctypes.c_int) VIDIOC_S_OUTPUT = _IOWR('V', 47, ctypes.c_int) VIDIOC_ENUMOUTPUT = _IOWR('V', 48, v4l2_output) VIDIOC_G_AUDOUT = _IOR('V', 49, v4l2_audioout) VIDIOC_S_AUDOUT = _IOW('V', 50, v4l2_audioout) VIDIOC_G_MODULATOR = _IOWR('V', 54, v4l2_modulator) VIDIOC_S_MODULATOR = _IOW('V', 55, v4l2_modulator) VIDIOC_G_FREQUENCY = _IOWR('V', 56, v4l2_frequency) VIDIOC_S_FREQUENCY = _IOW('V', 57, v4l2_frequency) VIDIOC_CROPCAP = _IOWR('V', 58, v4l2_cropcap) VIDIOC_G_CROP = _IOWR('V', 59, v4l2_crop) VIDIOC_S_CROP = _IOW('V', 60, v4l2_crop) VIDIOC_G_JPEGCOMP = _IOR('V', 61, v4l2_jpegcompression) VIDIOC_S_JPEGCOMP = _IOW('V', 62, v4l2_jpegcompression) VIDIOC_QUERYSTD = _IOR('V', 63, v4l2_std_id) VIDIOC_TRY_FMT = _IOWR('V', 64, v4l2_format) VIDIOC_ENUMAUDIO = _IOWR('V', 65, v4l2_audio) VIDIOC_ENUMAUDOUT = _IOWR('V', 66, v4l2_audioout) VIDIOC_G_PRIORITY = _IOR('V', 67, v4l2_priority) VIDIOC_S_PRIORITY = _IOW('V', 68, v4l2_priority) VIDIOC_G_SLICED_VBI_CAP = _IOWR('V', 69, v4l2_sliced_vbi_cap) VIDIOC_LOG_STATUS = _IO('V', 70) VIDIOC_G_EXT_CTRLS = _IOWR('V', 71, v4l2_ext_controls) VIDIOC_S_EXT_CTRLS = _IOWR('V', 72, v4l2_ext_controls) VIDIOC_TRY_EXT_CTRLS = _IOWR('V', 73, v4l2_ext_controls) VIDIOC_ENUM_FRAMESIZES = _IOWR('V', 74, v4l2_frmsizeenum) VIDIOC_ENUM_FRAMEINTERVALS = _IOWR('V', 75, v4l2_frmivalenum) VIDIOC_G_ENC_INDEX = _IOR('V', 76, v4l2_enc_idx) VIDIOC_ENCODER_CMD = _IOWR('V', 77, v4l2_encoder_cmd) VIDIOC_TRY_ENCODER_CMD = _IOWR('V', 78, v4l2_encoder_cmd) VIDIOC_DBG_S_REGISTER = _IOW('V', 79, v4l2_dbg_register) VIDIOC_DBG_G_REGISTER = _IOWR('V', 80, v4l2_dbg_register) VIDIOC_DBG_G_CHIP_IDENT = _IOWR('V', 81, v4l2_dbg_chip_ident) VIDIOC_S_HW_FREQ_SEEK = _IOW('V', 82, v4l2_hw_freq_seek) VIDIOC_ENUM_DV_PRESETS = _IOWR('V', 83, v4l2_dv_enum_preset) VIDIOC_S_DV_PRESET = _IOWR('V', 84, v4l2_dv_preset) VIDIOC_G_DV_PRESET = _IOWR('V', 85, v4l2_dv_preset) VIDIOC_QUERY_DV_PRESET = _IOR('V', 86, v4l2_dv_preset) VIDIOC_S_DV_TIMINGS = _IOWR('V', 87, v4l2_dv_timings) VIDIOC_G_DV_TIMINGS = _IOWR('V', 88, v4l2_dv_timings) VIDIOC_OVERLAY_OLD = _IOWR('V', 14, ctypes.c_int) VIDIOC_S_PARM_OLD = _IOW('V', 22, v4l2_streamparm) VIDIOC_S_CTRL_OLD = _IOW('V', 28, v4l2_control) VIDIOC_G_AUDIO_OLD = _IOWR('V', 33, v4l2_audio) VIDIOC_G_AUDOUT_OLD = _IOWR('V', 49, v4l2_audioout) VIDIOC_CROPCAP_OLD = _IOR('V', 58, v4l2_cropcap) VIDIOC_QUERY_EXT_CTRL = _IOWR('V', 103, v4l2_query_ext_ctrl) BASE_VIDIOC_PRIVATE = 192 v4l2_colorspace_dict = {0:'DEFAULT', 1:'SMPTE170M', 2:'SMPTE240M', 3:'REC709', 4:'BT878', 5:'470_SYSTEM_M', 6:'470_SYSTEM_BG', 7:'JPEG', 8:'SRGB', 9:'ADOBERGB', 10:'BT2020', 11:'RAW', 12:'DCI_P3'} v4l2_field_dict = {0:'ANY', 1:'NONE', 2:'TOP', 3:'BOTTOM', 4:'INTERLACED', 5:'SEQ_TB', 6:'SEQ_BT', 7:'ALTERNATE', 8:'INTERLACED_TB', 9:'INTERLACED_BT'} v4l2_CID_dict = {V4L2_CID_BRIGHTNESS:'V4L2_CID_BRIGHTNESS', V4L2_CID_CONTRAST:'V4L2_CID_CONTRAST', V4L2_CID_SATURATION:'V4L2_CID_SATURATION', V4L2_CID_HUE:'V4L2_CID_HUE', V4L2_CID_AUTO_WHITE_BALANCE:'V4L2_CID_AUTO_WHITE_BALANCE', V4L2_CID_GAMMA:'V4L2_CID_GAMMA', V4L2_CID_GAIN:'V4L2_CID_GAIN', V4L2_CID_POWER_LINE_FREQUENCY:'V4L2_CID_POWER_LINE_FREQUENCY', V4L2_CID_WHITE_BALANCE_TEMPERATURE:'V4L2_CID_WHITE_BALANCE_TEMPERATURE', V4L2_CID_SHARPNESS:'V4L2_CID_SHARPNESS', V4L2_CID_BACKLIGHT_COMPENSATION:'V4L2_CID_BACKLIGHT_COMPENSATION', V4L2_CID_EXPOSURE_AUTO:'V4L2_CID_EXPOSURE_AUTO', V4L2_CID_EXPOSURE_ABSOLUTE:'V4L2_CID_EXPOSURE_ABSOLUTE', V4L2_CID_EXPOSURE_AUTO_PRIORITY:'V4L2_CID_EXPOSURE_AUTO_PRIORITY'} v4l2_CTRL_FLAG_dict = {NONE:'NONE', V4L2_CTRL_FLAG_DISABLED:'V4L2_CTRL_FLAG_DISABLED', V4L2_CTRL_FLAG_GRABBED:'V4L2_CTRL_FLAG_GRABBED', V4L2_CTRL_FLAG_READ_ONLY:'V4L2_CTRL_FLAG_READ_ONLY', V4L2_CTRL_FLAG_UPDATE:'V4L2_CTRL_FLAG_UPDATE', V4L2_CTRL_FLAG_INACTIVE:'V4L2_CTRL_FLAG_INACTIVE', V4L2_CTRL_FLAG_SLIDER:'V4L2_CTRL_FLAG_SLIDER', V4L2_CTRL_FLAG_WRITE_ONLY:'V4L2_CTRL_FLAG_WRITE_ONLY', V4L2_CTRL_FLAG_VOLATILE:'V4L2_CTRL_FLAG_VOLATILE', V4L2_CTRL_FLAG_HAS_PAYLOAD:'V4L2_CTRL_FLAG_HAS_PAYLOAD', V4L2_CTRL_FLAG_EXECUTE_ON_WRITE:'V4L2_CTRL_FLAG_EXECUTE_ON_WRITE', V4L2_CTRL_FLAG_MODIFY_LAYOUT:'V4L2_CTRL_FLAG_MODIFY_LAYOUT', V4L2_CTRL_FLAG_NEXT_CTRL:'V4L2_CTRL_FLAG_NEXT_CTRL', V4L2_CTRL_FLAG_NEXT_COMPOUND:'V4L2_CTRL_FLAG_NEXT_COMPOUND'} v4l2_ctrl_type_dict = {V4L2_CTRL_TYPE_INTEGER:'V4L2_CTRL_TYPE_INTEGER', V4L2_CTRL_TYPE_BOOLEAN:'V4L2_CTRL_TYPE_BOOLEAN', V4L2_CTRL_TYPE_MENU:'V4L2_CTRL_TYPE_MENU', V4L2_CTRL_TYPE_BUTTON:'V4L2_CTRL_TYPE_BUTTON', V4L2_CTRL_TYPE_INTEGER64:'V4L2_CTRL_TYPE_INTEGER64', V4L2_CTRL_TYPE_CTRL_CLASS:'V4L2_CTRL_TYPE_CTRL_CLASS', V4L2_CTRL_TYPE_STRING:'V4L2_CTRL_TYPE_STRING', V4L2_CTRL_TYPE_BITMASK:'V4L2_CTRL_TYPE_BITMASK', V4L2_CTRL_TYPE_INTEGER_MENU:'V4L2_CTRL_TYPE_INTEGER_MENU', V4L2_CTRL_COMPOUND_TYPES:'V4L2_CTRL_COMPOUND_TYPES', V4L2_CTRL_TYPE_U8:'V4L2_CTRL_TYPE_U8', V4L2_CTRL_TYPE_U16:'V4L2_CTRL_TYPE_U16', V4L2_CTRL_TYPE_U32:'V4L2_CTRL_TYPE_U32'} v4l2_capabilities_dict = {V4L2_CAP_VIDEO_CAPTURE:'V4L2_CAP_VIDEO_CAPTURE', V4L2_CAP_VIDEO_OUTPUT:'V4L2_CAP_VIDEO_OUTPUT', V4L2_CAP_VIDEO_OVERLAY:'V4L2_CAP_VIDEO_OVERLAY', V4L2_CAP_VBI_CAPTURE:'V4L2_CAP_VBI_CAPTURE', V4L2_CAP_VBI_OUTPUT:'V4L2_CAP_VBI_OUTPUT', V4L2_CAP_SLICED_VBI_CAPTURE:'V4L2_CAP_SLICED_VBI_CAPTURE', V4L2_CAP_SLICED_VBI_OUTPUT:'V4L2_CAP_SLICED_VBI_OUTPUT', V4L2_CAP_RDS_CAPTURE:'V4L2_CAP_RDS_CAPTURE', V4L2_CAP_VIDEO_OUTPUT_OVERLAY:'V4L2_CAP_VIDEO_OUTPUT_OVERLAY', V4L2_CAP_HW_FREQ_SEEK:'V4L2_CAP_HW_FREQ_SEEK', V4L2_CAP_RDS_OUTPUT:'V4L2_CAP_RDS_OUTPUT', V4L2_CAP_VIDEO_CAPTURE_MPLANE:'V4L2_CAP_VIDEO_CAPTURE_MPLANE', V4L2_CAP_VIDEO_OUTPUT_MPLANE:'V4L2_CAP_VIDEO_OUTPUT_MPLANE', V4L2_CAP_VIDEO_M2M_MPLANE:'V4L2_CAP_VIDEO_M2M_MPLANE', V4L2_CAP_VIDEO_M2M:'V4L2_CAP_VIDEO_M2M', V4L2_CAP_TUNER:'V4L2_CAP_TUNER', V4L2_CAP_AUDIO:'V4L2_CAP_AUDIO', V4L2_CAP_RADIO:'V4L2_CAP_RADIO', V4L2_CAP_MODULATOR:'V4L2_CAP_MODULATOR', V4L2_CAP_SDR_CAPTURE:'V4L2_CAP_SDR_CAPTURE', V4L2_CAP_EXT_PIX_FORMAT:'V4L2_CAP_EXT_PIX_FORMAT', V4L2_CAP_SDR_OUTPUT:'V4L2_CAP_SDR_OUTPUT', V4L2_CAP_META_CAPTURE:'V4L2_CAP_META_CAPTURE', V4L2_CAP_READWRITE:'V4L2_CAP_READWRITE', V4L2_CAP_ASYNCIO:'V4L2_CAP_ASYNCIO', V4L2_CAP_STREAMING:'V4L2_CAP_STREAMING', V4L2_CAP_TOUCH:'V4L2_CAP_TOUCH', V4L2_CAP_DEVICE_CAPS:'V4L2_CAP_DEVICE_CAPS'} v4l2_BUF_TYPE_dict = {V4L2_BUF_TYPE_VIDEO_CAPTURE:'V4L2_BUF_TYPE_VIDEO_CAPTURE', V4L2_BUF_TYPE_VIDEO_OUTPUT:'V4L2_BUF_TYPE_VIDEO_OUTPUT', V4L2_BUF_TYPE_VIDEO_OVERLAY:'V4L2_BUF_TYPE_VIDEO_OVERLAY', V4L2_BUF_TYPE_VBI_CAPTURE:'V4L2_BUF_TYPE_VBI_CAPTURE', V4L2_BUF_TYPE_VBI_OUTPUT:'V4L2_BUF_TYPE_VBI_OUTPUT', V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:'V4L2_BUF_TYPE_SLICED_VBI_CAPTURE', V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:'V4L2_BUF_TYPE_SLICED_VBI_OUTPUT', V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:'V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY', V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:'V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE', V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:'V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE', V4L2_BUF_TYPE_SDR_CAPTURE:'V4L2_BUF_TYPE_SDR_CAPTURE', V4L2_BUF_TYPE_SDR_OUTPUT:'V4L2_BUF_TYPE_SDR_OUTPUT', V4L2_BUF_TYPE_META_CAPTURE:'V4L2_BUF_TYPE_META_CAPTURE', V4L2_BUF_TYPE_PRIVATE:'V4L2_BUF_TYPE_PRIVATE'} v4l2_MEMORY_dict = {V4L2_MEMORY_MMAP:'V4L2_MEMORY_MMAP', V4L2_MEMORY_USERPTR:'V4L2_MEMORY_USERPTR', V4L2_MEMORY_OVERLAY:'V4L2_MEMORY_OVERLAY', V4L2_MEMORY_DMABUF:'V4L2_MEMORY_DMABUF'} ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1724763002.3499787 v4l2-python3-0.3.5/v4l2_python3.egg-info/0000755000076600000240000000000014663345572016544 5ustar00gregstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1724763002.0 v4l2-python3-0.3.5/v4l2_python3.egg-info/PKG-INFO0000644000076600000240000000140414663345572017640 0ustar00gregstaffMetadata-Version: 2.1 Name: v4l2-python3 Version: 0.3.5 Summary: Python bindings for the v4l2 userspace api. Home-page: https://pypi.org/project/v4l2-python3/ Maintainer: Raspberry Pi Foundation Maintainer-email: web@raspberrypi.org License: GPLv2 Keywords: v4l2 video4linux video4linux2 binding ctypes Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: GNU General Public License (GPL) Classifier: Operating System :: POSIX :: Linux Classifier: Programming Language :: C Classifier: Programming Language :: Python Classifier: Topic :: Multimedia :: Video Classifier: Topic :: Multimedia :: Video :: Capture Requires: ctypes License-File: LICENSE License-File: AUTHORS UNKNOWN ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1724763002.0 v4l2-python3-0.3.5/v4l2_python3.egg-info/SOURCES.txt0000644000076600000240000000032414663345572020427 0ustar00gregstaffAUTHORS LICENSE MANIFEST.in NEWS README.md setup.py tests.py v4l2.py v4l2_python3.egg-info/PKG-INFO v4l2_python3.egg-info/SOURCES.txt v4l2_python3.egg-info/dependency_links.txt v4l2_python3.egg-info/top_level.txt././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1724763002.0 v4l2-python3-0.3.5/v4l2_python3.egg-info/dependency_links.txt0000644000076600000240000000000114663345572022612 0ustar00gregstaff ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1724763002.0 v4l2-python3-0.3.5/v4l2_python3.egg-info/top_level.txt0000644000076600000240000000000514663345572021271 0ustar00gregstaffv4l2