diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..551ef3b --- /dev/null +++ b/.gitignore @@ -0,0 +1,60 @@ +# Built application files +*.apk +*.ap_ + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ + +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# Intellij +*.iml +.idea/workspace.xml +.idea/tasks.xml +.idea/gradle.xml +.idea/misc.xml +.idea/vcs.xml +.idea/dictionaries +.idea/libraries + +# Keystore files +*.jks + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild + +# Google Services (e.g. APIs or Firebase) +google-services.json + +# Freeline +freeline.py +freeline/ +freeline_project_description.json + +# Keys +app/src/main/res/values/keys.xml \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..3bee7ff --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9cecc1d --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. 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 +them 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 prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. 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. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey 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; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If 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 convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU 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 that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + 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. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +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. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + 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 +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 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, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + {project} Copyright (C) {year} {fullname} + This program 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, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU 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. But first, please read +. diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..6dfbd79 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,64 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 25 + buildToolsVersion '26.0.2' + defaultConfig { + applicationId "sq.rogue.rosettadrone" + minSdkVersion 23 + targetSdkVersion 25 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + multiDexEnabled true + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + + sourceSets { + main { + jniLibs.srcDir 'libs' + } + } + + packagingOptions { + doNotStrip "*/*/libdjivideo.so" + doNotStrip "*/*/libSDKRelativeJNI.so" + doNotStrip "*/*/libFlyForbid.so" + doNotStrip "*/*/libduml_vision_bokeh.so" + doNotStrip "*/*/libyuv2.so" + doNotStrip "*/*/libGroudStation.so" + doNotStrip "*/*/libFRCorkscrew.so" + doNotStrip "*/*/libUpgradeVerify.so" + doNotStrip "*/*/libFR.so" + } + externalNativeBuild { + ndkBuild { + path 'src/main/cpp/Android.mk' + } + } + defaultConfig { + ndk { + abiFilters 'x86', 'armeabi-v7a' // more could be added + } + } + +} + +dependencies { + compile fileTree(include: ['*.jar'], dir: 'libs') + androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + exclude group: 'com.android.support', module: 'support-annotations' + }) + compile 'com.android.support:appcompat-v7:25.4.0' + compile 'com.android.support.constraint:constraint-layout:1.0.2' + compile 'com.android.support:design:25.4.0' + testCompile 'junit:junit:4.12' + compile 'com.dji:dji-sdk:4.4.1' + provided 'com.dji:dji-sdk-provided:4.4.1' + compile 'com.android.support:multidex:1.0.2' +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..2cfb2f2 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,25 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/markjacobsen/Library/Android/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/app/src/androidTest/java/sq/rogue/rosettadrone/ExampleInstrumentedTest.java b/app/src/androidTest/java/sq/rogue/rosettadrone/ExampleInstrumentedTest.java new file mode 100644 index 0000000..0025769 --- /dev/null +++ b/app/src/androidTest/java/sq/rogue/rosettadrone/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package sq.rogue.rosettadrone; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumentation test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("io.diux.rogue.rosettadrone", appContext.getPackageName()); + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..fd085f4 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/assets/APMArduCopterMockLink.txt b/app/src/main/assets/APMArduCopterMockLink.txt new file mode 100644 index 0000000..4e63597 --- /dev/null +++ b/app/src/main/assets/APMArduCopterMockLink.txt @@ -0,0 +1,776 @@ +# Onboard parameters for Vehicle 1 +# +# Stack: ArduPilot +# Vehicle: Multi-Rotor +# Version: 3.5.0 rc +# Git Revision: efab409b +# +# Vehicle-Id Component-Id Name Value Type +1 1 ACCEL_Z_D 0.000000000000000000 9 +1 1 ACCEL_Z_FF 0.000000000000000000 9 +1 1 ACCEL_Z_FILT 20.000000000000000000 9 +1 1 ACCEL_Z_I 1.000000000000000000 9 +1 1 ACCEL_Z_IMAX 800.000000000000000000 9 +1 1 ACCEL_Z_P 0.500000000000000000 9 +1 1 ACRO_BAL_PITCH 1.000000000000000000 9 +1 1 ACRO_BAL_ROLL 1.000000000000000000 9 +1 1 ACRO_RP_EXPO 0.300000011920928955 9 +1 1 ACRO_RP_P 4.500000000000000000 9 +1 1 ACRO_THR_MID 0.000000000000000000 9 +1 1 ACRO_TRAINER 2 2 +1 1 ACRO_YAW_P 3.000000000000000000 9 +1 1 ACRO_Y_EXPO 0.000000000000000000 9 +1 1 ADSB_ENABLE 0 2 +1 1 AHRS_COMP_BETA 0.100000001490116119 9 +1 1 AHRS_EKF_TYPE 2 2 +1 1 AHRS_GPS_GAIN 1.000000000000000000 9 +1 1 AHRS_GPS_MINSATS 6 2 +1 1 AHRS_GPS_USE 1 2 +1 1 AHRS_ORIENTATION 0 2 +1 1 AHRS_RP_P 0.200000002980232239 9 +1 1 AHRS_TRIM_X -0.005487891845405102 9 +1 1 AHRS_TRIM_Y 0.009387995116412640 9 +1 1 AHRS_TRIM_Z 0.000000000000000000 9 +1 1 AHRS_WIND_MAX 0 2 +1 1 AHRS_YAW_P 0.200000002980232239 9 +1 1 ANGLE_MAX 3000 4 +1 1 ARMING_ACCTHRESH 0.750000000000000000 9 +1 1 ARMING_CHECK 0 4 +1 1 ATC_ACCEL_P_MAX 110000.000000000000000000 9 +1 1 ATC_ACCEL_R_MAX 110000.000000000000000000 9 +1 1 ATC_ACCEL_Y_MAX 18000.000000000000000000 9 +1 1 ATC_ANGLE_BOOST 1 2 +1 1 ATC_ANG_LIM_TC 1.000000000000000000 9 +1 1 ATC_ANG_PIT_P 11.250000000000000000 9 +1 1 ATC_ANG_RLL_P 11.250000000000000000 9 +1 1 ATC_ANG_YAW_P 6.000000000000000000 9 +1 1 ATC_RATE_FF_ENAB 1 2 +1 1 ATC_RAT_PIT_D 0.008325000293552876 9 +1 1 ATC_RAT_PIT_FF 0.000000000000000000 9 +1 1 ATC_RAT_PIT_FILT 20.000000000000000000 9 +1 1 ATC_RAT_PIT_I 0.126000002026557922 9 +1 1 ATC_RAT_PIT_IMAX 0.222222223877906799 9 +1 1 ATC_RAT_PIT_P 0.126000002026557922 9 +1 1 ATC_RAT_RLL_D 0.011249999515712261 9 +1 1 ATC_RAT_RLL_FF 0.000000000000000000 9 +1 1 ATC_RAT_RLL_FILT 20.000000000000000000 9 +1 1 ATC_RAT_RLL_I 0.182249993085861206 9 +1 1 ATC_RAT_RLL_IMAX 0.222222223877906799 9 +1 1 ATC_RAT_RLL_P 0.182249993085861206 9 +1 1 ATC_RAT_YAW_D 0.003600000170990825 9 +1 1 ATC_RAT_YAW_FF 0.000000000000000000 9 +1 1 ATC_RAT_YAW_FILT 5.000000000000000000 9 +1 1 ATC_RAT_YAW_I 0.035999998450279236 9 +1 1 ATC_RAT_YAW_IMAX 0.222000002861022949 9 +1 1 ATC_RAT_YAW_P 0.359999984502792358 9 +1 1 ATC_SLEW_YAW 1000.000000000000000000 9 +1 1 ATC_THR_MIX_MAN 0.500000000000000000 9 +1 1 ATC_THR_MIX_MAX 0.500000000000000000 9 +1 1 ATC_THR_MIX_MIN 0.100000001490116119 9 +1 1 AUTOTUNE_AGGR 0.100000001490116119 9 +1 1 AUTOTUNE_AXES 7 2 +1 1 AUTOTUNE_MIN_D 0.001000000047497451 9 +1 1 AVD_ENABLE 0 2 +1 1 AVOID_ANGLE_MAX 1000 4 +1 1 AVOID_DIST_MAX 10.000000000000000000 9 +1 1 AVOID_ENABLE 3 2 +1 1 AVOID_MARGIN 2.000000000000000000 9 +1 1 BATT2_AMP_OFFSET 0.000000000000000000 9 +1 1 BATT2_AMP_PERVOL 17.000000000000000000 9 +1 1 BATT2_CAPACITY 3300 6 +1 1 BATT2_CURR_PIN 3 2 +1 1 BATT2_MONITOR 0 2 +1 1 BATT2_SERIAL_NUM -1 6 +1 1 BATT2_VOLT_MULT 10.100000381469726563 9 +1 1 BATT2_VOLT_PIN 2 2 +1 1 BATT_AMP_OFFSET 0.000000000000000000 9 +1 1 BATT_AMP_PERVOLT 17.000000000000000000 9 +1 1 BATT_CAPACITY 5100 6 +1 1 BATT_CURR_PIN 3 2 +1 1 BATT_MONITOR 4 2 +1 1 BATT_SERIAL_NUM -1 6 +1 1 BATT_VOLT_MULT 12.020000457763671875 9 +1 1 BATT_VOLT_PIN 2 2 +1 1 BATT_VOLT_TIMER 10 2 +1 1 BCN_ALT 0.000000000000000000 9 +1 1 BCN_LATITUDE 0.000000000000000000 9 +1 1 BCN_LONGITUDE 0.000000000000000000 9 +1 1 BCN_ORIENT_YAW 0 4 +1 1 BCN_TYPE 0 2 +1 1 BRD_CAN_ENABLE 0 2 +1 1 BRD_IMU_TARGTEMP -1 2 +1 1 BRD_IO_ENABLE 1 2 +1 1 BRD_PWM_COUNT 4 2 +1 1 BRD_SAFETYENABLE 1 2 +1 1 BRD_SAFETY_MASK 16368 6 +1 1 BRD_SBUS_OUT 0 2 +1 1 BRD_SER1_RTSCTS 2 2 +1 1 BRD_SER2_RTSCTS 2 2 +1 1 BRD_SERIAL_NUM 0 4 +1 1 BRD_TYPE 2 2 +1 1 BTN_ENABLE 0 2 +1 1 CAM_DURATION 10 2 +1 1 CAM_FEEDBACK_PIN -1 2 +1 1 CAM_FEEDBACK_POL 1 2 +1 1 CAM_MAX_ROLL 0 4 +1 1 CAM_MIN_INTERVAL 0 4 +1 1 CAM_RELAY_ON 1 2 +1 1 CAM_SERVO_OFF 1100 4 +1 1 CAM_SERVO_ON 1300 4 +1 1 CAM_TRIGG_DIST 0.000000000000000000 9 +1 1 CAM_TRIGG_TYPE 0 2 +1 1 CH10_OPT 0 2 +1 1 CH11_OPT 0 2 +1 1 CH12_OPT 0 2 +1 1 CH7_OPT 4 2 +1 1 CH8_OPT 0 2 +1 1 CH9_OPT 0 2 +1 1 CHUTE_ENABLED 0 2 +1 1 CIRCLE_RADIUS 1000.000000000000000000 9 +1 1 CIRCLE_RATE 20.000000000000000000 9 +1 1 CLI_ENABLED 0 2 +1 1 COMPASS_AUTODEC 1 2 +1 1 COMPASS_CAL_FIT 16.000000000000000000 9 +1 1 COMPASS_DEC 0.000000000000000000 9 +1 1 COMPASS_DEV_ID 466441 6 +1 1 COMPASS_DEV_ID2 131594 6 +1 1 COMPASS_DEV_ID3 0 6 +1 1 COMPASS_DIA2_X 0.990296721458435059 9 +1 1 COMPASS_DIA2_Y 0.971784174442291260 9 +1 1 COMPASS_DIA2_Z 1.007365465164184570 9 +1 1 COMPASS_DIA3_X 0.000000000000000000 9 +1 1 COMPASS_DIA3_Y 0.000000000000000000 9 +1 1 COMPASS_DIA3_Z 0.000000000000000000 9 +1 1 COMPASS_DIA_X 0.947009563446044922 9 +1 1 COMPASS_DIA_Y 0.937935292720794678 9 +1 1 COMPASS_DIA_Z 1.060336470603942871 9 +1 1 COMPASS_EXTERN2 0 2 +1 1 COMPASS_EXTERN3 0 2 +1 1 COMPASS_EXTERNAL 1 2 +1 1 COMPASS_LEARN 0 2 +1 1 COMPASS_MOT2_X 0.000000000000000000 9 +1 1 COMPASS_MOT2_Y 0.000000000000000000 9 +1 1 COMPASS_MOT2_Z 0.000000000000000000 9 +1 1 COMPASS_MOT3_X 0.000000000000000000 9 +1 1 COMPASS_MOT3_Y 0.000000000000000000 9 +1 1 COMPASS_MOT3_Z 0.000000000000000000 9 +1 1 COMPASS_MOTCT 0 2 +1 1 COMPASS_MOT_X 0.000000000000000000 9 +1 1 COMPASS_MOT_Y 0.000000000000000000 9 +1 1 COMPASS_MOT_Z 0.000000000000000000 9 +1 1 COMPASS_ODI2_X -0.006166019476950169 9 +1 1 COMPASS_ODI2_Y 0.001182210398837924 9 +1 1 COMPASS_ODI2_Z 0.018183957785367966 9 +1 1 COMPASS_ODI3_X 0.000000000000000000 9 +1 1 COMPASS_ODI3_Y 0.000000000000000000 9 +1 1 COMPASS_ODI3_Z 0.000000000000000000 9 +1 1 COMPASS_ODI_X -0.013673859648406506 9 +1 1 COMPASS_ODI_Y 0.001898076618090272 9 +1 1 COMPASS_ODI_Z -0.007604577112942934 9 +1 1 COMPASS_OFFS_MAX 600 4 +1 1 COMPASS_OFS2_X 280.823242187500000000 9 +1 1 COMPASS_OFS2_Y 87.670928955078125000 9 +1 1 COMPASS_OFS2_Z -469.461639404296875000 9 +1 1 COMPASS_OFS3_X 0.000000000000000000 9 +1 1 COMPASS_OFS3_Y 0.000000000000000000 9 +1 1 COMPASS_OFS3_Z 0.000000000000000000 9 +1 1 COMPASS_OFS_X -112.272964477539062500 9 +1 1 COMPASS_OFS_Y -5.009645462036132813 9 +1 1 COMPASS_OFS_Z 34.276287078857421875 9 +1 1 COMPASS_ORIENT 0 2 +1 1 COMPASS_ORIENT2 0 2 +1 1 COMPASS_ORIENT3 0 2 +1 1 COMPASS_PRIMARY 0 2 +1 1 COMPASS_USE 1 2 +1 1 COMPASS_USE2 1 2 +1 1 COMPASS_USE3 1 2 +1 1 DEV_OPTIONS 0 6 +1 1 DISARM_DELAY 10 2 +1 1 EK2_ABIAS_P_NSE 0.004999999888241291 9 +1 1 EK2_ACC_P_NSE 0.600000023841857910 9 +1 1 EK2_ALT_M_NSE 3.000000000000000000 9 +1 1 EK2_ALT_SOURCE 0 2 +1 1 EK2_BCN_DELAY 50 2 +1 1 EK2_BCN_I_GTE 500 4 +1 1 EK2_BCN_M_NSE 1.000000000000000000 9 +1 1 EK2_CHECK_SCALE 100 4 +1 1 EK2_EAS_I_GATE 400 4 +1 1 EK2_EAS_M_NSE 1.399999976158142090 9 +1 1 EK2_ENABLE 1 2 +1 1 EK2_FLOW_DELAY 10 2 +1 1 EK2_FLOW_I_GATE 300 4 +1 1 EK2_FLOW_M_NSE 0.250000000000000000 9 +1 1 EK2_GBIAS_P_NSE 0.000099999997473788 9 +1 1 EK2_GLITCH_RAD 25 2 +1 1 EK2_GPS_CHECK 31 2 +1 1 EK2_GPS_DELAY 220 4 +1 1 EK2_GPS_TYPE 0 2 +1 1 EK2_GSCL_P_NSE 0.000500000023748726 9 +1 1 EK2_GYRO_P_NSE 0.029999999329447746 9 +1 1 EK2_HGT_DELAY 60 4 +1 1 EK2_HGT_I_GATE 500 4 +1 1 EK2_IMU_MASK 3 2 +1 1 EK2_LOG_MASK 1 2 +1 1 EK2_MAGB_P_NSE 0.000099999997473788 9 +1 1 EK2_MAGE_P_NSE 0.001000000047497451 9 +1 1 EK2_MAG_CAL 3 2 +1 1 EK2_MAG_I_GATE 300 4 +1 1 EK2_MAG_MASK 0 2 +1 1 EK2_MAG_M_NSE 0.050000000745058060 9 +1 1 EK2_MAX_FLOW 2.500000000000000000 9 +1 1 EK2_NOAID_M_NSE 10.000000000000000000 9 +1 1 EK2_POSNE_M_NSE 1.000000000000000000 9 +1 1 EK2_POS_I_GATE 500 4 +1 1 EK2_RNG_I_GATE 500 4 +1 1 EK2_RNG_M_NSE 0.500000000000000000 9 +1 1 EK2_RNG_USE_HGT -1 2 +1 1 EK2_RNG_USE_SPD 2.000000000000000000 9 +1 1 EK2_TAU_OUTPUT 25 2 +1 1 EK2_TERR_GRAD 0.100000001490116119 9 +1 1 EK2_VELD_M_NSE 0.699999988079071045 9 +1 1 EK2_VELNE_M_NSE 0.500000000000000000 9 +1 1 EK2_VEL_I_GATE 500 4 +1 1 EK2_WIND_PSCALE 0.500000000000000000 9 +1 1 EK2_WIND_P_NSE 0.100000001490116119 9 +1 1 EK2_YAW_I_GATE 300 4 +1 1 EK2_YAW_M_NSE 0.500000000000000000 9 +1 1 EK3_ENABLE 0 2 +1 1 ESC_CALIBRATION 0 2 +1 1 FENCE_ACTION 1 2 +1 1 FENCE_ALT_MAX 100.000000000000000000 9 +1 1 FENCE_ENABLE 1 2 +1 1 FENCE_MARGIN 2.000000000000000000 9 +1 1 FENCE_RADIUS 300.000000000000000000 9 +1 1 FENCE_TOTAL 0 2 +1 1 FENCE_TYPE 3 2 +1 1 FLOW_BUS_ID 0 2 +1 1 FLOW_ENABLE 0 2 +1 1 FLOW_FXSCALER 0 4 +1 1 FLOW_FYSCALER 0 4 +1 1 FLOW_ORIENT_YAW 0 4 +1 1 FLOW_POS_X 0.000000000000000000 9 +1 1 FLOW_POS_Y 0.000000000000000000 9 +1 1 FLOW_POS_Z 0.000000000000000000 9 +1 1 FLTMODE1 0 2 +1 1 FLTMODE2 5 2 +1 1 FLTMODE3 3 2 +1 1 FLTMODE4 6 2 +1 1 FLTMODE5 6 2 +1 1 FLTMODE6 6 2 +1 1 FRAME_CLASS 1 2 +1 1 FRAME_TYPE 2 2 +1 1 FS_BATT_ENABLE 1 2 +1 1 FS_BATT_MAH 0.000000000000000000 9 +1 1 FS_BATT_VOLTAGE 10.500000000000000000 9 +1 1 FS_CRASH_CHECK 1 2 +1 1 FS_EKF_ACTION 1 2 +1 1 FS_EKF_THRESH 0.800000011920928955 9 +1 1 FS_GCS_ENABLE 1 2 +1 1 FS_THR_ENABLE 1 2 +1 1 FS_THR_VALUE 975 4 +1 1 GCS_PID_MASK 0 4 +1 1 GND_ABS_PRESS 101975.898437500000000000 9 +1 1 GND_ABS_PRESS2 0.000000000000000000 9 +1 1 GND_ABS_PRESS3 0.000000000000000000 9 +1 1 GND_ALT_OFFSET 0.000000000000000000 9 +1 1 GND_EFFECT_COMP 0 2 +1 1 GND_EXT_BUS -1 2 +1 1 GND_PRIMARY 0 2 +1 1 GND_TEMP 0.000000000000000000 9 +1 1 GPS_AUTO_CONFIG 1 2 +1 1 GPS_AUTO_SWITCH 1 2 +1 1 GPS_BLEND_MASK 5 2 +1 1 GPS_BLEND_TC 10.000000000000000000 9 +1 1 GPS_DELAY_MS 0 4 +1 1 GPS_DELAY_MS2 0 4 +1 1 GPS_GNSS_MODE 0 2 +1 1 GPS_GNSS_MODE2 0 2 +1 1 GPS_HDOP_GOOD 250 4 +1 1 GPS_INJECT_TO 127 2 +1 1 GPS_MIN_DGPS 100 2 +1 1 GPS_MIN_ELEV -100 2 +1 1 GPS_NAVFILTER 8 2 +1 1 GPS_POS1_X 0.000000000000000000 9 +1 1 GPS_POS1_Y 0.000000000000000000 9 +1 1 GPS_POS1_Z 0.000000000000000000 9 +1 1 GPS_POS2_X 0.000000000000000000 9 +1 1 GPS_POS2_Y 0.000000000000000000 9 +1 1 GPS_POS2_Z 0.000000000000000000 9 +1 1 GPS_RATE_MS 200 4 +1 1 GPS_RATE_MS2 200 4 +1 1 GPS_RAW_DATA 0 2 +1 1 GPS_SAVE_CFG 0 2 +1 1 GPS_SBAS_MODE 2 2 +1 1 GPS_SBP_LOGMASK -256 4 +1 1 GPS_TYPE 1 2 +1 1 GPS_TYPE2 0 2 +1 1 GRIP_ENABLE 0 2 +1 1 INS_ACC2OFFS_X 0.465681284666061401 9 +1 1 INS_ACC2OFFS_Y -0.163094490766525269 9 +1 1 INS_ACC2OFFS_Z 0.841708540916442871 9 +1 1 INS_ACC2SCAL_X 1.025157928466796875 9 +1 1 INS_ACC2SCAL_Y 1.017194271087646484 9 +1 1 INS_ACC2SCAL_Z 1.034052014350891113 9 +1 1 INS_ACC2_ID 1114634 6 +1 1 INS_ACC3OFFS_X 0.000000000000000000 9 +1 1 INS_ACC3OFFS_Y 0.000000000000000000 9 +1 1 INS_ACC3OFFS_Z 0.000000000000000000 9 +1 1 INS_ACC3SCAL_X 0.000000000000000000 9 +1 1 INS_ACC3SCAL_Y 0.000000000000000000 9 +1 1 INS_ACC3SCAL_Z 0.000000000000000000 9 +1 1 INS_ACC3_ID 0 6 +1 1 INS_ACCEL_FILTER 20 2 +1 1 INS_ACCOFFS_X -0.064211823046207428 9 +1 1 INS_ACCOFFS_Y -0.180485680699348450 9 +1 1 INS_ACCOFFS_Z -0.311422348022460938 9 +1 1 INS_ACCSCAL_X 0.995959579944610596 9 +1 1 INS_ACCSCAL_Y 1.004220247268676758 9 +1 1 INS_ACCSCAL_Z 0.992680013179779053 9 +1 1 INS_ACC_BODYFIX 2 2 +1 1 INS_ACC_ID 1246218 6 +1 1 INS_FAST_SAMPLE 0 2 +1 1 INS_GYR2OFFS_X 0.033170118927955627 9 +1 1 INS_GYR2OFFS_Y -0.008167488500475883 9 +1 1 INS_GYR2OFFS_Z -0.009966009296476841 9 +1 1 INS_GYR2_ID 2228490 6 +1 1 INS_GYR3OFFS_X 0.000000000000000000 9 +1 1 INS_GYR3OFFS_Y 0.000000000000000000 9 +1 1 INS_GYR3OFFS_Z 0.000000000000000000 9 +1 1 INS_GYR3_ID 0 6 +1 1 INS_GYROFFS_X -0.020668458193540573 9 +1 1 INS_GYROFFS_Y 0.071772724390029907 9 +1 1 INS_GYROFFS_Z -0.002931264694780111 9 +1 1 INS_GYRO_FILTER 20 2 +1 1 INS_GYR_CAL 1 2 +1 1 INS_GYR_ID 2163722 6 +1 1 INS_POS1_X 0.000000000000000000 9 +1 1 INS_POS1_Y 0.000000000000000000 9 +1 1 INS_POS1_Z 0.000000000000000000 9 +1 1 INS_POS2_X 0.000000000000000000 9 +1 1 INS_POS2_Y 0.000000000000000000 9 +1 1 INS_POS2_Z 0.000000000000000000 9 +1 1 INS_POS3_X 0.000000000000000000 9 +1 1 INS_POS3_Y 0.000000000000000000 9 +1 1 INS_POS3_Z 0.000000000000000000 9 +1 1 INS_PRODUCT_ID 5 4 +1 1 INS_STILL_THRESH 2.500000000000000000 9 +1 1 INS_TRIM_OPTION 1 2 +1 1 INS_USE 1 2 +1 1 INS_USE2 1 2 +1 1 INS_USE3 0 2 +1 1 LAND_REPOSITION 1 2 +1 1 LAND_SPEED 50 4 +1 1 LAND_SPEED_HIGH 0 4 +1 1 LGR_SERVO_DEPLOY 1750 4 +1 1 LGR_SERVO_RTRACT 1250 4 +1 1 LOG_BACKEND_TYPE 1 2 +1 1 LOG_BITMASK 176126 6 +1 1 LOG_DISARMED 0 2 +1 1 LOG_FILE_BUFSIZE 16 2 +1 1 LOG_FILE_DSRMROT 0 2 +1 1 LOG_REPLAY 0 2 +1 1 MAG_ENABLE 1 2 +1 1 MIS_RESTART 0 2 +1 1 MIS_TOTAL 0 4 +1 1 MNT_ANGMAX_PAN 4500 4 +1 1 MNT_ANGMAX_ROL 4500 4 +1 1 MNT_ANGMAX_TIL 0 4 +1 1 MNT_ANGMIN_PAN -4500 4 +1 1 MNT_ANGMIN_ROL -4500 4 +1 1 MNT_ANGMIN_TIL -9000 4 +1 1 MNT_DEFLT_MODE 3 2 +1 1 MNT_JSTICK_SPD 0 2 +1 1 MNT_LEAD_PTCH 0.000000000000000000 9 +1 1 MNT_LEAD_RLL 0.000000000000000000 9 +1 1 MNT_NEUTRAL_X 0.000000000000000000 9 +1 1 MNT_NEUTRAL_Y 0.000000000000000000 9 +1 1 MNT_NEUTRAL_Z 0.000000000000000000 9 +1 1 MNT_RC_IN_PAN 0 2 +1 1 MNT_RC_IN_ROLL 0 2 +1 1 MNT_RC_IN_TILT 6 2 +1 1 MNT_RETRACT_X 0.000000000000000000 9 +1 1 MNT_RETRACT_Y 0.000000000000000000 9 +1 1 MNT_RETRACT_Z 0.000000000000000000 9 +1 1 MNT_STAB_PAN 0 2 +1 1 MNT_STAB_ROLL 0 2 +1 1 MNT_STAB_TILT 0 2 +1 1 MNT_TYPE 1 2 +1 1 MOT_BAT_CURR_MAX 0.000000000000000000 9 +1 1 MOT_BAT_CURR_TC 5.000000000000000000 9 +1 1 MOT_BAT_VOLT_MAX 0.000000000000000000 9 +1 1 MOT_BAT_VOLT_MIN 0.000000000000000000 9 +1 1 MOT_HOVER_LEARN 2 2 +1 1 MOT_PWM_MAX 0 4 +1 1 MOT_PWM_MIN 0 4 +1 1 MOT_PWM_TYPE 0 2 +1 1 MOT_SAFE_DISARM 0 2 +1 1 MOT_SPIN_ARM 0.100000001490116119 9 +1 1 MOT_SPIN_MAX 0.949999988079071045 9 +1 1 MOT_SPIN_MIN 0.150000005960464478 9 +1 1 MOT_SPOOL_TIME 0.500000000000000000 9 +1 1 MOT_THST_EXPO 0.649999976158142090 9 +1 1 MOT_THST_HOVER 0.472181797027587891 9 +1 1 MOT_YAW_HEADROOM 200 4 +1 1 NTF_BUZZ_ENABLE 1 2 +1 1 NTF_DISPLAY_TYPE 0 2 +1 1 NTF_LED_BRIGHT 3 2 +1 1 NTF_LED_OVERRIDE 0 2 +1 1 PHLD_BRAKE_ANGLE 3000 4 +1 1 PHLD_BRAKE_RATE 8 4 +1 1 PILOT_ACCEL_Z 250 4 +1 1 PILOT_THR_BHV 0 4 +1 1 PILOT_THR_FILT 0.000000000000000000 9 +1 1 PILOT_TKOFF_ALT 0.000000000000000000 9 +1 1 PILOT_TKOFF_DZ 100 4 +1 1 PILOT_VELZ_MAX 250 4 +1 1 PLND_ENABLED 0 2 +1 1 POS_XY_P 1.000000000000000000 9 +1 1 POS_Z_P 1.000000000000000000 9 +1 1 PRX_IGN_ANG1 0 4 +1 1 PRX_IGN_ANG2 0 4 +1 1 PRX_IGN_ANG3 0 4 +1 1 PRX_IGN_ANG4 0 4 +1 1 PRX_IGN_ANG5 0 4 +1 1 PRX_IGN_ANG6 0 4 +1 1 PRX_IGN_WID1 0 2 +1 1 PRX_IGN_WID2 0 2 +1 1 PRX_IGN_WID3 0 2 +1 1 PRX_IGN_WID4 0 2 +1 1 PRX_IGN_WID5 0 2 +1 1 PRX_IGN_WID6 0 2 +1 1 PRX_ORIENT 0 2 +1 1 PRX_TYPE 0 2 +1 1 PRX_YAW_CORR 22 4 +1 1 PSC_ACC_XY_FILT 2.000000000000000000 9 +1 1 RALLY_INCL_HOME 1 2 +1 1 RALLY_LIMIT_KM 0.300000011920928955 9 +1 1 RALLY_TOTAL 0 2 +1 1 RC10_DZ 0 4 +1 1 RC10_MAX 2000 4 +1 1 RC10_MIN 1000 4 +1 1 RC10_REVERSED 0 2 +1 1 RC10_TRIM 1500 4 +1 1 RC11_DZ 0 4 +1 1 RC11_MAX 2000 4 +1 1 RC11_MIN 1000 4 +1 1 RC11_REVERSED 0 2 +1 1 RC11_TRIM 1500 4 +1 1 RC12_DZ 0 4 +1 1 RC12_MAX 2000 4 +1 1 RC12_MIN 1000 4 +1 1 RC12_REVERSED 0 2 +1 1 RC12_TRIM 1500 4 +1 1 RC13_DZ 0 4 +1 1 RC13_MAX 2000 4 +1 1 RC13_MIN 1000 4 +1 1 RC13_REVERSED 0 2 +1 1 RC13_TRIM 1500 4 +1 1 RC14_DZ 0 4 +1 1 RC14_MAX 2000 4 +1 1 RC14_MIN 1000 4 +1 1 RC14_REVERSED 0 2 +1 1 RC14_TRIM 1500 4 +1 1 RC15_DZ 0 4 +1 1 RC15_MAX 1900 4 +1 1 RC15_MIN 1100 4 +1 1 RC15_REVERSED 0 2 +1 1 RC15_TRIM 1500 4 +1 1 RC16_DZ 0 4 +1 1 RC16_MAX 1900 4 +1 1 RC16_MIN 1100 4 +1 1 RC16_REVERSED 0 2 +1 1 RC16_TRIM 1500 4 +1 1 RC1_DZ 10 4 +1 1 RC1_MAX 2014 4 +1 1 RC1_MIN 990 4 +1 1 RC1_REVERSED 0 2 +1 1 RC1_TRIM 1503 4 +1 1 RC2_DZ 10 4 +1 1 RC2_MAX 2015 4 +1 1 RC2_MIN 991 4 +1 1 RC2_REVERSED 0 2 +1 1 RC2_TRIM 1504 4 +1 1 RC3_DZ 30 4 +1 1 RC3_MAX 2016 4 +1 1 RC3_MIN 992 4 +1 1 RC3_REVERSED 0 2 +1 1 RC3_TRIM 992 4 +1 1 RC4_DZ 10 4 +1 1 RC4_MAX 2015 4 +1 1 RC4_MIN 992 4 +1 1 RC4_REVERSED 0 2 +1 1 RC4_TRIM 1501 4 +1 1 RC5_DZ 0 4 +1 1 RC5_MAX 2016 4 +1 1 RC5_MIN 991 4 +1 1 RC5_REVERSED 0 2 +1 1 RC5_TRIM 1503 4 +1 1 RC6_DZ 0 4 +1 1 RC6_MAX 2016 4 +1 1 RC6_MIN 991 4 +1 1 RC6_REVERSED 0 2 +1 1 RC6_TRIM 1503 4 +1 1 RC7_DZ 0 4 +1 1 RC7_MAX 2016 4 +1 1 RC7_MIN 991 4 +1 1 RC7_REVERSED 0 2 +1 1 RC7_TRIM 1503 4 +1 1 RC8_DZ 0 4 +1 1 RC8_MAX 2015 4 +1 1 RC8_MIN 991 4 +1 1 RC8_REVERSED 0 2 +1 1 RC8_TRIM 1503 4 +1 1 RC9_DZ 0 4 +1 1 RC9_MAX 2000 4 +1 1 RC9_MIN 1000 4 +1 1 RC9_REVERSED 0 2 +1 1 RC9_TRIM 1500 4 +1 1 RCMAP_PITCH 2 2 +1 1 RCMAP_ROLL 1 2 +1 1 RCMAP_THROTTLE 3 2 +1 1 RCMAP_YAW 4 2 +1 1 RC_FEEL_RP 25 2 +1 1 RC_SPEED 490 4 +1 1 RELAY_DEFAULT 0 2 +1 1 RELAY_PIN 54 2 +1 1 RELAY_PIN2 55 2 +1 1 RELAY_PIN3 -1 2 +1 1 RELAY_PIN4 -1 2 +1 1 RNGFND2_ADDR 0 2 +1 1 RNGFND2_FUNCTION 0 2 +1 1 RNGFND2_GNDCLEAR 10 2 +1 1 RNGFND2_MAX_CM 700 4 +1 1 RNGFND2_MIN_CM 20 4 +1 1 RNGFND2_OFFSET 0.000000000000000000 9 +1 1 RNGFND2_ORIENT 25 2 +1 1 RNGFND2_PIN -1 2 +1 1 RNGFND2_POS_X 0.000000000000000000 9 +1 1 RNGFND2_POS_Y 0.000000000000000000 9 +1 1 RNGFND2_POS_Z 0.000000000000000000 9 +1 1 RNGFND2_RMETRIC 1 2 +1 1 RNGFND2_SCALING 3.000000000000000000 9 +1 1 RNGFND2_SETTLE 0 4 +1 1 RNGFND2_STOP_PIN -1 2 +1 1 RNGFND2_TYPE 0 2 +1 1 RNGFND_ADDR 0 2 +1 1 RNGFND_FUNCTION 0 2 +1 1 RNGFND_GAIN 0.800000011920928955 9 +1 1 RNGFND_GNDCLEAR 10 2 +1 1 RNGFND_MAX_CM 700 4 +1 1 RNGFND_MIN_CM 20 4 +1 1 RNGFND_OFFSET 0.000000000000000000 9 +1 1 RNGFND_ORIENT 25 2 +1 1 RNGFND_PIN -1 2 +1 1 RNGFND_POS_X 0.000000000000000000 9 +1 1 RNGFND_POS_Y 0.000000000000000000 9 +1 1 RNGFND_POS_Z 0.000000000000000000 9 +1 1 RNGFND_PWRRNG 0 4 +1 1 RNGFND_RMETRIC 1 2 +1 1 RNGFND_SCALING 3.000000000000000000 9 +1 1 RNGFND_SETTLE 0 4 +1 1 RNGFND_STOP_PIN -1 2 +1 1 RNGFND_TYPE 0 2 +1 1 RPM2_PIN -1 2 +1 1 RPM2_SCALING 1.000000000000000000 9 +1 1 RPM2_TYPE 0 2 +1 1 RPM_MAX 100000.000000000000000000 9 +1 1 RPM_MIN 10.000000000000000000 9 +1 1 RPM_MIN_QUAL 0.500000000000000000 9 +1 1 RPM_PIN 54 2 +1 1 RPM_SCALING 1.000000000000000000 9 +1 1 RPM_TYPE 0 2 +1 1 RSSI_ANA_PIN 0 2 +1 1 RSSI_CHANNEL 0 2 +1 1 RSSI_CHAN_HIGH 2000 4 +1 1 RSSI_CHAN_LOW 1000 4 +1 1 RSSI_PIN_HIGH 5.000000000000000000 9 +1 1 RSSI_PIN_LOW 0.000000000000000000 9 +1 1 RSSI_TYPE 0 2 +1 1 RTL_ALT 100 4 +1 1 RTL_ALT_FINAL 0 4 +1 1 RTL_CLIMB_MIN 0 4 +1 1 RTL_CONE_SLOPE 3.000000000000000000 9 +1 1 RTL_LOIT_TIME 5000 6 +1 1 RTL_SPEED 0 4 +1 1 SCHED_DEBUG 0 2 +1 1 SCHED_LOOP_RATE 400 4 +1 1 SERIAL0_BAUD 115 6 +1 1 SERIAL0_PROTOCOL 1 2 +1 1 SERIAL1_BAUD 57 6 +1 1 SERIAL1_PROTOCOL 1 2 +1 1 SERIAL2_BAUD 9 6 +1 1 SERIAL2_PROTOCOL 3 2 +1 1 SERIAL3_BAUD 38 6 +1 1 SERIAL3_PROTOCOL 5 2 +1 1 SERIAL4_BAUD 38 6 +1 1 SERIAL4_PROTOCOL 5 2 +1 1 SERIAL5_BAUD 57 6 +1 1 SERIAL5_PROTOCOL -1 2 +1 1 SERVO10_FUNCTION 0 2 +1 1 SERVO10_MAX 2000 4 +1 1 SERVO10_MIN 1000 4 +1 1 SERVO10_REVERSED 0 2 +1 1 SERVO10_TRIM 1500 4 +1 1 SERVO11_FUNCTION 0 2 +1 1 SERVO11_MAX 2000 4 +1 1 SERVO11_MIN 1000 4 +1 1 SERVO11_REVERSED 0 2 +1 1 SERVO11_TRIM 1500 4 +1 1 SERVO12_FUNCTION 0 2 +1 1 SERVO12_MAX 2000 4 +1 1 SERVO12_MIN 1000 4 +1 1 SERVO12_REVERSED 0 2 +1 1 SERVO12_TRIM 1500 4 +1 1 SERVO13_FUNCTION 0 2 +1 1 SERVO13_MAX 2000 4 +1 1 SERVO13_MIN 1000 4 +1 1 SERVO13_REVERSED 0 2 +1 1 SERVO13_TRIM 1500 4 +1 1 SERVO14_FUNCTION 0 2 +1 1 SERVO14_MAX 2000 4 +1 1 SERVO14_MIN 1000 4 +1 1 SERVO14_REVERSED 0 2 +1 1 SERVO14_TRIM 1500 4 +1 1 SERVO15_FUNCTION 0 2 +1 1 SERVO15_MAX 1900 4 +1 1 SERVO15_MIN 1100 4 +1 1 SERVO15_REVERSED 0 2 +1 1 SERVO15_TRIM 1500 4 +1 1 SERVO16_FUNCTION 0 2 +1 1 SERVO16_MAX 1900 4 +1 1 SERVO16_MIN 1100 4 +1 1 SERVO16_REVERSED 0 2 +1 1 SERVO16_TRIM 1500 4 +1 1 SERVO1_FUNCTION 33 2 +1 1 SERVO1_MAX 2015 4 +1 1 SERVO1_MIN 991 4 +1 1 SERVO1_REVERSED 0 2 +1 1 SERVO1_TRIM 1503 4 +1 1 SERVO2_FUNCTION 34 2 +1 1 SERVO2_MAX 2016 4 +1 1 SERVO2_MIN 991 4 +1 1 SERVO2_REVERSED 0 2 +1 1 SERVO2_TRIM 1503 4 +1 1 SERVO3_FUNCTION 35 2 +1 1 SERVO3_MAX 2016 4 +1 1 SERVO3_MIN 992 4 +1 1 SERVO3_REVERSED 0 2 +1 1 SERVO3_TRIM 992 4 +1 1 SERVO4_FUNCTION 36 2 +1 1 SERVO4_MAX 2015 4 +1 1 SERVO4_MIN 991 4 +1 1 SERVO4_REVERSED 0 2 +1 1 SERVO4_TRIM 1503 4 +1 1 SERVO5_FUNCTION 0 2 +1 1 SERVO5_MAX 2016 4 +1 1 SERVO5_MIN 991 4 +1 1 SERVO5_REVERSED 0 2 +1 1 SERVO5_TRIM 1503 4 +1 1 SERVO6_FUNCTION 0 2 +1 1 SERVO6_MAX 2016 4 +1 1 SERVO6_MIN 991 4 +1 1 SERVO6_REVERSED 0 2 +1 1 SERVO6_TRIM 1503 4 +1 1 SERVO7_FUNCTION 0 2 +1 1 SERVO7_MAX 2016 4 +1 1 SERVO7_MIN 991 4 +1 1 SERVO7_REVERSED 0 2 +1 1 SERVO7_TRIM 1503 4 +1 1 SERVO8_FUNCTION 0 2 +1 1 SERVO8_MAX 2000 4 +1 1 SERVO8_MIN 1000 4 +1 1 SERVO8_REVERSED 0 2 +1 1 SERVO8_TRIM 1500 4 +1 1 SERVO9_FUNCTION 7 2 +1 1 SERVO9_MAX 2000 4 +1 1 SERVO9_MIN 1000 4 +1 1 SERVO9_REVERSED 0 2 +1 1 SERVO9_TRIM 1500 4 +1 1 SERVO_CANESC_BM 0 6 +1 1 SERVO_CANSRV_BM 0 6 +1 1 SIMPLE 0 2 +1 1 SPRAY_ENABLE 0 2 +1 1 SR0_ADSB 5 4 +1 1 SR0_EXTRA1 0 4 +1 1 SR0_EXTRA2 0 4 +1 1 SR0_EXTRA3 0 4 +1 1 SR0_EXT_STAT 0 4 +1 1 SR0_PARAMS 0 4 +1 1 SR0_POSITION 0 4 +1 1 SR0_RAW_CTRL 0 4 +1 1 SR0_RAW_SENS 0 4 +1 1 SR0_RC_CHAN 0 4 +1 1 SR1_ADSB 5 4 +1 1 SR1_EXTRA1 10 4 +1 1 SR1_EXTRA2 10 4 +1 1 SR1_EXTRA3 3 4 +1 1 SR1_EXT_STAT 2 4 +1 1 SR1_PARAMS 10 4 +1 1 SR1_POSITION 3 4 +1 1 SR1_RAW_CTRL 0 4 +1 1 SR1_RAW_SENS 2 4 +1 1 SR1_RC_CHAN 2 4 +1 1 SR2_ADSB 5 4 +1 1 SR2_EXTRA1 0 4 +1 1 SR2_EXTRA2 0 4 +1 1 SR2_EXTRA3 0 4 +1 1 SR2_EXT_STAT 0 4 +1 1 SR2_PARAMS 0 4 +1 1 SR2_POSITION 0 4 +1 1 SR2_RAW_CTRL 0 4 +1 1 SR2_RAW_SENS 0 4 +1 1 SR2_RC_CHAN 0 4 +1 1 SR3_ADSB 5 4 +1 1 SR3_EXTRA1 0 4 +1 1 SR3_EXTRA2 0 4 +1 1 SR3_EXTRA3 0 4 +1 1 SR3_EXT_STAT 0 4 +1 1 SR3_PARAMS 0 4 +1 1 SR3_POSITION 0 4 +1 1 SR3_RAW_CTRL 0 4 +1 1 SR3_RAW_SENS 0 4 +1 1 SR3_RC_CHAN 0 4 +1 1 STAT_BOOTCNT 16 4 +1 1 STAT_FLTTIME 623 6 +1 1 STAT_RESET 20034978 6 +1 1 STAT_RUNTIME 3525 6 +1 1 SUPER_SIMPLE 0 2 +1 1 SYSID_ENFORCE 0 2 +1 1 SYSID_MYGCS 255 4 +1 1 SYSID_SW_MREV 120 4 +1 1 SYSID_SW_TYPE 10 2 +1 1 SYSID_THISMAV 1 4 +1 1 TELEM_DELAY 0 2 +1 1 TERRAIN_ENABLE 1 2 +1 1 TERRAIN_FOLLOW 0 2 +1 1 TERRAIN_SPACING 100 4 +1 1 THROW_MOT_START 0 2 +1 1 THROW_NEXTMODE 18 2 +1 1 THROW_TYPE 0 2 +1 1 THR_DZ 50 4 +1 1 TUNE 0 2 +1 1 TUNE_HIGH 1000 4 +1 1 TUNE_LOW 0 4 +1 1 VEL_XY_FILT_HZ 5.000000000000000000 9 +1 1 VEL_XY_I 0.500000000000000000 9 +1 1 VEL_XY_IMAX 1000.000000000000000000 9 +1 1 VEL_XY_P 1.000000000000000000 9 +1 1 VEL_Z_P 5.000000000000000000 9 +1 1 VISO_ORIENT 0 2 +1 1 VISO_POS_X 0.000000000000000000 9 +1 1 VISO_POS_Y 0.000000000000000000 9 +1 1 VISO_POS_Z 0.000000000000000000 9 +1 1 VISO_TYPE 0 2 +1 1 WPNAV_ACCEL 250.000000000000000000 9 +1 1 WPNAV_ACCEL_Z 100.000000000000000000 9 +1 1 WPNAV_LOIT_JERK 1000.000000000000000000 9 +1 1 WPNAV_LOIT_MAXA 250.000000000000000000 9 +1 1 WPNAV_LOIT_MINA 25.000000000000000000 9 +1 1 WPNAV_LOIT_SPEED 1000.000000000000000000 9 +1 1 WPNAV_RADIUS 200.000000000000000000 9 +1 1 WPNAV_RFND_USE 1 2 +1 1 WPNAV_SPEED 650.000000000000000000 9 +1 1 WPNAV_SPEED_DN 150.000000000000000000 9 +1 1 WPNAV_SPEED_UP 250.000000000000000000 9 +1 1 WP_NAVALT_MIN 0.000000000000000000 9 +1 1 WP_YAW_BEHAVIOR 2 2 diff --git a/app/src/main/assets/DJIMock.txt b/app/src/main/assets/DJIMock.txt new file mode 100644 index 0000000..67b36d1 --- /dev/null +++ b/app/src/main/assets/DJIMock.txt @@ -0,0 +1,807 @@ +# Onboard parameters for Vehicle 1 +# +# Parameters DJI_* are implemented +# +# The rest are mock ArduCopter parameters lifted from QGroundControl +# +# Note that entries are tab-delimited. Android Studio defaults to using spaces. You can copy-paste a tab from another text editor. +# +# Vehicle-Id Component-Id Name Value Type Desc +# +# FlightController +1 1 DJI_CTRL_MODE 2 2 MANUAL=0,SMART=2,UNKNOWN=255 +1 1 DJI_ENBL_LEDS 1 2 Turns on/off the forward LEDs, which are used to indicate aircraft status. [0,1] +1 1 DJI_ENBL_QSPIN 1 2 Enable/disable Auto Quick Spin. When the gimbal reaches a yaw movement limit, the aircraft will automatically rotate 360 degrees to unwind the gimbal, allowing it to continue moving in the yaw direction. This method is only available when the aircraft is flying at least 3m above the ground. [0,1] +1 1 DJI_ENBL_RADIUS 1 2 Sets whether the maximum flight radius limitation is enabled. If enabled is false, there is no maximum flight radius limitation. [0,1] +1 1 DJI_ENBL_TFOLLOW 0 2 Enable/disable terrain follow mode. [0,1] +1 1 DJI_ENBL_TRIPOD 0 2 Enables/disables tripod mode. [0,1] +1 1 DJI_FAILSAFE 1 2 HOVER=0,LANDING=1,GO_HOME=2,UNKNOWN=255 +1 1 DJI_LOW_BAT 1 4 Sets the low battery warning threshold as a percentage. The percentage must be in the range of [15, 50]. +1 1 DJI_MAX_HEIGHT 500 4 Sets the maximum flight height limitation of the aircraft. [20,500 m] +1 1 DJI_MAX_RADIUS 500 4 Sets the maximum flight radius limitation of the aircraft. The radius is calculated from the home point. The maxRadius value must be in the range [15, 500] m. +1 1 DJI_RLPCH_MODE 1 2 Sets whether roll/pitch virtual controllers change aircraft's angle relative to level orientation, or aircraft's velocity on horizontal axes. 0=ANGLE,1=VELOCITY. +1 1 DJI_RTL_HEIGHT 40 4 Return to home height (m) +1 1 DJI_SERIOUS_BAT 1 4 Sets the serious low battery warning threshold as a percentage. The minimum value is 10. The maximum value is value from getLowBatteryWarningThreshold minus 5. +1 1 DJI_SMART_RTH 1 2 Enables/disables Smart Return-To-Home (RTH) feature. When it is enabled, aircraft will request to go home when remaining battery is only enough for completing the go-home action. [0,1] +1 1 DJI_VERT_MODE 1 2 Sets whether virtual stick vertical controller changes aircraft's altitude or vertical velocity. 0=VELOCITY,1=POSITION. +1 1 DJI_YAW_MODE 1 2 Sets whether virtual stick yaw controller changes aircraft's heading by angle or by angular velocity. 0=ANGLE,1=ANGULAR_VELOCITY. +# IntelligentFlightAssistant +#1 1 DJI_COL_AVOID 1 2 TBD +#1 1 DJI_UP_AVOID 1 2 TBD +#1 1 DJI_ADV_GEST 1 2 TBD +#1 1 DJI_VIS_ASSIST 1 2 TBD +#1 1 DJI_NOVICE_MODE 1 2 TBD +#1 1 DJI_MULTIPLE 1 2 TBD +#1 1 DJI_PRECLAND 1 2 TBD +#1 1 DJI_LAND_PRTCT 1 2 TBD +# Camera +#1 1 DJI_CAM_MODE 1 2 TBD +#1 1 DJI_GBL_MODE 1 2 TBD +1 1 ACCEL_Z_D 0.000000000000000000 9 +1 1 ACCEL_Z_FF 0.000000000000000000 9 +1 1 ACCEL_Z_FILT 20.000000000000000000 9 +1 1 ACCEL_Z_I 1.000000000000000000 9 +1 1 ACCEL_Z_IMAX 800.000000000000000000 9 +1 1 ACCEL_Z_P 0.500000000000000000 9 +1 1 ACRO_BAL_PITCH 1.000000000000000000 9 +1 1 ACRO_BAL_ROLL 1.000000000000000000 9 +1 1 ACRO_RP_EXPO 0.300000011920928955 9 +1 1 ACRO_RP_P 4.500000000000000000 9 +1 1 ACRO_THR_MID 0.000000000000000000 9 +1 1 ACRO_TRAINER 2 2 +1 1 ACRO_YAW_P 3.000000000000000000 9 +1 1 ACRO_Y_EXPO 0.000000000000000000 9 +1 1 ADSB_ENABLE 0 2 +1 1 AHRS_COMP_BETA 0.100000001490116119 9 +1 1 AHRS_EKF_TYPE 2 2 +1 1 AHRS_GPS_GAIN 1.000000000000000000 9 +1 1 AHRS_GPS_MINSATS 6 2 +1 1 AHRS_GPS_USE 1 2 +1 1 AHRS_ORIENTATION 0 2 +1 1 AHRS_RP_P 0.200000002980232239 9 +1 1 AHRS_TRIM_X -0.005487891845405102 9 +1 1 AHRS_TRIM_Y 0.009387995116412640 9 +1 1 AHRS_TRIM_Z 0.000000000000000000 9 +1 1 AHRS_WIND_MAX 0 2 +1 1 AHRS_YAW_P 0.200000002980232239 9 +1 1 ANGLE_MAX 3000 4 +1 1 ARMING_ACCTHRESH 0.750000000000000000 9 +1 1 ARMING_CHECK 0 4 +1 1 ATC_ACCEL_P_MAX 110000.000000000000000000 9 +1 1 ATC_ACCEL_R_MAX 110000.000000000000000000 9 +1 1 ATC_ACCEL_Y_MAX 18000.000000000000000000 9 +1 1 ATC_ANGLE_BOOST 1 2 +1 1 ATC_ANG_LIM_TC 1.000000000000000000 9 +1 1 ATC_ANG_PIT_P 11.250000000000000000 9 +1 1 ATC_ANG_RLL_P 11.250000000000000000 9 +1 1 ATC_ANG_YAW_P 6.000000000000000000 9 +1 1 ATC_RATE_FF_ENAB 1 2 +1 1 ATC_RAT_PIT_D 0.008325000293552876 9 +1 1 ATC_RAT_PIT_FF 0.000000000000000000 9 +1 1 ATC_RAT_PIT_FILT 20.000000000000000000 9 +1 1 ATC_RAT_PIT_I 0.126000002026557922 9 +1 1 ATC_RAT_PIT_IMAX 0.222222223877906799 9 +1 1 ATC_RAT_PIT_P 0.126000002026557922 9 +1 1 ATC_RAT_RLL_D 0.011249999515712261 9 +1 1 ATC_RAT_RLL_FF 0.000000000000000000 9 +1 1 ATC_RAT_RLL_FILT 20.000000000000000000 9 +1 1 ATC_RAT_RLL_I 0.182249993085861206 9 +1 1 ATC_RAT_RLL_IMAX 0.222222223877906799 9 +1 1 ATC_RAT_RLL_P 0.182249993085861206 9 +1 1 ATC_RAT_YAW_D 0.003600000170990825 9 +1 1 ATC_RAT_YAW_FF 0.000000000000000000 9 +1 1 ATC_RAT_YAW_FILT 5.000000000000000000 9 +1 1 ATC_RAT_YAW_I 0.035999998450279236 9 +1 1 ATC_RAT_YAW_IMAX 0.222000002861022949 9 +1 1 ATC_RAT_YAW_P 0.359999984502792358 9 +1 1 ATC_SLEW_YAW 1000.000000000000000000 9 +1 1 ATC_THR_MIX_MAN 0.500000000000000000 9 +1 1 ATC_THR_MIX_MAX 0.500000000000000000 9 +1 1 ATC_THR_MIX_MIN 0.100000001490116119 9 +1 1 AUTOTUNE_AGGR 0.100000001490116119 9 +1 1 AUTOTUNE_AXES 7 2 +1 1 AUTOTUNE_MIN_D 0.001000000047497451 9 +1 1 AVD_ENABLE 0 2 +1 1 AVOID_ANGLE_MAX 1000 4 +1 1 AVOID_DIST_MAX 10.000000000000000000 9 +1 1 AVOID_ENABLE 3 2 +1 1 AVOID_MARGIN 2.000000000000000000 9 +1 1 BATT2_AMP_OFFSET 0.000000000000000000 9 +1 1 BATT2_AMP_PERVOL 17.000000000000000000 9 +1 1 BATT2_CAPACITY 3300 6 +1 1 BATT2_CURR_PIN 3 2 +1 1 BATT2_MONITOR 0 2 +1 1 BATT2_SERIAL_NUM -1 6 +1 1 BATT2_VOLT_MULT 10.100000381469726563 9 +1 1 BATT2_VOLT_PIN 2 2 +1 1 BATT_AMP_OFFSET 0.000000000000000000 9 +1 1 BATT_AMP_PERVOLT 17.000000000000000000 9 +1 1 BATT_CAPACITY 5100 6 +1 1 BATT_CURR_PIN 3 2 +1 1 BATT_MONITOR 4 2 +1 1 BATT_SERIAL_NUM -1 6 +1 1 BATT_VOLT_MULT 12.020000457763671875 9 +1 1 BATT_VOLT_PIN 2 2 +1 1 BATT_VOLT_TIMER 10 2 +1 1 BCN_ALT 0.000000000000000000 9 +1 1 BCN_LATITUDE 0.000000000000000000 9 +1 1 BCN_LONGITUDE 0.000000000000000000 9 +1 1 BCN_ORIENT_YAW 0 4 +1 1 BCN_TYPE 0 2 +1 1 BRD_CAN_ENABLE 0 2 +1 1 BRD_IMU_TARGTEMP -1 2 +1 1 BRD_IO_ENABLE 1 2 +1 1 BRD_PWM_COUNT 4 2 +1 1 BRD_SAFETYENABLE 1 2 +1 1 BRD_SAFETY_MASK 16368 6 +1 1 BRD_SBUS_OUT 0 2 +1 1 BRD_SER1_RTSCTS 2 2 +1 1 BRD_SER2_RTSCTS 2 2 +1 1 BRD_SERIAL_NUM 0 4 +1 1 BRD_TYPE 2 2 +1 1 BTN_ENABLE 0 2 +1 1 CAM_DURATION 10 2 +1 1 CAM_FEEDBACK_PIN -1 2 +1 1 CAM_FEEDBACK_POL 1 2 +1 1 CAM_MAX_ROLL 0 4 +1 1 CAM_MIN_INTERVAL 0 4 +1 1 CAM_RELAY_ON 1 2 +1 1 CAM_SERVO_OFF 1100 4 +1 1 CAM_SERVO_ON 1300 4 +1 1 CAM_TRIGG_DIST 0.000000000000000000 9 +1 1 CAM_TRIGG_TYPE 0 2 +1 1 CH10_OPT 0 2 +1 1 CH11_OPT 0 2 +1 1 CH12_OPT 0 2 +1 1 CH7_OPT 4 2 +1 1 CH8_OPT 0 2 +1 1 CH9_OPT 0 2 +1 1 CHUTE_ENABLED 0 2 +1 1 CIRCLE_RADIUS 1000.000000000000000000 9 +1 1 CIRCLE_RATE 20.000000000000000000 9 +1 1 CLI_ENABLED 0 2 +1 1 COMPASS_AUTODEC 1 2 +1 1 COMPASS_CAL_FIT 16.000000000000000000 9 +1 1 COMPASS_DEC 0.000000000000000000 9 +1 1 COMPASS_DEV_ID 466441 6 +1 1 COMPASS_DEV_ID2 131594 6 +1 1 COMPASS_DEV_ID3 0 6 +1 1 COMPASS_DIA2_X 0.990296721458435059 9 +1 1 COMPASS_DIA2_Y 0.971784174442291260 9 +1 1 COMPASS_DIA2_Z 1.007365465164184570 9 +1 1 COMPASS_DIA3_X 0.000000000000000000 9 +1 1 COMPASS_DIA3_Y 0.000000000000000000 9 +1 1 COMPASS_DIA3_Z 0.000000000000000000 9 +1 1 COMPASS_DIA_X 0.947009563446044922 9 +1 1 COMPASS_DIA_Y 0.937935292720794678 9 +1 1 COMPASS_DIA_Z 1.060336470603942871 9 +1 1 COMPASS_EXTERN2 0 2 +1 1 COMPASS_EXTERN3 0 2 +1 1 COMPASS_EXTERNAL 1 2 +1 1 COMPASS_LEARN 0 2 +1 1 COMPASS_MOT2_X 0.000000000000000000 9 +1 1 COMPASS_MOT2_Y 0.000000000000000000 9 +1 1 COMPASS_MOT2_Z 0.000000000000000000 9 +1 1 COMPASS_MOT3_X 0.000000000000000000 9 +1 1 COMPASS_MOT3_Y 0.000000000000000000 9 +1 1 COMPASS_MOT3_Z 0.000000000000000000 9 +1 1 COMPASS_MOTCT 0 2 +1 1 COMPASS_MOT_X 0.000000000000000000 9 +1 1 COMPASS_MOT_Y 0.000000000000000000 9 +1 1 COMPASS_MOT_Z 0.000000000000000000 9 +1 1 COMPASS_ODI2_X -0.006166019476950169 9 +1 1 COMPASS_ODI2_Y 0.001182210398837924 9 +1 1 COMPASS_ODI2_Z 0.018183957785367966 9 +1 1 COMPASS_ODI3_X 0.000000000000000000 9 +1 1 COMPASS_ODI3_Y 0.000000000000000000 9 +1 1 COMPASS_ODI3_Z 0.000000000000000000 9 +1 1 COMPASS_ODI_X -0.013673859648406506 9 +1 1 COMPASS_ODI_Y 0.001898076618090272 9 +1 1 COMPASS_ODI_Z -0.007604577112942934 9 +1 1 COMPASS_OFFS_MAX 600 4 +1 1 COMPASS_OFS2_X 280.823242187500000000 9 +1 1 COMPASS_OFS2_Y 87.670928955078125000 9 +1 1 COMPASS_OFS2_Z -469.461639404296875000 9 +1 1 COMPASS_OFS3_X 0.000000000000000000 9 +1 1 COMPASS_OFS3_Y 0.000000000000000000 9 +1 1 COMPASS_OFS3_Z 0.000000000000000000 9 +1 1 COMPASS_OFS_X -112.272964477539062500 9 +1 1 COMPASS_OFS_Y -5.009645462036132813 9 +1 1 COMPASS_OFS_Z 34.276287078857421875 9 +1 1 COMPASS_ORIENT 0 2 +1 1 COMPASS_ORIENT2 0 2 +1 1 COMPASS_ORIENT3 0 2 +1 1 COMPASS_PRIMARY 0 2 +1 1 COMPASS_USE 1 2 +1 1 COMPASS_USE2 1 2 +1 1 COMPASS_USE3 1 2 +1 1 DEV_OPTIONS 0 6 +1 1 DISARM_DELAY 10 2 +1 1 EK2_ABIAS_P_NSE 0.004999999888241291 9 +1 1 EK2_ACC_P_NSE 0.600000023841857910 9 +1 1 EK2_ALT_M_NSE 3.000000000000000000 9 +1 1 EK2_ALT_SOURCE 0 2 +1 1 EK2_BCN_DELAY 50 2 +1 1 EK2_BCN_I_GTE 500 4 +1 1 EK2_BCN_M_NSE 1.000000000000000000 9 +1 1 EK2_CHECK_SCALE 100 4 +1 1 EK2_EAS_I_GATE 400 4 +1 1 EK2_EAS_M_NSE 1.399999976158142090 9 +1 1 EK2_ENABLE 1 2 +1 1 EK2_FLOW_DELAY 10 2 +1 1 EK2_FLOW_I_GATE 300 4 +1 1 EK2_FLOW_M_NSE 0.250000000000000000 9 +1 1 EK2_GBIAS_P_NSE 0.000099999997473788 9 +1 1 EK2_GLITCH_RAD 25 2 +1 1 EK2_GPS_CHECK 31 2 +1 1 EK2_GPS_DELAY 220 4 +1 1 EK2_GPS_TYPE 0 2 +1 1 EK2_GSCL_P_NSE 0.000500000023748726 9 +1 1 EK2_GYRO_P_NSE 0.029999999329447746 9 +1 1 EK2_HGT_DELAY 60 4 +1 1 EK2_HGT_I_GATE 500 4 +1 1 EK2_IMU_MASK 3 2 +1 1 EK2_LOG_MASK 1 2 +1 1 EK2_MAGB_P_NSE 0.000099999997473788 9 +1 1 EK2_MAGE_P_NSE 0.001000000047497451 9 +1 1 EK2_MAG_CAL 3 2 +1 1 EK2_MAG_I_GATE 300 4 +1 1 EK2_MAG_MASK 0 2 +1 1 EK2_MAG_M_NSE 0.050000000745058060 9 +1 1 EK2_MAX_FLOW 2.500000000000000000 9 +1 1 EK2_NOAID_M_NSE 10.000000000000000000 9 +1 1 EK2_POSNE_M_NSE 1.000000000000000000 9 +1 1 EK2_POS_I_GATE 500 4 +1 1 EK2_RNG_I_GATE 500 4 +1 1 EK2_RNG_M_NSE 0.500000000000000000 9 +1 1 EK2_RNG_USE_HGT -1 2 +1 1 EK2_RNG_USE_SPD 2.000000000000000000 9 +1 1 EK2_TAU_OUTPUT 25 2 +1 1 EK2_TERR_GRAD 0.100000001490116119 9 +1 1 EK2_VELD_M_NSE 0.699999988079071045 9 +1 1 EK2_VELNE_M_NSE 0.500000000000000000 9 +1 1 EK2_VEL_I_GATE 500 4 +1 1 EK2_WIND_PSCALE 0.500000000000000000 9 +1 1 EK2_WIND_P_NSE 0.100000001490116119 9 +1 1 EK2_YAW_I_GATE 300 4 +1 1 EK2_YAW_M_NSE 0.500000000000000000 9 +1 1 EK3_ENABLE 0 2 +1 1 ESC_CALIBRATION 0 2 +1 1 FENCE_ACTION 1 2 +1 1 FENCE_ALT_MAX 100.000000000000000000 9 +1 1 FENCE_ENABLE 1 2 +1 1 FENCE_MARGIN 2.000000000000000000 9 +1 1 FENCE_RADIUS 300.000000000000000000 9 +1 1 FENCE_TOTAL 0 2 +1 1 FENCE_TYPE 3 2 +1 1 FLOW_BUS_ID 0 2 +1 1 FLOW_ENABLE 0 2 +1 1 FLOW_FXSCALER 0 4 +1 1 FLOW_FYSCALER 0 4 +1 1 FLOW_ORIENT_YAW 0 4 +1 1 FLOW_POS_X 0.000000000000000000 9 +1 1 FLOW_POS_Y 0.000000000000000000 9 +1 1 FLOW_POS_Z 0.000000000000000000 9 +1 1 FLTMODE1 0 2 +1 1 FLTMODE2 5 2 +1 1 FLTMODE3 3 2 +1 1 FLTMODE4 6 2 +1 1 FLTMODE5 6 2 +1 1 FLTMODE6 6 2 +1 1 FRAME_CLASS 1 2 +1 1 FRAME_TYPE 2 2 +1 1 FS_BATT_ENABLE 1 2 +1 1 FS_BATT_MAH 0.000000000000000000 9 +1 1 FS_BATT_VOLTAGE 10.500000000000000000 9 +1 1 FS_CRASH_CHECK 1 2 +1 1 FS_EKF_ACTION 1 2 +1 1 FS_EKF_THRESH 0.800000011920928955 9 +1 1 FS_GCS_ENABLE 1 2 +1 1 FS_THR_ENABLE 1 2 +1 1 FS_THR_VALUE 975 4 +1 1 GCS_PID_MASK 0 4 +1 1 GND_ABS_PRESS 101975.898437500000000000 9 +1 1 GND_ABS_PRESS2 0.000000000000000000 9 +1 1 GND_ABS_PRESS3 0.000000000000000000 9 +1 1 GND_ALT_OFFSET 0.000000000000000000 9 +1 1 GND_EFFECT_COMP 0 2 +1 1 GND_EXT_BUS -1 2 +1 1 GND_PRIMARY 0 2 +1 1 GND_TEMP 0.000000000000000000 9 +1 1 GPS_AUTO_CONFIG 1 2 +1 1 GPS_AUTO_SWITCH 1 2 +1 1 GPS_BLEND_MASK 5 2 +1 1 GPS_BLEND_TC 10.000000000000000000 9 +1 1 GPS_DELAY_MS 0 4 +1 1 GPS_DELAY_MS2 0 4 +1 1 GPS_GNSS_MODE 0 2 +1 1 GPS_GNSS_MODE2 0 2 +1 1 GPS_HDOP_GOOD 250 4 +1 1 GPS_INJECT_TO 127 2 +1 1 GPS_MIN_DGPS 100 2 +1 1 GPS_MIN_ELEV -100 2 +1 1 GPS_NAVFILTER 8 2 +1 1 GPS_POS1_X 0.000000000000000000 9 +1 1 GPS_POS1_Y 0.000000000000000000 9 +1 1 GPS_POS1_Z 0.000000000000000000 9 +1 1 GPS_POS2_X 0.000000000000000000 9 +1 1 GPS_POS2_Y 0.000000000000000000 9 +1 1 GPS_POS2_Z 0.000000000000000000 9 +1 1 GPS_RATE_MS 200 4 +1 1 GPS_RATE_MS2 200 4 +1 1 GPS_RAW_DATA 0 2 +1 1 GPS_SAVE_CFG 0 2 +1 1 GPS_SBAS_MODE 2 2 +1 1 GPS_SBP_LOGMASK -256 4 +1 1 GPS_TYPE 1 2 +1 1 GPS_TYPE2 0 2 +1 1 GRIP_ENABLE 0 2 +1 1 INS_ACC2OFFS_X 0.465681284666061401 9 +1 1 INS_ACC2OFFS_Y -0.163094490766525269 9 +1 1 INS_ACC2OFFS_Z 0.841708540916442871 9 +1 1 INS_ACC2SCAL_X 1.025157928466796875 9 +1 1 INS_ACC2SCAL_Y 1.017194271087646484 9 +1 1 INS_ACC2SCAL_Z 1.034052014350891113 9 +1 1 INS_ACC2_ID 1114634 6 +1 1 INS_ACC3OFFS_X 0.000000000000000000 9 +1 1 INS_ACC3OFFS_Y 0.000000000000000000 9 +1 1 INS_ACC3OFFS_Z 0.000000000000000000 9 +1 1 INS_ACC3SCAL_X 0.000000000000000000 9 +1 1 INS_ACC3SCAL_Y 0.000000000000000000 9 +1 1 INS_ACC3SCAL_Z 0.000000000000000000 9 +1 1 INS_ACC3_ID 0 6 +1 1 INS_ACCEL_FILTER 20 2 +1 1 INS_ACCOFFS_X -0.064211823046207428 9 +1 1 INS_ACCOFFS_Y -0.180485680699348450 9 +1 1 INS_ACCOFFS_Z -0.311422348022460938 9 +1 1 INS_ACCSCAL_X 0.995959579944610596 9 +1 1 INS_ACCSCAL_Y 1.004220247268676758 9 +1 1 INS_ACCSCAL_Z 0.992680013179779053 9 +1 1 INS_ACC_BODYFIX 2 2 +1 1 INS_ACC_ID 1246218 6 +1 1 INS_FAST_SAMPLE 0 2 +1 1 INS_GYR2OFFS_X 0.033170118927955627 9 +1 1 INS_GYR2OFFS_Y -0.008167488500475883 9 +1 1 INS_GYR2OFFS_Z -0.009966009296476841 9 +1 1 INS_GYR2_ID 2228490 6 +1 1 INS_GYR3OFFS_X 0.000000000000000000 9 +1 1 INS_GYR3OFFS_Y 0.000000000000000000 9 +1 1 INS_GYR3OFFS_Z 0.000000000000000000 9 +1 1 INS_GYR3_ID 0 6 +1 1 INS_GYROFFS_X -0.020668458193540573 9 +1 1 INS_GYROFFS_Y 0.071772724390029907 9 +1 1 INS_GYROFFS_Z -0.002931264694780111 9 +1 1 INS_GYRO_FILTER 20 2 +1 1 INS_GYR_CAL 1 2 +1 1 INS_GYR_ID 2163722 6 +1 1 INS_POS1_X 0.000000000000000000 9 +1 1 INS_POS1_Y 0.000000000000000000 9 +1 1 INS_POS1_Z 0.000000000000000000 9 +1 1 INS_POS2_X 0.000000000000000000 9 +1 1 INS_POS2_Y 0.000000000000000000 9 +1 1 INS_POS2_Z 0.000000000000000000 9 +1 1 INS_POS3_X 0.000000000000000000 9 +1 1 INS_POS3_Y 0.000000000000000000 9 +1 1 INS_POS3_Z 0.000000000000000000 9 +1 1 INS_PRODUCT_ID 5 4 +1 1 INS_STILL_THRESH 2.500000000000000000 9 +1 1 INS_TRIM_OPTION 1 2 +1 1 INS_USE 1 2 +1 1 INS_USE2 1 2 +1 1 INS_USE3 0 2 +1 1 LAND_REPOSITION 1 2 +1 1 LAND_SPEED 50 4 +1 1 LAND_SPEED_HIGH 0 4 +1 1 LGR_SERVO_DEPLOY 1750 4 +1 1 LGR_SERVO_RTRACT 1250 4 +1 1 LOG_BACKEND_TYPE 1 2 +1 1 LOG_BITMASK 176126 6 +1 1 LOG_DISARMED 0 2 +1 1 LOG_FILE_BUFSIZE 16 2 +1 1 LOG_FILE_DSRMROT 0 2 +1 1 LOG_REPLAY 0 2 +1 1 MAG_ENABLE 1 2 +1 1 MIS_RESTART 0 2 +1 1 MIS_TOTAL 0 4 +1 1 MNT_ANGMAX_PAN 4500 4 +1 1 MNT_ANGMAX_ROL 4500 4 +1 1 MNT_ANGMAX_TIL 0 4 +1 1 MNT_ANGMIN_PAN -4500 4 +1 1 MNT_ANGMIN_ROL -4500 4 +1 1 MNT_ANGMIN_TIL -9000 4 +1 1 MNT_DEFLT_MODE 3 2 +1 1 MNT_JSTICK_SPD 0 2 +1 1 MNT_LEAD_PTCH 0.000000000000000000 9 +1 1 MNT_LEAD_RLL 0.000000000000000000 9 +1 1 MNT_NEUTRAL_X 0.000000000000000000 9 +1 1 MNT_NEUTRAL_Y 0.000000000000000000 9 +1 1 MNT_NEUTRAL_Z 0.000000000000000000 9 +1 1 MNT_RC_IN_PAN 0 2 +1 1 MNT_RC_IN_ROLL 0 2 +1 1 MNT_RC_IN_TILT 6 2 +1 1 MNT_RETRACT_X 0.000000000000000000 9 +1 1 MNT_RETRACT_Y 0.000000000000000000 9 +1 1 MNT_RETRACT_Z 0.000000000000000000 9 +1 1 MNT_STAB_PAN 0 2 +1 1 MNT_STAB_ROLL 0 2 +1 1 MNT_STAB_TILT 0 2 +1 1 MNT_TYPE 1 2 +1 1 MOT_BAT_CURR_MAX 0.000000000000000000 9 +1 1 MOT_BAT_CURR_TC 5.000000000000000000 9 +1 1 MOT_BAT_VOLT_MAX 0.000000000000000000 9 +1 1 MOT_BAT_VOLT_MIN 0.000000000000000000 9 +1 1 MOT_HOVER_LEARN 2 2 +1 1 MOT_PWM_MAX 0 4 +1 1 MOT_PWM_MIN 0 4 +1 1 MOT_PWM_TYPE 0 2 +1 1 MOT_SAFE_DISARM 0 2 +1 1 MOT_SPIN_ARM 0.100000001490116119 9 +1 1 MOT_SPIN_MAX 0.949999988079071045 9 +1 1 MOT_SPIN_MIN 0.150000005960464478 9 +1 1 MOT_SPOOL_TIME 0.500000000000000000 9 +1 1 MOT_THST_EXPO 0.649999976158142090 9 +1 1 MOT_THST_HOVER 0.472181797027587891 9 +1 1 MOT_YAW_HEADROOM 200 4 +1 1 NTF_BUZZ_ENABLE 1 2 +1 1 NTF_DISPLAY_TYPE 0 2 +1 1 NTF_LED_BRIGHT 3 2 +1 1 NTF_LED_OVERRIDE 0 2 +1 1 PHLD_BRAKE_ANGLE 3000 4 +1 1 PHLD_BRAKE_RATE 8 4 +1 1 PILOT_ACCEL_Z 250 4 +1 1 PILOT_THR_BHV 0 4 +1 1 PILOT_THR_FILT 0.000000000000000000 9 +1 1 PILOT_TKOFF_ALT 0.000000000000000000 9 +1 1 PILOT_TKOFF_DZ 100 4 +1 1 PILOT_VELZ_MAX 250 4 +1 1 PLND_ENABLED 0 2 +1 1 POS_XY_P 1.000000000000000000 9 +1 1 POS_Z_P 1.000000000000000000 9 +1 1 PRX_IGN_ANG1 0 4 +1 1 PRX_IGN_ANG2 0 4 +1 1 PRX_IGN_ANG3 0 4 +1 1 PRX_IGN_ANG4 0 4 +1 1 PRX_IGN_ANG5 0 4 +1 1 PRX_IGN_ANG6 0 4 +1 1 PRX_IGN_WID1 0 2 +1 1 PRX_IGN_WID2 0 2 +1 1 PRX_IGN_WID3 0 2 +1 1 PRX_IGN_WID4 0 2 +1 1 PRX_IGN_WID5 0 2 +1 1 PRX_IGN_WID6 0 2 +1 1 PRX_ORIENT 0 2 +1 1 PRX_TYPE 0 2 +1 1 PRX_YAW_CORR 22 4 +1 1 PSC_ACC_XY_FILT 2.000000000000000000 9 +1 1 RALLY_INCL_HOME 1 2 +1 1 RALLY_LIMIT_KM 0.300000011920928955 9 +1 1 RALLY_TOTAL 0 2 +1 1 RC10_DZ 0 4 +1 1 RC10_MAX 2000 4 +1 1 RC10_MIN 1000 4 +1 1 RC10_REVERSED 0 2 +1 1 RC10_TRIM 1500 4 +1 1 RC11_DZ 0 4 +1 1 RC11_MAX 2000 4 +1 1 RC11_MIN 1000 4 +1 1 RC11_REVERSED 0 2 +1 1 RC11_TRIM 1500 4 +1 1 RC12_DZ 0 4 +1 1 RC12_MAX 2000 4 +1 1 RC12_MIN 1000 4 +1 1 RC12_REVERSED 0 2 +1 1 RC12_TRIM 1500 4 +1 1 RC13_DZ 0 4 +1 1 RC13_MAX 2000 4 +1 1 RC13_MIN 1000 4 +1 1 RC13_REVERSED 0 2 +1 1 RC13_TRIM 1500 4 +1 1 RC14_DZ 0 4 +1 1 RC14_MAX 2000 4 +1 1 RC14_MIN 1000 4 +1 1 RC14_REVERSED 0 2 +1 1 RC14_TRIM 1500 4 +1 1 RC15_DZ 0 4 +1 1 RC15_MAX 1900 4 +1 1 RC15_MIN 1100 4 +1 1 RC15_REVERSED 0 2 +1 1 RC15_TRIM 1500 4 +1 1 RC16_DZ 0 4 +1 1 RC16_MAX 1900 4 +1 1 RC16_MIN 1100 4 +1 1 RC16_REVERSED 0 2 +1 1 RC16_TRIM 1500 4 +1 1 RC1_DZ 10 4 +1 1 RC1_MAX 2014 4 +1 1 RC1_MIN 990 4 +1 1 RC1_REVERSED 0 2 +1 1 RC1_TRIM 1503 4 +1 1 RC2_DZ 10 4 +1 1 RC2_MAX 2015 4 +1 1 RC2_MIN 991 4 +1 1 RC2_REVERSED 0 2 +1 1 RC2_TRIM 1504 4 +1 1 RC3_DZ 30 4 +1 1 RC3_MAX 2016 4 +1 1 RC3_MIN 992 4 +1 1 RC3_REVERSED 0 2 +1 1 RC3_TRIM 992 4 +1 1 RC4_DZ 10 4 +1 1 RC4_MAX 2015 4 +1 1 RC4_MIN 992 4 +1 1 RC4_REVERSED 0 2 +1 1 RC4_TRIM 1501 4 +1 1 RC5_DZ 0 4 +1 1 RC5_MAX 2016 4 +1 1 RC5_MIN 991 4 +1 1 RC5_REVERSED 0 2 +1 1 RC5_TRIM 1503 4 +1 1 RC6_DZ 0 4 +1 1 RC6_MAX 2016 4 +1 1 RC6_MIN 991 4 +1 1 RC6_REVERSED 0 2 +1 1 RC6_TRIM 1503 4 +1 1 RC7_DZ 0 4 +1 1 RC7_MAX 2016 4 +1 1 RC7_MIN 991 4 +1 1 RC7_REVERSED 0 2 +1 1 RC7_TRIM 1503 4 +1 1 RC8_DZ 0 4 +1 1 RC8_MAX 2015 4 +1 1 RC8_MIN 991 4 +1 1 RC8_REVERSED 0 2 +1 1 RC8_TRIM 1503 4 +1 1 RC9_DZ 0 4 +1 1 RC9_MAX 2000 4 +1 1 RC9_MIN 1000 4 +1 1 RC9_REVERSED 0 2 +1 1 RC9_TRIM 1500 4 +1 1 RCMAP_PITCH 2 2 +1 1 RCMAP_ROLL 1 2 +1 1 RCMAP_THROTTLE 3 2 +1 1 RCMAP_YAW 4 2 +1 1 RC_FEEL_RP 25 2 +1 1 RC_SPEED 490 4 +1 1 RELAY_DEFAULT 0 2 +1 1 RELAY_PIN 54 2 +1 1 RELAY_PIN2 55 2 +1 1 RELAY_PIN3 -1 2 +1 1 RELAY_PIN4 -1 2 +1 1 RNGFND2_ADDR 0 2 +1 1 RNGFND2_FUNCTION 0 2 +1 1 RNGFND2_GNDCLEAR 10 2 +1 1 RNGFND2_MAX_CM 700 4 +1 1 RNGFND2_MIN_CM 20 4 +1 1 RNGFND2_OFFSET 0.000000000000000000 9 +1 1 RNGFND2_ORIENT 25 2 +1 1 RNGFND2_PIN -1 2 +1 1 RNGFND2_POS_X 0.000000000000000000 9 +1 1 RNGFND2_POS_Y 0.000000000000000000 9 +1 1 RNGFND2_POS_Z 0.000000000000000000 9 +1 1 RNGFND2_RMETRIC 1 2 +1 1 RNGFND2_SCALING 3.000000000000000000 9 +1 1 RNGFND2_SETTLE 0 4 +1 1 RNGFND2_STOP_PIN -1 2 +1 1 RNGFND2_TYPE 0 2 +1 1 RNGFND_ADDR 0 2 +1 1 RNGFND_FUNCTION 0 2 +1 1 RNGFND_GAIN 0.800000011920928955 9 +1 1 RNGFND_GNDCLEAR 10 2 +1 1 RNGFND_MAX_CM 700 4 +1 1 RNGFND_MIN_CM 20 4 +1 1 RNGFND_OFFSET 0.000000000000000000 9 +1 1 RNGFND_ORIENT 25 2 +1 1 RNGFND_PIN -1 2 +1 1 RNGFND_POS_X 0.000000000000000000 9 +1 1 RNGFND_POS_Y 0.000000000000000000 9 +1 1 RNGFND_POS_Z 0.000000000000000000 9 +1 1 RNGFND_PWRRNG 0 4 +1 1 RNGFND_RMETRIC 1 2 +1 1 RNGFND_SCALING 3.000000000000000000 9 +1 1 RNGFND_SETTLE 0 4 +1 1 RNGFND_STOP_PIN -1 2 +1 1 RNGFND_TYPE 0 2 +1 1 RPM2_PIN -1 2 +1 1 RPM2_SCALING 1.000000000000000000 9 +1 1 RPM2_TYPE 0 2 +1 1 RPM_MAX 100000.000000000000000000 9 +1 1 RPM_MIN 10.000000000000000000 9 +1 1 RPM_MIN_QUAL 0.500000000000000000 9 +1 1 RPM_PIN 54 2 +1 1 RPM_SCALING 1.000000000000000000 9 +1 1 RPM_TYPE 0 2 +1 1 RSSI_ANA_PIN 0 2 +1 1 RSSI_CHANNEL 0 2 +1 1 RSSI_CHAN_HIGH 2000 4 +1 1 RSSI_CHAN_LOW 1000 4 +1 1 RSSI_PIN_HIGH 5.000000000000000000 9 +1 1 RSSI_PIN_LOW 0.000000000000000000 9 +1 1 RSSI_TYPE 0 2 +1 1 RTL_ALT 100 4 +1 1 RTL_ALT_FINAL 0 4 +1 1 RTL_CLIMB_MIN 0 4 +1 1 RTL_CONE_SLOPE 3.000000000000000000 9 +1 1 RTL_LOIT_TIME 5000 6 +1 1 RTL_SPEED 0 4 +1 1 SCHED_DEBUG 0 2 +1 1 SCHED_LOOP_RATE 400 4 +1 1 SERIAL0_BAUD 115 6 +1 1 SERIAL0_PROTOCOL 1 2 +1 1 SERIAL1_BAUD 57 6 +1 1 SERIAL1_PROTOCOL 1 2 +1 1 SERIAL2_BAUD 9 6 +1 1 SERIAL2_PROTOCOL 3 2 +1 1 SERIAL3_BAUD 38 6 +1 1 SERIAL3_PROTOCOL 5 2 +1 1 SERIAL4_BAUD 38 6 +1 1 SERIAL4_PROTOCOL 5 2 +1 1 SERIAL5_BAUD 57 6 +1 1 SERIAL5_PROTOCOL -1 2 +1 1 SERVO10_FUNCTION 0 2 +1 1 SERVO10_MAX 2000 4 +1 1 SERVO10_MIN 1000 4 +1 1 SERVO10_REVERSED 0 2 +1 1 SERVO10_TRIM 1500 4 +1 1 SERVO11_FUNCTION 0 2 +1 1 SERVO11_MAX 2000 4 +1 1 SERVO11_MIN 1000 4 +1 1 SERVO11_REVERSED 0 2 +1 1 SERVO11_TRIM 1500 4 +1 1 SERVO12_FUNCTION 0 2 +1 1 SERVO12_MAX 2000 4 +1 1 SERVO12_MIN 1000 4 +1 1 SERVO12_REVERSED 0 2 +1 1 SERVO12_TRIM 1500 4 +1 1 SERVO13_FUNCTION 0 2 +1 1 SERVO13_MAX 2000 4 +1 1 SERVO13_MIN 1000 4 +1 1 SERVO13_REVERSED 0 2 +1 1 SERVO13_TRIM 1500 4 +1 1 SERVO14_FUNCTION 0 2 +1 1 SERVO14_MAX 2000 4 +1 1 SERVO14_MIN 1000 4 +1 1 SERVO14_REVERSED 0 2 +1 1 SERVO14_TRIM 1500 4 +1 1 SERVO15_FUNCTION 0 2 +1 1 SERVO15_MAX 1900 4 +1 1 SERVO15_MIN 1100 4 +1 1 SERVO15_REVERSED 0 2 +1 1 SERVO15_TRIM 1500 4 +1 1 SERVO16_FUNCTION 0 2 +1 1 SERVO16_MAX 1900 4 +1 1 SERVO16_MIN 1100 4 +1 1 SERVO16_REVERSED 0 2 +1 1 SERVO16_TRIM 1500 4 +1 1 SERVO1_FUNCTION 33 2 +1 1 SERVO1_MAX 2015 4 +1 1 SERVO1_MIN 991 4 +1 1 SERVO1_REVERSED 0 2 +1 1 SERVO1_TRIM 1503 4 +1 1 SERVO2_FUNCTION 34 2 +1 1 SERVO2_MAX 2016 4 +1 1 SERVO2_MIN 991 4 +1 1 SERVO2_REVERSED 0 2 +1 1 SERVO2_TRIM 1503 4 +1 1 SERVO3_FUNCTION 35 2 +1 1 SERVO3_MAX 2016 4 +1 1 SERVO3_MIN 992 4 +1 1 SERVO3_REVERSED 0 2 +1 1 SERVO3_TRIM 992 4 +1 1 SERVO4_FUNCTION 36 2 +1 1 SERVO4_MAX 2015 4 +1 1 SERVO4_MIN 991 4 +1 1 SERVO4_REVERSED 0 2 +1 1 SERVO4_TRIM 1503 4 +1 1 SERVO5_FUNCTION 0 2 +1 1 SERVO5_MAX 2016 4 +1 1 SERVO5_MIN 991 4 +1 1 SERVO5_REVERSED 0 2 +1 1 SERVO5_TRIM 1503 4 +1 1 SERVO6_FUNCTION 0 2 +1 1 SERVO6_MAX 2016 4 +1 1 SERVO6_MIN 991 4 +1 1 SERVO6_REVERSED 0 2 +1 1 SERVO6_TRIM 1503 4 +1 1 SERVO7_FUNCTION 0 2 +1 1 SERVO7_MAX 2016 4 +1 1 SERVO7_MIN 991 4 +1 1 SERVO7_REVERSED 0 2 +1 1 SERVO7_TRIM 1503 4 +1 1 SERVO8_FUNCTION 0 2 +1 1 SERVO8_MAX 2000 4 +1 1 SERVO8_MIN 1000 4 +1 1 SERVO8_REVERSED 0 2 +1 1 SERVO8_TRIM 1500 4 +1 1 SERVO9_FUNCTION 7 2 +1 1 SERVO9_MAX 2000 4 +1 1 SERVO9_MIN 1000 4 +1 1 SERVO9_REVERSED 0 2 +1 1 SERVO9_TRIM 1500 4 +1 1 SERVO_CANESC_BM 0 6 +1 1 SERVO_CANSRV_BM 0 6 +1 1 SIMPLE 0 2 +1 1 SPRAY_ENABLE 0 2 +1 1 SR0_ADSB 5 4 +1 1 SR0_EXTRA1 0 4 +1 1 SR0_EXTRA2 0 4 +1 1 SR0_EXTRA3 0 4 +1 1 SR0_EXT_STAT 0 4 +1 1 SR0_PARAMS 0 4 +1 1 SR0_POSITION 0 4 +1 1 SR0_RAW_CTRL 0 4 +1 1 SR0_RAW_SENS 0 4 +1 1 SR0_RC_CHAN 0 4 +1 1 SR1_ADSB 5 4 +1 1 SR1_EXTRA1 10 4 +1 1 SR1_EXTRA2 10 4 +1 1 SR1_EXTRA3 3 4 +1 1 SR1_EXT_STAT 2 4 +1 1 SR1_PARAMS 10 4 +1 1 SR1_POSITION 3 4 +1 1 SR1_RAW_CTRL 0 4 +1 1 SR1_RAW_SENS 2 4 +1 1 SR1_RC_CHAN 2 4 +1 1 SR2_ADSB 5 4 +1 1 SR2_EXTRA1 0 4 +1 1 SR2_EXTRA2 0 4 +1 1 SR2_EXTRA3 0 4 +1 1 SR2_EXT_STAT 0 4 +1 1 SR2_PARAMS 0 4 +1 1 SR2_POSITION 0 4 +1 1 SR2_RAW_CTRL 0 4 +1 1 SR2_RAW_SENS 0 4 +1 1 SR2_RC_CHAN 0 4 +1 1 SR3_ADSB 5 4 +1 1 SR3_EXTRA1 0 4 +1 1 SR3_EXTRA2 0 4 +1 1 SR3_EXTRA3 0 4 +1 1 SR3_EXT_STAT 0 4 +1 1 SR3_PARAMS 0 4 +1 1 SR3_POSITION 0 4 +1 1 SR3_RAW_CTRL 0 4 +1 1 SR3_RAW_SENS 0 4 +1 1 SR3_RC_CHAN 0 4 +1 1 STAT_BOOTCNT 16 4 +1 1 STAT_FLTTIME 623 6 +1 1 STAT_RESET 20034978 6 +1 1 STAT_RUNTIME 3525 6 +1 1 SUPER_SIMPLE 0 2 +1 1 SYSID_ENFORCE 0 2 +1 1 SYSID_MYGCS 255 4 +1 1 SYSID_SW_MREV 120 4 +1 1 SYSID_SW_TYPE 10 2 +1 1 SYSID_THISMAV 1 4 +1 1 TELEM_DELAY 0 2 +1 1 TERRAIN_ENABLE 1 2 +1 1 TERRAIN_FOLLOW 0 2 +1 1 TERRAIN_SPACING 100 4 +1 1 THROW_MOT_START 0 2 +1 1 THROW_NEXTMODE 18 2 +1 1 THROW_TYPE 0 2 +1 1 THR_DZ 50 4 +1 1 TUNE 0 2 +1 1 TUNE_HIGH 1000 4 +1 1 TUNE_LOW 0 4 +1 1 VEL_XY_FILT_HZ 5.000000000000000000 9 +1 1 VEL_XY_I 0.500000000000000000 9 +1 1 VEL_XY_IMAX 1000.000000000000000000 9 +1 1 VEL_XY_P 1.000000000000000000 9 +1 1 VEL_Z_P 5.000000000000000000 9 +1 1 VISO_ORIENT 0 2 +1 1 VISO_POS_X 0.000000000000000000 9 +1 1 VISO_POS_Y 0.000000000000000000 9 +1 1 VISO_POS_Z 0.000000000000000000 9 +1 1 VISO_TYPE 0 2 +1 1 WPNAV_ACCEL 250.000000000000000000 9 +1 1 WPNAV_ACCEL_Z 100.000000000000000000 9 +1 1 WPNAV_LOIT_JERK 1000.000000000000000000 9 +1 1 WPNAV_LOIT_MAXA 250.000000000000000000 9 +1 1 WPNAV_LOIT_MINA 25.000000000000000000 9 +1 1 WPNAV_LOIT_SPEED 1000.000000000000000000 9 +1 1 WPNAV_RADIUS 200.000000000000000000 9 +1 1 WPNAV_RFND_USE 1 2 +1 1 WPNAV_SPEED 650.000000000000000000 9 +1 1 WPNAV_SPEED_DN 150.000000000000000000 9 +1 1 WPNAV_SPEED_UP 250.000000000000000000 9 +1 1 WP_NAVALT_MIN 0.000000000000000000 9 +1 1 WP_YAW_BEHAVIOR 2 2 diff --git a/app/src/main/cpp/Android.mk b/app/src/main/cpp/Android.mk new file mode 100644 index 0000000..6dbcacb --- /dev/null +++ b/app/src/main/cpp/Android.mk @@ -0,0 +1,22 @@ +CUR_LOCAL_PATH := $(call my-dir) +include $(all-subdir-makefiles) + + +# FFmpeg library +include $(CLEAR_VARS) +LOCAL_MODULE := ffmpegjni +LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libffmpeg.so +include $(PREBUILT_SHARED_LIBRARY) + + + +# Program +include $(CLEAR_VARS) +LOCAL_PATH := $(CUR_LOCAL_PATH) +PATH_TO_LIBFFMPEG_SO=$(LOCAL_PATH) +LOCAL_MODULE := djivideojni +LOCAL_SRC_FILES :=dji_video_jni.c +LOCAL_C_INCLUDES += $(LOCAL_PATH)/include +LOCAL_LDLIBS := -llog -lz +LOCAL_SHARED_LIBRARIES := ffmpegjni +include $(BUILD_SHARED_LIBRARY) diff --git a/app/src/main/cpp/Application.mk b/app/src/main/cpp/Application.mk new file mode 100644 index 0000000..2be9f56 --- /dev/null +++ b/app/src/main/cpp/Application.mk @@ -0,0 +1,3 @@ +NDK_TOOLCHAIN_VERSION = 4.9 +APP_ABI := armeabi-v7a x86 +APP_PLATFORM := android-16 \ No newline at end of file diff --git a/app/src/main/cpp/Application64.mk b/app/src/main/cpp/Application64.mk new file mode 100644 index 0000000..37e1421 --- /dev/null +++ b/app/src/main/cpp/Application64.mk @@ -0,0 +1,3 @@ +NDK_TOOLCHAIN_VERSION = 4.9 +APP_ABI := arm64-v8a +APP_PLATFORM := android-21 \ No newline at end of file diff --git a/app/src/main/cpp/cmdutils.h b/app/src/main/cpp/cmdutils.h new file mode 100644 index 0000000..eb049a3 --- /dev/null +++ b/app/src/main/cpp/cmdutils.h @@ -0,0 +1,609 @@ +/* + * Various utilities for command line tools + * copyright (c) 2003 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef FFMPEG_CMDUTILS_H +#define FFMPEG_CMDUTILS_H + +#include + +#include "config.h" +#include "libavcodec/avcodec.h" +#include "libavfilter/avfilter.h" +#include "libavformat/avformat.h" +#include "libswscale/swscale.h" + +#ifdef _WIN32 +#undef main /* We don't want SDL to override our main() */ +#endif + +/** + * program name, defined by the program for show_version(). + */ +extern const char program_name[]; + +/** + * program birth year, defined by the program for show_banner() + */ +extern const int program_birth_year; + +extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB]; +extern AVFormatContext *avformat_opts; +extern struct SwsContext *sws_opts; +extern AVDictionary *swr_opts; +extern AVDictionary *format_opts, *codec_opts, *resample_opts; +extern int hide_banner; + +/** + * Register a program-specific cleanup routine. + */ +void register_exit(void (*cb)(int ret)); + +/** + * Wraps exit with a program-specific cleanup routine. + */ +void exit_program(int ret) + +av_noreturn; + +/** + * Initialize the cmdutils option system, in particular + * allocate the *_opts contexts. + */ +void init_opts(void); + +/** + * Uninitialize the cmdutils option system, in particular + * free the *_opts contexts and their contents. + */ +void uninit_opts(void); + +/** + * Trivial log callback. + * Only suitable for opt_help and similar since it lacks prefix handling. + */ +void log_callback_help(void *ptr, int level, const char *fmt, va_list vl); + +/** + * Override the cpuflags. + */ +int opt_cpuflags(void *optctx, const char *opt, const char *arg); + +/** + * Fallback for options that are not explicitly handled, these will be + * parsed through AVOptions. + */ +int opt_default(void *optctx, const char *opt, const char *arg); + +/** + * Set the libav* libraries log level. + */ +int opt_loglevel(void *optctx, const char *opt, const char *arg); + +int opt_report(const char *opt); + +int opt_max_alloc(void *optctx, const char *opt, const char *arg); + +int opt_codec_debug(void *optctx, const char *opt, const char *arg); + +#if CONFIG_OPENCL +int opt_opencl(void *optctx, const char *opt, const char *arg); + +int opt_opencl_bench(void *optctx, const char *opt, const char *arg); +#endif + +/** + * Limit the execution time. + */ +int opt_timelimit(void *optctx, const char *opt, const char *arg); + +/** + * Parse a string and return its corresponding value as a double. + * Exit from the application if the string cannot be correctly + * parsed or the corresponding value is invalid. + * + * @param context the context of the value to be set (e.g. the + * corresponding command line option name) + * @param numstr the string to be parsed + * @param type the type (OPT_INT64 or OPT_FLOAT) as which the + * string should be parsed + * @param min the minimum valid accepted value + * @param max the maximum valid accepted value + */ +double parse_number_or_die(const char *context, const char *numstr, int type, + double min, double max); + +/** + * Parse a string specifying a time and return its corresponding + * value as a number of microseconds. Exit from the application if + * the string cannot be correctly parsed. + * + * @param context the context of the value to be set (e.g. the + * corresponding command line option name) + * @param timestr the string to be parsed + * @param is_duration a flag which tells how to interpret timestr, if + * not zero timestr is interpreted as a duration, otherwise as a + * date + * + * @see av_parse_time() + */ +int64_t parse_time_or_die(const char *context, const char *timestr, + int is_duration); + +typedef struct SpecifierOpt { + char *specifier; /**< stream/chapter/program/... specifier */ + union { + uint8_t *str; + int i; + int64_t i64; + float f; + double dbl; + } u; +} SpecifierOpt; + +typedef struct OptionDef { + const char *name; + int flags; +#define HAS_ARG 0x0001 +#define OPT_BOOL 0x0002 +#define OPT_EXPERT 0x0004 +#define OPT_STRING 0x0008 +#define OPT_VIDEO 0x0010 +#define OPT_AUDIO 0x0020 +#define OPT_INT 0x0080 +#define OPT_FLOAT 0x0100 +#define OPT_SUBTITLE 0x0200 +#define OPT_INT64 0x0400 +#define OPT_EXIT 0x0800 +#define OPT_DATA 0x1000 +#define OPT_PERFILE 0x2000 /* the option is per-file (currently ffmpeg-only). + implied by OPT_OFFSET or OPT_SPEC */ +#define OPT_OFFSET 0x4000 /* option is specified as an offset in a passed optctx */ +#define OPT_SPEC 0x8000 /* option is to be stored in an array of SpecifierOpt. + Implies OPT_OFFSET. Next element after the offset is + an int containing element count in the array. */ +#define OPT_TIME 0x10000 +#define OPT_DOUBLE 0x20000 +#define OPT_INPUT 0x40000 +#define OPT_OUTPUT 0x80000 + + union { + void *dst_ptr; + + int (*func_arg)(void *, const char *, const char *); + + size_t off; + } u; + + const char *help; + const char *argname; +} OptionDef; + +/** + * Print help for all options matching specified flags. + * + * @param options a list of options + * @param msg title of this group. Only printed if at least one option matches. + * @param req_flags print only options which have all those flags set. + * @param rej_flags don't print options which have any of those flags set. + * @param alt_flags print only options that have at least one of those flags set + */ +void show_help_options(const OptionDef *options, const char *msg, int req_flags, + int rej_flags, int alt_flags); + +/** + * Show help for all options with given flags in class and all its + * children. + */ +void show_help_children(const AVClass *class, int flags); + +/** + * Per-fftool specific help handler. Implemented in each + * fftool, called by show_help(). + */ +void show_help_default(const char *opt, const char *arg); + +/** + * Generic -h handler common to all fftools. + */ +int show_help(void *optctx, const char *opt, const char *arg); + +/** + * Parse the command line arguments. + * + * @param optctx an opaque options context + * @param argc number of command line arguments + * @param argv values of command line arguments + * @param options Array with the definitions required to interpret every + * option of the form: -option_name [argument] + * @param parse_arg_function Name of the function called to process every + * argument without a leading option name flag. NULL if such arguments do + * not have to be processed. + */ +void parse_options(void *optctx, int argc, char **argv, const OptionDef *options, + void (*parse_arg_function)(void *optctx, const char *)); + +/** + * Parse one given option. + * + * @return on success 1 if arg was consumed, 0 otherwise; negative number on error + */ +int parse_option(void *optctx, const char *opt, const char *arg, + const OptionDef *options); + +/** + * An option extracted from the commandline. + * Cannot use AVDictionary because of options like -map which can be + * used multiple times. + */ +typedef struct Option { + const OptionDef *opt; + const char *key; + const char *val; +} Option; + +typedef struct OptionGroupDef { + /**< group name */ + const char *name; + /** + * Option to be used as group separator. Can be NULL for groups which + * are terminated by a non-option argument (e.g. ffmpeg output files) + */ + const char *sep; + /** + * Option flags that must be set on each option that is + * applied to this group + */ + int flags; +} OptionGroupDef; + +typedef struct OptionGroup { + const OptionGroupDef *group_def; + const char *arg; + + Option *opts; + int nb_opts; + + AVDictionary *codec_opts; + AVDictionary *format_opts; + AVDictionary *resample_opts; + struct SwsContext *sws_opts; + AVDictionary *swr_opts; +} OptionGroup; + +/** + * A list of option groups that all have the same group type + * (e.g. input files or output files) + */ +typedef struct OptionGroupList { + const OptionGroupDef *group_def; + + OptionGroup *groups; + int nb_groups; +} OptionGroupList; + +typedef struct OptionParseContext { + OptionGroup global_opts; + + OptionGroupList *groups; + int nb_groups; + + /* parsing state */ + OptionGroup cur_group; +} OptionParseContext; + +/** + * Parse an options group and write results into optctx. + * + * @param optctx an app-specific options context. NULL for global options group + */ +int parse_optgroup(void *optctx, OptionGroup *g); + +/** + * Split the commandline into an intermediate form convenient for further + * processing. + * + * The commandline is assumed to be composed of options which either belong to a + * group (those with OPT_SPEC, OPT_OFFSET or OPT_PERFILE) or are global + * (everything else). + * + * A group (defined by an OptionGroupDef struct) is a sequence of options + * terminated by either a group separator option (e.g. -i) or a parameter that + * is not an option (doesn't start with -). A group without a separator option + * must always be first in the supplied groups list. + * + * All options within the same group are stored in one OptionGroup struct in an + * OptionGroupList, all groups with the same group definition are stored in one + * OptionGroupList in OptionParseContext.groups. The order of group lists is the + * same as the order of group definitions. + */ +int split_commandline(OptionParseContext *octx, int argc, char *argv[], + const OptionDef *options, + const OptionGroupDef *groups, int nb_groups); + +/** + * Free all allocated memory in an OptionParseContext. + */ +void uninit_parse_context(OptionParseContext *octx); + +/** + * Find the '-loglevel' option in the command line args and apply it. + */ +void parse_loglevel(int argc, char **argv, const OptionDef *options); + +/** + * Return index of option opt in argv or 0 if not found. + */ +int locate_option(int argc, char **argv, const OptionDef *options, + const char *optname); + +/** + * Check if the given stream matches a stream specifier. + * + * @param s Corresponding format context. + * @param st Stream from s to be checked. + * @param spec A stream specifier of the [v|a|s|d]:[\] form. + * + * @return 1 if the stream matches, 0 if it doesn't, <0 on error + */ +int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec); + +/** + * Filter out options for given codec. + * + * Create a new options dictionary containing only the options from + * opts which apply to the codec with ID codec_id. + * + * @param opts dictionary to place options in + * @param codec_id ID of the codec that should be filtered for + * @param s Corresponding format context. + * @param st A stream from s for which the options should be filtered. + * @param codec The particular codec for which the options should be filtered. + * If null, the default one is looked up according to the codec id. + * @return a pointer to the created dictionary + */ +AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id, + AVFormatContext *s, AVStream *st, AVCodec *codec); + +/** + * Setup AVCodecContext options for avformat_find_stream_info(). + * + * Create an array of dictionaries, one dictionary for each stream + * contained in s. + * Each dictionary will contain the options from codec_opts which can + * be applied to the corresponding stream codec context. + * + * @return pointer to the created array of dictionaries, NULL if it + * cannot be created + */ +AVDictionary **setup_find_stream_info_opts(AVFormatContext *s, + AVDictionary *codec_opts); + +/** + * Print an error message to stderr, indicating filename and a human + * readable description of the error code err. + * + * If strerror_r() is not available the use of this function in a + * multithreaded application may be unsafe. + * + * @see av_strerror() + */ +void print_error(const char *filename, int err); + +/** + * Print the program banner to stderr. The banner contents depend on the + * current version of the repository and of the libav* libraries used by + * the program. + */ +void show_banner(int argc, char **argv, const OptionDef *options); + +/** + * Print the version of the program to stdout. The version message + * depends on the current versions of the repository and of the libav* + * libraries. + * This option processing function does not utilize the arguments. + */ +int show_version(void *optctx, const char *opt, const char *arg); + +/** + * Print the build configuration of the program to stdout. The contents + * depend on the definition of FFMPEG_CONFIGURATION. + * This option processing function does not utilize the arguments. + */ +int show_buildconf(void *optctx, const char *opt, const char *arg); + +/** + * Print the license of the program to stdout. The license depends on + * the license of the libraries compiled into the program. + * This option processing function does not utilize the arguments. + */ +int show_license(void *optctx, const char *opt, const char *arg); + +/** + * Print a listing containing all the formats supported by the + * program (including devices). + * This option processing function does not utilize the arguments. + */ +int show_formats(void *optctx, const char *opt, const char *arg); + +/** + * Print a listing containing all the devices supported by the + * program. + * This option processing function does not utilize the arguments. + */ +int show_devices(void *optctx, const char *opt, const char *arg); + +#if CONFIG_AVDEVICE + +/** + * Print a listing containing audodetected sinks of the output device. + * Device name with options may be passed as an argument to limit results. + */ +int show_sinks(void *optctx, const char *opt, const char *arg); + +/** + * Print a listing containing audodetected sources of the input device. + * Device name with options may be passed as an argument to limit results. + */ +int show_sources(void *optctx, const char *opt, const char *arg); + +#endif + +/** + * Print a listing containing all the codecs supported by the + * program. + * This option processing function does not utilize the arguments. + */ +int show_codecs(void *optctx, const char *opt, const char *arg); + +/** + * Print a listing containing all the decoders supported by the + * program. + */ +int show_decoders(void *optctx, const char *opt, const char *arg); + +/** + * Print a listing containing all the encoders supported by the + * program. + */ +int show_encoders(void *optctx, const char *opt, const char *arg); + +/** + * Print a listing containing all the filters supported by the + * program. + * This option processing function does not utilize the arguments. + */ +int show_filters(void *optctx, const char *opt, const char *arg); + +/** + * Print a listing containing all the bit stream filters supported by the + * program. + * This option processing function does not utilize the arguments. + */ +int show_bsfs(void *optctx, const char *opt, const char *arg); + +/** + * Print a listing containing all the protocols supported by the + * program. + * This option processing function does not utilize the arguments. + */ +int show_protocols(void *optctx, const char *opt, const char *arg); + +/** + * Print a listing containing all the pixel formats supported by the + * program. + * This option processing function does not utilize the arguments. + */ +int show_pix_fmts(void *optctx, const char *opt, const char *arg); + +/** + * Print a listing containing all the standard channel layouts supported by + * the program. + * This option processing function does not utilize the arguments. + */ +int show_layouts(void *optctx, const char *opt, const char *arg); + +/** + * Print a listing containing all the sample formats supported by the + * program. + */ +int show_sample_fmts(void *optctx, const char *opt, const char *arg); + +/** + * Print a listing containing all the color names and values recognized + * by the program. + */ +int show_colors(void *optctx, const char *opt, const char *arg); + +/** + * Return a positive value if a line read from standard input + * starts with [yY], otherwise return 0. + */ +int read_yesno(void); + +/** + * Read the file with name filename, and put its content in a newly + * allocated 0-terminated buffer. + * + * @param filename file to read from + * @param bufptr location where pointer to buffer is returned + * @param size location where size of buffer is returned + * @return >= 0 in case of success, a negative value corresponding to an + * AVERROR error code in case of failure. + */ +int cmdutils_read_file(const char *filename, char **bufptr, size_t *size); + +/** + * Get a file corresponding to a preset file. + * + * If is_path is non-zero, look for the file in the path preset_name. + * Otherwise search for a file named arg.ffpreset in the directories + * $FFMPEG_DATADIR (if set), $HOME/.ffmpeg, and in the datadir defined + * at configuration time or in a "ffpresets" folder along the executable + * on win32, in that order. If no such file is found and + * codec_name is defined, then search for a file named + * codec_name-preset_name.avpreset in the above-mentioned directories. + * + * @param filename buffer where the name of the found filename is written + * @param filename_size size in bytes of the filename buffer + * @param preset_name name of the preset to search + * @param is_path tell if preset_name is a filename path + * @param codec_name name of the codec for which to look for the + * preset, may be NULL + */ +FILE *get_preset_file(char *filename, size_t filename_size, + const char *preset_name, int is_path, const char *codec_name); + +/** + * Realloc array to hold new_size elements of elem_size. + * Calls exit() on failure. + * + * @param array array to reallocate + * @param elem_size size in bytes of each element + * @param size new element count will be written here + * @param new_size number of elements to place in reallocated array + * @return reallocated array + */ +void *grow_array(void *array, int elem_size, int *size, int new_size); + +#define media_type_string av_get_media_type_string + +#define GROW_ARRAY(array, nb_elems)\ + array = grow_array(array, sizeof(*array), &nb_elems, nb_elems + 1) + +#define GET_PIX_FMT_NAME(pix_fmt)\ + const char *name = av_get_pix_fmt_name(pix_fmt); + +#define GET_SAMPLE_FMT_NAME(sample_fmt)\ + const char *name = av_get_sample_fmt_name(sample_fmt) + +#define GET_SAMPLE_RATE_NAME(rate)\ + char name[16];\ + snprintf(name, sizeof(name), "%d", rate); + +#define GET_CH_LAYOUT_NAME(ch_layout)\ + char name[16];\ + snprintf(name, sizeof(name), "0x%"PRIx64, ch_layout); + +#define GET_CH_LAYOUT_DESC(ch_layout)\ + char name[128];\ + av_get_channel_layout_string(name, sizeof(name), 0, ch_layout); + +#endif /* CMDUTILS_H */ diff --git a/app/src/main/cpp/config.h b/app/src/main/cpp/config.h new file mode 100644 index 0000000..6b83546 --- /dev/null +++ b/app/src/main/cpp/config.h @@ -0,0 +1,1858 @@ +/* Automatically generated by configure - do not modify! */ +#ifndef FFMPEG_CONFIG_H +#define FFMPEG_CONFIG_H +#define FFMPEG_CONFIGURATION "--target-os=linux --prefix=../android-lib-ff-full --enable-cross-compile --enable-runtime-cpudetect --disable-asm --arch=arm --cc=/home/leixiaohua1020/cdtworkspace/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc --cross-prefix=/home/leixiaohua1020/cdtworkspace/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --disable-stripping --nm=/home/leixiaohua1020/cdtworkspace/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-nm --sysroot=/home/leixiaohua1020/cdtworkspace/android-ndk-r9d/platforms/android-8/arch-arm --enable-gpl --enable-shared --disable-static --enable-nonfree --enable-version3 --enable-small --disable-vda --disable-iconv --enable-libx264 --enable-libfaac --enable-encoder=libx264 --enable-encoder=libfaac --enable-zlib --disable-ffprobe --disable-ffplay --disable-ffmpeg --disable-ffserver --disable-debug --extra-cflags='-I ../android-lib/include -fPIC -DANDROID -D__thumb__ -mthumb -Wfatal-errors -Wno-deprecated -mfloat-abi=softfp -marm -march=armv7-a' --extra-ldflags='-L ../android-lib/lib'" +#define FFMPEG_LICENSE "nonfree and unredistributable" +#define CONFIG_THIS_YEAR 2015 +#define FFMPEG_DATADIR "../android-lib-ff-full/share/ffmpeg" +#define AVCONV_DATADIR "../android-lib-ff-full/share/ffmpeg" +#define CC_IDENT "gcc 4.6 (GCC) 20120106 (prerelease)" +#define av_restrict restrict +#define EXTERN_PREFIX "" +#define EXTERN_ASM +#define BUILDSUF "" +#define SLIBSUF ".so" +#define HAVE_MMX2 HAVE_MMXEXT +#define SWS_MAX_FILTER_SIZE 256 +#define ARCH_AARCH64 0 +#define ARCH_ALPHA 0 +#define ARCH_ARM 0 +#define ARCH_AVR32 0 +#define ARCH_AVR32_AP 0 +#define ARCH_AVR32_UC 0 +#define ARCH_BFIN 0 +#define ARCH_IA64 0 +#define ARCH_M68K 0 +#define ARCH_MIPS 0 +#define ARCH_MIPS64 0 +#define ARCH_PARISC 0 +#define ARCH_PPC 0 +#define ARCH_PPC64 0 +#define ARCH_S390 0 +#define ARCH_SH4 0 +#define ARCH_SPARC 0 +#define ARCH_SPARC64 0 +#define ARCH_TILEGX 0 +#define ARCH_TILEPRO 0 +#define ARCH_TOMI 0 +#define ARCH_X86 0 +#define ARCH_X86_32 0 +#define ARCH_X86_64 0 +#define HAVE_ARMV5TE 0 +#define HAVE_ARMV6 0 +#define HAVE_ARMV6T2 0 +#define HAVE_ARMV8 0 +#define HAVE_NEON 0 +#define HAVE_VFP 0 +#define HAVE_VFPV3 0 +#define HAVE_SETEND 0 +#define HAVE_ALTIVEC 0 +#define HAVE_DCBZL 0 +#define HAVE_LDBRX 0 +#define HAVE_PPC4XX 0 +#define HAVE_VSX 0 +#define HAVE_AMD3DNOW 0 +#define HAVE_AMD3DNOWEXT 0 +#define HAVE_AVX 0 +#define HAVE_AVX2 0 +#define HAVE_FMA3 0 +#define HAVE_FMA4 0 +#define HAVE_MMX 0 +#define HAVE_MMXEXT 0 +#define HAVE_SSE 0 +#define HAVE_SSE2 0 +#define HAVE_SSE3 0 +#define HAVE_SSE4 0 +#define HAVE_SSE42 0 +#define HAVE_SSSE3 0 +#define HAVE_XOP 0 +#define HAVE_CPUNOP 0 +#define HAVE_I686 0 +#define HAVE_MIPSFPU 0 +#define HAVE_MIPS32R2 0 +#define HAVE_MIPSDSPR1 0 +#define HAVE_MIPSDSPR2 0 +#define HAVE_LOONGSON 0 +#define HAVE_ARMV5TE_EXTERNAL 1 +#define HAVE_ARMV6_EXTERNAL 1 +#define HAVE_ARMV6T2_EXTERNAL 1 +#define HAVE_ARMV8_EXTERNAL 0 +#define HAVE_NEON_EXTERNAL 0 +#define HAVE_VFP_EXTERNAL 1 +#define HAVE_VFPV3_EXTERNAL 0 +#define HAVE_SETEND_EXTERNAL 1 +#define HAVE_ALTIVEC_EXTERNAL 0 +#define HAVE_DCBZL_EXTERNAL 0 +#define HAVE_LDBRX_EXTERNAL 0 +#define HAVE_PPC4XX_EXTERNAL 0 +#define HAVE_VSX_EXTERNAL 0 +#define HAVE_AMD3DNOW_EXTERNAL 0 +#define HAVE_AMD3DNOWEXT_EXTERNAL 0 +#define HAVE_AVX_EXTERNAL 0 +#define HAVE_AVX2_EXTERNAL 0 +#define HAVE_FMA3_EXTERNAL 0 +#define HAVE_FMA4_EXTERNAL 0 +#define HAVE_MMX_EXTERNAL 0 +#define HAVE_MMXEXT_EXTERNAL 0 +#define HAVE_SSE_EXTERNAL 0 +#define HAVE_SSE2_EXTERNAL 0 +#define HAVE_SSE3_EXTERNAL 0 +#define HAVE_SSE4_EXTERNAL 0 +#define HAVE_SSE42_EXTERNAL 0 +#define HAVE_SSSE3_EXTERNAL 0 +#define HAVE_XOP_EXTERNAL 0 +#define HAVE_CPUNOP_EXTERNAL 0 +#define HAVE_I686_EXTERNAL 0 +#define HAVE_MIPSFPU_EXTERNAL 0 +#define HAVE_MIPS32R2_EXTERNAL 0 +#define HAVE_MIPSDSPR1_EXTERNAL 0 +#define HAVE_MIPSDSPR2_EXTERNAL 0 +#define HAVE_LOONGSON_EXTERNAL 0 +#define HAVE_ARMV5TE_INLINE 1 +#define HAVE_ARMV6_INLINE 1 +#define HAVE_ARMV6T2_INLINE 1 +#define HAVE_ARMV8_INLINE 0 +#define HAVE_NEON_INLINE 0 +#define HAVE_VFP_INLINE 1 +#define HAVE_VFPV3_INLINE 0 +#define HAVE_SETEND_INLINE 1 +#define HAVE_ALTIVEC_INLINE 0 +#define HAVE_DCBZL_INLINE 0 +#define HAVE_LDBRX_INLINE 0 +#define HAVE_PPC4XX_INLINE 0 +#define HAVE_VSX_INLINE 0 +#define HAVE_AMD3DNOW_INLINE 0 +#define HAVE_AMD3DNOWEXT_INLINE 0 +#define HAVE_AVX_INLINE 0 +#define HAVE_AVX2_INLINE 0 +#define HAVE_FMA3_INLINE 0 +#define HAVE_FMA4_INLINE 0 +#define HAVE_MMX_INLINE 0 +#define HAVE_MMXEXT_INLINE 0 +#define HAVE_SSE_INLINE 0 +#define HAVE_SSE2_INLINE 0 +#define HAVE_SSE3_INLINE 0 +#define HAVE_SSE4_INLINE 0 +#define HAVE_SSE42_INLINE 0 +#define HAVE_SSSE3_INLINE 0 +#define HAVE_XOP_INLINE 0 +#define HAVE_CPUNOP_INLINE 0 +#define HAVE_I686_INLINE 0 +#define HAVE_MIPSFPU_INLINE 0 +#define HAVE_MIPS32R2_INLINE 0 +#define HAVE_MIPSDSPR1_INLINE 0 +#define HAVE_MIPSDSPR2_INLINE 0 +#define HAVE_LOONGSON_INLINE 0 +#define HAVE_ALIGNED_STACK 0 +#define HAVE_FAST_64BIT 0 +#define HAVE_FAST_CLZ 1 +#define HAVE_FAST_CMOV 0 +#define HAVE_LOCAL_ALIGNED_8 0 +#define HAVE_LOCAL_ALIGNED_16 0 +#define HAVE_LOCAL_ALIGNED_32 0 +#define HAVE_SIMD_ALIGN_16 0 +#define HAVE_ATOMICS_GCC 1 +#define HAVE_ATOMICS_SUNCC 0 +#define HAVE_ATOMICS_WIN32 0 +#define HAVE_ATOMIC_CAS_PTR 0 +#define HAVE_ATOMIC_COMPARE_EXCHANGE 0 +#define HAVE_MACHINE_RW_BARRIER 0 +#define HAVE_MEMORYBARRIER 0 +#define HAVE_MM_EMPTY 0 +#define HAVE_RDTSC 0 +#define HAVE_SARESTART 1 +#define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1 +#define HAVE_INLINE_ASM 1 +#define HAVE_SYMVER 1 +#define HAVE_YASM 0 +#define HAVE_BIGENDIAN 0 +#define HAVE_FAST_UNALIGNED 1 +#define HAVE_INCOMPATIBLE_LIBAV_ABI 0 +#define HAVE_ALSA_ASOUNDLIB_H 0 +#define HAVE_ALTIVEC_H 0 +#define HAVE_ARPA_INET_H 1 +#define HAVE_ASM_TYPES_H 1 +#define HAVE_CDIO_PARANOIA_H 0 +#define HAVE_CDIO_PARANOIA_PARANOIA_H 0 +#define HAVE_DEV_BKTR_IOCTL_BT848_H 0 +#define HAVE_DEV_BKTR_IOCTL_METEOR_H 0 +#define HAVE_DEV_IC_BT8XX_H 0 +#define HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H 0 +#define HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H 0 +#define HAVE_DIRECT_H 0 +#define HAVE_DLFCN_H 1 +#define HAVE_DXVA_H 0 +#define HAVE_ES2_GL_H 0 +#define HAVE_GSM_H 0 +#define HAVE_IO_H 0 +#define HAVE_MACH_MACH_TIME_H 0 +#define HAVE_MACHINE_IOCTL_BT848_H 0 +#define HAVE_MACHINE_IOCTL_METEOR_H 0 +#define HAVE_MALLOC_H 1 +#define HAVE_OPENJPEG_1_5_OPENJPEG_H 0 +#define HAVE_OPENGL_GL3_H 0 +#define HAVE_POLL_H 1 +#define HAVE_SNDIO_H 0 +#define HAVE_SOUNDCARD_H 0 +#define HAVE_SYS_MMAN_H 1 +#define HAVE_SYS_PARAM_H 1 +#define HAVE_SYS_RESOURCE_H 1 +#define HAVE_SYS_SELECT_H 1 +#define HAVE_SYS_SOUNDCARD_H 0 +#define HAVE_SYS_TIME_H 1 +#define HAVE_SYS_UN_H 1 +#define HAVE_SYS_VIDEOIO_H 0 +#define HAVE_TERMIOS_H 1 +#define HAVE_UDPLITE_H 0 +#define HAVE_UNISTD_H 1 +#define HAVE_WINDOWS_H 0 +#define HAVE_WINSOCK2_H 0 +#define HAVE_INTRINSICS_NEON 0 +#define HAVE_ATANF 1 +#define HAVE_ATAN2F 1 +#define HAVE_CBRT 1 +#define HAVE_CBRTF 1 +#define HAVE_COSF 1 +#define HAVE_EXP2 1 +#define HAVE_EXP2F 1 +#define HAVE_EXPF 1 +#define HAVE_ISINF 1 +#define HAVE_ISNAN 1 +#define HAVE_LDEXPF 1 +#define HAVE_LLRINT 1 +#define HAVE_LLRINTF 1 +#define HAVE_LOG2 0 +#define HAVE_LOG2F 0 +#define HAVE_LOG10F 1 +#define HAVE_LRINT 1 +#define HAVE_LRINTF 1 +#define HAVE_POWF 1 +#define HAVE_RINT 1 +#define HAVE_ROUND 1 +#define HAVE_ROUNDF 1 +#define HAVE_SINF 1 +#define HAVE_TRUNC 1 +#define HAVE_TRUNCF 1 +#define HAVE_ACCESS 1 +#define HAVE_ALIGNED_MALLOC 0 +#define HAVE_CLOCK_GETTIME 1 +#define HAVE_CLOSESOCKET 0 +#define HAVE_COMMANDLINETOARGVW 0 +#define HAVE_COTASKMEMFREE 0 +#define HAVE_CRYPTGENRANDOM 0 +#define HAVE_DLOPEN 1 +#define HAVE_FCNTL 1 +#define HAVE_FLT_LIM 1 +#define HAVE_FORK 1 +#define HAVE_GETADDRINFO 1 +#define HAVE_GETHRTIME 0 +#define HAVE_GETOPT 1 +#define HAVE_GETPROCESSAFFINITYMASK 0 +#define HAVE_GETPROCESSMEMORYINFO 0 +#define HAVE_GETPROCESSTIMES 0 +#define HAVE_GETRUSAGE 1 +#define HAVE_GETSERVBYPORT 1 +#define HAVE_GETSYSTEMTIMEASFILETIME 0 +#define HAVE_GETTIMEOFDAY 1 +#define HAVE_GLOB 0 +#define HAVE_GLXGETPROCADDRESS 0 +#define HAVE_GMTIME_R 1 +#define HAVE_INET_ATON 1 +#define HAVE_ISATTY 1 +#define HAVE_JACK_PORT_GET_LATENCY_RANGE 0 +#define HAVE_KBHIT 0 +#define HAVE_LOCALTIME_R 1 +#define HAVE_LZO1X_999_COMPRESS 0 +#define HAVE_MACH_ABSOLUTE_TIME 0 +#define HAVE_MAPVIEWOFFILE 0 +#define HAVE_MEMALIGN 1 +#define HAVE_MKSTEMP 1 +#define HAVE_MMAP 1 +#define HAVE_MPROTECT 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_PEEKNAMEDPIPE 0 +#define HAVE_POSIX_MEMALIGN 0 +#define HAVE_PTHREAD_CANCEL 0 +#define HAVE_SCHED_GETAFFINITY 0 +#define HAVE_SETCONSOLETEXTATTRIBUTE 0 +#define HAVE_SETMODE 0 +#define HAVE_SETRLIMIT 1 +#define HAVE_SLEEP 0 +#define HAVE_STRERROR_R 1 +#define HAVE_SYSCONF 1 +#define HAVE_SYSCTL 0 +#define HAVE_USLEEP 1 +#define HAVE_VIRTUALALLOC 0 +#define HAVE_WGLGETPROCADDRESS 0 +#define HAVE_PTHREADS 1 +#define HAVE_OS2THREADS 0 +#define HAVE_W32THREADS 0 +#define HAVE_AS_DN_DIRECTIVE 1 +#define HAVE_AS_FUNC 0 +#define HAVE_AS_OBJECT_ARCH 1 +#define HAVE_ASM_MOD_Q 1 +#define HAVE_ATTRIBUTE_MAY_ALIAS 1 +#define HAVE_ATTRIBUTE_PACKED 1 +#define HAVE_EBP_AVAILABLE 0 +#define HAVE_EBX_AVAILABLE 0 +#define HAVE_GNU_AS 0 +#define HAVE_GNU_WINDRES 0 +#define HAVE_IBM_ASM 0 +#define HAVE_INLINE_ASM_LABELS 1 +#define HAVE_INLINE_ASM_NONLOCAL_LABELS 1 +#define HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS 0 +#define HAVE_PRAGMA_DEPRECATED 1 +#define HAVE_RSYNC_CONTIMEOUT 1 +#define HAVE_SYMVER_ASM_LABEL 0 +#define HAVE_SYMVER_GNU_ASM 1 +#define HAVE_VFP_ARGS 0 +#define HAVE_XFORM_ASM 0 +#define HAVE_XMM_CLOBBERS 0 +#define HAVE_CONDITION_VARIABLE_PTR 0 +#define HAVE_DXVA_PICPARAMS_HEVC 0 +#define HAVE_SOCKLEN_T 1 +#define HAVE_STRUCT_ADDRINFO 1 +#define HAVE_STRUCT_GROUP_SOURCE_REQ 1 +#define HAVE_STRUCT_IP_MREQ_SOURCE 1 +#define HAVE_STRUCT_IPV6_MREQ 1 +#define HAVE_STRUCT_POLLFD 1 +#define HAVE_STRUCT_RUSAGE_RU_MAXRSS 1 +#define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE 0 +#define HAVE_STRUCT_SOCKADDR_IN6 1 +#define HAVE_STRUCT_SOCKADDR_SA_LEN 0 +#define HAVE_STRUCT_SOCKADDR_STORAGE 1 +#define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 0 +#define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 0 +#define HAVE_ATOMICS_NATIVE 1 +#define HAVE_DOS_PATHS 0 +#define HAVE_DXVA2API_COBJ 0 +#define HAVE_DXVA2_LIB 0 +#define HAVE_LIBC_MSVCRT 0 +#define HAVE_LIBDC1394_1 0 +#define HAVE_LIBDC1394_2 0 +#define HAVE_MAKEINFO 1 +#define HAVE_MAKEINFO_HTML 1 +#define HAVE_PERL 1 +#define HAVE_POD2MAN 1 +#define HAVE_SDL 0 +#define HAVE_SECTION_DATA_REL_RO 1 +#define HAVE_TEXI2HTML 0 +#define HAVE_THREADS 1 +#define HAVE_VAAPI_X11 0 +#define HAVE_VDPAU_X11 0 +#define HAVE_XLIB 0 +#define CONFIG_BSFS 1 +#define CONFIG_DECODERS 1 +#define CONFIG_DEMUXERS 1 +#define CONFIG_ENCODERS 1 +#define CONFIG_FILTERS 1 +#define CONFIG_HWACCELS 0 +#define CONFIG_INDEVS 1 +#define CONFIG_MUXERS 1 +#define CONFIG_OUTDEVS 1 +#define CONFIG_PARSERS 1 +#define CONFIG_PROTOCOLS 1 +#define CONFIG_DOC 1 +#define CONFIG_HTMLPAGES 1 +#define CONFIG_MANPAGES 1 +#define CONFIG_PODPAGES 1 +#define CONFIG_TXTPAGES 1 +#define CONFIG_AVIO_READING_EXAMPLE 1 +#define CONFIG_DECODING_ENCODING_EXAMPLE 1 +#define CONFIG_DEMUXING_DECODING_EXAMPLE 1 +#define CONFIG_EXTRACT_MVS_EXAMPLE 1 +#define CONFIG_FILTER_AUDIO_EXAMPLE 1 +#define CONFIG_FILTERING_AUDIO_EXAMPLE 1 +#define CONFIG_FILTERING_VIDEO_EXAMPLE 1 +#define CONFIG_METADATA_EXAMPLE 1 +#define CONFIG_MUXING_EXAMPLE 1 +#define CONFIG_QSVDEC_EXAMPLE 0 +#define CONFIG_REMUXING_EXAMPLE 1 +#define CONFIG_RESAMPLING_AUDIO_EXAMPLE 1 +#define CONFIG_SCALING_VIDEO_EXAMPLE 1 +#define CONFIG_TRANSCODE_AAC_EXAMPLE 1 +#define CONFIG_TRANSCODING_EXAMPLE 1 +#define CONFIG_AVISYNTH 0 +#define CONFIG_BZLIB 0 +#define CONFIG_CRYSTALHD 0 +#define CONFIG_DECKLINK 0 +#define CONFIG_FREI0R 0 +#define CONFIG_GNUTLS 0 +#define CONFIG_ICONV 0 +#define CONFIG_LADSPA 0 +#define CONFIG_LIBAACPLUS 0 +#define CONFIG_LIBASS 0 +#define CONFIG_LIBBLURAY 0 +#define CONFIG_LIBBS2B 0 +#define CONFIG_LIBCACA 0 +#define CONFIG_LIBCDIO 0 +#define CONFIG_LIBCELT 0 +#define CONFIG_LIBDC1394 0 +#define CONFIG_LIBFAAC 1 +#define CONFIG_LIBFDK_AAC 0 +#define CONFIG_LIBFLITE 0 +#define CONFIG_LIBFONTCONFIG 0 +#define CONFIG_LIBFREETYPE 0 +#define CONFIG_LIBFRIBIDI 0 +#define CONFIG_LIBGME 0 +#define CONFIG_LIBGSM 0 +#define CONFIG_LIBIEC61883 0 +#define CONFIG_LIBILBC 0 +#define CONFIG_LIBMFX 0 +#define CONFIG_LIBMODPLUG 0 +#define CONFIG_LIBMP3LAME 0 +#define CONFIG_LIBNUT 0 +#define CONFIG_LIBOPENCORE_AMRNB 0 +#define CONFIG_LIBOPENCORE_AMRWB 0 +#define CONFIG_LIBOPENCV 0 +#define CONFIG_LIBOPENH264 0 +#define CONFIG_LIBOPENJPEG 0 +#define CONFIG_LIBOPUS 0 +#define CONFIG_LIBPULSE 0 +#define CONFIG_LIBQUVI 0 +#define CONFIG_LIBRTMP 0 +#define CONFIG_LIBSCHROEDINGER 0 +#define CONFIG_LIBSHINE 0 +#define CONFIG_LIBSMBCLIENT 0 +#define CONFIG_LIBSOXR 0 +#define CONFIG_LIBSPEEX 0 +#define CONFIG_LIBSSH 0 +#define CONFIG_LIBSTAGEFRIGHT_H264 0 +#define CONFIG_LIBTHEORA 0 +#define CONFIG_LIBTWOLAME 0 +#define CONFIG_LIBUTVIDEO 0 +#define CONFIG_LIBV4L2 0 +#define CONFIG_LIBVIDSTAB 0 +#define CONFIG_LIBVO_AACENC 0 +#define CONFIG_LIBVO_AMRWBENC 0 +#define CONFIG_LIBVORBIS 0 +#define CONFIG_LIBVPX 0 +#define CONFIG_LIBWAVPACK 0 +#define CONFIG_LIBWEBP 0 +#define CONFIG_LIBX264 1 +#define CONFIG_LIBX265 0 +#define CONFIG_LIBXAVS 0 +#define CONFIG_LIBXCB 0 +#define CONFIG_LIBXCB_SHM 0 +#define CONFIG_LIBXCB_SHAPE 0 +#define CONFIG_LIBXCB_XFIXES 0 +#define CONFIG_LIBXVID 0 +#define CONFIG_LIBZMQ 0 +#define CONFIG_LIBZVBI 0 +#define CONFIG_LZMA 0 +#define CONFIG_NVENC 0 +#define CONFIG_OPENAL 0 +#define CONFIG_OPENCL 0 +#define CONFIG_OPENGL 0 +#define CONFIG_OPENSSL 0 +#define CONFIG_SDL 0 +#define CONFIG_X11GRAB 0 +#define CONFIG_XLIB 0 +#define CONFIG_ZLIB 1 +#define CONFIG_FTRAPV 0 +#define CONFIG_GRAY 0 +#define CONFIG_HARDCODED_TABLES 0 +#define CONFIG_RUNTIME_CPUDETECT 1 +#define CONFIG_SAFE_BITSTREAM_READER 1 +#define CONFIG_SHARED 1 +#define CONFIG_SMALL 1 +#define CONFIG_STATIC 0 +#define CONFIG_SWSCALE_ALPHA 1 +#define CONFIG_DXVA2 0 +#define CONFIG_VAAPI 0 +#define CONFIG_VDA 0 +#define CONFIG_VDPAU 0 +#define CONFIG_XVMC 0 +#define CONFIG_GPL 1 +#define CONFIG_NONFREE 1 +#define CONFIG_VERSION3 1 +#define CONFIG_AVCODEC 1 +#define CONFIG_AVDEVICE 1 +#define CONFIG_AVFILTER 1 +#define CONFIG_AVFORMAT 1 +#define CONFIG_AVRESAMPLE 0 +#define CONFIG_AVUTIL 1 +#define CONFIG_POSTPROC 1 +#define CONFIG_SWRESAMPLE 1 +#define CONFIG_SWSCALE 1 +#define CONFIG_FFPLAY 0 +#define CONFIG_FFPROBE 0 +#define CONFIG_FFSERVER 0 +#define CONFIG_FFMPEG 0 +#define CONFIG_DCT 1 +#define CONFIG_DWT 1 +#define CONFIG_ERROR_RESILIENCE 1 +#define CONFIG_FAAN 1 +#define CONFIG_FAST_UNALIGNED 1 +#define CONFIG_FFT 1 +#define CONFIG_LSP 1 +#define CONFIG_LZO 1 +#define CONFIG_MDCT 1 +#define CONFIG_PIXELUTILS 1 +#define CONFIG_NETWORK 1 +#define CONFIG_QSV 0 +#define CONFIG_RDFT 1 +#define CONFIG_FONTCONFIG 0 +#define CONFIG_INCOMPATIBLE_LIBAV_ABI 0 +#define CONFIG_MEMALIGN_HACK 0 +#define CONFIG_MEMORY_POISONING 0 +#define CONFIG_NEON_CLOBBER_TEST 0 +#define CONFIG_PIC 1 +#define CONFIG_POD2MAN 1 +#define CONFIG_RAISE_MAJOR 0 +#define CONFIG_THUMB 1 +#define CONFIG_XMM_CLOBBER_TEST 0 +#define CONFIG_AANDCTTABLES 1 +#define CONFIG_AC3DSP 1 +#define CONFIG_AUDIO_FRAME_QUEUE 1 +#define CONFIG_AUDIODSP 1 +#define CONFIG_BLOCKDSP 1 +#define CONFIG_BSWAPDSP 1 +#define CONFIG_CABAC 1 +#define CONFIG_DVPROFILE 1 +#define CONFIG_EXIF 1 +#define CONFIG_FAANDCT 1 +#define CONFIG_FAANIDCT 1 +#define CONFIG_FDCTDSP 1 +#define CONFIG_FMTCONVERT 1 +#define CONFIG_FRAME_THREAD_ENCODER 1 +#define CONFIG_GCRYPT 0 +#define CONFIG_GOLOMB 1 +#define CONFIG_GPLV3 1 +#define CONFIG_H263DSP 1 +#define CONFIG_H264CHROMA 1 +#define CONFIG_H264DSP 1 +#define CONFIG_H264PRED 1 +#define CONFIG_H264QPEL 1 +#define CONFIG_HPELDSP 1 +#define CONFIG_HUFFMAN 1 +#define CONFIG_HUFFYUVDSP 1 +#define CONFIG_HUFFYUVENCDSP 1 +#define CONFIG_IDCTDSP 1 +#define CONFIG_IIRFILTER 1 +#define CONFIG_IMDCT15 1 +#define CONFIG_INTRAX8 1 +#define CONFIG_LGPLV3 0 +#define CONFIG_LLAUDDSP 1 +#define CONFIG_LLVIDDSP 1 +#define CONFIG_LPC 1 +#define CONFIG_ME_CMP 1 +#define CONFIG_MPEG_ER 1 +#define CONFIG_MPEGAUDIO 1 +#define CONFIG_MPEGAUDIODSP 1 +#define CONFIG_MPEGVIDEO 1 +#define CONFIG_MPEGVIDEOENC 1 +#define CONFIG_NETTLE 0 +#define CONFIG_PIXBLOCKDSP 1 +#define CONFIG_QPELDSP 1 +#define CONFIG_RANGECODER 1 +#define CONFIG_RIFFDEC 1 +#define CONFIG_RIFFENC 1 +#define CONFIG_RTPDEC 1 +#define CONFIG_RTPENC_CHAIN 1 +#define CONFIG_SINEWIN 1 +#define CONFIG_STARTCODE 1 +#define CONFIG_TPELDSP 1 +#define CONFIG_VIDEODSP 1 +#define CONFIG_VP3DSP 1 +#define CONFIG_WMA_FREQS 1 +#define CONFIG_AAC_ADTSTOASC_BSF 1 +#define CONFIG_CHOMP_BSF 1 +#define CONFIG_DUMP_EXTRADATA_BSF 1 +#define CONFIG_H264_MP4TOANNEXB_BSF 1 +#define CONFIG_IMX_DUMP_HEADER_BSF 1 +#define CONFIG_MJPEG2JPEG_BSF 1 +#define CONFIG_MJPEGA_DUMP_HEADER_BSF 1 +#define CONFIG_MP3_HEADER_DECOMPRESS_BSF 1 +#define CONFIG_MOV2TEXTSUB_BSF 1 +#define CONFIG_NOISE_BSF 1 +#define CONFIG_REMOVE_EXTRADATA_BSF 1 +#define CONFIG_TEXT2MOVSUB_BSF 1 +#define CONFIG_AASC_DECODER 1 +#define CONFIG_AIC_DECODER 1 +#define CONFIG_ALIAS_PIX_DECODER 1 +#define CONFIG_AMV_DECODER 1 +#define CONFIG_ANM_DECODER 1 +#define CONFIG_ANSI_DECODER 1 +#define CONFIG_APNG_DECODER 1 +#define CONFIG_ASV1_DECODER 1 +#define CONFIG_ASV2_DECODER 1 +#define CONFIG_AURA_DECODER 1 +#define CONFIG_AURA2_DECODER 1 +#define CONFIG_AVRP_DECODER 1 +#define CONFIG_AVRN_DECODER 1 +#define CONFIG_AVS_DECODER 1 +#define CONFIG_AVUI_DECODER 1 +#define CONFIG_AYUV_DECODER 1 +#define CONFIG_BETHSOFTVID_DECODER 1 +#define CONFIG_BFI_DECODER 1 +#define CONFIG_BINK_DECODER 1 +#define CONFIG_BMP_DECODER 1 +#define CONFIG_BMV_VIDEO_DECODER 1 +#define CONFIG_BRENDER_PIX_DECODER 1 +#define CONFIG_C93_DECODER 1 +#define CONFIG_CAVS_DECODER 1 +#define CONFIG_CDGRAPHICS_DECODER 1 +#define CONFIG_CDXL_DECODER 1 +#define CONFIG_CINEPAK_DECODER 1 +#define CONFIG_CLJR_DECODER 1 +#define CONFIG_CLLC_DECODER 1 +#define CONFIG_COMFORTNOISE_DECODER 1 +#define CONFIG_CPIA_DECODER 1 +#define CONFIG_CSCD_DECODER 1 +#define CONFIG_CYUV_DECODER 1 +#define CONFIG_DFA_DECODER 1 +#define CONFIG_DIRAC_DECODER 1 +#define CONFIG_DNXHD_DECODER 1 +#define CONFIG_DPX_DECODER 1 +#define CONFIG_DSICINVIDEO_DECODER 1 +#define CONFIG_DVVIDEO_DECODER 1 +#define CONFIG_DXA_DECODER 1 +#define CONFIG_DXTORY_DECODER 1 +#define CONFIG_EACMV_DECODER 1 +#define CONFIG_EAMAD_DECODER 1 +#define CONFIG_EATGQ_DECODER 1 +#define CONFIG_EATGV_DECODER 1 +#define CONFIG_EATQI_DECODER 1 +#define CONFIG_EIGHTBPS_DECODER 1 +#define CONFIG_EIGHTSVX_EXP_DECODER 1 +#define CONFIG_EIGHTSVX_FIB_DECODER 1 +#define CONFIG_ESCAPE124_DECODER 1 +#define CONFIG_ESCAPE130_DECODER 1 +#define CONFIG_EXR_DECODER 1 +#define CONFIG_FFV1_DECODER 1 +#define CONFIG_FFVHUFF_DECODER 1 +#define CONFIG_FIC_DECODER 1 +#define CONFIG_FLASHSV_DECODER 1 +#define CONFIG_FLASHSV2_DECODER 1 +#define CONFIG_FLIC_DECODER 1 +#define CONFIG_FLV_DECODER 1 +#define CONFIG_FOURXM_DECODER 1 +#define CONFIG_FRAPS_DECODER 1 +#define CONFIG_FRWU_DECODER 1 +#define CONFIG_G2M_DECODER 1 +#define CONFIG_GIF_DECODER 1 +#define CONFIG_H261_DECODER 1 +#define CONFIG_H263_DECODER 1 +#define CONFIG_H263I_DECODER 1 +#define CONFIG_H263P_DECODER 1 +#define CONFIG_H264_DECODER 1 +#define CONFIG_H264_CRYSTALHD_DECODER 0 +#define CONFIG_H264_QSV_DECODER 0 +#define CONFIG_H264_VDA_DECODER 0 +#define CONFIG_H264_VDPAU_DECODER 0 +#define CONFIG_HEVC_DECODER 1 +#define CONFIG_HNM4_VIDEO_DECODER 1 +#define CONFIG_HQX_DECODER 1 +#define CONFIG_HUFFYUV_DECODER 1 +#define CONFIG_IDCIN_DECODER 1 +#define CONFIG_IFF_BYTERUN1_DECODER 1 +#define CONFIG_IFF_ILBM_DECODER 1 +#define CONFIG_INDEO2_DECODER 1 +#define CONFIG_INDEO3_DECODER 1 +#define CONFIG_INDEO4_DECODER 1 +#define CONFIG_INDEO5_DECODER 1 +#define CONFIG_INTERPLAY_VIDEO_DECODER 1 +#define CONFIG_JPEG2000_DECODER 1 +#define CONFIG_JPEGLS_DECODER 1 +#define CONFIG_JV_DECODER 1 +#define CONFIG_KGV1_DECODER 1 +#define CONFIG_KMVC_DECODER 1 +#define CONFIG_LAGARITH_DECODER 1 +#define CONFIG_LOCO_DECODER 1 +#define CONFIG_MDEC_DECODER 1 +#define CONFIG_MIMIC_DECODER 1 +#define CONFIG_MJPEG_DECODER 1 +#define CONFIG_MJPEGB_DECODER 1 +#define CONFIG_MMVIDEO_DECODER 1 +#define CONFIG_MOTIONPIXELS_DECODER 1 +#define CONFIG_MPEG_XVMC_DECODER 0 +#define CONFIG_MPEG1VIDEO_DECODER 1 +#define CONFIG_MPEG2VIDEO_DECODER 1 +#define CONFIG_MPEG4_DECODER 1 +#define CONFIG_MPEG4_CRYSTALHD_DECODER 0 +#define CONFIG_MPEG4_VDPAU_DECODER 0 +#define CONFIG_MPEGVIDEO_DECODER 1 +#define CONFIG_MPEG_VDPAU_DECODER 0 +#define CONFIG_MPEG1_VDPAU_DECODER 0 +#define CONFIG_MPEG2_CRYSTALHD_DECODER 0 +#define CONFIG_MSA1_DECODER 1 +#define CONFIG_MSMPEG4_CRYSTALHD_DECODER 0 +#define CONFIG_MSMPEG4V1_DECODER 1 +#define CONFIG_MSMPEG4V2_DECODER 1 +#define CONFIG_MSMPEG4V3_DECODER 1 +#define CONFIG_MSRLE_DECODER 1 +#define CONFIG_MSS1_DECODER 1 +#define CONFIG_MSS2_DECODER 1 +#define CONFIG_MSVIDEO1_DECODER 1 +#define CONFIG_MSZH_DECODER 1 +#define CONFIG_MTS2_DECODER 1 +#define CONFIG_MVC1_DECODER 1 +#define CONFIG_MVC2_DECODER 1 +#define CONFIG_MXPEG_DECODER 1 +#define CONFIG_NUV_DECODER 1 +#define CONFIG_PAF_VIDEO_DECODER 1 +#define CONFIG_PAM_DECODER 1 +#define CONFIG_PBM_DECODER 1 +#define CONFIG_PCX_DECODER 1 +#define CONFIG_PGM_DECODER 1 +#define CONFIG_PGMYUV_DECODER 1 +#define CONFIG_PICTOR_DECODER 1 +#define CONFIG_PNG_DECODER 1 +#define CONFIG_PPM_DECODER 1 +#define CONFIG_PRORES_DECODER 1 +#define CONFIG_PRORES_LGPL_DECODER 1 +#define CONFIG_PTX_DECODER 1 +#define CONFIG_QDRAW_DECODER 1 +#define CONFIG_QPEG_DECODER 1 +#define CONFIG_QTRLE_DECODER 1 +#define CONFIG_R10K_DECODER 1 +#define CONFIG_R210_DECODER 1 +#define CONFIG_RAWVIDEO_DECODER 1 +#define CONFIG_RL2_DECODER 1 +#define CONFIG_ROQ_DECODER 1 +#define CONFIG_RPZA_DECODER 1 +#define CONFIG_RV10_DECODER 1 +#define CONFIG_RV20_DECODER 1 +#define CONFIG_RV30_DECODER 1 +#define CONFIG_RV40_DECODER 1 +#define CONFIG_S302M_DECODER 1 +#define CONFIG_SANM_DECODER 1 +#define CONFIG_SGI_DECODER 1 +#define CONFIG_SGIRLE_DECODER 1 +#define CONFIG_SMACKER_DECODER 1 +#define CONFIG_SMC_DECODER 1 +#define CONFIG_SMVJPEG_DECODER 1 +#define CONFIG_SNOW_DECODER 1 +#define CONFIG_SP5X_DECODER 1 +#define CONFIG_SUNRAST_DECODER 1 +#define CONFIG_SVQ1_DECODER 1 +#define CONFIG_SVQ3_DECODER 1 +#define CONFIG_TARGA_DECODER 1 +#define CONFIG_TARGA_Y216_DECODER 1 +#define CONFIG_THEORA_DECODER 1 +#define CONFIG_THP_DECODER 1 +#define CONFIG_TIERTEXSEQVIDEO_DECODER 1 +#define CONFIG_TIFF_DECODER 1 +#define CONFIG_TMV_DECODER 1 +#define CONFIG_TRUEMOTION1_DECODER 1 +#define CONFIG_TRUEMOTION2_DECODER 1 +#define CONFIG_TSCC_DECODER 1 +#define CONFIG_TSCC2_DECODER 1 +#define CONFIG_TXD_DECODER 1 +#define CONFIG_ULTI_DECODER 1 +#define CONFIG_UTVIDEO_DECODER 1 +#define CONFIG_V210_DECODER 1 +#define CONFIG_V210X_DECODER 1 +#define CONFIG_V308_DECODER 1 +#define CONFIG_V408_DECODER 1 +#define CONFIG_V410_DECODER 1 +#define CONFIG_VB_DECODER 1 +#define CONFIG_VBLE_DECODER 1 +#define CONFIG_VC1_DECODER 1 +#define CONFIG_VC1_CRYSTALHD_DECODER 0 +#define CONFIG_VC1_VDPAU_DECODER 0 +#define CONFIG_VC1IMAGE_DECODER 1 +#define CONFIG_VCR1_DECODER 1 +#define CONFIG_VMDVIDEO_DECODER 1 +#define CONFIG_VMNC_DECODER 1 +#define CONFIG_VP3_DECODER 1 +#define CONFIG_VP5_DECODER 1 +#define CONFIG_VP6_DECODER 1 +#define CONFIG_VP6A_DECODER 1 +#define CONFIG_VP6F_DECODER 1 +#define CONFIG_VP7_DECODER 1 +#define CONFIG_VP8_DECODER 1 +#define CONFIG_VP9_DECODER 1 +#define CONFIG_VQA_DECODER 1 +#define CONFIG_WEBP_DECODER 1 +#define CONFIG_WMV1_DECODER 1 +#define CONFIG_WMV2_DECODER 1 +#define CONFIG_WMV3_DECODER 1 +#define CONFIG_WMV3_CRYSTALHD_DECODER 0 +#define CONFIG_WMV3_VDPAU_DECODER 0 +#define CONFIG_WMV3IMAGE_DECODER 1 +#define CONFIG_WNV1_DECODER 1 +#define CONFIG_XAN_WC3_DECODER 1 +#define CONFIG_XAN_WC4_DECODER 1 +#define CONFIG_XBM_DECODER 1 +#define CONFIG_XFACE_DECODER 1 +#define CONFIG_XL_DECODER 1 +#define CONFIG_XWD_DECODER 1 +#define CONFIG_Y41P_DECODER 1 +#define CONFIG_YOP_DECODER 1 +#define CONFIG_YUV4_DECODER 1 +#define CONFIG_ZERO12V_DECODER 1 +#define CONFIG_ZEROCODEC_DECODER 1 +#define CONFIG_ZLIB_DECODER 1 +#define CONFIG_ZMBV_DECODER 1 +#define CONFIG_AAC_DECODER 1 +#define CONFIG_AAC_LATM_DECODER 1 +#define CONFIG_AC3_DECODER 1 +#define CONFIG_AC3_FIXED_DECODER 1 +#define CONFIG_ALAC_DECODER 1 +#define CONFIG_ALS_DECODER 1 +#define CONFIG_AMRNB_DECODER 1 +#define CONFIG_AMRWB_DECODER 1 +#define CONFIG_APE_DECODER 1 +#define CONFIG_ATRAC1_DECODER 1 +#define CONFIG_ATRAC3_DECODER 1 +#define CONFIG_ATRAC3P_DECODER 1 +#define CONFIG_BINKAUDIO_DCT_DECODER 1 +#define CONFIG_BINKAUDIO_RDFT_DECODER 1 +#define CONFIG_BMV_AUDIO_DECODER 1 +#define CONFIG_COOK_DECODER 1 +#define CONFIG_DCA_DECODER 1 +#define CONFIG_DSD_LSBF_DECODER 1 +#define CONFIG_DSD_MSBF_DECODER 1 +#define CONFIG_DSD_LSBF_PLANAR_DECODER 1 +#define CONFIG_DSD_MSBF_PLANAR_DECODER 1 +#define CONFIG_DSICINAUDIO_DECODER 1 +#define CONFIG_DSS_SP_DECODER 1 +#define CONFIG_EAC3_DECODER 1 +#define CONFIG_EVRC_DECODER 1 +#define CONFIG_FFWAVESYNTH_DECODER 1 +#define CONFIG_FLAC_DECODER 1 +#define CONFIG_G723_1_DECODER 1 +#define CONFIG_G729_DECODER 1 +#define CONFIG_GSM_DECODER 1 +#define CONFIG_GSM_MS_DECODER 1 +#define CONFIG_IAC_DECODER 1 +#define CONFIG_IMC_DECODER 1 +#define CONFIG_MACE3_DECODER 1 +#define CONFIG_MACE6_DECODER 1 +#define CONFIG_METASOUND_DECODER 1 +#define CONFIG_MLP_DECODER 1 +#define CONFIG_MP1_DECODER 1 +#define CONFIG_MP1FLOAT_DECODER 1 +#define CONFIG_MP2_DECODER 1 +#define CONFIG_MP2FLOAT_DECODER 1 +#define CONFIG_MP3_DECODER 1 +#define CONFIG_MP3FLOAT_DECODER 1 +#define CONFIG_MP3ADU_DECODER 1 +#define CONFIG_MP3ADUFLOAT_DECODER 1 +#define CONFIG_MP3ON4_DECODER 1 +#define CONFIG_MP3ON4FLOAT_DECODER 1 +#define CONFIG_MPC7_DECODER 1 +#define CONFIG_MPC8_DECODER 1 +#define CONFIG_NELLYMOSER_DECODER 1 +#define CONFIG_ON2AVC_DECODER 1 +#define CONFIG_OPUS_DECODER 1 +#define CONFIG_PAF_AUDIO_DECODER 1 +#define CONFIG_QCELP_DECODER 1 +#define CONFIG_QDM2_DECODER 1 +#define CONFIG_RA_144_DECODER 1 +#define CONFIG_RA_288_DECODER 1 +#define CONFIG_RALF_DECODER 1 +#define CONFIG_SHORTEN_DECODER 1 +#define CONFIG_SIPR_DECODER 1 +#define CONFIG_SMACKAUD_DECODER 1 +#define CONFIG_SONIC_DECODER 1 +#define CONFIG_TAK_DECODER 1 +#define CONFIG_TRUEHD_DECODER 1 +#define CONFIG_TRUESPEECH_DECODER 1 +#define CONFIG_TTA_DECODER 1 +#define CONFIG_TWINVQ_DECODER 1 +#define CONFIG_VMDAUDIO_DECODER 1 +#define CONFIG_VORBIS_DECODER 1 +#define CONFIG_WAVPACK_DECODER 1 +#define CONFIG_WMALOSSLESS_DECODER 1 +#define CONFIG_WMAPRO_DECODER 1 +#define CONFIG_WMAV1_DECODER 1 +#define CONFIG_WMAV2_DECODER 1 +#define CONFIG_WMAVOICE_DECODER 1 +#define CONFIG_WS_SND1_DECODER 1 +#define CONFIG_PCM_ALAW_DECODER 1 +#define CONFIG_PCM_BLURAY_DECODER 1 +#define CONFIG_PCM_DVD_DECODER 1 +#define CONFIG_PCM_F32BE_DECODER 1 +#define CONFIG_PCM_F32LE_DECODER 1 +#define CONFIG_PCM_F64BE_DECODER 1 +#define CONFIG_PCM_F64LE_DECODER 1 +#define CONFIG_PCM_LXF_DECODER 1 +#define CONFIG_PCM_MULAW_DECODER 1 +#define CONFIG_PCM_S8_DECODER 1 +#define CONFIG_PCM_S8_PLANAR_DECODER 1 +#define CONFIG_PCM_S16BE_DECODER 1 +#define CONFIG_PCM_S16BE_PLANAR_DECODER 1 +#define CONFIG_PCM_S16LE_DECODER 1 +#define CONFIG_PCM_S16LE_PLANAR_DECODER 1 +#define CONFIG_PCM_S24BE_DECODER 1 +#define CONFIG_PCM_S24DAUD_DECODER 1 +#define CONFIG_PCM_S24LE_DECODER 1 +#define CONFIG_PCM_S24LE_PLANAR_DECODER 1 +#define CONFIG_PCM_S32BE_DECODER 1 +#define CONFIG_PCM_S32LE_DECODER 1 +#define CONFIG_PCM_S32LE_PLANAR_DECODER 1 +#define CONFIG_PCM_U8_DECODER 1 +#define CONFIG_PCM_U16BE_DECODER 1 +#define CONFIG_PCM_U16LE_DECODER 1 +#define CONFIG_PCM_U24BE_DECODER 1 +#define CONFIG_PCM_U24LE_DECODER 1 +#define CONFIG_PCM_U32BE_DECODER 1 +#define CONFIG_PCM_U32LE_DECODER 1 +#define CONFIG_PCM_ZORK_DECODER 1 +#define CONFIG_INTERPLAY_DPCM_DECODER 1 +#define CONFIG_ROQ_DPCM_DECODER 1 +#define CONFIG_SOL_DPCM_DECODER 1 +#define CONFIG_XAN_DPCM_DECODER 1 +#define CONFIG_ADPCM_4XM_DECODER 1 +#define CONFIG_ADPCM_ADX_DECODER 1 +#define CONFIG_ADPCM_AFC_DECODER 1 +#define CONFIG_ADPCM_CT_DECODER 1 +#define CONFIG_ADPCM_DTK_DECODER 1 +#define CONFIG_ADPCM_EA_DECODER 1 +#define CONFIG_ADPCM_EA_MAXIS_XA_DECODER 1 +#define CONFIG_ADPCM_EA_R1_DECODER 1 +#define CONFIG_ADPCM_EA_R2_DECODER 1 +#define CONFIG_ADPCM_EA_R3_DECODER 1 +#define CONFIG_ADPCM_EA_XAS_DECODER 1 +#define CONFIG_ADPCM_G722_DECODER 1 +#define CONFIG_ADPCM_G726_DECODER 1 +#define CONFIG_ADPCM_G726LE_DECODER 1 +#define CONFIG_ADPCM_IMA_AMV_DECODER 1 +#define CONFIG_ADPCM_IMA_APC_DECODER 1 +#define CONFIG_ADPCM_IMA_DK3_DECODER 1 +#define CONFIG_ADPCM_IMA_DK4_DECODER 1 +#define CONFIG_ADPCM_IMA_EA_EACS_DECODER 1 +#define CONFIG_ADPCM_IMA_EA_SEAD_DECODER 1 +#define CONFIG_ADPCM_IMA_ISS_DECODER 1 +#define CONFIG_ADPCM_IMA_OKI_DECODER 1 +#define CONFIG_ADPCM_IMA_QT_DECODER 1 +#define CONFIG_ADPCM_IMA_RAD_DECODER 1 +#define CONFIG_ADPCM_IMA_SMJPEG_DECODER 1 +#define CONFIG_ADPCM_IMA_WAV_DECODER 1 +#define CONFIG_ADPCM_IMA_WS_DECODER 1 +#define CONFIG_ADPCM_MS_DECODER 1 +#define CONFIG_ADPCM_SBPRO_2_DECODER 1 +#define CONFIG_ADPCM_SBPRO_3_DECODER 1 +#define CONFIG_ADPCM_SBPRO_4_DECODER 1 +#define CONFIG_ADPCM_SWF_DECODER 1 +#define CONFIG_ADPCM_THP_DECODER 1 +#define CONFIG_ADPCM_VIMA_DECODER 1 +#define CONFIG_ADPCM_XA_DECODER 1 +#define CONFIG_ADPCM_YAMAHA_DECODER 1 +#define CONFIG_VIMA_DECODER 1 +#define CONFIG_SSA_DECODER 1 +#define CONFIG_ASS_DECODER 1 +#define CONFIG_CCAPTION_DECODER 1 +#define CONFIG_DVBSUB_DECODER 1 +#define CONFIG_DVDSUB_DECODER 1 +#define CONFIG_JACOSUB_DECODER 1 +#define CONFIG_MICRODVD_DECODER 1 +#define CONFIG_MOVTEXT_DECODER 1 +#define CONFIG_MPL2_DECODER 1 +#define CONFIG_PGSSUB_DECODER 1 +#define CONFIG_PJS_DECODER 1 +#define CONFIG_REALTEXT_DECODER 1 +#define CONFIG_SAMI_DECODER 1 +#define CONFIG_SRT_DECODER 1 +#define CONFIG_STL_DECODER 1 +#define CONFIG_SUBRIP_DECODER 1 +#define CONFIG_SUBVIEWER_DECODER 1 +#define CONFIG_SUBVIEWER1_DECODER 1 +#define CONFIG_TEXT_DECODER 1 +#define CONFIG_VPLAYER_DECODER 1 +#define CONFIG_WEBVTT_DECODER 1 +#define CONFIG_XSUB_DECODER 1 +#define CONFIG_LIBCELT_DECODER 0 +#define CONFIG_LIBFDK_AAC_DECODER 0 +#define CONFIG_LIBGSM_DECODER 0 +#define CONFIG_LIBGSM_MS_DECODER 0 +#define CONFIG_LIBILBC_DECODER 0 +#define CONFIG_LIBOPENCORE_AMRNB_DECODER 0 +#define CONFIG_LIBOPENCORE_AMRWB_DECODER 0 +#define CONFIG_LIBOPENJPEG_DECODER 0 +#define CONFIG_LIBOPUS_DECODER 0 +#define CONFIG_LIBSCHROEDINGER_DECODER 0 +#define CONFIG_LIBSPEEX_DECODER 0 +#define CONFIG_LIBSTAGEFRIGHT_H264_DECODER 0 +#define CONFIG_LIBUTVIDEO_DECODER 0 +#define CONFIG_LIBVORBIS_DECODER 0 +#define CONFIG_LIBVPX_VP8_DECODER 0 +#define CONFIG_LIBVPX_VP9_DECODER 0 +#define CONFIG_LIBZVBI_TELETEXT_DECODER 0 +#define CONFIG_BINTEXT_DECODER 1 +#define CONFIG_XBIN_DECODER 1 +#define CONFIG_IDF_DECODER 1 +#define CONFIG_AAC_DEMUXER 1 +#define CONFIG_AC3_DEMUXER 1 +#define CONFIG_ACT_DEMUXER 1 +#define CONFIG_ADF_DEMUXER 1 +#define CONFIG_ADP_DEMUXER 1 +#define CONFIG_ADX_DEMUXER 1 +#define CONFIG_AEA_DEMUXER 1 +#define CONFIG_AFC_DEMUXER 1 +#define CONFIG_AIFF_DEMUXER 1 +#define CONFIG_AMR_DEMUXER 1 +#define CONFIG_ANM_DEMUXER 1 +#define CONFIG_APC_DEMUXER 1 +#define CONFIG_APE_DEMUXER 1 +#define CONFIG_APNG_DEMUXER 1 +#define CONFIG_AQTITLE_DEMUXER 1 +#define CONFIG_ASF_DEMUXER 1 +#define CONFIG_ASS_DEMUXER 1 +#define CONFIG_AST_DEMUXER 1 +#define CONFIG_AU_DEMUXER 1 +#define CONFIG_AVI_DEMUXER 1 +#define CONFIG_AVISYNTH_DEMUXER 0 +#define CONFIG_AVR_DEMUXER 1 +#define CONFIG_AVS_DEMUXER 1 +#define CONFIG_BETHSOFTVID_DEMUXER 1 +#define CONFIG_BFI_DEMUXER 1 +#define CONFIG_BINTEXT_DEMUXER 1 +#define CONFIG_BINK_DEMUXER 1 +#define CONFIG_BIT_DEMUXER 1 +#define CONFIG_BMV_DEMUXER 1 +#define CONFIG_BRSTM_DEMUXER 1 +#define CONFIG_BOA_DEMUXER 1 +#define CONFIG_C93_DEMUXER 1 +#define CONFIG_CAF_DEMUXER 1 +#define CONFIG_CAVSVIDEO_DEMUXER 1 +#define CONFIG_CDG_DEMUXER 1 +#define CONFIG_CDXL_DEMUXER 1 +#define CONFIG_CINE_DEMUXER 1 +#define CONFIG_CONCAT_DEMUXER 1 +#define CONFIG_DATA_DEMUXER 1 +#define CONFIG_DAUD_DEMUXER 1 +#define CONFIG_DFA_DEMUXER 1 +#define CONFIG_DIRAC_DEMUXER 1 +#define CONFIG_DNXHD_DEMUXER 1 +#define CONFIG_DSF_DEMUXER 1 +#define CONFIG_DSICIN_DEMUXER 1 +#define CONFIG_DSS_DEMUXER 1 +#define CONFIG_DTS_DEMUXER 1 +#define CONFIG_DTSHD_DEMUXER 1 +#define CONFIG_DV_DEMUXER 1 +#define CONFIG_DVBSUB_DEMUXER 1 +#define CONFIG_DXA_DEMUXER 1 +#define CONFIG_EA_DEMUXER 1 +#define CONFIG_EA_CDATA_DEMUXER 1 +#define CONFIG_EAC3_DEMUXER 1 +#define CONFIG_EPAF_DEMUXER 1 +#define CONFIG_FFM_DEMUXER 1 +#define CONFIG_FFMETADATA_DEMUXER 1 +#define CONFIG_FILMSTRIP_DEMUXER 1 +#define CONFIG_FLAC_DEMUXER 1 +#define CONFIG_FLIC_DEMUXER 1 +#define CONFIG_FLV_DEMUXER 1 +#define CONFIG_LIVE_FLV_DEMUXER 1 +#define CONFIG_FOURXM_DEMUXER 1 +#define CONFIG_FRM_DEMUXER 1 +#define CONFIG_G722_DEMUXER 1 +#define CONFIG_G723_1_DEMUXER 1 +#define CONFIG_G729_DEMUXER 1 +#define CONFIG_GIF_DEMUXER 1 +#define CONFIG_GSM_DEMUXER 1 +#define CONFIG_GXF_DEMUXER 1 +#define CONFIG_H261_DEMUXER 1 +#define CONFIG_H263_DEMUXER 1 +#define CONFIG_H264_DEMUXER 1 +#define CONFIG_HEVC_DEMUXER 1 +#define CONFIG_HLS_DEMUXER 1 +#define CONFIG_HNM_DEMUXER 1 +#define CONFIG_ICO_DEMUXER 1 +#define CONFIG_IDCIN_DEMUXER 1 +#define CONFIG_IDF_DEMUXER 1 +#define CONFIG_IFF_DEMUXER 1 +#define CONFIG_ILBC_DEMUXER 1 +#define CONFIG_IMAGE2_DEMUXER 1 +#define CONFIG_IMAGE2PIPE_DEMUXER 1 +#define CONFIG_IMAGE2_ALIAS_PIX_DEMUXER 1 +#define CONFIG_IMAGE2_BRENDER_PIX_DEMUXER 1 +#define CONFIG_INGENIENT_DEMUXER 1 +#define CONFIG_IPMOVIE_DEMUXER 1 +#define CONFIG_IRCAM_DEMUXER 1 +#define CONFIG_ISS_DEMUXER 1 +#define CONFIG_IV8_DEMUXER 1 +#define CONFIG_IVF_DEMUXER 1 +#define CONFIG_JACOSUB_DEMUXER 1 +#define CONFIG_JV_DEMUXER 1 +#define CONFIG_LATM_DEMUXER 1 +#define CONFIG_LMLM4_DEMUXER 1 +#define CONFIG_LOAS_DEMUXER 1 +#define CONFIG_LRC_DEMUXER 1 +#define CONFIG_LVF_DEMUXER 1 +#define CONFIG_LXF_DEMUXER 1 +#define CONFIG_M4V_DEMUXER 1 +#define CONFIG_MATROSKA_DEMUXER 1 +#define CONFIG_MGSTS_DEMUXER 1 +#define CONFIG_MICRODVD_DEMUXER 1 +#define CONFIG_MJPEG_DEMUXER 1 +#define CONFIG_MLP_DEMUXER 1 +#define CONFIG_MLV_DEMUXER 1 +#define CONFIG_MM_DEMUXER 1 +#define CONFIG_MMF_DEMUXER 1 +#define CONFIG_MOV_DEMUXER 1 +#define CONFIG_MP3_DEMUXER 1 +#define CONFIG_MPC_DEMUXER 1 +#define CONFIG_MPC8_DEMUXER 1 +#define CONFIG_MPEGPS_DEMUXER 1 +#define CONFIG_MPEGTS_DEMUXER 1 +#define CONFIG_MPEGTSRAW_DEMUXER 1 +#define CONFIG_MPEGVIDEO_DEMUXER 1 +#define CONFIG_MPL2_DEMUXER 1 +#define CONFIG_MPSUB_DEMUXER 1 +#define CONFIG_MSNWC_TCP_DEMUXER 1 +#define CONFIG_MTV_DEMUXER 1 +#define CONFIG_MV_DEMUXER 1 +#define CONFIG_MVI_DEMUXER 1 +#define CONFIG_MXF_DEMUXER 1 +#define CONFIG_MXG_DEMUXER 1 +#define CONFIG_NC_DEMUXER 1 +#define CONFIG_NISTSPHERE_DEMUXER 1 +#define CONFIG_NSV_DEMUXER 1 +#define CONFIG_NUT_DEMUXER 1 +#define CONFIG_NUV_DEMUXER 1 +#define CONFIG_OGG_DEMUXER 1 +#define CONFIG_OMA_DEMUXER 1 +#define CONFIG_PAF_DEMUXER 1 +#define CONFIG_PCM_ALAW_DEMUXER 1 +#define CONFIG_PCM_MULAW_DEMUXER 1 +#define CONFIG_PCM_F64BE_DEMUXER 1 +#define CONFIG_PCM_F64LE_DEMUXER 1 +#define CONFIG_PCM_F32BE_DEMUXER 1 +#define CONFIG_PCM_F32LE_DEMUXER 1 +#define CONFIG_PCM_S32BE_DEMUXER 1 +#define CONFIG_PCM_S32LE_DEMUXER 1 +#define CONFIG_PCM_S24BE_DEMUXER 1 +#define CONFIG_PCM_S24LE_DEMUXER 1 +#define CONFIG_PCM_S16BE_DEMUXER 1 +#define CONFIG_PCM_S16LE_DEMUXER 1 +#define CONFIG_PCM_S8_DEMUXER 1 +#define CONFIG_PCM_U32BE_DEMUXER 1 +#define CONFIG_PCM_U32LE_DEMUXER 1 +#define CONFIG_PCM_U24BE_DEMUXER 1 +#define CONFIG_PCM_U24LE_DEMUXER 1 +#define CONFIG_PCM_U16BE_DEMUXER 1 +#define CONFIG_PCM_U16LE_DEMUXER 1 +#define CONFIG_PCM_U8_DEMUXER 1 +#define CONFIG_PJS_DEMUXER 1 +#define CONFIG_PMP_DEMUXER 1 +#define CONFIG_PVA_DEMUXER 1 +#define CONFIG_PVF_DEMUXER 1 +#define CONFIG_QCP_DEMUXER 1 +#define CONFIG_R3D_DEMUXER 1 +#define CONFIG_RAWVIDEO_DEMUXER 1 +#define CONFIG_REALTEXT_DEMUXER 1 +#define CONFIG_REDSPARK_DEMUXER 1 +#define CONFIG_RL2_DEMUXER 1 +#define CONFIG_RM_DEMUXER 1 +#define CONFIG_ROQ_DEMUXER 1 +#define CONFIG_RPL_DEMUXER 1 +#define CONFIG_RSD_DEMUXER 1 +#define CONFIG_RSO_DEMUXER 1 +#define CONFIG_RTP_DEMUXER 1 +#define CONFIG_RTSP_DEMUXER 1 +#define CONFIG_SAMI_DEMUXER 1 +#define CONFIG_SAP_DEMUXER 1 +#define CONFIG_SBG_DEMUXER 1 +#define CONFIG_SDP_DEMUXER 1 +#define CONFIG_SDR2_DEMUXER 1 +#define CONFIG_SEGAFILM_DEMUXER 1 +#define CONFIG_SHORTEN_DEMUXER 1 +#define CONFIG_SIFF_DEMUXER 1 +#define CONFIG_SLN_DEMUXER 1 +#define CONFIG_SMACKER_DEMUXER 1 +#define CONFIG_SMJPEG_DEMUXER 1 +#define CONFIG_SMUSH_DEMUXER 1 +#define CONFIG_SOL_DEMUXER 1 +#define CONFIG_SOX_DEMUXER 1 +#define CONFIG_SPDIF_DEMUXER 1 +#define CONFIG_SRT_DEMUXER 1 +#define CONFIG_STR_DEMUXER 1 +#define CONFIG_STL_DEMUXER 1 +#define CONFIG_SUBVIEWER1_DEMUXER 1 +#define CONFIG_SUBVIEWER_DEMUXER 1 +#define CONFIG_SUP_DEMUXER 1 +#define CONFIG_SWF_DEMUXER 1 +#define CONFIG_TAK_DEMUXER 1 +#define CONFIG_TEDCAPTIONS_DEMUXER 1 +#define CONFIG_THP_DEMUXER 1 +#define CONFIG_TIERTEXSEQ_DEMUXER 1 +#define CONFIG_TMV_DEMUXER 1 +#define CONFIG_TRUEHD_DEMUXER 1 +#define CONFIG_TTA_DEMUXER 1 +#define CONFIG_TXD_DEMUXER 1 +#define CONFIG_TTY_DEMUXER 1 +#define CONFIG_VC1_DEMUXER 1 +#define CONFIG_VC1T_DEMUXER 1 +#define CONFIG_VIVO_DEMUXER 1 +#define CONFIG_VMD_DEMUXER 1 +#define CONFIG_VOBSUB_DEMUXER 1 +#define CONFIG_VOC_DEMUXER 1 +#define CONFIG_VPLAYER_DEMUXER 1 +#define CONFIG_VQF_DEMUXER 1 +#define CONFIG_W64_DEMUXER 1 +#define CONFIG_WAV_DEMUXER 1 +#define CONFIG_WC3_DEMUXER 1 +#define CONFIG_WEBM_DASH_MANIFEST_DEMUXER 1 +#define CONFIG_WEBVTT_DEMUXER 1 +#define CONFIG_WSAUD_DEMUXER 1 +#define CONFIG_WSVQA_DEMUXER 1 +#define CONFIG_WTV_DEMUXER 1 +#define CONFIG_WV_DEMUXER 1 +#define CONFIG_XA_DEMUXER 1 +#define CONFIG_XBIN_DEMUXER 1 +#define CONFIG_XMV_DEMUXER 1 +#define CONFIG_XWMA_DEMUXER 1 +#define CONFIG_YOP_DEMUXER 1 +#define CONFIG_YUV4MPEGPIPE_DEMUXER 1 +#define CONFIG_IMAGE_BMP_PIPE_DEMUXER 1 +#define CONFIG_IMAGE_DPX_PIPE_DEMUXER 1 +#define CONFIG_IMAGE_EXR_PIPE_DEMUXER 1 +#define CONFIG_IMAGE_J2K_PIPE_DEMUXER 1 +#define CONFIG_IMAGE_JPEG_PIPE_DEMUXER 1 +#define CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER 1 +#define CONFIG_IMAGE_PICTOR_PIPE_DEMUXER 1 +#define CONFIG_IMAGE_PNG_PIPE_DEMUXER 1 +#define CONFIG_IMAGE_SGI_PIPE_DEMUXER 1 +#define CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER 1 +#define CONFIG_IMAGE_TIFF_PIPE_DEMUXER 1 +#define CONFIG_IMAGE_WEBP_PIPE_DEMUXER 1 +#define CONFIG_LIBGME_DEMUXER 0 +#define CONFIG_LIBMODPLUG_DEMUXER 0 +#define CONFIG_LIBNUT_DEMUXER 0 +#define CONFIG_LIBQUVI_DEMUXER 0 +#define CONFIG_A64MULTI_ENCODER 1 +#define CONFIG_A64MULTI5_ENCODER 1 +#define CONFIG_ALIAS_PIX_ENCODER 1 +#define CONFIG_AMV_ENCODER 1 +#define CONFIG_ASV1_ENCODER 1 +#define CONFIG_ASV2_ENCODER 1 +#define CONFIG_AVRP_ENCODER 1 +#define CONFIG_AVUI_ENCODER 1 +#define CONFIG_AYUV_ENCODER 1 +#define CONFIG_BMP_ENCODER 1 +#define CONFIG_CINEPAK_ENCODER 1 +#define CONFIG_CLJR_ENCODER 1 +#define CONFIG_COMFORTNOISE_ENCODER 1 +#define CONFIG_DNXHD_ENCODER 1 +#define CONFIG_DPX_ENCODER 1 +#define CONFIG_DVVIDEO_ENCODER 1 +#define CONFIG_FFV1_ENCODER 1 +#define CONFIG_FFVHUFF_ENCODER 1 +#define CONFIG_FLASHSV_ENCODER 1 +#define CONFIG_FLASHSV2_ENCODER 1 +#define CONFIG_FLV_ENCODER 1 +#define CONFIG_GIF_ENCODER 1 +#define CONFIG_H261_ENCODER 1 +#define CONFIG_H263_ENCODER 1 +#define CONFIG_H263P_ENCODER 1 +#define CONFIG_HUFFYUV_ENCODER 1 +#define CONFIG_JPEG2000_ENCODER 1 +#define CONFIG_JPEGLS_ENCODER 1 +#define CONFIG_LJPEG_ENCODER 1 +#define CONFIG_MJPEG_ENCODER 1 +#define CONFIG_MPEG1VIDEO_ENCODER 1 +#define CONFIG_MPEG2VIDEO_ENCODER 1 +#define CONFIG_MPEG4_ENCODER 1 +#define CONFIG_MSMPEG4V2_ENCODER 1 +#define CONFIG_MSMPEG4V3_ENCODER 1 +#define CONFIG_MSVIDEO1_ENCODER 1 +#define CONFIG_NVENC_ENCODER 0 +#define CONFIG_PAM_ENCODER 1 +#define CONFIG_PBM_ENCODER 1 +#define CONFIG_PCX_ENCODER 1 +#define CONFIG_PGM_ENCODER 1 +#define CONFIG_PGMYUV_ENCODER 1 +#define CONFIG_PNG_ENCODER 1 +#define CONFIG_PPM_ENCODER 1 +#define CONFIG_PRORES_ENCODER 1 +#define CONFIG_PRORES_AW_ENCODER 1 +#define CONFIG_PRORES_KS_ENCODER 1 +#define CONFIG_QTRLE_ENCODER 1 +#define CONFIG_R10K_ENCODER 1 +#define CONFIG_R210_ENCODER 1 +#define CONFIG_RAWVIDEO_ENCODER 1 +#define CONFIG_ROQ_ENCODER 1 +#define CONFIG_RV10_ENCODER 1 +#define CONFIG_RV20_ENCODER 1 +#define CONFIG_S302M_ENCODER 1 +#define CONFIG_SGI_ENCODER 1 +#define CONFIG_SNOW_ENCODER 1 +#define CONFIG_SUNRAST_ENCODER 1 +#define CONFIG_SVQ1_ENCODER 1 +#define CONFIG_TARGA_ENCODER 1 +#define CONFIG_TIFF_ENCODER 1 +#define CONFIG_UTVIDEO_ENCODER 1 +#define CONFIG_V210_ENCODER 1 +#define CONFIG_V308_ENCODER 1 +#define CONFIG_V408_ENCODER 1 +#define CONFIG_V410_ENCODER 1 +#define CONFIG_WMV1_ENCODER 1 +#define CONFIG_WMV2_ENCODER 1 +#define CONFIG_XBM_ENCODER 1 +#define CONFIG_XFACE_ENCODER 1 +#define CONFIG_XWD_ENCODER 1 +#define CONFIG_Y41P_ENCODER 1 +#define CONFIG_YUV4_ENCODER 1 +#define CONFIG_ZLIB_ENCODER 1 +#define CONFIG_ZMBV_ENCODER 1 +#define CONFIG_AAC_ENCODER 1 +#define CONFIG_AC3_ENCODER 1 +#define CONFIG_AC3_FIXED_ENCODER 1 +#define CONFIG_ALAC_ENCODER 1 +#define CONFIG_DCA_ENCODER 1 +#define CONFIG_EAC3_ENCODER 1 +#define CONFIG_FLAC_ENCODER 1 +#define CONFIG_G723_1_ENCODER 1 +#define CONFIG_MP2_ENCODER 1 +#define CONFIG_MP2FIXED_ENCODER 1 +#define CONFIG_NELLYMOSER_ENCODER 1 +#define CONFIG_RA_144_ENCODER 1 +#define CONFIG_SONIC_ENCODER 1 +#define CONFIG_SONIC_LS_ENCODER 1 +#define CONFIG_TTA_ENCODER 1 +#define CONFIG_VORBIS_ENCODER 1 +#define CONFIG_WAVPACK_ENCODER 1 +#define CONFIG_WMAV1_ENCODER 1 +#define CONFIG_WMAV2_ENCODER 1 +#define CONFIG_PCM_ALAW_ENCODER 1 +#define CONFIG_PCM_F32BE_ENCODER 1 +#define CONFIG_PCM_F32LE_ENCODER 1 +#define CONFIG_PCM_F64BE_ENCODER 1 +#define CONFIG_PCM_F64LE_ENCODER 1 +#define CONFIG_PCM_MULAW_ENCODER 1 +#define CONFIG_PCM_S8_ENCODER 1 +#define CONFIG_PCM_S8_PLANAR_ENCODER 1 +#define CONFIG_PCM_S16BE_ENCODER 1 +#define CONFIG_PCM_S16BE_PLANAR_ENCODER 1 +#define CONFIG_PCM_S16LE_ENCODER 1 +#define CONFIG_PCM_S16LE_PLANAR_ENCODER 1 +#define CONFIG_PCM_S24BE_ENCODER 1 +#define CONFIG_PCM_S24DAUD_ENCODER 1 +#define CONFIG_PCM_S24LE_ENCODER 1 +#define CONFIG_PCM_S24LE_PLANAR_ENCODER 1 +#define CONFIG_PCM_S32BE_ENCODER 1 +#define CONFIG_PCM_S32LE_ENCODER 1 +#define CONFIG_PCM_S32LE_PLANAR_ENCODER 1 +#define CONFIG_PCM_U8_ENCODER 1 +#define CONFIG_PCM_U16BE_ENCODER 1 +#define CONFIG_PCM_U16LE_ENCODER 1 +#define CONFIG_PCM_U24BE_ENCODER 1 +#define CONFIG_PCM_U24LE_ENCODER 1 +#define CONFIG_PCM_U32BE_ENCODER 1 +#define CONFIG_PCM_U32LE_ENCODER 1 +#define CONFIG_ROQ_DPCM_ENCODER 1 +#define CONFIG_ADPCM_ADX_ENCODER 1 +#define CONFIG_ADPCM_G722_ENCODER 1 +#define CONFIG_ADPCM_G726_ENCODER 1 +#define CONFIG_ADPCM_IMA_QT_ENCODER 1 +#define CONFIG_ADPCM_IMA_WAV_ENCODER 1 +#define CONFIG_ADPCM_MS_ENCODER 1 +#define CONFIG_ADPCM_SWF_ENCODER 1 +#define CONFIG_ADPCM_YAMAHA_ENCODER 1 +#define CONFIG_SSA_ENCODER 1 +#define CONFIG_ASS_ENCODER 1 +#define CONFIG_DVBSUB_ENCODER 1 +#define CONFIG_DVDSUB_ENCODER 1 +#define CONFIG_MOVTEXT_ENCODER 1 +#define CONFIG_SRT_ENCODER 1 +#define CONFIG_SUBRIP_ENCODER 1 +#define CONFIG_WEBVTT_ENCODER 1 +#define CONFIG_XSUB_ENCODER 1 +#define CONFIG_LIBFAAC_ENCODER 1 +#define CONFIG_LIBFDK_AAC_ENCODER 0 +#define CONFIG_LIBGSM_ENCODER 0 +#define CONFIG_LIBGSM_MS_ENCODER 0 +#define CONFIG_LIBILBC_ENCODER 0 +#define CONFIG_LIBMP3LAME_ENCODER 0 +#define CONFIG_LIBOPENCORE_AMRNB_ENCODER 0 +#define CONFIG_LIBOPENJPEG_ENCODER 0 +#define CONFIG_LIBOPUS_ENCODER 0 +#define CONFIG_LIBSCHROEDINGER_ENCODER 0 +#define CONFIG_LIBSHINE_ENCODER 0 +#define CONFIG_LIBSPEEX_ENCODER 0 +#define CONFIG_LIBTHEORA_ENCODER 0 +#define CONFIG_LIBTWOLAME_ENCODER 0 +#define CONFIG_LIBUTVIDEO_ENCODER 0 +#define CONFIG_LIBVO_AACENC_ENCODER 0 +#define CONFIG_LIBVO_AMRWBENC_ENCODER 0 +#define CONFIG_LIBVORBIS_ENCODER 0 +#define CONFIG_LIBVPX_VP8_ENCODER 0 +#define CONFIG_LIBVPX_VP9_ENCODER 0 +#define CONFIG_LIBWAVPACK_ENCODER 0 +#define CONFIG_LIBWEBP_ENCODER 0 +#define CONFIG_LIBX264_ENCODER 1 +#define CONFIG_LIBX264RGB_ENCODER 1 +#define CONFIG_LIBX265_ENCODER 0 +#define CONFIG_LIBXAVS_ENCODER 0 +#define CONFIG_LIBXVID_ENCODER 0 +#define CONFIG_LIBAACPLUS_ENCODER 0 +#define CONFIG_LIBOPENH264_ENCODER 0 +#define CONFIG_ADELAY_FILTER 1 +#define CONFIG_AECHO_FILTER 1 +#define CONFIG_AEVAL_FILTER 1 +#define CONFIG_AFADE_FILTER 1 +#define CONFIG_AFORMAT_FILTER 1 +#define CONFIG_AINTERLEAVE_FILTER 1 +#define CONFIG_ALLPASS_FILTER 1 +#define CONFIG_AMERGE_FILTER 1 +#define CONFIG_AMIX_FILTER 1 +#define CONFIG_ANULL_FILTER 1 +#define CONFIG_APAD_FILTER 1 +#define CONFIG_APERMS_FILTER 1 +#define CONFIG_APHASER_FILTER 1 +#define CONFIG_ARESAMPLE_FILTER 1 +#define CONFIG_ASELECT_FILTER 1 +#define CONFIG_ASENDCMD_FILTER 1 +#define CONFIG_ASETNSAMPLES_FILTER 1 +#define CONFIG_ASETPTS_FILTER 1 +#define CONFIG_ASETRATE_FILTER 1 +#define CONFIG_ASETTB_FILTER 1 +#define CONFIG_ASHOWINFO_FILTER 1 +#define CONFIG_ASPLIT_FILTER 1 +#define CONFIG_ASTATS_FILTER 1 +#define CONFIG_ASTREAMSYNC_FILTER 1 +#define CONFIG_ASYNCTS_FILTER 0 +#define CONFIG_ATEMPO_FILTER 1 +#define CONFIG_ATRIM_FILTER 1 +#define CONFIG_AZMQ_FILTER 0 +#define CONFIG_BANDPASS_FILTER 1 +#define CONFIG_BANDREJECT_FILTER 1 +#define CONFIG_BASS_FILTER 1 +#define CONFIG_BIQUAD_FILTER 1 +#define CONFIG_BS2B_FILTER 0 +#define CONFIG_CHANNELMAP_FILTER 1 +#define CONFIG_CHANNELSPLIT_FILTER 1 +#define CONFIG_COMPAND_FILTER 1 +#define CONFIG_DCSHIFT_FILTER 1 +#define CONFIG_EARWAX_FILTER 1 +#define CONFIG_EBUR128_FILTER 1 +#define CONFIG_EQUALIZER_FILTER 1 +#define CONFIG_FLANGER_FILTER 1 +#define CONFIG_HIGHPASS_FILTER 1 +#define CONFIG_JOIN_FILTER 1 +#define CONFIG_LADSPA_FILTER 0 +#define CONFIG_LOWPASS_FILTER 1 +#define CONFIG_PAN_FILTER 1 +#define CONFIG_REPLAYGAIN_FILTER 1 +#define CONFIG_RESAMPLE_FILTER 0 +#define CONFIG_SILENCEDETECT_FILTER 1 +#define CONFIG_SILENCEREMOVE_FILTER 1 +#define CONFIG_TREBLE_FILTER 1 +#define CONFIG_VOLUME_FILTER 1 +#define CONFIG_VOLUMEDETECT_FILTER 1 +#define CONFIG_AEVALSRC_FILTER 1 +#define CONFIG_ANULLSRC_FILTER 1 +#define CONFIG_FLITE_FILTER 0 +#define CONFIG_SINE_FILTER 1 +#define CONFIG_ANULLSINK_FILTER 1 +#define CONFIG_ALPHAEXTRACT_FILTER 1 +#define CONFIG_ALPHAMERGE_FILTER 1 +#define CONFIG_ASS_FILTER 0 +#define CONFIG_BBOX_FILTER 1 +#define CONFIG_BLACKDETECT_FILTER 1 +#define CONFIG_BLACKFRAME_FILTER 1 +#define CONFIG_BLEND_FILTER 1 +#define CONFIG_BOXBLUR_FILTER 1 +#define CONFIG_CODECVIEW_FILTER 1 +#define CONFIG_COLORBALANCE_FILTER 1 +#define CONFIG_COLORCHANNELMIXER_FILTER 1 +#define CONFIG_COLORLEVELS_FILTER 1 +#define CONFIG_COLORMATRIX_FILTER 1 +#define CONFIG_COPY_FILTER 1 +#define CONFIG_CROP_FILTER 1 +#define CONFIG_CROPDETECT_FILTER 1 +#define CONFIG_CURVES_FILTER 1 +#define CONFIG_DCTDNOIZ_FILTER 1 +#define CONFIG_DECIMATE_FILTER 1 +#define CONFIG_DEJUDDER_FILTER 1 +#define CONFIG_DELOGO_FILTER 1 +#define CONFIG_DESHAKE_FILTER 1 +#define CONFIG_DRAWBOX_FILTER 1 +#define CONFIG_DRAWGRID_FILTER 1 +#define CONFIG_DRAWTEXT_FILTER 0 +#define CONFIG_EDGEDETECT_FILTER 1 +#define CONFIG_ELBG_FILTER 1 +#define CONFIG_EQ_FILTER 1 +#define CONFIG_EXTRACTPLANES_FILTER 1 +#define CONFIG_FADE_FILTER 1 +#define CONFIG_FIELD_FILTER 1 +#define CONFIG_FIELDMATCH_FILTER 1 +#define CONFIG_FIELDORDER_FILTER 1 +#define CONFIG_FORMAT_FILTER 1 +#define CONFIG_FPS_FILTER 1 +#define CONFIG_FRAMEPACK_FILTER 1 +#define CONFIG_FRAMESTEP_FILTER 1 +#define CONFIG_FREI0R_FILTER 0 +#define CONFIG_FSPP_FILTER 1 +#define CONFIG_GEQ_FILTER 1 +#define CONFIG_GRADFUN_FILTER 1 +#define CONFIG_HALDCLUT_FILTER 1 +#define CONFIG_HFLIP_FILTER 1 +#define CONFIG_HISTEQ_FILTER 1 +#define CONFIG_HISTOGRAM_FILTER 1 +#define CONFIG_HQDN3D_FILTER 1 +#define CONFIG_HQX_FILTER 1 +#define CONFIG_HUE_FILTER 1 +#define CONFIG_IDET_FILTER 1 +#define CONFIG_IL_FILTER 1 +#define CONFIG_INTERLACE_FILTER 1 +#define CONFIG_INTERLEAVE_FILTER 1 +#define CONFIG_KERNDEINT_FILTER 1 +#define CONFIG_LENSCORRECTION_FILTER 1 +#define CONFIG_LUT3D_FILTER 1 +#define CONFIG_LUT_FILTER 1 +#define CONFIG_LUTRGB_FILTER 1 +#define CONFIG_LUTYUV_FILTER 1 +#define CONFIG_MCDEINT_FILTER 1 +#define CONFIG_MERGEPLANES_FILTER 1 +#define CONFIG_MPDECIMATE_FILTER 1 +#define CONFIG_NEGATE_FILTER 1 +#define CONFIG_NOFORMAT_FILTER 1 +#define CONFIG_NOISE_FILTER 1 +#define CONFIG_NULL_FILTER 1 +#define CONFIG_OCV_FILTER 0 +#define CONFIG_OVERLAY_FILTER 1 +#define CONFIG_OWDENOISE_FILTER 1 +#define CONFIG_PAD_FILTER 1 +#define CONFIG_PALETTEGEN_FILTER 1 +#define CONFIG_PALETTEUSE_FILTER 1 +#define CONFIG_PERMS_FILTER 1 +#define CONFIG_PERSPECTIVE_FILTER 1 +#define CONFIG_PHASE_FILTER 1 +#define CONFIG_PIXDESCTEST_FILTER 1 +#define CONFIG_PP_FILTER 1 +#define CONFIG_PP7_FILTER 1 +#define CONFIG_PSNR_FILTER 1 +#define CONFIG_PULLUP_FILTER 1 +#define CONFIG_QP_FILTER 1 +#define CONFIG_REMOVELOGO_FILTER 1 +#define CONFIG_REPEATFIELDS_FILTER 1 +#define CONFIG_ROTATE_FILTER 1 +#define CONFIG_SAB_FILTER 1 +#define CONFIG_SCALE_FILTER 1 +#define CONFIG_SELECT_FILTER 1 +#define CONFIG_SENDCMD_FILTER 1 +#define CONFIG_SEPARATEFIELDS_FILTER 1 +#define CONFIG_SETDAR_FILTER 1 +#define CONFIG_SETFIELD_FILTER 1 +#define CONFIG_SETPTS_FILTER 1 +#define CONFIG_SETSAR_FILTER 1 +#define CONFIG_SETTB_FILTER 1 +#define CONFIG_SHOWINFO_FILTER 1 +#define CONFIG_SHOWPALETTE_FILTER 1 +#define CONFIG_SHUFFLEPLANES_FILTER 1 +#define CONFIG_SIGNALSTATS_FILTER 1 +#define CONFIG_SMARTBLUR_FILTER 1 +#define CONFIG_SPLIT_FILTER 1 +#define CONFIG_SPP_FILTER 1 +#define CONFIG_STEREO3D_FILTER 1 +#define CONFIG_SUBTITLES_FILTER 0 +#define CONFIG_SUPER2XSAI_FILTER 1 +#define CONFIG_SWAPUV_FILTER 1 +#define CONFIG_TBLEND_FILTER 1 +#define CONFIG_TELECINE_FILTER 1 +#define CONFIG_THUMBNAIL_FILTER 1 +#define CONFIG_TILE_FILTER 1 +#define CONFIG_TINTERLACE_FILTER 1 +#define CONFIG_TRANSPOSE_FILTER 1 +#define CONFIG_TRIM_FILTER 1 +#define CONFIG_UNSHARP_FILTER 1 +#define CONFIG_USPP_FILTER 1 +#define CONFIG_VFLIP_FILTER 1 +#define CONFIG_VIDSTABDETECT_FILTER 0 +#define CONFIG_VIDSTABTRANSFORM_FILTER 0 +#define CONFIG_VIGNETTE_FILTER 1 +#define CONFIG_W3FDIF_FILTER 1 +#define CONFIG_XBR_FILTER 1 +#define CONFIG_YADIF_FILTER 1 +#define CONFIG_ZMQ_FILTER 0 +#define CONFIG_ZOOMPAN_FILTER 1 +#define CONFIG_CELLAUTO_FILTER 1 +#define CONFIG_COLOR_FILTER 1 +#define CONFIG_FREI0R_SRC_FILTER 0 +#define CONFIG_HALDCLUTSRC_FILTER 1 +#define CONFIG_LIFE_FILTER 1 +#define CONFIG_MANDELBROT_FILTER 1 +#define CONFIG_MPTESTSRC_FILTER 1 +#define CONFIG_NULLSRC_FILTER 1 +#define CONFIG_RGBTESTSRC_FILTER 1 +#define CONFIG_SMPTEBARS_FILTER 1 +#define CONFIG_SMPTEHDBARS_FILTER 1 +#define CONFIG_TESTSRC_FILTER 1 +#define CONFIG_NULLSINK_FILTER 1 +#define CONFIG_AVECTORSCOPE_FILTER 1 +#define CONFIG_CONCAT_FILTER 1 +#define CONFIG_SHOWCQT_FILTER 1 +#define CONFIG_SHOWSPECTRUM_FILTER 1 +#define CONFIG_SHOWWAVES_FILTER 1 +#define CONFIG_AMOVIE_FILTER 1 +#define CONFIG_MOVIE_FILTER 1 +#define CONFIG_H263_VAAPI_HWACCEL 0 +#define CONFIG_H263_VDPAU_HWACCEL 0 +#define CONFIG_H264_DXVA2_HWACCEL 0 +#define CONFIG_H264_QSV_HWACCEL 0 +#define CONFIG_H264_VAAPI_HWACCEL 0 +#define CONFIG_H264_VDA_HWACCEL 0 +#define CONFIG_H264_VDA_OLD_HWACCEL 0 +#define CONFIG_H264_VDPAU_HWACCEL 0 +#define CONFIG_HEVC_DXVA2_HWACCEL 0 +#define CONFIG_MPEG1_XVMC_HWACCEL 0 +#define CONFIG_MPEG1_VDPAU_HWACCEL 0 +#define CONFIG_MPEG2_XVMC_HWACCEL 0 +#define CONFIG_MPEG2_DXVA2_HWACCEL 0 +#define CONFIG_MPEG2_VAAPI_HWACCEL 0 +#define CONFIG_MPEG2_VDPAU_HWACCEL 0 +#define CONFIG_MPEG4_VAAPI_HWACCEL 0 +#define CONFIG_MPEG4_VDPAU_HWACCEL 0 +#define CONFIG_VC1_DXVA2_HWACCEL 0 +#define CONFIG_VC1_VAAPI_HWACCEL 0 +#define CONFIG_VC1_VDPAU_HWACCEL 0 +#define CONFIG_WMV3_DXVA2_HWACCEL 0 +#define CONFIG_WMV3_VAAPI_HWACCEL 0 +#define CONFIG_WMV3_VDPAU_HWACCEL 0 +#define CONFIG_ALSA_INDEV 0 +#define CONFIG_AVFOUNDATION_INDEV 0 +#define CONFIG_BKTR_INDEV 0 +#define CONFIG_DECKLINK_INDEV 0 +#define CONFIG_DSHOW_INDEV 0 +#define CONFIG_DV1394_INDEV 1 +#define CONFIG_FBDEV_INDEV 1 +#define CONFIG_GDIGRAB_INDEV 0 +#define CONFIG_IEC61883_INDEV 0 +#define CONFIG_JACK_INDEV 0 +#define CONFIG_LAVFI_INDEV 1 +#define CONFIG_OPENAL_INDEV 0 +#define CONFIG_OSS_INDEV 0 +#define CONFIG_PULSE_INDEV 0 +#define CONFIG_QTKIT_INDEV 0 +#define CONFIG_SNDIO_INDEV 0 +#define CONFIG_V4L2_INDEV 1 +#define CONFIG_VFWCAP_INDEV 0 +#define CONFIG_X11GRAB_INDEV 0 +#define CONFIG_X11GRAB_XCB_INDEV 0 +#define CONFIG_LIBCDIO_INDEV 0 +#define CONFIG_LIBDC1394_INDEV 0 +#define CONFIG_A64_MUXER 1 +#define CONFIG_AC3_MUXER 1 +#define CONFIG_ADTS_MUXER 1 +#define CONFIG_ADX_MUXER 1 +#define CONFIG_AIFF_MUXER 1 +#define CONFIG_AMR_MUXER 1 +#define CONFIG_ASF_MUXER 1 +#define CONFIG_ASS_MUXER 1 +#define CONFIG_AST_MUXER 1 +#define CONFIG_ASF_STREAM_MUXER 1 +#define CONFIG_AU_MUXER 1 +#define CONFIG_AVI_MUXER 1 +#define CONFIG_AVM2_MUXER 1 +#define CONFIG_BIT_MUXER 1 +#define CONFIG_CAF_MUXER 1 +#define CONFIG_CAVSVIDEO_MUXER 1 +#define CONFIG_CRC_MUXER 1 +#define CONFIG_DASH_MUXER 1 +#define CONFIG_DATA_MUXER 1 +#define CONFIG_DAUD_MUXER 1 +#define CONFIG_DIRAC_MUXER 1 +#define CONFIG_DNXHD_MUXER 1 +#define CONFIG_DTS_MUXER 1 +#define CONFIG_DV_MUXER 1 +#define CONFIG_EAC3_MUXER 1 +#define CONFIG_F4V_MUXER 1 +#define CONFIG_FFM_MUXER 1 +#define CONFIG_FFMETADATA_MUXER 1 +#define CONFIG_FILMSTRIP_MUXER 1 +#define CONFIG_FLAC_MUXER 1 +#define CONFIG_FLV_MUXER 1 +#define CONFIG_FRAMECRC_MUXER 1 +#define CONFIG_FRAMEMD5_MUXER 1 +#define CONFIG_G722_MUXER 1 +#define CONFIG_G723_1_MUXER 1 +#define CONFIG_GIF_MUXER 1 +#define CONFIG_GXF_MUXER 1 +#define CONFIG_H261_MUXER 1 +#define CONFIG_H263_MUXER 1 +#define CONFIG_H264_MUXER 1 +#define CONFIG_HDS_MUXER 1 +#define CONFIG_HEVC_MUXER 1 +#define CONFIG_HLS_MUXER 1 +#define CONFIG_ICO_MUXER 1 +#define CONFIG_ILBC_MUXER 1 +#define CONFIG_IMAGE2_MUXER 1 +#define CONFIG_IMAGE2PIPE_MUXER 1 +#define CONFIG_IPOD_MUXER 1 +#define CONFIG_IRCAM_MUXER 1 +#define CONFIG_ISMV_MUXER 1 +#define CONFIG_IVF_MUXER 1 +#define CONFIG_JACOSUB_MUXER 1 +#define CONFIG_LATM_MUXER 1 +#define CONFIG_LRC_MUXER 1 +#define CONFIG_M4V_MUXER 1 +#define CONFIG_MD5_MUXER 1 +#define CONFIG_MATROSKA_MUXER 1 +#define CONFIG_MATROSKA_AUDIO_MUXER 1 +#define CONFIG_MICRODVD_MUXER 1 +#define CONFIG_MJPEG_MUXER 1 +#define CONFIG_MLP_MUXER 1 +#define CONFIG_MMF_MUXER 1 +#define CONFIG_MOV_MUXER 1 +#define CONFIG_MP2_MUXER 1 +#define CONFIG_MP3_MUXER 1 +#define CONFIG_MP4_MUXER 1 +#define CONFIG_MPEG1SYSTEM_MUXER 1 +#define CONFIG_MPEG1VCD_MUXER 1 +#define CONFIG_MPEG1VIDEO_MUXER 1 +#define CONFIG_MPEG2DVD_MUXER 1 +#define CONFIG_MPEG2SVCD_MUXER 1 +#define CONFIG_MPEG2VIDEO_MUXER 1 +#define CONFIG_MPEG2VOB_MUXER 1 +#define CONFIG_MPEGTS_MUXER 1 +#define CONFIG_MPJPEG_MUXER 1 +#define CONFIG_MXF_MUXER 1 +#define CONFIG_MXF_D10_MUXER 1 +#define CONFIG_MXF_OPATOM_MUXER 1 +#define CONFIG_NULL_MUXER 1 +#define CONFIG_NUT_MUXER 1 +#define CONFIG_OGA_MUXER 1 +#define CONFIG_OGG_MUXER 1 +#define CONFIG_OMA_MUXER 1 +#define CONFIG_OPUS_MUXER 1 +#define CONFIG_PCM_ALAW_MUXER 1 +#define CONFIG_PCM_MULAW_MUXER 1 +#define CONFIG_PCM_F64BE_MUXER 1 +#define CONFIG_PCM_F64LE_MUXER 1 +#define CONFIG_PCM_F32BE_MUXER 1 +#define CONFIG_PCM_F32LE_MUXER 1 +#define CONFIG_PCM_S32BE_MUXER 1 +#define CONFIG_PCM_S32LE_MUXER 1 +#define CONFIG_PCM_S24BE_MUXER 1 +#define CONFIG_PCM_S24LE_MUXER 1 +#define CONFIG_PCM_S16BE_MUXER 1 +#define CONFIG_PCM_S16LE_MUXER 1 +#define CONFIG_PCM_S8_MUXER 1 +#define CONFIG_PCM_U32BE_MUXER 1 +#define CONFIG_PCM_U32LE_MUXER 1 +#define CONFIG_PCM_U24BE_MUXER 1 +#define CONFIG_PCM_U24LE_MUXER 1 +#define CONFIG_PCM_U16BE_MUXER 1 +#define CONFIG_PCM_U16LE_MUXER 1 +#define CONFIG_PCM_U8_MUXER 1 +#define CONFIG_PSP_MUXER 1 +#define CONFIG_RAWVIDEO_MUXER 1 +#define CONFIG_RM_MUXER 1 +#define CONFIG_ROQ_MUXER 1 +#define CONFIG_RSO_MUXER 1 +#define CONFIG_RTP_MUXER 1 +#define CONFIG_RTP_MPEGTS_MUXER 1 +#define CONFIG_RTSP_MUXER 1 +#define CONFIG_SAP_MUXER 1 +#define CONFIG_SEGMENT_MUXER 1 +#define CONFIG_STREAM_SEGMENT_MUXER 1 +#define CONFIG_SMJPEG_MUXER 1 +#define CONFIG_SMOOTHSTREAMING_MUXER 1 +#define CONFIG_SOX_MUXER 1 +#define CONFIG_SPX_MUXER 1 +#define CONFIG_SPDIF_MUXER 1 +#define CONFIG_SRT_MUXER 1 +#define CONFIG_SWF_MUXER 1 +#define CONFIG_TEE_MUXER 1 +#define CONFIG_TG2_MUXER 1 +#define CONFIG_TGP_MUXER 1 +#define CONFIG_MKVTIMESTAMP_V2_MUXER 1 +#define CONFIG_TRUEHD_MUXER 1 +#define CONFIG_UNCODEDFRAMECRC_MUXER 1 +#define CONFIG_VC1_MUXER 1 +#define CONFIG_VC1T_MUXER 1 +#define CONFIG_VOC_MUXER 1 +#define CONFIG_W64_MUXER 1 +#define CONFIG_WAV_MUXER 1 +#define CONFIG_WEBM_MUXER 1 +#define CONFIG_WEBM_DASH_MANIFEST_MUXER 1 +#define CONFIG_WEBP_MUXER 1 +#define CONFIG_WEBVTT_MUXER 1 +#define CONFIG_WTV_MUXER 1 +#define CONFIG_WV_MUXER 1 +#define CONFIG_YUV4MPEGPIPE_MUXER 1 +#define CONFIG_LIBNUT_MUXER 0 +#define CONFIG_ALSA_OUTDEV 0 +#define CONFIG_CACA_OUTDEV 0 +#define CONFIG_DECKLINK_OUTDEV 0 +#define CONFIG_FBDEV_OUTDEV 1 +#define CONFIG_OPENGL_OUTDEV 0 +#define CONFIG_OSS_OUTDEV 0 +#define CONFIG_PULSE_OUTDEV 0 +#define CONFIG_SDL_OUTDEV 0 +#define CONFIG_SNDIO_OUTDEV 0 +#define CONFIG_V4L2_OUTDEV 1 +#define CONFIG_XV_OUTDEV 0 +#define CONFIG_AAC_PARSER 1 +#define CONFIG_AAC_LATM_PARSER 1 +#define CONFIG_AC3_PARSER 1 +#define CONFIG_ADX_PARSER 1 +#define CONFIG_BMP_PARSER 1 +#define CONFIG_CAVSVIDEO_PARSER 1 +#define CONFIG_COOK_PARSER 1 +#define CONFIG_DCA_PARSER 1 +#define CONFIG_DIRAC_PARSER 1 +#define CONFIG_DNXHD_PARSER 1 +#define CONFIG_DPX_PARSER 1 +#define CONFIG_DVBSUB_PARSER 1 +#define CONFIG_DVDSUB_PARSER 1 +#define CONFIG_DVD_NAV_PARSER 1 +#define CONFIG_FLAC_PARSER 1 +#define CONFIG_GSM_PARSER 1 +#define CONFIG_H261_PARSER 1 +#define CONFIG_H263_PARSER 1 +#define CONFIG_H264_PARSER 1 +#define CONFIG_HEVC_PARSER 1 +#define CONFIG_MJPEG_PARSER 1 +#define CONFIG_MLP_PARSER 1 +#define CONFIG_MPEG4VIDEO_PARSER 1 +#define CONFIG_MPEGAUDIO_PARSER 1 +#define CONFIG_MPEGVIDEO_PARSER 1 +#define CONFIG_OPUS_PARSER 1 +#define CONFIG_PNG_PARSER 1 +#define CONFIG_PNM_PARSER 1 +#define CONFIG_RV30_PARSER 1 +#define CONFIG_RV40_PARSER 1 +#define CONFIG_TAK_PARSER 1 +#define CONFIG_VC1_PARSER 1 +#define CONFIG_VORBIS_PARSER 1 +#define CONFIG_VP3_PARSER 1 +#define CONFIG_VP8_PARSER 1 +#define CONFIG_VP9_PARSER 1 +#define CONFIG_BLURAY_PROTOCOL 0 +#define CONFIG_CACHE_PROTOCOL 1 +#define CONFIG_CONCAT_PROTOCOL 1 +#define CONFIG_CRYPTO_PROTOCOL 1 +#define CONFIG_DATA_PROTOCOL 1 +#define CONFIG_FFRTMPCRYPT_PROTOCOL 0 +#define CONFIG_FFRTMPHTTP_PROTOCOL 1 +#define CONFIG_FILE_PROTOCOL 1 +#define CONFIG_FTP_PROTOCOL 1 +#define CONFIG_GOPHER_PROTOCOL 1 +#define CONFIG_HLS_PROTOCOL 1 +#define CONFIG_HTTP_PROTOCOL 1 +#define CONFIG_HTTPPROXY_PROTOCOL 1 +#define CONFIG_HTTPS_PROTOCOL 0 +#define CONFIG_ICECAST_PROTOCOL 1 +#define CONFIG_MMSH_PROTOCOL 1 +#define CONFIG_MMST_PROTOCOL 1 +#define CONFIG_MD5_PROTOCOL 1 +#define CONFIG_PIPE_PROTOCOL 1 +#define CONFIG_RTMP_PROTOCOL 1 +#define CONFIG_RTMPE_PROTOCOL 0 +#define CONFIG_RTMPS_PROTOCOL 0 +#define CONFIG_RTMPT_PROTOCOL 1 +#define CONFIG_RTMPTE_PROTOCOL 0 +#define CONFIG_RTMPTS_PROTOCOL 0 +#define CONFIG_RTP_PROTOCOL 1 +#define CONFIG_SCTP_PROTOCOL 0 +#define CONFIG_SRTP_PROTOCOL 1 +#define CONFIG_SUBFILE_PROTOCOL 1 +#define CONFIG_TCP_PROTOCOL 1 +#define CONFIG_TLS_PROTOCOL 0 +#define CONFIG_UDP_PROTOCOL 1 +#define CONFIG_UDPLITE_PROTOCOL 1 +#define CONFIG_UNIX_PROTOCOL 1 +#define CONFIG_LIBRTMP_PROTOCOL 0 +#define CONFIG_LIBRTMPE_PROTOCOL 0 +#define CONFIG_LIBRTMPS_PROTOCOL 0 +#define CONFIG_LIBRTMPT_PROTOCOL 0 +#define CONFIG_LIBRTMPTE_PROTOCOL 0 +#define CONFIG_LIBSSH_PROTOCOL 0 +#define CONFIG_LIBSMBCLIENT_PROTOCOL 0 +#endif /* FFMPEG_CONFIG_H */ diff --git a/app/src/main/cpp/dji_video_jni.c b/app/src/main/cpp/dji_video_jni.c new file mode 100755 index 0000000..d58ccd5 --- /dev/null +++ b/app/src/main/cpp/dji_video_jni.c @@ -0,0 +1,223 @@ +#include +#include +#include +#include + +#include "libavcodec/avcodec.h" +#include "libavformat/avformat.h" +#include "libavfilter/avfilter.h" + +// Log +#ifdef ANDROID + +#include +#include + +#define LOGE(format, ...) __android_log_print(ANDROID_LOG_ERROR, "DJI", format, ##__VA_ARGS__) +#define LOGD(format, ...) __android_log_print(ANDROID_LOG_DEBUG, "DJI", format, ##__VA_ARGS__) +#else +#define LOGE(format, ...) printf("DJI" format "\n", ##__VA_ARGS__) +#define LOGD(format, ...) printf("DJI" format "\n", ##__VA_ARGS__) +#endif + +int isFFmpegInitialized; + +AVFrame *m_pYUVFrame; +AVCodecContext *m_pCodecCtx; +AVCodec *m_pAVCodec; +AVCodecParserContext *m_pCodecPaser; + +jmethodID dataCallbackMID; + +//FIX +struct URLProtocol; + +/** + * Codec information + */ +JNIEXPORT jstring +Java_io_diux_rogue_rosettadrone_video_NativeHelper_codecinfotest(JNIEnv *env, jobject obj) { + char info[40000] = {0}; + + av_register_all(); + + AVCodec *codec_head = av_codec_next(NULL); + + while (codec_head != NULL) { + + sprintf(info, "%s\n", codec_head->name); + codec_head = codec_head->next; + } + LOGE("%s", info); + + return (*env)->NewStringUTF(env, info); +} + +/** + * Invoke the java callback method + */ +void invokeFrameDataCallback(JNIEnv *env, jobject obj, uint8_t *buf, int size, int frameNum, + int isKeyFrame, int width, int height) { + jbyte *buff = (jbyte *) buf; + jbyteArray jarray = (*env)->NewByteArray(env, size); + (*env)->SetByteArrayRegion(env, jarray, 0, size, buf); + (*env)->CallVoidMethod(env, obj, dataCallbackMID, jarray, size, frameNum, isKeyFrame != 0, + width, height); +} + +/** + * Initialize the ffmpeg and software decoder. + */ +JNIEXPORT jboolean +Java_io_diux_rogue_rosettadrone_video_NativeHelper_init(JNIEnv *env, jobject obj) { + jclass clazz = (*env)->GetObjectClass(env, obj); + dataCallbackMID = (*env)->GetMethodID(env, clazz, "onFrameDataRecv", "([BIIZII)V"); + if (isFFmpegInitialized == 0) { + avcodec_register_all(); + av_register_all(); + isFFmpegInitialized = 1; + } + m_pAVCodec = avcodec_find_decoder(AV_CODEC_ID_H264); + m_pCodecCtx = avcodec_alloc_context3(m_pAVCodec); + m_pCodecPaser = av_parser_init(AV_CODEC_ID_H264); + if (m_pAVCodec == NULL || m_pCodecCtx == NULL) { + LOGD("m_pAVCodec == NULL||m_pCodecCtx == NULL"); + return 0; + } + + if (m_pAVCodec->capabilities & CODEC_CAP_TRUNCATED) + m_pCodecCtx->flags |= CODEC_FLAG_TRUNCATED; + + m_pCodecCtx->thread_count = 4; + m_pCodecCtx->thread_type = FF_THREAD_FRAME; + + if (avcodec_open2(m_pCodecCtx, m_pAVCodec, NULL) < 0) { + m_pAVCodec = NULL; + return 0; + } + + m_pYUVFrame = av_frame_alloc(); + + if (m_pYUVFrame == NULL) { + LOGD(" CDecoder avcodec_alloc_frame() == NULL "); + return 0; + } + LOGD("CDecoder::prepare()2"); + return 1; +} + +/** + * Framing the raw data from camera using the av parser. + */ +int parse(JNIEnv *env, jobject obj, uint8_t *pBuff, int videosize, uint64_t pts) { + int paserLength_In = videosize; + int paserLen; + int decode_data_length; + int got_picture = 0; + uint8_t *pFrameBuff = (uint8_t *) pBuff; + while (paserLength_In > 0) { + AVPacket packet; + av_init_packet(&packet); + if (m_pCodecPaser == NULL) { + LOGE("m_pCodecPaser == NULL"); + Java_io_diux_rogue_rosettadrone_video_NativeHelper_init(env, obj); + } + if (m_pCodecCtx == NULL) { + LOGE("m_pCodecCtx == NULL"); + Java_io_diux_rogue_rosettadrone_video_NativeHelper_init(env, obj); + } + paserLen = av_parser_parse2(m_pCodecPaser, m_pCodecCtx, &packet.data, &packet.size, + pFrameBuff, + paserLength_In, AV_NOPTS_VALUE, AV_NOPTS_VALUE, AV_NOPTS_VALUE); + + //LOGD("paserLen = %d",paserLen); + paserLength_In -= paserLen; + pFrameBuff += paserLen; + + if (packet.size > 0) { + + // LOGD( + // "packet size=%d, pts=%lld, width_in_pixel=%d, height_in_pixel=%d, key_frame=%d, frame_has_sps=%d, frame_has_pps=%d, frame_num=%d", + // packet.size, + // pts, + // m_pCodecPaser->width_in_pixel, + // m_pCodecPaser->height_in_pixel, + // m_pCodecPaser->key_frame, + // m_pCodecPaser->frame_has_sps, + // m_pCodecPaser->frame_has_pps, + // m_pCodecPaser->frame_num + // ); + invokeFrameDataCallback( + env, + obj, + packet.data, + packet.size, + m_pCodecPaser->frame_num, + m_pCodecPaser->key_frame, + m_pCodecPaser->width_in_pixel, + m_pCodecPaser->height_in_pixel + ); + + } + av_free_packet(&packet); + } + + return 0; +} + +uint8_t audbuffer2[] = {0x00, 0x00, 0x00, 0x01, 0x09, 0x10}; +uint8_t audsize2 = 6; +uint8_t fillerbuffer2[] = {0x00, 0x00, 0x00, 0x01, 0x0C, 0x00, 0x00, 0x00, 0x01, 0x09, 0x10}; +uint8_t fillersize2 = 11; +uint8_t audaudbuffer2[] = {0x00, 0x00, 0x00, 0x01, 0x09, 0x10, 0x00, 0x00, 0x00, 0x01, 0x09, 0x10}; +uint8_t audaudsize2 = 12; +/** + * Framing the raw data from camera. + */ +JNIEXPORT jboolean +Java_io_diux_rogue_rosettadrone_video_NativeHelper_parse(JNIEnv *env, jobject obj, jbyteArray pBuff, + int size) { + jbyte *jBuff = (jbyte *) ((*env)->GetByteArrayElements(env, pBuff, 0)); + uint8_t *buff = (uint8_t *) jBuff; + uint64_t pts = 0; + jbyte *jBuff2; + + // LOGD("pts=%llu", pts); + + // Removing the aud bytes. + if (size >= fillersize2 && memcmp(fillerbuffer2, buff + size - fillersize2, fillersize2) == 0) { + LOGD("Remove filler+AUD"); + parse(env, obj, buff, size - fillersize2, pts); + } else if (size >= audaudsize2 && + memcmp(audaudbuffer2, buff + size - audaudsize2, audaudsize2) == 0) { + LOGD("Remove AUD+AUD"); + parse(env, obj, buff, size - audaudsize2, pts); + } else if (size >= audsize2 && memcmp(audbuffer2, buff + size - audsize2, audsize2) == 0) { + LOGD("Remove AUD"); + parse(env, obj, buff, size - audsize2, pts); + } else { + // LOGD("Remove Nothing"); + parse(env, obj, buff, size, pts); + } + (*env)->ReleaseByteArrayElements(env, pBuff, jBuff, 0); + + return 1; +} + + +/** + * Release the ffmpeg. + */ +JNIEXPORT jboolean +Java_io_diux_rogue_rosettadrone_video_NativeHelper_release(JNIEnv *env, jobject obj) { + if (m_pCodecCtx) { + avcodec_close(m_pCodecCtx); + m_pCodecCtx = NULL; + } + + av_free(m_pYUVFrame); + av_free(m_pCodecCtx); + av_parser_close(m_pCodecPaser); + + return 1; +} \ No newline at end of file diff --git a/app/src/main/cpp/ffmpeg.h b/app/src/main/cpp/ffmpeg.h new file mode 100644 index 0000000..e9f177a --- /dev/null +++ b/app/src/main/cpp/ffmpeg.h @@ -0,0 +1,557 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef FFMPEG_H +#define FFMPEG_H + +#include "config.h" + +#include +#include +#include + +#if HAVE_PTHREADS + +#include + +#endif + +#include "cmdutils.h" + +#include "libavformat/avformat.h" +#include "libavformat/avio.h" + +#include "libavcodec/avcodec.h" + +#include "libavfilter/avfilter.h" + +#include "libavutil/avutil.h" +#include "libavutil/dict.h" +#include "libavutil/eval.h" +#include "libavutil/fifo.h" +#include "libavutil/pixfmt.h" +#include "libavutil/rational.h" +#include "libavutil/threadmessage.h" + +#include "libswresample/swresample.h" + +#define VSYNC_AUTO -1 +#define VSYNC_PASSTHROUGH 0 +#define VSYNC_CFR 1 +#define VSYNC_VFR 2 +#define VSYNC_VSCFR 0xfe +#define VSYNC_DROP 0xff + +#define MAX_STREAMS 1024 /* arbitrary sanity check value */ + +enum HWAccelID { + HWACCEL_NONE = 0, + HWACCEL_AUTO, + HWACCEL_VDPAU, + HWACCEL_DXVA2, + HWACCEL_VDA, +}; + +typedef struct HWAccel { + const char *name; + + int (*init)(AVCodecContext *s); + + enum HWAccelID id; + enum AVPixelFormat pix_fmt; +} HWAccel; + +/* select an input stream for an output stream */ +typedef struct StreamMap { + int disabled; /* 1 is this mapping is disabled by a negative map */ + int file_index; + int stream_index; + int sync_file_index; + int sync_stream_index; + char *linklabel; /* name of an output link, for mapping lavfi outputs */ +} StreamMap; + +typedef struct { + int file_idx, stream_idx, channel_idx; // input + int ofile_idx, ostream_idx; // output +} AudioChannelMap; + +typedef struct OptionsContext { + OptionGroup *g; + + /* input/output options */ + int64_t start_time; + const char *format; + + SpecifierOpt *codec_names; + int nb_codec_names; + SpecifierOpt *audio_channels; + int nb_audio_channels; + SpecifierOpt *audio_sample_rate; + int nb_audio_sample_rate; + SpecifierOpt *frame_rates; + int nb_frame_rates; + SpecifierOpt *frame_sizes; + int nb_frame_sizes; + SpecifierOpt *frame_pix_fmts; + int nb_frame_pix_fmts; + + /* input options */ + int64_t input_ts_offset; + int rate_emu; + int accurate_seek; + int thread_queue_size; + + SpecifierOpt *ts_scale; + int nb_ts_scale; + SpecifierOpt *dump_attachment; + int nb_dump_attachment; + SpecifierOpt *hwaccels; + int nb_hwaccels; + SpecifierOpt *hwaccel_devices; + int nb_hwaccel_devices; + + /* output options */ + StreamMap *stream_maps; + int nb_stream_maps; + AudioChannelMap *audio_channel_maps; /* one info entry per -map_channel */ + int nb_audio_channel_maps; /* number of (valid) -map_channel settings */ + int metadata_global_manual; + int metadata_streams_manual; + int metadata_chapters_manual; + const char **attachments; + int nb_attachments; + + int chapters_input_file; + + int64_t recording_time; + int64_t stop_time; + uint64_t limit_filesize; + float mux_preload; + float mux_max_delay; + int shortest; + + int video_disable; + int audio_disable; + int subtitle_disable; + int data_disable; + + /* indexed by output file stream index */ + int *streamid_map; + int nb_streamid_map; + + SpecifierOpt *metadata; + int nb_metadata; + SpecifierOpt *max_frames; + int nb_max_frames; + SpecifierOpt *bitstream_filters; + int nb_bitstream_filters; + SpecifierOpt *codec_tags; + int nb_codec_tags; + SpecifierOpt *sample_fmts; + int nb_sample_fmts; + SpecifierOpt *qscale; + int nb_qscale; + SpecifierOpt *forced_key_frames; + int nb_forced_key_frames; + SpecifierOpt *force_fps; + int nb_force_fps; + SpecifierOpt *frame_aspect_ratios; + int nb_frame_aspect_ratios; + SpecifierOpt *rc_overrides; + int nb_rc_overrides; + SpecifierOpt *intra_matrices; + int nb_intra_matrices; + SpecifierOpt *inter_matrices; + int nb_inter_matrices; + SpecifierOpt *chroma_intra_matrices; + int nb_chroma_intra_matrices; + SpecifierOpt *top_field_first; + int nb_top_field_first; + SpecifierOpt *metadata_map; + int nb_metadata_map; + SpecifierOpt *presets; + int nb_presets; + SpecifierOpt *copy_initial_nonkeyframes; + int nb_copy_initial_nonkeyframes; + SpecifierOpt *copy_prior_start; + int nb_copy_prior_start; + SpecifierOpt *filters; + int nb_filters; + SpecifierOpt *filter_scripts; + int nb_filter_scripts; + SpecifierOpt *reinit_filters; + int nb_reinit_filters; + SpecifierOpt *fix_sub_duration; + int nb_fix_sub_duration; + SpecifierOpt *canvas_sizes; + int nb_canvas_sizes; + SpecifierOpt *pass; + int nb_pass; + SpecifierOpt *passlogfiles; + int nb_passlogfiles; + SpecifierOpt *guess_layout_max; + int nb_guess_layout_max; + SpecifierOpt *apad; + int nb_apad; + SpecifierOpt *discard; + int nb_discard; + SpecifierOpt *disposition; + int nb_disposition; +} OptionsContext; + +typedef struct InputFilter { + AVFilterContext *filter; + struct InputStream *ist; + struct FilterGraph *graph; + uint8_t *name; +} InputFilter; + +typedef struct OutputFilter { + AVFilterContext *filter; + struct OutputStream *ost; + struct FilterGraph *graph; + uint8_t *name; + + /* temporary storage until stream maps are processed */ + AVFilterInOut *out_tmp; +} OutputFilter; + +typedef struct FilterGraph { + int index; + const char *graph_desc; + + AVFilterGraph *graph; + int reconfiguration; + + InputFilter **inputs; + int nb_inputs; + OutputFilter **outputs; + int nb_outputs; +} FilterGraph; + +typedef struct InputStream { + int file_index; + AVStream *st; + int discard; /* true if stream data should be discarded */ + int user_set_discard; + int decoding_needed; /* non zero if the packets must be decoded in 'raw_fifo', see DECODING_FOR_* */ +#define DECODING_FOR_OST 1 +#define DECODING_FOR_FILTER 2 + + AVCodecContext *dec_ctx; + AVCodec *dec; + AVFrame *decoded_frame; + AVFrame *filter_frame; /* a ref of decoded_frame, to be sent to filters */ + + int64_t start; /* time when read started */ + /* predicted dts of the next packet read for this stream or (when there are + * several frames in a packet) of the next frame in current packet (in AV_TIME_BASE units) */ + int64_t next_dts; + int64_t dts; ///< dts of the last packet read for this stream (in AV_TIME_BASE units) + + int64_t next_pts; ///< synthetic pts for the next decode frame (in AV_TIME_BASE units) + int64_t pts; ///< current pts of the decoded frame (in AV_TIME_BASE units) + int wrap_correction_done; + + int64_t filter_in_rescale_delta_last; + + double ts_scale; + int saw_first_ts; + int showed_multi_packet_warning; + AVDictionary *decoder_opts; + AVRational framerate; /* framerate forced with -r */ + int top_field_first; + int guess_layout_max; + + int resample_height; + int resample_width; + int resample_pix_fmt; + + int resample_sample_fmt; + int resample_sample_rate; + int resample_channels; + uint64_t resample_channel_layout; + + int fix_sub_duration; + struct { /* previous decoded subtitle and related variables */ + int got_output; + int ret; + AVSubtitle subtitle; + } prev_sub; + + struct sub2video { + int64_t last_pts; + int64_t end_pts; + AVFrame *frame; + int w, h; + } sub2video; + + int dr1; + + /* decoded data from this stream goes into all those filters + * currently video and audio only */ + InputFilter **filters; + int nb_filters; + + int reinit_filters; + + /* hwaccel options */ + enum HWAccelID hwaccel_id; + char *hwaccel_device; + + /* hwaccel context */ + enum HWAccelID active_hwaccel_id; + void *hwaccel_ctx; + + void (*hwaccel_uninit)(AVCodecContext *s); + + int (*hwaccel_get_buffer)(AVCodecContext *s, AVFrame *frame, int flags); + + int (*hwaccel_retrieve_data)(AVCodecContext *s, AVFrame *frame); + + enum AVPixelFormat hwaccel_pix_fmt; + enum AVPixelFormat hwaccel_retrieved_pix_fmt; + + /* stats */ + // combined size of all the packets read + uint64_t data_size; + /* number of packets successfully read for this stream */ + uint64_t nb_packets; + // number of frames/samples retrieved from the decoder + uint64_t frames_decoded; + uint64_t samples_decoded; +} InputStream; + +typedef struct InputFile { + AVFormatContext *ctx; + int eof_reached; /* true if eof reached */ + int eagain; /* true if last read attempt returned EAGAIN */ + int ist_index; /* index of first stream in input_streams */ + int64_t input_ts_offset; + int64_t ts_offset; + int64_t last_ts; + int64_t start_time; /* user-specified start time in AV_TIME_BASE or AV_NOPTS_VALUE */ + int64_t recording_time; + int nb_streams; /* number of stream that ffmpeg is aware of; may be different + from ctx.nb_streams if new streams appear during av_read_frame() */ + int nb_streams_warn; /* number of streams that the user was warned of */ + int rate_emu; + int accurate_seek; + +#if HAVE_PTHREADS + AVThreadMessageQueue *in_thread_queue; + pthread_t thread; /* thread reading from this file */ + int non_blocking; /* reading packets from the thread should not block */ + int joined; /* the thread has been joined */ + int thread_queue_size; /* maximum number of queued packets */ +#endif +} InputFile; + +enum forced_keyframes_const { + FKF_N, + FKF_N_FORCED, + FKF_PREV_FORCED_N, + FKF_PREV_FORCED_T, + FKF_T, + FKF_NB +}; + +extern const char *const forced_keyframes_const_names[]; + +typedef enum { + ENCODER_FINISHED = 1, + MUXER_FINISHED = 2, +} OSTFinished; + +typedef struct OutputStream { + int file_index; /* file index */ + int index; /* stream index in the output file */ + int source_index; /* InputStream index */ + AVStream *st; /* stream in the output file */ + int encoding_needed; /* true if encoding needed for this stream */ + int frame_number; + /* input pts and corresponding output pts + for A/V sync */ + struct InputStream *sync_ist; /* input stream to sync against */ + int64_t sync_opts; /* output frame counter, could be changed to some true timestamp */ // FIXME look at frame_number + /* pts of the first frame encoded for this stream, used for limiting + * recording time */ + int64_t first_pts; + /* dts of the last packet sent to the muxer */ + int64_t last_mux_dts; + AVBitStreamFilterContext *bitstream_filters; + AVCodecContext *enc_ctx; + AVCodec *enc; + int64_t max_frames; + AVFrame *filtered_frame; + AVFrame *last_frame; + int last_droped; + + /* video only */ + AVRational frame_rate; + int force_fps; + int top_field_first; + + AVRational frame_aspect_ratio; + + /* forced key frames */ + int64_t *forced_kf_pts; + int forced_kf_count; + int forced_kf_index; + char *forced_keyframes; + AVExpr *forced_keyframes_pexpr; + double forced_keyframes_expr_const_values[FKF_NB]; + + /* audio only */ + int *audio_channels_map; /* list of the channels id to pick from the source stream */ + int audio_channels_mapped; /* number of channels in audio_channels_map */ + + char *logfile_prefix; + FILE *logfile; + + OutputFilter *filter; + char *avfilter; + char *filters; ///< filtergraph associated to the -filter option + char *filters_script; ///< filtergraph script associated to the -filter_script option + + int64_t sws_flags; + AVDictionary *encoder_opts; + AVDictionary *swr_opts; + AVDictionary *resample_opts; + AVDictionary *bsf_args; + char *apad; + OSTFinished finished; /* no more packets should be written for this stream */ + int unavailable; /* true if the steram is unavailable (possibly temporarily) */ + int stream_copy; + const char *attachment_filename; + int copy_initial_nonkeyframes; + int copy_prior_start; + char *disposition; + + int keep_pix_fmt; + + AVCodecParserContext *parser; + + /* stats */ + // combined size of all the packets written + uint64_t data_size; + // number of packets send to the muxer + uint64_t packets_written; + // number of frames/samples sent to the encoder + uint64_t frames_encoded; + uint64_t samples_encoded; +} OutputStream; + +typedef struct OutputFile { + AVFormatContext *ctx; + AVDictionary *opts; + int ost_index; /* index of the first stream in output_streams */ + int64_t recording_time; ///< desired length of the resulting file in microseconds == AV_TIME_BASE units + int64_t start_time; ///< start time in microseconds == AV_TIME_BASE units + uint64_t limit_filesize; /* filesize limit expressed in bytes */ + + int shortest; +} OutputFile; + +extern InputStream **input_streams; +extern int nb_input_streams; +extern InputFile **input_files; +extern int nb_input_files; + +extern OutputStream **output_streams; +extern int nb_output_streams; +extern OutputFile **output_files; +extern int nb_output_files; + +extern FilterGraph **filtergraphs; +extern int nb_filtergraphs; + +extern char *vstats_filename; +extern char *sdp_filename; + +extern float audio_drift_threshold; +extern float dts_delta_threshold; +extern float dts_error_threshold; + +extern int audio_volume; +extern int audio_sync_method; +extern int video_sync_method; +extern float frame_drop_threshold; +extern int do_benchmark; +extern int do_benchmark_all; +extern int do_deinterlace; +extern int do_hex_dump; +extern int do_pkt_dump; +extern int copy_ts; +extern int start_at_zero; +extern int copy_tb; +extern int debug_ts; +extern int exit_on_error; +extern int print_stats; +extern int qp_hist; +extern int stdin_interaction; +extern int frame_bits_per_raw_sample; +extern AVIOContext *progress_avio; +extern float max_error_rate; +extern int vdpau_api_ver; + +extern const AVIOInterruptCB int_cb; + +extern const OptionDef options[]; +extern const HWAccel hwaccels[]; + + +void term_init(void); + +void term_exit(void); + +void reset_options(OptionsContext *o, int is_input); + +void show_usage(void); + +void opt_output_file(void *optctx, const char *filename); + +void remove_avoptions(AVDictionary **a, AVDictionary *b); + +void assert_avoptions(AVDictionary *m); + +int guess_input_channel_layout(InputStream *ist); + +enum AVPixelFormat +choose_pixel_fmt(AVStream *st, AVCodecContext *avctx, AVCodec *codec, enum AVPixelFormat target); + +void choose_sample_fmt(AVStream *st, AVCodec *codec); + +int configure_filtergraph(FilterGraph *fg); + +int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out); + +int ist_in_filtergraph(FilterGraph *fg, InputStream *ist); + +FilterGraph *init_simple_filtergraph(InputStream *ist, OutputStream *ost); + +int ffmpeg_parse_options(int argc, char **argv); + +int vdpau_init(AVCodecContext *s); + +int dxva2_init(AVCodecContext *s); + +int vda_init(AVCodecContext *s); + +#endif /* FFMPEG_H */ diff --git a/app/src/main/cpp/include/ass/ass.h b/app/src/main/cpp/include/ass/ass.h new file mode 100644 index 0000000..5ef3c05 --- /dev/null +++ b/app/src/main/cpp/include/ass/ass.h @@ -0,0 +1,404 @@ +/* + * Copyright (C) 2006 Evgeniy Stepanov + * + * This file is part of libass. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef LIBASS_ASS_H +#define LIBASS_ASS_H + +#include +#include +#include "ass_types.h" + +#define LIBASS_VERSION 0x01000000 + +/* + * A linked list of images produced by an ass renderer. + * + * These images have to be rendered in-order for the correct screen + * composition. The libass renderer clips these bitmaps to the frame size. + * w/h can be zero, in this case the bitmap should not be rendered at all. + * The last bitmap row is not guaranteed to be padded up to stride size, + * e.g. in the worst case a bitmap has the size stride * (h - 1) + w. + */ +typedef struct ass_image { + int w, h; // Bitmap width/height + int stride; // Bitmap stride + unsigned char *bitmap; // 1bpp stride*h alpha buffer + // Note: the last row may not be padded to + // bitmap stride! + uint32_t color; // Bitmap color and alpha, RGBA + int dst_x, dst_y; // Bitmap placement inside the video frame + + struct ass_image *next; // Next image, or NULL +} ASS_Image; + +/* + * Hinting type. (see ass_set_hinting below) + * + * FreeType's native hinter is still buggy sometimes and it is recommended + * to use the light autohinter, ASS_HINTING_LIGHT, instead. For best + * compatibility with problematic fonts, disable hinting. + */ +typedef enum { + ASS_HINTING_NONE = 0, + ASS_HINTING_LIGHT, + ASS_HINTING_NORMAL, + ASS_HINTING_NATIVE +} ASS_Hinting; + +/** + * \brief Text shaping levels. + * + * SIMPLE is a fast, font-agnostic shaper that can do only substitutions. + * COMPLEX is a slower shaper using OpenType for substitutions and positioning. + * + * libass uses the best shaper available by default. + */ +typedef enum { + ASS_SHAPING_SIMPLE = 0, + ASS_SHAPING_COMPLEX +} ASS_ShapingLevel; + +/** + * \brief Initialize the library. + * \return library handle or NULL if failed + */ +ASS_Library *ass_library_init(void); + +/** + * \brief Finalize the library + * \param priv library handle + */ +void ass_library_done(ASS_Library *priv); + +/** + * \brief Set additional fonts directory. + * Optional directory that will be scanned for fonts recursively. The fonts + * found are used for font lookup. + * NOTE: A valid font directory is not needed to support embedded fonts. + * + * \param priv library handle + * \param fonts_dir directory with additional fonts + */ +void ass_set_fonts_dir(ASS_Library *priv, const char *fonts_dir); + +/** + * \brief Whether fonts should be extracted from track data. + * \param priv library handle + * \param extract whether to extract fonts + */ +void ass_set_extract_fonts(ASS_Library *priv, int extract); + +/** + * \brief Register style overrides with a library instance. + * The overrides should have the form [Style.]Param=Value, e.g. + * SomeStyle.Font=Arial + * ScaledBorderAndShadow=yes + * + * \param priv library handle + * \param list NULL-terminated list of strings + */ +void ass_set_style_overrides(ASS_Library *priv, char **list); + +/** + * \brief Explicitly process style overrides for a track. + * \param track track handle + */ +void ass_process_force_style(ASS_Track *track); + +/** + * \brief Register a callback for debug/info messages. + * If a callback is registered, it is called for every message emitted by + * libass. The callback receives a format string and a list of arguments, + * to be used for the printf family of functions. Additionally, a log level + * from 0 (FATAL errors) to 7 (verbose DEBUG) is passed. Usually, level 5 + * should be used by applications. + * If no callback is set, all messages level < 5 are printed to stderr, + * prefixed with [ass]. + * + * \param priv library handle + * \param msg_cb pointer to callback function + * \param data additional data, will be passed to callback + */ +void ass_set_message_cb(ASS_Library *priv, void (*msg_cb) + (int level, const char *fmt, va_list args, void *data), + void *data); + +/** + * \brief Initialize the renderer. + * \param priv library handle + * \return renderer handle or NULL if failed + */ +ASS_Renderer *ass_renderer_init(ASS_Library *); + +/** + * \brief Finalize the renderer. + * \param priv renderer handle + */ +void ass_renderer_done(ASS_Renderer *priv); + +/** + * \brief Set the frame size in pixels, including margins. + * \param priv renderer handle + * \param w width + * \param h height + */ +void ass_set_frame_size(ASS_Renderer *priv, int w, int h); + +/** + * \brief Set shaping level. This is merely a hint, the renderer will use + * whatever is available if the request cannot be fulfilled. + * \param level shaping level + */ +void ass_set_shaper(ASS_Renderer *priv, ASS_ShapingLevel level); + +/** + * \brief Set frame margins. These values may be negative if pan-and-scan + * is used. + * \param priv renderer handle + * \param t top margin + * \param b bottom margin + * \param l left margin + * \param r right margin + */ +void ass_set_margins(ASS_Renderer *priv, int t, int b, int l, int r); + +/** + * \brief Whether margins should be used for placing regular events. + * \param priv renderer handle + * \param use whether to use the margins + */ +void ass_set_use_margins(ASS_Renderer *priv, int use); + +/** + * \brief Set aspect ratio parameters. + * \param priv renderer handle + * \param dar display aspect ratio (DAR), prescaled for output PAR + * \param sar storage aspect ratio (SAR) + */ +void ass_set_aspect_ratio(ASS_Renderer *priv, double dar, double sar); + +/** + * \brief Set a fixed font scaling factor. + * \param priv renderer handle + * \param font_scale scaling factor, default is 1.0 + */ +void ass_set_font_scale(ASS_Renderer *priv, double font_scale); + +/** + * \brief Set font hinting method. + * \param priv renderer handle + * \param ht hinting method + */ +void ass_set_hinting(ASS_Renderer *priv, ASS_Hinting ht); + +/** + * \brief Set line spacing. Will not be scaled with frame size. + * \param priv renderer handle + * \param line_spacing line spacing in pixels + */ +void ass_set_line_spacing(ASS_Renderer *priv, double line_spacing); + +/** + * \brief Set font lookup defaults. + * \param default_font path to default font to use. Must be supplied if + * fontconfig is disabled or unavailable. + * \param default_family fallback font family for fontconfig, or NULL + * \param fc whether to use fontconfig + * \param config path to fontconfig configuration file, or NULL. Only relevant + * if fontconfig is used. + * \param update whether fontconfig cache should be built/updated now. Only + * relevant if fontconfig is used. + * + * NOTE: font lookup must be configured before an ASS_Renderer can be used. + */ +void ass_set_fonts(ASS_Renderer *priv, const char *default_font, + const char *default_family, int fc, const char *config, + int update); + +/** + * \brief Update/build font cache. This needs to be called if it was + * disabled when ass_set_fonts was set. + * + * \param priv renderer handle + * \return success + */ +int ass_fonts_update(ASS_Renderer *priv); + +/** + * \brief Set hard cache limits. Do not set, or set to zero, for reasonable + * defaults. + * + * \param priv renderer handle + * \param glyph_max maximum number of cached glyphs + * \param bitmap_max_size maximum bitmap cache size (in MB) + */ +void ass_set_cache_limits(ASS_Renderer *priv, int glyph_max, + int bitmap_max_size); + +/** + * \brief Render a frame, producing a list of ASS_Image. + * \param priv renderer handle + * \param track subtitle track + * \param now video timestamp in milliseconds + * \param detect_change will be set to 1 if a change occured compared + * to the last invocation + */ +ASS_Image *ass_render_frame(ASS_Renderer *priv, ASS_Track *track, + long long now, int *detect_change); + + +/* + * The following functions operate on track objects and do not need + * an ass_renderer + */ + +/** + * \brief Allocate a new empty track object. + * \param library handle + * \return pointer to empty track + */ +ASS_Track *ass_new_track(ASS_Library *); + +/** + * \brief Deallocate track and all its child objects (styles and events). + * \param track track to deallocate + */ +void ass_free_track(ASS_Track *track); + +/** + * \brief Allocate new style. + * \param track track + * \return newly allocated style id + */ +int ass_alloc_style(ASS_Track *track); + +/** + * \brief Allocate new event. + * \param track track + * \return newly allocated event id + */ +int ass_alloc_event(ASS_Track *track); + +/** + * \brief Delete a style. + * \param track track + * \param sid style id + * Deallocates style data. Does not modify track->n_styles. + */ +void ass_free_style(ASS_Track *track, int sid); + +/** + * \brief Delete an event. + * \param track track + * \param eid event id + * Deallocates event data. Does not modify track->n_events. + */ +void ass_free_event(ASS_Track *track, int eid); + +/** + * \brief Parse a chunk of subtitle stream data. + * \param track track + * \param data string to parse + * \param size length of data + */ +void ass_process_data(ASS_Track *track, char *data, int size); + +/** + * \brief Parse Codec Private section of the subtitle stream, in Matroska + * format. See the Matroska specification for details. + * \param track target track + * \param data string to parse + * \param size length of data + */ +void ass_process_codec_private(ASS_Track *track, char *data, int size); + +/** + * \brief Parse a chunk of subtitle stream data. A chunk contains exactly one + * event in Matroska format. See the Matroska specification for details. + * \param track track + * \param data string to parse + * \param size length of data + * \param timecode starting time of the event (milliseconds) + * \param duration duration of the event (milliseconds) + */ +void ass_process_chunk(ASS_Track *track, char *data, int size, + long long timecode, long long duration); + +/** + * \brief Flush buffered events. + * \param track track +*/ +void ass_flush_events(ASS_Track *track); + +/** + * \brief Read subtitles from file. + * \param library library handle + * \param fname file name + * \param codepage encoding (iconv format) + * \return newly allocated track +*/ +ASS_Track *ass_read_file(ASS_Library *library, char *fname, + char *codepage); + +/** + * \brief Read subtitles from memory. + * \param library library handle + * \param buf pointer to subtitles text + * \param bufsize size of buffer + * \param codepage encoding (iconv format) + * \return newly allocated track +*/ +ASS_Track *ass_read_memory(ASS_Library *library, char *buf, + size_t bufsize, char *codepage); + +/** + * \brief Read styles from file into already initialized track. + * \param fname file name + * \param codepage encoding (iconv format) + * \return 0 on success + */ +int ass_read_styles(ASS_Track *track, char *fname, char *codepage); + +/** + * \brief Add a memory font. + * \param library library handle + * \param name attachment name + * \param data binary font data + * \param data_size data size +*/ +void ass_add_font(ASS_Library *library, char *name, char *data, + int data_size); + +/** + * \brief Remove all fonts stored in an ass_library object. + * \param library library handle + */ +void ass_clear_fonts(ASS_Library *library); + +/** + * \brief Calculates timeshift from now to the start of some other subtitle + * event, depending on movement parameter. + * \param track subtitle track + * \param now current time in milliseconds + * \param movement how many events to skip from the one currently displayed + * +2 means "the one after the next", -1 means "previous" + * \return timeshift in milliseconds + */ +long long ass_step_sub(ASS_Track *track, long long now, int movement); + +#endif /* LIBASS_ASS_H */ diff --git a/app/src/main/cpp/include/ass/ass_types.h b/app/src/main/cpp/include/ass/ass_types.h new file mode 100644 index 0000000..20fd825 --- /dev/null +++ b/app/src/main/cpp/include/ass/ass_types.h @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2006 Evgeniy Stepanov + * + * This file is part of libass. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef LIBASS_TYPES_H +#define LIBASS_TYPES_H + +#include + +#define VALIGN_SUB 0 +#define VALIGN_CENTER 8 +#define VALIGN_TOP 4 +#define HALIGN_LEFT 1 +#define HALIGN_CENTER 2 +#define HALIGN_RIGHT 3 + +/* Opaque objects internally used by libass. Contents are private. */ +typedef struct ass_renderer ASS_Renderer; +typedef struct render_priv ASS_RenderPriv; +typedef struct parser_priv ASS_ParserPriv; +typedef struct ass_library ASS_Library; + +/* ASS Style: line */ +typedef struct ass_style { + char *Name; + char *FontName; + double FontSize; + uint32_t PrimaryColour; + uint32_t SecondaryColour; + uint32_t OutlineColour; + uint32_t BackColour; + int Bold; + int Italic; + int Underline; + int StrikeOut; + double ScaleX; + double ScaleY; + double Spacing; + int Angle; + int BorderStyle; + double Outline; + double Shadow; + int Alignment; + int MarginL; + int MarginR; + int MarginV; + int Encoding; + int treat_fontname_as_pattern; +} ASS_Style; + +/* + * ASS_Event corresponds to a single Dialogue line; + * text is stored as-is, style overrides will be parsed later. + */ +typedef struct ass_event { + long long Start; // ms + long long Duration; // ms + + int ReadOrder; + int Layer; + int Style; + char *Name; + int MarginL; + int MarginR; + int MarginV; + char *Effect; + char *Text; + + ASS_RenderPriv *render_priv; +} ASS_Event; + +/* + * ass track represent either an external script or a matroska subtitle stream + * (no real difference between them); it can be used in rendering after the + * headers are parsed (i.e. events format line read). + */ +typedef struct ass_track { + int n_styles; // amount used + int max_styles; // amount allocated + int n_events; + int max_events; + ASS_Style *styles; // array of styles, max_styles length, n_styles used + ASS_Event *events; // the same as styles + + char *style_format; // style format line (everything after "Format: ") + char *event_format; // event format line + + enum { + TRACK_TYPE_UNKNOWN = 0, + TRACK_TYPE_ASS, + TRACK_TYPE_SSA + } track_type; + + // Script header fields + int PlayResX; + int PlayResY; + double Timer; + int WrapStyle; + int ScaledBorderAndShadow; + int Kerning; + char *Language; + + int default_style; // index of default style + char *name; // file name in case of external subs, 0 for streams + + ASS_Library *library; + ASS_ParserPriv *parser_priv; +} ASS_Track; + +#endif /* LIBASS_TYPES_H */ diff --git a/app/src/main/cpp/include/freetype2/freetype/config/ftconfig.h b/app/src/main/cpp/include/freetype2/freetype/config/ftconfig.h new file mode 100644 index 0000000..e991a0c --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/config/ftconfig.h @@ -0,0 +1,545 @@ +/* ftconfig.h. Generated from ftconfig.in by configure. */ +/***************************************************************************/ +/* */ +/* ftconfig.in */ +/* */ +/* UNIX-specific configuration file (specification only). */ +/* */ +/* Copyright 1996-2004, 2006-2009, 2011 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +/*************************************************************************/ +/* */ +/* This header file contains a number of macro definitions that are used */ +/* by the rest of the engine. Most of the macros here are automatically */ +/* determined at compile time, and you should not need to change it to */ +/* port FreeType, except to compile the library with a non-ANSI */ +/* compiler. */ +/* */ +/* Note however that if some specific modifications are needed, we */ +/* advise you to place a modified copy in your build directory. */ +/* */ +/* The build directory is usually `freetype/builds/', and */ +/* contains system-specific files that are always included first when */ +/* building the library. */ +/* */ +/*************************************************************************/ + + +#ifndef __FTCONFIG_H__ +#define __FTCONFIG_H__ + +#include +#include FT_CONFIG_OPTIONS_H +#include FT_CONFIG_STANDARD_LIBRARY_H + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* PLATFORM-SPECIFIC CONFIGURATION MACROS */ +/* */ +/* These macros can be toggled to suit a specific system. The current */ +/* ones are defaults used to compile FreeType in an ANSI C environment */ +/* (16bit compilers are also supported). Copy this file to your own */ +/* `freetype/builds/' directory, and edit it to port the engine. */ +/* */ +/*************************************************************************/ + + +#define HAVE_UNISTD_H 1 +#define HAVE_FCNTL_H 1 +#define HAVE_STDINT_H 1 + + +/* There are systems (like the Texas Instruments 'C54x) where a `char' */ +/* has 16 bits. ANSI C says that sizeof(char) is always 1. Since an */ +/* `int' has 16 bits also for this system, sizeof(int) gives 1 which */ +/* is probably unexpected. */ +/* */ +/* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */ +/* `char' type. */ + +#ifndef FT_CHAR_BIT +#define FT_CHAR_BIT CHAR_BIT +#endif + + +/* #undef FT_USE_AUTOCONF_SIZEOF_TYPES */ +#ifdef FT_USE_AUTOCONF_SIZEOF_TYPES + +#define SIZEOF_INT 4 +#define SIZEOF_LONG 4 +#define FT_SIZEOF_INT SIZEOF_INT +#define FT_SIZEOF_LONG SIZEOF_LONG + +#else /* !FT_USE_AUTOCONF_SIZEOF_TYPES */ + +/* Following cpp computation of the bit length of int and long */ +/* is copied from default include/freetype/config/ftconfig.h. */ +/* If any improvement is required for this file, it should be */ +/* applied to the original header file for the builders that */ +/* does not use configure script. */ + +/* The size of an `int' type. */ +#if FT_UINT_MAX == 0xFFFFUL +#define FT_SIZEOF_INT (16 / FT_CHAR_BIT) +#elif FT_UINT_MAX == 0xFFFFFFFFUL +#define FT_SIZEOF_INT (32 / FT_CHAR_BIT) +#elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL +#define FT_SIZEOF_INT (64 / FT_CHAR_BIT) +#else +#error "Unsupported size of `int' type!" +#endif + +/* The size of a `long' type. A five-byte `long' (as used e.g. on the */ +/* DM642) is recognized but avoided. */ +#if FT_ULONG_MAX == 0xFFFFFFFFUL +#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) +#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL +#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) +#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL +#define FT_SIZEOF_LONG (64 / FT_CHAR_BIT) +#else +#error "Unsupported size of `long' type!" +#endif + +#endif /* !FT_USE_AUTOCONF_SIZEOF_TYPES */ + + +/* FT_UNUSED is a macro used to indicate that a given parameter is not */ +/* used -- this is only used to get rid of unpleasant compiler warnings */ +#ifndef FT_UNUSED +#define FT_UNUSED(arg) ( (arg) = (arg) ) +#endif + + +/*************************************************************************/ +/* */ +/* AUTOMATIC CONFIGURATION MACROS */ +/* */ +/* These macros are computed from the ones defined above. Don't touch */ +/* their definition, unless you know precisely what you are doing. No */ +/* porter should need to mess with them. */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* Mac support */ +/* */ +/* This is the only necessary change, so it is defined here instead */ +/* providing a new configuration file. */ +/* */ +#if defined( __APPLE__ ) || (defined( __MWERKS__ ) && defined( macintosh )) +/* no Carbon frameworks for 64bit 10.4.x */ +/* AvailabilityMacros.h is available since Mac OS X 10.2, */ +/* so guess the system version by maximum errno before inclusion */ +#include +#ifdef ECANCELED /* defined since 10.2 */ +#include "AvailabilityMacros.h" +#endif +#if defined( __LP64__ ) && \ + ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 ) +#undef FT_MACINTOSH +#endif + +#elif defined( __SC__ ) || defined( __MRC__ ) +/* Classic MacOS compilers */ +#include "ConditionalMacros.h" +#if TARGET_OS_MAC +#define FT_MACINTOSH 1 +#endif + +#endif + + +/* Fix compiler warning with sgi compiler */ +#if defined( __sgi ) && !defined( __GNUC__ ) +#if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 ) +#pragma set woff 3505 +#endif +#endif + + +/*************************************************************************/ +/* */ +/* IntN types */ +/* */ +/* Used to guarantee the size of some specific integers. */ +/* */ +typedef signed short FT_Int16; +typedef unsigned short FT_UInt16; + +#if FT_SIZEOF_INT == 4 + +typedef signed int FT_Int32; +typedef unsigned int FT_UInt32; + +#elif FT_SIZEOF_LONG == 4 + +typedef signed long FT_Int32; +typedef unsigned long FT_UInt32; + +#else +#error "no 32bit type found -- please check your configuration files" +#endif + + +/* look up an integer type that is at least 32 bits */ +#if FT_SIZEOF_INT >= 4 + +typedef int FT_Fast; +typedef unsigned int FT_UFast; + +#elif FT_SIZEOF_LONG >= 4 + +typedef long FT_Fast; +typedef unsigned long FT_UFast; + +#endif + + +/* determine whether we have a 64-bit int type for platforms without */ +/* Autoconf */ +#if FT_SIZEOF_LONG == 8 + +/* FT_LONG64 must be defined if a 64-bit type is available */ +#define FT_LONG64 +#define FT_INT64 long + +#elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */ + +/* this compiler provides the __int64 type */ +#define FT_LONG64 +#define FT_INT64 __int64 + +#elif defined( __BORLANDC__ ) /* Borland C++ */ + +/* XXXX: We should probably check the value of __BORLANDC__ in order */ +/* to test the compiler version. */ + +/* this compiler provides the __int64 type */ +#define FT_LONG64 +#define FT_INT64 __int64 + +#elif defined( __WATCOMC__ ) /* Watcom C++ */ + +/* Watcom doesn't provide 64-bit data types */ + +#elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */ + +#define FT_LONG64 +#define FT_INT64 long long int + +#elif defined( __GNUC__ ) + +/* GCC provides the `long long' type */ +#define FT_LONG64 +#define FT_INT64 long long int + +#endif /* FT_SIZEOF_LONG == 8 */ + + +/*************************************************************************/ +/* */ +/* A 64-bit data type will create compilation problems if you compile */ +/* in strict ANSI mode. To avoid them, we disable its use if __STDC__ */ +/* is defined. You can however ignore this rule by defining the */ +/* FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */ +/* */ +#if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 ) + +#ifdef __STDC__ + +/* Undefine the 64-bit macros in strict ANSI compilation mode. */ +/* Since `#undef' doesn't survive in configuration header files */ +/* we use the postprocessing facility of AC_CONFIG_HEADERS to */ +/* replace the leading `/' with `#'. */ +#undef FT_LONG64 +#undef FT_INT64 + +#endif /* __STDC__ */ + +#endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */ + + +#define FT_BEGIN_STMNT do { +#define FT_END_STMNT } while ( 0 ) +#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT + + +#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER +/* Provide assembler fragments for performance-critical functions. */ +/* These must be defined `static __inline__' with GCC. */ + +#if defined( __CC_ARM ) || defined( __ARMCC__ ) /* RVCT */ +#define FT_MULFIX_ASSEMBLER FT_MulFix_arm + +/* documentation is in freetype.h */ + +static __inline FT_Int32 +FT_MulFix_arm( FT_Int32 a, + FT_Int32 b ) +{ + register FT_Int32 t, t2; + + + __asm + { + smull t2, t, b, a /* (lo=t2,hi=t) = a*b */ + mov a, t, asr #31 /* a = (hi >> 31) */ + add a, a, #0x8000 /* a += 0x8000 */ + adds t2, t2, a /* t2 += a */ + adc t, t, #0 /* t += carry */ + mov a, t2, lsr #16 /* a = t2 >> 16 */ + orr a, a, t, lsl #16 /* a |= t << 16 */ + } + return a; +} + +#endif /* __CC_ARM || __ARMCC__ */ + + +#ifdef __GNUC__ + +#if defined( __arm__ ) && !defined( __thumb__ ) && \ + !( defined( __CC_ARM ) || defined( __ARMCC__ ) ) +#define FT_MULFIX_ASSEMBLER FT_MulFix_arm + +/* documentation is in freetype.h */ + +static __inline__ FT_Int32 +FT_MulFix_arm( FT_Int32 a, + FT_Int32 b ) +{ + register FT_Int32 t, t2; + + + __asm__ __volatile__ ( + "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */ + "mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */ + "add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */ + "adds %1, %1, %0\n\t" /* %1 += %0 */ + "adc %2, %2, #0\n\t" /* %2 += carry */ + "mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */ + "orr %0, %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */ + : "=r"(a), "=&r"(t2), "=&r"(t) + : "r"(a), "r"(b) ); + return a; +} + +#endif /* __arm__ && !__thumb__ && !( __CC_ARM || __ARMCC__ ) */ + +#if defined( __i386__ ) +#define FT_MULFIX_ASSEMBLER FT_MulFix_i386 + +/* documentation is in freetype.h */ + +static __inline__ FT_Int32 +FT_MulFix_i386( FT_Int32 a, + FT_Int32 b ) +{ + register FT_Int32 result; + + + __asm__ __volatile__ ( + "imul %%edx\n" + "movl %%edx, %%ecx\n" + "sarl $31, %%ecx\n" + "addl $0x8000, %%ecx\n" + "addl %%ecx, %%eax\n" + "adcl $0, %%edx\n" + "shrl $16, %%eax\n" + "shll $16, %%edx\n" + "addl %%edx, %%eax\n" + : "=a"(result), "=d"(b) + : "a"(a), "d"(b) + : "%ecx", "cc" ); + return result; +} + +#endif /* i386 */ + +#endif /* __GNUC__ */ + + +#ifdef _MSC_VER /* Visual C++ */ + +#ifdef _M_IX86 + +#define FT_MULFIX_ASSEMBLER FT_MulFix_i386 + +/* documentation is in freetype.h */ + +static __inline FT_Int32 +FT_MulFix_i386( FT_Int32 a, + FT_Int32 b ) +{ + register FT_Int32 result; + + __asm + { + mov eax, a + mov edx, b + imul edx + mov ecx, edx + sar ecx, 31 + add ecx, 8000h + add eax, ecx + adc edx, 0 + shr eax, 16 + shl edx, 16 + add eax, edx + mov result, eax + } + return result; +} + +#endif /* _M_IX86 */ + +#endif /* _MSC_VER */ + +#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */ + + +#ifdef FT_CONFIG_OPTION_INLINE_MULFIX +#ifdef FT_MULFIX_ASSEMBLER +#define FT_MULFIX_INLINED FT_MULFIX_ASSEMBLER +#endif +#endif + + +#ifdef FT_MAKE_OPTION_SINGLE_OBJECT + +#define FT_LOCAL( x ) static x +#define FT_LOCAL_DEF( x ) static x + +#else + +#ifdef __cplusplus +#define FT_LOCAL( x ) extern "C" x +#define FT_LOCAL_DEF( x ) extern "C" x +#else +#define FT_LOCAL(x) extern x +#define FT_LOCAL_DEF(x) x +#endif + +#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */ + + +#ifndef FT_BASE + +#ifdef __cplusplus +#define FT_BASE( x ) extern "C" x +#else +#define FT_BASE(x) extern x +#endif + +#endif /* !FT_BASE */ + + +#ifndef FT_BASE_DEF + +#ifdef __cplusplus +#define FT_BASE_DEF( x ) x +#else +#define FT_BASE_DEF(x) x +#endif + +#endif /* !FT_BASE_DEF */ + + +#ifndef FT_EXPORT + +#ifdef __cplusplus +#define FT_EXPORT( x ) extern "C" x +#else +#define FT_EXPORT(x) extern x +#endif + +#endif /* !FT_EXPORT */ + + +#ifndef FT_EXPORT_DEF + +#ifdef __cplusplus +#define FT_EXPORT_DEF( x ) extern "C" x +#else +#define FT_EXPORT_DEF(x) extern x +#endif + +#endif /* !FT_EXPORT_DEF */ + + +#ifndef FT_EXPORT_VAR + +#ifdef __cplusplus +#define FT_EXPORT_VAR( x ) extern "C" x +#else +#define FT_EXPORT_VAR(x) extern x +#endif + +#endif /* !FT_EXPORT_VAR */ + +/* The following macros are needed to compile the library with a */ +/* C++ compiler and with 16bit compilers. */ +/* */ + +/* This is special. Within C++, you must specify `extern "C"' for */ +/* functions which are used via function pointers, and you also */ +/* must do that for structures which contain function pointers to */ +/* assure C linkage -- it's not possible to have (local) anonymous */ +/* functions which are accessed by (global) function pointers. */ +/* */ +/* */ +/* FT_CALLBACK_DEF is used to _define_ a callback function. */ +/* */ +/* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */ +/* contains pointers to callback functions. */ +/* */ +/* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */ +/* that contains pointers to callback functions. */ +/* */ +/* */ +/* Some 16bit compilers have to redefine these macros to insert */ +/* the infamous `_cdecl' or `__fastcall' declarations. */ +/* */ +#ifndef FT_CALLBACK_DEF +#ifdef __cplusplus +#define FT_CALLBACK_DEF( x ) extern "C" x +#else +#define FT_CALLBACK_DEF(x) static x +#endif +#endif /* FT_CALLBACK_DEF */ + +#ifndef FT_CALLBACK_TABLE +#ifdef __cplusplus +#define FT_CALLBACK_TABLE extern "C" +#define FT_CALLBACK_TABLE_DEF extern "C" +#else +#define FT_CALLBACK_TABLE extern +#define FT_CALLBACK_TABLE_DEF /* nothing */ +#endif +#endif /* FT_CALLBACK_TABLE */ + + +FT_END_HEADER + + +#endif /* __FTCONFIG_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/config/ftheader.h b/app/src/main/cpp/include/freetype2/freetype/config/ftheader.h new file mode 100644 index 0000000..9b93ed8 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/config/ftheader.h @@ -0,0 +1,793 @@ +/***************************************************************************/ +/* */ +/* ftheader.h */ +/* */ +/* Build macros of the FreeType 2 library. */ +/* */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + +#ifndef __FT_HEADER_H__ +#define __FT_HEADER_H__ + + +/*@***********************************************************************/ +/* */ +/* */ +/* FT_BEGIN_HEADER */ +/* */ +/* */ +/* This macro is used in association with @FT_END_HEADER in header */ +/* files to ensure that the declarations within are properly */ +/* encapsulated in an `extern "C" { .. }' block when included from a */ +/* C++ compiler. */ +/* */ +#ifdef __cplusplus +#define FT_BEGIN_HEADER extern "C" { +#else +#define FT_BEGIN_HEADER /* nothing */ +#endif + + +/*@***********************************************************************/ +/* */ +/* */ +/* FT_END_HEADER */ +/* */ +/* */ +/* This macro is used in association with @FT_BEGIN_HEADER in header */ +/* files to ensure that the declarations within are properly */ +/* encapsulated in an `extern "C" { .. }' block when included from a */ +/* C++ compiler. */ +/* */ +#ifdef __cplusplus +#define FT_END_HEADER } +#else +#define FT_END_HEADER /* nothing */ +#endif + + +/*************************************************************************/ +/* */ +/* Aliases for the FreeType 2 public and configuration files. */ +/* */ +/*************************************************************************/ + +/*************************************************************************/ +/* */ +/*
*/ +/* header_file_macros */ +/* */ +/* */ +/* Header File Macros */ +/* */ +/* <Abstract> */ +/* Macro definitions used to #include specific header files. */ +/* */ +/* <Description> */ +/* The following macros are defined to the name of specific */ +/* FreeType~2 header files. They can be used directly in #include */ +/* statements as in: */ +/* */ +/* { */ +/* #include FT_FREETYPE_H */ +/* #include FT_MULTIPLE_MASTERS_H */ +/* #include FT_GLYPH_H */ +/* } */ +/* */ +/* There are several reasons why we are now using macros to name */ +/* public header files. The first one is that such macros are not */ +/* limited to the infamous 8.3~naming rule required by DOS (and */ +/* `FT_MULTIPLE_MASTERS_H' is a lot more meaningful than `ftmm.h'). */ +/* */ +/* The second reason is that it allows for more flexibility in the */ +/* way FreeType~2 is installed on a given system. */ +/* */ +/*************************************************************************/ + + +/* configuration files */ + +/************************************************************************* + * + * @macro: + * FT_CONFIG_CONFIG_H + * + * @description: + * A macro used in #include statements to name the file containing + * FreeType~2 configuration data. + * + */ +#ifndef FT_CONFIG_CONFIG_H +#define FT_CONFIG_CONFIG_H <freetype/config/ftconfig.h> +#endif + + +/************************************************************************* + * + * @macro: + * FT_CONFIG_STANDARD_LIBRARY_H + * + * @description: + * A macro used in #include statements to name the file containing + * FreeType~2 interface to the standard C library functions. + * + */ +#ifndef FT_CONFIG_STANDARD_LIBRARY_H +#define FT_CONFIG_STANDARD_LIBRARY_H <freetype/config/ftstdlib.h> +#endif + + +/************************************************************************* + * + * @macro: + * FT_CONFIG_OPTIONS_H + * + * @description: + * A macro used in #include statements to name the file containing + * FreeType~2 project-specific configuration options. + * + */ +#ifndef FT_CONFIG_OPTIONS_H +#define FT_CONFIG_OPTIONS_H <freetype/config/ftoption.h> +#endif + + +/************************************************************************* + * + * @macro: + * FT_CONFIG_MODULES_H + * + * @description: + * A macro used in #include statements to name the file containing the + * list of FreeType~2 modules that are statically linked to new library + * instances in @FT_Init_FreeType. + * + */ +#ifndef FT_CONFIG_MODULES_H +#define FT_CONFIG_MODULES_H <freetype/config/ftmodule.h> +#endif + +/* */ + +/* public headers */ + +/************************************************************************* + * + * @macro: + * FT_FREETYPE_H + * + * @description: + * A macro used in #include statements to name the file containing the + * base FreeType~2 API. + * + */ +#define FT_FREETYPE_H <freetype/freetype.h> + + +/************************************************************************* + * + * @macro: + * FT_ERRORS_H + * + * @description: + * A macro used in #include statements to name the file containing the + * list of FreeType~2 error codes (and messages). + * + * It is included by @FT_FREETYPE_H. + * + */ +#define FT_ERRORS_H <freetype/fterrors.h> + + +/************************************************************************* + * + * @macro: + * FT_MODULE_ERRORS_H + * + * @description: + * A macro used in #include statements to name the file containing the + * list of FreeType~2 module error offsets (and messages). + * + */ +#define FT_MODULE_ERRORS_H <freetype/ftmoderr.h> + + +/************************************************************************* + * + * @macro: + * FT_SYSTEM_H + * + * @description: + * A macro used in #include statements to name the file containing the + * FreeType~2 interface to low-level operations (i.e., memory management + * and stream i/o). + * + * It is included by @FT_FREETYPE_H. + * + */ +#define FT_SYSTEM_H <freetype/ftsystem.h> + + +/************************************************************************* + * + * @macro: + * FT_IMAGE_H + * + * @description: + * A macro used in #include statements to name the file containing type + * definitions related to glyph images (i.e., bitmaps, outlines, + * scan-converter parameters). + * + * It is included by @FT_FREETYPE_H. + * + */ +#define FT_IMAGE_H <freetype/ftimage.h> + + +/************************************************************************* + * + * @macro: + * FT_TYPES_H + * + * @description: + * A macro used in #include statements to name the file containing the + * basic data types defined by FreeType~2. + * + * It is included by @FT_FREETYPE_H. + * + */ +#define FT_TYPES_H <freetype/fttypes.h> + + +/************************************************************************* + * + * @macro: + * FT_LIST_H + * + * @description: + * A macro used in #include statements to name the file containing the + * list management API of FreeType~2. + * + * (Most applications will never need to include this file.) + * + */ +#define FT_LIST_H <freetype/ftlist.h> + + +/************************************************************************* + * + * @macro: + * FT_OUTLINE_H + * + * @description: + * A macro used in #include statements to name the file containing the + * scalable outline management API of FreeType~2. + * + */ +#define FT_OUTLINE_H <freetype/ftoutln.h> + + +/************************************************************************* + * + * @macro: + * FT_SIZES_H + * + * @description: + * A macro used in #include statements to name the file containing the + * API which manages multiple @FT_Size objects per face. + * + */ +#define FT_SIZES_H <freetype/ftsizes.h> + + +/************************************************************************* + * + * @macro: + * FT_MODULE_H + * + * @description: + * A macro used in #include statements to name the file containing the + * module management API of FreeType~2. + * + */ +#define FT_MODULE_H <freetype/ftmodapi.h> + + +/************************************************************************* + * + * @macro: + * FT_RENDER_H + * + * @description: + * A macro used in #include statements to name the file containing the + * renderer module management API of FreeType~2. + * + */ +#define FT_RENDER_H <freetype/ftrender.h> + + +/************************************************************************* + * + * @macro: + * FT_TYPE1_TABLES_H + * + * @description: + * A macro used in #include statements to name the file containing the + * types and API specific to the Type~1 format. + * + */ +#define FT_TYPE1_TABLES_H <freetype/t1tables.h> + + +/************************************************************************* + * + * @macro: + * FT_TRUETYPE_IDS_H + * + * @description: + * A macro used in #include statements to name the file containing the + * enumeration values which identify name strings, languages, encodings, + * etc. This file really contains a _large_ set of constant macro + * definitions, taken from the TrueType and OpenType specifications. + * + */ +#define FT_TRUETYPE_IDS_H <freetype/ttnameid.h> + + +/************************************************************************* + * + * @macro: + * FT_TRUETYPE_TABLES_H + * + * @description: + * A macro used in #include statements to name the file containing the + * types and API specific to the TrueType (as well as OpenType) format. + * + */ +#define FT_TRUETYPE_TABLES_H <freetype/tttables.h> + + +/************************************************************************* + * + * @macro: + * FT_TRUETYPE_TAGS_H + * + * @description: + * A macro used in #include statements to name the file containing the + * definitions of TrueType four-byte `tags' which identify blocks in + * SFNT-based font formats (i.e., TrueType and OpenType). + * + */ +#define FT_TRUETYPE_TAGS_H <freetype/tttags.h> + + +/************************************************************************* + * + * @macro: + * FT_BDF_H + * + * @description: + * A macro used in #include statements to name the file containing the + * definitions of an API which accesses BDF-specific strings from a + * face. + * + */ +#define FT_BDF_H <freetype/ftbdf.h> + + +/************************************************************************* + * + * @macro: + * FT_CID_H + * + * @description: + * A macro used in #include statements to name the file containing the + * definitions of an API which access CID font information from a + * face. + * + */ +#define FT_CID_H <freetype/ftcid.h> + + +/************************************************************************* + * + * @macro: + * FT_GZIP_H + * + * @description: + * A macro used in #include statements to name the file containing the + * definitions of an API which supports gzip-compressed files. + * + */ +#define FT_GZIP_H <freetype/ftgzip.h> + + +/************************************************************************* + * + * @macro: + * FT_LZW_H + * + * @description: + * A macro used in #include statements to name the file containing the + * definitions of an API which supports LZW-compressed files. + * + */ +#define FT_LZW_H <freetype/ftlzw.h> + + +/************************************************************************* + * + * @macro: + * FT_BZIP2_H + * + * @description: + * A macro used in #include statements to name the file containing the + * definitions of an API which supports bzip2-compressed files. + * + */ +#define FT_BZIP2_H <freetype/ftbzip2.h> + + +/************************************************************************* + * + * @macro: + * FT_WINFONTS_H + * + * @description: + * A macro used in #include statements to name the file containing the + * definitions of an API which supports Windows FNT files. + * + */ +#define FT_WINFONTS_H <freetype/ftwinfnt.h> + + +/************************************************************************* + * + * @macro: + * FT_GLYPH_H + * + * @description: + * A macro used in #include statements to name the file containing the + * API of the optional glyph management component. + * + */ +#define FT_GLYPH_H <freetype/ftglyph.h> + + +/************************************************************************* + * + * @macro: + * FT_BITMAP_H + * + * @description: + * A macro used in #include statements to name the file containing the + * API of the optional bitmap conversion component. + * + */ +#define FT_BITMAP_H <freetype/ftbitmap.h> + + +/************************************************************************* + * + * @macro: + * FT_BBOX_H + * + * @description: + * A macro used in #include statements to name the file containing the + * API of the optional exact bounding box computation routines. + * + */ +#define FT_BBOX_H <freetype/ftbbox.h> + + +/************************************************************************* + * + * @macro: + * FT_CACHE_H + * + * @description: + * A macro used in #include statements to name the file containing the + * API of the optional FreeType~2 cache sub-system. + * + */ +#define FT_CACHE_H <freetype/ftcache.h> + + +/************************************************************************* + * + * @macro: + * FT_CACHE_IMAGE_H + * + * @description: + * A macro used in #include statements to name the file containing the + * `glyph image' API of the FreeType~2 cache sub-system. + * + * It is used to define a cache for @FT_Glyph elements. You can also + * use the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need to + * store small glyph bitmaps, as it will use less memory. + * + * This macro is deprecated. Simply include @FT_CACHE_H to have all + * glyph image-related cache declarations. + * + */ +#define FT_CACHE_IMAGE_H FT_CACHE_H + + +/************************************************************************* + * + * @macro: + * FT_CACHE_SMALL_BITMAPS_H + * + * @description: + * A macro used in #include statements to name the file containing the + * `small bitmaps' API of the FreeType~2 cache sub-system. + * + * It is used to define a cache for small glyph bitmaps in a relatively + * memory-efficient way. You can also use the API defined in + * @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images, + * including scalable outlines. + * + * This macro is deprecated. Simply include @FT_CACHE_H to have all + * small bitmaps-related cache declarations. + * + */ +#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H + + +/************************************************************************* + * + * @macro: + * FT_CACHE_CHARMAP_H + * + * @description: + * A macro used in #include statements to name the file containing the + * `charmap' API of the FreeType~2 cache sub-system. + * + * This macro is deprecated. Simply include @FT_CACHE_H to have all + * charmap-based cache declarations. + * + */ +#define FT_CACHE_CHARMAP_H FT_CACHE_H + + +/************************************************************************* + * + * @macro: + * FT_MAC_H + * + * @description: + * A macro used in #include statements to name the file containing the + * Macintosh-specific FreeType~2 API. The latter is used to access + * fonts embedded in resource forks. + * + * This header file must be explicitly included by client applications + * compiled on the Mac (note that the base API still works though). + * + */ +#define FT_MAC_H <freetype/ftmac.h> + + +/************************************************************************* + * + * @macro: + * FT_MULTIPLE_MASTERS_H + * + * @description: + * A macro used in #include statements to name the file containing the + * optional multiple-masters management API of FreeType~2. + * + */ +#define FT_MULTIPLE_MASTERS_H <freetype/ftmm.h> + + +/************************************************************************* + * + * @macro: + * FT_SFNT_NAMES_H + * + * @description: + * A macro used in #include statements to name the file containing the + * optional FreeType~2 API which accesses embedded `name' strings in + * SFNT-based font formats (i.e., TrueType and OpenType). + * + */ +#define FT_SFNT_NAMES_H <freetype/ftsnames.h> + + +/************************************************************************* + * + * @macro: + * FT_OPENTYPE_VALIDATE_H + * + * @description: + * A macro used in #include statements to name the file containing the + * optional FreeType~2 API which validates OpenType tables (BASE, GDEF, + * GPOS, GSUB, JSTF). + * + */ +#define FT_OPENTYPE_VALIDATE_H <freetype/ftotval.h> + + +/************************************************************************* + * + * @macro: + * FT_GX_VALIDATE_H + * + * @description: + * A macro used in #include statements to name the file containing the + * optional FreeType~2 API which validates TrueTypeGX/AAT tables (feat, + * mort, morx, bsln, just, kern, opbd, trak, prop). + * + */ +#define FT_GX_VALIDATE_H <freetype/ftgxval.h> + + +/************************************************************************* + * + * @macro: + * FT_PFR_H + * + * @description: + * A macro used in #include statements to name the file containing the + * FreeType~2 API which accesses PFR-specific data. + * + */ +#define FT_PFR_H <freetype/ftpfr.h> + + +/************************************************************************* + * + * @macro: + * FT_STROKER_H + * + * @description: + * A macro used in #include statements to name the file containing the + * FreeType~2 API which provides functions to stroke outline paths. + */ +#define FT_STROKER_H <freetype/ftstroke.h> + + +/************************************************************************* + * + * @macro: + * FT_SYNTHESIS_H + * + * @description: + * A macro used in #include statements to name the file containing the + * FreeType~2 API which performs artificial obliquing and emboldening. + */ +#define FT_SYNTHESIS_H <freetype/ftsynth.h> + + +/************************************************************************* + * + * @macro: + * FT_XFREE86_H + * + * @description: + * A macro used in #include statements to name the file containing the + * FreeType~2 API which provides functions specific to the XFree86 and + * X.Org X11 servers. + */ +#define FT_XFREE86_H <freetype/ftxf86.h> + + +/************************************************************************* + * + * @macro: + * FT_TRIGONOMETRY_H + * + * @description: + * A macro used in #include statements to name the file containing the + * FreeType~2 API which performs trigonometric computations (e.g., + * cosines and arc tangents). + */ +#define FT_TRIGONOMETRY_H <freetype/fttrigon.h> + + +/************************************************************************* + * + * @macro: + * FT_LCD_FILTER_H + * + * @description: + * A macro used in #include statements to name the file containing the + * FreeType~2 API which performs color filtering for subpixel rendering. + */ +#define FT_LCD_FILTER_H <freetype/ftlcdfil.h> + + +/************************************************************************* + * + * @macro: + * FT_UNPATENTED_HINTING_H + * + * @description: + * A macro used in #include statements to name the file containing the + * FreeType~2 API which performs color filtering for subpixel rendering. + */ +#define FT_UNPATENTED_HINTING_H <freetype/ttunpat.h> + + +/************************************************************************* + * + * @macro: + * FT_INCREMENTAL_H + * + * @description: + * A macro used in #include statements to name the file containing the + * FreeType~2 API which performs color filtering for subpixel rendering. + */ +#define FT_INCREMENTAL_H <freetype/ftincrem.h> + + +/************************************************************************* + * + * @macro: + * FT_GASP_H + * + * @description: + * A macro used in #include statements to name the file containing the + * FreeType~2 API which returns entries from the TrueType GASP table. + */ +#define FT_GASP_H <freetype/ftgasp.h> + + +/************************************************************************* + * + * @macro: + * FT_ADVANCES_H + * + * @description: + * A macro used in #include statements to name the file containing the + * FreeType~2 API which returns individual and ranged glyph advances. + */ +#define FT_ADVANCES_H <freetype/ftadvanc.h> + + +/* */ + +#define FT_ERROR_DEFINITIONS_H <freetype/fterrdef.h> + + +/* The internals of the cache sub-system are no longer exposed. We */ +/* default to FT_CACHE_H at the moment just in case, but we know of */ +/* no rogue client that uses them. */ +/* */ +#define FT_CACHE_MANAGER_H <freetype/ftcache.h> +#define FT_CACHE_INTERNAL_MRU_H <freetype/ftcache.h> +#define FT_CACHE_INTERNAL_MANAGER_H <freetype/ftcache.h> +#define FT_CACHE_INTERNAL_CACHE_H <freetype/ftcache.h> +#define FT_CACHE_INTERNAL_GLYPH_H <freetype/ftcache.h> +#define FT_CACHE_INTERNAL_IMAGE_H <freetype/ftcache.h> +#define FT_CACHE_INTERNAL_SBITS_H <freetype/ftcache.h> + + +#define FT_INCREMENTAL_H <freetype/ftincrem.h> + +#define FT_TRUETYPE_UNPATENTED_H <freetype/ttunpat.h> + + +/* + * Include internal headers definitions from <freetype/internal/...> + * only when building the library. + */ +#ifdef FT2_BUILD_LIBRARY +#define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h> +#include FT_INTERNAL_INTERNAL_H +#endif /* FT2_BUILD_LIBRARY */ + + +#endif /* __FT2_BUILD_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/config/ftmodule.h b/app/src/main/cpp/include/freetype2/freetype/config/ftmodule.h new file mode 100644 index 0000000..3b1f68f --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/config/ftmodule.h @@ -0,0 +1,38 @@ +/* This is a generated file. */ +FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class +) +FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class +) +FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class +) +FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class +) +FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class +) +FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class +) +FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class +) +FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class +) +FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class +) +FT_USE_MODULE( FT_Module_Class, sfnt_module_class +) +FT_USE_MODULE( FT_Module_Class, autofit_module_class +) +FT_USE_MODULE( FT_Module_Class, pshinter_module_class +) +FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class +) +FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class +) +FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class +) +FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class +) +FT_USE_MODULE( FT_Module_Class, psaux_module_class +) +FT_USE_MODULE( FT_Module_Class, psnames_module_class +) +/* EOF */ diff --git a/app/src/main/cpp/include/freetype2/freetype/config/ftoption.h b/app/src/main/cpp/include/freetype2/freetype/config/ftoption.h new file mode 100644 index 0000000..76ddd6d --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/config/ftoption.h @@ -0,0 +1,805 @@ +/***************************************************************************/ +/* */ +/* ftoption.h */ +/* */ +/* User-selectable configuration macros (specification only). */ +/* */ +/* Copyright 1996-2012 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTOPTION_H__ +#define __FTOPTION_H__ + + +#include <ft2build.h> + + +FT_BEGIN_HEADER + +/*************************************************************************/ +/* */ +/* USER-SELECTABLE CONFIGURATION MACROS */ +/* */ +/* This file contains the default configuration macro definitions for */ +/* a standard build of the FreeType library. There are three ways to */ +/* use this file to build project-specific versions of the library: */ +/* */ +/* - You can modify this file by hand, but this is not recommended in */ +/* cases where you would like to build several versions of the */ +/* library from a single source directory. */ +/* */ +/* - You can put a copy of this file in your build directory, more */ +/* precisely in `$BUILD/freetype/config/ftoption.h', where `$BUILD' */ +/* is the name of a directory that is included _before_ the FreeType */ +/* include path during compilation. */ +/* */ +/* The default FreeType Makefiles and Jamfiles use the build */ +/* directory `builds/<system>' by default, but you can easily change */ +/* that for your own projects. */ +/* */ +/* - Copy the file <ft2build.h> to `$BUILD/ft2build.h' and modify it */ +/* slightly to pre-define the macro FT_CONFIG_OPTIONS_H used to */ +/* locate this file during the build. For example, */ +/* */ +/* #define FT_CONFIG_OPTIONS_H <myftoptions.h> */ +/* #include <freetype/config/ftheader.h> */ +/* */ +/* will use `$BUILD/myftoptions.h' instead of this file for macro */ +/* definitions. */ +/* */ +/* Note also that you can similarly pre-define the macro */ +/* FT_CONFIG_MODULES_H used to locate the file listing of the modules */ +/* that are statically linked to the library at compile time. By */ +/* default, this file is <freetype/config/ftmodule.h>. */ +/* */ +/* We highly recommend using the third method whenever possible. */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/*************************************************************************/ +/**** ****/ +/**** G E N E R A L F R E E T Y P E 2 C O N F I G U R A T I O N ****/ +/**** ****/ +/*************************************************************************/ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* Uncomment the line below if you want to activate sub-pixel rendering */ +/* (a.k.a. LCD rendering, or ClearType) in this build of the library. */ +/* */ +/* Note that this feature is covered by several Microsoft patents */ +/* and should not be activated in any default build of the library. */ +/* */ +/* This macro has no impact on the FreeType API, only on its */ +/* _implementation_. For example, using FT_RENDER_MODE_LCD when calling */ +/* FT_Render_Glyph still generates a bitmap that is 3 times wider than */ +/* the original size in case this macro isn't defined; however, each */ +/* triplet of subpixels has R=G=B. */ +/* */ +/* This is done to allow FreeType clients to run unmodified, forcing */ +/* them to display normal gray-level anti-aliased glyphs. */ +/* */ +/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ + + +/*************************************************************************/ +/* */ +/* Many compilers provide a non-ANSI 64-bit data type that can be used */ +/* by FreeType to speed up some computations. However, this will create */ +/* some problems when compiling the library in strict ANSI mode. */ +/* */ +/* For this reason, the use of 64-bit integers is normally disabled when */ +/* the __STDC__ macro is defined. You can however disable this by */ +/* defining the macro FT_CONFIG_OPTION_FORCE_INT64 here. */ +/* */ +/* For most compilers, this will only create compilation warnings when */ +/* building the library. */ +/* */ +/* ObNote: The compiler-specific 64-bit integers are detected in the */ +/* file `ftconfig.h' either statically or through the */ +/* `configure' script on supported platforms. */ +/* */ +#undef FT_CONFIG_OPTION_FORCE_INT64 + + +/*************************************************************************/ +/* */ +/* If this macro is defined, do not try to use an assembler version of */ +/* performance-critical functions (e.g. FT_MulFix). You should only do */ +/* that to verify that the assembler function works properly, or to */ +/* execute benchmark tests of the various implementations. */ +/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */ + + +/*************************************************************************/ +/* */ +/* If this macro is defined, try to use an inlined assembler version of */ +/* the `FT_MulFix' function, which is a `hotspot' when loading and */ +/* hinting glyphs, and which should be executed as fast as possible. */ +/* */ +/* Note that if your compiler or CPU is not supported, this will default */ +/* to the standard and portable implementation found in `ftcalc.c'. */ +/* */ +#define FT_CONFIG_OPTION_INLINE_MULFIX + + +/*************************************************************************/ +/* */ +/* LZW-compressed file support. */ +/* */ +/* FreeType now handles font files that have been compressed with the */ +/* `compress' program. This is mostly used to parse many of the PCF */ +/* files that come with various X11 distributions. The implementation */ +/* uses NetBSD's `zopen' to partially uncompress the file on the fly */ +/* (see src/lzw/ftgzip.c). */ +/* */ +/* Define this macro if you want to enable this `feature'. */ +/* */ +#define FT_CONFIG_OPTION_USE_LZW + + +/*************************************************************************/ +/* */ +/* Gzip-compressed file support. */ +/* */ +/* FreeType now handles font files that have been compressed with the */ +/* `gzip' program. This is mostly used to parse many of the PCF files */ +/* that come with XFree86. The implementation uses `zlib' to */ +/* partially uncompress the file on the fly (see src/gzip/ftgzip.c). */ +/* */ +/* Define this macro if you want to enable this `feature'. See also */ +/* the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below. */ +/* */ +#define FT_CONFIG_OPTION_USE_ZLIB + + +/*************************************************************************/ +/* */ +/* ZLib library selection */ +/* */ +/* This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined. */ +/* It allows FreeType's `ftgzip' component to link to the system's */ +/* installation of the ZLib library. This is useful on systems like */ +/* Unix or VMS where it generally is already available. */ +/* */ +/* If you let it undefined, the component will use its own copy */ +/* of the zlib sources instead. These have been modified to be */ +/* included directly within the component and *not* export external */ +/* function names. This allows you to link any program with FreeType */ +/* _and_ ZLib without linking conflicts. */ +/* */ +/* Do not #undef this macro here since the build system might define */ +/* it for certain configurations only. */ +/* */ +/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */ + + +/*************************************************************************/ +/* */ +/* Bzip2-compressed file support. */ +/* */ +/* FreeType now handles font files that have been compressed with the */ +/* `bzip2' program. This is mostly used to parse many of the PCF */ +/* files that come with XFree86. The implementation uses `libbz2' to */ +/* partially uncompress the file on the fly (see src/bzip2/ftbzip2.c). */ +/* Contrary to gzip, bzip2 currently is not included and need to use */ +/* the system available bzip2 implementation. */ +/* */ +/* Define this macro if you want to enable this `feature'. */ +/* */ +/* #define FT_CONFIG_OPTION_USE_BZIP2 */ + + +/*************************************************************************/ +/* */ +/* Define to disable the use of file stream functions and types, FILE, */ +/* fopen() etc. Enables the use of smaller system libraries on embedded */ +/* systems that have multiple system libraries, some with or without */ +/* file stream support, in the cases where file stream support is not */ +/* necessary such as memory loading of font files. */ +/* */ +/* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */ + + +/*************************************************************************/ +/* */ +/* DLL export compilation */ +/* */ +/* When compiling FreeType as a DLL, some systems/compilers need a */ +/* special keyword in front OR after the return type of function */ +/* declarations. */ +/* */ +/* Two macros are used within the FreeType source code to define */ +/* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ +/* */ +/* FT_EXPORT( return_type ) */ +/* */ +/* is used in a function declaration, as in */ +/* */ +/* FT_EXPORT( FT_Error ) */ +/* FT_Init_FreeType( FT_Library* alibrary ); */ +/* */ +/* */ +/* FT_EXPORT_DEF( return_type ) */ +/* */ +/* is used in a function definition, as in */ +/* */ +/* FT_EXPORT_DEF( FT_Error ) */ +/* FT_Init_FreeType( FT_Library* alibrary ) */ +/* { */ +/* ... some code ... */ +/* return FT_Err_Ok; */ +/* } */ +/* */ +/* You can provide your own implementation of FT_EXPORT and */ +/* FT_EXPORT_DEF here if you want. If you leave them undefined, they */ +/* will be later automatically defined as `extern return_type' to */ +/* allow normal compilation. */ +/* */ +/* Do not #undef these macros here since the build system might define */ +/* them for certain configurations only. */ +/* */ +/* #define FT_EXPORT(x) extern x */ +/* #define FT_EXPORT_DEF(x) x */ + + +/*************************************************************************/ +/* */ +/* Glyph Postscript Names handling */ +/* */ +/* By default, FreeType 2 is compiled with the `psnames' module. This */ +/* module is in charge of converting a glyph name string into a */ +/* Unicode value, or return a Macintosh standard glyph name for the */ +/* use with the TrueType `post' table. */ +/* */ +/* Undefine this macro if you do not want `psnames' compiled in your */ +/* build of FreeType. This has the following effects: */ +/* */ +/* - The TrueType driver will provide its own set of glyph names, */ +/* if you build it to support postscript names in the TrueType */ +/* `post' table. */ +/* */ +/* - The Type 1 driver will not be able to synthesize a Unicode */ +/* charmap out of the glyphs found in the fonts. */ +/* */ +/* You would normally undefine this configuration macro when building */ +/* a version of FreeType that doesn't contain a Type 1 or CFF driver. */ +/* */ +#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES + + +/*************************************************************************/ +/* */ +/* Postscript Names to Unicode Values support */ +/* */ +/* By default, FreeType 2 is built with the `PSNames' module compiled */ +/* in. Among other things, the module is used to convert a glyph name */ +/* into a Unicode value. This is especially useful in order to */ +/* synthesize on the fly a Unicode charmap from the CFF/Type 1 driver */ +/* through a big table named the `Adobe Glyph List' (AGL). */ +/* */ +/* Undefine this macro if you do not want the Adobe Glyph List */ +/* compiled in your `PSNames' module. The Type 1 driver will not be */ +/* able to synthesize a Unicode charmap out of the glyphs found in the */ +/* fonts. */ +/* */ +#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST + + +/*************************************************************************/ +/* */ +/* Support for Mac fonts */ +/* */ +/* Define this macro if you want support for outline fonts in Mac */ +/* format (mac dfont, mac resource, macbinary containing a mac */ +/* resource) on non-Mac platforms. */ +/* */ +/* Note that the `FOND' resource isn't checked. */ +/* */ +#define FT_CONFIG_OPTION_MAC_FONTS + + +/*************************************************************************/ +/* */ +/* Guessing methods to access embedded resource forks */ +/* */ +/* Enable extra Mac fonts support on non-Mac platforms (e.g. */ +/* GNU/Linux). */ +/* */ +/* Resource forks which include fonts data are stored sometimes in */ +/* locations which users or developers don't expected. In some cases, */ +/* resource forks start with some offset from the head of a file. In */ +/* other cases, the actual resource fork is stored in file different */ +/* from what the user specifies. If this option is activated, */ +/* FreeType tries to guess whether such offsets or different file */ +/* names must be used. */ +/* */ +/* Note that normal, direct access of resource forks is controlled via */ +/* the FT_CONFIG_OPTION_MAC_FONTS option. */ +/* */ +#ifdef FT_CONFIG_OPTION_MAC_FONTS +#define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK +#endif + + +/*************************************************************************/ +/* */ +/* Allow the use of FT_Incremental_Interface to load typefaces that */ +/* contain no glyph data, but supply it via a callback function. */ +/* This is required by clients supporting document formats which */ +/* supply font data incrementally as the document is parsed, such */ +/* as the Ghostscript interpreter for the PostScript language. */ +/* */ +#define FT_CONFIG_OPTION_INCREMENTAL + + +/*************************************************************************/ +/* */ +/* The size in bytes of the render pool used by the scan-line converter */ +/* to do all of its work. */ +/* */ +/* This must be greater than 4KByte if you use FreeType to rasterize */ +/* glyphs; otherwise, you may set it to zero to avoid unnecessary */ +/* allocation of the render pool. */ +/* */ +#define FT_RENDER_POOL_SIZE 16384L + + +/*************************************************************************/ +/* */ +/* FT_MAX_MODULES */ +/* */ +/* The maximum number of modules that can be registered in a single */ +/* FreeType library object. 32 is the default. */ +/* */ +#define FT_MAX_MODULES 32 + + +/*************************************************************************/ +/* */ +/* Debug level */ +/* */ +/* FreeType can be compiled in debug or trace mode. In debug mode, */ +/* errors are reported through the `ftdebug' component. In trace */ +/* mode, additional messages are sent to the standard output during */ +/* execution. */ +/* */ +/* Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode. */ +/* Define FT_DEBUG_LEVEL_TRACE to build it in trace mode. */ +/* */ +/* Don't define any of these macros to compile in `release' mode! */ +/* */ +/* Do not #undef these macros here since the build system might define */ +/* them for certain configurations only. */ +/* */ +/* #define FT_DEBUG_LEVEL_ERROR */ +/* #define FT_DEBUG_LEVEL_TRACE */ + + +/*************************************************************************/ +/* */ +/* Autofitter debugging */ +/* */ +/* If FT_DEBUG_AUTOFIT is defined, FreeType provides some means to */ +/* control the autofitter behaviour for debugging purposes with global */ +/* boolean variables (consequently, you should *never* enable this */ +/* while compiling in `release' mode): */ +/* */ +/* _af_debug_disable_horz_hints */ +/* _af_debug_disable_vert_hints */ +/* _af_debug_disable_blue_hints */ +/* */ +/* Additionally, the following functions provide dumps of various */ +/* internal autofit structures to stdout (using `printf'): */ +/* */ +/* af_glyph_hints_dump_points */ +/* af_glyph_hints_dump_segments */ +/* af_glyph_hints_dump_edges */ +/* */ +/* As an argument, they use another global variable: */ +/* */ +/* _af_debug_hints */ +/* */ +/* Please have a look at the `ftgrid' demo program to see how those */ +/* variables and macros should be used. */ +/* */ +/* Do not #undef these macros here since the build system might define */ +/* them for certain configurations only. */ +/* */ +/* #define FT_DEBUG_AUTOFIT */ + + +/*************************************************************************/ +/* */ +/* Memory Debugging */ +/* */ +/* FreeType now comes with an integrated memory debugger that is */ +/* capable of detecting simple errors like memory leaks or double */ +/* deletes. To compile it within your build of the library, you */ +/* should define FT_DEBUG_MEMORY here. */ +/* */ +/* Note that the memory debugger is only activated at runtime when */ +/* when the _environment_ variable `FT2_DEBUG_MEMORY' is defined also! */ +/* */ +/* Do not #undef this macro here since the build system might define */ +/* it for certain configurations only. */ +/* */ +/* #define FT_DEBUG_MEMORY */ + + +/*************************************************************************/ +/* */ +/* Module errors */ +/* */ +/* If this macro is set (which is _not_ the default), the higher byte */ +/* of an error code gives the module in which the error has occurred, */ +/* while the lower byte is the real error code. */ +/* */ +/* Setting this macro makes sense for debugging purposes only, since */ +/* it would break source compatibility of certain programs that use */ +/* FreeType 2. */ +/* */ +/* More details can be found in the files ftmoderr.h and fterrors.h. */ +/* */ +#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS + + +/*************************************************************************/ +/* */ +/* Position Independent Code */ +/* */ +/* If this macro is set (which is _not_ the default), FreeType2 will */ +/* avoid creating constants that require address fixups. Instead the */ +/* constants will be moved into a struct and additional intialization */ +/* code will be used. */ +/* */ +/* Setting this macro is needed for systems that prohibit address */ +/* fixups, such as BREW. */ +/* */ +/* #define FT_CONFIG_OPTION_PIC */ + + +/*************************************************************************/ +/*************************************************************************/ +/**** ****/ +/**** S F N T D R I V E R C O N F I G U R A T I O N ****/ +/**** ****/ +/*************************************************************************/ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* Define TT_CONFIG_OPTION_EMBEDDED_BITMAPS if you want to support */ +/* embedded bitmaps in all formats using the SFNT module (namely */ +/* TrueType & OpenType). */ +/* */ +#define TT_CONFIG_OPTION_EMBEDDED_BITMAPS + + +/*************************************************************************/ +/* */ +/* Define TT_CONFIG_OPTION_POSTSCRIPT_NAMES if you want to be able to */ +/* load and enumerate the glyph Postscript names in a TrueType or */ +/* OpenType file. */ +/* */ +/* Note that when you do not compile the `PSNames' module by undefining */ +/* the above FT_CONFIG_OPTION_POSTSCRIPT_NAMES, the `sfnt' module will */ +/* contain additional code used to read the PS Names table from a font. */ +/* */ +/* (By default, the module uses `PSNames' to extract glyph names.) */ +/* */ +#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES + + +/*************************************************************************/ +/* */ +/* Define TT_CONFIG_OPTION_SFNT_NAMES if your applications need to */ +/* access the internal name table in a SFNT-based format like TrueType */ +/* or OpenType. The name table contains various strings used to */ +/* describe the font, like family name, copyright, version, etc. It */ +/* does not contain any glyph name though. */ +/* */ +/* Accessing SFNT names is done through the functions declared in */ +/* `freetype/ftsnames.h'. */ +/* */ +#define TT_CONFIG_OPTION_SFNT_NAMES + + +/*************************************************************************/ +/* */ +/* TrueType CMap support */ +/* */ +/* Here you can fine-tune which TrueType CMap table format shall be */ +/* supported. */ +#define TT_CONFIG_CMAP_FORMAT_0 +#define TT_CONFIG_CMAP_FORMAT_2 +#define TT_CONFIG_CMAP_FORMAT_4 +#define TT_CONFIG_CMAP_FORMAT_6 +#define TT_CONFIG_CMAP_FORMAT_8 +#define TT_CONFIG_CMAP_FORMAT_10 +#define TT_CONFIG_CMAP_FORMAT_12 +#define TT_CONFIG_CMAP_FORMAT_13 +#define TT_CONFIG_CMAP_FORMAT_14 + + +/*************************************************************************/ +/*************************************************************************/ +/**** ****/ +/**** T R U E T Y P E D R I V E R C O N F I G U R A T I O N ****/ +/**** ****/ +/*************************************************************************/ +/*************************************************************************/ + +/*************************************************************************/ +/* */ +/* Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER if you want to compile */ +/* a bytecode interpreter in the TrueType driver. */ +/* */ +/* By undefining this, you will only compile the code necessary to load */ +/* TrueType glyphs without hinting. */ +/* */ +/* Do not #undef this macro here, since the build system might */ +/* define it for certain configurations only. */ +/* */ +#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER + + +/*************************************************************************/ +/* */ +/* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version */ +/* of the TrueType bytecode interpreter is used that doesn't implement */ +/* any of the patented opcodes and algorithms. The patents related to */ +/* TrueType hinting have expired worldwide since May 2010; this option */ +/* is now deprecated. */ +/* */ +/* Note that the TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* */ +/* if you define TT_CONFIG_OPTION_BYTECODE_INTERPRETER; in other words, */ +/* either define TT_CONFIG_OPTION_BYTECODE_INTERPRETER or */ +/* TT_CONFIG_OPTION_UNPATENTED_HINTING but not both at the same time. */ +/* */ +/* This macro is only useful for a small number of font files (mostly */ +/* for Asian scripts) that require bytecode interpretation to properly */ +/* load glyphs. For all other fonts, this produces unpleasant results, */ +/* thus the unpatented interpreter is never used to load glyphs from */ +/* TrueType fonts unless one of the following two options is used. */ +/* */ +/* - The unpatented interpreter is explicitly activated by the user */ +/* through the FT_PARAM_TAG_UNPATENTED_HINTING parameter tag */ +/* when opening the FT_Face. */ +/* */ +/* - FreeType detects that the FT_Face corresponds to one of the */ +/* `trick' fonts (e.g., `Mingliu') it knows about. The font engine */ +/* contains a hard-coded list of font names and other matching */ +/* parameters (see function `tt_face_init' in file */ +/* `src/truetype/ttobjs.c'). */ +/* */ +/* Here a sample code snippet for using FT_PARAM_TAG_UNPATENTED_HINTING. */ +/* */ +/* { */ +/* FT_Parameter parameter; */ +/* FT_Open_Args open_args; */ +/* */ +/* */ +/* parameter.tag = FT_PARAM_TAG_UNPATENTED_HINTING; */ +/* */ +/* open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; */ +/* open_args.pathname = my_font_pathname; */ +/* open_args.num_params = 1; */ +/* open_args.params = ¶meter; */ +/* */ +/* error = FT_Open_Face( library, &open_args, index, &face ); */ +/* ... */ +/* } */ +/* */ +/* #define TT_CONFIG_OPTION_UNPATENTED_HINTING */ + + +/*************************************************************************/ +/* */ +/* Define TT_CONFIG_OPTION_INTERPRETER_SWITCH to compile the TrueType */ +/* bytecode interpreter with a huge switch statement, rather than a call */ +/* table. This results in smaller and faster code for a number of */ +/* architectures. */ +/* */ +/* Note however that on some compiler/processor combinations, undefining */ +/* this macro will generate faster, though larger, code. */ +/* */ +#define TT_CONFIG_OPTION_INTERPRETER_SWITCH + + +/*************************************************************************/ +/* */ +/* Define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED to compile the */ +/* TrueType glyph loader to use Apple's definition of how to handle */ +/* component offsets in composite glyphs. */ +/* */ +/* Apple and MS disagree on the default behavior of component offsets */ +/* in composites. Apple says that they should be scaled by the scaling */ +/* factors in the transformation matrix (roughly, it's more complex) */ +/* while MS says they should not. OpenType defines two bits in the */ +/* composite flags array which can be used to disambiguate, but old */ +/* fonts will not have them. */ +/* */ +/* http://www.microsoft.com/typography/otspec/glyf.htm */ +/* http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html */ +/* */ +#undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED + + +/*************************************************************************/ +/* */ +/* Define TT_CONFIG_OPTION_GX_VAR_SUPPORT if you want to include */ +/* support for Apple's distortable font technology (fvar, gvar, cvar, */ +/* and avar tables). This has many similarities to Type 1 Multiple */ +/* Masters support. */ +/* */ +#define TT_CONFIG_OPTION_GX_VAR_SUPPORT + + +/*************************************************************************/ +/* */ +/* Define TT_CONFIG_OPTION_BDF if you want to include support for */ +/* an embedded `BDF ' table within SFNT-based bitmap formats. */ +/* */ +#define TT_CONFIG_OPTION_BDF + + +/*************************************************************************/ +/*************************************************************************/ +/**** ****/ +/**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/ +/**** ****/ +/*************************************************************************/ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* T1_MAX_DICT_DEPTH is the maximum depth of nest dictionaries and */ +/* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */ +/* required. */ +/* */ +#define T1_MAX_DICT_DEPTH 5 + + +/*************************************************************************/ +/* */ +/* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */ +/* calls during glyph loading. */ +/* */ +#define T1_MAX_SUBRS_CALLS 16 + + +/*************************************************************************/ +/* */ +/* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */ +/* minimum of 16 is required. */ +/* */ +/* The Chinese font MingTiEG-Medium (CNS 11643 character set) needs 256. */ +/* */ +#define T1_MAX_CHARSTRINGS_OPERANDS 256 + + +/*************************************************************************/ +/* */ +/* Define this configuration macro if you want to prevent the */ +/* compilation of `t1afm', which is in charge of reading Type 1 AFM */ +/* files into an existing face. Note that if set, the T1 driver will be */ +/* unable to produce kerning distances. */ +/* */ +#undef T1_CONFIG_OPTION_NO_AFM + + +/*************************************************************************/ +/* */ +/* Define this configuration macro if you want to prevent the */ +/* compilation of the Multiple Masters font support in the Type 1 */ +/* driver. */ +/* */ +#undef T1_CONFIG_OPTION_NO_MM_SUPPORT + + +/*************************************************************************/ +/*************************************************************************/ +/**** ****/ +/**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/ +/**** ****/ +/*************************************************************************/ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* Compile autofit module with CJK (Chinese, Japanese, Korean) script */ +/* support. */ +/* */ +#define AF_CONFIG_OPTION_CJK + +/*************************************************************************/ +/* */ +/* Compile autofit module with Indic script support. */ +/* */ +#define AF_CONFIG_OPTION_INDIC + +/*************************************************************************/ +/* */ +/* Compile autofit module with warp hinting. The idea of the warping */ +/* code is to slightly scale and shift a glyph within a single dimension */ +/* so that as much of its segments are aligned (more or less) on the */ +/* grid. To find out the optimal scaling and shifting value, various */ +/* parameter combinations are tried and scored. */ +/* */ +/* This experimental option is only active if the render mode is */ +/* FT_RENDER_MODE_LIGHT. */ +/* */ +/* #define AF_CONFIG_OPTION_USE_WARPER */ + +/* */ + + +/* + * Define this variable if you want to keep the layout of internal + * structures that was used prior to FreeType 2.2. This also compiles in + * a few obsolete functions to avoid linking problems on typical Unix + * distributions. + * + * For embedded systems or building a new distribution from scratch, it + * is recommended to disable the macro since it reduces the library's code + * size and activates a few memory-saving optimizations as well. + */ +#define FT_CONFIG_OPTION_OLD_INTERNALS + + +/* + * To detect legacy cache-lookup call from a rogue client (<= 2.1.7), + * we restrict the number of charmaps in a font. The current API of + * FTC_CMapCache_Lookup() takes cmap_index & charcode, but old API + * takes charcode only. To determine the passed value is for cmap_index + * or charcode, the possible cmap_index is restricted not to exceed + * the minimum possible charcode by a rogue client. It is also very + * unlikely that a rogue client is interested in Unicode values 0 to 15. + * + * NOTE: The original threshold was 4 deduced from popular number of + * cmap subtables in UCS-4 TrueType fonts, but now it is not + * irregular for OpenType fonts to have more than 4 subtables, + * because variation selector subtables are available for Apple + * and Microsoft platforms. + */ + +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS +#define FT_MAX_CHARMAP_CACHEABLE 15 +#endif + + +/* + * This macro is defined if either unpatented or native TrueType + * hinting is requested by the definitions above. + */ +#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER +#define TT_USE_BYTECODE_INTERPRETER +#undef TT_CONFIG_OPTION_UNPATENTED_HINTING +#elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING +#define TT_USE_BYTECODE_INTERPRETER +#endif + + FT_END_HEADER + + +#endif /* __FTOPTION_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/config/ftstdlib.h b/app/src/main/cpp/include/freetype2/freetype/config/ftstdlib.h new file mode 100644 index 0000000..658ac66 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/config/ftstdlib.h @@ -0,0 +1,174 @@ +/***************************************************************************/ +/* */ +/* ftstdlib.h */ +/* */ +/* ANSI-specific library and header configuration file (specification */ +/* only). */ +/* */ +/* Copyright 2002-2007, 2009, 2011 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +/*************************************************************************/ +/* */ +/* This file is used to group all #includes to the ANSI C library that */ +/* FreeType normally requires. It also defines macros to rename the */ +/* standard functions within the FreeType source code. */ +/* */ +/* Load a file which defines __FTSTDLIB_H__ before this one to override */ +/* it. */ +/* */ +/*************************************************************************/ + + +#ifndef __FTSTDLIB_H__ +#define __FTSTDLIB_H__ + + +#include <stddef.h> + +#define ft_ptrdiff_t ptrdiff_t + + +/**********************************************************************/ +/* */ +/* integer limits */ +/* */ +/* UINT_MAX and ULONG_MAX are used to automatically compute the size */ +/* of `int' and `long' in bytes at compile-time. So far, this works */ +/* for all platforms the library has been tested on. */ +/* */ +/* Note that on the extremely rare platforms that do not provide */ +/* integer types that are _exactly_ 16 and 32 bits wide (e.g. some */ +/* old Crays where `int' is 36 bits), we do not make any guarantee */ +/* about the correct behaviour of FT2 with all fonts. */ +/* */ +/* In these case, `ftconfig.h' will refuse to compile anyway with a */ +/* message like `couldn't find 32-bit type' or something similar. */ +/* */ +/**********************************************************************/ + + +#include <limits.h> + +#define FT_CHAR_BIT CHAR_BIT +#define FT_USHORT_MAX USHRT_MAX +#define FT_INT_MAX INT_MAX +#define FT_INT_MIN INT_MIN +#define FT_UINT_MAX UINT_MAX +#define FT_ULONG_MAX ULONG_MAX + + +/**********************************************************************/ +/* */ +/* character and string processing */ +/* */ +/**********************************************************************/ + + +#include <string.h> + +#define ft_memchr memchr +#define ft_memcmp memcmp +#define ft_memcpy memcpy +#define ft_memmove memmove +#define ft_memset memset +#define ft_strcat strcat +#define ft_strcmp strcmp +#define ft_strcpy strcpy +#define ft_strlen strlen +#define ft_strncmp strncmp +#define ft_strncpy strncpy +#define ft_strrchr strrchr +#define ft_strstr strstr + + +/**********************************************************************/ +/* */ +/* file handling */ +/* */ +/**********************************************************************/ + + +#include <stdio.h> + +#define FT_FILE FILE +#define ft_fclose fclose +#define ft_fopen fopen +#define ft_fread fread +#define ft_fseek fseek +#define ft_ftell ftell +#define ft_sprintf sprintf + + +/**********************************************************************/ +/* */ +/* sorting */ +/* */ +/**********************************************************************/ + + +#include <stdlib.h> + +#define ft_qsort qsort + + +/**********************************************************************/ +/* */ +/* memory allocation */ +/* */ +/**********************************************************************/ + + +#define ft_scalloc calloc +#define ft_sfree free +#define ft_smalloc malloc +#define ft_srealloc realloc + + +/**********************************************************************/ +/* */ +/* miscellaneous */ +/* */ +/**********************************************************************/ + + +#define ft_atol atol +#define ft_labs labs + + +/**********************************************************************/ +/* */ +/* execution control */ +/* */ +/**********************************************************************/ + + +#include <setjmp.h> + +#define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */ +/* jmp_buf is defined as a macro */ +/* on certain platforms */ + +#define ft_longjmp longjmp +#define ft_setjmp(b) setjmp( *(jmp_buf*) &(b) ) /* same thing here */ + + +/* the following is only used for debugging purposes, i.e., if */ +/* FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined */ + +#include <stdarg.h> + + +#endif /* __FTSTDLIB_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/freetype.h b/app/src/main/cpp/include/freetype2/freetype/freetype.h new file mode 100644 index 0000000..4e5d2ec --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/freetype.h @@ -0,0 +1,4044 @@ +/***************************************************************************/ +/* */ +/* freetype.h */ +/* */ +/* FreeType high-level API and common types (specification only). */ +/* */ +/* Copyright 1996-2012 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FREETYPE_H__ +#define __FREETYPE_H__ + + +#ifndef FT_FREETYPE_H +#error "`ft2build.h' hasn't been included yet!" +#error "Please always use macros to include FreeType header files." +#error "Example:" +#error " #include <ft2build.h>" +#error " #include FT_FREETYPE_H" +#endif + + +#include <ft2build.h> +#include FT_CONFIG_CONFIG_H +#include FT_ERRORS_H +#include FT_TYPES_H + + +FT_BEGIN_HEADER + + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* user_allocation */ +/* */ +/* <Title> */ +/* User allocation */ +/* */ +/* <Abstract> */ +/* How client applications should allocate FreeType data structures. */ +/* */ +/* <Description> */ +/* FreeType assumes that structures allocated by the user and passed */ +/* as arguments are zeroed out except for the actual data. In other */ +/* words, it is recommended to use `calloc' (or variants of it) */ +/* instead of `malloc' for allocation. */ +/* */ +/*************************************************************************/ + + + +/*************************************************************************/ +/*************************************************************************/ +/* */ +/* B A S I C T Y P E S */ +/* */ +/*************************************************************************/ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* base_interface */ +/* */ +/* <Title> */ +/* Base Interface */ +/* */ +/* <Abstract> */ +/* The FreeType~2 base font interface. */ +/* */ +/* <Description> */ +/* This section describes the public high-level API of FreeType~2. */ +/* */ +/* <Order> */ +/* FT_Library */ +/* FT_Face */ +/* FT_Size */ +/* FT_GlyphSlot */ +/* FT_CharMap */ +/* FT_Encoding */ +/* */ +/* FT_FaceRec */ +/* */ +/* FT_FACE_FLAG_SCALABLE */ +/* FT_FACE_FLAG_FIXED_SIZES */ +/* FT_FACE_FLAG_FIXED_WIDTH */ +/* FT_FACE_FLAG_HORIZONTAL */ +/* FT_FACE_FLAG_VERTICAL */ +/* FT_FACE_FLAG_SFNT */ +/* FT_FACE_FLAG_KERNING */ +/* FT_FACE_FLAG_MULTIPLE_MASTERS */ +/* FT_FACE_FLAG_GLYPH_NAMES */ +/* FT_FACE_FLAG_EXTERNAL_STREAM */ +/* FT_FACE_FLAG_FAST_GLYPHS */ +/* FT_FACE_FLAG_HINTER */ +/* */ +/* FT_STYLE_FLAG_BOLD */ +/* FT_STYLE_FLAG_ITALIC */ +/* */ +/* FT_SizeRec */ +/* FT_Size_Metrics */ +/* */ +/* FT_GlyphSlotRec */ +/* FT_Glyph_Metrics */ +/* FT_SubGlyph */ +/* */ +/* FT_Bitmap_Size */ +/* */ +/* FT_Init_FreeType */ +/* FT_Done_FreeType */ +/* */ +/* FT_New_Face */ +/* FT_Done_Face */ +/* FT_New_Memory_Face */ +/* FT_Open_Face */ +/* FT_Open_Args */ +/* FT_Parameter */ +/* FT_Attach_File */ +/* FT_Attach_Stream */ +/* */ +/* FT_Set_Char_Size */ +/* FT_Set_Pixel_Sizes */ +/* FT_Request_Size */ +/* FT_Select_Size */ +/* FT_Size_Request_Type */ +/* FT_Size_Request */ +/* FT_Set_Transform */ +/* FT_Load_Glyph */ +/* FT_Get_Char_Index */ +/* FT_Get_Name_Index */ +/* FT_Load_Char */ +/* */ +/* FT_OPEN_MEMORY */ +/* FT_OPEN_STREAM */ +/* FT_OPEN_PATHNAME */ +/* FT_OPEN_DRIVER */ +/* FT_OPEN_PARAMS */ +/* */ +/* FT_LOAD_DEFAULT */ +/* FT_LOAD_RENDER */ +/* FT_LOAD_MONOCHROME */ +/* FT_LOAD_LINEAR_DESIGN */ +/* FT_LOAD_NO_SCALE */ +/* FT_LOAD_NO_HINTING */ +/* FT_LOAD_NO_BITMAP */ +/* FT_LOAD_CROP_BITMAP */ +/* */ +/* FT_LOAD_VERTICAL_LAYOUT */ +/* FT_LOAD_IGNORE_TRANSFORM */ +/* FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH */ +/* FT_LOAD_FORCE_AUTOHINT */ +/* FT_LOAD_NO_RECURSE */ +/* FT_LOAD_PEDANTIC */ +/* */ +/* FT_LOAD_TARGET_NORMAL */ +/* FT_LOAD_TARGET_LIGHT */ +/* FT_LOAD_TARGET_MONO */ +/* FT_LOAD_TARGET_LCD */ +/* FT_LOAD_TARGET_LCD_V */ +/* */ +/* FT_Render_Glyph */ +/* FT_Render_Mode */ +/* FT_Get_Kerning */ +/* FT_Kerning_Mode */ +/* FT_Get_Track_Kerning */ +/* FT_Get_Glyph_Name */ +/* FT_Get_Postscript_Name */ +/* */ +/* FT_CharMapRec */ +/* FT_Select_Charmap */ +/* FT_Set_Charmap */ +/* FT_Get_Charmap_Index */ +/* */ +/* FT_FSTYPE_INSTALLABLE_EMBEDDING */ +/* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING */ +/* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING */ +/* FT_FSTYPE_EDITABLE_EMBEDDING */ +/* FT_FSTYPE_NO_SUBSETTING */ +/* FT_FSTYPE_BITMAP_EMBEDDING_ONLY */ +/* */ +/* FT_Get_FSType_Flags */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Glyph_Metrics */ +/* */ +/* <Description> */ +/* A structure used to model the metrics of a single glyph. The */ +/* values are expressed in 26.6 fractional pixel format; if the flag */ +/* @FT_LOAD_NO_SCALE has been used while loading the glyph, values */ +/* are expressed in font units instead. */ +/* */ +/* <Fields> */ +/* width :: */ +/* The glyph's width. */ +/* */ +/* height :: */ +/* The glyph's height. */ +/* */ +/* horiBearingX :: */ +/* Left side bearing for horizontal layout. */ +/* */ +/* horiBearingY :: */ +/* Top side bearing for horizontal layout. */ +/* */ +/* horiAdvance :: */ +/* Advance width for horizontal layout. */ +/* */ +/* vertBearingX :: */ +/* Left side bearing for vertical layout. */ +/* */ +/* vertBearingY :: */ +/* Top side bearing for vertical layout. Larger positive values */ +/* mean further below the vertical glyph origin. */ +/* */ +/* vertAdvance :: */ +/* Advance height for vertical layout. Positive values mean the */ +/* glyph has a positive advance downward. */ +/* */ +/* <Note> */ +/* If not disabled with @FT_LOAD_NO_HINTING, the values represent */ +/* dimensions of the hinted glyph (in case hinting is applicable). */ +/* */ +/* Stroking a glyph with an outside border does not increase */ +/* `horiAdvance' or `vertAdvance'; you have to manually adjust these */ +/* values to account for the added width and height. */ +/* */ +typedef struct FT_Glyph_Metrics_ { + FT_Pos width; + FT_Pos height; + + FT_Pos horiBearingX; + FT_Pos horiBearingY; + FT_Pos horiAdvance; + + FT_Pos vertBearingX; + FT_Pos vertBearingY; + FT_Pos vertAdvance; + +} FT_Glyph_Metrics; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Bitmap_Size */ +/* */ +/* <Description> */ +/* This structure models the metrics of a bitmap strike (i.e., a set */ +/* of glyphs for a given point size and resolution) in a bitmap font. */ +/* It is used for the `available_sizes' field of @FT_Face. */ +/* */ +/* <Fields> */ +/* height :: The vertical distance, in pixels, between two */ +/* consecutive baselines. It is always positive. */ +/* */ +/* width :: The average width, in pixels, of all glyphs in the */ +/* strike. */ +/* */ +/* size :: The nominal size of the strike in 26.6 fractional */ +/* points. This field is not very useful. */ +/* */ +/* x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional */ +/* pixels. */ +/* */ +/* y_ppem :: The vertical ppem (nominal height) in 26.6 fractional */ +/* pixels. */ +/* */ +/* <Note> */ +/* Windows FNT: */ +/* The nominal size given in a FNT font is not reliable. Thus when */ +/* the driver finds it incorrect, it sets `size' to some calculated */ +/* values and sets `x_ppem' and `y_ppem' to the pixel width and */ +/* height given in the font, respectively. */ +/* */ +/* TrueType embedded bitmaps: */ +/* `size', `width', and `height' values are not contained in the */ +/* bitmap strike itself. They are computed from the global font */ +/* parameters. */ +/* */ +typedef struct FT_Bitmap_Size_ { + FT_Short height; + FT_Short width; + + FT_Pos size; + + FT_Pos x_ppem; + FT_Pos y_ppem; + +} FT_Bitmap_Size; + + +/*************************************************************************/ +/*************************************************************************/ +/* */ +/* O B J E C T C L A S S E S */ +/* */ +/*************************************************************************/ +/*************************************************************************/ + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Library */ +/* */ +/* <Description> */ +/* A handle to a FreeType library instance. Each `library' is */ +/* completely independent from the others; it is the `root' of a set */ +/* of objects like fonts, faces, sizes, etc. */ +/* */ +/* It also embeds a memory manager (see @FT_Memory), as well as a */ +/* scan-line converter object (see @FT_Raster). */ +/* */ +/* For multi-threading applications each thread should have its own */ +/* FT_Library object. */ +/* */ +/* <Note> */ +/* Library objects are normally created by @FT_Init_FreeType, and */ +/* destroyed with @FT_Done_FreeType. */ +/* */ +typedef struct FT_LibraryRec_ *FT_Library; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Module */ +/* */ +/* <Description> */ +/* A handle to a given FreeType module object. Each module can be a */ +/* font driver, a renderer, or anything else that provides services */ +/* to the formers. */ +/* */ +typedef struct FT_ModuleRec_ *FT_Module; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Driver */ +/* */ +/* <Description> */ +/* A handle to a given FreeType font driver object. Each font driver */ +/* is a special module capable of creating faces from font files. */ +/* */ +typedef struct FT_DriverRec_ *FT_Driver; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Renderer */ +/* */ +/* <Description> */ +/* A handle to a given FreeType renderer. A renderer is a special */ +/* module in charge of converting a glyph image to a bitmap, when */ +/* necessary. Each renderer supports a given glyph image format, and */ +/* one or more target surface depths. */ +/* */ +typedef struct FT_RendererRec_ *FT_Renderer; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Face */ +/* */ +/* <Description> */ +/* A handle to a given typographic face object. A face object models */ +/* a given typeface, in a given style. */ +/* */ +/* <Note> */ +/* Each face object also owns a single @FT_GlyphSlot object, as well */ +/* as one or more @FT_Size objects. */ +/* */ +/* Use @FT_New_Face or @FT_Open_Face to create a new face object from */ +/* a given filepathname or a custom input stream. */ +/* */ +/* Use @FT_Done_Face to destroy it (along with its slot and sizes). */ +/* */ +/* <Also> */ +/* See @FT_FaceRec for the publicly accessible fields of a given face */ +/* object. */ +/* */ +typedef struct FT_FaceRec_ *FT_Face; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Size */ +/* */ +/* <Description> */ +/* A handle to an object used to model a face scaled to a given */ +/* character size. */ +/* */ +/* <Note> */ +/* Each @FT_Face has an _active_ @FT_Size object that is used by */ +/* functions like @FT_Load_Glyph to determine the scaling */ +/* transformation which is used to load and hint glyphs and metrics. */ +/* */ +/* You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, */ +/* @FT_Request_Size or even @FT_Select_Size to change the content */ +/* (i.e., the scaling values) of the active @FT_Size. */ +/* */ +/* You can use @FT_New_Size to create additional size objects for a */ +/* given @FT_Face, but they won't be used by other functions until */ +/* you activate it through @FT_Activate_Size. Only one size can be */ +/* activated at any given time per face. */ +/* */ +/* <Also> */ +/* See @FT_SizeRec for the publicly accessible fields of a given size */ +/* object. */ +/* */ +typedef struct FT_SizeRec_ *FT_Size; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_GlyphSlot */ +/* */ +/* <Description> */ +/* A handle to a given `glyph slot'. A slot is a container where it */ +/* is possible to load any of the glyphs contained in its parent */ +/* face. */ +/* */ +/* In other words, each time you call @FT_Load_Glyph or */ +/* @FT_Load_Char, the slot's content is erased by the new glyph data, */ +/* i.e., the glyph's metrics, its image (bitmap or outline), and */ +/* other control information. */ +/* */ +/* <Also> */ +/* See @FT_GlyphSlotRec for the publicly accessible glyph fields. */ +/* */ +typedef struct FT_GlyphSlotRec_ *FT_GlyphSlot; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_CharMap */ +/* */ +/* <Description> */ +/* A handle to a given character map. A charmap is used to translate */ +/* character codes in a given encoding into glyph indexes for its */ +/* parent's face. Some font formats may provide several charmaps per */ +/* font. */ +/* */ +/* Each face object owns zero or more charmaps, but only one of them */ +/* can be `active' and used by @FT_Get_Char_Index or @FT_Load_Char. */ +/* */ +/* The list of available charmaps in a face is available through the */ +/* `face->num_charmaps' and `face->charmaps' fields of @FT_FaceRec. */ +/* */ +/* The currently active charmap is available as `face->charmap'. */ +/* You should call @FT_Set_Charmap to change it. */ +/* */ +/* <Note> */ +/* When a new face is created (either through @FT_New_Face or */ +/* @FT_Open_Face), the library looks for a Unicode charmap within */ +/* the list and automatically activates it. */ +/* */ +/* <Also> */ +/* See @FT_CharMapRec for the publicly accessible fields of a given */ +/* character map. */ +/* */ +typedef struct FT_CharMapRec_ *FT_CharMap; + + +/*************************************************************************/ +/* */ +/* <Macro> */ +/* FT_ENC_TAG */ +/* */ +/* <Description> */ +/* This macro converts four-letter tags into an unsigned long. It is */ +/* used to define `encoding' identifiers (see @FT_Encoding). */ +/* */ +/* <Note> */ +/* Since many 16-bit compilers don't like 32-bit enumerations, you */ +/* should redefine this macro in case of problems to something like */ +/* this: */ +/* */ +/* { */ +/* #define FT_ENC_TAG( value, a, b, c, d ) value */ +/* } */ +/* */ +/* to get a simple enumeration without assigning special numbers. */ +/* */ + +#ifndef FT_ENC_TAG +#define FT_ENC_TAG(value, a, b, c, d) \ + value = ( ( (FT_UInt32)(a) << 24 ) | \ + ( (FT_UInt32)(b) << 16 ) | \ + ( (FT_UInt32)(c) << 8 ) | \ + (FT_UInt32)(d) ) + +#endif /* FT_ENC_TAG */ + + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* FT_Encoding */ +/* */ +/* <Description> */ +/* An enumeration used to specify character sets supported by */ +/* charmaps. Used in the @FT_Select_Charmap API function. */ +/* */ +/* <Note> */ +/* Despite the name, this enumeration lists specific character */ +/* repertories (i.e., charsets), and not text encoding methods (e.g., */ +/* UTF-8, UTF-16, etc.). */ +/* */ +/* Other encodings might be defined in the future. */ +/* */ +/* <Values> */ +/* FT_ENCODING_NONE :: */ +/* The encoding value~0 is reserved. */ +/* */ +/* FT_ENCODING_UNICODE :: */ +/* Corresponds to the Unicode character set. This value covers */ +/* all versions of the Unicode repertoire, including ASCII and */ +/* Latin-1. Most fonts include a Unicode charmap, but not all */ +/* of them. */ +/* */ +/* For example, if you want to access Unicode value U+1F028 (and */ +/* the font contains it), use value 0x1F028 as the input value for */ +/* @FT_Get_Char_Index. */ +/* */ +/* FT_ENCODING_MS_SYMBOL :: */ +/* Corresponds to the Microsoft Symbol encoding, used to encode */ +/* mathematical symbols in the 32..255 character code range. For */ +/* more information, see `http://www.ceviz.net/symbol.htm'. */ +/* */ +/* FT_ENCODING_SJIS :: */ +/* Corresponds to Japanese SJIS encoding. More info at */ +/* at `http://langsupport.japanreference.com/encoding.shtml'. */ +/* See note on multi-byte encodings below. */ +/* */ +/* FT_ENCODING_GB2312 :: */ +/* Corresponds to an encoding system for Simplified Chinese as used */ +/* used in mainland China. */ +/* */ +/* FT_ENCODING_BIG5 :: */ +/* Corresponds to an encoding system for Traditional Chinese as */ +/* used in Taiwan and Hong Kong. */ +/* */ +/* FT_ENCODING_WANSUNG :: */ +/* Corresponds to the Korean encoding system known as Wansung. */ +/* For more information see */ +/* `http://www.microsoft.com/typography/unicode/949.txt'. */ +/* */ +/* FT_ENCODING_JOHAB :: */ +/* The Korean standard character set (KS~C 5601-1992), which */ +/* corresponds to MS Windows code page 1361. This character set */ +/* includes all possible Hangeul character combinations. */ +/* */ +/* FT_ENCODING_ADOBE_LATIN_1 :: */ +/* Corresponds to a Latin-1 encoding as defined in a Type~1 */ +/* PostScript font. It is limited to 256 character codes. */ +/* */ +/* FT_ENCODING_ADOBE_STANDARD :: */ +/* Corresponds to the Adobe Standard encoding, as found in Type~1, */ +/* CFF, and OpenType/CFF fonts. It is limited to 256 character */ +/* codes. */ +/* */ +/* FT_ENCODING_ADOBE_EXPERT :: */ +/* Corresponds to the Adobe Expert encoding, as found in Type~1, */ +/* CFF, and OpenType/CFF fonts. It is limited to 256 character */ +/* codes. */ +/* */ +/* FT_ENCODING_ADOBE_CUSTOM :: */ +/* Corresponds to a custom encoding, as found in Type~1, CFF, and */ +/* OpenType/CFF fonts. It is limited to 256 character codes. */ +/* */ +/* FT_ENCODING_APPLE_ROMAN :: */ +/* Corresponds to the 8-bit Apple roman encoding. Many TrueType */ +/* and OpenType fonts contain a charmap for this encoding, since */ +/* older versions of Mac OS are able to use it. */ +/* */ +/* FT_ENCODING_OLD_LATIN_2 :: */ +/* This value is deprecated and was never used nor reported by */ +/* FreeType. Don't use or test for it. */ +/* */ +/* FT_ENCODING_MS_SJIS :: */ +/* Same as FT_ENCODING_SJIS. Deprecated. */ +/* */ +/* FT_ENCODING_MS_GB2312 :: */ +/* Same as FT_ENCODING_GB2312. Deprecated. */ +/* */ +/* FT_ENCODING_MS_BIG5 :: */ +/* Same as FT_ENCODING_BIG5. Deprecated. */ +/* */ +/* FT_ENCODING_MS_WANSUNG :: */ +/* Same as FT_ENCODING_WANSUNG. Deprecated. */ +/* */ +/* FT_ENCODING_MS_JOHAB :: */ +/* Same as FT_ENCODING_JOHAB. Deprecated. */ +/* */ +/* <Note> */ +/* By default, FreeType automatically synthesizes a Unicode charmap */ +/* for PostScript fonts, using their glyph names dictionaries. */ +/* However, it also reports the encodings defined explicitly in the */ +/* font file, for the cases when they are needed, with the Adobe */ +/* values as well. */ +/* */ +/* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */ +/* is neither Unicode nor ISO-8859-1 (otherwise it is set to */ +/* FT_ENCODING_UNICODE). Use @FT_Get_BDF_Charset_ID to find out */ +/* which encoding is really present. If, for example, the */ +/* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */ +/* the font is encoded in KOI8-R. */ +/* */ +/* FT_ENCODING_NONE is always set (with a single exception) by the */ +/* winfonts driver. Use @FT_Get_WinFNT_Header and examine the */ +/* `charset' field of the @FT_WinFNT_HeaderRec structure to find out */ +/* which encoding is really present. For example, */ +/* @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for */ +/* Russian). */ +/* */ +/* FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */ +/* and `encoding_id' is not @TT_MAC_ID_ROMAN (otherwise it is set to */ +/* FT_ENCODING_APPLE_ROMAN). */ +/* */ +/* If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function */ +/* @FT_Get_CMap_Language_ID to query the Mac language ID which may */ +/* be needed to be able to distinguish Apple encoding variants. See */ +/* */ +/* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/README.TXT */ +/* */ +/* to get an idea how to do that. Basically, if the language ID */ +/* is~0, don't use it, otherwise subtract 1 from the language ID. */ +/* Then examine `encoding_id'. If, for example, `encoding_id' is */ +/* @TT_MAC_ID_ROMAN and the language ID (minus~1) is */ +/* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */ +/* @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi */ +/* variant the Arabic encoding. */ +/* */ +typedef enum FT_Encoding_ { + FT_ENC_TAG(FT_ENCODING_NONE, 0, 0, 0, 0), + + FT_ENC_TAG(FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b'), + FT_ENC_TAG(FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c'), + + FT_ENC_TAG(FT_ENCODING_SJIS, 's', 'j', 'i', 's'), + FT_ENC_TAG(FT_ENCODING_GB2312, 'g', 'b', ' ', ' '), + FT_ENC_TAG(FT_ENCODING_BIG5, 'b', 'i', 'g', '5'), + FT_ENC_TAG(FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's'), + FT_ENC_TAG(FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a'), + + /* for backwards compatibility */ + FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS, + FT_ENCODING_MS_GB2312 = FT_ENCODING_GB2312, + FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5, + FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG, + FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB, + + FT_ENC_TAG(FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B'), + FT_ENC_TAG(FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E'), + FT_ENC_TAG(FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C'), + FT_ENC_TAG(FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1'), + + FT_ENC_TAG(FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2'), + + FT_ENC_TAG(FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n') + +} FT_Encoding; + + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* ft_encoding_xxx */ +/* */ +/* <Description> */ +/* These constants are deprecated; use the corresponding @FT_Encoding */ +/* values instead. */ +/* */ +#define ft_encoding_none FT_ENCODING_NONE +#define ft_encoding_unicode FT_ENCODING_UNICODE +#define ft_encoding_symbol FT_ENCODING_MS_SYMBOL +#define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1 +#define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2 +#define ft_encoding_sjis FT_ENCODING_SJIS +#define ft_encoding_gb2312 FT_ENCODING_GB2312 +#define ft_encoding_big5 FT_ENCODING_BIG5 +#define ft_encoding_wansung FT_ENCODING_WANSUNG +#define ft_encoding_johab FT_ENCODING_JOHAB + +#define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD +#define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT +#define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM +#define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_CharMapRec */ +/* */ +/* <Description> */ +/* The base charmap structure. */ +/* */ +/* <Fields> */ +/* face :: A handle to the parent face object. */ +/* */ +/* encoding :: An @FT_Encoding tag identifying the charmap. Use */ +/* this with @FT_Select_Charmap. */ +/* */ +/* platform_id :: An ID number describing the platform for the */ +/* following encoding ID. This comes directly from */ +/* the TrueType specification and should be emulated */ +/* for other formats. */ +/* */ +/* encoding_id :: A platform specific encoding number. This also */ +/* comes from the TrueType specification and should be */ +/* emulated similarly. */ +/* */ +typedef struct FT_CharMapRec_ { + FT_Face face; + FT_Encoding encoding; + FT_UShort platform_id; + FT_UShort encoding_id; + +} FT_CharMapRec; + + +/*************************************************************************/ +/*************************************************************************/ +/* */ +/* B A S E O B J E C T C L A S S E S */ +/* */ +/*************************************************************************/ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Face_Internal */ +/* */ +/* <Description> */ +/* An opaque handle to an `FT_Face_InternalRec' structure, used to */ +/* model private data of a given @FT_Face object. */ +/* */ +/* This structure might change between releases of FreeType~2 and is */ +/* not generally available to client applications. */ +/* */ +typedef struct FT_Face_InternalRec_ *FT_Face_Internal; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_FaceRec */ +/* */ +/* <Description> */ +/* FreeType root face class structure. A face object models a */ +/* typeface in a font file. */ +/* */ +/* <Fields> */ +/* num_faces :: The number of faces in the font file. Some */ +/* font formats can have multiple faces in */ +/* a font file. */ +/* */ +/* face_index :: The index of the face in the font file. It */ +/* is set to~0 if there is only one face in */ +/* the font file. */ +/* */ +/* face_flags :: A set of bit flags that give important */ +/* information about the face; see */ +/* @FT_FACE_FLAG_XXX for the details. */ +/* */ +/* style_flags :: A set of bit flags indicating the style of */ +/* the face; see @FT_STYLE_FLAG_XXX for the */ +/* details. */ +/* */ +/* num_glyphs :: The number of glyphs in the face. If the */ +/* face is scalable and has sbits (see */ +/* `num_fixed_sizes'), it is set to the number */ +/* of outline glyphs. */ +/* */ +/* For CID-keyed fonts, this value gives the */ +/* highest CID used in the font. */ +/* */ +/* family_name :: The face's family name. This is an ASCII */ +/* string, usually in English, which describes */ +/* the typeface's family (like `Times New */ +/* Roman', `Bodoni', `Garamond', etc). This */ +/* is a least common denominator used to list */ +/* fonts. Some formats (TrueType & OpenType) */ +/* provide localized and Unicode versions of */ +/* this string. Applications should use the */ +/* format specific interface to access them. */ +/* Can be NULL (e.g., in fonts embedded in a */ +/* PDF file). */ +/* */ +/* style_name :: The face's style name. This is an ASCII */ +/* string, usually in English, which describes */ +/* the typeface's style (like `Italic', */ +/* `Bold', `Condensed', etc). Not all font */ +/* formats provide a style name, so this field */ +/* is optional, and can be set to NULL. As */ +/* for `family_name', some formats provide */ +/* localized and Unicode versions of this */ +/* string. Applications should use the format */ +/* specific interface to access them. */ +/* */ +/* num_fixed_sizes :: The number of bitmap strikes in the face. */ +/* Even if the face is scalable, there might */ +/* still be bitmap strikes, which are called */ +/* `sbits' in that case. */ +/* */ +/* available_sizes :: An array of @FT_Bitmap_Size for all bitmap */ +/* strikes in the face. It is set to NULL if */ +/* there is no bitmap strike. */ +/* */ +/* num_charmaps :: The number of charmaps in the face. */ +/* */ +/* charmaps :: An array of the charmaps of the face. */ +/* */ +/* generic :: A field reserved for client uses. See the */ +/* @FT_Generic type description. */ +/* */ +/* bbox :: The font bounding box. Coordinates are */ +/* expressed in font units (see */ +/* `units_per_EM'). The box is large enough */ +/* to contain any glyph from the font. Thus, */ +/* `bbox.yMax' can be seen as the `maximum */ +/* ascender', and `bbox.yMin' as the `minimum */ +/* descender'. Only relevant for scalable */ +/* formats. */ +/* */ +/* Note that the bounding box might be off by */ +/* (at least) one pixel for hinted fonts. See */ +/* @FT_Size_Metrics for further discussion. */ +/* */ +/* units_per_EM :: The number of font units per EM square for */ +/* this face. This is typically 2048 for */ +/* TrueType fonts, and 1000 for Type~1 fonts. */ +/* Only relevant for scalable formats. */ +/* */ +/* ascender :: The typographic ascender of the face, */ +/* expressed in font units. For font formats */ +/* not having this information, it is set to */ +/* `bbox.yMax'. Only relevant for scalable */ +/* formats. */ +/* */ +/* descender :: The typographic descender of the face, */ +/* expressed in font units. For font formats */ +/* not having this information, it is set to */ +/* `bbox.yMin'. Note that this field is */ +/* usually negative. Only relevant for */ +/* scalable formats. */ +/* */ +/* height :: The height is the vertical distance */ +/* between two consecutive baselines, */ +/* expressed in font units. It is always */ +/* positive. Only relevant for scalable */ +/* formats. */ +/* */ +/* max_advance_width :: The maximum advance width, in font units, */ +/* for all glyphs in this face. This can be */ +/* used to make word wrapping computations */ +/* faster. Only relevant for scalable */ +/* formats. */ +/* */ +/* max_advance_height :: The maximum advance height, in font units, */ +/* for all glyphs in this face. This is only */ +/* relevant for vertical layouts, and is set */ +/* to `height' for fonts that do not provide */ +/* vertical metrics. Only relevant for */ +/* scalable formats. */ +/* */ +/* underline_position :: The position, in font units, of the */ +/* underline line for this face. It is the */ +/* center of the underlining stem. Only */ +/* relevant for scalable formats. */ +/* */ +/* underline_thickness :: The thickness, in font units, of the */ +/* underline for this face. Only relevant for */ +/* scalable formats. */ +/* */ +/* glyph :: The face's associated glyph slot(s). */ +/* */ +/* size :: The current active size for this face. */ +/* */ +/* charmap :: The current active charmap for this face. */ +/* */ +/* <Note> */ +/* Fields may be changed after a call to @FT_Attach_File or */ +/* @FT_Attach_Stream. */ +/* */ +typedef struct FT_FaceRec_ { + FT_Long num_faces; + FT_Long face_index; + + FT_Long face_flags; + FT_Long style_flags; + + FT_Long num_glyphs; + + FT_String *family_name; + FT_String *style_name; + + FT_Int num_fixed_sizes; + FT_Bitmap_Size *available_sizes; + + FT_Int num_charmaps; + FT_CharMap *charmaps; + + FT_Generic generic; + + /*# The following member variables (down to `underline_thickness') */ + /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */ + /*# for bitmap fonts. */ + FT_BBox bbox; + + FT_UShort units_per_EM; + FT_Short ascender; + FT_Short descender; + FT_Short height; + + FT_Short max_advance_width; + FT_Short max_advance_height; + + FT_Short underline_position; + FT_Short underline_thickness; + + FT_GlyphSlot glyph; + FT_Size size; + FT_CharMap charmap; + + /*@private begin */ + + FT_Driver driver; + FT_Memory memory; + FT_Stream stream; + + FT_ListRec sizes_list; + + FT_Generic autohint; /* face-specific auto-hinter data */ + void *extensions; /* unused */ + + FT_Face_Internal internal; + + /*@private end */ + +} FT_FaceRec; + + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* FT_FACE_FLAG_XXX */ +/* */ +/* <Description> */ +/* A list of bit flags used in the `face_flags' field of the */ +/* @FT_FaceRec structure. They inform client applications of */ +/* properties of the corresponding face. */ +/* */ +/* <Values> */ +/* FT_FACE_FLAG_SCALABLE :: */ +/* Indicates that the face contains outline glyphs. This doesn't */ +/* prevent bitmap strikes, i.e., a face can have both this and */ +/* and @FT_FACE_FLAG_FIXED_SIZES set. */ +/* */ +/* FT_FACE_FLAG_FIXED_SIZES :: */ +/* Indicates that the face contains bitmap strikes. See also the */ +/* `num_fixed_sizes' and `available_sizes' fields of @FT_FaceRec. */ +/* */ +/* FT_FACE_FLAG_FIXED_WIDTH :: */ +/* Indicates that the face contains fixed-width characters (like */ +/* Courier, Lucido, MonoType, etc.). */ +/* */ +/* FT_FACE_FLAG_SFNT :: */ +/* Indicates that the face uses the `sfnt' storage scheme. For */ +/* now, this means TrueType and OpenType. */ +/* */ +/* FT_FACE_FLAG_HORIZONTAL :: */ +/* Indicates that the face contains horizontal glyph metrics. This */ +/* should be set for all common formats. */ +/* */ +/* FT_FACE_FLAG_VERTICAL :: */ +/* Indicates that the face contains vertical glyph metrics. This */ +/* is only available in some formats, not all of them. */ +/* */ +/* FT_FACE_FLAG_KERNING :: */ +/* Indicates that the face contains kerning information. If set, */ +/* the kerning distance can be retrieved through the function */ +/* @FT_Get_Kerning. Otherwise the function always return the */ +/* vector (0,0). Note that FreeType doesn't handle kerning data */ +/* from the `GPOS' table (as present in some OpenType fonts). */ +/* */ +/* FT_FACE_FLAG_FAST_GLYPHS :: */ +/* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. */ +/* */ +/* FT_FACE_FLAG_MULTIPLE_MASTERS :: */ +/* Indicates that the font contains multiple masters and is capable */ +/* of interpolating between them. See the multiple-masters */ +/* specific API for details. */ +/* */ +/* FT_FACE_FLAG_GLYPH_NAMES :: */ +/* Indicates that the font contains glyph names that can be */ +/* retrieved through @FT_Get_Glyph_Name. Note that some TrueType */ +/* fonts contain broken glyph name tables. Use the function */ +/* @FT_Has_PS_Glyph_Names when needed. */ +/* */ +/* FT_FACE_FLAG_EXTERNAL_STREAM :: */ +/* Used internally by FreeType to indicate that a face's stream was */ +/* provided by the client application and should not be destroyed */ +/* when @FT_Done_Face is called. Don't read or test this flag. */ +/* */ +/* FT_FACE_FLAG_HINTER :: */ +/* Set if the font driver has a hinting machine of its own. For */ +/* example, with TrueType fonts, it makes sense to use data from */ +/* the SFNT `gasp' table only if the native TrueType hinting engine */ +/* (with the bytecode interpreter) is available and active. */ +/* */ +/* FT_FACE_FLAG_CID_KEYED :: */ +/* Set if the font is CID-keyed. In that case, the font is not */ +/* accessed by glyph indices but by CID values. For subsetted */ +/* CID-keyed fonts this has the consequence that not all index */ +/* values are a valid argument to FT_Load_Glyph. Only the CID */ +/* values for which corresponding glyphs in the subsetted font */ +/* exist make FT_Load_Glyph return successfully; in all other cases */ +/* you get an `FT_Err_Invalid_Argument' error. */ +/* */ +/* Note that CID-keyed fonts which are in an SFNT wrapper don't */ +/* have this flag set since the glyphs are accessed in the normal */ +/* way (using contiguous indices); the `CID-ness' isn't visible to */ +/* the application. */ +/* */ +/* FT_FACE_FLAG_TRICKY :: */ +/* Set if the font is `tricky', this is, it always needs the */ +/* font format's native hinting engine to get a reasonable result. */ +/* A typical example is the Chinese font `mingli.ttf' which uses */ +/* TrueType bytecode instructions to move and scale all of its */ +/* subglyphs. */ +/* */ +/* It is not possible to autohint such fonts using */ +/* @FT_LOAD_FORCE_AUTOHINT; it will also ignore */ +/* @FT_LOAD_NO_HINTING. You have to set both @FT_LOAD_NO_HINTING */ +/* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */ +/* probably never want this except for demonstration purposes. */ +/* */ +/* Currently, there are about a dozen TrueType fonts in the list of */ +/* tricky fonts; they are hard-coded in file `ttobjs.c'. */ +/* */ +#define FT_FACE_FLAG_SCALABLE ( 1L << 0 ) +#define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 ) +#define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 ) +#define FT_FACE_FLAG_SFNT ( 1L << 3 ) +#define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 ) +#define FT_FACE_FLAG_VERTICAL ( 1L << 5 ) +#define FT_FACE_FLAG_KERNING ( 1L << 6 ) +#define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 ) +#define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 ) +#define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 ) +#define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 ) +#define FT_FACE_FLAG_HINTER ( 1L << 11 ) +#define FT_FACE_FLAG_CID_KEYED ( 1L << 12 ) +#define FT_FACE_FLAG_TRICKY ( 1L << 13 ) + + +/************************************************************************* + * + * @macro: + * FT_HAS_HORIZONTAL( face ) + * + * @description: + * A macro that returns true whenever a face object contains + * horizontal metrics (this is true for all font formats though). + * + * @also: + * @FT_HAS_VERTICAL can be used to check for vertical metrics. + * + */ +#define FT_HAS_HORIZONTAL(face) \ + ( face->face_flags & FT_FACE_FLAG_HORIZONTAL ) + + +/************************************************************************* + * + * @macro: + * FT_HAS_VERTICAL( face ) + * + * @description: + * A macro that returns true whenever a face object contains vertical + * metrics. + * + */ +#define FT_HAS_VERTICAL(face) \ + ( face->face_flags & FT_FACE_FLAG_VERTICAL ) + + +/************************************************************************* + * + * @macro: + * FT_HAS_KERNING( face ) + * + * @description: + * A macro that returns true whenever a face object contains kerning + * data that can be accessed with @FT_Get_Kerning. + * + */ +#define FT_HAS_KERNING(face) \ + ( face->face_flags & FT_FACE_FLAG_KERNING ) + + +/************************************************************************* + * + * @macro: + * FT_IS_SCALABLE( face ) + * + * @description: + * A macro that returns true whenever a face object contains a scalable + * font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF, + * and PFR font formats. + * + */ +#define FT_IS_SCALABLE(face) \ + ( face->face_flags & FT_FACE_FLAG_SCALABLE ) + + +/************************************************************************* + * + * @macro: + * FT_IS_SFNT( face ) + * + * @description: + * A macro that returns true whenever a face object contains a font + * whose format is based on the SFNT storage scheme. This usually + * means: TrueType fonts, OpenType fonts, as well as SFNT-based embedded + * bitmap fonts. + * + * If this macro is true, all functions defined in @FT_SFNT_NAMES_H and + * @FT_TRUETYPE_TABLES_H are available. + * + */ +#define FT_IS_SFNT(face) \ + ( face->face_flags & FT_FACE_FLAG_SFNT ) + + +/************************************************************************* + * + * @macro: + * FT_IS_FIXED_WIDTH( face ) + * + * @description: + * A macro that returns true whenever a face object contains a font face + * that contains fixed-width (or `monospace', `fixed-pitch', etc.) + * glyphs. + * + */ +#define FT_IS_FIXED_WIDTH(face) \ + ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH ) + + +/************************************************************************* + * + * @macro: + * FT_HAS_FIXED_SIZES( face ) + * + * @description: + * A macro that returns true whenever a face object contains some + * embedded bitmaps. See the `available_sizes' field of the + * @FT_FaceRec structure. + * + */ +#define FT_HAS_FIXED_SIZES(face) \ + ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES ) + + +/************************************************************************* + * + * @macro: + * FT_HAS_FAST_GLYPHS( face ) + * + * @description: + * Deprecated. + * + */ +#define FT_HAS_FAST_GLYPHS(face) 0 + + +/************************************************************************* + * + * @macro: + * FT_HAS_GLYPH_NAMES( face ) + * + * @description: + * A macro that returns true whenever a face object contains some glyph + * names that can be accessed through @FT_Get_Glyph_Name. + * + */ +#define FT_HAS_GLYPH_NAMES(face) \ + ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) + + +/************************************************************************* + * + * @macro: + * FT_HAS_MULTIPLE_MASTERS( face ) + * + * @description: + * A macro that returns true whenever a face object contains some + * multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H + * are then available to choose the exact design you want. + * + */ +#define FT_HAS_MULTIPLE_MASTERS(face) \ + ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS ) + + +/************************************************************************* + * + * @macro: + * FT_IS_CID_KEYED( face ) + * + * @description: + * A macro that returns true whenever a face object contains a CID-keyed + * font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more + * details. + * + * If this macro is true, all functions defined in @FT_CID_H are + * available. + * + */ +#define FT_IS_CID_KEYED(face) \ + ( face->face_flags & FT_FACE_FLAG_CID_KEYED ) + + +/************************************************************************* + * + * @macro: + * FT_IS_TRICKY( face ) + * + * @description: + * A macro that returns true whenever a face represents a `tricky' font. + * See the discussion of @FT_FACE_FLAG_TRICKY for more details. + * + */ +#define FT_IS_TRICKY(face) \ + ( face->face_flags & FT_FACE_FLAG_TRICKY ) + + +/*************************************************************************/ +/* */ +/* <Const> */ +/* FT_STYLE_FLAG_XXX */ +/* */ +/* <Description> */ +/* A list of bit-flags used to indicate the style of a given face. */ +/* These are used in the `style_flags' field of @FT_FaceRec. */ +/* */ +/* <Values> */ +/* FT_STYLE_FLAG_ITALIC :: */ +/* Indicates that a given face style is italic or oblique. */ +/* */ +/* FT_STYLE_FLAG_BOLD :: */ +/* Indicates that a given face is bold. */ +/* */ +/* <Note> */ +/* The style information as provided by FreeType is very basic. More */ +/* details are beyond the scope and should be done on a higher level */ +/* (for example, by analyzing various fields of the `OS/2' table in */ +/* SFNT based fonts). */ +/* */ +#define FT_STYLE_FLAG_ITALIC ( 1 << 0 ) +#define FT_STYLE_FLAG_BOLD ( 1 << 1 ) + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Size_Internal */ +/* */ +/* <Description> */ +/* An opaque handle to an `FT_Size_InternalRec' structure, used to */ +/* model private data of a given @FT_Size object. */ +/* */ +typedef struct FT_Size_InternalRec_ *FT_Size_Internal; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Size_Metrics */ +/* */ +/* <Description> */ +/* The size metrics structure gives the metrics of a size object. */ +/* */ +/* <Fields> */ +/* x_ppem :: The width of the scaled EM square in pixels, hence */ +/* the term `ppem' (pixels per EM). It is also */ +/* referred to as `nominal width'. */ +/* */ +/* y_ppem :: The height of the scaled EM square in pixels, */ +/* hence the term `ppem' (pixels per EM). It is also */ +/* referred to as `nominal height'. */ +/* */ +/* x_scale :: A 16.16 fractional scaling value used to convert */ +/* horizontal metrics from font units to 26.6 */ +/* fractional pixels. Only relevant for scalable */ +/* font formats. */ +/* */ +/* y_scale :: A 16.16 fractional scaling value used to convert */ +/* vertical metrics from font units to 26.6 */ +/* fractional pixels. Only relevant for scalable */ +/* font formats. */ +/* */ +/* ascender :: The ascender in 26.6 fractional pixels. See */ +/* @FT_FaceRec for the details. */ +/* */ +/* descender :: The descender in 26.6 fractional pixels. See */ +/* @FT_FaceRec for the details. */ +/* */ +/* height :: The height in 26.6 fractional pixels. See */ +/* @FT_FaceRec for the details. */ +/* */ +/* max_advance :: The maximum advance width in 26.6 fractional */ +/* pixels. See @FT_FaceRec for the details. */ +/* */ +/* <Note> */ +/* The scaling values, if relevant, are determined first during a */ +/* size changing operation. The remaining fields are then set by the */ +/* driver. For scalable formats, they are usually set to scaled */ +/* values of the corresponding fields in @FT_FaceRec. */ +/* */ +/* Note that due to glyph hinting, these values might not be exact */ +/* for certain fonts. Thus they must be treated as unreliable */ +/* with an error margin of at least one pixel! */ +/* */ +/* Indeed, the only way to get the exact metrics is to render _all_ */ +/* glyphs. As this would be a definite performance hit, it is up to */ +/* client applications to perform such computations. */ +/* */ +/* The FT_Size_Metrics structure is valid for bitmap fonts also. */ +/* */ +typedef struct FT_Size_Metrics_ { + FT_UShort x_ppem; /* horizontal pixels per EM */ + FT_UShort y_ppem; /* vertical pixels per EM */ + + FT_Fixed x_scale; /* scaling values used to convert font */ + FT_Fixed y_scale; /* units to 26.6 fractional pixels */ + + FT_Pos ascender; /* ascender in 26.6 frac. pixels */ + FT_Pos descender; /* descender in 26.6 frac. pixels */ + FT_Pos height; /* text height in 26.6 frac. pixels */ + FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */ + +} FT_Size_Metrics; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_SizeRec */ +/* */ +/* <Description> */ +/* FreeType root size class structure. A size object models a face */ +/* object at a given size. */ +/* */ +/* <Fields> */ +/* face :: Handle to the parent face object. */ +/* */ +/* generic :: A typeless pointer, which is unused by the FreeType */ +/* library or any of its drivers. It can be used by */ +/* client applications to link their own data to each size */ +/* object. */ +/* */ +/* metrics :: Metrics for this size object. This field is read-only. */ +/* */ +typedef struct FT_SizeRec_ { + FT_Face face; /* parent face object */ + FT_Generic generic; /* generic pointer for client uses */ + FT_Size_Metrics metrics; /* size metrics */ + FT_Size_Internal internal; + +} FT_SizeRec; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_SubGlyph */ +/* */ +/* <Description> */ +/* The subglyph structure is an internal object used to describe */ +/* subglyphs (for example, in the case of composites). */ +/* */ +/* <Note> */ +/* The subglyph implementation is not part of the high-level API, */ +/* hence the forward structure declaration. */ +/* */ +/* You can however retrieve subglyph information with */ +/* @FT_Get_SubGlyph_Info. */ +/* */ +typedef struct FT_SubGlyphRec_ *FT_SubGlyph; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Slot_Internal */ +/* */ +/* <Description> */ +/* An opaque handle to an `FT_Slot_InternalRec' structure, used to */ +/* model private data of a given @FT_GlyphSlot object. */ +/* */ +typedef struct FT_Slot_InternalRec_ *FT_Slot_Internal; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_GlyphSlotRec */ +/* */ +/* <Description> */ +/* FreeType root glyph slot class structure. A glyph slot is a */ +/* container where individual glyphs can be loaded, be they in */ +/* outline or bitmap format. */ +/* */ +/* <Fields> */ +/* library :: A handle to the FreeType library instance */ +/* this slot belongs to. */ +/* */ +/* face :: A handle to the parent face object. */ +/* */ +/* next :: In some cases (like some font tools), several */ +/* glyph slots per face object can be a good */ +/* thing. As this is rare, the glyph slots are */ +/* listed through a direct, single-linked list */ +/* using its `next' field. */ +/* */ +/* generic :: A typeless pointer which is unused by the */ +/* FreeType library or any of its drivers. It */ +/* can be used by client applications to link */ +/* their own data to each glyph slot object. */ +/* */ +/* metrics :: The metrics of the last loaded glyph in the */ +/* slot. The returned values depend on the last */ +/* load flags (see the @FT_Load_Glyph API */ +/* function) and can be expressed either in 26.6 */ +/* fractional pixels or font units. */ +/* */ +/* Note that even when the glyph image is */ +/* transformed, the metrics are not. */ +/* */ +/* linearHoriAdvance :: The advance width of the unhinted glyph. */ +/* Its value is expressed in 16.16 fractional */ +/* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */ +/* when loading the glyph. This field can be */ +/* important to perform correct WYSIWYG layout. */ +/* Only relevant for outline glyphs. */ +/* */ +/* linearVertAdvance :: The advance height of the unhinted glyph. */ +/* Its value is expressed in 16.16 fractional */ +/* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */ +/* when loading the glyph. This field can be */ +/* important to perform correct WYSIWYG layout. */ +/* Only relevant for outline glyphs. */ +/* */ +/* advance :: This shorthand is, depending on */ +/* @FT_LOAD_IGNORE_TRANSFORM, the transformed */ +/* advance width for the glyph (in 26.6 */ +/* fractional pixel format). As specified with */ +/* @FT_LOAD_VERTICAL_LAYOUT, it uses either the */ +/* `horiAdvance' or the `vertAdvance' value of */ +/* `metrics' field. */ +/* */ +/* format :: This field indicates the format of the image */ +/* contained in the glyph slot. Typically */ +/* @FT_GLYPH_FORMAT_BITMAP, */ +/* @FT_GLYPH_FORMAT_OUTLINE, or */ +/* @FT_GLYPH_FORMAT_COMPOSITE, but others are */ +/* possible. */ +/* */ +/* bitmap :: This field is used as a bitmap descriptor */ +/* when the slot format is */ +/* @FT_GLYPH_FORMAT_BITMAP. Note that the */ +/* address and content of the bitmap buffer can */ +/* change between calls of @FT_Load_Glyph and a */ +/* few other functions. */ +/* */ +/* bitmap_left :: This is the bitmap's left bearing expressed */ +/* in integer pixels. Of course, this is only */ +/* valid if the format is */ +/* @FT_GLYPH_FORMAT_BITMAP. */ +/* */ +/* bitmap_top :: This is the bitmap's top bearing expressed in */ +/* integer pixels. Remember that this is the */ +/* distance from the baseline to the top-most */ +/* glyph scanline, upwards y~coordinates being */ +/* *positive*. */ +/* */ +/* outline :: The outline descriptor for the current glyph */ +/* image if its format is */ +/* @FT_GLYPH_FORMAT_OUTLINE. Once a glyph is */ +/* loaded, `outline' can be transformed, */ +/* distorted, embolded, etc. However, it must */ +/* not be freed. */ +/* */ +/* num_subglyphs :: The number of subglyphs in a composite glyph. */ +/* This field is only valid for the composite */ +/* glyph format that should normally only be */ +/* loaded with the @FT_LOAD_NO_RECURSE flag. */ +/* For now this is internal to FreeType. */ +/* */ +/* subglyphs :: An array of subglyph descriptors for */ +/* composite glyphs. There are `num_subglyphs' */ +/* elements in there. Currently internal to */ +/* FreeType. */ +/* */ +/* control_data :: Certain font drivers can also return the */ +/* control data for a given glyph image (e.g. */ +/* TrueType bytecode, Type~1 charstrings, etc.). */ +/* This field is a pointer to such data. */ +/* */ +/* control_len :: This is the length in bytes of the control */ +/* data. */ +/* */ +/* other :: Really wicked formats can use this pointer to */ +/* present their own glyph image to client */ +/* applications. Note that the application */ +/* needs to know about the image format. */ +/* */ +/* lsb_delta :: The difference between hinted and unhinted */ +/* left side bearing while autohinting is */ +/* active. Zero otherwise. */ +/* */ +/* rsb_delta :: The difference between hinted and unhinted */ +/* right side bearing while autohinting is */ +/* active. Zero otherwise. */ +/* */ +/* <Note> */ +/* If @FT_Load_Glyph is called with default flags (see */ +/* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */ +/* its native format (e.g., an outline glyph for TrueType and Type~1 */ +/* formats). */ +/* */ +/* This image can later be converted into a bitmap by calling */ +/* @FT_Render_Glyph. This function finds the current renderer for */ +/* the native image's format, then invokes it. */ +/* */ +/* The renderer is in charge of transforming the native image through */ +/* the slot's face transformation fields, then converting it into a */ +/* bitmap that is returned in `slot->bitmap'. */ +/* */ +/* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */ +/* to specify the position of the bitmap relative to the current pen */ +/* position (e.g., coordinates (0,0) on the baseline). Of course, */ +/* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */ +/* */ +/* <Note> */ +/* Here a small pseudo code fragment which shows how to use */ +/* `lsb_delta' and `rsb_delta': */ +/* */ +/* { */ +/* FT_Pos origin_x = 0; */ +/* FT_Pos prev_rsb_delta = 0; */ +/* */ +/* */ +/* for all glyphs do */ +/* <compute kern between current and previous glyph and add it to */ +/* `origin_x'> */ +/* */ +/* <load glyph with `FT_Load_Glyph'> */ +/* */ +/* if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) */ +/* origin_x -= 64; */ +/* else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) */ +/* origin_x += 64; */ +/* */ +/* prev_rsb_delta = face->glyph->rsb_delta; */ +/* */ +/* <save glyph image, or render glyph, or ...> */ +/* */ +/* origin_x += face->glyph->advance.x; */ +/* endfor */ +/* } */ +/* */ +typedef struct FT_GlyphSlotRec_ { + FT_Library library; + FT_Face face; + FT_GlyphSlot next; + FT_UInt reserved; /* retained for binary compatibility */ + FT_Generic generic; + + FT_Glyph_Metrics metrics; + FT_Fixed linearHoriAdvance; + FT_Fixed linearVertAdvance; + FT_Vector advance; + + FT_Glyph_Format format; + + FT_Bitmap bitmap; + FT_Int bitmap_left; + FT_Int bitmap_top; + + FT_Outline outline; + + FT_UInt num_subglyphs; + FT_SubGlyph subglyphs; + + void *control_data; + long control_len; + + FT_Pos lsb_delta; + FT_Pos rsb_delta; + + void *other; + + FT_Slot_Internal internal; + +} FT_GlyphSlotRec; + + +/*************************************************************************/ +/*************************************************************************/ +/* */ +/* F U N C T I O N S */ +/* */ +/*************************************************************************/ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Init_FreeType */ +/* */ +/* <Description> */ +/* Initialize a new FreeType library object. The set of modules */ +/* that are registered by this function is determined at build time. */ +/* */ +/* <Output> */ +/* alibrary :: A handle to a new library object. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* In case you want to provide your own memory allocating routines, */ +/* use @FT_New_Library instead, followed by a call to */ +/* @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module). */ +/* */ +/* For multi-threading applications each thread should have its own */ +/* FT_Library object. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Init_FreeType( FT_Library +*alibrary ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Done_FreeType */ +/* */ +/* <Description> */ +/* Destroy a given FreeType library object and all of its children, */ +/* including resources, drivers, faces, sizes, etc. */ +/* */ +/* <Input> */ +/* library :: A handle to the target library object. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Done_FreeType( FT_Library +library ); + + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* FT_OPEN_XXX */ +/* */ +/* <Description> */ +/* A list of bit-field constants used within the `flags' field of the */ +/* @FT_Open_Args structure. */ +/* */ +/* <Values> */ +/* FT_OPEN_MEMORY :: This is a memory-based stream. */ +/* */ +/* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */ +/* */ +/* FT_OPEN_PATHNAME :: Create a new input stream from a C~path */ +/* name. */ +/* */ +/* FT_OPEN_DRIVER :: Use the `driver' field. */ +/* */ +/* FT_OPEN_PARAMS :: Use the `num_params' and `params' fields. */ +/* */ +/* ft_open_memory :: Deprecated; use @FT_OPEN_MEMORY instead. */ +/* */ +/* ft_open_stream :: Deprecated; use @FT_OPEN_STREAM instead. */ +/* */ +/* ft_open_pathname :: Deprecated; use @FT_OPEN_PATHNAME instead. */ +/* */ +/* ft_open_driver :: Deprecated; use @FT_OPEN_DRIVER instead. */ +/* */ +/* ft_open_params :: Deprecated; use @FT_OPEN_PARAMS instead. */ +/* */ +/* <Note> */ +/* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */ +/* flags are mutually exclusive. */ +/* */ +#define FT_OPEN_MEMORY 0x1 +#define FT_OPEN_STREAM 0x2 +#define FT_OPEN_PATHNAME 0x4 +#define FT_OPEN_DRIVER 0x8 +#define FT_OPEN_PARAMS 0x10 + +#define ft_open_memory FT_OPEN_MEMORY /* deprecated */ +#define ft_open_stream FT_OPEN_STREAM /* deprecated */ +#define ft_open_pathname FT_OPEN_PATHNAME /* deprecated */ +#define ft_open_driver FT_OPEN_DRIVER /* deprecated */ +#define ft_open_params FT_OPEN_PARAMS /* deprecated */ + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Parameter */ +/* */ +/* <Description> */ +/* A simple structure used to pass more or less generic parameters to */ +/* @FT_Open_Face. */ +/* */ +/* <Fields> */ +/* tag :: A four-byte identification tag. */ +/* */ +/* data :: A pointer to the parameter data. */ +/* */ +/* <Note> */ +/* The ID and function of parameters are driver-specific. See the */ +/* various FT_PARAM_TAG_XXX flags for more information. */ +/* */ +typedef struct FT_Parameter_ { + FT_ULong tag; + FT_Pointer data; + +} FT_Parameter; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Open_Args */ +/* */ +/* <Description> */ +/* A structure used to indicate how to open a new font file or */ +/* stream. A pointer to such a structure can be used as a parameter */ +/* for the functions @FT_Open_Face and @FT_Attach_Stream. */ +/* */ +/* <Fields> */ +/* flags :: A set of bit flags indicating how to use the */ +/* structure. */ +/* */ +/* memory_base :: The first byte of the file in memory. */ +/* */ +/* memory_size :: The size in bytes of the file in memory. */ +/* */ +/* pathname :: A pointer to an 8-bit file pathname. */ +/* */ +/* stream :: A handle to a source stream object. */ +/* */ +/* driver :: This field is exclusively used by @FT_Open_Face; */ +/* it simply specifies the font driver to use to open */ +/* the face. If set to~0, FreeType tries to load the */ +/* face with each one of the drivers in its list. */ +/* */ +/* num_params :: The number of extra parameters. */ +/* */ +/* params :: Extra parameters passed to the font driver when */ +/* opening a new face. */ +/* */ +/* <Note> */ +/* The stream type is determined by the contents of `flags' which */ +/* are tested in the following order by @FT_Open_Face: */ +/* */ +/* If the `FT_OPEN_MEMORY' bit is set, assume that this is a */ +/* memory file of `memory_size' bytes, located at `memory_address'. */ +/* The data are are not copied, and the client is responsible for */ +/* releasing and destroying them _after_ the corresponding call to */ +/* @FT_Done_Face. */ +/* */ +/* Otherwise, if the `FT_OPEN_STREAM' bit is set, assume that a */ +/* custom input stream `stream' is used. */ +/* */ +/* Otherwise, if the `FT_OPEN_PATHNAME' bit is set, assume that this */ +/* is a normal file and use `pathname' to open it. */ +/* */ +/* If the `FT_OPEN_DRIVER' bit is set, @FT_Open_Face only tries to */ +/* open the file with the driver whose handler is in `driver'. */ +/* */ +/* If the `FT_OPEN_PARAMS' bit is set, the parameters given by */ +/* `num_params' and `params' is used. They are ignored otherwise. */ +/* */ +/* Ideally, both the `pathname' and `params' fields should be tagged */ +/* as `const'; this is missing for API backwards compatibility. In */ +/* other words, applications should treat them as read-only. */ +/* */ +typedef struct FT_Open_Args_ { + FT_UInt flags; + const FT_Byte *memory_base; + FT_Long memory_size; + FT_String *pathname; + FT_Stream stream; + FT_Module driver; + FT_Int num_params; + FT_Parameter *params; + +} FT_Open_Args; + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_New_Face */ +/* */ +/* <Description> */ +/* This function calls @FT_Open_Face to open a font by its pathname. */ +/* */ +/* <InOut> */ +/* library :: A handle to the library resource. */ +/* */ +/* <Input> */ +/* pathname :: A path to the font file. */ +/* */ +/* face_index :: The index of the face within the font. The first */ +/* face has index~0. */ +/* */ +/* <Output> */ +/* aface :: A handle to a new face object. If `face_index' is */ +/* greater than or equal to zero, it must be non-NULL. */ +/* See @FT_Open_Face for more details. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) +FT_New_Face( FT_Library +library, +const char *filepathname, + FT_Long +face_index, +FT_Face *aface +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_New_Memory_Face */ +/* */ +/* <Description> */ +/* This function calls @FT_Open_Face to open a font which has been */ +/* loaded into memory. */ +/* */ +/* <InOut> */ +/* library :: A handle to the library resource. */ +/* */ +/* <Input> */ +/* file_base :: A pointer to the beginning of the font data. */ +/* */ +/* file_size :: The size of the memory chunk used by the font data. */ +/* */ +/* face_index :: The index of the face within the font. The first */ +/* face has index~0. */ +/* */ +/* <Output> */ +/* aface :: A handle to a new face object. If `face_index' is */ +/* greater than or equal to zero, it must be non-NULL. */ +/* See @FT_Open_Face for more details. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* You must not deallocate the memory before calling @FT_Done_Face. */ +/* */ +FT_EXPORT( FT_Error ) +FT_New_Memory_Face( FT_Library +library, +const FT_Byte *file_base, + FT_Long +file_size, +FT_Long face_index, + FT_Face +*aface ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Open_Face */ +/* */ +/* <Description> */ +/* Create a face object from a given resource described by */ +/* @FT_Open_Args. */ +/* */ +/* <InOut> */ +/* library :: A handle to the library resource. */ +/* */ +/* <Input> */ +/* args :: A pointer to an `FT_Open_Args' structure which must */ +/* be filled by the caller. */ +/* */ +/* face_index :: The index of the face within the font. The first */ +/* face has index~0. */ +/* */ +/* <Output> */ +/* aface :: A handle to a new face object. If `face_index' is */ +/* greater than or equal to zero, it must be non-NULL. */ +/* See note below. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* Unlike FreeType 1.x, this function automatically creates a glyph */ +/* slot for the face object which can be accessed directly through */ +/* `face->glyph'. */ +/* */ +/* FT_Open_Face can be used to quickly check whether the font */ +/* format of a given font resource is supported by FreeType. If the */ +/* `face_index' field is negative, the function's return value is~0 */ +/* if the font format is recognized, or non-zero otherwise; */ +/* the function returns a more or less empty face handle in `*aface' */ +/* (if `aface' isn't NULL). The only useful field in this special */ +/* case is `face->num_faces' which gives the number of faces within */ +/* the font file. After examination, the returned @FT_Face structure */ +/* should be deallocated with a call to @FT_Done_Face. */ +/* */ +/* Each new face object created with this function also owns a */ +/* default @FT_Size object, accessible as `face->size'. */ +/* */ +/* One @FT_Library instance can have multiple face objects, this is, */ +/* @FT_Open_Face and its siblings can be called multiple times using */ +/* the same `library' argument. */ +/* */ +/* See the discussion of reference counters in the description of */ +/* @FT_Reference_Face. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Open_Face( FT_Library +library, +const FT_Open_Args *args, + FT_Long +face_index, +FT_Face *aface +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Attach_File */ +/* */ +/* <Description> */ +/* This function calls @FT_Attach_Stream to attach a file. */ +/* */ +/* <InOut> */ +/* face :: The target face object. */ +/* */ +/* <Input> */ +/* filepathname :: The pathname. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Attach_File( FT_Face +face, +const char *filepathname +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Attach_Stream */ +/* */ +/* <Description> */ +/* `Attach' data to a face object. Normally, this is used to read */ +/* additional information for the face object. For example, you can */ +/* attach an AFM file that comes with a Type~1 font to get the */ +/* kerning values and other metrics. */ +/* */ +/* <InOut> */ +/* face :: The target face object. */ +/* */ +/* <Input> */ +/* parameters :: A pointer to @FT_Open_Args which must be filled by */ +/* the caller. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* The meaning of the `attach' (i.e., what really happens when the */ +/* new file is read) is not fixed by FreeType itself. It really */ +/* depends on the font format (and thus the font driver). */ +/* */ +/* Client applications are expected to know what they are doing */ +/* when invoking this function. Most drivers simply do not implement */ +/* file attachments. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Attach_Stream( FT_Face +face, +FT_Open_Args *parameters +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Reference_Face */ +/* */ +/* <Description> */ +/* A counter gets initialized to~1 at the time an @FT_Face structure */ +/* is created. This function increments the counter. @FT_Done_Face */ +/* then only destroys a face if the counter is~1, otherwise it simply */ +/* decrements the counter. */ +/* */ +/* This function helps in managing life-cycles of structures which */ +/* reference @FT_Face objects. */ +/* */ +/* <Input> */ +/* face :: A handle to a target face object. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Since> */ +/* 2.4.2 */ +/* */ +FT_EXPORT( FT_Error ) +FT_Reference_Face( FT_Face +face ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Done_Face */ +/* */ +/* <Description> */ +/* Discard a given face object, as well as all of its child slots and */ +/* sizes. */ +/* */ +/* <Input> */ +/* face :: A handle to a target face object. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* See the discussion of reference counters in the description of */ +/* @FT_Reference_Face. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Done_Face( FT_Face +face ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Select_Size */ +/* */ +/* <Description> */ +/* Select a bitmap strike. */ +/* */ +/* <InOut> */ +/* face :: A handle to a target face object. */ +/* */ +/* <Input> */ +/* strike_index :: The index of the bitmap strike in the */ +/* `available_sizes' field of @FT_FaceRec structure. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Select_Size( FT_Face +face, +FT_Int strike_index +); + + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* FT_Size_Request_Type */ +/* */ +/* <Description> */ +/* An enumeration type that lists the supported size request types. */ +/* */ +/* <Values> */ +/* FT_SIZE_REQUEST_TYPE_NOMINAL :: */ +/* The nominal size. The `units_per_EM' field of @FT_FaceRec is */ +/* used to determine both scaling values. */ +/* */ +/* FT_SIZE_REQUEST_TYPE_REAL_DIM :: */ +/* The real dimension. The sum of the the `ascender' and (minus */ +/* of) the `descender' fields of @FT_FaceRec are used to determine */ +/* both scaling values. */ +/* */ +/* FT_SIZE_REQUEST_TYPE_BBOX :: */ +/* The font bounding box. The width and height of the `bbox' field */ +/* of @FT_FaceRec are used to determine the horizontal and vertical */ +/* scaling value, respectively. */ +/* */ +/* FT_SIZE_REQUEST_TYPE_CELL :: */ +/* The `max_advance_width' field of @FT_FaceRec is used to */ +/* determine the horizontal scaling value; the vertical scaling */ +/* value is determined the same way as */ +/* @FT_SIZE_REQUEST_TYPE_REAL_DIM does. Finally, both scaling */ +/* values are set to the smaller one. This type is useful if you */ +/* want to specify the font size for, say, a window of a given */ +/* dimension and 80x24 cells. */ +/* */ +/* FT_SIZE_REQUEST_TYPE_SCALES :: */ +/* Specify the scaling values directly. */ +/* */ +/* <Note> */ +/* The above descriptions only apply to scalable formats. For bitmap */ +/* formats, the behaviour is up to the driver. */ +/* */ +/* See the note section of @FT_Size_Metrics if you wonder how size */ +/* requesting relates to scaling values. */ +/* */ +typedef enum FT_Size_Request_Type_ { + FT_SIZE_REQUEST_TYPE_NOMINAL, + FT_SIZE_REQUEST_TYPE_REAL_DIM, + FT_SIZE_REQUEST_TYPE_BBOX, + FT_SIZE_REQUEST_TYPE_CELL, + FT_SIZE_REQUEST_TYPE_SCALES, + + FT_SIZE_REQUEST_TYPE_MAX + +} FT_Size_Request_Type; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Size_RequestRec */ +/* */ +/* <Description> */ +/* A structure used to model a size request. */ +/* */ +/* <Fields> */ +/* type :: See @FT_Size_Request_Type. */ +/* */ +/* width :: The desired width. */ +/* */ +/* height :: The desired height. */ +/* */ +/* horiResolution :: The horizontal resolution. If set to zero, */ +/* `width' is treated as a 26.6 fractional pixel */ +/* value. */ +/* */ +/* vertResolution :: The vertical resolution. If set to zero, */ +/* `height' is treated as a 26.6 fractional pixel */ +/* value. */ +/* */ +/* <Note> */ +/* If `width' is zero, then the horizontal scaling value is set equal */ +/* to the vertical scaling value, and vice versa. */ +/* */ +typedef struct FT_Size_RequestRec_ { + FT_Size_Request_Type type; + FT_Long width; + FT_Long height; + FT_UInt horiResolution; + FT_UInt vertResolution; + +} FT_Size_RequestRec; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Size_Request */ +/* */ +/* <Description> */ +/* A handle to a size request structure. */ +/* */ +typedef struct FT_Size_RequestRec_ *FT_Size_Request; + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Request_Size */ +/* */ +/* <Description> */ +/* Resize the scale of the active @FT_Size object in a face. */ +/* */ +/* <InOut> */ +/* face :: A handle to a target face object. */ +/* */ +/* <Input> */ +/* req :: A pointer to a @FT_Size_RequestRec. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* Although drivers may select the bitmap strike matching the */ +/* request, you should not rely on this if you intend to select a */ +/* particular bitmap strike. Use @FT_Select_Size instead in that */ +/* case. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Request_Size( FT_Face +face, +FT_Size_Request req +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Set_Char_Size */ +/* */ +/* <Description> */ +/* This function calls @FT_Request_Size to request the nominal size */ +/* (in points). */ +/* */ +/* <InOut> */ +/* face :: A handle to a target face object. */ +/* */ +/* <Input> */ +/* char_width :: The nominal width, in 26.6 fractional points. */ +/* */ +/* char_height :: The nominal height, in 26.6 fractional points. */ +/* */ +/* horz_resolution :: The horizontal resolution in dpi. */ +/* */ +/* vert_resolution :: The vertical resolution in dpi. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* If either the character width or height is zero, it is set equal */ +/* to the other value. */ +/* */ +/* If either the horizontal or vertical resolution is zero, it is set */ +/* equal to the other value. */ +/* */ +/* A character width or height smaller than 1pt is set to 1pt; if */ +/* both resolution values are zero, they are set to 72dpi. */ +/* */ +/* Don't use this function if you are using the FreeType cache API. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Set_Char_Size( FT_Face +face, +FT_F26Dot6 char_width, + FT_F26Dot6 +char_height, +FT_UInt horz_resolution, + FT_UInt +vert_resolution ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Set_Pixel_Sizes */ +/* */ +/* <Description> */ +/* This function calls @FT_Request_Size to request the nominal size */ +/* (in pixels). */ +/* */ +/* <InOut> */ +/* face :: A handle to the target face object. */ +/* */ +/* <Input> */ +/* pixel_width :: The nominal width, in pixels. */ +/* */ +/* pixel_height :: The nominal height, in pixels. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Set_Pixel_Sizes( FT_Face +face, +FT_UInt pixel_width, + FT_UInt +pixel_height ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Load_Glyph */ +/* */ +/* <Description> */ +/* A function used to load a single glyph into the glyph slot of a */ +/* face object. */ +/* */ +/* <InOut> */ +/* face :: A handle to the target face object where the glyph */ +/* is loaded. */ +/* */ +/* <Input> */ +/* glyph_index :: The index of the glyph in the font file. For */ +/* CID-keyed fonts (either in PS or in CFF format) */ +/* this argument specifies the CID value. */ +/* */ +/* load_flags :: A flag indicating what to load for this glyph. The */ +/* @FT_LOAD_XXX constants can be used to control the */ +/* glyph loading process (e.g., whether the outline */ +/* should be scaled, whether to load bitmaps or not, */ +/* whether to hint the outline, etc). */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* The loaded glyph may be transformed. See @FT_Set_Transform for */ +/* the details. */ +/* */ +/* For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is */ +/* returned for invalid CID values (this is, for CID values which */ +/* don't have a corresponding glyph in the font). See the discussion */ +/* of the @FT_FACE_FLAG_CID_KEYED flag for more details. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Load_Glyph( FT_Face +face, +FT_UInt glyph_index, + FT_Int32 +load_flags ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Load_Char */ +/* */ +/* <Description> */ +/* A function used to load a single glyph into the glyph slot of a */ +/* face object, according to its character code. */ +/* */ +/* <InOut> */ +/* face :: A handle to a target face object where the glyph */ +/* is loaded. */ +/* */ +/* <Input> */ +/* char_code :: The glyph's character code, according to the */ +/* current charmap used in the face. */ +/* */ +/* load_flags :: A flag indicating what to load for this glyph. The */ +/* @FT_LOAD_XXX constants can be used to control the */ +/* glyph loading process (e.g., whether the outline */ +/* should be scaled, whether to load bitmaps or not, */ +/* whether to hint the outline, etc). */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Load_Char( FT_Face +face, +FT_ULong char_code, + FT_Int32 +load_flags ); + + +/************************************************************************* + * + * @enum: + * FT_LOAD_XXX + * + * @description: + * A list of bit-field constants used with @FT_Load_Glyph to indicate + * what kind of operations to perform during glyph loading. + * + * @values: + * FT_LOAD_DEFAULT :: + * Corresponding to~0, this value is used as the default glyph load + * operation. In this case, the following happens: + * + * 1. FreeType looks for a bitmap for the glyph corresponding to the + * face's current size. If one is found, the function returns. + * The bitmap data can be accessed from the glyph slot (see note + * below). + * + * 2. If no embedded bitmap is searched or found, FreeType looks for a + * scalable outline. If one is found, it is loaded from the font + * file, scaled to device pixels, then `hinted' to the pixel grid + * in order to optimize it. The outline data can be accessed from + * the glyph slot (see note below). + * + * Note that by default, the glyph loader doesn't render outlines into + * bitmaps. The following flags are used to modify this default + * behaviour to more specific and useful cases. + * + * FT_LOAD_NO_SCALE :: + * Don't scale the outline glyph loaded, but keep it in font units. + * + * This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and + * unsets @FT_LOAD_RENDER. + * + * FT_LOAD_NO_HINTING :: + * Disable hinting. This generally generates `blurrier' bitmap glyph + * when the glyph is rendered in any of the anti-aliased modes. See + * also the note below. + * + * This flag is implied by @FT_LOAD_NO_SCALE. + * + * FT_LOAD_RENDER :: + * Call @FT_Render_Glyph after the glyph is loaded. By default, the + * glyph is rendered in @FT_RENDER_MODE_NORMAL mode. This can be + * overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME. + * + * This flag is unset by @FT_LOAD_NO_SCALE. + * + * FT_LOAD_NO_BITMAP :: + * Ignore bitmap strikes when loading. Bitmap-only fonts ignore this + * flag. + * + * @FT_LOAD_NO_SCALE always sets this flag. + * + * FT_LOAD_VERTICAL_LAYOUT :: + * Load the glyph for vertical text layout. _Don't_ use it as it is + * problematic currently. + * + * FT_LOAD_FORCE_AUTOHINT :: + * Indicates that the auto-hinter is preferred over the font's native + * hinter. See also the note below. + * + * FT_LOAD_CROP_BITMAP :: + * Indicates that the font driver should crop the loaded bitmap glyph + * (i.e., remove all space around its black bits). Not all drivers + * implement this. + * + * FT_LOAD_PEDANTIC :: + * Indicates that the font driver should perform pedantic verifications + * during glyph loading. This is mostly used to detect broken glyphs + * in fonts. By default, FreeType tries to handle broken fonts also. + * + * In particular, errors from the TrueType bytecode engine are not + * passed to the application if this flag is not set; this might + * result in partially hinted or distorted glyphs in case a glyph's + * bytecode is buggy. + * + * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH :: + * Ignored. Deprecated. + * + * FT_LOAD_NO_RECURSE :: + * This flag is only used internally. It merely indicates that the + * font driver should not load composite glyphs recursively. Instead, + * it should set the `num_subglyph' and `subglyphs' values of the + * glyph slot accordingly, and set `glyph->format' to + * @FT_GLYPH_FORMAT_COMPOSITE. + * + * The description of sub-glyphs is not available to client + * applications for now. + * + * This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM. + * + * FT_LOAD_IGNORE_TRANSFORM :: + * Indicates that the transform matrix set by @FT_Set_Transform should + * be ignored. + * + * FT_LOAD_MONOCHROME :: + * This flag is used with @FT_LOAD_RENDER to indicate that you want to + * render an outline glyph to a 1-bit monochrome bitmap glyph, with + * 8~pixels packed into each byte of the bitmap data. + * + * Note that this has no effect on the hinting algorithm used. You + * should rather use @FT_LOAD_TARGET_MONO so that the + * monochrome-optimized hinting algorithm is used. + * + * FT_LOAD_LINEAR_DESIGN :: + * Indicates that the `linearHoriAdvance' and `linearVertAdvance' + * fields of @FT_GlyphSlotRec should be kept in font units. See + * @FT_GlyphSlotRec for details. + * + * FT_LOAD_NO_AUTOHINT :: + * Disable auto-hinter. See also the note below. + * + * @note: + * By default, hinting is enabled and the font's native hinter (see + * @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can + * disable hinting by setting @FT_LOAD_NO_HINTING or change the + * precedence by setting @FT_LOAD_FORCE_AUTOHINT. You can also set + * @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be + * used at all. + * + * See the description of @FT_FACE_FLAG_TRICKY for a special exception + * (affecting only a handful of Asian fonts). + * + * Besides deciding which hinter to use, you can also decide which + * hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details. + * + * Note that the auto-hinter needs a valid Unicode cmap (either a native + * one or synthesized by FreeType) for producing correct results. If a + * font provides an incorrect mapping (for example, assigning the + * character code U+005A, LATIN CAPITAL LETTER Z, to a glyph depicting a + * mathematical integral sign), the auto-hinter might produce useless + * results. + * + */ +#define FT_LOAD_DEFAULT 0x0 +#define FT_LOAD_NO_SCALE ( 1L << 0 ) +#define FT_LOAD_NO_HINTING ( 1L << 1 ) +#define FT_LOAD_RENDER ( 1L << 2 ) +#define FT_LOAD_NO_BITMAP ( 1L << 3 ) +#define FT_LOAD_VERTICAL_LAYOUT ( 1L << 4 ) +#define FT_LOAD_FORCE_AUTOHINT ( 1L << 5 ) +#define FT_LOAD_CROP_BITMAP ( 1L << 6 ) +#define FT_LOAD_PEDANTIC ( 1L << 7 ) +#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ( 1L << 9 ) +#define FT_LOAD_NO_RECURSE ( 1L << 10 ) +#define FT_LOAD_IGNORE_TRANSFORM ( 1L << 11 ) +#define FT_LOAD_MONOCHROME ( 1L << 12 ) +#define FT_LOAD_LINEAR_DESIGN ( 1L << 13 ) +#define FT_LOAD_NO_AUTOHINT ( 1L << 15 ) + +/* */ + +/* used internally only by certain font drivers! */ +#define FT_LOAD_ADVANCE_ONLY ( 1L << 8 ) +#define FT_LOAD_SBITS_ONLY ( 1L << 14 ) + + +/************************************************************************** + * + * @enum: + * FT_LOAD_TARGET_XXX + * + * @description: + * A list of values that are used to select a specific hinting algorithm + * to use by the hinter. You should OR one of these values to your + * `load_flags' when calling @FT_Load_Glyph. + * + * Note that font's native hinters may ignore the hinting algorithm you + * have specified (e.g., the TrueType bytecode interpreter). You can set + * @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is used. + * + * Also note that @FT_LOAD_TARGET_LIGHT is an exception, in that it + * always implies @FT_LOAD_FORCE_AUTOHINT. + * + * @values: + * FT_LOAD_TARGET_NORMAL :: + * This corresponds to the default hinting algorithm, optimized for + * standard gray-level rendering. For monochrome output, use + * @FT_LOAD_TARGET_MONO instead. + * + * FT_LOAD_TARGET_LIGHT :: + * A lighter hinting algorithm for non-monochrome modes. Many + * generated glyphs are more fuzzy but better resemble its original + * shape. A bit like rendering on Mac OS~X. + * + * As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT. + * + * FT_LOAD_TARGET_MONO :: + * Strong hinting algorithm that should only be used for monochrome + * output. The result is probably unpleasant if the glyph is rendered + * in non-monochrome modes. + * + * FT_LOAD_TARGET_LCD :: + * A variant of @FT_LOAD_TARGET_NORMAL optimized for horizontally + * decimated LCD displays. + * + * FT_LOAD_TARGET_LCD_V :: + * A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically + * decimated LCD displays. + * + * @note: + * You should use only _one_ of the FT_LOAD_TARGET_XXX values in your + * `load_flags'. They can't be ORed. + * + * If @FT_LOAD_RENDER is also set, the glyph is rendered in the + * corresponding mode (i.e., the mode which matches the used algorithm + * best). An exeption is FT_LOAD_TARGET_MONO since it implies + * @FT_LOAD_MONOCHROME. + * + * You can use a hinting algorithm that doesn't correspond to the same + * rendering mode. As an example, it is possible to use the `light' + * hinting algorithm and have the results rendered in horizontal LCD + * pixel mode, with code like + * + * { + * FT_Load_Glyph( face, glyph_index, + * load_flags | FT_LOAD_TARGET_LIGHT ); + * + * FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD ); + * } + * + */ +#define FT_LOAD_TARGET_(x) ( (FT_Int32)( (x) & 15 ) << 16 ) + +#define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL ) +#define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT ) +#define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO ) +#define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD ) +#define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V ) + + +/************************************************************************** + * + * @macro: + * FT_LOAD_TARGET_MODE + * + * @description: + * Return the @FT_Render_Mode corresponding to a given + * @FT_LOAD_TARGET_XXX value. + * + */ +#define FT_LOAD_TARGET_MODE(x) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) ) + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Set_Transform */ +/* */ +/* <Description> */ +/* A function used to set the transformation that is applied to glyph */ +/* images when they are loaded into a glyph slot through */ +/* @FT_Load_Glyph. */ +/* */ +/* <InOut> */ +/* face :: A handle to the source face object. */ +/* */ +/* <Input> */ +/* matrix :: A pointer to the transformation's 2x2 matrix. Use~0 for */ +/* the identity matrix. */ +/* delta :: A pointer to the translation vector. Use~0 for the null */ +/* vector. */ +/* */ +/* <Note> */ +/* The transformation is only applied to scalable image formats after */ +/* the glyph has been loaded. It means that hinting is unaltered by */ +/* the transformation and is performed on the character size given in */ +/* the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. */ +/* */ +/* Note that this also transforms the `face.glyph.advance' field, but */ +/* *not* the values in `face.glyph.metrics'. */ +/* */ +FT_EXPORT(void) + +FT_Set_Transform( FT_Face +face, +FT_Matrix *matrix, + FT_Vector +* delta ); + + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* FT_Render_Mode */ +/* */ +/* <Description> */ +/* An enumeration type that lists the render modes supported by */ +/* FreeType~2. Each mode corresponds to a specific type of scanline */ +/* conversion performed on the outline. */ +/* */ +/* For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode' */ +/* field in the @FT_GlyphSlotRec structure gives the format of the */ +/* returned bitmap. */ +/* */ +/* All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity. */ +/* */ +/* <Values> */ +/* FT_RENDER_MODE_NORMAL :: */ +/* This is the default render mode; it corresponds to 8-bit */ +/* anti-aliased bitmaps. */ +/* */ +/* FT_RENDER_MODE_LIGHT :: */ +/* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only */ +/* defined as a separate value because render modes are also used */ +/* indirectly to define hinting algorithm selectors. See */ +/* @FT_LOAD_TARGET_XXX for details. */ +/* */ +/* FT_RENDER_MODE_MONO :: */ +/* This mode corresponds to 1-bit bitmaps (with 2~levels of */ +/* opacity). */ +/* */ +/* FT_RENDER_MODE_LCD :: */ +/* This mode corresponds to horizontal RGB and BGR sub-pixel */ +/* displays like LCD screens. It produces 8-bit bitmaps that are */ +/* 3~times the width of the original glyph outline in pixels, and */ +/* which use the @FT_PIXEL_MODE_LCD mode. */ +/* */ +/* FT_RENDER_MODE_LCD_V :: */ +/* This mode corresponds to vertical RGB and BGR sub-pixel displays */ +/* (like PDA screens, rotated LCD displays, etc.). It produces */ +/* 8-bit bitmaps that are 3~times the height of the original */ +/* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */ +/* */ +/* <Note> */ +/* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph can be */ +/* filtered to reduce color-fringes by using @FT_Library_SetLcdFilter */ +/* (not active in the default builds). It is up to the caller to */ +/* either call @FT_Library_SetLcdFilter (if available) or do the */ +/* filtering itself. */ +/* */ +/* The selected render mode only affects vector glyphs of a font. */ +/* Embedded bitmaps often have a different pixel mode like */ +/* @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform */ +/* them into 8-bit pixmaps. */ +/* */ +typedef enum FT_Render_Mode_ { + FT_RENDER_MODE_NORMAL = 0, + FT_RENDER_MODE_LIGHT, + FT_RENDER_MODE_MONO, + FT_RENDER_MODE_LCD, + FT_RENDER_MODE_LCD_V, + + FT_RENDER_MODE_MAX + +} FT_Render_Mode; + + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* ft_render_mode_xxx */ +/* */ +/* <Description> */ +/* These constants are deprecated. Use the corresponding */ +/* @FT_Render_Mode values instead. */ +/* */ +/* <Values> */ +/* ft_render_mode_normal :: see @FT_RENDER_MODE_NORMAL */ +/* ft_render_mode_mono :: see @FT_RENDER_MODE_MONO */ +/* */ +#define ft_render_mode_normal FT_RENDER_MODE_NORMAL +#define ft_render_mode_mono FT_RENDER_MODE_MONO + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Render_Glyph */ +/* */ +/* <Description> */ +/* Convert a given glyph image to a bitmap. It does so by inspecting */ +/* the glyph image format, finding the relevant renderer, and */ +/* invoking it. */ +/* */ +/* <InOut> */ +/* slot :: A handle to the glyph slot containing the image to */ +/* convert. */ +/* */ +/* <Input> */ +/* render_mode :: This is the render mode used to render the glyph */ +/* image into a bitmap. See @FT_Render_Mode for a */ +/* list of possible values. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Render_Glyph( FT_GlyphSlot +slot, +FT_Render_Mode render_mode +); + + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* FT_Kerning_Mode */ +/* */ +/* <Description> */ +/* An enumeration used to specify which kerning values to return in */ +/* @FT_Get_Kerning. */ +/* */ +/* <Values> */ +/* FT_KERNING_DEFAULT :: Return scaled and grid-fitted kerning */ +/* distances (value is~0). */ +/* */ +/* FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning */ +/* distances. */ +/* */ +/* FT_KERNING_UNSCALED :: Return the kerning vector in original font */ +/* units. */ +/* */ +typedef enum FT_Kerning_Mode_ { + FT_KERNING_DEFAULT = 0, + FT_KERNING_UNFITTED, + FT_KERNING_UNSCALED + +} FT_Kerning_Mode; + + +/*************************************************************************/ +/* */ +/* <Const> */ +/* ft_kerning_default */ +/* */ +/* <Description> */ +/* This constant is deprecated. Please use @FT_KERNING_DEFAULT */ +/* instead. */ +/* */ +#define ft_kerning_default FT_KERNING_DEFAULT + + +/*************************************************************************/ +/* */ +/* <Const> */ +/* ft_kerning_unfitted */ +/* */ +/* <Description> */ +/* This constant is deprecated. Please use @FT_KERNING_UNFITTED */ +/* instead. */ +/* */ +#define ft_kerning_unfitted FT_KERNING_UNFITTED + + +/*************************************************************************/ +/* */ +/* <Const> */ +/* ft_kerning_unscaled */ +/* */ +/* <Description> */ +/* This constant is deprecated. Please use @FT_KERNING_UNSCALED */ +/* instead. */ +/* */ +#define ft_kerning_unscaled FT_KERNING_UNSCALED + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_Kerning */ +/* */ +/* <Description> */ +/* Return the kerning vector between two glyphs of a same face. */ +/* */ +/* <Input> */ +/* face :: A handle to a source face object. */ +/* */ +/* left_glyph :: The index of the left glyph in the kern pair. */ +/* */ +/* right_glyph :: The index of the right glyph in the kern pair. */ +/* */ +/* kern_mode :: See @FT_Kerning_Mode for more information. */ +/* Determines the scale and dimension of the returned */ +/* kerning vector. */ +/* */ +/* <Output> */ +/* akerning :: The kerning vector. This is either in font units */ +/* or in pixels (26.6 format) for scalable formats, */ +/* and in pixels for fixed-sizes formats. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* Only horizontal layouts (left-to-right & right-to-left) are */ +/* supported by this method. Other layouts, or more sophisticated */ +/* kernings, are out of the scope of this API function -- they can be */ +/* implemented through format-specific interfaces. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Get_Kerning( FT_Face +face, +FT_UInt left_glyph, + FT_UInt +right_glyph, +FT_UInt kern_mode, + FT_Vector +*akerning ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_Track_Kerning */ +/* */ +/* <Description> */ +/* Return the track kerning for a given face object at a given size. */ +/* */ +/* <Input> */ +/* face :: A handle to a source face object. */ +/* */ +/* point_size :: The point size in 16.16 fractional points. */ +/* */ +/* degree :: The degree of tightness. Increasingly negative */ +/* values represent tighter track kerning, while */ +/* increasingly positive values represent looser track */ +/* kerning. Value zero means no track kerning. */ +/* */ +/* <Output> */ +/* akerning :: The kerning in 16.16 fractional points, to be */ +/* uniformly applied between all glyphs. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* Currently, only the Type~1 font driver supports track kerning, */ +/* using data from AFM files (if attached with @FT_Attach_File or */ +/* @FT_Attach_Stream). */ +/* */ +/* Only very few AFM files come with track kerning data; please refer */ +/* to the Adobe's AFM specification for more details. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Get_Track_Kerning( FT_Face +face, +FT_Fixed point_size, + FT_Int +degree, +FT_Fixed *akerning +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_Glyph_Name */ +/* */ +/* <Description> */ +/* Retrieve the ASCII name of a given glyph in a face. This only */ +/* works for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1. */ +/* */ +/* <Input> */ +/* face :: A handle to a source face object. */ +/* */ +/* glyph_index :: The glyph index. */ +/* */ +/* buffer_max :: The maximum number of bytes available in the */ +/* buffer. */ +/* */ +/* <Output> */ +/* buffer :: A pointer to a target buffer where the name is */ +/* copied to. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* An error is returned if the face doesn't provide glyph names or if */ +/* the glyph index is invalid. In all cases of failure, the first */ +/* byte of `buffer' is set to~0 to indicate an empty name. */ +/* */ +/* The glyph name is truncated to fit within the buffer if it is too */ +/* long. The returned string is always zero-terminated. */ +/* */ +/* Be aware that FreeType reorders glyph indices internally so that */ +/* glyph index~0 always corresponds to the `missing glyph' (called */ +/* `.notdef'). */ +/* */ +/* This function is not compiled within the library if the config */ +/* macro `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is defined in */ +/* `include/freetype/config/ftoptions.h'. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Get_Glyph_Name( FT_Face +face, +FT_UInt glyph_index, + FT_Pointer +buffer, +FT_UInt buffer_max +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_Postscript_Name */ +/* */ +/* <Description> */ +/* Retrieve the ASCII PostScript name of a given face, if available. */ +/* This only works with PostScript and TrueType fonts. */ +/* */ +/* <Input> */ +/* face :: A handle to the source face object. */ +/* */ +/* <Return> */ +/* A pointer to the face's PostScript name. NULL if unavailable. */ +/* */ +/* <Note> */ +/* The returned pointer is owned by the face and is destroyed with */ +/* it. */ +/* */ +FT_EXPORT(const char *) + +FT_Get_Postscript_Name( FT_Face +face ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Select_Charmap */ +/* */ +/* <Description> */ +/* Select a given charmap by its encoding tag (as listed in */ +/* `freetype.h'). */ +/* */ +/* <InOut> */ +/* face :: A handle to the source face object. */ +/* */ +/* <Input> */ +/* encoding :: A handle to the selected encoding. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* This function returns an error if no charmap in the face */ +/* corresponds to the encoding queried here. */ +/* */ +/* Because many fonts contain more than a single cmap for Unicode */ +/* encoding, this function has some special code to select the one */ +/* which covers Unicode best (`best' in the sense that a UCS-4 cmap */ +/* is preferred to a UCS-2 cmap). It is thus preferable to */ +/* @FT_Set_Charmap in this case. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Select_Charmap( FT_Face +face, +FT_Encoding encoding +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Set_Charmap */ +/* */ +/* <Description> */ +/* Select a given charmap for character code to glyph index mapping. */ +/* */ +/* <InOut> */ +/* face :: A handle to the source face object. */ +/* */ +/* <Input> */ +/* charmap :: A handle to the selected charmap. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* This function returns an error if the charmap is not part of */ +/* the face (i.e., if it is not listed in the `face->charmaps' */ +/* table). */ +/* */ +/* It also fails if a type~14 charmap is selected. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Set_Charmap( FT_Face +face, +FT_CharMap charmap +); + + +/************************************************************************* + * + * @function: + * FT_Get_Charmap_Index + * + * @description: + * Retrieve index of a given charmap. + * + * @input: + * charmap :: + * A handle to a charmap. + * + * @return: + * The index into the array of character maps within the face to which + * `charmap' belongs. If an error occurs, -1 is returned. + * + */ +FT_EXPORT( FT_Int ) +FT_Get_Charmap_Index( FT_CharMap +charmap ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_Char_Index */ +/* */ +/* <Description> */ +/* Return the glyph index of a given character code. This function */ +/* uses a charmap object to do the mapping. */ +/* */ +/* <Input> */ +/* face :: A handle to the source face object. */ +/* */ +/* charcode :: The character code. */ +/* */ +/* <Return> */ +/* The glyph index. 0~means `undefined character code'. */ +/* */ +/* <Note> */ +/* If you use FreeType to manipulate the contents of font files */ +/* directly, be aware that the glyph index returned by this function */ +/* doesn't always correspond to the internal indices used within the */ +/* file. This is done to ensure that value~0 always corresponds to */ +/* the `missing glyph'. If the first glyph is not named `.notdef', */ +/* then for Type~1 and Type~42 fonts, `.notdef' will be moved into */ +/* the glyph ID~0 position, and whatever was there will be moved to */ +/* the position `.notdef' had. For Type~1 fonts, if there is no */ +/* `.notdef' glyph at all, then one will be created at index~0 and */ +/* whatever was there will be moved to the last index -- Type~42 */ +/* fonts are considered invalid under this condition. */ +/* */ +FT_EXPORT( FT_UInt ) +FT_Get_Char_Index( FT_Face +face, +FT_ULong charcode +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_First_Char */ +/* */ +/* <Description> */ +/* This function is used to return the first character code in the */ +/* current charmap of a given face. It also returns the */ +/* corresponding glyph index. */ +/* */ +/* <Input> */ +/* face :: A handle to the source face object. */ +/* */ +/* <Output> */ +/* agindex :: Glyph index of first character code. 0~if charmap is */ +/* empty. */ +/* */ +/* <Return> */ +/* The charmap's first character code. */ +/* */ +/* <Note> */ +/* You should use this function with @FT_Get_Next_Char to be able to */ +/* parse all character codes available in a given charmap. The code */ +/* should look like this: */ +/* */ +/* { */ +/* FT_ULong charcode; */ +/* FT_UInt gindex; */ +/* */ +/* */ +/* charcode = FT_Get_First_Char( face, &gindex ); */ +/* while ( gindex != 0 ) */ +/* { */ +/* ... do something with (charcode,gindex) pair ... */ +/* */ +/* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */ +/* } */ +/* } */ +/* */ +/* Note that `*agindex' is set to~0 if the charmap is empty. The */ +/* result itself can be~0 in two cases: if the charmap is empty or */ +/* if the value~0 is the first valid character code. */ +/* */ +FT_EXPORT( FT_ULong ) +FT_Get_First_Char( FT_Face +face, +FT_UInt *agindex +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_Next_Char */ +/* */ +/* <Description> */ +/* This function is used to return the next character code in the */ +/* current charmap of a given face following the value `char_code', */ +/* as well as the corresponding glyph index. */ +/* */ +/* <Input> */ +/* face :: A handle to the source face object. */ +/* char_code :: The starting character code. */ +/* */ +/* <Output> */ +/* agindex :: Glyph index of next character code. 0~if charmap */ +/* is empty. */ +/* */ +/* <Return> */ +/* The charmap's next character code. */ +/* */ +/* <Note> */ +/* You should use this function with @FT_Get_First_Char to walk */ +/* over all character codes available in a given charmap. See the */ +/* note for this function for a simple code example. */ +/* */ +/* Note that `*agindex' is set to~0 when there are no more codes in */ +/* the charmap. */ +/* */ +FT_EXPORT( FT_ULong ) +FT_Get_Next_Char( FT_Face +face, +FT_ULong char_code, + FT_UInt +*agindex ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_Name_Index */ +/* */ +/* <Description> */ +/* Return the glyph index of a given glyph name. This function uses */ +/* driver specific objects to do the translation. */ +/* */ +/* <Input> */ +/* face :: A handle to the source face object. */ +/* */ +/* glyph_name :: The glyph name. */ +/* */ +/* <Return> */ +/* The glyph index. 0~means `undefined character code'. */ +/* */ +FT_EXPORT( FT_UInt ) +FT_Get_Name_Index( FT_Face +face, +FT_String *glyph_name +); + + +/************************************************************************* + * + * @macro: + * FT_SUBGLYPH_FLAG_XXX + * + * @description: + * A list of constants used to describe subglyphs. Please refer to the + * TrueType specification for the meaning of the various flags. + * + * @values: + * FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS :: + * FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES :: + * FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID :: + * FT_SUBGLYPH_FLAG_SCALE :: + * FT_SUBGLYPH_FLAG_XY_SCALE :: + * FT_SUBGLYPH_FLAG_2X2 :: + * FT_SUBGLYPH_FLAG_USE_MY_METRICS :: + * + */ +#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1 +#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2 +#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4 +#define FT_SUBGLYPH_FLAG_SCALE 8 +#define FT_SUBGLYPH_FLAG_XY_SCALE 0x40 +#define FT_SUBGLYPH_FLAG_2X2 0x80 +#define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200 + + +/************************************************************************* + * + * @func: + * FT_Get_SubGlyph_Info + * + * @description: + * Retrieve a description of a given subglyph. Only use it if + * `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE; an error is + * returned otherwise. + * + * @input: + * glyph :: + * The source glyph slot. + * + * sub_index :: + * The index of the subglyph. Must be less than + * `glyph->num_subglyphs'. + * + * @output: + * p_index :: + * The glyph index of the subglyph. + * + * p_flags :: + * The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX. + * + * p_arg1 :: + * The subglyph's first argument (if any). + * + * p_arg2 :: + * The subglyph's second argument (if any). + * + * p_transform :: + * The subglyph transformation (if any). + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The values of `*p_arg1', `*p_arg2', and `*p_transform' must be + * interpreted depending on the flags returned in `*p_flags'. See the + * TrueType specification for details. + * + */ +FT_EXPORT( FT_Error ) +FT_Get_SubGlyph_Info( FT_GlyphSlot +glyph, +FT_UInt sub_index, + FT_Int +*p_index, +FT_UInt *p_flags, + FT_Int +*p_arg1, +FT_Int *p_arg2, + FT_Matrix +*p_transform ); + + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* FT_FSTYPE_XXX */ +/* */ +/* <Description> */ +/* A list of bit flags used in the `fsType' field of the OS/2 table */ +/* in a TrueType or OpenType font and the `FSType' entry in a */ +/* PostScript font. These bit flags are returned by */ +/* @FT_Get_FSType_Flags; they inform client applications of embedding */ +/* and subsetting restrictions associated with a font. */ +/* */ +/* See http://www.adobe.com/devnet/acrobat/pdfs/FontPolicies.pdf for */ +/* more details. */ +/* */ +/* <Values> */ +/* FT_FSTYPE_INSTALLABLE_EMBEDDING :: */ +/* Fonts with no fsType bit set may be embedded and permanently */ +/* installed on the remote system by an application. */ +/* */ +/* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING :: */ +/* Fonts that have only this bit set must not be modified, embedded */ +/* or exchanged in any manner without first obtaining permission of */ +/* the font software copyright owner. */ +/* */ +/* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING :: */ +/* If this bit is set, the font may be embedded and temporarily */ +/* loaded on the remote system. Documents containing Preview & */ +/* Print fonts must be opened `read-only'; no edits can be applied */ +/* to the document. */ +/* */ +/* FT_FSTYPE_EDITABLE_EMBEDDING :: */ +/* If this bit is set, the font may be embedded but must only be */ +/* installed temporarily on other systems. In contrast to Preview */ +/* & Print fonts, documents containing editable fonts may be opened */ +/* for reading, editing is permitted, and changes may be saved. */ +/* */ +/* FT_FSTYPE_NO_SUBSETTING :: */ +/* If this bit is set, the font may not be subsetted prior to */ +/* embedding. */ +/* */ +/* FT_FSTYPE_BITMAP_EMBEDDING_ONLY :: */ +/* If this bit is set, only bitmaps contained in the font may be */ +/* embedded; no outline data may be embedded. If there are no */ +/* bitmaps available in the font, then the font is unembeddable. */ +/* */ +/* <Note> */ +/* While the fsType flags can indicate that a font may be embedded, a */ +/* license with the font vendor may be separately required to use the */ +/* font in this way. */ +/* */ +#define FT_FSTYPE_INSTALLABLE_EMBEDDING 0x0000 +#define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING 0x0002 +#define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING 0x0004 +#define FT_FSTYPE_EDITABLE_EMBEDDING 0x0008 +#define FT_FSTYPE_NO_SUBSETTING 0x0100 +#define FT_FSTYPE_BITMAP_EMBEDDING_ONLY 0x0200 + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_FSType_Flags */ +/* */ +/* <Description> */ +/* Return the fsType flags for a font. */ +/* */ +/* <Input> */ +/* face :: A handle to the source face object. */ +/* */ +/* <Return> */ +/* The fsType flags, @FT_FSTYPE_XXX. */ +/* */ +/* <Note> */ +/* Use this function rather than directly reading the `fs_type' field */ +/* in the @PS_FontInfoRec structure which is only guaranteed to */ +/* return the correct results for Type~1 fonts. */ +/* */ +/* <Since> */ +/* 2.3.8 */ +/* */ +FT_EXPORT( FT_UShort ) +FT_Get_FSType_Flags( FT_Face +face ); + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* glyph_variants */ +/* */ +/* <Title> */ +/* Glyph Variants */ +/* */ +/* <Abstract> */ +/* The FreeType~2 interface to Unicode Ideographic Variation */ +/* Sequences (IVS), using the SFNT cmap format~14. */ +/* */ +/* <Description> */ +/* Many CJK characters have variant forms. They are a sort of grey */ +/* area somewhere between being totally irrelevant and semantically */ +/* distinct; for this reason, the Unicode consortium decided to */ +/* introduce Ideographic Variation Sequences (IVS), consisting of a */ +/* Unicode base character and one of 240 variant selectors */ +/* (U+E0100-U+E01EF), instead of further extending the already huge */ +/* code range for CJK characters. */ +/* */ +/* An IVS is registered and unique; for further details please refer */ +/* to Unicode Technical Report #37, the Ideographic Variation */ +/* Database. To date (October 2007), the character with the most */ +/* variants is U+908A, having 8~such IVS. */ +/* */ +/* Adobe and MS decided to support IVS with a new cmap subtable */ +/* (format~14). It is an odd subtable because it is not a mapping of */ +/* input code points to glyphs, but contains lists of all variants */ +/* supported by the font. */ +/* */ +/* A variant may be either `default' or `non-default'. A default */ +/* variant is the one you will get for that code point if you look it */ +/* up in the standard Unicode cmap. A non-default variant is a */ +/* different glyph. */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Face_GetCharVariantIndex */ +/* */ +/* <Description> */ +/* Return the glyph index of a given character code as modified by */ +/* the variation selector. */ +/* */ +/* <Input> */ +/* face :: */ +/* A handle to the source face object. */ +/* */ +/* charcode :: */ +/* The character code point in Unicode. */ +/* */ +/* variantSelector :: */ +/* The Unicode code point of the variation selector. */ +/* */ +/* <Return> */ +/* The glyph index. 0~means either `undefined character code', or */ +/* `undefined selector code', or `no variation selector cmap */ +/* subtable', or `current CharMap is not Unicode'. */ +/* */ +/* <Note> */ +/* If you use FreeType to manipulate the contents of font files */ +/* directly, be aware that the glyph index returned by this function */ +/* doesn't always correspond to the internal indices used within */ +/* the file. This is done to ensure that value~0 always corresponds */ +/* to the `missing glyph'. */ +/* */ +/* This function is only meaningful if */ +/* a) the font has a variation selector cmap sub table, */ +/* and */ +/* b) the current charmap has a Unicode encoding. */ +/* */ +/* <Since> */ +/* 2.3.6 */ +/* */ +FT_EXPORT( FT_UInt ) +FT_Face_GetCharVariantIndex( FT_Face +face, +FT_ULong charcode, + FT_ULong +variantSelector ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Face_GetCharVariantIsDefault */ +/* */ +/* <Description> */ +/* Check whether this variant of this Unicode character is the one to */ +/* be found in the `cmap'. */ +/* */ +/* <Input> */ +/* face :: */ +/* A handle to the source face object. */ +/* */ +/* charcode :: */ +/* The character codepoint in Unicode. */ +/* */ +/* variantSelector :: */ +/* The Unicode codepoint of the variation selector. */ +/* */ +/* <Return> */ +/* 1~if found in the standard (Unicode) cmap, 0~if found in the */ +/* variation selector cmap, or -1 if it is not a variant. */ +/* */ +/* <Note> */ +/* This function is only meaningful if the font has a variation */ +/* selector cmap subtable. */ +/* */ +/* <Since> */ +/* 2.3.6 */ +/* */ +FT_EXPORT( FT_Int ) +FT_Face_GetCharVariantIsDefault( FT_Face +face, +FT_ULong charcode, + FT_ULong +variantSelector ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Face_GetVariantSelectors */ +/* */ +/* <Description> */ +/* Return a zero-terminated list of Unicode variant selectors found */ +/* in the font. */ +/* */ +/* <Input> */ +/* face :: */ +/* A handle to the source face object. */ +/* */ +/* <Return> */ +/* A pointer to an array of selector code points, or NULL if there is */ +/* no valid variant selector cmap subtable. */ +/* */ +/* <Note> */ +/* The last item in the array is~0; the array is owned by the */ +/* @FT_Face object but can be overwritten or released on the next */ +/* call to a FreeType function. */ +/* */ +/* <Since> */ +/* 2.3.6 */ +/* */ +FT_EXPORT( FT_UInt32 +* ) +FT_Face_GetVariantSelectors( FT_Face +face ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Face_GetVariantsOfChar */ +/* */ +/* <Description> */ +/* Return a zero-terminated list of Unicode variant selectors found */ +/* for the specified character code. */ +/* */ +/* <Input> */ +/* face :: */ +/* A handle to the source face object. */ +/* */ +/* charcode :: */ +/* The character codepoint in Unicode. */ +/* */ +/* <Return> */ +/* A pointer to an array of variant selector code points which are */ +/* active for the given character, or NULL if the corresponding list */ +/* is empty. */ +/* */ +/* <Note> */ +/* The last item in the array is~0; the array is owned by the */ +/* @FT_Face object but can be overwritten or released on the next */ +/* call to a FreeType function. */ +/* */ +/* <Since> */ +/* 2.3.6 */ +/* */ +FT_EXPORT( FT_UInt32 +* ) +FT_Face_GetVariantsOfChar( FT_Face +face, +FT_ULong charcode +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Face_GetCharsOfVariant */ +/* */ +/* <Description> */ +/* Return a zero-terminated list of Unicode character codes found for */ +/* the specified variant selector. */ +/* */ +/* <Input> */ +/* face :: */ +/* A handle to the source face object. */ +/* */ +/* variantSelector :: */ +/* The variant selector code point in Unicode. */ +/* */ +/* <Return> */ +/* A list of all the code points which are specified by this selector */ +/* (both default and non-default codes are returned) or NULL if there */ +/* is no valid cmap or the variant selector is invalid. */ +/* */ +/* <Note> */ +/* The last item in the array is~0; the array is owned by the */ +/* @FT_Face object but can be overwritten or released on the next */ +/* call to a FreeType function. */ +/* */ +/* <Since> */ +/* 2.3.6 */ +/* */ +FT_EXPORT( FT_UInt32 +* ) +FT_Face_GetCharsOfVariant( FT_Face +face, +FT_ULong variantSelector +); + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* computations */ +/* */ +/* <Title> */ +/* Computations */ +/* */ +/* <Abstract> */ +/* Crunching fixed numbers and vectors. */ +/* */ +/* <Description> */ +/* This section contains various functions used to perform */ +/* computations on 16.16 fixed-float numbers or 2d vectors. */ +/* */ +/* <Order> */ +/* FT_MulDiv */ +/* FT_MulFix */ +/* FT_DivFix */ +/* FT_RoundFix */ +/* FT_CeilFix */ +/* FT_FloorFix */ +/* FT_Vector_Transform */ +/* FT_Matrix_Multiply */ +/* FT_Matrix_Invert */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_MulDiv */ +/* */ +/* <Description> */ +/* A very simple function used to perform the computation `(a*b)/c' */ +/* with maximum accuracy (it uses a 64-bit intermediate integer */ +/* whenever necessary). */ +/* */ +/* This function isn't necessarily as fast as some processor specific */ +/* operations, but is at least completely portable. */ +/* */ +/* <Input> */ +/* a :: The first multiplier. */ +/* b :: The second multiplier. */ +/* c :: The divisor. */ +/* */ +/* <Return> */ +/* The result of `(a*b)/c'. This function never traps when trying to */ +/* divide by zero; it simply returns `MaxInt' or `MinInt' depending */ +/* on the signs of `a' and `b'. */ +/* */ +FT_EXPORT( FT_Long ) +FT_MulDiv( FT_Long +a, +FT_Long b, + FT_Long +c ); + + +/* */ + +/* The following #if 0 ... #endif is for the documentation formatter, */ +/* hiding the internal `FT_MULFIX_INLINED' macro. */ + +#if 0 + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_MulFix */ + /* */ + /* <Description> */ + /* A very simple function used to perform the computation */ + /* `(a*b)/0x10000' with maximum accuracy. Most of the time this is */ + /* used to multiply a given value by a 16.16 fixed float factor. */ + /* */ + /* <Input> */ + /* a :: The first multiplier. */ + /* b :: The second multiplier. Use a 16.16 factor here whenever */ + /* possible (see note below). */ + /* */ + /* <Return> */ + /* The result of `(a*b)/0x10000'. */ + /* */ + /* <Note> */ + /* This function has been optimized for the case where the absolute */ + /* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */ + /* As this happens mainly when scaling from notional units to */ + /* fractional pixels in FreeType, it resulted in noticeable speed */ + /* improvements between versions 2.x and 1.x. */ + /* */ + /* As a conclusion, always try to place a 16.16 factor as the */ + /* _second_ argument of this function; this can make a great */ + /* difference. */ + /* */ + FT_EXPORT( FT_Long ) + FT_MulFix( FT_Long a, + FT_Long b ); + + /* */ +#endif + +#ifdef FT_MULFIX_INLINED +#define FT_MulFix( a, b ) FT_MULFIX_INLINED( a, b ) +#else +FT_EXPORT( FT_Long ) +FT_MulFix( FT_Long +a, +FT_Long b +); +#endif + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_DivFix */ +/* */ +/* <Description> */ +/* A very simple function used to perform the computation */ +/* `(a*0x10000)/b' with maximum accuracy. Most of the time, this is */ +/* used to divide a given value by a 16.16 fixed float factor. */ +/* */ +/* <Input> */ +/* a :: The first multiplier. */ +/* b :: The second multiplier. Use a 16.16 factor here whenever */ +/* possible (see note below). */ +/* */ +/* <Return> */ +/* The result of `(a*0x10000)/b'. */ +/* */ +/* <Note> */ +/* The optimization for FT_DivFix() is simple: If (a~<<~16) fits in */ +/* 32~bits, then the division is computed directly. Otherwise, we */ +/* use a specialized version of @FT_MulDiv. */ +/* */ +FT_EXPORT( FT_Long ) +FT_DivFix( FT_Long +a, +FT_Long b +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_RoundFix */ +/* */ +/* <Description> */ +/* A very simple function used to round a 16.16 fixed number. */ +/* */ +/* <Input> */ +/* a :: The number to be rounded. */ +/* */ +/* <Return> */ +/* The result of `(a + 0x8000) & -0x10000'. */ +/* */ +FT_EXPORT( FT_Fixed ) +FT_RoundFix( FT_Fixed +a ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_CeilFix */ +/* */ +/* <Description> */ +/* A very simple function used to compute the ceiling function of a */ +/* 16.16 fixed number. */ +/* */ +/* <Input> */ +/* a :: The number for which the ceiling function is to be computed. */ +/* */ +/* <Return> */ +/* The result of `(a + 0x10000 - 1) & -0x10000'. */ +/* */ +FT_EXPORT( FT_Fixed ) +FT_CeilFix( FT_Fixed +a ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_FloorFix */ +/* */ +/* <Description> */ +/* A very simple function used to compute the floor function of a */ +/* 16.16 fixed number. */ +/* */ +/* <Input> */ +/* a :: The number for which the floor function is to be computed. */ +/* */ +/* <Return> */ +/* The result of `a & -0x10000'. */ +/* */ +FT_EXPORT( FT_Fixed ) +FT_FloorFix( FT_Fixed +a ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Vector_Transform */ +/* */ +/* <Description> */ +/* Transform a single vector through a 2x2 matrix. */ +/* */ +/* <InOut> */ +/* vector :: The target vector to transform. */ +/* */ +/* <Input> */ +/* matrix :: A pointer to the source 2x2 matrix. */ +/* */ +/* <Note> */ +/* The result is undefined if either `vector' or `matrix' is invalid. */ +/* */ +FT_EXPORT(void) + +FT_Vector_Transform( FT_Vector +* vec, +const FT_Matrix *matrix +); + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* version */ +/* */ +/* <Title> */ +/* FreeType Version */ +/* */ +/* <Abstract> */ +/* Functions and macros related to FreeType versions. */ +/* */ +/* <Description> */ +/* Note that those functions and macros are of limited use because */ +/* even a new release of FreeType with only documentation changes */ +/* increases the version number. */ +/* */ +/*************************************************************************/ + + +/************************************************************************* + * + * @enum: + * FREETYPE_XXX + * + * @description: + * These three macros identify the FreeType source code version. + * Use @FT_Library_Version to access them at runtime. + * + * @values: + * FREETYPE_MAJOR :: The major version number. + * FREETYPE_MINOR :: The minor version number. + * FREETYPE_PATCH :: The patch level. + * + * @note: + * The version number of FreeType if built as a dynamic link library + * with the `libtool' package is _not_ controlled by these three + * macros. + * + */ +#define FREETYPE_MAJOR 2 +#define FREETYPE_MINOR 4 +#define FREETYPE_PATCH 10 + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Library_Version */ +/* */ +/* <Description> */ +/* Return the version of the FreeType library being used. This is */ +/* useful when dynamically linking to the library, since one cannot */ +/* use the macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and */ +/* @FREETYPE_PATCH. */ +/* */ +/* <Input> */ +/* library :: A source library handle. */ +/* */ +/* <Output> */ +/* amajor :: The major version number. */ +/* */ +/* aminor :: The minor version number. */ +/* */ +/* apatch :: The patch version number. */ +/* */ +/* <Note> */ +/* The reason why this function takes a `library' argument is because */ +/* certain programs implement library initialization in a custom way */ +/* that doesn't use @FT_Init_FreeType. */ +/* */ +/* In such cases, the library version might not be available before */ +/* the library object has been created. */ +/* */ +FT_EXPORT(void) + +FT_Library_Version( FT_Library +library, +FT_Int *amajor, + FT_Int +*aminor, +FT_Int *apatch +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Face_CheckTrueTypePatents */ +/* */ +/* <Description> */ +/* Parse all bytecode instructions of a TrueType font file to check */ +/* whether any of the patented opcodes are used. This is only useful */ +/* if you want to be able to use the unpatented hinter with */ +/* fonts that do *not* use these opcodes. */ +/* */ +/* Note that this function parses *all* glyph instructions in the */ +/* font file, which may be slow. */ +/* */ +/* <Input> */ +/* face :: A face handle. */ +/* */ +/* <Return> */ +/* 1~if this is a TrueType font that uses one of the patented */ +/* opcodes, 0~otherwise. */ +/* */ +/* <Note> */ +/* Since May 2010, TrueType hinting is no longer patented. */ +/* */ +/* <Since> */ +/* 2.3.5 */ +/* */ +FT_EXPORT( FT_Bool ) +FT_Face_CheckTrueTypePatents( FT_Face +face ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Face_SetUnpatentedHinting */ +/* */ +/* <Description> */ +/* Enable or disable the unpatented hinter for a given face. */ +/* Only enable it if you have determined that the face doesn't */ +/* use any patented opcodes (see @FT_Face_CheckTrueTypePatents). */ +/* */ +/* <Input> */ +/* face :: A face handle. */ +/* */ +/* value :: New boolean setting. */ +/* */ +/* <Return> */ +/* The old setting value. This will always be false if this is not */ +/* an SFNT font, or if the unpatented hinter is not compiled in this */ +/* instance of the library. */ +/* */ +/* <Note> */ +/* Since May 2010, TrueType hinting is no longer patented. */ +/* */ +/* <Since> */ +/* 2.3.5 */ +/* */ +FT_EXPORT( FT_Bool ) +FT_Face_SetUnpatentedHinting( FT_Face +face, +FT_Bool value +); + +/* */ + + +FT_END_HEADER + +#endif /* __FREETYPE_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftadvanc.h b/app/src/main/cpp/include/freetype2/freetype/ftadvanc.h new file mode 100644 index 0000000..bfb3ae9 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftadvanc.h @@ -0,0 +1,186 @@ +/***************************************************************************/ +/* */ +/* ftadvanc.h */ +/* */ +/* Quick computation of advance widths (specification only). */ +/* */ +/* Copyright 2008 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTADVANC_H__ +#define __FTADVANC_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +/************************************************************************** + * + * @section: + * quick_advance + * + * @title: + * Quick retrieval of advance values + * + * @abstract: + * Retrieve horizontal and vertical advance values without processing + * glyph outlines, if possible. + * + * @description: + * This section contains functions to quickly extract advance values + * without handling glyph outlines, if possible. + */ + + +/*************************************************************************/ +/* */ +/* <Const> */ +/* FT_ADVANCE_FLAG_FAST_ONLY */ +/* */ +/* <Description> */ +/* A bit-flag to be OR-ed with the `flags' parameter of the */ +/* @FT_Get_Advance and @FT_Get_Advances functions. */ +/* */ +/* If set, it indicates that you want these functions to fail if the */ +/* corresponding hinting mode or font driver doesn't allow for very */ +/* quick advance computation. */ +/* */ +/* Typically, glyphs which are either unscaled, unhinted, bitmapped, */ +/* or light-hinted can have their advance width computed very */ +/* quickly. */ +/* */ +/* Normal and bytecode hinted modes, which require loading, scaling, */ +/* and hinting of the glyph outline, are extremely slow by */ +/* comparison. */ +/* */ +#define FT_ADVANCE_FLAG_FAST_ONLY 0x20000000UL + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_Advance */ +/* */ +/* <Description> */ +/* Retrieve the advance value of a given glyph outline in an */ +/* @FT_Face. By default, the unhinted advance is returned in font */ +/* units. */ +/* */ +/* <Input> */ +/* face :: The source @FT_Face handle. */ +/* */ +/* gindex :: The glyph index. */ +/* */ +/* load_flags :: A set of bit flags similar to those used when */ +/* calling @FT_Load_Glyph, used to determine what kind */ +/* of advances you need. */ +/* <Output> */ +/* padvance :: The advance value, in either font units or 16.16 */ +/* format. */ +/* */ +/* If @FT_LOAD_VERTICAL_LAYOUT is set, this is the */ +/* vertical advance corresponding to a vertical layout. */ +/* Otherwise, it is the horizontal advance in a */ +/* horizontal layout. */ +/* */ +/* <Return> */ +/* FreeType error code. 0 means success. */ +/* */ +/* <Note> */ +/* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */ +/* if the corresponding font backend doesn't have a quick way to */ +/* retrieve the advances. */ +/* */ +/* A scaled advance is returned in 16.16 format but isn't transformed */ +/* by the affine transformation specified by @FT_Set_Transform. */ +/* */ +FT_EXPORT(FT_Error) + +FT_Get_Advance( FT_Face +face, +FT_UInt gindex, + FT_Int32 +load_flags, +FT_Fixed *padvance +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_Advances */ +/* */ +/* <Description> */ +/* Retrieve the advance values of several glyph outlines in an */ +/* @FT_Face. By default, the unhinted advances are returned in font */ +/* units. */ +/* */ +/* <Input> */ +/* face :: The source @FT_Face handle. */ +/* */ +/* start :: The first glyph index. */ +/* */ +/* count :: The number of advance values you want to retrieve. */ +/* */ +/* load_flags :: A set of bit flags similar to those used when */ +/* calling @FT_Load_Glyph. */ +/* */ +/* <Output> */ +/* padvance :: The advances, in either font units or 16.16 format. */ +/* This array must contain at least `count' elements. */ +/* */ +/* If @FT_LOAD_VERTICAL_LAYOUT is set, these are the */ +/* vertical advances corresponding to a vertical layout. */ +/* Otherwise, they are the horizontal advances in a */ +/* horizontal layout. */ +/* */ +/* <Return> */ +/* FreeType error code. 0 means success. */ +/* */ +/* <Note> */ +/* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */ +/* if the corresponding font backend doesn't have a quick way to */ +/* retrieve the advances. */ +/* */ +/* Scaled advances are returned in 16.16 format but aren't */ +/* transformed by the affine transformation specified by */ +/* @FT_Set_Transform. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Get_Advances( FT_Face +face, +FT_UInt start, + FT_UInt +count, +FT_Int32 load_flags, + FT_Fixed +*padvances ); + +/* */ + + +FT_END_HEADER + +#endif /* __FTADVANC_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftbbox.h b/app/src/main/cpp/include/freetype2/freetype/ftbbox.h new file mode 100644 index 0000000..33eecf6 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftbbox.h @@ -0,0 +1,105 @@ +/***************************************************************************/ +/* */ +/* ftbbox.h */ +/* */ +/* FreeType exact bbox computation (specification). */ +/* */ +/* Copyright 1996-2001, 2003, 2007, 2011 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +/*************************************************************************/ +/* */ +/* This component has a _single_ role: to compute exact outline bounding */ +/* boxes. */ +/* */ +/* It is separated from the rest of the engine for various technical */ +/* reasons. It may well be integrated in `ftoutln' later. */ +/* */ +/*************************************************************************/ + + +#ifndef __FTBBOX_H__ +#define __FTBBOX_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* outline_processing */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Outline_Get_BBox */ +/* */ +/* <Description> */ +/* Compute the exact bounding box of an outline. This is slower */ +/* than computing the control box. However, it uses an advanced */ +/* algorithm which returns _very_ quickly when the two boxes */ +/* coincide. Otherwise, the outline Bézier arcs are traversed to */ +/* extract their extrema. */ +/* */ +/* <Input> */ +/* outline :: A pointer to the source outline. */ +/* */ +/* <Output> */ +/* abbox :: The outline's exact bounding box. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* If the font is tricky and the glyph has been loaded with */ +/* @FT_LOAD_NO_SCALE, the resulting BBox is meaningless. To get */ +/* reasonable values for the BBox it is necessary to load the glyph */ +/* at a large ppem value (so that the hinting instructions can */ +/* properly shift and scale the subglyphs), then extracting the BBox */ +/* which can be eventually converted back to font units. */ +/* */ +FT_EXPORT(FT_Error) + +FT_Outline_Get_BBox( FT_Outline +* outline, +FT_BBox *abbox +); + + +/* */ + + +FT_END_HEADER + +#endif /* __FTBBOX_H__ */ + + +/* END */ + + +/* Local Variables: */ +/* coding: utf-8 */ +/* End: */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftbdf.h b/app/src/main/cpp/include/freetype2/freetype/ftbdf.h new file mode 100644 index 0000000..c16a598 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftbdf.h @@ -0,0 +1,211 @@ +/***************************************************************************/ +/* */ +/* ftbdf.h */ +/* */ +/* FreeType API for accessing BDF-specific strings (specification). */ +/* */ +/* Copyright 2002, 2003, 2004, 2006, 2009 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTBDF_H__ +#define __FTBDF_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* bdf_fonts */ +/* */ +/* <Title> */ +/* BDF and PCF Files */ +/* */ +/* <Abstract> */ +/* BDF and PCF specific API. */ +/* */ +/* <Description> */ +/* This section contains the declaration of functions specific to BDF */ +/* and PCF fonts. */ +/* */ +/*************************************************************************/ + + +/********************************************************************** + * + * @enum: + * FT_PropertyType + * + * @description: + * A list of BDF property types. + * + * @values: + * BDF_PROPERTY_TYPE_NONE :: + * Value~0 is used to indicate a missing property. + * + * BDF_PROPERTY_TYPE_ATOM :: + * Property is a string atom. + * + * BDF_PROPERTY_TYPE_INTEGER :: + * Property is a 32-bit signed integer. + * + * BDF_PROPERTY_TYPE_CARDINAL :: + * Property is a 32-bit unsigned integer. + */ +typedef enum BDF_PropertyType_ { + BDF_PROPERTY_TYPE_NONE = 0, + BDF_PROPERTY_TYPE_ATOM = 1, + BDF_PROPERTY_TYPE_INTEGER = 2, + BDF_PROPERTY_TYPE_CARDINAL = 3 + +} BDF_PropertyType; + + +/********************************************************************** + * + * @type: + * BDF_Property + * + * @description: + * A handle to a @BDF_PropertyRec structure to model a given + * BDF/PCF property. + */ +typedef struct BDF_PropertyRec_ *BDF_Property; + + +/********************************************************************** + * + * @struct: + * BDF_PropertyRec + * + * @description: + * This structure models a given BDF/PCF property. + * + * @fields: + * type :: + * The property type. + * + * u.atom :: + * The atom string, if type is @BDF_PROPERTY_TYPE_ATOM. + * + * u.integer :: + * A signed integer, if type is @BDF_PROPERTY_TYPE_INTEGER. + * + * u.cardinal :: + * An unsigned integer, if type is @BDF_PROPERTY_TYPE_CARDINAL. + */ +typedef struct BDF_PropertyRec_ { + BDF_PropertyType type; + union { + const char *atom; + FT_Int32 integer; + FT_UInt32 cardinal; + + } u; + +} BDF_PropertyRec; + + +/********************************************************************** + * + * @function: + * FT_Get_BDF_Charset_ID + * + * @description: + * Retrieve a BDF font character set identity, according to + * the BDF specification. + * + * @input: + * face :: + * A handle to the input face. + * + * @output: + * acharset_encoding :: + * Charset encoding, as a C~string, owned by the face. + * + * acharset_registry :: + * Charset registry, as a C~string, owned by the face. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function only works with BDF faces, returning an error otherwise. + */ +FT_EXPORT( FT_Error ) +FT_Get_BDF_Charset_ID( FT_Face +face, +const char **acharset_encoding, +const char **acharset_registry +); + + +/********************************************************************** + * + * @function: + * FT_Get_BDF_Property + * + * @description: + * Retrieve a BDF property from a BDF or PCF font file. + * + * @input: + * face :: A handle to the input face. + * + * name :: The property name. + * + * @output: + * aproperty :: The property. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function works with BDF _and_ PCF fonts. It returns an error + * otherwise. It also returns an error if the property is not in the + * font. + * + * A `property' is a either key-value pair within the STARTPROPERTIES + * ... ENDPROPERTIES block of a BDF font or a key-value pair from the + * `info->props' array within a `FontRec' structure of a PCF font. + * + * Integer properties are always stored as `signed' within PCF fonts; + * consequently, @BDF_PROPERTY_TYPE_CARDINAL is a possible return value + * for BDF fonts only. + * + * In case of error, `aproperty->type' is always set to + * @BDF_PROPERTY_TYPE_NONE. + */ +FT_EXPORT( FT_Error ) +FT_Get_BDF_Property( FT_Face +face, +const char *prop_name, + BDF_PropertyRec +*aproperty ); + +/* */ + +FT_END_HEADER + +#endif /* __FTBDF_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftbitmap.h b/app/src/main/cpp/include/freetype2/freetype/ftbitmap.h new file mode 100644 index 0000000..0632f67 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftbitmap.h @@ -0,0 +1,240 @@ +/***************************************************************************/ +/* */ +/* ftbitmap.h */ +/* */ +/* FreeType utility functions for bitmaps (specification). */ +/* */ +/* Copyright 2004, 2005, 2006, 2008 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTBITMAP_H__ +#define __FTBITMAP_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* bitmap_handling */ +/* */ +/* <Title> */ +/* Bitmap Handling */ +/* */ +/* <Abstract> */ +/* Handling FT_Bitmap objects. */ +/* */ +/* <Description> */ +/* This section contains functions for converting FT_Bitmap objects. */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Bitmap_New */ +/* */ +/* <Description> */ +/* Initialize a pointer to an @FT_Bitmap structure. */ +/* */ +/* <InOut> */ +/* abitmap :: A pointer to the bitmap structure. */ +/* */ +FT_EXPORT(void) + +FT_Bitmap_New( FT_Bitmap +*abitmap ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Bitmap_Copy */ +/* */ +/* <Description> */ +/* Copy a bitmap into another one. */ +/* */ +/* <Input> */ +/* library :: A handle to a library object. */ +/* */ +/* source :: A handle to the source bitmap. */ +/* */ +/* <Output> */ +/* target :: A handle to the target bitmap. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Bitmap_Copy( FT_Library +library, +const FT_Bitmap *source, + FT_Bitmap +*target); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Bitmap_Embolden */ +/* */ +/* <Description> */ +/* Embolden a bitmap. The new bitmap will be about `xStrength' */ +/* pixels wider and `yStrength' pixels higher. The left and bottom */ +/* borders are kept unchanged. */ +/* */ +/* <Input> */ +/* library :: A handle to a library object. */ +/* */ +/* xStrength :: How strong the glyph is emboldened horizontally. */ +/* Expressed in 26.6 pixel format. */ +/* */ +/* yStrength :: How strong the glyph is emboldened vertically. */ +/* Expressed in 26.6 pixel format. */ +/* */ +/* <InOut> */ +/* bitmap :: A handle to the target bitmap. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* The current implementation restricts `xStrength' to be less than */ +/* or equal to~8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO. */ +/* */ +/* If you want to embolden the bitmap owned by a @FT_GlyphSlotRec, */ +/* you should call @FT_GlyphSlot_Own_Bitmap on the slot first. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Bitmap_Embolden( FT_Library +library, +FT_Bitmap *bitmap, + FT_Pos +xStrength, +FT_Pos yStrength +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Bitmap_Convert */ +/* */ +/* <Description> */ +/* Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, or 8bpp to a */ +/* bitmap object with depth 8bpp, making the number of used bytes per */ +/* line (a.k.a. the `pitch') a multiple of `alignment'. */ +/* */ +/* <Input> */ +/* library :: A handle to a library object. */ +/* */ +/* source :: The source bitmap. */ +/* */ +/* alignment :: The pitch of the bitmap is a multiple of this */ +/* parameter. Common values are 1, 2, or 4. */ +/* */ +/* <Output> */ +/* target :: The target bitmap. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* It is possible to call @FT_Bitmap_Convert multiple times without */ +/* calling @FT_Bitmap_Done (the memory is simply reallocated). */ +/* */ +/* Use @FT_Bitmap_Done to finally remove the bitmap object. */ +/* */ +/* The `library' argument is taken to have access to FreeType's */ +/* memory handling functions. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Bitmap_Convert( FT_Library +library, +const FT_Bitmap *source, + FT_Bitmap +*target, +FT_Int alignment +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_GlyphSlot_Own_Bitmap */ +/* */ +/* <Description> */ +/* Make sure that a glyph slot owns `slot->bitmap'. */ +/* */ +/* <Input> */ +/* slot :: The glyph slot. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* This function is to be used in combination with */ +/* @FT_Bitmap_Embolden. */ +/* */ +FT_EXPORT( FT_Error ) +FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot +slot ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Bitmap_Done */ +/* */ +/* <Description> */ +/* Destroy a bitmap object created with @FT_Bitmap_New. */ +/* */ +/* <Input> */ +/* library :: A handle to a library object. */ +/* */ +/* bitmap :: The bitmap object to be freed. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* The `library' argument is taken to have access to FreeType's */ +/* memory handling functions. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Bitmap_Done( FT_Library +library, +FT_Bitmap *bitmap +); + + +/* */ + + +FT_END_HEADER + +#endif /* __FTBITMAP_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftbzip2.h b/app/src/main/cpp/include/freetype2/freetype/ftbzip2.h new file mode 100644 index 0000000..2aa2e5e --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftbzip2.h @@ -0,0 +1,105 @@ +/***************************************************************************/ +/* */ +/* ftbzip2.h */ +/* */ +/* Bzip2-compressed stream support. */ +/* */ +/* Copyright 2010 by */ +/* Joel Klinghed. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTBZIP2_H__ +#define __FTBZIP2_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + +/*************************************************************************/ +/* */ +/* <Section> */ +/* bzip2 */ +/* */ +/* <Title> */ +/* BZIP2 Streams */ +/* */ +/* <Abstract> */ +/* Using bzip2-compressed font files. */ +/* */ +/* <Description> */ +/* This section contains the declaration of Bzip2-specific functions. */ +/* */ +/*************************************************************************/ + + +/************************************************************************ + * + * @function: + * FT_Stream_OpenBzip2 + * + * @description: + * Open a new stream to parse bzip2-compressed font files. This is + * mainly used to support the compressed `*.pcf.bz2' fonts that come + * with XFree86. + * + * @input: + * stream :: + * The target embedding stream. + * + * source :: + * The source stream. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The source stream must be opened _before_ calling this function. + * + * Calling the internal function `FT_Stream_Close' on the new stream will + * *not* call `FT_Stream_Close' on the source stream. None of the stream + * objects will be released to the heap. + * + * The stream implementation is very basic and resets the decompression + * process each time seeking backwards is needed within the stream. + * + * In certain builds of the library, bzip2 compression recognition is + * automatically handled when calling @FT_New_Face or @FT_Open_Face. + * This means that if no font driver is capable of handling the raw + * compressed file, the library will try to open a bzip2 compressed stream + * from it and re-open the face with it. + * + * This function may return `FT_Err_Unimplemented_Feature' if your build + * of FreeType was not compiled with bzip2 support. + */ +FT_EXPORT(FT_Error) + +FT_Stream_OpenBzip2( FT_Stream +stream, +FT_Stream source +); + +/* */ + + +FT_END_HEADER + +#endif /* __FTBZIP2_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftcache.h b/app/src/main/cpp/include/freetype2/freetype/ftcache.h new file mode 100644 index 0000000..3785227 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftcache.h @@ -0,0 +1,1182 @@ +/***************************************************************************/ +/* */ +/* ftcache.h */ +/* */ +/* FreeType Cache subsystem (specification). */ +/* */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTCACHE_H__ +#define __FTCACHE_H__ + + +#include <ft2build.h> +#include FT_GLYPH_H + + +FT_BEGIN_HEADER + + +/************************************************************************* + * + * <Section> + * cache_subsystem + * + * <Title> + * Cache Sub-System + * + * <Abstract> + * How to cache face, size, and glyph data with FreeType~2. + * + * <Description> + * This section describes the FreeType~2 cache sub-system, which is used + * to limit the number of concurrently opened @FT_Face and @FT_Size + * objects, as well as caching information like character maps and glyph + * images while limiting their maximum memory usage. + * + * Note that all types and functions begin with the `FTC_' prefix. + * + * The cache is highly portable and thus doesn't know anything about the + * fonts installed on your system, or how to access them. This implies + * the following scheme: + * + * First, available or installed font faces are uniquely identified by + * @FTC_FaceID values, provided to the cache by the client. Note that + * the cache only stores and compares these values, and doesn't try to + * interpret them in any way. + * + * Second, the cache calls, only when needed, a client-provided function + * to convert an @FTC_FaceID into a new @FT_Face object. The latter is + * then completely managed by the cache, including its termination + * through @FT_Done_Face. To monitor termination of face objects, the + * finalizer callback in the `generic' field of the @FT_Face object can + * be used, which might also be used to store the @FTC_FaceID of the + * face. + * + * Clients are free to map face IDs to anything else. The most simple + * usage is to associate them to a (pathname,face_index) pair that is + * used to call @FT_New_Face. However, more complex schemes are also + * possible. + * + * Note that for the cache to work correctly, the face ID values must be + * *persistent*, which means that the contents they point to should not + * change at runtime, or that their value should not become invalid. + * + * If this is unavoidable (e.g., when a font is uninstalled at runtime), + * you should call @FTC_Manager_RemoveFaceID as soon as possible, to let + * the cache get rid of any references to the old @FTC_FaceID it may + * keep internally. Failure to do so will lead to incorrect behaviour + * or even crashes. + * + * To use the cache, start with calling @FTC_Manager_New to create a new + * @FTC_Manager object, which models a single cache instance. You can + * then look up @FT_Face and @FT_Size objects with + * @FTC_Manager_LookupFace and @FTC_Manager_LookupSize, respectively. + * + * If you want to use the charmap caching, call @FTC_CMapCache_New, then + * later use @FTC_CMapCache_Lookup to perform the equivalent of + * @FT_Get_Char_Index, only much faster. + * + * If you want to use the @FT_Glyph caching, call @FTC_ImageCache, then + * later use @FTC_ImageCache_Lookup to retrieve the corresponding + * @FT_Glyph objects from the cache. + * + * If you need lots of small bitmaps, it is much more memory efficient + * to call @FTC_SBitCache_New followed by @FTC_SBitCache_Lookup. This + * returns @FTC_SBitRec structures, which are used to store small + * bitmaps directly. (A small bitmap is one whose metrics and + * dimensions all fit into 8-bit integers). + * + * We hope to also provide a kerning cache in the near future. + * + * + * <Order> + * FTC_Manager + * FTC_FaceID + * FTC_Face_Requester + * + * FTC_Manager_New + * FTC_Manager_Reset + * FTC_Manager_Done + * FTC_Manager_LookupFace + * FTC_Manager_LookupSize + * FTC_Manager_RemoveFaceID + * + * FTC_Node + * FTC_Node_Unref + * + * FTC_ImageCache + * FTC_ImageCache_New + * FTC_ImageCache_Lookup + * + * FTC_SBit + * FTC_SBitCache + * FTC_SBitCache_New + * FTC_SBitCache_Lookup + * + * FTC_CMapCache + * FTC_CMapCache_New + * FTC_CMapCache_Lookup + * + *************************************************************************/ + + +/*************************************************************************/ +/*************************************************************************/ +/*************************************************************************/ +/***** *****/ +/***** BASIC TYPE DEFINITIONS *****/ +/***** *****/ +/*************************************************************************/ +/*************************************************************************/ +/*************************************************************************/ + + +/************************************************************************* + * + * @type: FTC_FaceID + * + * @description: + * An opaque pointer type that is used to identity face objects. The + * contents of such objects is application-dependent. + * + * These pointers are typically used to point to a user-defined + * structure containing a font file path, and face index. + * + * @note: + * Never use NULL as a valid @FTC_FaceID. + * + * Face IDs are passed by the client to the cache manager, which calls, + * when needed, the @FTC_Face_Requester to translate them into new + * @FT_Face objects. + * + * If the content of a given face ID changes at runtime, or if the value + * becomes invalid (e.g., when uninstalling a font), you should + * immediately call @FTC_Manager_RemoveFaceID before any other cache + * function. + * + * Failure to do so will result in incorrect behaviour or even + * memory leaks and crashes. + */ +typedef FT_Pointer +FTC_FaceID; + + +/************************************************************************ + * + * @functype: + * FTC_Face_Requester + * + * @description: + * A callback function provided by client applications. It is used by + * the cache manager to translate a given @FTC_FaceID into a new valid + * @FT_Face object, on demand. + * + * <Input> + * face_id :: + * The face ID to resolve. + * + * library :: + * A handle to a FreeType library object. + * + * req_data :: + * Application-provided request data (see note below). + * + * <Output> + * aface :: + * A new @FT_Face handle. + * + * <Return> + * FreeType error code. 0~means success. + * + * <Note> + * The third parameter `req_data' is the same as the one passed by the + * client when @FTC_Manager_New is called. + * + * The face requester should not perform funny things on the returned + * face object, like creating a new @FT_Size for it, or setting a + * transformation through @FT_Set_Transform! + */ +typedef FT_Error +(*FTC_Face_Requester)(FTC_FaceID +face_id, +FT_Library library, + FT_Pointer +request_data, +FT_Face *aface +); + +/* */ + +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + +/* these macros are incompatible with LLP64, should not be used */ + +#define FT_POINTER_TO_ULONG( p ) ( (FT_ULong)(FT_Pointer)(p) ) + +#define FTC_FACE_ID_HASH( i ) \ + ((FT_UInt32)(( FT_POINTER_TO_ULONG( i ) >> 3 ) ^ \ + ( FT_POINTER_TO_ULONG( i ) << 7 ) ) ) + +#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ + +/*************************************************************************/ +/*************************************************************************/ +/*************************************************************************/ +/***** *****/ +/***** CACHE MANAGER OBJECT *****/ +/***** *****/ +/*************************************************************************/ +/*************************************************************************/ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FTC_Manager */ +/* */ +/* <Description> */ +/* This object corresponds to one instance of the cache-subsystem. */ +/* It is used to cache one or more @FT_Face objects, along with */ +/* corresponding @FT_Size objects. */ +/* */ +/* The manager intentionally limits the total number of opened */ +/* @FT_Face and @FT_Size objects to control memory usage. See the */ +/* `max_faces' and `max_sizes' parameters of @FTC_Manager_New. */ +/* */ +/* The manager is also used to cache `nodes' of various types while */ +/* limiting their total memory usage. */ +/* */ +/* All limitations are enforced by keeping lists of managed objects */ +/* in most-recently-used order, and flushing old nodes to make room */ +/* for new ones. */ +/* */ +typedef struct FTC_ManagerRec_ *FTC_Manager; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FTC_Node */ +/* */ +/* <Description> */ +/* An opaque handle to a cache node object. Each cache node is */ +/* reference-counted. A node with a count of~0 might be flushed */ +/* out of a full cache whenever a lookup request is performed. */ +/* */ +/* If you look up nodes, you have the ability to `acquire' them, */ +/* i.e., to increment their reference count. This will prevent the */ +/* node from being flushed out of the cache until you explicitly */ +/* `release' it (see @FTC_Node_Unref). */ +/* */ +/* See also @FTC_SBitCache_Lookup and @FTC_ImageCache_Lookup. */ +/* */ +typedef struct FTC_NodeRec_ *FTC_Node; + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FTC_Manager_New */ +/* */ +/* <Description> */ +/* Create a new cache manager. */ +/* */ +/* <Input> */ +/* library :: The parent FreeType library handle to use. */ +/* */ +/* max_faces :: Maximum number of opened @FT_Face objects managed by */ +/* this cache instance. Use~0 for defaults. */ +/* */ +/* max_sizes :: Maximum number of opened @FT_Size objects managed by */ +/* this cache instance. Use~0 for defaults. */ +/* */ +/* max_bytes :: Maximum number of bytes to use for cached data nodes. */ +/* Use~0 for defaults. Note that this value does not */ +/* account for managed @FT_Face and @FT_Size objects. */ +/* */ +/* requester :: An application-provided callback used to translate */ +/* face IDs into real @FT_Face objects. */ +/* */ +/* req_data :: A generic pointer that is passed to the requester */ +/* each time it is called (see @FTC_Face_Requester). */ +/* */ +/* <Output> */ +/* amanager :: A handle to a new manager object. 0~in case of */ +/* failure. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) +FTC_Manager_New( FT_Library +library, +FT_UInt max_faces, + FT_UInt +max_sizes, +FT_ULong max_bytes, + FTC_Face_Requester +requester, +FT_Pointer req_data, + FTC_Manager +*amanager ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FTC_Manager_Reset */ +/* */ +/* <Description> */ +/* Empty a given cache manager. This simply gets rid of all the */ +/* currently cached @FT_Face and @FT_Size objects within the manager. */ +/* */ +/* <InOut> */ +/* manager :: A handle to the manager. */ +/* */ +FT_EXPORT(void) + +FTC_Manager_Reset( FTC_Manager +manager ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FTC_Manager_Done */ +/* */ +/* <Description> */ +/* Destroy a given manager after emptying it. */ +/* */ +/* <Input> */ +/* manager :: A handle to the target cache manager object. */ +/* */ +FT_EXPORT(void) + +FTC_Manager_Done( FTC_Manager +manager ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FTC_Manager_LookupFace */ +/* */ +/* <Description> */ +/* Retrieve the @FT_Face object that corresponds to a given face ID */ +/* through a cache manager. */ +/* */ +/* <Input> */ +/* manager :: A handle to the cache manager. */ +/* */ +/* face_id :: The ID of the face object. */ +/* */ +/* <Output> */ +/* aface :: A handle to the face object. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* The returned @FT_Face object is always owned by the manager. You */ +/* should never try to discard it yourself. */ +/* */ +/* The @FT_Face object doesn't necessarily have a current size object */ +/* (i.e., face->size can be 0). If you need a specific `font size', */ +/* use @FTC_Manager_LookupSize instead. */ +/* */ +/* Never change the face's transformation matrix (i.e., never call */ +/* the @FT_Set_Transform function) on a returned face! If you need */ +/* to transform glyphs, do it yourself after glyph loading. */ +/* */ +/* When you perform a lookup, out-of-memory errors are detected */ +/* _within_ the lookup and force incremental flushes of the cache */ +/* until enough memory is released for the lookup to succeed. */ +/* */ +/* If a lookup fails with `FT_Err_Out_Of_Memory' the cache has */ +/* already been completely flushed, and still no memory was available */ +/* for the operation. */ +/* */ +FT_EXPORT( FT_Error ) +FTC_Manager_LookupFace( FTC_Manager +manager, +FTC_FaceID face_id, + FT_Face +*aface ); + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FTC_ScalerRec */ +/* */ +/* <Description> */ +/* A structure used to describe a given character size in either */ +/* pixels or points to the cache manager. See */ +/* @FTC_Manager_LookupSize. */ +/* */ +/* <Fields> */ +/* face_id :: The source face ID. */ +/* */ +/* width :: The character width. */ +/* */ +/* height :: The character height. */ +/* */ +/* pixel :: A Boolean. If 1, the `width' and `height' fields are */ +/* interpreted as integer pixel character sizes. */ +/* Otherwise, they are expressed as 1/64th of points. */ +/* */ +/* x_res :: Only used when `pixel' is value~0 to indicate the */ +/* horizontal resolution in dpi. */ +/* */ +/* y_res :: Only used when `pixel' is value~0 to indicate the */ +/* vertical resolution in dpi. */ +/* */ +/* <Note> */ +/* This type is mainly used to retrieve @FT_Size objects through the */ +/* cache manager. */ +/* */ +typedef struct FTC_ScalerRec_ { + FTC_FaceID face_id; + FT_UInt width; + FT_UInt height; + FT_Int pixel; + FT_UInt x_res; + FT_UInt y_res; + +} FTC_ScalerRec; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FTC_Scaler */ +/* */ +/* <Description> */ +/* A handle to an @FTC_ScalerRec structure. */ +/* */ +typedef struct FTC_ScalerRec_ *FTC_Scaler; + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FTC_Manager_LookupSize */ +/* */ +/* <Description> */ +/* Retrieve the @FT_Size object that corresponds to a given */ +/* @FTC_ScalerRec pointer through a cache manager. */ +/* */ +/* <Input> */ +/* manager :: A handle to the cache manager. */ +/* */ +/* scaler :: A scaler handle. */ +/* */ +/* <Output> */ +/* asize :: A handle to the size object. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* The returned @FT_Size object is always owned by the manager. You */ +/* should never try to discard it by yourself. */ +/* */ +/* You can access the parent @FT_Face object simply as `size->face' */ +/* if you need it. Note that this object is also owned by the */ +/* manager. */ +/* */ +/* <Note> */ +/* When you perform a lookup, out-of-memory errors are detected */ +/* _within_ the lookup and force incremental flushes of the cache */ +/* until enough memory is released for the lookup to succeed. */ +/* */ +/* If a lookup fails with `FT_Err_Out_Of_Memory' the cache has */ +/* already been completely flushed, and still no memory is available */ +/* for the operation. */ +/* */ +FT_EXPORT( FT_Error ) +FTC_Manager_LookupSize( FTC_Manager +manager, +FTC_Scaler scaler, + FT_Size +*asize ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FTC_Node_Unref */ +/* */ +/* <Description> */ +/* Decrement a cache node's internal reference count. When the count */ +/* reaches 0, it is not destroyed but becomes eligible for subsequent */ +/* cache flushes. */ +/* */ +/* <Input> */ +/* node :: The cache node handle. */ +/* */ +/* manager :: The cache manager handle. */ +/* */ +FT_EXPORT(void) + +FTC_Node_Unref( FTC_Node +node, +FTC_Manager manager +); + + +/************************************************************************* + * + * @function: + * FTC_Manager_RemoveFaceID + * + * @description: + * A special function used to indicate to the cache manager that + * a given @FTC_FaceID is no longer valid, either because its + * content changed, or because it was deallocated or uninstalled. + * + * @input: + * manager :: + * The cache manager handle. + * + * face_id :: + * The @FTC_FaceID to be removed. + * + * @note: + * This function flushes all nodes from the cache corresponding to this + * `face_id', with the exception of nodes with a non-null reference + * count. + * + * Such nodes are however modified internally so as to never appear + * in later lookups with the same `face_id' value, and to be immediately + * destroyed when released by all their users. + * + */ +FT_EXPORT(void) + +FTC_Manager_RemoveFaceID( FTC_Manager +manager, +FTC_FaceID face_id +); + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* cache_subsystem */ +/* */ +/*************************************************************************/ + +/************************************************************************* + * + * @type: + * FTC_CMapCache + * + * @description: + * An opaque handle used to model a charmap cache. This cache is to + * hold character codes -> glyph indices mappings. + * + */ +typedef struct FTC_CMapCacheRec_ *FTC_CMapCache; + + +/************************************************************************* + * + * @function: + * FTC_CMapCache_New + * + * @description: + * Create a new charmap cache. + * + * @input: + * manager :: + * A handle to the cache manager. + * + * @output: + * acache :: + * A new cache handle. NULL in case of error. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * Like all other caches, this one will be destroyed with the cache + * manager. + * + */ +FT_EXPORT( FT_Error ) +FTC_CMapCache_New( FTC_Manager +manager, +FTC_CMapCache *acache +); + + +/************************************************************************ + * + * @function: + * FTC_CMapCache_Lookup + * + * @description: + * Translate a character code into a glyph index, using the charmap + * cache. + * + * @input: + * cache :: + * A charmap cache handle. + * + * face_id :: + * The source face ID. + * + * cmap_index :: + * The index of the charmap in the source face. Any negative value + * means to use the cache @FT_Face's default charmap. + * + * char_code :: + * The character code (in the corresponding charmap). + * + * @return: + * Glyph index. 0~means `no glyph'. + * + */ +FT_EXPORT( FT_UInt ) +FTC_CMapCache_Lookup( FTC_CMapCache +cache, +FTC_FaceID face_id, + FT_Int +cmap_index, +FT_UInt32 char_code +); + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* cache_subsystem */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/*************************************************************************/ +/*************************************************************************/ +/***** *****/ +/***** IMAGE CACHE OBJECT *****/ +/***** *****/ +/*************************************************************************/ +/*************************************************************************/ +/*************************************************************************/ + + +/************************************************************************* + * + * @struct: + * FTC_ImageTypeRec + * + * @description: + * A structure used to model the type of images in a glyph cache. + * + * @fields: + * face_id :: + * The face ID. + * + * width :: + * The width in pixels. + * + * height :: + * The height in pixels. + * + * flags :: + * The load flags, as in @FT_Load_Glyph. + * + */ +typedef struct FTC_ImageTypeRec_ { + FTC_FaceID face_id; + FT_Int width; + FT_Int height; + FT_Int32 flags; + +} FTC_ImageTypeRec; + + +/************************************************************************* + * + * @type: + * FTC_ImageType + * + * @description: + * A handle to an @FTC_ImageTypeRec structure. + * + */ +typedef struct FTC_ImageTypeRec_ *FTC_ImageType; + + +/* */ + + +#define FTC_IMAGE_TYPE_COMPARE(d1, d2) \ + ( (d1)->face_id == (d2)->face_id && \ + (d1)->width == (d2)->width && \ + (d1)->flags == (d2)->flags ) + +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + +/* this macro is incompatible with LLP64, should not be used */ + +#define FTC_IMAGE_TYPE_HASH( d ) \ + (FT_UFast)( FTC_FACE_ID_HASH( (d)->face_id ) ^ \ + ( (d)->width << 8 ) ^ (d)->height ^ \ + ( (d)->flags << 4 ) ) + +#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FTC_ImageCache */ +/* */ +/* <Description> */ +/* A handle to an glyph image cache object. They are designed to */ +/* hold many distinct glyph images while not exceeding a certain */ +/* memory threshold. */ +/* */ +typedef struct FTC_ImageCacheRec_ *FTC_ImageCache; + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FTC_ImageCache_New */ +/* */ +/* <Description> */ +/* Create a new glyph image cache. */ +/* */ +/* <Input> */ +/* manager :: The parent manager for the image cache. */ +/* */ +/* <Output> */ +/* acache :: A handle to the new glyph image cache object. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) +FTC_ImageCache_New( FTC_Manager +manager, +FTC_ImageCache *acache +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FTC_ImageCache_Lookup */ +/* */ +/* <Description> */ +/* Retrieve a given glyph image from a glyph image cache. */ +/* */ +/* <Input> */ +/* cache :: A handle to the source glyph image cache. */ +/* */ +/* type :: A pointer to a glyph image type descriptor. */ +/* */ +/* gindex :: The glyph index to retrieve. */ +/* */ +/* <Output> */ +/* aglyph :: The corresponding @FT_Glyph object. 0~in case of */ +/* failure. */ +/* */ +/* anode :: Used to return the address of of the corresponding cache */ +/* node after incrementing its reference count (see note */ +/* below). */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* The returned glyph is owned and managed by the glyph image cache. */ +/* Never try to transform or discard it manually! You can however */ +/* create a copy with @FT_Glyph_Copy and modify the new one. */ +/* */ +/* If `anode' is _not_ NULL, it receives the address of the cache */ +/* node containing the glyph image, after increasing its reference */ +/* count. This ensures that the node (as well as the @FT_Glyph) will */ +/* always be kept in the cache until you call @FTC_Node_Unref to */ +/* `release' it. */ +/* */ +/* If `anode' is NULL, the cache node is left unchanged, which means */ +/* that the @FT_Glyph could be flushed out of the cache on the next */ +/* call to one of the caching sub-system APIs. Don't assume that it */ +/* is persistent! */ +/* */ +FT_EXPORT( FT_Error ) +FTC_ImageCache_Lookup( FTC_ImageCache +cache, +FTC_ImageType type, + FT_UInt +gindex, +FT_Glyph *aglyph, + FTC_Node +*anode ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FTC_ImageCache_LookupScaler */ +/* */ +/* <Description> */ +/* A variant of @FTC_ImageCache_Lookup that uses an @FTC_ScalerRec */ +/* to specify the face ID and its size. */ +/* */ +/* <Input> */ +/* cache :: A handle to the source glyph image cache. */ +/* */ +/* scaler :: A pointer to a scaler descriptor. */ +/* */ +/* load_flags :: The corresponding load flags. */ +/* */ +/* gindex :: The glyph index to retrieve. */ +/* */ +/* <Output> */ +/* aglyph :: The corresponding @FT_Glyph object. 0~in case of */ +/* failure. */ +/* */ +/* anode :: Used to return the address of of the corresponding */ +/* cache node after incrementing its reference count */ +/* (see note below). */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* The returned glyph is owned and managed by the glyph image cache. */ +/* Never try to transform or discard it manually! You can however */ +/* create a copy with @FT_Glyph_Copy and modify the new one. */ +/* */ +/* If `anode' is _not_ NULL, it receives the address of the cache */ +/* node containing the glyph image, after increasing its reference */ +/* count. This ensures that the node (as well as the @FT_Glyph) will */ +/* always be kept in the cache until you call @FTC_Node_Unref to */ +/* `release' it. */ +/* */ +/* If `anode' is NULL, the cache node is left unchanged, which means */ +/* that the @FT_Glyph could be flushed out of the cache on the next */ +/* call to one of the caching sub-system APIs. Don't assume that it */ +/* is persistent! */ +/* */ +/* Calls to @FT_Set_Char_Size and friends have no effect on cached */ +/* glyphs; you should always use the FreeType cache API instead. */ +/* */ +FT_EXPORT( FT_Error ) +FTC_ImageCache_LookupScaler( FTC_ImageCache +cache, +FTC_Scaler scaler, + FT_ULong +load_flags, +FT_UInt gindex, + FT_Glyph +*aglyph, +FTC_Node *anode +); + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FTC_SBit */ +/* */ +/* <Description> */ +/* A handle to a small bitmap descriptor. See the @FTC_SBitRec */ +/* structure for details. */ +/* */ +typedef struct FTC_SBitRec_ *FTC_SBit; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FTC_SBitRec */ +/* */ +/* <Description> */ +/* A very compact structure used to describe a small glyph bitmap. */ +/* */ +/* <Fields> */ +/* width :: The bitmap width in pixels. */ +/* */ +/* height :: The bitmap height in pixels. */ +/* */ +/* left :: The horizontal distance from the pen position to the */ +/* left bitmap border (a.k.a. `left side bearing', or */ +/* `lsb'). */ +/* */ +/* top :: The vertical distance from the pen position (on the */ +/* baseline) to the upper bitmap border (a.k.a. `top */ +/* side bearing'). The distance is positive for upwards */ +/* y~coordinates. */ +/* */ +/* format :: The format of the glyph bitmap (monochrome or gray). */ +/* */ +/* max_grays :: Maximum gray level value (in the range 1 to~255). */ +/* */ +/* pitch :: The number of bytes per bitmap line. May be positive */ +/* or negative. */ +/* */ +/* xadvance :: The horizontal advance width in pixels. */ +/* */ +/* yadvance :: The vertical advance height in pixels. */ +/* */ +/* buffer :: A pointer to the bitmap pixels. */ +/* */ +typedef struct FTC_SBitRec_ { + FT_Byte width; + FT_Byte height; + FT_Char left; + FT_Char top; + + FT_Byte format; + FT_Byte max_grays; + FT_Short pitch; + FT_Char xadvance; + FT_Char yadvance; + + FT_Byte *buffer; + +} FTC_SBitRec; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FTC_SBitCache */ +/* */ +/* <Description> */ +/* A handle to a small bitmap cache. These are special cache objects */ +/* used to store small glyph bitmaps (and anti-aliased pixmaps) in a */ +/* much more efficient way than the traditional glyph image cache */ +/* implemented by @FTC_ImageCache. */ +/* */ +typedef struct FTC_SBitCacheRec_ *FTC_SBitCache; + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FTC_SBitCache_New */ +/* */ +/* <Description> */ +/* Create a new cache to store small glyph bitmaps. */ +/* */ +/* <Input> */ +/* manager :: A handle to the source cache manager. */ +/* */ +/* <Output> */ +/* acache :: A handle to the new sbit cache. NULL in case of error. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) +FTC_SBitCache_New( FTC_Manager +manager, +FTC_SBitCache *acache +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FTC_SBitCache_Lookup */ +/* */ +/* <Description> */ +/* Look up a given small glyph bitmap in a given sbit cache and */ +/* `lock' it to prevent its flushing from the cache until needed. */ +/* */ +/* <Input> */ +/* cache :: A handle to the source sbit cache. */ +/* */ +/* type :: A pointer to the glyph image type descriptor. */ +/* */ +/* gindex :: The glyph index. */ +/* */ +/* <Output> */ +/* sbit :: A handle to a small bitmap descriptor. */ +/* */ +/* anode :: Used to return the address of of the corresponding cache */ +/* node after incrementing its reference count (see note */ +/* below). */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* The small bitmap descriptor and its bit buffer are owned by the */ +/* cache and should never be freed by the application. They might */ +/* as well disappear from memory on the next cache lookup, so don't */ +/* treat them as persistent data. */ +/* */ +/* The descriptor's `buffer' field is set to~0 to indicate a missing */ +/* glyph bitmap. */ +/* */ +/* If `anode' is _not_ NULL, it receives the address of the cache */ +/* node containing the bitmap, after increasing its reference count. */ +/* This ensures that the node (as well as the image) will always be */ +/* kept in the cache until you call @FTC_Node_Unref to `release' it. */ +/* */ +/* If `anode' is NULL, the cache node is left unchanged, which means */ +/* that the bitmap could be flushed out of the cache on the next */ +/* call to one of the caching sub-system APIs. Don't assume that it */ +/* is persistent! */ +/* */ +FT_EXPORT( FT_Error ) +FTC_SBitCache_Lookup( FTC_SBitCache +cache, +FTC_ImageType type, + FT_UInt +gindex, +FTC_SBit *sbit, + FTC_Node +*anode ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FTC_SBitCache_LookupScaler */ +/* */ +/* <Description> */ +/* A variant of @FTC_SBitCache_Lookup that uses an @FTC_ScalerRec */ +/* to specify the face ID and its size. */ +/* */ +/* <Input> */ +/* cache :: A handle to the source sbit cache. */ +/* */ +/* scaler :: A pointer to the scaler descriptor. */ +/* */ +/* load_flags :: The corresponding load flags. */ +/* */ +/* gindex :: The glyph index. */ +/* */ +/* <Output> */ +/* sbit :: A handle to a small bitmap descriptor. */ +/* */ +/* anode :: Used to return the address of of the corresponding */ +/* cache node after incrementing its reference count */ +/* (see note below). */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* The small bitmap descriptor and its bit buffer are owned by the */ +/* cache and should never be freed by the application. They might */ +/* as well disappear from memory on the next cache lookup, so don't */ +/* treat them as persistent data. */ +/* */ +/* The descriptor's `buffer' field is set to~0 to indicate a missing */ +/* glyph bitmap. */ +/* */ +/* If `anode' is _not_ NULL, it receives the address of the cache */ +/* node containing the bitmap, after increasing its reference count. */ +/* This ensures that the node (as well as the image) will always be */ +/* kept in the cache until you call @FTC_Node_Unref to `release' it. */ +/* */ +/* If `anode' is NULL, the cache node is left unchanged, which means */ +/* that the bitmap could be flushed out of the cache on the next */ +/* call to one of the caching sub-system APIs. Don't assume that it */ +/* is persistent! */ +/* */ +FT_EXPORT( FT_Error ) +FTC_SBitCache_LookupScaler( FTC_SBitCache +cache, +FTC_Scaler scaler, + FT_ULong +load_flags, +FT_UInt gindex, + FTC_SBit +*sbit, +FTC_Node *anode +); + + +/* */ + +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + +/*@***********************************************************************/ +/* */ +/* <Struct> */ +/* FTC_FontRec */ +/* */ +/* <Description> */ +/* A simple structure used to describe a given `font' to the cache */ +/* manager. Note that a `font' is the combination of a given face */ +/* with a given character size. */ +/* */ +/* <Fields> */ +/* face_id :: The ID of the face to use. */ +/* */ +/* pix_width :: The character width in integer pixels. */ +/* */ +/* pix_height :: The character height in integer pixels. */ +/* */ +typedef struct FTC_FontRec_ +{ + FTC_FaceID face_id; + FT_UShort pix_width; + FT_UShort pix_height; + +} FTC_FontRec; + + +/* */ + + +#define FTC_FONT_COMPARE( f1, f2 ) \ + ( (f1)->face_id == (f2)->face_id && \ + (f1)->pix_width == (f2)->pix_width && \ + (f1)->pix_height == (f2)->pix_height ) + +/* this macro is incompatible with LLP64, should not be used */ +#define FTC_FONT_HASH( f ) \ + (FT_UInt32)( FTC_FACE_ID_HASH((f)->face_id) ^ \ + ((f)->pix_width << 8) ^ \ + ((f)->pix_height) ) + +typedef FTC_FontRec* FTC_Font; + + +FT_EXPORT( FT_Error ) +FTC_Manager_Lookup_Face( FTC_Manager manager, + FTC_FaceID face_id, + FT_Face *aface ); + +FT_EXPORT( FT_Error ) +FTC_Manager_Lookup_Size( FTC_Manager manager, + FTC_Font font, + FT_Face *aface, + FT_Size *asize ); + +#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ + + +/* */ + +FT_END_HEADER + +#endif /* __FTCACHE_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftchapters.h b/app/src/main/cpp/include/freetype2/freetype/ftchapters.h new file mode 100644 index 0000000..6cdf54e --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftchapters.h @@ -0,0 +1,104 @@ +/***************************************************************************/ +/* */ +/* This file defines the structure of the FreeType reference. */ +/* It is used by the python script which generates the HTML files. */ +/* */ +/***************************************************************************/ + + +/***************************************************************************/ +/* */ +/* <Chapter> */ +/* general_remarks */ +/* */ +/* <Title> */ +/* General Remarks */ +/* */ +/* <Sections> */ +/* user_allocation */ +/* */ +/***************************************************************************/ + + +/***************************************************************************/ +/* */ +/* <Chapter> */ +/* core_api */ +/* */ +/* <Title> */ +/* Core API */ +/* */ +/* <Sections> */ +/* version */ +/* basic_types */ +/* base_interface */ +/* glyph_variants */ +/* glyph_management */ +/* mac_specific */ +/* sizes_management */ +/* header_file_macros */ +/* */ +/***************************************************************************/ + + +/***************************************************************************/ +/* */ +/* <Chapter> */ +/* format_specific */ +/* */ +/* <Title> */ +/* Format-Specific API */ +/* */ +/* <Sections> */ +/* multiple_masters */ +/* truetype_tables */ +/* type1_tables */ +/* sfnt_names */ +/* bdf_fonts */ +/* cid_fonts */ +/* pfr_fonts */ +/* winfnt_fonts */ +/* font_formats */ +/* gasp_table */ +/* */ +/***************************************************************************/ + + +/***************************************************************************/ +/* */ +/* <Chapter> */ +/* cache_subsystem */ +/* */ +/* <Title> */ +/* Cache Sub-System */ +/* */ +/* <Sections> */ +/* cache_subsystem */ +/* */ +/***************************************************************************/ + + +/***************************************************************************/ +/* */ +/* <Chapter> */ +/* support_api */ +/* */ +/* <Title> */ +/* Support API */ +/* */ +/* <Sections> */ +/* computations */ +/* list_processing */ +/* outline_processing */ +/* quick_advance */ +/* bitmap_handling */ +/* raster */ +/* glyph_stroker */ +/* system_interface */ +/* module_management */ +/* gzip */ +/* lzw */ +/* bzip2 */ +/* lcd_filtering */ +/* */ +/***************************************************************************/ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftcid.h b/app/src/main/cpp/include/freetype2/freetype/ftcid.h new file mode 100644 index 0000000..e1c9593 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftcid.h @@ -0,0 +1,173 @@ +/***************************************************************************/ +/* */ +/* ftcid.h */ +/* */ +/* FreeType API for accessing CID font information (specification). */ +/* */ +/* Copyright 2007, 2009 by Dereg Clegg, Michael Toftdal. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTCID_H__ +#define __FTCID_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* cid_fonts */ +/* */ +/* <Title> */ +/* CID Fonts */ +/* */ +/* <Abstract> */ +/* CID-keyed font specific API. */ +/* */ +/* <Description> */ +/* This section contains the declaration of CID-keyed font specific */ +/* functions. */ +/* */ +/*************************************************************************/ + + +/********************************************************************** + * + * @function: + * FT_Get_CID_Registry_Ordering_Supplement + * + * @description: + * Retrieve the Registry/Ordering/Supplement triple (also known as the + * "R/O/S") from a CID-keyed font. + * + * @input: + * face :: + * A handle to the input face. + * + * @output: + * registry :: + * The registry, as a C~string, owned by the face. + * + * ordering :: + * The ordering, as a C~string, owned by the face. + * + * supplement :: + * The supplement. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function only works with CID faces, returning an error + * otherwise. + * + * @since: + * 2.3.6 + */ +FT_EXPORT(FT_Error) + +FT_Get_CID_Registry_Ordering_Supplement( FT_Face +face, +const char **registry, +const char **ordering, + FT_Int +*supplement); + + +/********************************************************************** + * + * @function: + * FT_Get_CID_Is_Internally_CID_Keyed + * + * @description: + * Retrieve the type of the input face, CID keyed or not. In + * constrast to the @FT_IS_CID_KEYED macro this function returns + * successfully also for CID-keyed fonts in an SNFT wrapper. + * + * @input: + * face :: + * A handle to the input face. + * + * @output: + * is_cid :: + * The type of the face as an @FT_Bool. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function only works with CID faces and OpenType fonts, + * returning an error otherwise. + * + * @since: + * 2.3.9 + */ +FT_EXPORT( FT_Error ) +FT_Get_CID_Is_Internally_CID_Keyed( FT_Face +face, +FT_Bool *is_cid +); + + +/********************************************************************** + * + * @function: + * FT_Get_CID_From_Glyph_Index + * + * @description: + * Retrieve the CID of the input glyph index. + * + * @input: + * face :: + * A handle to the input face. + * + * glyph_index :: + * The input glyph index. + * + * @output: + * cid :: + * The CID as an @FT_UInt. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function only works with CID faces and OpenType fonts, + * returning an error otherwise. + * + * @since: + * 2.3.9 + */ +FT_EXPORT( FT_Error ) +FT_Get_CID_From_Glyph_Index( FT_Face +face, +FT_UInt glyph_index, + FT_UInt +*cid ); + +/* */ + +FT_END_HEADER + +#endif /* __FTCID_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/fterrdef.h b/app/src/main/cpp/include/freetype2/freetype/fterrdef.h new file mode 100644 index 0000000..23718fa --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/fterrdef.h @@ -0,0 +1,334 @@ +/***************************************************************************/ +/* */ +/* fterrdef.h */ +/* */ +/* FreeType error codes (specification). */ +/* */ +/* Copyright 2002, 2004, 2006, 2007, 2010-2011 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +/*******************************************************************/ +/*******************************************************************/ +/***** *****/ +/***** LIST OF ERROR CODES/MESSAGES *****/ +/***** *****/ +/*******************************************************************/ +/*******************************************************************/ + + +/* You need to define both FT_ERRORDEF_ and FT_NOERRORDEF_ before */ +/* including this file. */ + + +/* generic errors */ + +FT_NOERRORDEF_( Ok, +0x00, \ + "no error" ) + +FT_ERRORDEF_( Cannot_Open_Resource, +0x01, \ + "cannot open resource" ) +FT_ERRORDEF_( Unknown_File_Format, +0x02, \ + "unknown file format" ) +FT_ERRORDEF_( Invalid_File_Format, +0x03, \ + "broken file" ) +FT_ERRORDEF_( Invalid_Version, +0x04, \ + "invalid FreeType version" ) +FT_ERRORDEF_( Lower_Module_Version, +0x05, \ + "module version is too low" ) +FT_ERRORDEF_( Invalid_Argument, +0x06, \ + "invalid argument" ) +FT_ERRORDEF_( Unimplemented_Feature, +0x07, \ + "unimplemented feature" ) +FT_ERRORDEF_( Invalid_Table, +0x08, \ + "broken table" ) +FT_ERRORDEF_( Invalid_Offset, +0x09, \ + "broken offset within table" ) +FT_ERRORDEF_( Array_Too_Large, +0x0A, \ + "array allocation size too large" ) +FT_ERRORDEF_( Missing_Module, +0x0B, \ + "missing module" ) + +/* glyph/character errors */ + +FT_ERRORDEF_( Invalid_Glyph_Index, +0x10, \ + "invalid glyph index" ) +FT_ERRORDEF_( Invalid_Character_Code, +0x11, \ + "invalid character code" ) +FT_ERRORDEF_( Invalid_Glyph_Format, +0x12, \ + "unsupported glyph image format" ) +FT_ERRORDEF_( Cannot_Render_Glyph, +0x13, \ + "cannot render this glyph format" ) +FT_ERRORDEF_( Invalid_Outline, +0x14, \ + "invalid outline" ) +FT_ERRORDEF_( Invalid_Composite, +0x15, \ + "invalid composite glyph" ) +FT_ERRORDEF_( Too_Many_Hints, +0x16, \ + "too many hints" ) +FT_ERRORDEF_( Invalid_Pixel_Size, +0x17, \ + "invalid pixel size" ) + +/* handle errors */ + +FT_ERRORDEF_( Invalid_Handle, +0x20, \ + "invalid object handle" ) +FT_ERRORDEF_( Invalid_Library_Handle, +0x21, \ + "invalid library handle" ) +FT_ERRORDEF_( Invalid_Driver_Handle, +0x22, \ + "invalid module handle" ) +FT_ERRORDEF_( Invalid_Face_Handle, +0x23, \ + "invalid face handle" ) +FT_ERRORDEF_( Invalid_Size_Handle, +0x24, \ + "invalid size handle" ) +FT_ERRORDEF_( Invalid_Slot_Handle, +0x25, \ + "invalid glyph slot handle" ) +FT_ERRORDEF_( Invalid_CharMap_Handle, +0x26, \ + "invalid charmap handle" ) +FT_ERRORDEF_( Invalid_Cache_Handle, +0x27, \ + "invalid cache manager handle" ) +FT_ERRORDEF_( Invalid_Stream_Handle, +0x28, \ + "invalid stream handle" ) + +/* driver errors */ + +FT_ERRORDEF_( Too_Many_Drivers, +0x30, \ + "too many modules" ) +FT_ERRORDEF_( Too_Many_Extensions, +0x31, \ + "too many extensions" ) + +/* memory errors */ + +FT_ERRORDEF_( Out_Of_Memory, +0x40, \ + "out of memory" ) +FT_ERRORDEF_( Unlisted_Object, +0x41, \ + "unlisted object" ) + +/* stream errors */ + +FT_ERRORDEF_( Cannot_Open_Stream, +0x51, \ + "cannot open stream" ) +FT_ERRORDEF_( Invalid_Stream_Seek, +0x52, \ + "invalid stream seek" ) +FT_ERRORDEF_( Invalid_Stream_Skip, +0x53, \ + "invalid stream skip" ) +FT_ERRORDEF_( Invalid_Stream_Read, +0x54, \ + "invalid stream read" ) +FT_ERRORDEF_( Invalid_Stream_Operation, +0x55, \ + "invalid stream operation" ) +FT_ERRORDEF_( Invalid_Frame_Operation, +0x56, \ + "invalid frame operation" ) +FT_ERRORDEF_( Nested_Frame_Access, +0x57, \ + "nested frame access" ) +FT_ERRORDEF_( Invalid_Frame_Read, +0x58, \ + "invalid frame read" ) + +/* raster errors */ + +FT_ERRORDEF_( Raster_Uninitialized, +0x60, \ + "raster uninitialized" ) +FT_ERRORDEF_( Raster_Corrupted, +0x61, \ + "raster corrupted" ) +FT_ERRORDEF_( Raster_Overflow, +0x62, \ + "raster overflow" ) +FT_ERRORDEF_( Raster_Negative_Height, +0x63, \ + "negative height while rastering" ) + +/* cache errors */ + +FT_ERRORDEF_( Too_Many_Caches, +0x70, \ + "too many registered caches" ) + +/* TrueType and SFNT errors */ + +FT_ERRORDEF_( Invalid_Opcode, +0x80, \ + "invalid opcode" ) +FT_ERRORDEF_( Too_Few_Arguments, +0x81, \ + "too few arguments" ) +FT_ERRORDEF_( Stack_Overflow, +0x82, \ + "stack overflow" ) +FT_ERRORDEF_( Code_Overflow, +0x83, \ + "code overflow" ) +FT_ERRORDEF_( Bad_Argument, +0x84, \ + "bad argument" ) +FT_ERRORDEF_( Divide_By_Zero, +0x85, \ + "division by zero" ) +FT_ERRORDEF_( Invalid_Reference, +0x86, \ + "invalid reference" ) +FT_ERRORDEF_( Debug_OpCode, +0x87, \ + "found debug opcode" ) +FT_ERRORDEF_( ENDF_In_Exec_Stream, +0x88, \ + "found ENDF opcode in execution stream" ) +FT_ERRORDEF_( Nested_DEFS, +0x89, \ + "nested DEFS" ) +FT_ERRORDEF_( Invalid_CodeRange, +0x8A, \ + "invalid code range" ) +FT_ERRORDEF_( Execution_Too_Long, +0x8B, \ + "execution context too long" ) +FT_ERRORDEF_( Too_Many_Function_Defs, +0x8C, \ + "too many function definitions" ) +FT_ERRORDEF_( Too_Many_Instruction_Defs, +0x8D, \ + "too many instruction definitions" ) +FT_ERRORDEF_( Table_Missing, +0x8E, \ + "SFNT font table missing" ) +FT_ERRORDEF_( Horiz_Header_Missing, +0x8F, \ + "horizontal header (hhea) table missing" ) +FT_ERRORDEF_( Locations_Missing, +0x90, \ + "locations (loca) table missing" ) +FT_ERRORDEF_( Name_Table_Missing, +0x91, \ + "name table missing" ) +FT_ERRORDEF_( CMap_Table_Missing, +0x92, \ + "character map (cmap) table missing" ) +FT_ERRORDEF_( Hmtx_Table_Missing, +0x93, \ + "horizontal metrics (hmtx) table missing" ) +FT_ERRORDEF_( Post_Table_Missing, +0x94, \ + "PostScript (post) table missing" ) +FT_ERRORDEF_( Invalid_Horiz_Metrics, +0x95, \ + "invalid horizontal metrics" ) +FT_ERRORDEF_( Invalid_CharMap_Format, +0x96, \ + "invalid character map (cmap) format" ) +FT_ERRORDEF_( Invalid_PPem, +0x97, \ + "invalid ppem value" ) +FT_ERRORDEF_( Invalid_Vert_Metrics, +0x98, \ + "invalid vertical metrics" ) +FT_ERRORDEF_( Could_Not_Find_Context, +0x99, \ + "could not find context" ) +FT_ERRORDEF_( Invalid_Post_Table_Format, +0x9A, \ + "invalid PostScript (post) table format" ) +FT_ERRORDEF_( Invalid_Post_Table, +0x9B, \ + "invalid PostScript (post) table" ) + +/* CFF, CID, and Type 1 errors */ + +FT_ERRORDEF_( Syntax_Error, +0xA0, \ + "opcode syntax error" ) +FT_ERRORDEF_( Stack_Underflow, +0xA1, \ + "argument stack underflow" ) +FT_ERRORDEF_( Ignore, +0xA2, \ + "ignore" ) +FT_ERRORDEF_( No_Unicode_Glyph_Name, +0xA3, \ + "no Unicode glyph name found" ) + +/* BDF errors */ + +FT_ERRORDEF_( Missing_Startfont_Field, +0xB0, \ + "`STARTFONT' field missing" ) +FT_ERRORDEF_( Missing_Font_Field, +0xB1, \ + "`FONT' field missing" ) +FT_ERRORDEF_( Missing_Size_Field, +0xB2, \ + "`SIZE' field missing" ) +FT_ERRORDEF_( Missing_Fontboundingbox_Field, +0xB3, \ + "`FONTBOUNDINGBOX' field missing" ) +FT_ERRORDEF_( Missing_Chars_Field, +0xB4, \ + "`CHARS' field missing" ) +FT_ERRORDEF_( Missing_Startchar_Field, +0xB5, \ + "`STARTCHAR' field missing" ) +FT_ERRORDEF_( Missing_Encoding_Field, +0xB6, \ + "`ENCODING' field missing" ) +FT_ERRORDEF_( Missing_Bbx_Field, +0xB7, \ + "`BBX' field missing" ) +FT_ERRORDEF_( Bbx_Too_Big, +0xB8, \ + "`BBX' too big" ) +FT_ERRORDEF_( Corrupted_Font_Header, +0xB9, \ + "Font header corrupted or missing fields" ) +FT_ERRORDEF_( Corrupted_Font_Glyphs, +0xBA, \ + "Font glyphs corrupted or missing fields" ) + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/fterrors.h b/app/src/main/cpp/include/freetype2/freetype/fterrors.h new file mode 100644 index 0000000..7dc91eb --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/fterrors.h @@ -0,0 +1,207 @@ +/***************************************************************************/ +/* */ +/* fterrors.h */ +/* */ +/* FreeType error code handling (specification). */ +/* */ +/* Copyright 1996-2001, 2002, 2004, 2007 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +/*************************************************************************/ +/* */ +/* This special header file is used to define the handling of FT2 */ +/* enumeration constants. It can also be used to generate error message */ +/* strings with a small macro trick explained below. */ +/* */ +/* I - Error Formats */ +/* ----------------- */ +/* */ +/* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */ +/* defined in ftoption.h in order to make the higher byte indicate */ +/* the module where the error has happened (this is not compatible */ +/* with standard builds of FreeType 2). You can then use the macro */ +/* FT_ERROR_BASE macro to extract the generic error code from an */ +/* FT_Error value. */ +/* */ +/* */ +/* II - Error Message strings */ +/* -------------------------- */ +/* */ +/* The error definitions below are made through special macros that */ +/* allow client applications to build a table of error message strings */ +/* if they need it. The strings are not included in a normal build of */ +/* FreeType 2 to save space (most client applications do not use */ +/* them). */ +/* */ +/* To do so, you have to define the following macros before including */ +/* this file: */ +/* */ +/* FT_ERROR_START_LIST :: */ +/* This macro is called before anything else to define the start of */ +/* the error list. It is followed by several FT_ERROR_DEF calls */ +/* (see below). */ +/* */ +/* FT_ERROR_DEF( e, v, s ) :: */ +/* This macro is called to define one single error. */ +/* `e' is the error code identifier (e.g. FT_Err_Invalid_Argument). */ +/* `v' is the error numerical value. */ +/* `s' is the corresponding error string. */ +/* */ +/* FT_ERROR_END_LIST :: */ +/* This macro ends the list. */ +/* */ +/* Additionally, you have to undefine __FTERRORS_H__ before #including */ +/* this file. */ +/* */ +/* Here is a simple example: */ +/* */ +/* { */ +/* #undef __FTERRORS_H__ */ +/* #define FT_ERRORDEF( e, v, s ) { e, s }, */ +/* #define FT_ERROR_START_LIST { */ +/* #define FT_ERROR_END_LIST { 0, 0 } }; */ +/* */ +/* const struct */ +/* { */ +/* int err_code; */ +/* const char* err_msg; */ +/* } ft_errors[] = */ +/* */ +/* #include FT_ERRORS_H */ +/* } */ +/* */ +/*************************************************************************/ + + +#ifndef __FTERRORS_H__ +#define __FTERRORS_H__ + + +/* include module base error codes */ +#include FT_MODULE_ERRORS_H + + +/*******************************************************************/ +/*******************************************************************/ +/***** *****/ +/***** SETUP MACROS *****/ +/***** *****/ +/*******************************************************************/ +/*******************************************************************/ + + +#undef FT_NEED_EXTERN_C + +#undef FT_ERR_XCAT +#undef FT_ERR_CAT + +#define FT_ERR_XCAT(x, y) x ## y +#define FT_ERR_CAT(x, y) FT_ERR_XCAT( x, y ) + + +/* FT_ERR_PREFIX is used as a prefix for error identifiers. */ +/* By default, we use `FT_Err_'. */ +/* */ +#ifndef FT_ERR_PREFIX +#define FT_ERR_PREFIX FT_Err_ +#endif + + +/* FT_ERR_BASE is used as the base for module-specific errors. */ +/* */ +#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS + +#ifndef FT_ERR_BASE +#define FT_ERR_BASE FT_Mod_Err_Base +#endif + +#else + +#undef FT_ERR_BASE +#define FT_ERR_BASE 0 + +#endif /* FT_CONFIG_OPTION_USE_MODULE_ERRORS */ + + +/* If FT_ERRORDEF is not defined, we need to define a simple */ +/* enumeration type. */ +/* */ +#ifndef FT_ERRORDEF + +#define FT_ERRORDEF(e, v, s) e = v, +#define FT_ERROR_START_LIST enum { +#define FT_ERROR_END_LIST FT_ERR_CAT( FT_ERR_PREFIX, Max ) }; + +#ifdef __cplusplus +#define FT_NEED_EXTERN_C +extern "C" { +#endif + +#endif /* !FT_ERRORDEF */ + + +/* this macro is used to define an error */ +#define FT_ERRORDEF_(e, v, s) \ + FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s ) + +/* this is only used for <module>_Err_Ok, which must be 0! */ +#define FT_NOERRORDEF_(e, v, s) \ + FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s ) + + +#ifdef FT_ERROR_START_LIST +FT_ERROR_START_LIST +#endif + + + /* now include the error codes */ +#include FT_ERROR_DEFINITIONS_H + + +#ifdef FT_ERROR_END_LIST +FT_ERROR_END_LIST +#endif + + +/*******************************************************************/ +/*******************************************************************/ +/***** *****/ +/***** SIMPLE CLEANUP *****/ +/***** *****/ +/*******************************************************************/ +/*******************************************************************/ + +#ifdef FT_NEED_EXTERN_C +} +#endif + +#undef FT_ERROR_START_LIST +#undef FT_ERROR_END_LIST + +#undef FT_ERRORDEF +#undef FT_ERRORDEF_ +#undef FT_NOERRORDEF_ + +#undef FT_NEED_EXTERN_C +#undef FT_ERR_BASE + +/* FT_KEEP_ERR_PREFIX is needed for ftvalid.h */ +#ifndef FT_KEEP_ERR_PREFIX +#undef FT_ERR_PREFIX +#else +#undef FT_KEEP_ERR_PREFIX +#endif + +#endif /* __FTERRORS_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftgasp.h b/app/src/main/cpp/include/freetype2/freetype/ftgasp.h new file mode 100644 index 0000000..3404d88 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftgasp.h @@ -0,0 +1,130 @@ +/***************************************************************************/ +/* */ +/* ftgasp.h */ +/* */ +/* Access of TrueType's `gasp' table (specification). */ +/* */ +/* Copyright 2007, 2008, 2011 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef _FT_GASP_H_ +#define _FT_GASP_H_ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +/*************************************************************************** + * + * @section: + * gasp_table + * + * @title: + * Gasp Table + * + * @abstract: + * Retrieving TrueType `gasp' table entries. + * + * @description: + * The function @FT_Get_Gasp can be used to query a TrueType or OpenType + * font for specific entries in its `gasp' table, if any. This is + * mainly useful when implementing native TrueType hinting with the + * bytecode interpreter to duplicate the Windows text rendering results. + */ + +/************************************************************************* + * + * @enum: + * FT_GASP_XXX + * + * @description: + * A list of values and/or bit-flags returned by the @FT_Get_Gasp + * function. + * + * @values: + * FT_GASP_NO_TABLE :: + * This special value means that there is no GASP table in this face. + * It is up to the client to decide what to do. + * + * FT_GASP_DO_GRIDFIT :: + * Grid-fitting and hinting should be performed at the specified ppem. + * This *really* means TrueType bytecode interpretation. If this bit + * is not set, no hinting gets applied. + * + * FT_GASP_DO_GRAY :: + * Anti-aliased rendering should be performed at the specified ppem. + * If not set, do monochrome rendering. + * + * FT_GASP_SYMMETRIC_SMOOTHING :: + * If set, smoothing along multiple axes must be used with ClearType. + * + * FT_GASP_SYMMETRIC_GRIDFIT :: + * Grid-fitting must be used with ClearType's symmetric smoothing. + * + * @note: + * The bit-flags `FT_GASP_DO_GRIDFIT' and `FT_GASP_DO_GRAY' are to be + * used for standard font rasterization only. Independently of that, + * `FT_GASP_SYMMETRIC_SMOOTHING' and `FT_GASP_SYMMETRIC_GRIDFIT' are to + * be used if ClearType is enabled (and `FT_GASP_DO_GRIDFIT' and + * `FT_GASP_DO_GRAY' are consequently ignored). + * + * `ClearType' is Microsoft's implementation of LCD rendering, partly + * protected by patents. + * + * @since: + * 2.3.0 + */ +#define FT_GASP_NO_TABLE -1 +#define FT_GASP_DO_GRIDFIT 0x01 +#define FT_GASP_DO_GRAY 0x02 +#define FT_GASP_SYMMETRIC_SMOOTHING 0x08 +#define FT_GASP_SYMMETRIC_GRIDFIT 0x10 + + +/************************************************************************* + * + * @func: + * FT_Get_Gasp + * + * @description: + * Read the `gasp' table from a TrueType or OpenType font file and + * return the entry corresponding to a given character pixel size. + * + * @input: + * face :: The source face handle. + * ppem :: The vertical character pixel size. + * + * @return: + * Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no + * `gasp' table in the face. + * + * @since: + * 2.3.0 + */ +FT_EXPORT( FT_Int ) +FT_Get_Gasp( FT_Face +face, +FT_UInt ppem +); + +/* */ + +#endif /* _FT_GASP_H_ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftglyph.h b/app/src/main/cpp/include/freetype2/freetype/ftglyph.h new file mode 100644 index 0000000..a92abf7 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftglyph.h @@ -0,0 +1,632 @@ +/***************************************************************************/ +/* */ +/* ftglyph.h */ +/* */ +/* FreeType convenience functions to handle glyphs (specification). */ +/* */ +/* Copyright 1996-2003, 2006, 2008, 2009, 2011 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +/*************************************************************************/ +/* */ +/* This file contains the definition of several convenience functions */ +/* that can be used by client applications to easily retrieve glyph */ +/* bitmaps and outlines from a given face. */ +/* */ +/* These functions should be optional if you are writing a font server */ +/* or text layout engine on top of FreeType. However, they are pretty */ +/* handy for many other simple uses of the library. */ +/* */ +/*************************************************************************/ + + +#ifndef __FTGLYPH_H__ +#define __FTGLYPH_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* glyph_management */ +/* */ +/* <Title> */ +/* Glyph Management */ +/* */ +/* <Abstract> */ +/* Generic interface to manage individual glyph data. */ +/* */ +/* <Description> */ +/* This section contains definitions used to manage glyph data */ +/* through generic FT_Glyph objects. Each of them can contain a */ +/* bitmap, a vector outline, or even images in other formats. */ +/* */ +/*************************************************************************/ + + +/* forward declaration to a private type */ +typedef struct FT_Glyph_Class_ FT_Glyph_Class; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Glyph */ +/* */ +/* <Description> */ +/* Handle to an object used to model generic glyph images. It is a */ +/* pointer to the @FT_GlyphRec structure and can contain a glyph */ +/* bitmap or pointer. */ +/* */ +/* <Note> */ +/* Glyph objects are not owned by the library. You must thus release */ +/* them manually (through @FT_Done_Glyph) _before_ calling */ +/* @FT_Done_FreeType. */ +/* */ +typedef struct FT_GlyphRec_ *FT_Glyph; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_GlyphRec */ +/* */ +/* <Description> */ +/* The root glyph structure contains a given glyph image plus its */ +/* advance width in 16.16 fixed float format. */ +/* */ +/* <Fields> */ +/* library :: A handle to the FreeType library object. */ +/* */ +/* clazz :: A pointer to the glyph's class. Private. */ +/* */ +/* format :: The format of the glyph's image. */ +/* */ +/* advance :: A 16.16 vector that gives the glyph's advance width. */ +/* */ +typedef struct FT_GlyphRec_ { + FT_Library library; + const FT_Glyph_Class *clazz; + FT_Glyph_Format format; + FT_Vector advance; + +} FT_GlyphRec; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_BitmapGlyph */ +/* */ +/* <Description> */ +/* A handle to an object used to model a bitmap glyph image. This is */ +/* a sub-class of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec. */ +/* */ +typedef struct FT_BitmapGlyphRec_ *FT_BitmapGlyph; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_BitmapGlyphRec */ +/* */ +/* <Description> */ +/* A structure used for bitmap glyph images. This really is a */ +/* `sub-class' of @FT_GlyphRec. */ +/* */ +/* <Fields> */ +/* root :: The root @FT_Glyph fields. */ +/* */ +/* left :: The left-side bearing, i.e., the horizontal distance */ +/* from the current pen position to the left border of the */ +/* glyph bitmap. */ +/* */ +/* top :: The top-side bearing, i.e., the vertical distance from */ +/* the current pen position to the top border of the glyph */ +/* bitmap. This distance is positive for upwards~y! */ +/* */ +/* bitmap :: A descriptor for the bitmap. */ +/* */ +/* <Note> */ +/* You can typecast an @FT_Glyph to @FT_BitmapGlyph if you have */ +/* `glyph->format == FT_GLYPH_FORMAT_BITMAP'. This lets you access */ +/* the bitmap's contents easily. */ +/* */ +/* The corresponding pixel buffer is always owned by @FT_BitmapGlyph */ +/* and is thus created and destroyed with it. */ +/* */ +typedef struct FT_BitmapGlyphRec_ { + FT_GlyphRec root; + FT_Int left; + FT_Int top; + FT_Bitmap bitmap; + +} FT_BitmapGlyphRec; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_OutlineGlyph */ +/* */ +/* <Description> */ +/* A handle to an object used to model an outline glyph image. This */ +/* is a sub-class of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec. */ +/* */ +typedef struct FT_OutlineGlyphRec_ *FT_OutlineGlyph; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_OutlineGlyphRec */ +/* */ +/* <Description> */ +/* A structure used for outline (vectorial) glyph images. This */ +/* really is a `sub-class' of @FT_GlyphRec. */ +/* */ +/* <Fields> */ +/* root :: The root @FT_Glyph fields. */ +/* */ +/* outline :: A descriptor for the outline. */ +/* */ +/* <Note> */ +/* You can typecast an @FT_Glyph to @FT_OutlineGlyph if you have */ +/* `glyph->format == FT_GLYPH_FORMAT_OUTLINE'. This lets you access */ +/* the outline's content easily. */ +/* */ +/* As the outline is extracted from a glyph slot, its coordinates are */ +/* expressed normally in 26.6 pixels, unless the flag */ +/* @FT_LOAD_NO_SCALE was used in @FT_Load_Glyph() or @FT_Load_Char(). */ +/* */ +/* The outline's tables are always owned by the object and are */ +/* destroyed with it. */ +/* */ +typedef struct FT_OutlineGlyphRec_ { + FT_GlyphRec root; + FT_Outline outline; + +} FT_OutlineGlyphRec; + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_Glyph */ +/* */ +/* <Description> */ +/* A function used to extract a glyph image from a slot. Note that */ +/* the created @FT_Glyph object must be released with @FT_Done_Glyph. */ +/* */ +/* <Input> */ +/* slot :: A handle to the source glyph slot. */ +/* */ +/* <Output> */ +/* aglyph :: A handle to the glyph object. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Get_Glyph( FT_GlyphSlot +slot, +FT_Glyph *aglyph +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Glyph_Copy */ +/* */ +/* <Description> */ +/* A function used to copy a glyph image. Note that the created */ +/* @FT_Glyph object must be released with @FT_Done_Glyph. */ +/* */ +/* <Input> */ +/* source :: A handle to the source glyph object. */ +/* */ +/* <Output> */ +/* target :: A handle to the target glyph object. 0~in case of */ +/* error. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Glyph_Copy( FT_Glyph +source, +FT_Glyph *target +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Glyph_Transform */ +/* */ +/* <Description> */ +/* Transform a glyph image if its format is scalable. */ +/* */ +/* <InOut> */ +/* glyph :: A handle to the target glyph object. */ +/* */ +/* <Input> */ +/* matrix :: A pointer to a 2x2 matrix to apply. */ +/* */ +/* delta :: A pointer to a 2d vector to apply. Coordinates are */ +/* expressed in 1/64th of a pixel. */ +/* */ +/* <Return> */ +/* FreeType error code (if not 0, the glyph format is not scalable). */ +/* */ +/* <Note> */ +/* The 2x2 transformation matrix is also applied to the glyph's */ +/* advance vector. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Glyph_Transform( FT_Glyph +glyph, +FT_Matrix *matrix, + FT_Vector +* delta ); + + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* FT_Glyph_BBox_Mode */ +/* */ +/* <Description> */ +/* The mode how the values of @FT_Glyph_Get_CBox are returned. */ +/* */ +/* <Values> */ +/* FT_GLYPH_BBOX_UNSCALED :: */ +/* Return unscaled font units. */ +/* */ +/* FT_GLYPH_BBOX_SUBPIXELS :: */ +/* Return unfitted 26.6 coordinates. */ +/* */ +/* FT_GLYPH_BBOX_GRIDFIT :: */ +/* Return grid-fitted 26.6 coordinates. */ +/* */ +/* FT_GLYPH_BBOX_TRUNCATE :: */ +/* Return coordinates in integer pixels. */ +/* */ +/* FT_GLYPH_BBOX_PIXELS :: */ +/* Return grid-fitted pixel coordinates. */ +/* */ +typedef enum FT_Glyph_BBox_Mode_ { + FT_GLYPH_BBOX_UNSCALED = 0, + FT_GLYPH_BBOX_SUBPIXELS = 0, + FT_GLYPH_BBOX_GRIDFIT = 1, + FT_GLYPH_BBOX_TRUNCATE = 2, + FT_GLYPH_BBOX_PIXELS = 3 + +} FT_Glyph_BBox_Mode; + + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* ft_glyph_bbox_xxx */ +/* */ +/* <Description> */ +/* These constants are deprecated. Use the corresponding */ +/* @FT_Glyph_BBox_Mode values instead. */ +/* */ +/* <Values> */ +/* ft_glyph_bbox_unscaled :: See @FT_GLYPH_BBOX_UNSCALED. */ +/* ft_glyph_bbox_subpixels :: See @FT_GLYPH_BBOX_SUBPIXELS. */ +/* ft_glyph_bbox_gridfit :: See @FT_GLYPH_BBOX_GRIDFIT. */ +/* ft_glyph_bbox_truncate :: See @FT_GLYPH_BBOX_TRUNCATE. */ +/* ft_glyph_bbox_pixels :: See @FT_GLYPH_BBOX_PIXELS. */ +/* */ +#define ft_glyph_bbox_unscaled FT_GLYPH_BBOX_UNSCALED +#define ft_glyph_bbox_subpixels FT_GLYPH_BBOX_SUBPIXELS +#define ft_glyph_bbox_gridfit FT_GLYPH_BBOX_GRIDFIT +#define ft_glyph_bbox_truncate FT_GLYPH_BBOX_TRUNCATE +#define ft_glyph_bbox_pixels FT_GLYPH_BBOX_PIXELS + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Glyph_Get_CBox */ +/* */ +/* <Description> */ +/* Return a glyph's `control box'. The control box encloses all the */ +/* outline's points, including Bézier control points. Though it */ +/* coincides with the exact bounding box for most glyphs, it can be */ +/* slightly larger in some situations (like when rotating an outline */ +/* which contains Bézier outside arcs). */ +/* */ +/* Computing the control box is very fast, while getting the bounding */ +/* box can take much more time as it needs to walk over all segments */ +/* and arcs in the outline. To get the latter, you can use the */ +/* `ftbbox' component which is dedicated to this single task. */ +/* */ +/* <Input> */ +/* glyph :: A handle to the source glyph object. */ +/* */ +/* mode :: The mode which indicates how to interpret the returned */ +/* bounding box values. */ +/* */ +/* <Output> */ +/* acbox :: The glyph coordinate bounding box. Coordinates are */ +/* expressed in 1/64th of pixels if it is grid-fitted. */ +/* */ +/* <Note> */ +/* Coordinates are relative to the glyph origin, using the y~upwards */ +/* convention. */ +/* */ +/* If the glyph has been loaded with @FT_LOAD_NO_SCALE, `bbox_mode' */ +/* must be set to @FT_GLYPH_BBOX_UNSCALED to get unscaled font */ +/* units in 26.6 pixel format. The value @FT_GLYPH_BBOX_SUBPIXELS */ +/* is another name for this constant. */ +/* */ +/* If the font is tricky and the glyph has been loaded with */ +/* @FT_LOAD_NO_SCALE, the resulting CBox is meaningless. To get */ +/* reasonable values for the CBox it is necessary to load the glyph */ +/* at a large ppem value (so that the hinting instructions can */ +/* properly shift and scale the subglyphs), then extracting the CBox */ +/* which can be eventually converted back to font units. */ +/* */ +/* Note that the maximum coordinates are exclusive, which means that */ +/* one can compute the width and height of the glyph image (be it in */ +/* integer or 26.6 pixels) as: */ +/* */ +/* { */ +/* width = bbox.xMax - bbox.xMin; */ +/* height = bbox.yMax - bbox.yMin; */ +/* } */ +/* */ +/* Note also that for 26.6 coordinates, if `bbox_mode' is set to */ +/* @FT_GLYPH_BBOX_GRIDFIT, the coordinates will also be grid-fitted, */ +/* which corresponds to: */ +/* */ +/* { */ +/* bbox.xMin = FLOOR(bbox.xMin); */ +/* bbox.yMin = FLOOR(bbox.yMin); */ +/* bbox.xMax = CEILING(bbox.xMax); */ +/* bbox.yMax = CEILING(bbox.yMax); */ +/* } */ +/* */ +/* To get the bbox in pixel coordinates, set `bbox_mode' to */ +/* @FT_GLYPH_BBOX_TRUNCATE. */ +/* */ +/* To get the bbox in grid-fitted pixel coordinates, set `bbox_mode' */ +/* to @FT_GLYPH_BBOX_PIXELS. */ +/* */ +FT_EXPORT(void) + +FT_Glyph_Get_CBox( FT_Glyph +glyph, +FT_UInt bbox_mode, + FT_BBox +*acbox ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Glyph_To_Bitmap */ +/* */ +/* <Description> */ +/* Convert a given glyph object to a bitmap glyph object. */ +/* */ +/* <InOut> */ +/* the_glyph :: A pointer to a handle to the target glyph. */ +/* */ +/* <Input> */ +/* render_mode :: An enumeration that describes how the data is */ +/* rendered. */ +/* */ +/* origin :: A pointer to a vector used to translate the glyph */ +/* image before rendering. Can be~0 (if no */ +/* translation). The origin is expressed in */ +/* 26.6 pixels. */ +/* */ +/* destroy :: A boolean that indicates that the original glyph */ +/* image should be destroyed by this function. It is */ +/* never destroyed in case of error. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* This function does nothing if the glyph format isn't scalable. */ +/* */ +/* The glyph image is translated with the `origin' vector before */ +/* rendering. */ +/* */ +/* The first parameter is a pointer to an @FT_Glyph handle, that will */ +/* be _replaced_ by this function (with newly allocated data). */ +/* Typically, you would use (omitting error handling): */ +/* */ +/* */ +/* { */ +/* FT_Glyph glyph; */ +/* FT_BitmapGlyph glyph_bitmap; */ +/* */ +/* */ +/* // load glyph */ +/* error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAUT ); */ +/* */ +/* // extract glyph image */ +/* error = FT_Get_Glyph( face->glyph, &glyph ); */ +/* */ +/* // convert to a bitmap (default render mode + destroying old) */ +/* if ( glyph->format != FT_GLYPH_FORMAT_BITMAP ) */ +/* { */ +/* error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL, */ +/* 0, 1 ); */ +/* if ( error ) // `glyph' unchanged */ +/* ... */ +/* } */ +/* */ +/* // access bitmap content by typecasting */ +/* glyph_bitmap = (FT_BitmapGlyph)glyph; */ +/* */ +/* // do funny stuff with it, like blitting/drawing */ +/* ... */ +/* */ +/* // discard glyph image (bitmap or not) */ +/* FT_Done_Glyph( glyph ); */ +/* } */ +/* */ +/* */ +/* Here another example, again without error handling: */ +/* */ +/* */ +/* { */ +/* FT_Glyph glyphs[MAX_GLYPHS] */ +/* */ +/* */ +/* ... */ +/* */ +/* for ( idx = 0; i < MAX_GLYPHS; i++ ) */ +/* error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) || */ +/* FT_Get_Glyph ( face->glyph, &glyph[idx] ); */ +/* */ +/* ... */ +/* */ +/* for ( idx = 0; i < MAX_GLYPHS; i++ ) */ +/* { */ +/* FT_Glyph bitmap = glyphs[idx]; */ +/* */ +/* */ +/* ... */ +/* */ +/* // after this call, `bitmap' no longer points into */ +/* // the `glyphs' array (and the old value isn't destroyed) */ +/* FT_Glyph_To_Bitmap( &bitmap, FT_RENDER_MODE_MONO, 0, 0 ); */ +/* */ +/* ... */ +/* */ +/* FT_Done_Glyph( bitmap ); */ +/* } */ +/* */ +/* ... */ +/* */ +/* for ( idx = 0; i < MAX_GLYPHS; i++ ) */ +/* FT_Done_Glyph( glyphs[idx] ); */ +/* } */ +/* */ +FT_EXPORT( FT_Error ) +FT_Glyph_To_Bitmap( FT_Glyph +* the_glyph, +FT_Render_Mode render_mode, + FT_Vector +* origin, +FT_Bool destroy +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Done_Glyph */ +/* */ +/* <Description> */ +/* Destroy a given glyph. */ +/* */ +/* <Input> */ +/* glyph :: A handle to the target glyph object. */ +/* */ +FT_EXPORT(void) + +FT_Done_Glyph( FT_Glyph +glyph ); + +/* */ + + +/* other helpful functions */ + +/*************************************************************************/ +/* */ +/* <Section> */ +/* computations */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Matrix_Multiply */ +/* */ +/* <Description> */ +/* Perform the matrix operation `b = a*b'. */ +/* */ +/* <Input> */ +/* a :: A pointer to matrix `a'. */ +/* */ +/* <InOut> */ +/* b :: A pointer to matrix `b'. */ +/* */ +/* <Note> */ +/* The result is undefined if either `a' or `b' is zero. */ +/* */ +FT_EXPORT(void) + +FT_Matrix_Multiply(const FT_Matrix *a, + FT_Matrix *b); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Matrix_Invert */ +/* */ +/* <Description> */ +/* Invert a 2x2 matrix. Return an error if it can't be inverted. */ +/* */ +/* <InOut> */ +/* matrix :: A pointer to the target matrix. Remains untouched in */ +/* case of error. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Matrix_Invert( FT_Matrix +* matrix ); + + +/* */ + + +FT_END_HEADER + +#endif /* __FTGLYPH_H__ */ + + +/* END */ + + +/* Local Variables: */ +/* coding: utf-8 */ +/* End: */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftgxval.h b/app/src/main/cpp/include/freetype2/freetype/ftgxval.h new file mode 100644 index 0000000..9b637f5 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftgxval.h @@ -0,0 +1,370 @@ +/***************************************************************************/ +/* */ +/* ftgxval.h */ +/* */ +/* FreeType API for validating TrueTypeGX/AAT tables (specification). */ +/* */ +/* Copyright 2004, 2005, 2006 by */ +/* Masatake YAMATO, Redhat K.K, */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + +/***************************************************************************/ +/* */ +/* gxvalid is derived from both gxlayout module and otvalid module. */ +/* Development of gxlayout is supported by the Information-technology */ +/* Promotion Agency(IPA), Japan. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTGXVAL_H__ +#define __FTGXVAL_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* gx_validation */ +/* */ +/* <Title> */ +/* TrueTypeGX/AAT Validation */ +/* */ +/* <Abstract> */ +/* An API to validate TrueTypeGX/AAT tables. */ +/* */ +/* <Description> */ +/* This section contains the declaration of functions to validate */ +/* some TrueTypeGX tables (feat, mort, morx, bsln, just, kern, opbd, */ +/* trak, prop, lcar). */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* */ +/* Warning: Use FT_VALIDATE_XXX to validate a table. */ +/* Following definitions are for gxvalid developers. */ +/* */ +/* */ +/*************************************************************************/ + +#define FT_VALIDATE_feat_INDEX 0 +#define FT_VALIDATE_mort_INDEX 1 +#define FT_VALIDATE_morx_INDEX 2 +#define FT_VALIDATE_bsln_INDEX 3 +#define FT_VALIDATE_just_INDEX 4 +#define FT_VALIDATE_kern_INDEX 5 +#define FT_VALIDATE_opbd_INDEX 6 +#define FT_VALIDATE_trak_INDEX 7 +#define FT_VALIDATE_prop_INDEX 8 +#define FT_VALIDATE_lcar_INDEX 9 +#define FT_VALIDATE_GX_LAST_INDEX FT_VALIDATE_lcar_INDEX + + +/************************************************************************* + * + * @macro: + * FT_VALIDATE_GX_LENGTH + * + * @description: + * The number of tables checked in this module. Use it as a parameter + * for the `table-length' argument of function @FT_TrueTypeGX_Validate. + */ +#define FT_VALIDATE_GX_LENGTH (FT_VALIDATE_GX_LAST_INDEX + 1) + +/* */ + +/* Up to 0x1000 is used by otvalid. + Ox2xxx is reserved for feature OT extension. */ +#define FT_VALIDATE_GX_START 0x4000 +#define FT_VALIDATE_GX_BITFIELD(tag) \ + ( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX ) + + +/********************************************************************** + * + * @enum: + * FT_VALIDATE_GXXXX + * + * @description: + * A list of bit-field constants used with @FT_TrueTypeGX_Validate to + * indicate which TrueTypeGX/AAT Type tables should be validated. + * + * @values: + * FT_VALIDATE_feat :: + * Validate `feat' table. + * + * FT_VALIDATE_mort :: + * Validate `mort' table. + * + * FT_VALIDATE_morx :: + * Validate `morx' table. + * + * FT_VALIDATE_bsln :: + * Validate `bsln' table. + * + * FT_VALIDATE_just :: + * Validate `just' table. + * + * FT_VALIDATE_kern :: + * Validate `kern' table. + * + * FT_VALIDATE_opbd :: + * Validate `opbd' table. + * + * FT_VALIDATE_trak :: + * Validate `trak' table. + * + * FT_VALIDATE_prop :: + * Validate `prop' table. + * + * FT_VALIDATE_lcar :: + * Validate `lcar' table. + * + * FT_VALIDATE_GX :: + * Validate all TrueTypeGX tables (feat, mort, morx, bsln, just, kern, + * opbd, trak, prop and lcar). + * + */ + +#define FT_VALIDATE_feat FT_VALIDATE_GX_BITFIELD( feat ) +#define FT_VALIDATE_mort FT_VALIDATE_GX_BITFIELD( mort ) +#define FT_VALIDATE_morx FT_VALIDATE_GX_BITFIELD( morx ) +#define FT_VALIDATE_bsln FT_VALIDATE_GX_BITFIELD( bsln ) +#define FT_VALIDATE_just FT_VALIDATE_GX_BITFIELD( just ) +#define FT_VALIDATE_kern FT_VALIDATE_GX_BITFIELD( kern ) +#define FT_VALIDATE_opbd FT_VALIDATE_GX_BITFIELD( opbd ) +#define FT_VALIDATE_trak FT_VALIDATE_GX_BITFIELD( trak ) +#define FT_VALIDATE_prop FT_VALIDATE_GX_BITFIELD( prop ) +#define FT_VALIDATE_lcar FT_VALIDATE_GX_BITFIELD( lcar ) + +#define FT_VALIDATE_GX ( FT_VALIDATE_feat | \ + FT_VALIDATE_mort | \ + FT_VALIDATE_morx | \ + FT_VALIDATE_bsln | \ + FT_VALIDATE_just | \ + FT_VALIDATE_kern | \ + FT_VALIDATE_opbd | \ + FT_VALIDATE_trak | \ + FT_VALIDATE_prop | \ + FT_VALIDATE_lcar ) + + +/* */ + +/********************************************************************** + * + * @function: + * FT_TrueTypeGX_Validate + * + * @description: + * Validate various TrueTypeGX tables to assure that all offsets and + * indices are valid. The idea is that a higher-level library which + * actually does the text layout can access those tables without + * error checking (which can be quite time consuming). + * + * @input: + * face :: + * A handle to the input face. + * + * validation_flags :: + * A bit field which specifies the tables to be validated. See + * @FT_VALIDATE_GXXXX for possible values. + * + * table_length :: + * The size of the `tables' array. Normally, @FT_VALIDATE_GX_LENGTH + * should be passed. + * + * @output: + * tables :: + * The array where all validated sfnt tables are stored. + * The array itself must be allocated by a client. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function only works with TrueTypeGX fonts, returning an error + * otherwise. + * + * After use, the application should deallocate the buffers pointed to by + * each `tables' element, by calling @FT_TrueTypeGX_Free. A NULL value + * indicates that the table either doesn't exist in the font, the + * application hasn't asked for validation, or the validator doesn't have + * the ability to validate the sfnt table. + */ +FT_EXPORT(FT_Error) + +FT_TrueTypeGX_Validate( FT_Face +face, +FT_UInt validation_flags, + FT_Bytes +tables[FT_VALIDATE_GX_LENGTH], +FT_UInt table_length +); + + +/* */ + +/********************************************************************** + * + * @function: + * FT_TrueTypeGX_Free + * + * @description: + * Free the buffer allocated by TrueTypeGX validator. + * + * @input: + * face :: + * A handle to the input face. + * + * table :: + * The pointer to the buffer allocated by + * @FT_TrueTypeGX_Validate. + * + * @note: + * This function must be used to free the buffer allocated by + * @FT_TrueTypeGX_Validate only. + */ +FT_EXPORT(void) + +FT_TrueTypeGX_Free( FT_Face +face, +FT_Bytes table +); + + +/* */ + +/********************************************************************** + * + * @enum: + * FT_VALIDATE_CKERNXXX + * + * @description: + * A list of bit-field constants used with @FT_ClassicKern_Validate + * to indicate the classic kern dialect or dialects. If the selected + * type doesn't fit, @FT_ClassicKern_Validate regards the table as + * invalid. + * + * @values: + * FT_VALIDATE_MS :: + * Handle the `kern' table as a classic Microsoft kern table. + * + * FT_VALIDATE_APPLE :: + * Handle the `kern' table as a classic Apple kern table. + * + * FT_VALIDATE_CKERN :: + * Handle the `kern' as either classic Apple or Microsoft kern table. + */ +#define FT_VALIDATE_MS ( FT_VALIDATE_GX_START << 0 ) +#define FT_VALIDATE_APPLE ( FT_VALIDATE_GX_START << 1 ) + +#define FT_VALIDATE_CKERN ( FT_VALIDATE_MS | FT_VALIDATE_APPLE ) + + +/* */ + +/********************************************************************** + * + * @function: + * FT_ClassicKern_Validate + * + * @description: + * Validate classic (16-bit format) kern table to assure that the offsets + * and indices are valid. The idea is that a higher-level library which + * actually does the text layout can access those tables without error + * checking (which can be quite time consuming). + * + * The `kern' table validator in @FT_TrueTypeGX_Validate deals with both + * the new 32-bit format and the classic 16-bit format, while + * FT_ClassicKern_Validate only supports the classic 16-bit format. + * + * @input: + * face :: + * A handle to the input face. + * + * validation_flags :: + * A bit field which specifies the dialect to be validated. See + * @FT_VALIDATE_CKERNXXX for possible values. + * + * @output: + * ckern_table :: + * A pointer to the kern table. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * After use, the application should deallocate the buffers pointed to by + * `ckern_table', by calling @FT_ClassicKern_Free. A NULL value + * indicates that the table doesn't exist in the font. + */ +FT_EXPORT( FT_Error ) +FT_ClassicKern_Validate( FT_Face +face, +FT_UInt validation_flags, + FT_Bytes +*ckern_table ); + + +/* */ + +/********************************************************************** + * + * @function: + * FT_ClassicKern_Free + * + * @description: + * Free the buffer allocated by classic Kern validator. + * + * @input: + * face :: + * A handle to the input face. + * + * table :: + * The pointer to the buffer that is allocated by + * @FT_ClassicKern_Validate. + * + * @note: + * This function must be used to free the buffer allocated by + * @FT_ClassicKern_Validate only. + */ +FT_EXPORT(void) + +FT_ClassicKern_Free( FT_Face +face, +FT_Bytes table +); + + +/* */ + + +FT_END_HEADER + +#endif /* __FTGXVAL_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftgzip.h b/app/src/main/cpp/include/freetype2/freetype/ftgzip.h new file mode 100644 index 0000000..0952f17 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftgzip.h @@ -0,0 +1,105 @@ +/***************************************************************************/ +/* */ +/* ftgzip.h */ +/* */ +/* Gzip-compressed stream support. */ +/* */ +/* Copyright 2002, 2003, 2004, 2006 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTGZIP_H__ +#define __FTGZIP_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + +/*************************************************************************/ +/* */ +/* <Section> */ +/* gzip */ +/* */ +/* <Title> */ +/* GZIP Streams */ +/* */ +/* <Abstract> */ +/* Using gzip-compressed font files. */ +/* */ +/* <Description> */ +/* This section contains the declaration of Gzip-specific functions. */ +/* */ +/*************************************************************************/ + + +/************************************************************************ + * + * @function: + * FT_Stream_OpenGzip + * + * @description: + * Open a new stream to parse gzip-compressed font files. This is + * mainly used to support the compressed `*.pcf.gz' fonts that come + * with XFree86. + * + * @input: + * stream :: + * The target embedding stream. + * + * source :: + * The source stream. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The source stream must be opened _before_ calling this function. + * + * Calling the internal function `FT_Stream_Close' on the new stream will + * *not* call `FT_Stream_Close' on the source stream. None of the stream + * objects will be released to the heap. + * + * The stream implementation is very basic and resets the decompression + * process each time seeking backwards is needed within the stream. + * + * In certain builds of the library, gzip compression recognition is + * automatically handled when calling @FT_New_Face or @FT_Open_Face. + * This means that if no font driver is capable of handling the raw + * compressed file, the library will try to open a gzipped stream from + * it and re-open the face with it. + * + * This function may return `FT_Err_Unimplemented_Feature' if your build + * of FreeType was not compiled with zlib support. + */ +FT_EXPORT(FT_Error) + +FT_Stream_OpenGzip( FT_Stream +stream, +FT_Stream source +); + +/* */ + + +FT_END_HEADER + +#endif /* __FTGZIP_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftimage.h b/app/src/main/cpp/include/freetype2/freetype/ftimage.h new file mode 100644 index 0000000..5b35f9a --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftimage.h @@ -0,0 +1,1305 @@ +/***************************************************************************/ +/* */ +/* ftimage.h */ +/* */ +/* FreeType glyph image formats and default raster interface */ +/* (specification). */ +/* */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ +/* 2010 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + +/*************************************************************************/ +/* */ +/* Note: A `raster' is simply a scan-line converter, used to render */ +/* FT_Outlines into FT_Bitmaps. */ +/* */ +/*************************************************************************/ + + +#ifndef __FTIMAGE_H__ +#define __FTIMAGE_H__ + + +/* _STANDALONE_ is from ftgrays.c */ +#ifndef _STANDALONE_ + +#include <ft2build.h> + +#endif + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* basic_types */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Pos */ +/* */ +/* <Description> */ +/* The type FT_Pos is used to store vectorial coordinates. Depending */ +/* on the context, these can represent distances in integer font */ +/* units, or 16.16, or 26.6 fixed float pixel coordinates. */ +/* */ +typedef signed long FT_Pos; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Vector */ +/* */ +/* <Description> */ +/* A simple structure used to store a 2D vector; coordinates are of */ +/* the FT_Pos type. */ +/* */ +/* <Fields> */ +/* x :: The horizontal coordinate. */ +/* y :: The vertical coordinate. */ +/* */ +typedef struct FT_Vector_ { + FT_Pos x; + FT_Pos y; + +} FT_Vector; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_BBox */ +/* */ +/* <Description> */ +/* A structure used to hold an outline's bounding box, i.e., the */ +/* coordinates of its extrema in the horizontal and vertical */ +/* directions. */ +/* */ +/* <Fields> */ +/* xMin :: The horizontal minimum (left-most). */ +/* */ +/* yMin :: The vertical minimum (bottom-most). */ +/* */ +/* xMax :: The horizontal maximum (right-most). */ +/* */ +/* yMax :: The vertical maximum (top-most). */ +/* */ +/* <Note> */ +/* The bounding box is specified with the coordinates of the lower */ +/* left and the upper right corner. In PostScript, those values are */ +/* often called (llx,lly) and (urx,ury), respectively. */ +/* */ +/* If `yMin' is negative, this value gives the glyph's descender. */ +/* Otherwise, the glyph doesn't descend below the baseline. */ +/* Similarly, if `ymax' is positive, this value gives the glyph's */ +/* ascender. */ +/* */ +/* `xMin' gives the horizontal distance from the glyph's origin to */ +/* the left edge of the glyph's bounding box. If `xMin' is negative, */ +/* the glyph extends to the left of the origin. */ +/* */ +typedef struct FT_BBox_ { + FT_Pos xMin, yMin; + FT_Pos xMax, yMax; + +} FT_BBox; + + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* FT_Pixel_Mode */ +/* */ +/* <Description> */ +/* An enumeration type used to describe the format of pixels in a */ +/* given bitmap. Note that additional formats may be added in the */ +/* future. */ +/* */ +/* <Values> */ +/* FT_PIXEL_MODE_NONE :: */ +/* Value~0 is reserved. */ +/* */ +/* FT_PIXEL_MODE_MONO :: */ +/* A monochrome bitmap, using 1~bit per pixel. Note that pixels */ +/* are stored in most-significant order (MSB), which means that */ +/* the left-most pixel in a byte has value 128. */ +/* */ +/* FT_PIXEL_MODE_GRAY :: */ +/* An 8-bit bitmap, generally used to represent anti-aliased glyph */ +/* images. Each pixel is stored in one byte. Note that the number */ +/* of `gray' levels is stored in the `num_grays' field of the */ +/* @FT_Bitmap structure (it generally is 256). */ +/* */ +/* FT_PIXEL_MODE_GRAY2 :: */ +/* A 2-bit per pixel bitmap, used to represent embedded */ +/* anti-aliased bitmaps in font files according to the OpenType */ +/* specification. We haven't found a single font using this */ +/* format, however. */ +/* */ +/* FT_PIXEL_MODE_GRAY4 :: */ +/* A 4-bit per pixel bitmap, representing embedded anti-aliased */ +/* bitmaps in font files according to the OpenType specification. */ +/* We haven't found a single font using this format, however. */ +/* */ +/* FT_PIXEL_MODE_LCD :: */ +/* An 8-bit bitmap, representing RGB or BGR decimated glyph images */ +/* used for display on LCD displays; the bitmap is three times */ +/* wider than the original glyph image. See also */ +/* @FT_RENDER_MODE_LCD. */ +/* */ +/* FT_PIXEL_MODE_LCD_V :: */ +/* An 8-bit bitmap, representing RGB or BGR decimated glyph images */ +/* used for display on rotated LCD displays; the bitmap is three */ +/* times taller than the original glyph image. See also */ +/* @FT_RENDER_MODE_LCD_V. */ +/* */ +typedef enum FT_Pixel_Mode_ { + FT_PIXEL_MODE_NONE = 0, + FT_PIXEL_MODE_MONO, + FT_PIXEL_MODE_GRAY, + FT_PIXEL_MODE_GRAY2, + FT_PIXEL_MODE_GRAY4, + FT_PIXEL_MODE_LCD, + FT_PIXEL_MODE_LCD_V, + + FT_PIXEL_MODE_MAX /* do not remove */ + +} FT_Pixel_Mode; + + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* ft_pixel_mode_xxx */ +/* */ +/* <Description> */ +/* A list of deprecated constants. Use the corresponding */ +/* @FT_Pixel_Mode values instead. */ +/* */ +/* <Values> */ +/* ft_pixel_mode_none :: See @FT_PIXEL_MODE_NONE. */ +/* ft_pixel_mode_mono :: See @FT_PIXEL_MODE_MONO. */ +/* ft_pixel_mode_grays :: See @FT_PIXEL_MODE_GRAY. */ +/* ft_pixel_mode_pal2 :: See @FT_PIXEL_MODE_GRAY2. */ +/* ft_pixel_mode_pal4 :: See @FT_PIXEL_MODE_GRAY4. */ +/* */ +#define ft_pixel_mode_none FT_PIXEL_MODE_NONE +#define ft_pixel_mode_mono FT_PIXEL_MODE_MONO +#define ft_pixel_mode_grays FT_PIXEL_MODE_GRAY +#define ft_pixel_mode_pal2 FT_PIXEL_MODE_GRAY2 +#define ft_pixel_mode_pal4 FT_PIXEL_MODE_GRAY4 + +/* */ + +#if 0 + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* FT_Palette_Mode */ +/* */ +/* <Description> */ +/* THIS TYPE IS DEPRECATED. DO NOT USE IT! */ +/* */ +/* An enumeration type to describe the format of a bitmap palette, */ +/* used with ft_pixel_mode_pal4 and ft_pixel_mode_pal8. */ +/* */ +/* <Values> */ +/* ft_palette_mode_rgb :: The palette is an array of 3-byte RGB */ +/* records. */ +/* */ +/* ft_palette_mode_rgba :: The palette is an array of 4-byte RGBA */ +/* records. */ +/* */ +/* <Note> */ +/* As ft_pixel_mode_pal2, pal4 and pal8 are currently unused by */ +/* FreeType, these types are not handled by the library itself. */ +/* */ +typedef enum FT_Palette_Mode_ +{ + ft_palette_mode_rgb = 0, + ft_palette_mode_rgba, + + ft_palette_mode_max /* do not remove */ + +} FT_Palette_Mode; + +/* */ + +#endif + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Bitmap */ +/* */ +/* <Description> */ +/* A structure used to describe a bitmap or pixmap to the raster. */ +/* Note that we now manage pixmaps of various depths through the */ +/* `pixel_mode' field. */ +/* */ +/* <Fields> */ +/* rows :: The number of bitmap rows. */ +/* */ +/* width :: The number of pixels in bitmap row. */ +/* */ +/* pitch :: The pitch's absolute value is the number of bytes */ +/* taken by one bitmap row, including padding. */ +/* However, the pitch is positive when the bitmap has */ +/* a `down' flow, and negative when it has an `up' */ +/* flow. In all cases, the pitch is an offset to add */ +/* to a bitmap pointer in order to go down one row. */ +/* */ +/* Note that `padding' means the alignment of a */ +/* bitmap to a byte border, and FreeType functions */ +/* normally align to the smallest possible integer */ +/* value. */ +/* */ +/* For the B/W rasterizer, `pitch' is always an even */ +/* number. */ +/* */ +/* To change the pitch of a bitmap (say, to make it a */ +/* multiple of 4), use @FT_Bitmap_Convert. */ +/* Alternatively, you might use callback functions to */ +/* directly render to the application's surface; see */ +/* the file `example2.cpp' in the tutorial for a */ +/* demonstration. */ +/* */ +/* buffer :: A typeless pointer to the bitmap buffer. This */ +/* value should be aligned on 32-bit boundaries in */ +/* most cases. */ +/* */ +/* num_grays :: This field is only used with */ +/* @FT_PIXEL_MODE_GRAY; it gives the number of gray */ +/* levels used in the bitmap. */ +/* */ +/* pixel_mode :: The pixel mode, i.e., how pixel bits are stored. */ +/* See @FT_Pixel_Mode for possible values. */ +/* */ +/* palette_mode :: This field is intended for paletted pixel modes; */ +/* it indicates how the palette is stored. Not */ +/* used currently. */ +/* */ +/* palette :: A typeless pointer to the bitmap palette; this */ +/* field is intended for paletted pixel modes. Not */ +/* used currently. */ +/* */ +/* <Note> */ +/* For now, the only pixel modes supported by FreeType are mono and */ +/* grays. However, drivers might be added in the future to support */ +/* more `colorful' options. */ +/* */ +typedef struct FT_Bitmap_ { + int rows; + int width; + int pitch; + unsigned char *buffer; + short num_grays; + char pixel_mode; + char palette_mode; + void *palette; + +} FT_Bitmap; + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* outline_processing */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Outline */ +/* */ +/* <Description> */ +/* This structure is used to describe an outline to the scan-line */ +/* converter. */ +/* */ +/* <Fields> */ +/* n_contours :: The number of contours in the outline. */ +/* */ +/* n_points :: The number of points in the outline. */ +/* */ +/* points :: A pointer to an array of `n_points' @FT_Vector */ +/* elements, giving the outline's point coordinates. */ +/* */ +/* tags :: A pointer to an array of `n_points' chars, giving */ +/* each outline point's type. */ +/* */ +/* If bit~0 is unset, the point is `off' the curve, */ +/* i.e., a Bézier control point, while it is `on' if */ +/* set. */ +/* */ +/* Bit~1 is meaningful for `off' points only. If set, */ +/* it indicates a third-order Bézier arc control point; */ +/* and a second-order control point if unset. */ +/* */ +/* If bit~2 is set, bits 5-7 contain the drop-out mode */ +/* (as defined in the OpenType specification; the value */ +/* is the same as the argument to the SCANMODE */ +/* instruction). */ +/* */ +/* Bits 3 and~4 are reserved for internal purposes. */ +/* */ +/* contours :: An array of `n_contours' shorts, giving the end */ +/* point of each contour within the outline. For */ +/* example, the first contour is defined by the points */ +/* `0' to `contours[0]', the second one is defined by */ +/* the points `contours[0]+1' to `contours[1]', etc. */ +/* */ +/* flags :: A set of bit flags used to characterize the outline */ +/* and give hints to the scan-converter and hinter on */ +/* how to convert/grid-fit it. See @FT_OUTLINE_FLAGS. */ +/* */ +/* <Note> */ +/* The B/W rasterizer only checks bit~2 in the `tags' array for the */ +/* first point of each contour. The drop-out mode as given with */ +/* @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and */ +/* @FT_OUTLINE_INCLUDE_STUBS in `flags' is then overridden. */ +/* */ +typedef struct FT_Outline_ { + short n_contours; /* number of contours in glyph */ + short n_points; /* number of points in the glyph */ + + FT_Vector *points; /* the outline's points */ + char *tags; /* the points flags */ + short *contours; /* the contour end points */ + + int flags; /* outline masks */ + +} FT_Outline; + +/* Following limits must be consistent with */ +/* FT_Outline.{n_contours,n_points} */ +#define FT_OUTLINE_CONTOURS_MAX SHRT_MAX +#define FT_OUTLINE_POINTS_MAX SHRT_MAX + + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* FT_OUTLINE_FLAGS */ +/* */ +/* <Description> */ +/* A list of bit-field constants use for the flags in an outline's */ +/* `flags' field. */ +/* */ +/* <Values> */ +/* FT_OUTLINE_NONE :: */ +/* Value~0 is reserved. */ +/* */ +/* FT_OUTLINE_OWNER :: */ +/* If set, this flag indicates that the outline's field arrays */ +/* (i.e., `points', `flags', and `contours') are `owned' by the */ +/* outline object, and should thus be freed when it is destroyed. */ +/* */ +/* FT_OUTLINE_EVEN_ODD_FILL :: */ +/* By default, outlines are filled using the non-zero winding rule. */ +/* If set to 1, the outline will be filled using the even-odd fill */ +/* rule (only works with the smooth rasterizer). */ +/* */ +/* FT_OUTLINE_REVERSE_FILL :: */ +/* By default, outside contours of an outline are oriented in */ +/* clock-wise direction, as defined in the TrueType specification. */ +/* This flag is set if the outline uses the opposite direction */ +/* (typically for Type~1 fonts). This flag is ignored by the scan */ +/* converter. */ +/* */ +/* FT_OUTLINE_IGNORE_DROPOUTS :: */ +/* By default, the scan converter will try to detect drop-outs in */ +/* an outline and correct the glyph bitmap to ensure consistent */ +/* shape continuity. If set, this flag hints the scan-line */ +/* converter to ignore such cases. See below for more information. */ +/* */ +/* FT_OUTLINE_SMART_DROPOUTS :: */ +/* Select smart dropout control. If unset, use simple dropout */ +/* control. Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See */ +/* below for more information. */ +/* */ +/* FT_OUTLINE_INCLUDE_STUBS :: */ +/* If set, turn pixels on for `stubs', otherwise exclude them. */ +/* Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See below for */ +/* more information. */ +/* */ +/* FT_OUTLINE_HIGH_PRECISION :: */ +/* This flag indicates that the scan-line converter should try to */ +/* convert this outline to bitmaps with the highest possible */ +/* quality. It is typically set for small character sizes. Note */ +/* that this is only a hint that might be completely ignored by a */ +/* given scan-converter. */ +/* */ +/* FT_OUTLINE_SINGLE_PASS :: */ +/* This flag is set to force a given scan-converter to only use a */ +/* single pass over the outline to render a bitmap glyph image. */ +/* Normally, it is set for very large character sizes. It is only */ +/* a hint that might be completely ignored by a given */ +/* scan-converter. */ +/* */ +/* <Note> */ +/* The flags @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, */ +/* and @FT_OUTLINE_INCLUDE_STUBS are ignored by the smooth */ +/* rasterizer. */ +/* */ +/* There exists a second mechanism to pass the drop-out mode to the */ +/* B/W rasterizer; see the `tags' field in @FT_Outline. */ +/* */ +/* Please refer to the description of the `SCANTYPE' instruction in */ +/* the OpenType specification (in file `ttinst1.doc') how simple */ +/* drop-outs, smart drop-outs, and stubs are defined. */ +/* */ +#define FT_OUTLINE_NONE 0x0 +#define FT_OUTLINE_OWNER 0x1 +#define FT_OUTLINE_EVEN_ODD_FILL 0x2 +#define FT_OUTLINE_REVERSE_FILL 0x4 +#define FT_OUTLINE_IGNORE_DROPOUTS 0x8 +#define FT_OUTLINE_SMART_DROPOUTS 0x10 +#define FT_OUTLINE_INCLUDE_STUBS 0x20 + +#define FT_OUTLINE_HIGH_PRECISION 0x100 +#define FT_OUTLINE_SINGLE_PASS 0x200 + + +/************************************************************************* + * + * @enum: + * ft_outline_flags + * + * @description: + * These constants are deprecated. Please use the corresponding + * @FT_OUTLINE_FLAGS values. + * + * @values: + * ft_outline_none :: See @FT_OUTLINE_NONE. + * ft_outline_owner :: See @FT_OUTLINE_OWNER. + * ft_outline_even_odd_fill :: See @FT_OUTLINE_EVEN_ODD_FILL. + * ft_outline_reverse_fill :: See @FT_OUTLINE_REVERSE_FILL. + * ft_outline_ignore_dropouts :: See @FT_OUTLINE_IGNORE_DROPOUTS. + * ft_outline_high_precision :: See @FT_OUTLINE_HIGH_PRECISION. + * ft_outline_single_pass :: See @FT_OUTLINE_SINGLE_PASS. + */ +#define ft_outline_none FT_OUTLINE_NONE +#define ft_outline_owner FT_OUTLINE_OWNER +#define ft_outline_even_odd_fill FT_OUTLINE_EVEN_ODD_FILL +#define ft_outline_reverse_fill FT_OUTLINE_REVERSE_FILL +#define ft_outline_ignore_dropouts FT_OUTLINE_IGNORE_DROPOUTS +#define ft_outline_high_precision FT_OUTLINE_HIGH_PRECISION +#define ft_outline_single_pass FT_OUTLINE_SINGLE_PASS + +/* */ + +#define FT_CURVE_TAG(flag) ( flag & 3 ) + +#define FT_CURVE_TAG_ON 1 +#define FT_CURVE_TAG_CONIC 0 +#define FT_CURVE_TAG_CUBIC 2 + +#define FT_CURVE_TAG_HAS_SCANMODE 4 + +#define FT_CURVE_TAG_TOUCH_X 8 /* reserved for the TrueType hinter */ +#define FT_CURVE_TAG_TOUCH_Y 16 /* reserved for the TrueType hinter */ + +#define FT_CURVE_TAG_TOUCH_BOTH ( FT_CURVE_TAG_TOUCH_X | \ + FT_CURVE_TAG_TOUCH_Y ) + +#define FT_Curve_Tag_On FT_CURVE_TAG_ON +#define FT_Curve_Tag_Conic FT_CURVE_TAG_CONIC +#define FT_Curve_Tag_Cubic FT_CURVE_TAG_CUBIC +#define FT_Curve_Tag_Touch_X FT_CURVE_TAG_TOUCH_X +#define FT_Curve_Tag_Touch_Y FT_CURVE_TAG_TOUCH_Y + + +/*************************************************************************/ +/* */ +/* <FuncType> */ +/* FT_Outline_MoveToFunc */ +/* */ +/* <Description> */ +/* A function pointer type used to describe the signature of a `move */ +/* to' function during outline walking/decomposition. */ +/* */ +/* A `move to' is emitted to start a new contour in an outline. */ +/* */ +/* <Input> */ +/* to :: A pointer to the target point of the `move to'. */ +/* */ +/* user :: A typeless pointer which is passed from the caller of the */ +/* decomposition function. */ +/* */ +/* <Return> */ +/* Error code. 0~means success. */ +/* */ +typedef int +(*FT_Outline_MoveToFunc)(const FT_Vector *to, + void *user); + +#define FT_Outline_MoveTo_Func FT_Outline_MoveToFunc + + +/*************************************************************************/ +/* */ +/* <FuncType> */ +/* FT_Outline_LineToFunc */ +/* */ +/* <Description> */ +/* A function pointer type used to describe the signature of a `line */ +/* to' function during outline walking/decomposition. */ +/* */ +/* A `line to' is emitted to indicate a segment in the outline. */ +/* */ +/* <Input> */ +/* to :: A pointer to the target point of the `line to'. */ +/* */ +/* user :: A typeless pointer which is passed from the caller of the */ +/* decomposition function. */ +/* */ +/* <Return> */ +/* Error code. 0~means success. */ +/* */ +typedef int +(*FT_Outline_LineToFunc)(const FT_Vector *to, + void *user); + +#define FT_Outline_LineTo_Func FT_Outline_LineToFunc + + +/*************************************************************************/ +/* */ +/* <FuncType> */ +/* FT_Outline_ConicToFunc */ +/* */ +/* <Description> */ +/* A function pointer type used to describe the signature of a `conic */ +/* to' function during outline walking or decomposition. */ +/* */ +/* A `conic to' is emitted to indicate a second-order Bézier arc in */ +/* the outline. */ +/* */ +/* <Input> */ +/* control :: An intermediate control point between the last position */ +/* and the new target in `to'. */ +/* */ +/* to :: A pointer to the target end point of the conic arc. */ +/* */ +/* user :: A typeless pointer which is passed from the caller of */ +/* the decomposition function. */ +/* */ +/* <Return> */ +/* Error code. 0~means success. */ +/* */ +typedef int +(*FT_Outline_ConicToFunc)(const FT_Vector *control, + const FT_Vector *to, + void *user); + +#define FT_Outline_ConicTo_Func FT_Outline_ConicToFunc + + +/*************************************************************************/ +/* */ +/* <FuncType> */ +/* FT_Outline_CubicToFunc */ +/* */ +/* <Description> */ +/* A function pointer type used to describe the signature of a `cubic */ +/* to' function during outline walking or decomposition. */ +/* */ +/* A `cubic to' is emitted to indicate a third-order Bézier arc. */ +/* */ +/* <Input> */ +/* control1 :: A pointer to the first Bézier control point. */ +/* */ +/* control2 :: A pointer to the second Bézier control point. */ +/* */ +/* to :: A pointer to the target end point. */ +/* */ +/* user :: A typeless pointer which is passed from the caller of */ +/* the decomposition function. */ +/* */ +/* <Return> */ +/* Error code. 0~means success. */ +/* */ +typedef int +(*FT_Outline_CubicToFunc)(const FT_Vector *control1, + const FT_Vector *control2, + const FT_Vector *to, + void *user); + +#define FT_Outline_CubicTo_Func FT_Outline_CubicToFunc + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Outline_Funcs */ +/* */ +/* <Description> */ +/* A structure to hold various function pointers used during outline */ +/* decomposition in order to emit segments, conic, and cubic Béziers. */ +/* */ +/* <Fields> */ +/* move_to :: The `move to' emitter. */ +/* */ +/* line_to :: The segment emitter. */ +/* */ +/* conic_to :: The second-order Bézier arc emitter. */ +/* */ +/* cubic_to :: The third-order Bézier arc emitter. */ +/* */ +/* shift :: The shift that is applied to coordinates before they */ +/* are sent to the emitter. */ +/* */ +/* delta :: The delta that is applied to coordinates before they */ +/* are sent to the emitter, but after the shift. */ +/* */ +/* <Note> */ +/* The point coordinates sent to the emitters are the transformed */ +/* version of the original coordinates (this is important for high */ +/* accuracy during scan-conversion). The transformation is simple: */ +/* */ +/* { */ +/* x' = (x << shift) - delta */ +/* y' = (x << shift) - delta */ +/* } */ +/* */ +/* Set the values of `shift' and `delta' to~0 to get the original */ +/* point coordinates. */ +/* */ +typedef struct FT_Outline_Funcs_ { + FT_Outline_MoveToFunc move_to; + FT_Outline_LineToFunc line_to; + FT_Outline_ConicToFunc conic_to; + FT_Outline_CubicToFunc cubic_to; + + int shift; + FT_Pos delta; + +} FT_Outline_Funcs; + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* basic_types */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Macro> */ +/* FT_IMAGE_TAG */ +/* */ +/* <Description> */ +/* This macro converts four-letter tags to an unsigned long type. */ +/* */ +/* <Note> */ +/* Since many 16-bit compilers don't like 32-bit enumerations, you */ +/* should redefine this macro in case of problems to something like */ +/* this: */ +/* */ +/* { */ +/* #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) value */ +/* } */ +/* */ +/* to get a simple enumeration without assigning special numbers. */ +/* */ +#ifndef FT_IMAGE_TAG +#define FT_IMAGE_TAG(value, _x1, _x2, _x3, _x4) \ + value = ( ( (unsigned long)_x1 << 24 ) | \ + ( (unsigned long)_x2 << 16 ) | \ + ( (unsigned long)_x3 << 8 ) | \ + (unsigned long)_x4 ) +#endif /* FT_IMAGE_TAG */ + + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* FT_Glyph_Format */ +/* */ +/* <Description> */ +/* An enumeration type used to describe the format of a given glyph */ +/* image. Note that this version of FreeType only supports two image */ +/* formats, even though future font drivers will be able to register */ +/* their own format. */ +/* */ +/* <Values> */ +/* FT_GLYPH_FORMAT_NONE :: */ +/* The value~0 is reserved. */ +/* */ +/* FT_GLYPH_FORMAT_COMPOSITE :: */ +/* The glyph image is a composite of several other images. This */ +/* format is _only_ used with @FT_LOAD_NO_RECURSE, and is used to */ +/* report compound glyphs (like accented characters). */ +/* */ +/* FT_GLYPH_FORMAT_BITMAP :: */ +/* The glyph image is a bitmap, and can be described as an */ +/* @FT_Bitmap. You generally need to access the `bitmap' field of */ +/* the @FT_GlyphSlotRec structure to read it. */ +/* */ +/* FT_GLYPH_FORMAT_OUTLINE :: */ +/* The glyph image is a vectorial outline made of line segments */ +/* and Bézier arcs; it can be described as an @FT_Outline; you */ +/* generally want to access the `outline' field of the */ +/* @FT_GlyphSlotRec structure to read it. */ +/* */ +/* FT_GLYPH_FORMAT_PLOTTER :: */ +/* The glyph image is a vectorial path with no inside and outside */ +/* contours. Some Type~1 fonts, like those in the Hershey family, */ +/* contain glyphs in this format. These are described as */ +/* @FT_Outline, but FreeType isn't currently capable of rendering */ +/* them correctly. */ +/* */ +typedef enum FT_Glyph_Format_ { + FT_IMAGE_TAG(FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0), + + FT_IMAGE_TAG(FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p'), + FT_IMAGE_TAG(FT_GLYPH_FORMAT_BITMAP, 'b', 'i', 't', 's'), + FT_IMAGE_TAG(FT_GLYPH_FORMAT_OUTLINE, 'o', 'u', 't', 'l'), + FT_IMAGE_TAG(FT_GLYPH_FORMAT_PLOTTER, 'p', 'l', 'o', 't') + +} FT_Glyph_Format; + + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* ft_glyph_format_xxx */ +/* */ +/* <Description> */ +/* A list of deprecated constants. Use the corresponding */ +/* @FT_Glyph_Format values instead. */ +/* */ +/* <Values> */ +/* ft_glyph_format_none :: See @FT_GLYPH_FORMAT_NONE. */ +/* ft_glyph_format_composite :: See @FT_GLYPH_FORMAT_COMPOSITE. */ +/* ft_glyph_format_bitmap :: See @FT_GLYPH_FORMAT_BITMAP. */ +/* ft_glyph_format_outline :: See @FT_GLYPH_FORMAT_OUTLINE. */ +/* ft_glyph_format_plotter :: See @FT_GLYPH_FORMAT_PLOTTER. */ +/* */ +#define ft_glyph_format_none FT_GLYPH_FORMAT_NONE +#define ft_glyph_format_composite FT_GLYPH_FORMAT_COMPOSITE +#define ft_glyph_format_bitmap FT_GLYPH_FORMAT_BITMAP +#define ft_glyph_format_outline FT_GLYPH_FORMAT_OUTLINE +#define ft_glyph_format_plotter FT_GLYPH_FORMAT_PLOTTER + + +/*************************************************************************/ +/*************************************************************************/ +/*************************************************************************/ +/***** *****/ +/***** R A S T E R D E F I N I T I O N S *****/ +/***** *****/ +/*************************************************************************/ +/*************************************************************************/ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* A raster is a scan converter, in charge of rendering an outline into */ +/* a a bitmap. This section contains the public API for rasters. */ +/* */ +/* Note that in FreeType 2, all rasters are now encapsulated within */ +/* specific modules called `renderers'. See `freetype/ftrender.h' for */ +/* more details on renderers. */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* raster */ +/* */ +/* <Title> */ +/* Scanline Converter */ +/* */ +/* <Abstract> */ +/* How vectorial outlines are converted into bitmaps and pixmaps. */ +/* */ +/* <Description> */ +/* This section contains technical definitions. */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Raster */ +/* */ +/* <Description> */ +/* A handle (pointer) to a raster object. Each object can be used */ +/* independently to convert an outline into a bitmap or pixmap. */ +/* */ +typedef struct FT_RasterRec_ *FT_Raster; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Span */ +/* */ +/* <Description> */ +/* A structure used to model a single span of gray (or black) pixels */ +/* when rendering a monochrome or anti-aliased bitmap. */ +/* */ +/* <Fields> */ +/* x :: The span's horizontal start position. */ +/* */ +/* len :: The span's length in pixels. */ +/* */ +/* coverage :: The span color/coverage, ranging from 0 (background) */ +/* to 255 (foreground). Only used for anti-aliased */ +/* rendering. */ +/* */ +/* <Note> */ +/* This structure is used by the span drawing callback type named */ +/* @FT_SpanFunc which takes the y~coordinate of the span as a */ +/* a parameter. */ +/* */ +/* The coverage value is always between 0 and 255. If you want less */ +/* gray values, the callback function has to reduce them. */ +/* */ +typedef struct FT_Span_ { + short x; + unsigned short len; + unsigned char coverage; + +} FT_Span; + + +/*************************************************************************/ +/* */ +/* <FuncType> */ +/* FT_SpanFunc */ +/* */ +/* <Description> */ +/* A function used as a call-back by the anti-aliased renderer in */ +/* order to let client applications draw themselves the gray pixel */ +/* spans on each scan line. */ +/* */ +/* <Input> */ +/* y :: The scanline's y~coordinate. */ +/* */ +/* count :: The number of spans to draw on this scanline. */ +/* */ +/* spans :: A table of `count' spans to draw on the scanline. */ +/* */ +/* user :: User-supplied data that is passed to the callback. */ +/* */ +/* <Note> */ +/* This callback allows client applications to directly render the */ +/* gray spans of the anti-aliased bitmap to any kind of surfaces. */ +/* */ +/* This can be used to write anti-aliased outlines directly to a */ +/* given background bitmap, and even perform translucency. */ +/* */ +/* Note that the `count' field cannot be greater than a fixed value */ +/* defined by the `FT_MAX_GRAY_SPANS' configuration macro in */ +/* `ftoption.h'. By default, this value is set to~32, which means */ +/* that if there are more than 32~spans on a given scanline, the */ +/* callback is called several times with the same `y' parameter in */ +/* order to draw all callbacks. */ +/* */ +/* Otherwise, the callback is only called once per scan-line, and */ +/* only for those scanlines that do have `gray' pixels on them. */ +/* */ +typedef void +(*FT_SpanFunc)(int y, + int count, + const FT_Span *spans, + void *user); + +#define FT_Raster_Span_Func FT_SpanFunc + + +/*************************************************************************/ +/* */ +/* <FuncType> */ +/* FT_Raster_BitTest_Func */ +/* */ +/* <Description> */ +/* THIS TYPE IS DEPRECATED. DO NOT USE IT. */ +/* */ +/* A function used as a call-back by the monochrome scan-converter */ +/* to test whether a given target pixel is already set to the drawing */ +/* `color'. These tests are crucial to implement drop-out control */ +/* per-se the TrueType spec. */ +/* */ +/* <Input> */ +/* y :: The pixel's y~coordinate. */ +/* */ +/* x :: The pixel's x~coordinate. */ +/* */ +/* user :: User-supplied data that is passed to the callback. */ +/* */ +/* <Return> */ +/* 1~if the pixel is `set', 0~otherwise. */ +/* */ +typedef int +(*FT_Raster_BitTest_Func)(int y, + int x, + void *user); + + +/*************************************************************************/ +/* */ +/* <FuncType> */ +/* FT_Raster_BitSet_Func */ +/* */ +/* <Description> */ +/* THIS TYPE IS DEPRECATED. DO NOT USE IT. */ +/* */ +/* A function used as a call-back by the monochrome scan-converter */ +/* to set an individual target pixel. This is crucial to implement */ +/* drop-out control according to the TrueType specification. */ +/* */ +/* <Input> */ +/* y :: The pixel's y~coordinate. */ +/* */ +/* x :: The pixel's x~coordinate. */ +/* */ +/* user :: User-supplied data that is passed to the callback. */ +/* */ +/* <Return> */ +/* 1~if the pixel is `set', 0~otherwise. */ +/* */ +typedef void +(*FT_Raster_BitSet_Func)(int y, + int x, + void *user); + + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* FT_RASTER_FLAG_XXX */ +/* */ +/* <Description> */ +/* A list of bit flag constants as used in the `flags' field of a */ +/* @FT_Raster_Params structure. */ +/* */ +/* <Values> */ +/* FT_RASTER_FLAG_DEFAULT :: This value is 0. */ +/* */ +/* FT_RASTER_FLAG_AA :: This flag is set to indicate that an */ +/* anti-aliased glyph image should be */ +/* generated. Otherwise, it will be */ +/* monochrome (1-bit). */ +/* */ +/* FT_RASTER_FLAG_DIRECT :: This flag is set to indicate direct */ +/* rendering. In this mode, client */ +/* applications must provide their own span */ +/* callback. This lets them directly */ +/* draw or compose over an existing bitmap. */ +/* If this bit is not set, the target */ +/* pixmap's buffer _must_ be zeroed before */ +/* rendering. */ +/* */ +/* Note that for now, direct rendering is */ +/* only possible with anti-aliased glyphs. */ +/* */ +/* FT_RASTER_FLAG_CLIP :: This flag is only used in direct */ +/* rendering mode. If set, the output will */ +/* be clipped to a box specified in the */ +/* `clip_box' field of the */ +/* @FT_Raster_Params structure. */ +/* */ +/* Note that by default, the glyph bitmap */ +/* is clipped to the target pixmap, except */ +/* in direct rendering mode where all spans */ +/* are generated if no clipping box is set. */ +/* */ +#define FT_RASTER_FLAG_DEFAULT 0x0 +#define FT_RASTER_FLAG_AA 0x1 +#define FT_RASTER_FLAG_DIRECT 0x2 +#define FT_RASTER_FLAG_CLIP 0x4 + +/* deprecated */ +#define ft_raster_flag_default FT_RASTER_FLAG_DEFAULT +#define ft_raster_flag_aa FT_RASTER_FLAG_AA +#define ft_raster_flag_direct FT_RASTER_FLAG_DIRECT +#define ft_raster_flag_clip FT_RASTER_FLAG_CLIP + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Raster_Params */ +/* */ +/* <Description> */ +/* A structure to hold the arguments used by a raster's render */ +/* function. */ +/* */ +/* <Fields> */ +/* target :: The target bitmap. */ +/* */ +/* source :: A pointer to the source glyph image (e.g., an */ +/* @FT_Outline). */ +/* */ +/* flags :: The rendering flags. */ +/* */ +/* gray_spans :: The gray span drawing callback. */ +/* */ +/* black_spans :: The black span drawing callback. UNIMPLEMENTED! */ +/* */ +/* bit_test :: The bit test callback. UNIMPLEMENTED! */ +/* */ +/* bit_set :: The bit set callback. UNIMPLEMENTED! */ +/* */ +/* user :: User-supplied data that is passed to each drawing */ +/* callback. */ +/* */ +/* clip_box :: An optional clipping box. It is only used in */ +/* direct rendering mode. Note that coordinates here */ +/* should be expressed in _integer_ pixels (and not in */ +/* 26.6 fixed-point units). */ +/* */ +/* <Note> */ +/* An anti-aliased glyph bitmap is drawn if the @FT_RASTER_FLAG_AA */ +/* bit flag is set in the `flags' field, otherwise a monochrome */ +/* bitmap is generated. */ +/* */ +/* If the @FT_RASTER_FLAG_DIRECT bit flag is set in `flags', the */ +/* raster will call the `gray_spans' callback to draw gray pixel */ +/* spans, in the case of an aa glyph bitmap, it will call */ +/* `black_spans', and `bit_test' and `bit_set' in the case of a */ +/* monochrome bitmap. This allows direct composition over a */ +/* pre-existing bitmap through user-provided callbacks to perform the */ +/* span drawing/composition. */ +/* */ +/* Note that the `bit_test' and `bit_set' callbacks are required when */ +/* rendering a monochrome bitmap, as they are crucial to implement */ +/* correct drop-out control as defined in the TrueType specification. */ +/* */ +typedef struct FT_Raster_Params_ { + const FT_Bitmap *target; + const void *source; + int flags; + FT_SpanFunc gray_spans; + FT_SpanFunc black_spans; /* doesn't work! */ + FT_Raster_BitTest_Func bit_test; /* doesn't work! */ + FT_Raster_BitSet_Func bit_set; /* doesn't work! */ + void *user; + FT_BBox clip_box; + +} FT_Raster_Params; + + +/*************************************************************************/ +/* */ +/* <FuncType> */ +/* FT_Raster_NewFunc */ +/* */ +/* <Description> */ +/* A function used to create a new raster object. */ +/* */ +/* <Input> */ +/* memory :: A handle to the memory allocator. */ +/* */ +/* <Output> */ +/* raster :: A handle to the new raster object. */ +/* */ +/* <Return> */ +/* Error code. 0~means success. */ +/* */ +/* <Note> */ +/* The `memory' parameter is a typeless pointer in order to avoid */ +/* un-wanted dependencies on the rest of the FreeType code. In */ +/* practice, it is an @FT_Memory object, i.e., a handle to the */ +/* standard FreeType memory allocator. However, this field can be */ +/* completely ignored by a given raster implementation. */ +/* */ +typedef int +(*FT_Raster_NewFunc)(void *memory, + FT_Raster *raster); + +#define FT_Raster_New_Func FT_Raster_NewFunc + + +/*************************************************************************/ +/* */ +/* <FuncType> */ +/* FT_Raster_DoneFunc */ +/* */ +/* <Description> */ +/* A function used to destroy a given raster object. */ +/* */ +/* <Input> */ +/* raster :: A handle to the raster object. */ +/* */ +typedef void +(*FT_Raster_DoneFunc)(FT_Raster raster); + +#define FT_Raster_Done_Func FT_Raster_DoneFunc + + +/*************************************************************************/ +/* */ +/* <FuncType> */ +/* FT_Raster_ResetFunc */ +/* */ +/* <Description> */ +/* FreeType provides an area of memory called the `render pool', */ +/* available to all registered rasters. This pool can be freely used */ +/* during a given scan-conversion but is shared by all rasters. Its */ +/* content is thus transient. */ +/* */ +/* This function is called each time the render pool changes, or just */ +/* after a new raster object is created. */ +/* */ +/* <Input> */ +/* raster :: A handle to the new raster object. */ +/* */ +/* pool_base :: The address in memory of the render pool. */ +/* */ +/* pool_size :: The size in bytes of the render pool. */ +/* */ +/* <Note> */ +/* Rasters can ignore the render pool and rely on dynamic memory */ +/* allocation if they want to (a handle to the memory allocator is */ +/* passed to the raster constructor). However, this is not */ +/* recommended for efficiency purposes. */ +/* */ +typedef void +(*FT_Raster_ResetFunc)(FT_Raster raster, + unsigned char *pool_base, + unsigned long pool_size); + +#define FT_Raster_Reset_Func FT_Raster_ResetFunc + + +/*************************************************************************/ +/* */ +/* <FuncType> */ +/* FT_Raster_SetModeFunc */ +/* */ +/* <Description> */ +/* This function is a generic facility to change modes or attributes */ +/* in a given raster. This can be used for debugging purposes, or */ +/* simply to allow implementation-specific `features' in a given */ +/* raster module. */ +/* */ +/* <Input> */ +/* raster :: A handle to the new raster object. */ +/* */ +/* mode :: A 4-byte tag used to name the mode or property. */ +/* */ +/* args :: A pointer to the new mode/property to use. */ +/* */ +typedef int +(*FT_Raster_SetModeFunc)(FT_Raster raster, + unsigned long mode, + void *args); + +#define FT_Raster_Set_Mode_Func FT_Raster_SetModeFunc + + +/*************************************************************************/ +/* */ +/* <FuncType> */ +/* FT_Raster_RenderFunc */ +/* */ +/* <Description> */ +/* Invoke a given raster to scan-convert a given glyph image into a */ +/* target bitmap. */ +/* */ +/* <Input> */ +/* raster :: A handle to the raster object. */ +/* */ +/* params :: A pointer to an @FT_Raster_Params structure used to */ +/* store the rendering parameters. */ +/* */ +/* <Return> */ +/* Error code. 0~means success. */ +/* */ +/* <Note> */ +/* The exact format of the source image depends on the raster's glyph */ +/* format defined in its @FT_Raster_Funcs structure. It can be an */ +/* @FT_Outline or anything else in order to support a large array of */ +/* glyph formats. */ +/* */ +/* Note also that the render function can fail and return a */ +/* `FT_Err_Unimplemented_Feature' error code if the raster used does */ +/* not support direct composition. */ +/* */ +/* XXX: For now, the standard raster doesn't support direct */ +/* composition but this should change for the final release (see */ +/* the files `demos/src/ftgrays.c' and `demos/src/ftgrays2.c' */ +/* for examples of distinct implementations which support direct */ +/* composition). */ +/* */ +typedef int +(*FT_Raster_RenderFunc)(FT_Raster raster, + const FT_Raster_Params *params); + +#define FT_Raster_Render_Func FT_Raster_RenderFunc + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Raster_Funcs */ +/* */ +/* <Description> */ +/* A structure used to describe a given raster class to the library. */ +/* */ +/* <Fields> */ +/* glyph_format :: The supported glyph format for this raster. */ +/* */ +/* raster_new :: The raster constructor. */ +/* */ +/* raster_reset :: Used to reset the render pool within the raster. */ +/* */ +/* raster_render :: A function to render a glyph into a given bitmap. */ +/* */ +/* raster_done :: The raster destructor. */ +/* */ +typedef struct FT_Raster_Funcs_ { + FT_Glyph_Format glyph_format; + FT_Raster_NewFunc raster_new; + FT_Raster_ResetFunc raster_reset; + FT_Raster_SetModeFunc raster_set_mode; + FT_Raster_RenderFunc raster_render; + FT_Raster_DoneFunc raster_done; + +} FT_Raster_Funcs; + + +/* */ + + +FT_END_HEADER + +#endif /* __FTIMAGE_H__ */ + + +/* END */ + + +/* Local Variables: */ +/* coding: utf-8 */ +/* End: */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftincrem.h b/app/src/main/cpp/include/freetype2/freetype/ftincrem.h new file mode 100644 index 0000000..aac7303 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftincrem.h @@ -0,0 +1,357 @@ +/***************************************************************************/ +/* */ +/* ftincrem.h */ +/* */ +/* FreeType incremental loading (specification). */ +/* */ +/* Copyright 2002, 2003, 2006, 2007, 2008, 2010 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTINCREM_H__ +#define __FTINCREM_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + +/*************************************************************************** + * + * @section: + * incremental + * + * @title: + * Incremental Loading + * + * @abstract: + * Custom Glyph Loading. + * + * @description: + * This section contains various functions used to perform so-called + * `incremental' glyph loading. This is a mode where all glyphs loaded + * from a given @FT_Face are provided by the client application, + * + * Apart from that, all other tables are loaded normally from the font + * file. This mode is useful when FreeType is used within another + * engine, e.g., a PostScript Imaging Processor. + * + * To enable this mode, you must use @FT_Open_Face, passing an + * @FT_Parameter with the @FT_PARAM_TAG_INCREMENTAL tag and an + * @FT_Incremental_Interface value. See the comments for + * @FT_Incremental_InterfaceRec for an example. + * + */ + + +/*************************************************************************** + * + * @type: + * FT_Incremental + * + * @description: + * An opaque type describing a user-provided object used to implement + * `incremental' glyph loading within FreeType. This is used to support + * embedded fonts in certain environments (e.g., PostScript interpreters), + * where the glyph data isn't in the font file, or must be overridden by + * different values. + * + * @note: + * It is up to client applications to create and implement @FT_Incremental + * objects, as long as they provide implementations for the methods + * @FT_Incremental_GetGlyphDataFunc, @FT_Incremental_FreeGlyphDataFunc + * and @FT_Incremental_GetGlyphMetricsFunc. + * + * See the description of @FT_Incremental_InterfaceRec to understand how + * to use incremental objects with FreeType. + * + */ +typedef struct FT_IncrementalRec_ *FT_Incremental; + + +/*************************************************************************** + * + * @struct: + * FT_Incremental_MetricsRec + * + * @description: + * A small structure used to contain the basic glyph metrics returned + * by the @FT_Incremental_GetGlyphMetricsFunc method. + * + * @fields: + * bearing_x :: + * Left bearing, in font units. + * + * bearing_y :: + * Top bearing, in font units. + * + * advance :: + * Horizontal component of glyph advance, in font units. + * + * advance_v :: + * Vertical component of glyph advance, in font units. + * + * @note: + * These correspond to horizontal or vertical metrics depending on the + * value of the `vertical' argument to the function + * @FT_Incremental_GetGlyphMetricsFunc. + * + */ +typedef struct FT_Incremental_MetricsRec_ { + FT_Long bearing_x; + FT_Long bearing_y; + FT_Long advance; + FT_Long advance_v; /* since 2.3.12 */ + +} FT_Incremental_MetricsRec; + + +/*************************************************************************** + * + * @struct: + * FT_Incremental_Metrics + * + * @description: + * A handle to an @FT_Incremental_MetricsRec structure. + * + */ +typedef struct FT_Incremental_MetricsRec_ *FT_Incremental_Metrics; + + +/*************************************************************************** + * + * @type: + * FT_Incremental_GetGlyphDataFunc + * + * @description: + * A function called by FreeType to access a given glyph's data bytes + * during @FT_Load_Glyph or @FT_Load_Char if incremental loading is + * enabled. + * + * Note that the format of the glyph's data bytes depends on the font + * file format. For TrueType, it must correspond to the raw bytes within + * the `glyf' table. For PostScript formats, it must correspond to the + * *unencrypted* charstring bytes, without any `lenIV' header. It is + * undefined for any other format. + * + * @input: + * incremental :: + * Handle to an opaque @FT_Incremental handle provided by the client + * application. + * + * glyph_index :: + * Index of relevant glyph. + * + * @output: + * adata :: + * A structure describing the returned glyph data bytes (which will be + * accessed as a read-only byte block). + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * If this function returns successfully the method + * @FT_Incremental_FreeGlyphDataFunc will be called later to release + * the data bytes. + * + * Nested calls to @FT_Incremental_GetGlyphDataFunc can happen for + * compound glyphs. + * + */ +typedef FT_Error +(*FT_Incremental_GetGlyphDataFunc)(FT_Incremental +incremental, +FT_UInt glyph_index, + FT_Data +* adata ); + + +/*************************************************************************** + * + * @type: + * FT_Incremental_FreeGlyphDataFunc + * + * @description: + * A function used to release the glyph data bytes returned by a + * successful call to @FT_Incremental_GetGlyphDataFunc. + * + * @input: + * incremental :: + * A handle to an opaque @FT_Incremental handle provided by the client + * application. + * + * data :: + * A structure describing the glyph data bytes (which will be accessed + * as a read-only byte block). + * + */ +typedef void +(*FT_Incremental_FreeGlyphDataFunc)(FT_Incremental +incremental, +FT_Data *data +); + + +/*************************************************************************** + * + * @type: + * FT_Incremental_GetGlyphMetricsFunc + * + * @description: + * A function used to retrieve the basic metrics of a given glyph index + * before accessing its data. This is necessary because, in certain + * formats like TrueType, the metrics are stored in a different place from + * the glyph images proper. + * + * @input: + * incremental :: + * A handle to an opaque @FT_Incremental handle provided by the client + * application. + * + * glyph_index :: + * Index of relevant glyph. + * + * vertical :: + * If true, return vertical metrics. + * + * ametrics :: + * This parameter is used for both input and output. + * The original glyph metrics, if any, in font units. If metrics are + * not available all the values must be set to zero. + * + * @output: + * ametrics :: + * The replacement glyph metrics in font units. + * + */ +typedef FT_Error +(*FT_Incremental_GetGlyphMetricsFunc) + (FT_Incremental +incremental, +FT_UInt glyph_index, + FT_Bool +vertical, +FT_Incremental_MetricsRec *ametrics +); + + +/************************************************************************** + * + * @struct: + * FT_Incremental_FuncsRec + * + * @description: + * A table of functions for accessing fonts that load data + * incrementally. Used in @FT_Incremental_InterfaceRec. + * + * @fields: + * get_glyph_data :: + * The function to get glyph data. Must not be null. + * + * free_glyph_data :: + * The function to release glyph data. Must not be null. + * + * get_glyph_metrics :: + * The function to get glyph metrics. May be null if the font does + * not provide overriding glyph metrics. + * + */ +typedef struct FT_Incremental_FuncsRec_ { + FT_Incremental_GetGlyphDataFunc get_glyph_data; + FT_Incremental_FreeGlyphDataFunc free_glyph_data; + FT_Incremental_GetGlyphMetricsFunc get_glyph_metrics; + +} FT_Incremental_FuncsRec; + + +/*************************************************************************** + * + * @struct: + * FT_Incremental_InterfaceRec + * + * @description: + * A structure to be used with @FT_Open_Face to indicate that the user + * wants to support incremental glyph loading. You should use it with + * @FT_PARAM_TAG_INCREMENTAL as in the following example: + * + * { + * FT_Incremental_InterfaceRec inc_int; + * FT_Parameter parameter; + * FT_Open_Args open_args; + * + * + * // set up incremental descriptor + * inc_int.funcs = my_funcs; + * inc_int.object = my_object; + * + * // set up optional parameter + * parameter.tag = FT_PARAM_TAG_INCREMENTAL; + * parameter.data = &inc_int; + * + * // set up FT_Open_Args structure + * open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; + * open_args.pathname = my_font_pathname; + * open_args.num_params = 1; + * open_args.params = ¶meter; // we use one optional argument + * + * // open the font + * error = FT_Open_Face( library, &open_args, index, &face ); + * ... + * } + * + */ +typedef struct FT_Incremental_InterfaceRec_ { + const FT_Incremental_FuncsRec *funcs; + FT_Incremental object; + +} FT_Incremental_InterfaceRec; + + +/*************************************************************************** + * + * @type: + * FT_Incremental_Interface + * + * @description: + * A pointer to an @FT_Incremental_InterfaceRec structure. + * + */ +typedef FT_Incremental_InterfaceRec *FT_Incremental_Interface; + + +/*************************************************************************** + * + * @constant: + * FT_PARAM_TAG_INCREMENTAL + * + * @description: + * A constant used as the tag of @FT_Parameter structures to indicate + * an incremental loading object to be used by FreeType. + * + */ +#define FT_PARAM_TAG_INCREMENTAL FT_MAKE_TAG( 'i', 'n', 'c', 'r' ) + +/* */ + +FT_END_HEADER + +#endif /* __FTINCREM_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftlcdfil.h b/app/src/main/cpp/include/freetype2/freetype/ftlcdfil.h new file mode 100644 index 0000000..ef4b99d --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftlcdfil.h @@ -0,0 +1,216 @@ +/***************************************************************************/ +/* */ +/* ftlcdfil.h */ +/* */ +/* FreeType API for color filtering of subpixel bitmap glyphs */ +/* (specification). */ +/* */ +/* Copyright 2006, 2007, 2008, 2010 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FT_LCD_FILTER_H__ +#define __FT_LCD_FILTER_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + +/*************************************************************************** + * + * @section: + * lcd_filtering + * + * @title: + * LCD Filtering + * + * @abstract: + * Reduce color fringes of LCD-optimized bitmaps. + * + * @description: + * The @FT_Library_SetLcdFilter API can be used to specify a low-pass + * filter which is then applied to LCD-optimized bitmaps generated + * through @FT_Render_Glyph. This is useful to reduce color fringes + * which would occur with unfiltered rendering. + * + * Note that no filter is active by default, and that this function is + * *not* implemented in default builds of the library. You need to + * #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your `ftoption.h' file + * in order to activate it. + */ + + +/**************************************************************************** + * + * @enum: + * FT_LcdFilter + * + * @description: + * A list of values to identify various types of LCD filters. + * + * @values: + * FT_LCD_FILTER_NONE :: + * Do not perform filtering. When used with subpixel rendering, this + * results in sometimes severe color fringes. + * + * FT_LCD_FILTER_DEFAULT :: + * The default filter reduces color fringes considerably, at the cost + * of a slight blurriness in the output. + * + * FT_LCD_FILTER_LIGHT :: + * The light filter is a variant that produces less blurriness at the + * cost of slightly more color fringes than the default one. It might + * be better, depending on taste, your monitor, or your personal vision. + * + * FT_LCD_FILTER_LEGACY :: + * This filter corresponds to the original libXft color filter. It + * provides high contrast output but can exhibit really bad color + * fringes if glyphs are not extremely well hinted to the pixel grid. + * In other words, it only works well if the TrueType bytecode + * interpreter is enabled *and* high-quality hinted fonts are used. + * + * This filter is only provided for comparison purposes, and might be + * disabled or stay unsupported in the future. + * + * @since: + * 2.3.0 + */ +typedef enum FT_LcdFilter_ { + FT_LCD_FILTER_NONE = 0, + FT_LCD_FILTER_DEFAULT = 1, + FT_LCD_FILTER_LIGHT = 2, + FT_LCD_FILTER_LEGACY = 16, + + FT_LCD_FILTER_MAX /* do not remove */ + +} FT_LcdFilter; + + +/************************************************************************** + * + * @func: + * FT_Library_SetLcdFilter + * + * @description: + * This function is used to apply color filtering to LCD decimated + * bitmaps, like the ones used when calling @FT_Render_Glyph with + * @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V. + * + * @input: + * library :: + * A handle to the target library instance. + * + * filter :: + * The filter type. + * + * You can use @FT_LCD_FILTER_NONE here to disable this feature, or + * @FT_LCD_FILTER_DEFAULT to use a default filter that should work + * well on most LCD screens. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This feature is always disabled by default. Clients must make an + * explicit call to this function with a `filter' value other than + * @FT_LCD_FILTER_NONE in order to enable it. + * + * Due to *PATENTS* covering subpixel rendering, this function doesn't + * do anything except returning `FT_Err_Unimplemented_Feature' if the + * configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not + * defined in your build of the library, which should correspond to all + * default builds of FreeType. + * + * The filter affects glyph bitmaps rendered through @FT_Render_Glyph, + * @FT_Outline_Get_Bitmap, @FT_Load_Glyph, and @FT_Load_Char. + * + * It does _not_ affect the output of @FT_Outline_Render and + * @FT_Outline_Get_Bitmap. + * + * If this feature is activated, the dimensions of LCD glyph bitmaps are + * either larger or taller than the dimensions of the corresponding + * outline with regards to the pixel grid. For example, for + * @FT_RENDER_MODE_LCD, the filter adds up to 3~pixels to the left, and + * up to 3~pixels to the right. + * + * The bitmap offset values are adjusted correctly, so clients shouldn't + * need to modify their layout and glyph positioning code when enabling + * the filter. + * + * @since: + * 2.3.0 + */ +FT_EXPORT( FT_Error ) +FT_Library_SetLcdFilter( FT_Library +library, +FT_LcdFilter filter +); + + +/************************************************************************** + * + * @func: + * FT_Library_SetLcdFilterWeights + * + * @description: + * Use this function to override the filter weights selected by + * @FT_Library_SetLcdFilter. By default, FreeType uses the quintuple + * (0x00, 0x55, 0x56, 0x55, 0x00) for FT_LCD_FILTER_LIGHT, and (0x10, + * 0x40, 0x70, 0x40, 0x10) for FT_LCD_FILTER_DEFAULT and + * FT_LCD_FILTER_LEGACY. + * + * @input: + * library :: + * A handle to the target library instance. + * + * weights :: + * A pointer to an array; the function copies the first five bytes and + * uses them to specify the filter weights. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * Due to *PATENTS* covering subpixel rendering, this function doesn't + * do anything except returning `FT_Err_Unimplemented_Feature' if the + * configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not + * defined in your build of the library, which should correspond to all + * default builds of FreeType. + * + * This function must be called after @FT_Library_SetLcdFilter to have + * any effect. + * + * @since: + * 2.4.0 + */ +FT_EXPORT( FT_Error ) +FT_Library_SetLcdFilterWeights( FT_Library +library, +unsigned char *weights +); + +/* */ + + +FT_END_HEADER + +#endif /* __FT_LCD_FILTER_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftlist.h b/app/src/main/cpp/include/freetype2/freetype/ftlist.h new file mode 100644 index 0000000..2a7ed35 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftlist.h @@ -0,0 +1,298 @@ +/***************************************************************************/ +/* */ +/* ftlist.h */ +/* */ +/* Generic list support for FreeType (specification). */ +/* */ +/* Copyright 1996-2001, 2003, 2007, 2010 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +/*************************************************************************/ +/* */ +/* This file implements functions relative to list processing. Its */ +/* data structures are defined in `freetype.h'. */ +/* */ +/*************************************************************************/ + + +#ifndef __FTLIST_H__ +#define __FTLIST_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* list_processing */ +/* */ +/* <Title> */ +/* List Processing */ +/* */ +/* <Abstract> */ +/* Simple management of lists. */ +/* */ +/* <Description> */ +/* This section contains various definitions related to list */ +/* processing using doubly-linked nodes. */ +/* */ +/* <Order> */ +/* FT_List */ +/* FT_ListNode */ +/* FT_ListRec */ +/* FT_ListNodeRec */ +/* */ +/* FT_List_Add */ +/* FT_List_Insert */ +/* FT_List_Find */ +/* FT_List_Remove */ +/* FT_List_Up */ +/* FT_List_Iterate */ +/* FT_List_Iterator */ +/* FT_List_Finalize */ +/* FT_List_Destructor */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_List_Find */ +/* */ +/* <Description> */ +/* Find the list node for a given listed object. */ +/* */ +/* <Input> */ +/* list :: A pointer to the parent list. */ +/* data :: The address of the listed object. */ +/* */ +/* <Return> */ +/* List node. NULL if it wasn't found. */ +/* */ +FT_EXPORT(FT_ListNode) + +FT_List_Find( FT_List +list, +void *data +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_List_Add */ +/* */ +/* <Description> */ +/* Append an element to the end of a list. */ +/* */ +/* <InOut> */ +/* list :: A pointer to the parent list. */ +/* node :: The node to append. */ +/* */ +FT_EXPORT(void) + +FT_List_Add( FT_List +list, +FT_ListNode node +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_List_Insert */ +/* */ +/* <Description> */ +/* Insert an element at the head of a list. */ +/* */ +/* <InOut> */ +/* list :: A pointer to parent list. */ +/* node :: The node to insert. */ +/* */ +FT_EXPORT(void) + +FT_List_Insert( FT_List +list, +FT_ListNode node +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_List_Remove */ +/* */ +/* <Description> */ +/* Remove a node from a list. This function doesn't check whether */ +/* the node is in the list! */ +/* */ +/* <Input> */ +/* node :: The node to remove. */ +/* */ +/* <InOut> */ +/* list :: A pointer to the parent list. */ +/* */ +FT_EXPORT(void) + +FT_List_Remove( FT_List +list, +FT_ListNode node +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_List_Up */ +/* */ +/* <Description> */ +/* Move a node to the head/top of a list. Used to maintain LRU */ +/* lists. */ +/* */ +/* <InOut> */ +/* list :: A pointer to the parent list. */ +/* node :: The node to move. */ +/* */ +FT_EXPORT(void) + +FT_List_Up( FT_List +list, +FT_ListNode node +); + + +/*************************************************************************/ +/* */ +/* <FuncType> */ +/* FT_List_Iterator */ +/* */ +/* <Description> */ +/* An FT_List iterator function which is called during a list parse */ +/* by @FT_List_Iterate. */ +/* */ +/* <Input> */ +/* node :: The current iteration list node. */ +/* */ +/* user :: A typeless pointer passed to @FT_List_Iterate. */ +/* Can be used to point to the iteration's state. */ +/* */ +typedef FT_Error +(*FT_List_Iterator)(FT_ListNode node, + void *user); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_List_Iterate */ +/* */ +/* <Description> */ +/* Parse a list and calls a given iterator function on each element. */ +/* Note that parsing is stopped as soon as one of the iterator calls */ +/* returns a non-zero value. */ +/* */ +/* <Input> */ +/* list :: A handle to the list. */ +/* iterator :: An iterator function, called on each node of the list. */ +/* user :: A user-supplied field which is passed as the second */ +/* argument to the iterator. */ +/* */ +/* <Return> */ +/* The result (a FreeType error code) of the last iterator call. */ +/* */ +FT_EXPORT( FT_Error ) +FT_List_Iterate( FT_List +list, +FT_List_Iterator iterator, +void *user +); + + +/*************************************************************************/ +/* */ +/* <FuncType> */ +/* FT_List_Destructor */ +/* */ +/* <Description> */ +/* An @FT_List iterator function which is called during a list */ +/* finalization by @FT_List_Finalize to destroy all elements in a */ +/* given list. */ +/* */ +/* <Input> */ +/* system :: The current system object. */ +/* */ +/* data :: The current object to destroy. */ +/* */ +/* user :: A typeless pointer passed to @FT_List_Iterate. It can */ +/* be used to point to the iteration's state. */ +/* */ +typedef void +(*FT_List_Destructor)(FT_Memory memory, + void *data, + void *user); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_List_Finalize */ +/* */ +/* <Description> */ +/* Destroy all elements in the list as well as the list itself. */ +/* */ +/* <Input> */ +/* list :: A handle to the list. */ +/* */ +/* destroy :: A list destructor that will be applied to each element */ +/* of the list. */ +/* */ +/* memory :: The current memory object which handles deallocation. */ +/* */ +/* user :: A user-supplied field which is passed as the last */ +/* argument to the destructor. */ +/* */ +/* <Note> */ +/* This function expects that all nodes added by @FT_List_Add or */ +/* @FT_List_Insert have been dynamically allocated. */ +/* */ +FT_EXPORT(void) + +FT_List_Finalize( FT_List +list, +FT_List_Destructor destroy, + FT_Memory +memory, +void *user +); + + +/* */ + + +FT_END_HEADER + +#endif /* __FTLIST_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftlzw.h b/app/src/main/cpp/include/freetype2/freetype/ftlzw.h new file mode 100644 index 0000000..524469f --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftlzw.h @@ -0,0 +1,102 @@ +/***************************************************************************/ +/* */ +/* ftlzw.h */ +/* */ +/* LZW-compressed stream support. */ +/* */ +/* Copyright 2004, 2006 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTLZW_H__ +#define __FTLZW_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + +/*************************************************************************/ +/* */ +/* <Section> */ +/* lzw */ +/* */ +/* <Title> */ +/* LZW Streams */ +/* */ +/* <Abstract> */ +/* Using LZW-compressed font files. */ +/* */ +/* <Description> */ +/* This section contains the declaration of LZW-specific functions. */ +/* */ +/*************************************************************************/ + +/************************************************************************ + * + * @function: + * FT_Stream_OpenLZW + * + * @description: + * Open a new stream to parse LZW-compressed font files. This is + * mainly used to support the compressed `*.pcf.Z' fonts that come + * with XFree86. + * + * @input: + * stream :: The target embedding stream. + * + * source :: The source stream. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The source stream must be opened _before_ calling this function. + * + * Calling the internal function `FT_Stream_Close' on the new stream will + * *not* call `FT_Stream_Close' on the source stream. None of the stream + * objects will be released to the heap. + * + * The stream implementation is very basic and resets the decompression + * process each time seeking backwards is needed within the stream + * + * In certain builds of the library, LZW compression recognition is + * automatically handled when calling @FT_New_Face or @FT_Open_Face. + * This means that if no font driver is capable of handling the raw + * compressed file, the library will try to open a LZW stream from it + * and re-open the face with it. + * + * This function may return `FT_Err_Unimplemented_Feature' if your build + * of FreeType was not compiled with LZW support. + */ +FT_EXPORT(FT_Error) + +FT_Stream_OpenLZW( FT_Stream +stream, +FT_Stream source +); + +/* */ + + +FT_END_HEADER + +#endif /* __FTLZW_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftmac.h b/app/src/main/cpp/include/freetype2/freetype/ftmac.h new file mode 100644 index 0000000..4f8ed7c --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftmac.h @@ -0,0 +1,287 @@ +/***************************************************************************/ +/* */ +/* ftmac.h */ +/* */ +/* Additional Mac-specific API. */ +/* */ +/* Copyright 1996-2001, 2004, 2006, 2007 by */ +/* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +/***************************************************************************/ +/* */ +/* NOTE: Include this file after <freetype/freetype.h> and after any */ +/* Mac-specific headers (because this header uses Mac types such as */ +/* Handle, FSSpec, FSRef, etc.) */ +/* */ +/***************************************************************************/ + + +#ifndef __FTMAC_H__ +#define __FTMAC_H__ + + +#include <ft2build.h> + + +FT_BEGIN_HEADER + + +/* gcc-3.4.1 and later can warn about functions tagged as deprecated */ +#ifndef FT_DEPRECATED_ATTRIBUTE +#if defined(__GNUC__) && \ + ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) +#define FT_DEPRECATED_ATTRIBUTE __attribute__((deprecated)) +#else +#define FT_DEPRECATED_ATTRIBUTE +#endif +#endif + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* mac_specific */ +/* */ +/* <Title> */ +/* Mac Specific Interface */ +/* */ +/* <Abstract> */ +/* Only available on the Macintosh. */ +/* */ +/* <Description> */ +/* The following definitions are only available if FreeType is */ +/* compiled on a Macintosh. */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_New_Face_From_FOND */ +/* */ +/* <Description> */ +/* Create a new face object from a FOND resource. */ +/* */ +/* <InOut> */ +/* library :: A handle to the library resource. */ +/* */ +/* <Input> */ +/* fond :: A FOND resource. */ +/* */ +/* face_index :: Only supported for the -1 `sanity check' special */ +/* case. */ +/* */ +/* <Output> */ +/* aface :: A handle to a new face object. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Notes> */ +/* This function can be used to create @FT_Face objects from fonts */ +/* that are installed in the system as follows. */ +/* */ +/* { */ +/* fond = GetResource( 'FOND', fontName ); */ +/* error = FT_New_Face_From_FOND( library, fond, 0, &face ); */ +/* } */ +/* */ +FT_EXPORT(FT_Error) + +FT_New_Face_From_FOND( FT_Library +library, +Handle fond, + FT_Long +face_index, +FT_Face *aface +) +FT_DEPRECATED_ATTRIBUTE; + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_GetFile_From_Mac_Name */ +/* */ +/* <Description> */ +/* Return an FSSpec for the disk file containing the named font. */ +/* */ +/* <Input> */ +/* fontName :: Mac OS name of the font (e.g., Times New Roman */ +/* Bold). */ +/* */ +/* <Output> */ +/* pathSpec :: FSSpec to the file. For passing to */ +/* @FT_New_Face_From_FSSpec. */ +/* */ +/* face_index :: Index of the face. For passing to */ +/* @FT_New_Face_From_FSSpec. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) + +FT_GetFile_From_Mac_Name(const char *fontName, + FSSpec *pathSpec, + FT_Long *face_index) +FT_DEPRECATED_ATTRIBUTE; + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_GetFile_From_Mac_ATS_Name */ +/* */ +/* <Description> */ +/* Return an FSSpec for the disk file containing the named font. */ +/* */ +/* <Input> */ +/* fontName :: Mac OS name of the font in ATS framework. */ +/* */ +/* <Output> */ +/* pathSpec :: FSSpec to the file. For passing to */ +/* @FT_New_Face_From_FSSpec. */ +/* */ +/* face_index :: Index of the face. For passing to */ +/* @FT_New_Face_From_FSSpec. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) + +FT_GetFile_From_Mac_ATS_Name(const char *fontName, + FSSpec *pathSpec, + FT_Long *face_index) +FT_DEPRECATED_ATTRIBUTE; + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_GetFilePath_From_Mac_ATS_Name */ +/* */ +/* <Description> */ +/* Return a pathname of the disk file and face index for given font */ +/* name which is handled by ATS framework. */ +/* */ +/* <Input> */ +/* fontName :: Mac OS name of the font in ATS framework. */ +/* */ +/* <Output> */ +/* path :: Buffer to store pathname of the file. For passing */ +/* to @FT_New_Face. The client must allocate this */ +/* buffer before calling this function. */ +/* */ +/* maxPathSize :: Lengths of the buffer `path' that client allocated. */ +/* */ +/* face_index :: Index of the face. For passing to @FT_New_Face. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) + +FT_GetFilePath_From_Mac_ATS_Name(const char *fontName, + UInt8 *path, + UInt32 maxPathSize, + FT_Long *face_index) +FT_DEPRECATED_ATTRIBUTE; + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_New_Face_From_FSSpec */ +/* */ +/* <Description> */ +/* Create a new face object from a given resource and typeface index */ +/* using an FSSpec to the font file. */ +/* */ +/* <InOut> */ +/* library :: A handle to the library resource. */ +/* */ +/* <Input> */ +/* spec :: FSSpec to the font file. */ +/* */ +/* face_index :: The index of the face within the resource. The */ +/* first face has index~0. */ +/* <Output> */ +/* aface :: A handle to a new face object. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* @FT_New_Face_From_FSSpec is identical to @FT_New_Face except */ +/* it accepts an FSSpec instead of a path. */ +/* */ +FT_EXPORT( FT_Error ) +FT_New_Face_From_FSSpec( FT_Library +library, +const FSSpec *spec, + FT_Long +face_index, +FT_Face *aface +) +FT_DEPRECATED_ATTRIBUTE; + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_New_Face_From_FSRef */ +/* */ +/* <Description> */ +/* Create a new face object from a given resource and typeface index */ +/* using an FSRef to the font file. */ +/* */ +/* <InOut> */ +/* library :: A handle to the library resource. */ +/* */ +/* <Input> */ +/* spec :: FSRef to the font file. */ +/* */ +/* face_index :: The index of the face within the resource. The */ +/* first face has index~0. */ +/* <Output> */ +/* aface :: A handle to a new face object. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* @FT_New_Face_From_FSRef is identical to @FT_New_Face except */ +/* it accepts an FSRef instead of a path. */ +/* */ +FT_EXPORT( FT_Error ) +FT_New_Face_From_FSRef( FT_Library +library, +const FSRef *ref, + FT_Long +face_index, +FT_Face *aface +) +FT_DEPRECATED_ATTRIBUTE; + +/* */ + + +FT_END_HEADER + + +#endif /* __FTMAC_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftmm.h b/app/src/main/cpp/include/freetype2/freetype/ftmm.h new file mode 100644 index 0000000..a3b0967 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftmm.h @@ -0,0 +1,385 @@ +/***************************************************************************/ +/* */ +/* ftmm.h */ +/* */ +/* FreeType Multiple Master font interface (specification). */ +/* */ +/* Copyright 1996-2001, 2003, 2004, 2006, 2009 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTMM_H__ +#define __FTMM_H__ + + +#include <ft2build.h> +#include FT_TYPE1_TABLES_H + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* multiple_masters */ +/* */ +/* <Title> */ +/* Multiple Masters */ +/* */ +/* <Abstract> */ +/* How to manage Multiple Masters fonts. */ +/* */ +/* <Description> */ +/* The following types and functions are used to manage Multiple */ +/* Master fonts, i.e., the selection of specific design instances by */ +/* setting design axis coordinates. */ +/* */ +/* George Williams has extended this interface to make it work with */ +/* both Type~1 Multiple Masters fonts and GX distortable (var) */ +/* fonts. Some of these routines only work with MM fonts, others */ +/* will work with both types. They are similar enough that a */ +/* consistent interface makes sense. */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_MM_Axis */ +/* */ +/* <Description> */ +/* A simple structure used to model a given axis in design space for */ +/* Multiple Masters fonts. */ +/* */ +/* This structure can't be used for GX var fonts. */ +/* */ +/* <Fields> */ +/* name :: The axis's name. */ +/* */ +/* minimum :: The axis's minimum design coordinate. */ +/* */ +/* maximum :: The axis's maximum design coordinate. */ +/* */ +typedef struct FT_MM_Axis_ { + FT_String *name; + FT_Long minimum; + FT_Long maximum; + +} FT_MM_Axis; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Multi_Master */ +/* */ +/* <Description> */ +/* A structure used to model the axes and space of a Multiple Masters */ +/* font. */ +/* */ +/* This structure can't be used for GX var fonts. */ +/* */ +/* <Fields> */ +/* num_axis :: Number of axes. Cannot exceed~4. */ +/* */ +/* num_designs :: Number of designs; should be normally 2^num_axis */ +/* even though the Type~1 specification strangely */ +/* allows for intermediate designs to be present. This */ +/* number cannot exceed~16. */ +/* */ +/* axis :: A table of axis descriptors. */ +/* */ +typedef struct FT_Multi_Master_ { + FT_UInt num_axis; + FT_UInt num_designs; + FT_MM_Axis axis[T1_MAX_MM_AXIS]; + +} FT_Multi_Master; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Var_Axis */ +/* */ +/* <Description> */ +/* A simple structure used to model a given axis in design space for */ +/* Multiple Masters and GX var fonts. */ +/* */ +/* <Fields> */ +/* name :: The axis's name. */ +/* Not always meaningful for GX. */ +/* */ +/* minimum :: The axis's minimum design coordinate. */ +/* */ +/* def :: The axis's default design coordinate. */ +/* FreeType computes meaningful default values for MM; it */ +/* is then an integer value, not in 16.16 format. */ +/* */ +/* maximum :: The axis's maximum design coordinate. */ +/* */ +/* tag :: The axis's tag (the GX equivalent to `name'). */ +/* FreeType provides default values for MM if possible. */ +/* */ +/* strid :: The entry in `name' table (another GX version of */ +/* `name'). */ +/* Not meaningful for MM. */ +/* */ +typedef struct FT_Var_Axis_ { + FT_String *name; + + FT_Fixed minimum; + FT_Fixed def; + FT_Fixed maximum; + + FT_ULong tag; + FT_UInt strid; + +} FT_Var_Axis; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Var_Named_Style */ +/* */ +/* <Description> */ +/* A simple structure used to model a named style in a GX var font. */ +/* */ +/* This structure can't be used for MM fonts. */ +/* */ +/* <Fields> */ +/* coords :: The design coordinates for this style. */ +/* This is an array with one entry for each axis. */ +/* */ +/* strid :: The entry in `name' table identifying this style. */ +/* */ +typedef struct FT_Var_Named_Style_ { + FT_Fixed *coords; + FT_UInt strid; + +} FT_Var_Named_Style; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_MM_Var */ +/* */ +/* <Description> */ +/* A structure used to model the axes and space of a Multiple Masters */ +/* or GX var distortable font. */ +/* */ +/* Some fields are specific to one format and not to the other. */ +/* */ +/* <Fields> */ +/* num_axis :: The number of axes. The maximum value is~4 for */ +/* MM; no limit in GX. */ +/* */ +/* num_designs :: The number of designs; should be normally */ +/* 2^num_axis for MM fonts. Not meaningful for GX */ +/* (where every glyph could have a different */ +/* number of designs). */ +/* */ +/* num_namedstyles :: The number of named styles; only meaningful for */ +/* GX which allows certain design coordinates to */ +/* have a string ID (in the `name' table) */ +/* associated with them. The font can tell the */ +/* user that, for example, Weight=1.5 is `Bold'. */ +/* */ +/* axis :: A table of axis descriptors. */ +/* GX fonts contain slightly more data than MM. */ +/* */ +/* namedstyles :: A table of named styles. */ +/* Only meaningful with GX. */ +/* */ +typedef struct FT_MM_Var_ { + FT_UInt num_axis; + FT_UInt num_designs; + FT_UInt num_namedstyles; + FT_Var_Axis *axis; + FT_Var_Named_Style *namedstyle; + +} FT_MM_Var; + + +/* */ + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_Multi_Master */ +/* */ +/* <Description> */ +/* Retrieve the Multiple Master descriptor of a given font. */ +/* */ +/* This function can't be used with GX fonts. */ +/* */ +/* <Input> */ +/* face :: A handle to the source face. */ +/* */ +/* <Output> */ +/* amaster :: The Multiple Masters descriptor. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Get_Multi_Master( FT_Face +face, +FT_Multi_Master *amaster +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_MM_Var */ +/* */ +/* <Description> */ +/* Retrieve the Multiple Master/GX var descriptor of a given font. */ +/* */ +/* <Input> */ +/* face :: A handle to the source face. */ +/* */ +/* <Output> */ +/* amaster :: The Multiple Masters/GX var descriptor. */ +/* Allocates a data structure, which the user must free */ +/* (a single call to FT_FREE will do it). */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Get_MM_Var( FT_Face +face, +FT_MM_Var **amaster +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Set_MM_Design_Coordinates */ +/* */ +/* <Description> */ +/* For Multiple Masters fonts, choose an interpolated font design */ +/* through design coordinates. */ +/* */ +/* This function can't be used with GX fonts. */ +/* */ +/* <InOut> */ +/* face :: A handle to the source face. */ +/* */ +/* <Input> */ +/* num_coords :: The number of design coordinates (must be equal to */ +/* the number of axes in the font). */ +/* */ +/* coords :: An array of design coordinates. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Set_MM_Design_Coordinates( FT_Face +face, +FT_UInt num_coords, + FT_Long +* coords ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Set_Var_Design_Coordinates */ +/* */ +/* <Description> */ +/* For Multiple Master or GX Var fonts, choose an interpolated font */ +/* design through design coordinates. */ +/* */ +/* <InOut> */ +/* face :: A handle to the source face. */ +/* */ +/* <Input> */ +/* num_coords :: The number of design coordinates (must be equal to */ +/* the number of axes in the font). */ +/* */ +/* coords :: An array of design coordinates. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Set_Var_Design_Coordinates( FT_Face +face, +FT_UInt num_coords, + FT_Fixed +* coords ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Set_MM_Blend_Coordinates */ +/* */ +/* <Description> */ +/* For Multiple Masters and GX var fonts, choose an interpolated font */ +/* design through normalized blend coordinates. */ +/* */ +/* <InOut> */ +/* face :: A handle to the source face. */ +/* */ +/* <Input> */ +/* num_coords :: The number of design coordinates (must be equal to */ +/* the number of axes in the font). */ +/* */ +/* coords :: The design coordinates array (each element must be */ +/* between 0 and 1.0). */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Set_MM_Blend_Coordinates( FT_Face +face, +FT_UInt num_coords, + FT_Fixed +* coords ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Set_Var_Blend_Coordinates */ +/* */ +/* <Description> */ +/* This is another name of @FT_Set_MM_Blend_Coordinates. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Set_Var_Blend_Coordinates( FT_Face +face, +FT_UInt num_coords, + FT_Fixed +* coords ); + + +/* */ + + +FT_END_HEADER + +#endif /* __FTMM_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftmodapi.h b/app/src/main/cpp/include/freetype2/freetype/ftmodapi.h new file mode 100644 index 0000000..7bf32a8 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftmodapi.h @@ -0,0 +1,498 @@ +/***************************************************************************/ +/* */ +/* ftmodapi.h */ +/* */ +/* FreeType modules public interface (specification). */ +/* */ +/* Copyright 1996-2001, 2002, 2003, 2006, 2008, 2009, 2010 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTMODAPI_H__ +#define __FTMODAPI_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* module_management */ +/* */ +/* <Title> */ +/* Module Management */ +/* */ +/* <Abstract> */ +/* How to add, upgrade, and remove modules from FreeType. */ +/* */ +/* <Description> */ +/* The definitions below are used to manage modules within FreeType. */ +/* Modules can be added, upgraded, and removed at runtime. */ +/* */ +/*************************************************************************/ + + +/* module bit flags */ +#define FT_MODULE_FONT_DRIVER 1 /* this module is a font driver */ +#define FT_MODULE_RENDERER 2 /* this module is a renderer */ +#define FT_MODULE_HINTER 4 /* this module is a glyph hinter */ +#define FT_MODULE_STYLER 8 /* this module is a styler */ + +#define FT_MODULE_DRIVER_SCALABLE 0x100 /* the driver supports */ +/* scalable fonts */ +#define FT_MODULE_DRIVER_NO_OUTLINES 0x200 /* the driver does not */ +/* support vector outlines */ +#define FT_MODULE_DRIVER_HAS_HINTER 0x400 /* the driver provides its */ +/* own hinter */ + + +/* deprecated values */ +#define ft_module_font_driver FT_MODULE_FONT_DRIVER +#define ft_module_renderer FT_MODULE_RENDERER +#define ft_module_hinter FT_MODULE_HINTER +#define ft_module_styler FT_MODULE_STYLER + +#define ft_module_driver_scalable FT_MODULE_DRIVER_SCALABLE +#define ft_module_driver_no_outlines FT_MODULE_DRIVER_NO_OUTLINES +#define ft_module_driver_has_hinter FT_MODULE_DRIVER_HAS_HINTER + + +typedef FT_Pointer +FT_Module_Interface; + + +/*************************************************************************/ +/* */ +/* <FuncType> */ +/* FT_Module_Constructor */ +/* */ +/* <Description> */ +/* A function used to initialize (not create) a new module object. */ +/* */ +/* <Input> */ +/* module :: The module to initialize. */ +/* */ +typedef FT_Error +(*FT_Module_Constructor)(FT_Module module); + + +/*************************************************************************/ +/* */ +/* <FuncType> */ +/* FT_Module_Destructor */ +/* */ +/* <Description> */ +/* A function used to finalize (not destroy) a given module object. */ +/* */ +/* <Input> */ +/* module :: The module to finalize. */ +/* */ +typedef void +(*FT_Module_Destructor)(FT_Module module); + + +/*************************************************************************/ +/* */ +/* <FuncType> */ +/* FT_Module_Requester */ +/* */ +/* <Description> */ +/* A function used to query a given module for a specific interface. */ +/* */ +/* <Input> */ +/* module :: The module to finalize. */ +/* */ +/* name :: The name of the interface in the module. */ +/* */ +typedef FT_Module_Interface +(*FT_Module_Requester)(FT_Module module, + const char *name); + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Module_Class */ +/* */ +/* <Description> */ +/* The module class descriptor. */ +/* */ +/* <Fields> */ +/* module_flags :: Bit flags describing the module. */ +/* */ +/* module_size :: The size of one module object/instance in */ +/* bytes. */ +/* */ +/* module_name :: The name of the module. */ +/* */ +/* module_version :: The version, as a 16.16 fixed number */ +/* (major.minor). */ +/* */ +/* module_requires :: The version of FreeType this module requires, */ +/* as a 16.16 fixed number (major.minor). Starts */ +/* at version 2.0, i.e., 0x20000. */ +/* */ +/* module_init :: The initializing function. */ +/* */ +/* module_done :: The finalizing function. */ +/* */ +/* get_interface :: The interface requesting function. */ +/* */ +typedef struct FT_Module_Class_ { + FT_ULong module_flags; + FT_Long module_size; + const FT_String *module_name; + FT_Fixed module_version; + FT_Fixed module_requires; + + const void *module_interface; + + FT_Module_Constructor module_init; + FT_Module_Destructor module_done; + FT_Module_Requester get_interface; + +} FT_Module_Class; + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Add_Module */ +/* */ +/* <Description> */ +/* Add a new module to a given library instance. */ +/* */ +/* <InOut> */ +/* library :: A handle to the library object. */ +/* */ +/* <Input> */ +/* clazz :: A pointer to class descriptor for the module. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* An error will be returned if a module already exists by that name, */ +/* or if the module requires a version of FreeType that is too great. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Add_Module( FT_Library +library, +const FT_Module_Class *clazz +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_Module */ +/* */ +/* <Description> */ +/* Find a module by its name. */ +/* */ +/* <Input> */ +/* library :: A handle to the library object. */ +/* */ +/* module_name :: The module's name (as an ASCII string). */ +/* */ +/* <Return> */ +/* A module handle. 0~if none was found. */ +/* */ +/* <Note> */ +/* FreeType's internal modules aren't documented very well, and you */ +/* should look up the source code for details. */ +/* */ +FT_EXPORT( FT_Module ) +FT_Get_Module( FT_Library +library, +const char *module_name +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Remove_Module */ +/* */ +/* <Description> */ +/* Remove a given module from a library instance. */ +/* */ +/* <InOut> */ +/* library :: A handle to a library object. */ +/* */ +/* <Input> */ +/* module :: A handle to a module object. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* The module object is destroyed by the function in case of success. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Remove_Module( FT_Library +library, +FT_Module module +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Reference_Library */ +/* */ +/* <Description> */ +/* A counter gets initialized to~1 at the time an @FT_Library */ +/* structure is created. This function increments the counter. */ +/* @FT_Done_Library then only destroys a library if the counter is~1, */ +/* otherwise it simply decrements the counter. */ +/* */ +/* This function helps in managing life-cycles of structures which */ +/* reference @FT_Library objects. */ +/* */ +/* <Input> */ +/* library :: A handle to a target library object. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Since> */ +/* 2.4.2 */ +/* */ +FT_EXPORT( FT_Error ) +FT_Reference_Library( FT_Library +library ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_New_Library */ +/* */ +/* <Description> */ +/* This function is used to create a new FreeType library instance */ +/* from a given memory object. It is thus possible to use libraries */ +/* with distinct memory allocators within the same program. */ +/* */ +/* Normally, you would call this function (followed by a call to */ +/* @FT_Add_Default_Modules or a series of calls to @FT_Add_Module) */ +/* instead of @FT_Init_FreeType to initialize the FreeType library. */ +/* */ +/* Don't use @FT_Done_FreeType but @FT_Done_Library to destroy a */ +/* library instance. */ +/* */ +/* <Input> */ +/* memory :: A handle to the original memory object. */ +/* */ +/* <Output> */ +/* alibrary :: A pointer to handle of a new library object. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* See the discussion of reference counters in the description of */ +/* @FT_Reference_Library. */ +/* */ +FT_EXPORT( FT_Error ) +FT_New_Library( FT_Memory +memory, +FT_Library *alibrary +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Done_Library */ +/* */ +/* <Description> */ +/* Discard a given library object. This closes all drivers and */ +/* discards all resource objects. */ +/* */ +/* <Input> */ +/* library :: A handle to the target library. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* See the discussion of reference counters in the description of */ +/* @FT_Reference_Library. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Done_Library( FT_Library +library ); + +/* */ + +typedef void +(*FT_DebugHook_Func)(void *arg); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Set_Debug_Hook */ +/* */ +/* <Description> */ +/* Set a debug hook function for debugging the interpreter of a font */ +/* format. */ +/* */ +/* <InOut> */ +/* library :: A handle to the library object. */ +/* */ +/* <Input> */ +/* hook_index :: The index of the debug hook. You should use the */ +/* values defined in `ftobjs.h', e.g., */ +/* `FT_DEBUG_HOOK_TRUETYPE'. */ +/* */ +/* debug_hook :: The function used to debug the interpreter. */ +/* */ +/* <Note> */ +/* Currently, four debug hook slots are available, but only two (for */ +/* the TrueType and the Type~1 interpreter) are defined. */ +/* */ +/* Since the internal headers of FreeType are no longer installed, */ +/* the symbol `FT_DEBUG_HOOK_TRUETYPE' isn't available publicly. */ +/* This is a bug and will be fixed in a forthcoming release. */ +/* */ +FT_EXPORT(void) + +FT_Set_Debug_Hook( FT_Library +library, +FT_UInt hook_index, + FT_DebugHook_Func +debug_hook ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Add_Default_Modules */ +/* */ +/* <Description> */ +/* Add the set of default drivers to a given library object. */ +/* This is only useful when you create a library object with */ +/* @FT_New_Library (usually to plug a custom memory manager). */ +/* */ +/* <InOut> */ +/* library :: A handle to a new library object. */ +/* */ +FT_EXPORT(void) + +FT_Add_Default_Modules( FT_Library +library ); + + + +/************************************************************************** + * + * @section: + * truetype_engine + * + * @title: + * The TrueType Engine + * + * @abstract: + * TrueType bytecode support. + * + * @description: + * This section contains a function used to query the level of TrueType + * bytecode support compiled in this version of the library. + * + */ + + +/************************************************************************** + * + * @enum: + * FT_TrueTypeEngineType + * + * @description: + * A list of values describing which kind of TrueType bytecode + * engine is implemented in a given FT_Library instance. It is used + * by the @FT_Get_TrueType_Engine_Type function. + * + * @values: + * FT_TRUETYPE_ENGINE_TYPE_NONE :: + * The library doesn't implement any kind of bytecode interpreter. + * + * FT_TRUETYPE_ENGINE_TYPE_UNPATENTED :: + * The library implements a bytecode interpreter that doesn't + * support the patented operations of the TrueType virtual machine. + * + * Its main use is to load certain Asian fonts which position and + * scale glyph components with bytecode instructions. It produces + * bad output for most other fonts. + * + * FT_TRUETYPE_ENGINE_TYPE_PATENTED :: + * The library implements a bytecode interpreter that covers + * the full instruction set of the TrueType virtual machine (this + * was governed by patents until May 2010, hence the name). + * + * @since: + * 2.2 + * + */ +typedef enum FT_TrueTypeEngineType_ { + FT_TRUETYPE_ENGINE_TYPE_NONE = 0, + FT_TRUETYPE_ENGINE_TYPE_UNPATENTED, + FT_TRUETYPE_ENGINE_TYPE_PATENTED + +} FT_TrueTypeEngineType; + + +/************************************************************************** + * + * @func: + * FT_Get_TrueType_Engine_Type + * + * @description: + * Return an @FT_TrueTypeEngineType value to indicate which level of + * the TrueType virtual machine a given library instance supports. + * + * @input: + * library :: + * A library instance. + * + * @return: + * A value indicating which level is supported. + * + * @since: + * 2.2 + * + */ +FT_EXPORT( FT_TrueTypeEngineType ) +FT_Get_TrueType_Engine_Type( FT_Library +library ); + + +/* */ + + +FT_END_HEADER + +#endif /* __FTMODAPI_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftmoderr.h b/app/src/main/cpp/include/freetype2/freetype/ftmoderr.h new file mode 100644 index 0000000..4a22705 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftmoderr.h @@ -0,0 +1,156 @@ +/***************************************************************************/ +/* */ +/* ftmoderr.h */ +/* */ +/* FreeType module error offsets (specification). */ +/* */ +/* Copyright 2001, 2002, 2003, 2004, 2005, 2010 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +/*************************************************************************/ +/* */ +/* This file is used to define the FreeType module error offsets. */ +/* */ +/* The lower byte gives the error code, the higher byte gives the */ +/* module. The base module has error offset 0. For example, the error */ +/* `FT_Err_Invalid_File_Format' has value 0x003, the error */ +/* `TT_Err_Invalid_File_Format' has value 0x1103, the error */ +/* `T1_Err_Invalid_File_Format' has value 0x1203, etc. */ +/* */ +/* Undefine the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in ftoption.h */ +/* to make the higher byte always zero (disabling the module error */ +/* mechanism). */ +/* */ +/* It can also be used to create a module error message table easily */ +/* with something like */ +/* */ +/* { */ +/* #undef __FTMODERR_H__ */ +/* #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s }, */ +/* #define FT_MODERR_START_LIST { */ +/* #define FT_MODERR_END_LIST { 0, 0 } }; */ +/* */ +/* const struct */ +/* { */ +/* int mod_err_offset; */ +/* const char* mod_err_msg */ +/* } ft_mod_errors[] = */ +/* */ +/* #include FT_MODULE_ERRORS_H */ +/* } */ +/* */ +/* To use such a table, all errors must be ANDed with 0xFF00 to remove */ +/* the error code. */ +/* */ +/*************************************************************************/ + + +#ifndef __FTMODERR_H__ +#define __FTMODERR_H__ + + +/*******************************************************************/ +/*******************************************************************/ +/***** *****/ +/***** SETUP MACROS *****/ +/***** *****/ +/*******************************************************************/ +/*******************************************************************/ + + +#undef FT_NEED_EXTERN_C + +#ifndef FT_MODERRDEF + +#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS +#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = v, +#else +#define FT_MODERRDEF(e, v, s) FT_Mod_Err_ ## e = 0, +#endif + +#define FT_MODERR_START_LIST enum { +#define FT_MODERR_END_LIST FT_Mod_Err_Max }; + +#ifdef __cplusplus +#define FT_NEED_EXTERN_C +extern "C" { +#endif + +#endif /* !FT_MODERRDEF */ + + +/*******************************************************************/ +/*******************************************************************/ +/***** *****/ +/***** LIST MODULE ERROR BASES *****/ +/***** *****/ +/*******************************************************************/ +/*******************************************************************/ + + +#ifdef FT_MODERR_START_LIST +FT_MODERR_START_LIST +#endif + + + FT_MODERRDEF(Base, 0x000, "base module") + FT_MODERRDEF(Autofit, 0x100, "autofitter module") + FT_MODERRDEF(BDF, 0x200, "BDF module") + FT_MODERRDEF(Bzip2, 0x300, "Bzip2 module") + FT_MODERRDEF(Cache, 0x400, "cache module") + FT_MODERRDEF(CFF, 0x500, "CFF module") + FT_MODERRDEF(CID, 0x600, "CID module") + FT_MODERRDEF(Gzip, 0x700, "Gzip module") + FT_MODERRDEF(LZW, 0x800, "LZW module") + FT_MODERRDEF(OTvalid, 0x900, "OpenType validation module") + FT_MODERRDEF(PCF, 0xA00, "PCF module") + FT_MODERRDEF(PFR, 0xB00, "PFR module") + FT_MODERRDEF(PSaux, 0xC00, "PS auxiliary module") + FT_MODERRDEF(PShinter, 0xD00, "PS hinter module") + FT_MODERRDEF(PSnames, 0xE00, "PS names module") + FT_MODERRDEF(Raster, 0xF00, "raster module") + FT_MODERRDEF(SFNT, 0x1000, "SFNT module") + FT_MODERRDEF(Smooth, 0x1100, "smooth raster module") + FT_MODERRDEF(TrueType, 0x1200, "TrueType module") + FT_MODERRDEF(Type1, 0x1300, "Type 1 module") + FT_MODERRDEF(Type42, 0x1400, "Type 42 module") + FT_MODERRDEF(Winfonts, 0x1500, "Windows FON/FNT module") + + +#ifdef FT_MODERR_END_LIST +FT_MODERR_END_LIST +#endif + + +/*******************************************************************/ +/*******************************************************************/ +/***** *****/ +/***** CLEANUP *****/ +/***** *****/ +/*******************************************************************/ +/*******************************************************************/ + + +#ifdef FT_NEED_EXTERN_C +} +#endif + +#undef FT_MODERR_START_LIST +#undef FT_MODERR_END_LIST +#undef FT_MODERRDEF +#undef FT_NEED_EXTERN_C + + +#endif /* __FTMODERR_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftotval.h b/app/src/main/cpp/include/freetype2/freetype/ftotval.h new file mode 100644 index 0000000..8e102e3 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftotval.h @@ -0,0 +1,211 @@ +/***************************************************************************/ +/* */ +/* ftotval.h */ +/* */ +/* FreeType API for validating OpenType tables (specification). */ +/* */ +/* Copyright 2004, 2005, 2006, 2007 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +/***************************************************************************/ +/* */ +/* */ +/* Warning: This module might be moved to a different library in the */ +/* future to avoid a tight dependency between FreeType and the */ +/* OpenType specification. */ +/* */ +/* */ +/***************************************************************************/ + + +#ifndef __FTOTVAL_H__ +#define __FTOTVAL_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* ot_validation */ +/* */ +/* <Title> */ +/* OpenType Validation */ +/* */ +/* <Abstract> */ +/* An API to validate OpenType tables. */ +/* */ +/* <Description> */ +/* This section contains the declaration of functions to validate */ +/* some OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH). */ +/* */ +/*************************************************************************/ + + +/********************************************************************** + * + * @enum: + * FT_VALIDATE_OTXXX + * + * @description: + * A list of bit-field constants used with @FT_OpenType_Validate to + * indicate which OpenType tables should be validated. + * + * @values: + * FT_VALIDATE_BASE :: + * Validate BASE table. + * + * FT_VALIDATE_GDEF :: + * Validate GDEF table. + * + * FT_VALIDATE_GPOS :: + * Validate GPOS table. + * + * FT_VALIDATE_GSUB :: + * Validate GSUB table. + * + * FT_VALIDATE_JSTF :: + * Validate JSTF table. + * + * FT_VALIDATE_MATH :: + * Validate MATH table. + * + * FT_VALIDATE_OT :: + * Validate all OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH). + * + */ +#define FT_VALIDATE_BASE 0x0100 +#define FT_VALIDATE_GDEF 0x0200 +#define FT_VALIDATE_GPOS 0x0400 +#define FT_VALIDATE_GSUB 0x0800 +#define FT_VALIDATE_JSTF 0x1000 +#define FT_VALIDATE_MATH 0x2000 + +#define FT_VALIDATE_OT FT_VALIDATE_BASE | \ + FT_VALIDATE_GDEF | \ + FT_VALIDATE_GPOS | \ + FT_VALIDATE_GSUB | \ + FT_VALIDATE_JSTF | \ + FT_VALIDATE_MATH + +/* */ + +/********************************************************************** + * + * @function: + * FT_OpenType_Validate + * + * @description: + * Validate various OpenType tables to assure that all offsets and + * indices are valid. The idea is that a higher-level library which + * actually does the text layout can access those tables without + * error checking (which can be quite time consuming). + * + * @input: + * face :: + * A handle to the input face. + * + * validation_flags :: + * A bit field which specifies the tables to be validated. See + * @FT_VALIDATE_OTXXX for possible values. + * + * @output: + * BASE_table :: + * A pointer to the BASE table. + * + * GDEF_table :: + * A pointer to the GDEF table. + * + * GPOS_table :: + * A pointer to the GPOS table. + * + * GSUB_table :: + * A pointer to the GSUB table. + * + * JSTF_table :: + * A pointer to the JSTF table. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function only works with OpenType fonts, returning an error + * otherwise. + * + * After use, the application should deallocate the five tables with + * @FT_OpenType_Free. A NULL value indicates that the table either + * doesn't exist in the font, or the application hasn't asked for + * validation. + */ +FT_EXPORT(FT_Error) + +FT_OpenType_Validate( FT_Face +face, +FT_UInt validation_flags, + FT_Bytes +*BASE_table, +FT_Bytes *GDEF_table, + FT_Bytes +*GPOS_table, +FT_Bytes *GSUB_table, + FT_Bytes +*JSTF_table ); + +/* */ + +/********************************************************************** + * + * @function: + * FT_OpenType_Free + * + * @description: + * Free the buffer allocated by OpenType validator. + * + * @input: + * face :: + * A handle to the input face. + * + * table :: + * The pointer to the buffer that is allocated by + * @FT_OpenType_Validate. + * + * @note: + * This function must be used to free the buffer allocated by + * @FT_OpenType_Validate only. + */ +FT_EXPORT(void) + +FT_OpenType_Free( FT_Face +face, +FT_Bytes table +); + + +/* */ + + +FT_END_HEADER + +#endif /* __FTOTVAL_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftoutln.h b/app/src/main/cpp/include/freetype2/freetype/ftoutln.h new file mode 100644 index 0000000..a0a36dd --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftoutln.h @@ -0,0 +1,586 @@ +/***************************************************************************/ +/* */ +/* ftoutln.h */ +/* */ +/* Support for the FT_Outline type used to store glyph shapes of */ +/* most scalable font formats (specification). */ +/* */ +/* Copyright 1996-2003, 2005-2012 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTOUTLN_H__ +#define __FTOUTLN_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* outline_processing */ +/* */ +/* <Title> */ +/* Outline Processing */ +/* */ +/* <Abstract> */ +/* Functions to create, transform, and render vectorial glyph images. */ +/* */ +/* <Description> */ +/* This section contains routines used to create and destroy scalable */ +/* glyph images known as `outlines'. These can also be measured, */ +/* transformed, and converted into bitmaps and pixmaps. */ +/* */ +/* <Order> */ +/* FT_Outline */ +/* FT_OUTLINE_FLAGS */ +/* FT_Outline_New */ +/* FT_Outline_Done */ +/* FT_Outline_Copy */ +/* FT_Outline_Translate */ +/* FT_Outline_Transform */ +/* FT_Outline_Embolden */ +/* FT_Outline_EmboldenXY */ +/* FT_Outline_Reverse */ +/* FT_Outline_Check */ +/* */ +/* FT_Outline_Get_CBox */ +/* FT_Outline_Get_BBox */ +/* */ +/* FT_Outline_Get_Bitmap */ +/* FT_Outline_Render */ +/* */ +/* FT_Outline_Decompose */ +/* FT_Outline_Funcs */ +/* FT_Outline_MoveTo_Func */ +/* FT_Outline_LineTo_Func */ +/* FT_Outline_ConicTo_Func */ +/* FT_Outline_CubicTo_Func */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Outline_Decompose */ +/* */ +/* <Description> */ +/* Walk over an outline's structure to decompose it into individual */ +/* segments and Bézier arcs. This function also emits `move to' */ +/* operations to indicate the start of new contours in the outline. */ +/* */ +/* <Input> */ +/* outline :: A pointer to the source target. */ +/* */ +/* func_interface :: A table of `emitters', i.e., function pointers */ +/* called during decomposition to indicate path */ +/* operations. */ +/* */ +/* <InOut> */ +/* user :: A typeless pointer which is passed to each */ +/* emitter during the decomposition. It can be */ +/* used to store the state during the */ +/* decomposition. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT(FT_Error) + +FT_Outline_Decompose( FT_Outline +* outline, +const FT_Outline_Funcs *func_interface, +void *user +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Outline_New */ +/* */ +/* <Description> */ +/* Create a new outline of a given size. */ +/* */ +/* <Input> */ +/* library :: A handle to the library object from where the */ +/* outline is allocated. Note however that the new */ +/* outline will *not* necessarily be *freed*, when */ +/* destroying the library, by @FT_Done_FreeType. */ +/* */ +/* numPoints :: The maximum number of points within the outline. */ +/* */ +/* numContours :: The maximum number of contours within the outline. */ +/* */ +/* <Output> */ +/* anoutline :: A handle to the new outline. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* The reason why this function takes a `library' parameter is simply */ +/* to use the library's memory allocator. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Outline_New( FT_Library +library, +FT_UInt numPoints, + FT_Int +numContours, +FT_Outline *anoutline +); + + +FT_EXPORT( FT_Error ) +FT_Outline_New_Internal( FT_Memory +memory, +FT_UInt numPoints, + FT_Int +numContours, +FT_Outline *anoutline +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Outline_Done */ +/* */ +/* <Description> */ +/* Destroy an outline created with @FT_Outline_New. */ +/* */ +/* <Input> */ +/* library :: A handle of the library object used to allocate the */ +/* outline. */ +/* */ +/* outline :: A pointer to the outline object to be discarded. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* If the outline's `owner' field is not set, only the outline */ +/* descriptor will be released. */ +/* */ +/* The reason why this function takes an `library' parameter is */ +/* simply to use ft_mem_free(). */ +/* */ +FT_EXPORT( FT_Error ) +FT_Outline_Done( FT_Library +library, +FT_Outline *outline +); + + +FT_EXPORT( FT_Error ) +FT_Outline_Done_Internal( FT_Memory +memory, +FT_Outline *outline +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Outline_Check */ +/* */ +/* <Description> */ +/* Check the contents of an outline descriptor. */ +/* */ +/* <Input> */ +/* outline :: A handle to a source outline. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Outline_Check( FT_Outline +* outline ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Outline_Get_CBox */ +/* */ +/* <Description> */ +/* Return an outline's `control box'. The control box encloses all */ +/* the outline's points, including Bézier control points. Though it */ +/* coincides with the exact bounding box for most glyphs, it can be */ +/* slightly larger in some situations (like when rotating an outline */ +/* which contains Bézier outside arcs). */ +/* */ +/* Computing the control box is very fast, while getting the bounding */ +/* box can take much more time as it needs to walk over all segments */ +/* and arcs in the outline. To get the latter, you can use the */ +/* `ftbbox' component which is dedicated to this single task. */ +/* */ +/* <Input> */ +/* outline :: A pointer to the source outline descriptor. */ +/* */ +/* <Output> */ +/* acbox :: The outline's control box. */ +/* */ +/* <Note> */ +/* See @FT_Glyph_Get_CBox for a discussion of tricky fonts. */ +/* */ +FT_EXPORT(void) + +FT_Outline_Get_CBox(const FT_Outline *outline, + FT_BBox *acbox); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Outline_Translate */ +/* */ +/* <Description> */ +/* Apply a simple translation to the points of an outline. */ +/* */ +/* <InOut> */ +/* outline :: A pointer to the target outline descriptor. */ +/* */ +/* <Input> */ +/* xOffset :: The horizontal offset. */ +/* */ +/* yOffset :: The vertical offset. */ +/* */ +FT_EXPORT(void) + +FT_Outline_Translate(const FT_Outline *outline, + FT_Pos xOffset, + FT_Pos yOffset); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Outline_Copy */ +/* */ +/* <Description> */ +/* Copy an outline into another one. Both objects must have the */ +/* same sizes (number of points & number of contours) when this */ +/* function is called. */ +/* */ +/* <Input> */ +/* source :: A handle to the source outline. */ +/* */ +/* <Output> */ +/* target :: A handle to the target outline. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) + +FT_Outline_Copy(const FT_Outline *source, + FT_Outline *target); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Outline_Transform */ +/* */ +/* <Description> */ +/* Apply a simple 2x2 matrix to all of an outline's points. Useful */ +/* for applying rotations, slanting, flipping, etc. */ +/* */ +/* <InOut> */ +/* outline :: A pointer to the target outline descriptor. */ +/* */ +/* <Input> */ +/* matrix :: A pointer to the transformation matrix. */ +/* */ +/* <Note> */ +/* You can use @FT_Outline_Translate if you need to translate the */ +/* outline's points. */ +/* */ +FT_EXPORT(void) + +FT_Outline_Transform(const FT_Outline *outline, + const FT_Matrix *matrix); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Outline_Embolden */ +/* */ +/* <Description> */ +/* Embolden an outline. The new outline will be at most 4~times */ +/* `strength' pixels wider and higher. You may think of the left and */ +/* bottom borders as unchanged. */ +/* */ +/* Negative `strength' values to reduce the outline thickness are */ +/* possible also. */ +/* */ +/* <InOut> */ +/* outline :: A handle to the target outline. */ +/* */ +/* <Input> */ +/* strength :: How strong the glyph is emboldened. Expressed in */ +/* 26.6 pixel format. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* The used algorithm to increase or decrease the thickness of the */ +/* glyph doesn't change the number of points; this means that certain */ +/* situations like acute angles or intersections are sometimes */ +/* handled incorrectly. */ +/* */ +/* If you need `better' metrics values you should call */ +/* @FT_Outline_Get_CBox or @FT_Outline_Get_BBox. */ +/* */ +/* Example call: */ +/* */ +/* { */ +/* FT_Load_Glyph( face, index, FT_LOAD_DEFAULT ); */ +/* if ( face->slot->format == FT_GLYPH_FORMAT_OUTLINE ) */ +/* FT_Outline_Embolden( &face->slot->outline, strength ); */ +/* } */ +/* */ +FT_EXPORT( FT_Error ) +FT_Outline_Embolden( FT_Outline +* outline, +FT_Pos strength +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Outline_EmboldenXY */ +/* */ +/* <Description> */ +/* Embolden an outline. The new outline will be `xstrength' pixels */ +/* wider and `ystrength' pixels higher. Otherwise, it is similar to */ +/* @FT_Outline_Embolden, which uses the same strength in both */ +/* directions. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Outline_EmboldenXY( FT_Outline +* outline, +FT_Pos xstrength, + FT_Pos +ystrength ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Outline_Reverse */ +/* */ +/* <Description> */ +/* Reverse the drawing direction of an outline. This is used to */ +/* ensure consistent fill conventions for mirrored glyphs. */ +/* */ +/* <InOut> */ +/* outline :: A pointer to the target outline descriptor. */ +/* */ +/* <Note> */ +/* This function toggles the bit flag @FT_OUTLINE_REVERSE_FILL in */ +/* the outline's `flags' field. */ +/* */ +/* It shouldn't be used by a normal client application, unless it */ +/* knows what it is doing. */ +/* */ +FT_EXPORT(void) + +FT_Outline_Reverse( FT_Outline +* outline ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Outline_Get_Bitmap */ +/* */ +/* <Description> */ +/* Render an outline within a bitmap. The outline's image is simply */ +/* OR-ed to the target bitmap. */ +/* */ +/* <Input> */ +/* library :: A handle to a FreeType library object. */ +/* */ +/* outline :: A pointer to the source outline descriptor. */ +/* */ +/* <InOut> */ +/* abitmap :: A pointer to the target bitmap descriptor. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* This function does NOT CREATE the bitmap, it only renders an */ +/* outline image within the one you pass to it! Consequently, the */ +/* various fields in `abitmap' should be set accordingly. */ +/* */ +/* It will use the raster corresponding to the default glyph format. */ +/* */ +/* The value of the `num_grays' field in `abitmap' is ignored. If */ +/* you select the gray-level rasterizer, and you want less than 256 */ +/* gray levels, you have to use @FT_Outline_Render directly. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Outline_Get_Bitmap( FT_Library +library, +FT_Outline *outline, +const FT_Bitmap *abitmap +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Outline_Render */ +/* */ +/* <Description> */ +/* Render an outline within a bitmap using the current scan-convert. */ +/* This function uses an @FT_Raster_Params structure as an argument, */ +/* allowing advanced features like direct composition, translucency, */ +/* etc. */ +/* */ +/* <Input> */ +/* library :: A handle to a FreeType library object. */ +/* */ +/* outline :: A pointer to the source outline descriptor. */ +/* */ +/* <InOut> */ +/* params :: A pointer to an @FT_Raster_Params structure used to */ +/* describe the rendering operation. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* You should know what you are doing and how @FT_Raster_Params works */ +/* to use this function. */ +/* */ +/* The field `params.source' will be set to `outline' before the scan */ +/* converter is called, which means that the value you give to it is */ +/* actually ignored. */ +/* */ +/* The gray-level rasterizer always uses 256 gray levels. If you */ +/* want less gray levels, you have to provide your own span callback. */ +/* See the @FT_RASTER_FLAG_DIRECT value of the `flags' field in the */ +/* @FT_Raster_Params structure for more details. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Outline_Render( FT_Library +library, +FT_Outline *outline, + FT_Raster_Params +* params ); + + +/************************************************************************** + * + * @enum: + * FT_Orientation + * + * @description: + * A list of values used to describe an outline's contour orientation. + * + * The TrueType and PostScript specifications use different conventions + * to determine whether outline contours should be filled or unfilled. + * + * @values: + * FT_ORIENTATION_TRUETYPE :: + * According to the TrueType specification, clockwise contours must + * be filled, and counter-clockwise ones must be unfilled. + * + * FT_ORIENTATION_POSTSCRIPT :: + * According to the PostScript specification, counter-clockwise contours + * must be filled, and clockwise ones must be unfilled. + * + * FT_ORIENTATION_FILL_RIGHT :: + * This is identical to @FT_ORIENTATION_TRUETYPE, but is used to + * remember that in TrueType, everything that is to the right of + * the drawing direction of a contour must be filled. + * + * FT_ORIENTATION_FILL_LEFT :: + * This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to + * remember that in PostScript, everything that is to the left of + * the drawing direction of a contour must be filled. + * + * FT_ORIENTATION_NONE :: + * The orientation cannot be determined. That is, different parts of + * the glyph have different orientation. + * + */ +typedef enum FT_Orientation_ { + FT_ORIENTATION_TRUETYPE = 0, + FT_ORIENTATION_POSTSCRIPT = 1, + FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE, + FT_ORIENTATION_FILL_LEFT = FT_ORIENTATION_POSTSCRIPT, + FT_ORIENTATION_NONE + +} FT_Orientation; + + +/************************************************************************** + * + * @function: + * FT_Outline_Get_Orientation + * + * @description: + * This function analyzes a glyph outline and tries to compute its + * fill orientation (see @FT_Orientation). This is done by computing + * the direction of each global horizontal and/or vertical extrema + * within the outline. + * + * Note that this will return @FT_ORIENTATION_TRUETYPE for empty + * outlines. + * + * @input: + * outline :: + * A handle to the source outline. + * + * @return: + * The orientation. + * + */ +FT_EXPORT( FT_Orientation ) +FT_Outline_Get_Orientation( FT_Outline +* outline ); + + +/* */ + + +FT_END_HEADER + +#endif /* __FTOUTLN_H__ */ + + +/* END */ + + +/* Local Variables: */ +/* coding: utf-8 */ +/* End: */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftpfr.h b/app/src/main/cpp/include/freetype2/freetype/ftpfr.h new file mode 100644 index 0000000..58748dc --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftpfr.h @@ -0,0 +1,181 @@ +/***************************************************************************/ +/* */ +/* ftpfr.h */ +/* */ +/* FreeType API for accessing PFR-specific data (specification only). */ +/* */ +/* Copyright 2002, 2003, 2004, 2006, 2008, 2009 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTPFR_H__ +#define __FTPFR_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* pfr_fonts */ +/* */ +/* <Title> */ +/* PFR Fonts */ +/* */ +/* <Abstract> */ +/* PFR/TrueDoc specific API. */ +/* */ +/* <Description> */ +/* This section contains the declaration of PFR-specific functions. */ +/* */ +/*************************************************************************/ + + +/********************************************************************** + * + * @function: + * FT_Get_PFR_Metrics + * + * @description: + * Return the outline and metrics resolutions of a given PFR face. + * + * @input: + * face :: Handle to the input face. It can be a non-PFR face. + * + * @output: + * aoutline_resolution :: + * Outline resolution. This is equivalent to `face->units_per_EM' + * for non-PFR fonts. Optional (parameter can be NULL). + * + * ametrics_resolution :: + * Metrics resolution. This is equivalent to `outline_resolution' + * for non-PFR fonts. Optional (parameter can be NULL). + * + * ametrics_x_scale :: + * A 16.16 fixed-point number used to scale distance expressed + * in metrics units to device sub-pixels. This is equivalent to + * `face->size->x_scale', but for metrics only. Optional (parameter + * can be NULL). + * + * ametrics_y_scale :: + * Same as `ametrics_x_scale' but for the vertical direction. + * optional (parameter can be NULL). + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * If the input face is not a PFR, this function will return an error. + * However, in all cases, it will return valid values. + */ +FT_EXPORT(FT_Error) + +FT_Get_PFR_Metrics( FT_Face +face, +FT_UInt *aoutline_resolution, + FT_UInt +*ametrics_resolution, +FT_Fixed *ametrics_x_scale, + FT_Fixed +*ametrics_y_scale ); + + +/********************************************************************** + * + * @function: + * FT_Get_PFR_Kerning + * + * @description: + * Return the kerning pair corresponding to two glyphs in a PFR face. + * The distance is expressed in metrics units, unlike the result of + * @FT_Get_Kerning. + * + * @input: + * face :: A handle to the input face. + * + * left :: Index of the left glyph. + * + * right :: Index of the right glyph. + * + * @output: + * avector :: A kerning vector. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function always return distances in original PFR metrics + * units. This is unlike @FT_Get_Kerning with the @FT_KERNING_UNSCALED + * mode, which always returns distances converted to outline units. + * + * You can use the value of the `x_scale' and `y_scale' parameters + * returned by @FT_Get_PFR_Metrics to scale these to device sub-pixels. + */ +FT_EXPORT( FT_Error ) +FT_Get_PFR_Kerning( FT_Face +face, +FT_UInt left, + FT_UInt +right, +FT_Vector *avector +); + + +/********************************************************************** + * + * @function: + * FT_Get_PFR_Advance + * + * @description: + * Return a given glyph advance, expressed in original metrics units, + * from a PFR font. + * + * @input: + * face :: A handle to the input face. + * + * gindex :: The glyph index. + * + * @output: + * aadvance :: The glyph advance in metrics units. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * You can use the `x_scale' or `y_scale' results of @FT_Get_PFR_Metrics + * to convert the advance to device sub-pixels (i.e., 1/64th of pixels). + */ +FT_EXPORT( FT_Error ) +FT_Get_PFR_Advance( FT_Face +face, +FT_UInt gindex, + FT_Pos +*aadvance ); + +/* */ + + +FT_END_HEADER + +#endif /* __FTPFR_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftrender.h b/app/src/main/cpp/include/freetype2/freetype/ftrender.h new file mode 100644 index 0000000..17dc3a1 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftrender.h @@ -0,0 +1,241 @@ +/***************************************************************************/ +/* */ +/* ftrender.h */ +/* */ +/* FreeType renderer modules public interface (specification). */ +/* */ +/* Copyright 1996-2001, 2005, 2006, 2010 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTRENDER_H__ +#define __FTRENDER_H__ + + +#include <ft2build.h> +#include FT_MODULE_H +#include FT_GLYPH_H + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* module_management */ +/* */ +/*************************************************************************/ + + +/* create a new glyph object */ +typedef FT_Error + (*FT_Glyph_InitFunc)(FT_Glyph glyph, + FT_GlyphSlot slot); + +/* destroys a given glyph object */ +typedef void +(*FT_Glyph_DoneFunc)(FT_Glyph glyph); + +typedef void +(*FT_Glyph_TransformFunc)(FT_Glyph glyph, + const FT_Matrix *matrix, + const FT_Vector *delta); + +typedef void +(*FT_Glyph_GetBBoxFunc)(FT_Glyph glyph, + FT_BBox *abbox); + +typedef FT_Error +(*FT_Glyph_CopyFunc)(FT_Glyph source, + FT_Glyph target); + +typedef FT_Error +(*FT_Glyph_PrepareFunc)(FT_Glyph glyph, + FT_GlyphSlot slot); + +/* deprecated */ +#define FT_Glyph_Init_Func FT_Glyph_InitFunc +#define FT_Glyph_Done_Func FT_Glyph_DoneFunc +#define FT_Glyph_Transform_Func FT_Glyph_TransformFunc +#define FT_Glyph_BBox_Func FT_Glyph_GetBBoxFunc +#define FT_Glyph_Copy_Func FT_Glyph_CopyFunc +#define FT_Glyph_Prepare_Func FT_Glyph_PrepareFunc + + +struct FT_Glyph_Class_ { + FT_Long glyph_size; + FT_Glyph_Format glyph_format; + FT_Glyph_InitFunc glyph_init; + FT_Glyph_DoneFunc glyph_done; + FT_Glyph_CopyFunc glyph_copy; + FT_Glyph_TransformFunc glyph_transform; + FT_Glyph_GetBBoxFunc glyph_bbox; + FT_Glyph_PrepareFunc glyph_prepare; +}; + + +typedef FT_Error +(*FT_Renderer_RenderFunc)(FT_Renderer renderer, + FT_GlyphSlot slot, + FT_UInt mode, + const FT_Vector *origin); + +typedef FT_Error +(*FT_Renderer_TransformFunc)(FT_Renderer renderer, + FT_GlyphSlot slot, + const FT_Matrix *matrix, + const FT_Vector *delta); + + +typedef void +(*FT_Renderer_GetCBoxFunc)(FT_Renderer renderer, + FT_GlyphSlot slot, + FT_BBox *cbox); + + +typedef FT_Error +(*FT_Renderer_SetModeFunc)(FT_Renderer renderer, + FT_ULong mode_tag, + FT_Pointer mode_ptr); + +/* deprecated identifiers */ +#define FTRenderer_render FT_Renderer_RenderFunc +#define FTRenderer_transform FT_Renderer_TransformFunc +#define FTRenderer_getCBox FT_Renderer_GetCBoxFunc +#define FTRenderer_setMode FT_Renderer_SetModeFunc + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Renderer_Class */ +/* */ +/* <Description> */ +/* The renderer module class descriptor. */ +/* */ +/* <Fields> */ +/* root :: The root @FT_Module_Class fields. */ +/* */ +/* glyph_format :: The glyph image format this renderer handles. */ +/* */ +/* render_glyph :: A method used to render the image that is in a */ +/* given glyph slot into a bitmap. */ +/* */ +/* transform_glyph :: A method used to transform the image that is in */ +/* a given glyph slot. */ +/* */ +/* get_glyph_cbox :: A method used to access the glyph's cbox. */ +/* */ +/* set_mode :: A method used to pass additional parameters. */ +/* */ +/* raster_class :: For @FT_GLYPH_FORMAT_OUTLINE renderers only. */ +/* This is a pointer to its raster's class. */ +/* */ +typedef struct FT_Renderer_Class_ { + FT_Module_Class root; + + FT_Glyph_Format glyph_format; + + FT_Renderer_RenderFunc render_glyph; + FT_Renderer_TransformFunc transform_glyph; + FT_Renderer_GetCBoxFunc get_glyph_cbox; + FT_Renderer_SetModeFunc set_mode; + + FT_Raster_Funcs *raster_class; + +} FT_Renderer_Class; + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_Renderer */ +/* */ +/* <Description> */ +/* Retrieve the current renderer for a given glyph format. */ +/* */ +/* <Input> */ +/* library :: A handle to the library object. */ +/* */ +/* format :: The glyph format. */ +/* */ +/* <Return> */ +/* A renderer handle. 0~if none found. */ +/* */ +/* <Note> */ +/* An error will be returned if a module already exists by that name, */ +/* or if the module requires a version of FreeType that is too great. */ +/* */ +/* To add a new renderer, simply use @FT_Add_Module. To retrieve a */ +/* renderer by its name, use @FT_Get_Module. */ +/* */ +FT_EXPORT( FT_Renderer ) +FT_Get_Renderer( FT_Library +library, +FT_Glyph_Format format +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Set_Renderer */ +/* */ +/* <Description> */ +/* Set the current renderer to use, and set additional mode. */ +/* */ +/* <InOut> */ +/* library :: A handle to the library object. */ +/* */ +/* <Input> */ +/* renderer :: A handle to the renderer object. */ +/* */ +/* num_params :: The number of additional parameters. */ +/* */ +/* parameters :: Additional parameters. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* In case of success, the renderer will be used to convert glyph */ +/* images in the renderer's known format into bitmaps. */ +/* */ +/* This doesn't change the current renderer for other formats. */ +/* */ +/* Currently, only the B/W renderer, if compiled with */ +/* FT_RASTER_OPTION_ANTI_ALIASING (providing a 5-levels */ +/* anti-aliasing mode; this option must be set directly in */ +/* `ftraster.c' and is undefined by default) accepts a single tag */ +/* `pal5' to set its gray palette as a character string with */ +/* 5~elements. Consequently, the third and fourth argument are zero */ +/* normally. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Set_Renderer( FT_Library +library, +FT_Renderer renderer, + FT_UInt +num_params, +FT_Parameter *parameters +); + + +/* */ + + +FT_END_HEADER + +#endif /* __FTRENDER_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftsizes.h b/app/src/main/cpp/include/freetype2/freetype/ftsizes.h new file mode 100644 index 0000000..f3235da --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftsizes.h @@ -0,0 +1,164 @@ +/***************************************************************************/ +/* */ +/* ftsizes.h */ +/* */ +/* FreeType size objects management (specification). */ +/* */ +/* Copyright 1996-2001, 2003, 2004, 2006, 2009 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +/*************************************************************************/ +/* */ +/* Typical application would normally not need to use these functions. */ +/* However, they have been placed in a public API for the rare cases */ +/* where they are needed. */ +/* */ +/*************************************************************************/ + + +#ifndef __FTSIZES_H__ +#define __FTSIZES_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* sizes_management */ +/* */ +/* <Title> */ +/* Size Management */ +/* */ +/* <Abstract> */ +/* Managing multiple sizes per face. */ +/* */ +/* <Description> */ +/* When creating a new face object (e.g., with @FT_New_Face), an */ +/* @FT_Size object is automatically created and used to store all */ +/* pixel-size dependent information, available in the `face->size' */ +/* field. */ +/* */ +/* It is however possible to create more sizes for a given face, */ +/* mostly in order to manage several character pixel sizes of the */ +/* same font family and style. See @FT_New_Size and @FT_Done_Size. */ +/* */ +/* Note that @FT_Set_Pixel_Sizes and @FT_Set_Char_Size only */ +/* modify the contents of the current `active' size; you thus need */ +/* to use @FT_Activate_Size to change it. */ +/* */ +/* 99% of applications won't need the functions provided here, */ +/* especially if they use the caching sub-system, so be cautious */ +/* when using these. */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_New_Size */ +/* */ +/* <Description> */ +/* Create a new size object from a given face object. */ +/* */ +/* <Input> */ +/* face :: A handle to a parent face object. */ +/* */ +/* <Output> */ +/* asize :: A handle to a new size object. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* You need to call @FT_Activate_Size in order to select the new size */ +/* for upcoming calls to @FT_Set_Pixel_Sizes, @FT_Set_Char_Size, */ +/* @FT_Load_Glyph, @FT_Load_Char, etc. */ +/* */ +FT_EXPORT(FT_Error) + +FT_New_Size( FT_Face +face, +FT_Size *size +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Done_Size */ +/* */ +/* <Description> */ +/* Discard a given size object. Note that @FT_Done_Face */ +/* automatically discards all size objects allocated with */ +/* @FT_New_Size. */ +/* */ +/* <Input> */ +/* size :: A handle to a target size object. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Done_Size( FT_Size +size ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Activate_Size */ +/* */ +/* <Description> */ +/* Even though it is possible to create several size objects for a */ +/* given face (see @FT_New_Size for details), functions like */ +/* @FT_Load_Glyph or @FT_Load_Char only use the one which has been */ +/* activated last to determine the `current character pixel size'. */ +/* */ +/* This function can be used to `activate' a previously created size */ +/* object. */ +/* */ +/* <Input> */ +/* size :: A handle to a target size object. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* If `face' is the size's parent face object, this function changes */ +/* the value of `face->size' to the input size handle. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Activate_Size( FT_Size +size ); + +/* */ + + +FT_END_HEADER + +#endif /* __FTSIZES_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftsnames.h b/app/src/main/cpp/include/freetype2/freetype/ftsnames.h new file mode 100644 index 0000000..08ad1fb --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftsnames.h @@ -0,0 +1,202 @@ +/***************************************************************************/ +/* */ +/* ftsnames.h */ +/* */ +/* Simple interface to access SFNT name tables (which are used */ +/* to hold font names, copyright info, notices, etc.) (specification). */ +/* */ +/* This is _not_ used to retrieve glyph names! */ +/* */ +/* Copyright 1996-2001, 2002, 2003, 2006, 2009, 2010 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FT_SFNT_NAMES_H__ +#define __FT_SFNT_NAMES_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* sfnt_names */ +/* */ +/* <Title> */ +/* SFNT Names */ +/* */ +/* <Abstract> */ +/* Access the names embedded in TrueType and OpenType files. */ +/* */ +/* <Description> */ +/* The TrueType and OpenType specifications allow the inclusion of */ +/* a special `names table' in font files. This table contains */ +/* textual (and internationalized) information regarding the font, */ +/* like family name, copyright, version, etc. */ +/* */ +/* The definitions below are used to access them if available. */ +/* */ +/* Note that this has nothing to do with glyph names! */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_SfntName */ +/* */ +/* <Description> */ +/* A structure used to model an SFNT `name' table entry. */ +/* */ +/* <Fields> */ +/* platform_id :: The platform ID for `string'. */ +/* */ +/* encoding_id :: The encoding ID for `string'. */ +/* */ +/* language_id :: The language ID for `string'. */ +/* */ +/* name_id :: An identifier for `string'. */ +/* */ +/* string :: The `name' string. Note that its format differs */ +/* depending on the (platform,encoding) pair. It can */ +/* be a Pascal String, a UTF-16 one, etc. */ +/* */ +/* Generally speaking, the string is not */ +/* zero-terminated. Please refer to the TrueType */ +/* specification for details. */ +/* */ +/* string_len :: The length of `string' in bytes. */ +/* */ +/* <Note> */ +/* Possible values for `platform_id', `encoding_id', `language_id', */ +/* and `name_id' are given in the file `ttnameid.h'. For details */ +/* please refer to the TrueType or OpenType specification. */ +/* */ +/* See also @TT_PLATFORM_XXX, @TT_APPLE_ID_XXX, @TT_MAC_ID_XXX, */ +/* @TT_ISO_ID_XXX, and @TT_MS_ID_XXX. */ +/* */ +typedef struct FT_SfntName_ { + FT_UShort platform_id; + FT_UShort encoding_id; + FT_UShort language_id; + FT_UShort name_id; + + FT_Byte *string; /* this string is *not* null-terminated! */ + FT_UInt string_len; /* in bytes */ + +} FT_SfntName; + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_Sfnt_Name_Count */ +/* */ +/* <Description> */ +/* Retrieve the number of name strings in the SFNT `name' table. */ +/* */ +/* <Input> */ +/* face :: A handle to the source face. */ +/* */ +/* <Return> */ +/* The number of strings in the `name' table. */ +/* */ +FT_EXPORT( FT_UInt ) +FT_Get_Sfnt_Name_Count( FT_Face +face ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_Sfnt_Name */ +/* */ +/* <Description> */ +/* Retrieve a string of the SFNT `name' table for a given index. */ +/* */ +/* <Input> */ +/* face :: A handle to the source face. */ +/* */ +/* idx :: The index of the `name' string. */ +/* */ +/* <Output> */ +/* aname :: The indexed @FT_SfntName structure. */ +/* */ +/* <Return> */ +/* FreeType error code. 0~means success. */ +/* */ +/* <Note> */ +/* The `string' array returned in the `aname' structure is not */ +/* null-terminated. The application should deallocate it if it is no */ +/* longer in use. */ +/* */ +/* Use @FT_Get_Sfnt_Name_Count to get the total number of available */ +/* `name' table entries, then do a loop until you get the right */ +/* platform, encoding, and name ID. */ +/* */ +FT_EXPORT( FT_Error ) +FT_Get_Sfnt_Name( FT_Face +face, +FT_UInt idx, + FT_SfntName +*aname ); + + +/*************************************************************************** + * + * @constant: + * FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY + * + * @description: + * A constant used as the tag of @FT_Parameter structures to make + * FT_Open_Face() ignore preferred family subfamily names in `name' + * table since OpenType version 1.4. For backwards compatibility with + * legacy systems which has 4-face-per-family restriction. + * + */ +#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY FT_MAKE_TAG( 'i', 'g', 'p', 'f' ) + + +/*************************************************************************** + * + * @constant: + * FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY + * + * @description: + * A constant used as the tag of @FT_Parameter structures to make + * FT_Open_Face() ignore preferred subfamily names in `name' table since + * OpenType version 1.4. For backwards compatibility with legacy + * systems which has 4-face-per-family restriction. + * + */ +#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY FT_MAKE_TAG( 'i', 'g', 'p', 's' ) + +/* */ + + +FT_END_HEADER + +#endif /* __FT_SFNT_NAMES_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftstroke.h b/app/src/main/cpp/include/freetype2/freetype/ftstroke.h new file mode 100644 index 0000000..4a90e18 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftstroke.h @@ -0,0 +1,788 @@ +/***************************************************************************/ +/* */ +/* ftstroke.h */ +/* */ +/* FreeType path stroker (specification). */ +/* */ +/* Copyright 2002-2006, 2008, 2009, 2011-2012 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FT_STROKE_H__ +#define __FT_STROKE_H__ + +#include <ft2build.h> +#include FT_OUTLINE_H +#include FT_GLYPH_H + + +FT_BEGIN_HEADER + + +/************************************************************************ + * + * @section: + * glyph_stroker + * + * @title: + * Glyph Stroker + * + * @abstract: + * Generating bordered and stroked glyphs. + * + * @description: + * This component generates stroked outlines of a given vectorial + * glyph. It also allows you to retrieve the `outside' and/or the + * `inside' borders of the stroke. + * + * This can be useful to generate `bordered' glyph, i.e., glyphs + * displayed with a coloured (and anti-aliased) border around their + * shape. + */ + + +/************************************************************** + * + * @type: + * FT_Stroker + * + * @description: + * Opaque handler to a path stroker object. + */ +typedef struct FT_StrokerRec_ *FT_Stroker; + + +/************************************************************** + * + * @enum: + * FT_Stroker_LineJoin + * + * @description: + * These values determine how two joining lines are rendered + * in a stroker. + * + * @values: + * FT_STROKER_LINEJOIN_ROUND :: + * Used to render rounded line joins. Circular arcs are used + * to join two lines smoothly. + * + * FT_STROKER_LINEJOIN_BEVEL :: + * Used to render beveled line joins. The outer corner of + * the joined lines is filled by enclosing the triangular + * region of the corner with a straight line between the + * outer corners of each stroke. + * + * FT_STROKER_LINEJOIN_MITER_FIXED :: + * Used to render mitered line joins, with fixed bevels if the + * miter limit is exceeded. The outer edges of the strokes + * for the two segments are extended until they meet at an + * angle. If the segments meet at too sharp an angle (such + * that the miter would extend from the intersection of the + * segments a distance greater than the product of the miter + * limit value and the border radius), then a bevel join (see + * above) is used instead. This prevents long spikes being + * created. FT_STROKER_LINEJOIN_MITER_FIXED generates a miter + * line join as used in PostScript and PDF. + * + * FT_STROKER_LINEJOIN_MITER_VARIABLE :: + * FT_STROKER_LINEJOIN_MITER :: + * Used to render mitered line joins, with variable bevels if + * the miter limit is exceeded. The intersection of the + * strokes is clipped at a line perpendicular to the bisector + * of the angle between the strokes, at the distance from the + * intersection of the segments equal to the product of the + * miter limit value and the border radius. This prevents + * long spikes being created. + * FT_STROKER_LINEJOIN_MITER_VARIABLE generates a mitered line + * join as used in XPS. FT_STROKER_LINEJOIN_MITER is an alias + * for FT_STROKER_LINEJOIN_MITER_VARIABLE, retained for + * backwards compatibility. + */ +typedef enum FT_Stroker_LineJoin_ { + FT_STROKER_LINEJOIN_ROUND = 0, + FT_STROKER_LINEJOIN_BEVEL = 1, + FT_STROKER_LINEJOIN_MITER_VARIABLE = 2, + FT_STROKER_LINEJOIN_MITER = FT_STROKER_LINEJOIN_MITER_VARIABLE, + FT_STROKER_LINEJOIN_MITER_FIXED = 3 + +} FT_Stroker_LineJoin; + + +/************************************************************** + * + * @enum: + * FT_Stroker_LineCap + * + * @description: + * These values determine how the end of opened sub-paths are + * rendered in a stroke. + * + * @values: + * FT_STROKER_LINECAP_BUTT :: + * The end of lines is rendered as a full stop on the last + * point itself. + * + * FT_STROKER_LINECAP_ROUND :: + * The end of lines is rendered as a half-circle around the + * last point. + * + * FT_STROKER_LINECAP_SQUARE :: + * The end of lines is rendered as a square around the + * last point. + */ +typedef enum FT_Stroker_LineCap_ { + FT_STROKER_LINECAP_BUTT = 0, + FT_STROKER_LINECAP_ROUND, + FT_STROKER_LINECAP_SQUARE + +} FT_Stroker_LineCap; + + +/************************************************************** + * + * @enum: + * FT_StrokerBorder + * + * @description: + * These values are used to select a given stroke border + * in @FT_Stroker_GetBorderCounts and @FT_Stroker_ExportBorder. + * + * @values: + * FT_STROKER_BORDER_LEFT :: + * Select the left border, relative to the drawing direction. + * + * FT_STROKER_BORDER_RIGHT :: + * Select the right border, relative to the drawing direction. + * + * @note: + * Applications are generally interested in the `inside' and `outside' + * borders. However, there is no direct mapping between these and the + * `left' and `right' ones, since this really depends on the glyph's + * drawing orientation, which varies between font formats. + * + * You can however use @FT_Outline_GetInsideBorder and + * @FT_Outline_GetOutsideBorder to get these. + */ +typedef enum FT_StrokerBorder_ { + FT_STROKER_BORDER_LEFT = 0, + FT_STROKER_BORDER_RIGHT + +} FT_StrokerBorder; + + +/************************************************************** + * + * @function: + * FT_Outline_GetInsideBorder + * + * @description: + * Retrieve the @FT_StrokerBorder value corresponding to the + * `inside' borders of a given outline. + * + * @input: + * outline :: + * The source outline handle. + * + * @return: + * The border index. @FT_STROKER_BORDER_RIGHT for empty or invalid + * outlines. + */ +FT_EXPORT( FT_StrokerBorder ) +FT_Outline_GetInsideBorder( FT_Outline +* outline ); + + +/************************************************************** + * + * @function: + * FT_Outline_GetOutsideBorder + * + * @description: + * Retrieve the @FT_StrokerBorder value corresponding to the + * `outside' borders of a given outline. + * + * @input: + * outline :: + * The source outline handle. + * + * @return: + * The border index. @FT_STROKER_BORDER_LEFT for empty or invalid + * outlines. + */ +FT_EXPORT( FT_StrokerBorder ) +FT_Outline_GetOutsideBorder( FT_Outline +* outline ); + + +/************************************************************** + * + * @function: + * FT_Stroker_New + * + * @description: + * Create a new stroker object. + * + * @input: + * library :: + * FreeType library handle. + * + * @output: + * astroker :: + * A new stroker object handle. NULL in case of error. + * + * @return: + * FreeType error code. 0~means success. + */ +FT_EXPORT( FT_Error ) +FT_Stroker_New( FT_Library +library, +FT_Stroker *astroker +); + + +/************************************************************** + * + * @function: + * FT_Stroker_Set + * + * @description: + * Reset a stroker object's attributes. + * + * @input: + * stroker :: + * The target stroker handle. + * + * radius :: + * The border radius. + * + * line_cap :: + * The line cap style. + * + * line_join :: + * The line join style. + * + * miter_limit :: + * The miter limit for the FT_STROKER_LINEJOIN_MITER_FIXED and + * FT_STROKER_LINEJOIN_MITER_VARIABLE line join styles, + * expressed as 16.16 fixed point value. + * + * @note: + * The radius is expressed in the same units as the outline + * coordinates. + */ +FT_EXPORT(void) + +FT_Stroker_Set( FT_Stroker +stroker, +FT_Fixed radius, + FT_Stroker_LineCap +line_cap, +FT_Stroker_LineJoin line_join, + FT_Fixed +miter_limit ); + + +/************************************************************** + * + * @function: + * FT_Stroker_Rewind + * + * @description: + * Reset a stroker object without changing its attributes. + * You should call this function before beginning a new + * series of calls to @FT_Stroker_BeginSubPath or + * @FT_Stroker_EndSubPath. + * + * @input: + * stroker :: + * The target stroker handle. + */ +FT_EXPORT(void) + +FT_Stroker_Rewind( FT_Stroker +stroker ); + + +/************************************************************** + * + * @function: + * FT_Stroker_ParseOutline + * + * @description: + * A convenience function used to parse a whole outline with + * the stroker. The resulting outline(s) can be retrieved + * later by functions like @FT_Stroker_GetCounts and @FT_Stroker_Export. + * + * @input: + * stroker :: + * The target stroker handle. + * + * outline :: + * The source outline. + * + * opened :: + * A boolean. If~1, the outline is treated as an open path instead + * of a closed one. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * If `opened' is~0 (the default), the outline is treated as a closed + * path, and the stroker generates two distinct `border' outlines. + * + * If `opened' is~1, the outline is processed as an open path, and the + * stroker generates a single `stroke' outline. + * + * This function calls @FT_Stroker_Rewind automatically. + */ +FT_EXPORT( FT_Error ) +FT_Stroker_ParseOutline( FT_Stroker +stroker, +FT_Outline *outline, + FT_Bool +opened ); + + +/************************************************************** + * + * @function: + * FT_Stroker_BeginSubPath + * + * @description: + * Start a new sub-path in the stroker. + * + * @input: + * stroker :: + * The target stroker handle. + * + * to :: + * A pointer to the start vector. + * + * open :: + * A boolean. If~1, the sub-path is treated as an open one. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function is useful when you need to stroke a path that is + * not stored as an @FT_Outline object. + */ +FT_EXPORT( FT_Error ) +FT_Stroker_BeginSubPath( FT_Stroker +stroker, +FT_Vector *to, + FT_Bool +open ); + + +/************************************************************** + * + * @function: + * FT_Stroker_EndSubPath + * + * @description: + * Close the current sub-path in the stroker. + * + * @input: + * stroker :: + * The target stroker handle. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * You should call this function after @FT_Stroker_BeginSubPath. + * If the subpath was not `opened', this function `draws' a + * single line segment to the start position when needed. + */ +FT_EXPORT( FT_Error ) +FT_Stroker_EndSubPath( FT_Stroker +stroker ); + + +/************************************************************** + * + * @function: + * FT_Stroker_LineTo + * + * @description: + * `Draw' a single line segment in the stroker's current sub-path, + * from the last position. + * + * @input: + * stroker :: + * The target stroker handle. + * + * to :: + * A pointer to the destination point. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * You should call this function between @FT_Stroker_BeginSubPath and + * @FT_Stroker_EndSubPath. + */ +FT_EXPORT( FT_Error ) +FT_Stroker_LineTo( FT_Stroker +stroker, +FT_Vector *to +); + + +/************************************************************** + * + * @function: + * FT_Stroker_ConicTo + * + * @description: + * `Draw' a single quadratic Bézier in the stroker's current sub-path, + * from the last position. + * + * @input: + * stroker :: + * The target stroker handle. + * + * control :: + * A pointer to a Bézier control point. + * + * to :: + * A pointer to the destination point. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * You should call this function between @FT_Stroker_BeginSubPath and + * @FT_Stroker_EndSubPath. + */ +FT_EXPORT( FT_Error ) +FT_Stroker_ConicTo( FT_Stroker +stroker, +FT_Vector *control, + FT_Vector +* to ); + + +/************************************************************** + * + * @function: + * FT_Stroker_CubicTo + * + * @description: + * `Draw' a single cubic Bézier in the stroker's current sub-path, + * from the last position. + * + * @input: + * stroker :: + * The target stroker handle. + * + * control1 :: + * A pointer to the first Bézier control point. + * + * control2 :: + * A pointer to second Bézier control point. + * + * to :: + * A pointer to the destination point. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * You should call this function between @FT_Stroker_BeginSubPath and + * @FT_Stroker_EndSubPath. + */ +FT_EXPORT( FT_Error ) +FT_Stroker_CubicTo( FT_Stroker +stroker, +FT_Vector *control1, + FT_Vector +* control2, +FT_Vector *to +); + + +/************************************************************** + * + * @function: + * FT_Stroker_GetBorderCounts + * + * @description: + * Call this function once you have finished parsing your paths + * with the stroker. It returns the number of points and + * contours necessary to export one of the `border' or `stroke' + * outlines generated by the stroker. + * + * @input: + * stroker :: + * The target stroker handle. + * + * border :: + * The border index. + * + * @output: + * anum_points :: + * The number of points. + * + * anum_contours :: + * The number of contours. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * When an outline, or a sub-path, is `closed', the stroker generates + * two independent `border' outlines, named `left' and `right'. + * + * When the outline, or a sub-path, is `opened', the stroker merges + * the `border' outlines with caps. The `left' border receives all + * points, while the `right' border becomes empty. + * + * Use the function @FT_Stroker_GetCounts instead if you want to + * retrieve the counts associated to both borders. + */ +FT_EXPORT( FT_Error ) +FT_Stroker_GetBorderCounts( FT_Stroker +stroker, +FT_StrokerBorder border, + FT_UInt +*anum_points, +FT_UInt *anum_contours +); + + +/************************************************************** + * + * @function: + * FT_Stroker_ExportBorder + * + * @description: + * Call this function after @FT_Stroker_GetBorderCounts to + * export the corresponding border to your own @FT_Outline + * structure. + * + * Note that this function appends the border points and + * contours to your outline, but does not try to resize its + * arrays. + * + * @input: + * stroker :: + * The target stroker handle. + * + * border :: + * The border index. + * + * outline :: + * The target outline handle. + * + * @note: + * Always call this function after @FT_Stroker_GetBorderCounts to + * get sure that there is enough room in your @FT_Outline object to + * receive all new data. + * + * When an outline, or a sub-path, is `closed', the stroker generates + * two independent `border' outlines, named `left' and `right' + * + * When the outline, or a sub-path, is `opened', the stroker merges + * the `border' outlines with caps. The `left' border receives all + * points, while the `right' border becomes empty. + * + * Use the function @FT_Stroker_Export instead if you want to + * retrieve all borders at once. + */ +FT_EXPORT(void) + +FT_Stroker_ExportBorder( FT_Stroker +stroker, +FT_StrokerBorder border, + FT_Outline +* outline ); + + +/************************************************************** + * + * @function: + * FT_Stroker_GetCounts + * + * @description: + * Call this function once you have finished parsing your paths + * with the stroker. It returns the number of points and + * contours necessary to export all points/borders from the stroked + * outline/path. + * + * @input: + * stroker :: + * The target stroker handle. + * + * @output: + * anum_points :: + * The number of points. + * + * anum_contours :: + * The number of contours. + * + * @return: + * FreeType error code. 0~means success. + */ +FT_EXPORT( FT_Error ) +FT_Stroker_GetCounts( FT_Stroker +stroker, +FT_UInt *anum_points, + FT_UInt +*anum_contours ); + + +/************************************************************** + * + * @function: + * FT_Stroker_Export + * + * @description: + * Call this function after @FT_Stroker_GetBorderCounts to + * export all borders to your own @FT_Outline structure. + * + * Note that this function appends the border points and + * contours to your outline, but does not try to resize its + * arrays. + * + * @input: + * stroker :: + * The target stroker handle. + * + * outline :: + * The target outline handle. + */ +FT_EXPORT(void) + +FT_Stroker_Export( FT_Stroker +stroker, +FT_Outline *outline +); + + +/************************************************************** + * + * @function: + * FT_Stroker_Done + * + * @description: + * Destroy a stroker object. + * + * @input: + * stroker :: + * A stroker handle. Can be NULL. + */ +FT_EXPORT(void) + +FT_Stroker_Done( FT_Stroker +stroker ); + + +/************************************************************** + * + * @function: + * FT_Glyph_Stroke + * + * @description: + * Stroke a given outline glyph object with a given stroker. + * + * @inout: + * pglyph :: + * Source glyph handle on input, new glyph handle on output. + * + * @input: + * stroker :: + * A stroker handle. + * + * destroy :: + * A Boolean. If~1, the source glyph object is destroyed + * on success. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The source glyph is untouched in case of error. + * + * Adding stroke may yield a significantly wider and taller glyph + * depending on how large of a radius was used to stroke the glyph. You + * may need to manually adjust horizontal and vertical advance amounts + * to account for this added size. + */ +FT_EXPORT( FT_Error ) +FT_Glyph_Stroke( FT_Glyph +*pglyph, +FT_Stroker stroker, + FT_Bool +destroy ); + + +/************************************************************** + * + * @function: + * FT_Glyph_StrokeBorder + * + * @description: + * Stroke a given outline glyph object with a given stroker, but + * only return either its inside or outside border. + * + * @inout: + * pglyph :: + * Source glyph handle on input, new glyph handle on output. + * + * @input: + * stroker :: + * A stroker handle. + * + * inside :: + * A Boolean. If~1, return the inside border, otherwise + * the outside border. + * + * destroy :: + * A Boolean. If~1, the source glyph object is destroyed + * on success. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The source glyph is untouched in case of error. + * + * Adding stroke may yield a significantly wider and taller glyph + * depending on how large of a radius was used to stroke the glyph. You + * may need to manually adjust horizontal and vertical advance amounts + * to account for this added size. + */ +FT_EXPORT( FT_Error ) +FT_Glyph_StrokeBorder( FT_Glyph +*pglyph, +FT_Stroker stroker, + FT_Bool +inside, +FT_Bool destroy +); + +/* */ + +FT_END_HEADER + +#endif /* __FT_STROKE_H__ */ + + +/* END */ + + +/* Local Variables: */ +/* coding: utf-8 */ +/* End: */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftsynth.h b/app/src/main/cpp/include/freetype2/freetype/ftsynth.h new file mode 100644 index 0000000..19616f5 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftsynth.h @@ -0,0 +1,85 @@ +/***************************************************************************/ +/* */ +/* ftsynth.h */ +/* */ +/* FreeType synthesizing code for emboldening and slanting */ +/* (specification). */ +/* */ +/* Copyright 2000-2001, 2003, 2006, 2008, 2012 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +/*************************************************************************/ +/*************************************************************************/ +/*************************************************************************/ +/*************************************************************************/ +/*************************************************************************/ +/********* *********/ +/********* WARNING, THIS IS ALPHA CODE! THIS API *********/ +/********* IS DUE TO CHANGE UNTIL STRICTLY NOTIFIED BY THE *********/ +/********* FREETYPE DEVELOPMENT TEAM *********/ +/********* *********/ +/*************************************************************************/ +/*************************************************************************/ +/*************************************************************************/ +/*************************************************************************/ +/*************************************************************************/ + + +/* Main reason for not lifting the functions in this module to a */ +/* `standard' API is that the used parameters for emboldening and */ +/* slanting are not configurable. Consider the functions as a */ +/* code resource which should be copied into the application and */ +/* adapted to the particular needs. */ + + +#ifndef __FTSYNTH_H__ +#define __FTSYNTH_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + +/* Embolden a glyph by a `reasonable' value (which is highly a matter of */ +/* taste). This function is actually a convenience function, providing */ +/* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden. */ +/* */ +/* For emboldened outlines the height, width, and advance metrics are */ +/* increased by the strength of the emboldening. You can also call */ +/* @FT_Outline_Get_CBox to get precise values. */ +FT_EXPORT(void) + +FT_GlyphSlot_Embolden( FT_GlyphSlot +slot ); + +/* Slant an outline glyph to the right by about 12 degrees. */ +FT_EXPORT(void) + +FT_GlyphSlot_Oblique( FT_GlyphSlot +slot ); + +/* */ + +FT_END_HEADER + +#endif /* __FTSYNTH_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftsystem.h b/app/src/main/cpp/include/freetype2/freetype/ftsystem.h new file mode 100644 index 0000000..ef11015 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftsystem.h @@ -0,0 +1,350 @@ +/***************************************************************************/ +/* */ +/* ftsystem.h */ +/* */ +/* FreeType low-level system interface definition (specification). */ +/* */ +/* Copyright 1996-2001, 2002, 2005, 2010 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTSYSTEM_H__ +#define __FTSYSTEM_H__ + + +#include <ft2build.h> + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* system_interface */ +/* */ +/* <Title> */ +/* System Interface */ +/* */ +/* <Abstract> */ +/* How FreeType manages memory and i/o. */ +/* */ +/* <Description> */ +/* This section contains various definitions related to memory */ +/* management and i/o access. You need to understand this */ +/* information if you want to use a custom memory manager or you own */ +/* i/o streams. */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* M E M O R Y M A N A G E M E N T */ +/* */ +/*************************************************************************/ + + +/************************************************************************* + * + * @type: + * FT_Memory + * + * @description: + * A handle to a given memory manager object, defined with an + * @FT_MemoryRec structure. + * + */ +typedef struct FT_MemoryRec_ *FT_Memory; + + +/************************************************************************* + * + * @functype: + * FT_Alloc_Func + * + * @description: + * A function used to allocate `size' bytes from `memory'. + * + * @input: + * memory :: + * A handle to the source memory manager. + * + * size :: + * The size in bytes to allocate. + * + * @return: + * Address of new memory block. 0~in case of failure. + * + */ +typedef void * +(*FT_Alloc_Func)(FT_Memory +memory, +long size +); + + +/************************************************************************* + * + * @functype: + * FT_Free_Func + * + * @description: + * A function used to release a given block of memory. + * + * @input: + * memory :: + * A handle to the source memory manager. + * + * block :: + * The address of the target memory block. + * + */ +typedef void +(*FT_Free_Func)(FT_Memory +memory, +void *block +); + + +/************************************************************************* + * + * @functype: + * FT_Realloc_Func + * + * @description: + * A function used to re-allocate a given block of memory. + * + * @input: + * memory :: + * A handle to the source memory manager. + * + * cur_size :: + * The block's current size in bytes. + * + * new_size :: + * The block's requested new size. + * + * block :: + * The block's current address. + * + * @return: + * New block address. 0~in case of memory shortage. + * + * @note: + * In case of error, the old block must still be available. + * + */ +typedef void * +(*FT_Realloc_Func)(FT_Memory +memory, +long cur_size, +long new_size, +void *block +); + + +/************************************************************************* + * + * @struct: + * FT_MemoryRec + * + * @description: + * A structure used to describe a given memory manager to FreeType~2. + * + * @fields: + * user :: + * A generic typeless pointer for user data. + * + * alloc :: + * A pointer type to an allocation function. + * + * free :: + * A pointer type to an memory freeing function. + * + * realloc :: + * A pointer type to a reallocation function. + * + */ +struct FT_MemoryRec_ { + void *user; + FT_Alloc_Func alloc; + FT_Free_Func free; + FT_Realloc_Func realloc; +}; + + +/*************************************************************************/ +/* */ +/* I / O M A N A G E M E N T */ +/* */ +/*************************************************************************/ + + +/************************************************************************* + * + * @type: + * FT_Stream + * + * @description: + * A handle to an input stream. + * + */ +typedef struct FT_StreamRec_ *FT_Stream; + + +/************************************************************************* + * + * @struct: + * FT_StreamDesc + * + * @description: + * A union type used to store either a long or a pointer. This is used + * to store a file descriptor or a `FILE*' in an input stream. + * + */ +typedef union FT_StreamDesc_ { + long value; + void *pointer; + +} FT_StreamDesc; + + +/************************************************************************* + * + * @functype: + * FT_Stream_IoFunc + * + * @description: + * A function used to seek and read data from a given input stream. + * + * @input: + * stream :: + * A handle to the source stream. + * + * offset :: + * The offset of read in stream (always from start). + * + * buffer :: + * The address of the read buffer. + * + * count :: + * The number of bytes to read from the stream. + * + * @return: + * The number of bytes effectively read by the stream. + * + * @note: + * This function might be called to perform a seek or skip operation + * with a `count' of~0. A non-zero return value then indicates an + * error. + * + */ +typedef unsigned long +(*FT_Stream_IoFunc)(FT_Stream stream, + unsigned long offset, + unsigned char *buffer, + unsigned long count); + + +/************************************************************************* + * + * @functype: + * FT_Stream_CloseFunc + * + * @description: + * A function used to close a given input stream. + * + * @input: + * stream :: + * A handle to the target stream. + * + */ +typedef void +(*FT_Stream_CloseFunc)(FT_Stream stream); + + +/************************************************************************* + * + * @struct: + * FT_StreamRec + * + * @description: + * A structure used to describe an input stream. + * + * @input: + * base :: + * For memory-based streams, this is the address of the first stream + * byte in memory. This field should always be set to NULL for + * disk-based streams. + * + * size :: + * The stream size in bytes. + * + * pos :: + * The current position within the stream. + * + * descriptor :: + * This field is a union that can hold an integer or a pointer. It is + * used by stream implementations to store file descriptors or `FILE*' + * pointers. + * + * pathname :: + * This field is completely ignored by FreeType. However, it is often + * useful during debugging to use it to store the stream's filename + * (where available). + * + * read :: + * The stream's input function. + * + * close :: + * The stream's close function. + * + * memory :: + * The memory manager to use to preload frames. This is set + * internally by FreeType and shouldn't be touched by stream + * implementations. + * + * cursor :: + * This field is set and used internally by FreeType when parsing + * frames. + * + * limit :: + * This field is set and used internally by FreeType when parsing + * frames. + * + */ +typedef struct FT_StreamRec_ { + unsigned char *base; + unsigned long size; + unsigned long pos; + + FT_StreamDesc descriptor; + FT_StreamDesc pathname; + FT_Stream_IoFunc read; + FT_Stream_CloseFunc close; + + FT_Memory memory; + unsigned char *cursor; + unsigned char *limit; + +} FT_StreamRec; + + +/* */ + + +FT_END_HEADER + +#endif /* __FTSYSTEM_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/fttrigon.h b/app/src/main/cpp/include/freetype2/freetype/fttrigon.h new file mode 100644 index 0000000..09b25bf --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/fttrigon.h @@ -0,0 +1,371 @@ +/***************************************************************************/ +/* */ +/* fttrigon.h */ +/* */ +/* FreeType trigonometric functions (specification). */ +/* */ +/* Copyright 2001, 2003, 2005, 2007 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTTRIGON_H__ +#define __FTTRIGON_H__ + +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* computations */ +/* */ +/*************************************************************************/ + + +/************************************************************************* + * + * @type: + * FT_Angle + * + * @description: + * This type is used to model angle values in FreeType. Note that the + * angle is a 16.16 fixed float value expressed in degrees. + * + */ +typedef FT_Fixed +FT_Angle; + + +/************************************************************************* + * + * @macro: + * FT_ANGLE_PI + * + * @description: + * The angle pi expressed in @FT_Angle units. + * + */ +#define FT_ANGLE_PI ( 180L << 16 ) + + +/************************************************************************* + * + * @macro: + * FT_ANGLE_2PI + * + * @description: + * The angle 2*pi expressed in @FT_Angle units. + * + */ +#define FT_ANGLE_2PI ( FT_ANGLE_PI * 2 ) + + +/************************************************************************* + * + * @macro: + * FT_ANGLE_PI2 + * + * @description: + * The angle pi/2 expressed in @FT_Angle units. + * + */ +#define FT_ANGLE_PI2 ( FT_ANGLE_PI / 2 ) + + +/************************************************************************* + * + * @macro: + * FT_ANGLE_PI4 + * + * @description: + * The angle pi/4 expressed in @FT_Angle units. + * + */ +#define FT_ANGLE_PI4 ( FT_ANGLE_PI / 4 ) + + +/************************************************************************* + * + * @function: + * FT_Sin + * + * @description: + * Return the sinus of a given angle in fixed point format. + * + * @input: + * angle :: + * The input angle. + * + * @return: + * The sinus value. + * + * @note: + * If you need both the sinus and cosinus for a given angle, use the + * function @FT_Vector_Unit. + * + */ +FT_EXPORT( FT_Fixed ) +FT_Sin( FT_Angle +angle ); + + +/************************************************************************* + * + * @function: + * FT_Cos + * + * @description: + * Return the cosinus of a given angle in fixed point format. + * + * @input: + * angle :: + * The input angle. + * + * @return: + * The cosinus value. + * + * @note: + * If you need both the sinus and cosinus for a given angle, use the + * function @FT_Vector_Unit. + * + */ +FT_EXPORT( FT_Fixed ) +FT_Cos( FT_Angle +angle ); + + +/************************************************************************* + * + * @function: + * FT_Tan + * + * @description: + * Return the tangent of a given angle in fixed point format. + * + * @input: + * angle :: + * The input angle. + * + * @return: + * The tangent value. + * + */ +FT_EXPORT( FT_Fixed ) +FT_Tan( FT_Angle +angle ); + + +/************************************************************************* + * + * @function: + * FT_Atan2 + * + * @description: + * Return the arc-tangent corresponding to a given vector (x,y) in + * the 2d plane. + * + * @input: + * x :: + * The horizontal vector coordinate. + * + * y :: + * The vertical vector coordinate. + * + * @return: + * The arc-tangent value (i.e. angle). + * + */ +FT_EXPORT( FT_Angle ) +FT_Atan2( FT_Fixed +x, +FT_Fixed y +); + + +/************************************************************************* + * + * @function: + * FT_Angle_Diff + * + * @description: + * Return the difference between two angles. The result is always + * constrained to the ]-PI..PI] interval. + * + * @input: + * angle1 :: + * First angle. + * + * angle2 :: + * Second angle. + * + * @return: + * Constrained value of `value2-value1'. + * + */ +FT_EXPORT( FT_Angle ) +FT_Angle_Diff( FT_Angle +angle1, +FT_Angle angle2 +); + + +/************************************************************************* + * + * @function: + * FT_Vector_Unit + * + * @description: + * Return the unit vector corresponding to a given angle. After the + * call, the value of `vec.x' will be `sin(angle)', and the value of + * `vec.y' will be `cos(angle)'. + * + * This function is useful to retrieve both the sinus and cosinus of a + * given angle quickly. + * + * @output: + * vec :: + * The address of target vector. + * + * @input: + * angle :: + * The address of angle. + * + */ +FT_EXPORT(void) + +FT_Vector_Unit( FT_Vector +* vec, +FT_Angle angle +); + + +/************************************************************************* + * + * @function: + * FT_Vector_Rotate + * + * @description: + * Rotate a vector by a given angle. + * + * @inout: + * vec :: + * The address of target vector. + * + * @input: + * angle :: + * The address of angle. + * + */ +FT_EXPORT(void) + +FT_Vector_Rotate( FT_Vector +* vec, +FT_Angle angle +); + + +/************************************************************************* + * + * @function: + * FT_Vector_Length + * + * @description: + * Return the length of a given vector. + * + * @input: + * vec :: + * The address of target vector. + * + * @return: + * The vector length, expressed in the same units that the original + * vector coordinates. + * + */ +FT_EXPORT( FT_Fixed ) +FT_Vector_Length( FT_Vector +* vec ); + + +/************************************************************************* + * + * @function: + * FT_Vector_Polarize + * + * @description: + * Compute both the length and angle of a given vector. + * + * @input: + * vec :: + * The address of source vector. + * + * @output: + * length :: + * The vector length. + * + * angle :: + * The vector angle. + * + */ +FT_EXPORT(void) + +FT_Vector_Polarize( FT_Vector +* vec, +FT_Fixed *length, + FT_Angle +*angle ); + + +/************************************************************************* + * + * @function: + * FT_Vector_From_Polar + * + * @description: + * Compute vector coordinates from a length and angle. + * + * @output: + * vec :: + * The address of source vector. + * + * @input: + * length :: + * The vector length. + * + * angle :: + * The vector angle. + * + */ +FT_EXPORT(void) + +FT_Vector_From_Polar( FT_Vector +* vec, +FT_Fixed length, + FT_Angle +angle ); + +/* */ + + +FT_END_HEADER + +#endif /* __FTTRIGON_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/fttypes.h b/app/src/main/cpp/include/freetype2/freetype/fttypes.h new file mode 100644 index 0000000..9b4a9a1 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/fttypes.h @@ -0,0 +1,582 @@ +/***************************************************************************/ +/* */ +/* fttypes.h */ +/* */ +/* FreeType simple types definitions (specification only). */ +/* */ +/* Copyright 1996-2002, 2004, 2006-2009, 2012 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTTYPES_H__ +#define __FTTYPES_H__ + + +#include <ft2build.h> +#include FT_CONFIG_CONFIG_H +#include FT_SYSTEM_H +#include FT_IMAGE_H + +#include <stddef.h> + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* basic_types */ +/* */ +/* <Title> */ +/* Basic Data Types */ +/* */ +/* <Abstract> */ +/* The basic data types defined by the library. */ +/* */ +/* <Description> */ +/* This section contains the basic data types defined by FreeType~2, */ +/* ranging from simple scalar types to bitmap descriptors. More */ +/* font-specific structures are defined in a different section. */ +/* */ +/* <Order> */ +/* FT_Byte */ +/* FT_Bytes */ +/* FT_Char */ +/* FT_Int */ +/* FT_UInt */ +/* FT_Int16 */ +/* FT_UInt16 */ +/* FT_Int32 */ +/* FT_UInt32 */ +/* FT_Short */ +/* FT_UShort */ +/* FT_Long */ +/* FT_ULong */ +/* FT_Bool */ +/* FT_Offset */ +/* FT_PtrDist */ +/* FT_String */ +/* FT_Tag */ +/* FT_Error */ +/* FT_Fixed */ +/* FT_Pointer */ +/* FT_Pos */ +/* FT_Vector */ +/* FT_BBox */ +/* FT_Matrix */ +/* FT_FWord */ +/* FT_UFWord */ +/* FT_F2Dot14 */ +/* FT_UnitVector */ +/* FT_F26Dot6 */ +/* */ +/* */ +/* FT_Generic */ +/* FT_Generic_Finalizer */ +/* */ +/* FT_Bitmap */ +/* FT_Pixel_Mode */ +/* FT_Palette_Mode */ +/* FT_Glyph_Format */ +/* FT_IMAGE_TAG */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Bool */ +/* */ +/* <Description> */ +/* A typedef of unsigned char, used for simple booleans. As usual, */ +/* values 1 and~0 represent true and false, respectively. */ +/* */ +typedef unsigned char FT_Bool; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_FWord */ +/* */ +/* <Description> */ +/* A signed 16-bit integer used to store a distance in original font */ +/* units. */ +/* */ +typedef signed short FT_FWord; /* distance in FUnits */ + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_UFWord */ +/* */ +/* <Description> */ +/* An unsigned 16-bit integer used to store a distance in original */ +/* font units. */ +/* */ +typedef unsigned short FT_UFWord; /* unsigned distance */ + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Char */ +/* */ +/* <Description> */ +/* A simple typedef for the _signed_ char type. */ +/* */ +typedef signed char FT_Char; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Byte */ +/* */ +/* <Description> */ +/* A simple typedef for the _unsigned_ char type. */ +/* */ +typedef unsigned char FT_Byte; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Bytes */ +/* */ +/* <Description> */ +/* A typedef for constant memory areas. */ +/* */ +typedef const FT_Byte *FT_Bytes; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Tag */ +/* */ +/* <Description> */ +/* A typedef for 32-bit tags (as used in the SFNT format). */ +/* */ +typedef FT_UInt32 FT_Tag; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_String */ +/* */ +/* <Description> */ +/* A simple typedef for the char type, usually used for strings. */ +/* */ +typedef char FT_String; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Short */ +/* */ +/* <Description> */ +/* A typedef for signed short. */ +/* */ +typedef signed short FT_Short; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_UShort */ +/* */ +/* <Description> */ +/* A typedef for unsigned short. */ +/* */ +typedef unsigned short FT_UShort; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Int */ +/* */ +/* <Description> */ +/* A typedef for the int type. */ +/* */ +typedef signed int FT_Int; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_UInt */ +/* */ +/* <Description> */ +/* A typedef for the unsigned int type. */ +/* */ +typedef unsigned int FT_UInt; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Long */ +/* */ +/* <Description> */ +/* A typedef for signed long. */ +/* */ +typedef signed long FT_Long; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_ULong */ +/* */ +/* <Description> */ +/* A typedef for unsigned long. */ +/* */ +typedef unsigned long FT_ULong; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_F2Dot14 */ +/* */ +/* <Description> */ +/* A signed 2.14 fixed float type used for unit vectors. */ +/* */ +typedef signed short FT_F2Dot14; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_F26Dot6 */ +/* */ +/* <Description> */ +/* A signed 26.6 fixed float type used for vectorial pixel */ +/* coordinates. */ +/* */ +typedef signed long FT_F26Dot6; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Fixed */ +/* */ +/* <Description> */ +/* This type is used to store 16.16 fixed float values, like scaling */ +/* values or matrix coefficients. */ +/* */ +typedef signed long FT_Fixed; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Error */ +/* */ +/* <Description> */ +/* The FreeType error code type. A value of~0 is always interpreted */ +/* as a successful operation. */ +/* */ +typedef int FT_Error; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Pointer */ +/* */ +/* <Description> */ +/* A simple typedef for a typeless pointer. */ +/* */ +typedef void *FT_Pointer; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_Offset */ +/* */ +/* <Description> */ +/* This is equivalent to the ANSI~C `size_t' type, i.e., the largest */ +/* _unsigned_ integer type used to express a file size or position, */ +/* or a memory block size. */ +/* */ +typedef size_t FT_Offset; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_PtrDist */ +/* */ +/* <Description> */ +/* This is equivalent to the ANSI~C `ptrdiff_t' type, i.e., the */ +/* largest _signed_ integer type used to express the distance */ +/* between two pointers. */ +/* */ +typedef ft_ptrdiff_t FT_PtrDist; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_UnitVector */ +/* */ +/* <Description> */ +/* A simple structure used to store a 2D vector unit vector. Uses */ +/* FT_F2Dot14 types. */ +/* */ +/* <Fields> */ +/* x :: Horizontal coordinate. */ +/* */ +/* y :: Vertical coordinate. */ +/* */ +typedef struct FT_UnitVector_ { + FT_F2Dot14 x; + FT_F2Dot14 y; + +} FT_UnitVector; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Matrix */ +/* */ +/* <Description> */ +/* A simple structure used to store a 2x2 matrix. Coefficients are */ +/* in 16.16 fixed float format. The computation performed is: */ +/* */ +/* { */ +/* x' = x*xx + y*xy */ +/* y' = x*yx + y*yy */ +/* } */ +/* */ +/* <Fields> */ +/* xx :: Matrix coefficient. */ +/* */ +/* xy :: Matrix coefficient. */ +/* */ +/* yx :: Matrix coefficient. */ +/* */ +/* yy :: Matrix coefficient. */ +/* */ +typedef struct FT_Matrix_ { + FT_Fixed xx, xy; + FT_Fixed yx, yy; + +} FT_Matrix; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Data */ +/* */ +/* <Description> */ +/* Read-only binary data represented as a pointer and a length. */ +/* */ +/* <Fields> */ +/* pointer :: The data. */ +/* */ +/* length :: The length of the data in bytes. */ +/* */ +typedef struct FT_Data_ { + const FT_Byte *pointer; + FT_Int length; + +} FT_Data; + + +/*************************************************************************/ +/* */ +/* <FuncType> */ +/* FT_Generic_Finalizer */ +/* */ +/* <Description> */ +/* Describe a function used to destroy the `client' data of any */ +/* FreeType object. See the description of the @FT_Generic type for */ +/* details of usage. */ +/* */ +/* <Input> */ +/* The address of the FreeType object which is under finalization. */ +/* Its client data is accessed through its `generic' field. */ +/* */ +typedef void (*FT_Generic_Finalizer)(void *object); + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_Generic */ +/* */ +/* <Description> */ +/* Client applications often need to associate their own data to a */ +/* variety of FreeType core objects. For example, a text layout API */ +/* might want to associate a glyph cache to a given size object. */ +/* */ +/* Some FreeType object contains a `generic' field, of type */ +/* FT_Generic, which usage is left to client applications and font */ +/* servers. */ +/* */ +/* It can be used to store a pointer to client-specific data, as well */ +/* as the address of a `finalizer' function, which will be called by */ +/* FreeType when the object is destroyed (for example, the previous */ +/* client example would put the address of the glyph cache destructor */ +/* in the `finalizer' field). */ +/* */ +/* <Fields> */ +/* data :: A typeless pointer to any client-specified data. This */ +/* field is completely ignored by the FreeType library. */ +/* */ +/* finalizer :: A pointer to a `generic finalizer' function, which */ +/* will be called when the object is destroyed. If this */ +/* field is set to NULL, no code will be called. */ +/* */ +typedef struct FT_Generic_ { + void *data; + FT_Generic_Finalizer finalizer; + +} FT_Generic; + + +/*************************************************************************/ +/* */ +/* <Macro> */ +/* FT_MAKE_TAG */ +/* */ +/* <Description> */ +/* This macro converts four-letter tags which are used to label */ +/* TrueType tables into an unsigned long to be used within FreeType. */ +/* */ +/* <Note> */ +/* The produced values *must* be 32-bit integers. Don't redefine */ +/* this macro. */ +/* */ +#define FT_MAKE_TAG(_x1, _x2, _x3, _x4) \ + (FT_Tag) \ + ( ( (FT_ULong)_x1 << 24 ) | \ + ( (FT_ULong)_x2 << 16 ) | \ + ( (FT_ULong)_x3 << 8 ) | \ + (FT_ULong)_x4 ) + + +/*************************************************************************/ +/*************************************************************************/ +/* */ +/* L I S T M A N A G E M E N T */ +/* */ +/*************************************************************************/ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* list_processing */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_ListNode */ +/* */ +/* <Description> */ +/* Many elements and objects in FreeType are listed through an */ +/* @FT_List record (see @FT_ListRec). As its name suggests, an */ +/* FT_ListNode is a handle to a single list element. */ +/* */ +typedef struct FT_ListNodeRec_ *FT_ListNode; + + +/*************************************************************************/ +/* */ +/* <Type> */ +/* FT_List */ +/* */ +/* <Description> */ +/* A handle to a list record (see @FT_ListRec). */ +/* */ +typedef struct FT_ListRec_ *FT_List; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_ListNodeRec */ +/* */ +/* <Description> */ +/* A structure used to hold a single list element. */ +/* */ +/* <Fields> */ +/* prev :: The previous element in the list. NULL if first. */ +/* */ +/* next :: The next element in the list. NULL if last. */ +/* */ +/* data :: A typeless pointer to the listed object. */ +/* */ +typedef struct FT_ListNodeRec_ { + FT_ListNode prev; + FT_ListNode next; + void *data; + +} FT_ListNodeRec; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_ListRec */ +/* */ +/* <Description> */ +/* A structure used to hold a simple doubly-linked list. These are */ +/* used in many parts of FreeType. */ +/* */ +/* <Fields> */ +/* head :: The head (first element) of doubly-linked list. */ +/* */ +/* tail :: The tail (last element) of doubly-linked list. */ +/* */ +typedef struct FT_ListRec_ { + FT_ListNode head; + FT_ListNode tail; + +} FT_ListRec; + + +/* */ + +#define FT_IS_EMPTY(list) ( (list).head == 0 ) + +/* return base error code (without module-specific prefix) */ +#define FT_ERROR_BASE(x) ( (x) & 0xFF ) + +/* return module error code */ +#define FT_ERROR_MODULE(x) ( (x) & 0xFF00U ) + +#define FT_BOOL(x) ( (FT_Bool)( x ) ) + +FT_END_HEADER + +#endif /* __FTTYPES_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftwinfnt.h b/app/src/main/cpp/include/freetype2/freetype/ftwinfnt.h new file mode 100644 index 0000000..c9ec256 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftwinfnt.h @@ -0,0 +1,275 @@ +/***************************************************************************/ +/* */ +/* ftwinfnt.h */ +/* */ +/* FreeType API for accessing Windows fnt-specific data. */ +/* */ +/* Copyright 2003, 2004, 2008 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTWINFNT_H__ +#define __FTWINFNT_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* winfnt_fonts */ +/* */ +/* <Title> */ +/* Window FNT Files */ +/* */ +/* <Abstract> */ +/* Windows FNT specific API. */ +/* */ +/* <Description> */ +/* This section contains the declaration of Windows FNT specific */ +/* functions. */ +/* */ +/*************************************************************************/ + + +/************************************************************************* + * + * @enum: + * FT_WinFNT_ID_XXX + * + * @description: + * A list of valid values for the `charset' byte in + * @FT_WinFNT_HeaderRec. Exact mapping tables for the various cpXXXX + * encodings (except for cp1361) can be found at ftp://ftp.unicode.org + * in the MAPPINGS/VENDORS/MICSFT/WINDOWS subdirectory. cp1361 is + * roughly a superset of MAPPINGS/OBSOLETE/EASTASIA/KSC/JOHAB.TXT. + * + * @values: + * FT_WinFNT_ID_DEFAULT :: + * This is used for font enumeration and font creation as a + * `don't care' value. Valid font files don't contain this value. + * When querying for information about the character set of the font + * that is currently selected into a specified device context, this + * return value (of the related Windows API) simply denotes failure. + * + * FT_WinFNT_ID_SYMBOL :: + * There is no known mapping table available. + * + * FT_WinFNT_ID_MAC :: + * Mac Roman encoding. + * + * FT_WinFNT_ID_OEM :: + * From Michael Pöttgen <michael@poettgen.de>: + * + * The `Windows Font Mapping' article says that FT_WinFNT_ID_OEM + * is used for the charset of vector fonts, like `modern.fon', + * `roman.fon', and `script.fon' on Windows. + * + * The `CreateFont' documentation says: The FT_WinFNT_ID_OEM value + * specifies a character set that is operating-system dependent. + * + * The `IFIMETRICS' documentation from the `Windows Driver + * Development Kit' says: This font supports an OEM-specific + * character set. The OEM character set is system dependent. + * + * In general OEM, as opposed to ANSI (i.e., cp1252), denotes the + * second default codepage that most international versions of + * Windows have. It is one of the OEM codepages from + * + * http://www.microsoft.com/globaldev/reference/cphome.mspx, + * + * and is used for the `DOS boxes', to support legacy applications. + * A German Windows version for example usually uses ANSI codepage + * 1252 and OEM codepage 850. + * + * FT_WinFNT_ID_CP874 :: + * A superset of Thai TIS 620 and ISO 8859-11. + * + * FT_WinFNT_ID_CP932 :: + * A superset of Japanese Shift-JIS (with minor deviations). + * + * FT_WinFNT_ID_CP936 :: + * A superset of simplified Chinese GB 2312-1980 (with different + * ordering and minor deviations). + * + * FT_WinFNT_ID_CP949 :: + * A superset of Korean Hangul KS~C 5601-1987 (with different + * ordering and minor deviations). + * + * FT_WinFNT_ID_CP950 :: + * A superset of traditional Chinese Big~5 ETen (with different + * ordering and minor deviations). + * + * FT_WinFNT_ID_CP1250 :: + * A superset of East European ISO 8859-2 (with slightly different + * ordering). + * + * FT_WinFNT_ID_CP1251 :: + * A superset of Russian ISO 8859-5 (with different ordering). + * + * FT_WinFNT_ID_CP1252 :: + * ANSI encoding. A superset of ISO 8859-1. + * + * FT_WinFNT_ID_CP1253 :: + * A superset of Greek ISO 8859-7 (with minor modifications). + * + * FT_WinFNT_ID_CP1254 :: + * A superset of Turkish ISO 8859-9. + * + * FT_WinFNT_ID_CP1255 :: + * A superset of Hebrew ISO 8859-8 (with some modifications). + * + * FT_WinFNT_ID_CP1256 :: + * A superset of Arabic ISO 8859-6 (with different ordering). + * + * FT_WinFNT_ID_CP1257 :: + * A superset of Baltic ISO 8859-13 (with some deviations). + * + * FT_WinFNT_ID_CP1258 :: + * For Vietnamese. This encoding doesn't cover all necessary + * characters. + * + * FT_WinFNT_ID_CP1361 :: + * Korean (Johab). + */ + +#define FT_WinFNT_ID_CP1252 0 +#define FT_WinFNT_ID_DEFAULT 1 +#define FT_WinFNT_ID_SYMBOL 2 +#define FT_WinFNT_ID_MAC 77 +#define FT_WinFNT_ID_CP932 128 +#define FT_WinFNT_ID_CP949 129 +#define FT_WinFNT_ID_CP1361 130 +#define FT_WinFNT_ID_CP936 134 +#define FT_WinFNT_ID_CP950 136 +#define FT_WinFNT_ID_CP1253 161 +#define FT_WinFNT_ID_CP1254 162 +#define FT_WinFNT_ID_CP1258 163 +#define FT_WinFNT_ID_CP1255 177 +#define FT_WinFNT_ID_CP1256 178 +#define FT_WinFNT_ID_CP1257 186 +#define FT_WinFNT_ID_CP1251 204 +#define FT_WinFNT_ID_CP874 222 +#define FT_WinFNT_ID_CP1250 238 +#define FT_WinFNT_ID_OEM 255 + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_WinFNT_HeaderRec */ +/* */ +/* <Description> */ +/* Windows FNT Header info. */ +/* */ +typedef struct FT_WinFNT_HeaderRec_ { + FT_UShort version; + FT_ULong file_size; + FT_Byte copyright[60]; + FT_UShort file_type; + FT_UShort nominal_point_size; + FT_UShort vertical_resolution; + FT_UShort horizontal_resolution; + FT_UShort ascent; + FT_UShort internal_leading; + FT_UShort external_leading; + FT_Byte italic; + FT_Byte underline; + FT_Byte strike_out; + FT_UShort weight; + FT_Byte charset; + FT_UShort pixel_width; + FT_UShort pixel_height; + FT_Byte pitch_and_family; + FT_UShort avg_width; + FT_UShort max_width; + FT_Byte first_char; + FT_Byte last_char; + FT_Byte default_char; + FT_Byte break_char; + FT_UShort bytes_per_row; + FT_ULong device_offset; + FT_ULong face_name_offset; + FT_ULong bits_pointer; + FT_ULong bits_offset; + FT_Byte reserved; + FT_ULong flags; + FT_UShort A_space; + FT_UShort B_space; + FT_UShort C_space; + FT_UShort color_table_offset; + FT_ULong reserved1[4]; + +} FT_WinFNT_HeaderRec; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* FT_WinFNT_Header */ +/* */ +/* <Description> */ +/* A handle to an @FT_WinFNT_HeaderRec structure. */ +/* */ +typedef struct FT_WinFNT_HeaderRec_ *FT_WinFNT_Header; + + +/********************************************************************** + * + * @function: + * FT_Get_WinFNT_Header + * + * @description: + * Retrieve a Windows FNT font info header. + * + * @input: + * face :: A handle to the input face. + * + * @output: + * aheader :: The WinFNT header. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * This function only works with Windows FNT faces, returning an error + * otherwise. + */ +FT_EXPORT( FT_Error ) +FT_Get_WinFNT_Header( FT_Face +face, +FT_WinFNT_HeaderRec *aheader +); + + +/* */ + +FT_END_HEADER + +#endif /* __FTWINFNT_H__ */ + + +/* END */ + + +/* Local Variables: */ +/* coding: utf-8 */ +/* End: */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ftxf86.h b/app/src/main/cpp/include/freetype2/freetype/ftxf86.h new file mode 100644 index 0000000..866d6ed --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ftxf86.h @@ -0,0 +1,85 @@ +/***************************************************************************/ +/* */ +/* ftxf86.h */ +/* */ +/* Support functions for X11. */ +/* */ +/* Copyright 2002, 2003, 2004, 2006, 2007 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTXF86_H__ +#define __FTXF86_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* font_formats */ +/* */ +/* <Title> */ +/* Font Formats */ +/* */ +/* <Abstract> */ +/* Getting the font format. */ +/* */ +/* <Description> */ +/* The single function in this section can be used to get the font */ +/* format. Note that this information is not needed normally; */ +/* however, there are special cases (like in PDF devices) where it is */ +/* important to differentiate, in spite of FreeType's uniform API. */ +/* */ +/* This function is in the X11/xf86 namespace for historical reasons */ +/* and in no way depends on that windowing system. */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_X11_Font_Format */ +/* */ +/* <Description> */ +/* Return a string describing the format of a given face, using values */ +/* which can be used as an X11 FONT_PROPERTY. Possible values are */ +/* `TrueType', `Type~1', `BDF', `PCF', `Type~42', `CID~Type~1', `CFF', */ +/* `PFR', and `Windows~FNT'. */ +/* */ +/* <Input> */ +/* face :: */ +/* Input face handle. */ +/* */ +/* <Return> */ +/* Font format string. NULL in case of error. */ +/* */ +FT_EXPORT(const char *) + +FT_Get_X11_Font_Format( FT_Face +face ); + +/* */ + +FT_END_HEADER + +#endif /* __FTXF86_H__ */ diff --git a/app/src/main/cpp/include/freetype2/freetype/t1tables.h b/app/src/main/cpp/include/freetype2/freetype/t1tables.h new file mode 100644 index 0000000..fae08ce --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/t1tables.h @@ -0,0 +1,661 @@ +/***************************************************************************/ +/* */ +/* t1tables.h */ +/* */ +/* Basic Type 1/Type 2 tables definitions and interface (specification */ +/* only). */ +/* */ +/* Copyright 1996-2004, 2006, 2008, 2009, 2011 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __T1TABLES_H__ +#define __T1TABLES_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* type1_tables */ +/* */ +/* <Title> */ +/* Type 1 Tables */ +/* */ +/* <Abstract> */ +/* Type~1 (PostScript) specific font tables. */ +/* */ +/* <Description> */ +/* This section contains the definition of Type 1-specific tables, */ +/* including structures related to other PostScript font formats. */ +/* */ +/*************************************************************************/ + + +/* Note that we separate font data in PS_FontInfoRec and PS_PrivateRec */ +/* structures in order to support Multiple Master fonts. */ + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* PS_FontInfoRec */ +/* */ +/* <Description> */ +/* A structure used to model a Type~1 or Type~2 FontInfo dictionary. */ +/* Note that for Multiple Master fonts, each instance has its own */ +/* FontInfo dictionary. */ +/* */ +typedef struct PS_FontInfoRec_ { + FT_String *version; + FT_String *notice; + FT_String *full_name; + FT_String *family_name; + FT_String *weight; + FT_Long italic_angle; + FT_Bool is_fixed_pitch; + FT_Short underline_position; + FT_UShort underline_thickness; + +} PS_FontInfoRec; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* PS_FontInfo */ +/* */ +/* <Description> */ +/* A handle to a @PS_FontInfoRec structure. */ +/* */ +typedef struct PS_FontInfoRec_ *PS_FontInfo; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* T1_FontInfo */ +/* */ +/* <Description> */ +/* This type is equivalent to @PS_FontInfoRec. It is deprecated but */ +/* kept to maintain source compatibility between various versions of */ +/* FreeType. */ +/* */ +typedef PS_FontInfoRec T1_FontInfo; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* PS_PrivateRec */ +/* */ +/* <Description> */ +/* A structure used to model a Type~1 or Type~2 private dictionary. */ +/* Note that for Multiple Master fonts, each instance has its own */ +/* Private dictionary. */ +/* */ +typedef struct PS_PrivateRec_ { + FT_Int unique_id; + FT_Int lenIV; + + FT_Byte num_blue_values; + FT_Byte num_other_blues; + FT_Byte num_family_blues; + FT_Byte num_family_other_blues; + + FT_Short blue_values[14]; + FT_Short other_blues[10]; + + FT_Short family_blues[14]; + FT_Short family_other_blues[10]; + + FT_Fixed blue_scale; + FT_Int blue_shift; + FT_Int blue_fuzz; + + FT_UShort standard_width[1]; + FT_UShort standard_height[1]; + + FT_Byte num_snap_widths; + FT_Byte num_snap_heights; + FT_Bool force_bold; + FT_Bool round_stem_up; + + FT_Short snap_widths[13]; /* including std width */ + FT_Short snap_heights[13]; /* including std height */ + + FT_Fixed expansion_factor; + + FT_Long language_group; + FT_Long password; + + FT_Short min_feature[2]; + +} PS_PrivateRec; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* PS_Private */ +/* */ +/* <Description> */ +/* A handle to a @PS_PrivateRec structure. */ +/* */ +typedef struct PS_PrivateRec_ *PS_Private; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* T1_Private */ +/* */ +/* <Description> */ +/* This type is equivalent to @PS_PrivateRec. It is deprecated but */ +/* kept to maintain source compatibility between various versions of */ +/* FreeType. */ +/* */ +typedef PS_PrivateRec T1_Private; + + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* T1_Blend_Flags */ +/* */ +/* <Description> */ +/* A set of flags used to indicate which fields are present in a */ +/* given blend dictionary (font info or private). Used to support */ +/* Multiple Masters fonts. */ +/* */ +typedef enum T1_Blend_Flags_ { + /*# required fields in a FontInfo blend dictionary */ + T1_BLEND_UNDERLINE_POSITION = 0, + T1_BLEND_UNDERLINE_THICKNESS, + T1_BLEND_ITALIC_ANGLE, + + /*# required fields in a Private blend dictionary */ + T1_BLEND_BLUE_VALUES, + T1_BLEND_OTHER_BLUES, + T1_BLEND_STANDARD_WIDTH, + T1_BLEND_STANDARD_HEIGHT, + T1_BLEND_STEM_SNAP_WIDTHS, + T1_BLEND_STEM_SNAP_HEIGHTS, + T1_BLEND_BLUE_SCALE, + T1_BLEND_BLUE_SHIFT, + T1_BLEND_FAMILY_BLUES, + T1_BLEND_FAMILY_OTHER_BLUES, + T1_BLEND_FORCE_BOLD, + + /*# never remove */ + T1_BLEND_MAX + +} T1_Blend_Flags; + +/* */ + + +/*# backwards compatible definitions */ +#define t1_blend_underline_position T1_BLEND_UNDERLINE_POSITION +#define t1_blend_underline_thickness T1_BLEND_UNDERLINE_THICKNESS +#define t1_blend_italic_angle T1_BLEND_ITALIC_ANGLE +#define t1_blend_blue_values T1_BLEND_BLUE_VALUES +#define t1_blend_other_blues T1_BLEND_OTHER_BLUES +#define t1_blend_standard_widths T1_BLEND_STANDARD_WIDTH +#define t1_blend_standard_height T1_BLEND_STANDARD_HEIGHT +#define t1_blend_stem_snap_widths T1_BLEND_STEM_SNAP_WIDTHS +#define t1_blend_stem_snap_heights T1_BLEND_STEM_SNAP_HEIGHTS +#define t1_blend_blue_scale T1_BLEND_BLUE_SCALE +#define t1_blend_blue_shift T1_BLEND_BLUE_SHIFT +#define t1_blend_family_blues T1_BLEND_FAMILY_BLUES +#define t1_blend_family_other_blues T1_BLEND_FAMILY_OTHER_BLUES +#define t1_blend_force_bold T1_BLEND_FORCE_BOLD +#define t1_blend_max T1_BLEND_MAX + + +/* maximum number of Multiple Masters designs, as defined in the spec */ +#define T1_MAX_MM_DESIGNS 16 + +/* maximum number of Multiple Masters axes, as defined in the spec */ +#define T1_MAX_MM_AXIS 4 + +/* maximum number of elements in a design map */ +#define T1_MAX_MM_MAP_POINTS 20 + + +/* this structure is used to store the BlendDesignMap entry for an axis */ +typedef struct PS_DesignMap_ { + FT_Byte num_points; + FT_Long *design_points; + FT_Fixed *blend_points; + +} PS_DesignMapRec, *PS_DesignMap; + +/* backwards-compatible definition */ +typedef PS_DesignMapRec T1_DesignMap; + + +typedef struct PS_BlendRec_ { + FT_UInt num_designs; + FT_UInt num_axis; + + FT_String *axis_names[T1_MAX_MM_AXIS]; + FT_Fixed *design_pos[T1_MAX_MM_DESIGNS]; + PS_DesignMapRec design_map[T1_MAX_MM_AXIS]; + + FT_Fixed *weight_vector; + FT_Fixed *default_weight_vector; + + PS_FontInfo font_infos[T1_MAX_MM_DESIGNS + 1]; + PS_Private privates[T1_MAX_MM_DESIGNS + 1]; + + FT_ULong blend_bitflags; + + FT_BBox *bboxes[T1_MAX_MM_DESIGNS + 1]; + + /* since 2.3.0 */ + + /* undocumented, optional: the default design instance; */ + /* corresponds to default_weight_vector -- */ + /* num_default_design_vector == 0 means it is not present */ + /* in the font and associated metrics files */ + FT_UInt default_design_vector[T1_MAX_MM_DESIGNS]; + FT_UInt num_default_design_vector; + +} PS_BlendRec, *PS_Blend; + + +/* backwards-compatible definition */ +typedef PS_BlendRec T1_Blend; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* CID_FaceDictRec */ +/* */ +/* <Description> */ +/* A structure used to represent data in a CID top-level dictionary. */ +/* */ +typedef struct CID_FaceDictRec_ { + PS_PrivateRec private_dict; + + FT_UInt len_buildchar; + FT_Fixed forcebold_threshold; + FT_Pos stroke_width; + FT_Fixed expansion_factor; + + FT_Byte paint_type; + FT_Byte font_type; + FT_Matrix font_matrix; + FT_Vector font_offset; + + FT_UInt num_subrs; + FT_ULong subrmap_offset; + FT_Int sd_bytes; + +} CID_FaceDictRec; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* CID_FaceDict */ +/* */ +/* <Description> */ +/* A handle to a @CID_FaceDictRec structure. */ +/* */ +typedef struct CID_FaceDictRec_ *CID_FaceDict; + +/* */ + + +/* backwards-compatible definition */ +typedef CID_FaceDictRec CID_FontDict; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* CID_FaceInfoRec */ +/* */ +/* <Description> */ +/* A structure used to represent CID Face information. */ +/* */ +typedef struct CID_FaceInfoRec_ { + FT_String *cid_font_name; + FT_Fixed cid_version; + FT_Int cid_font_type; + + FT_String *registry; + FT_String *ordering; + FT_Int supplement; + + PS_FontInfoRec font_info; + FT_BBox font_bbox; + FT_ULong uid_base; + + FT_Int num_xuid; + FT_ULong xuid[16]; + + FT_ULong cidmap_offset; + FT_Int fd_bytes; + FT_Int gd_bytes; + FT_ULong cid_count; + + FT_Int num_dicts; + CID_FaceDict font_dicts; + + FT_ULong data_offset; + +} CID_FaceInfoRec; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* CID_FaceInfo */ +/* */ +/* <Description> */ +/* A handle to a @CID_FaceInfoRec structure. */ +/* */ +typedef struct CID_FaceInfoRec_ *CID_FaceInfo; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* CID_Info */ +/* */ +/* <Description> */ +/* This type is equivalent to @CID_FaceInfoRec. It is deprecated but */ +/* kept to maintain source compatibility between various versions of */ +/* FreeType. */ +/* */ +typedef CID_FaceInfoRec CID_Info; + + +/************************************************************************ + * + * @function: + * FT_Has_PS_Glyph_Names + * + * @description: + * Return true if a given face provides reliable PostScript glyph + * names. This is similar to using the @FT_HAS_GLYPH_NAMES macro, + * except that certain fonts (mostly TrueType) contain incorrect + * glyph name tables. + * + * When this function returns true, the caller is sure that the glyph + * names returned by @FT_Get_Glyph_Name are reliable. + * + * @input: + * face :: + * face handle + * + * @return: + * Boolean. True if glyph names are reliable. + * + */ +FT_EXPORT( FT_Int ) +FT_Has_PS_Glyph_Names( FT_Face +face ); + + +/************************************************************************ + * + * @function: + * FT_Get_PS_Font_Info + * + * @description: + * Retrieve the @PS_FontInfoRec structure corresponding to a given + * PostScript font. + * + * @input: + * face :: + * PostScript face handle. + * + * @output: + * afont_info :: + * Output font info structure pointer. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The string pointers within the font info structure are owned by + * the face and don't need to be freed by the caller. + * + * If the font's format is not PostScript-based, this function will + * return the `FT_Err_Invalid_Argument' error code. + * + */ +FT_EXPORT( FT_Error ) +FT_Get_PS_Font_Info( FT_Face +face, +PS_FontInfo afont_info +); + + +/************************************************************************ + * + * @function: + * FT_Get_PS_Font_Private + * + * @description: + * Retrieve the @PS_PrivateRec structure corresponding to a given + * PostScript font. + * + * @input: + * face :: + * PostScript face handle. + * + * @output: + * afont_private :: + * Output private dictionary structure pointer. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The string pointers within the @PS_PrivateRec structure are owned by + * the face and don't need to be freed by the caller. + * + * If the font's format is not PostScript-based, this function returns + * the `FT_Err_Invalid_Argument' error code. + * + */ +FT_EXPORT( FT_Error ) +FT_Get_PS_Font_Private( FT_Face +face, +PS_Private afont_private +); + + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* T1_EncodingType */ +/* */ +/* <Description> */ +/* An enumeration describing the `Encoding' entry in a Type 1 */ +/* dictionary. */ +/* */ +typedef enum T1_EncodingType_ { + T1_ENCODING_TYPE_NONE = 0, + T1_ENCODING_TYPE_ARRAY, + T1_ENCODING_TYPE_STANDARD, + T1_ENCODING_TYPE_ISOLATIN1, + T1_ENCODING_TYPE_EXPERT + +} T1_EncodingType; + + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* PS_Dict_Keys */ +/* */ +/* <Description> */ +/* An enumeration used in calls to @FT_Get_PS_Font_Value to identify */ +/* the Type~1 dictionary entry to retrieve. */ +/* */ +typedef enum PS_Dict_Keys_ { + /* conventionally in the font dictionary */ + PS_DICT_FONT_TYPE, /* FT_Byte */ + PS_DICT_FONT_MATRIX, /* FT_Fixed */ + PS_DICT_FONT_BBOX, /* FT_Fixed */ + PS_DICT_PAINT_TYPE, /* FT_Byte */ + PS_DICT_FONT_NAME, /* FT_String* */ + PS_DICT_UNIQUE_ID, /* FT_Int */ + PS_DICT_NUM_CHAR_STRINGS, /* FT_Int */ + PS_DICT_CHAR_STRING_KEY, /* FT_String* */ + PS_DICT_CHAR_STRING, /* FT_String* */ + PS_DICT_ENCODING_TYPE, /* T1_EncodingType */ + PS_DICT_ENCODING_ENTRY, /* FT_String* */ + + /* conventionally in the font Private dictionary */ + PS_DICT_NUM_SUBRS, /* FT_Int */ + PS_DICT_SUBR, /* FT_String* */ + PS_DICT_STD_HW, /* FT_UShort */ + PS_DICT_STD_VW, /* FT_UShort */ + PS_DICT_NUM_BLUE_VALUES, /* FT_Byte */ + PS_DICT_BLUE_VALUE, /* FT_Short */ + PS_DICT_BLUE_FUZZ, /* FT_Int */ + PS_DICT_NUM_OTHER_BLUES, /* FT_Byte */ + PS_DICT_OTHER_BLUE, /* FT_Short */ + PS_DICT_NUM_FAMILY_BLUES, /* FT_Byte */ + PS_DICT_FAMILY_BLUE, /* FT_Short */ + PS_DICT_NUM_FAMILY_OTHER_BLUES, /* FT_Byte */ + PS_DICT_FAMILY_OTHER_BLUE, /* FT_Short */ + PS_DICT_BLUE_SCALE, /* FT_Fixed */ + PS_DICT_BLUE_SHIFT, /* FT_Int */ + PS_DICT_NUM_STEM_SNAP_H, /* FT_Byte */ + PS_DICT_STEM_SNAP_H, /* FT_Short */ + PS_DICT_NUM_STEM_SNAP_V, /* FT_Byte */ + PS_DICT_STEM_SNAP_V, /* FT_Short */ + PS_DICT_FORCE_BOLD, /* FT_Bool */ + PS_DICT_RND_STEM_UP, /* FT_Bool */ + PS_DICT_MIN_FEATURE, /* FT_Short */ + PS_DICT_LEN_IV, /* FT_Int */ + PS_DICT_PASSWORD, /* FT_Long */ + PS_DICT_LANGUAGE_GROUP, /* FT_Long */ + + /* conventionally in the font FontInfo dictionary */ + PS_DICT_VERSION, /* FT_String* */ + PS_DICT_NOTICE, /* FT_String* */ + PS_DICT_FULL_NAME, /* FT_String* */ + PS_DICT_FAMILY_NAME, /* FT_String* */ + PS_DICT_WEIGHT, /* FT_String* */ + PS_DICT_IS_FIXED_PITCH, /* FT_Bool */ + PS_DICT_UNDERLINE_POSITION, /* FT_Short */ + PS_DICT_UNDERLINE_THICKNESS, /* FT_UShort */ + PS_DICT_FS_TYPE, /* FT_UShort */ + PS_DICT_ITALIC_ANGLE, /* FT_Long */ + + PS_DICT_MAX = PS_DICT_ITALIC_ANGLE + +} PS_Dict_Keys; + + +/************************************************************************ + * + * @function: + * FT_Get_PS_Font_Value + * + * @description: + * Retrieve the value for the supplied key from a PostScript font. + * + * @input: + * face :: + * PostScript face handle. + * + * key :: + * An enumeration value representing the dictionary key to retrieve. + * + * idx :: + * For array values, this specifies the index to be returned. + * + * value :: + * A pointer to memory into which to write the value. + * + * valen_len :: + * The size, in bytes, of the memory supplied for the value. + * + * @output: + * value :: + * The value matching the above key, if it exists. + * + * @return: + * The amount of memory (in bytes) required to hold the requested + * value (if it exists, -1 otherwise). + * + * @note: + * The values returned are not pointers into the internal structures of + * the face, but are `fresh' copies, so that the memory containing them + * belongs to the calling application. This also enforces the + * `read-only' nature of these values, i.e., this function cannot be + * used to manipulate the face. + * + * `value' is a void pointer because the values returned can be of + * various types. + * + * If either `value' is NULL or `value_len' is too small, just the + * required memory size for the requested entry is returned. + * + * The `idx' parameter is used, not only to retrieve elements of, for + * example, the FontMatrix or FontBBox, but also to retrieve name keys + * from the CharStrings dictionary, and the charstrings themselves. It + * is ignored for atomic values. + * + * PS_DICT_BLUE_SCALE returns a value that is scaled up by 1000. To + * get the value as in the font stream, you need to divide by + * 65536000.0 (to remove the FT_Fixed scale, and the x1000 scale). + * + * IMPORTANT: Only key/value pairs read by the FreeType interpreter can + * be retrieved. So, for example, PostScript procedures such as NP, + * ND, and RD are not available. Arbitrary keys are, obviously, not be + * available either. + * + * If the font's format is not PostScript-based, this function returns + * the `FT_Err_Invalid_Argument' error code. + * + */ +FT_EXPORT( FT_Long ) +FT_Get_PS_Font_Value( FT_Face +face, +PS_Dict_Keys key, + FT_UInt +idx, +void *value, + FT_Long +value_len ); + +/* */ + +FT_END_HEADER + +#endif /* __T1TABLES_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ttnameid.h b/app/src/main/cpp/include/freetype2/freetype/ttnameid.h new file mode 100644 index 0000000..afc862c --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ttnameid.h @@ -0,0 +1,1247 @@ +/***************************************************************************/ +/* */ +/* ttnameid.h */ +/* */ +/* TrueType name ID definitions (specification only). */ +/* */ +/* Copyright 1996-2002, 2003, 2004, 2006, 2007, 2008 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __TTNAMEID_H__ +#define __TTNAMEID_H__ + + +#include <ft2build.h> + + +FT_BEGIN_HEADER + + +/*************************************************************************/ +/* */ +/* <Section> */ +/* truetype_tables */ +/* */ + + +/*************************************************************************/ +/* */ +/* Possible values for the `platform' identifier code in the name */ +/* records of the TTF `name' table. */ +/* */ +/*************************************************************************/ + + +/*********************************************************************** + * + * @enum: + * TT_PLATFORM_XXX + * + * @description: + * A list of valid values for the `platform_id' identifier code in + * @FT_CharMapRec and @FT_SfntName structures. + * + * @values: + * TT_PLATFORM_APPLE_UNICODE :: + * Used by Apple to indicate a Unicode character map and/or name entry. + * See @TT_APPLE_ID_XXX for corresponding `encoding_id' values. Note + * that name entries in this format are coded as big-endian UCS-2 + * character codes _only_. + * + * TT_PLATFORM_MACINTOSH :: + * Used by Apple to indicate a MacOS-specific charmap and/or name entry. + * See @TT_MAC_ID_XXX for corresponding `encoding_id' values. Note that + * most TrueType fonts contain an Apple roman charmap to be usable on + * MacOS systems (even if they contain a Microsoft charmap as well). + * + * TT_PLATFORM_ISO :: + * This value was used to specify ISO/IEC 10646 charmaps. It is however + * now deprecated. See @TT_ISO_ID_XXX for a list of corresponding + * `encoding_id' values. + * + * TT_PLATFORM_MICROSOFT :: + * Used by Microsoft to indicate Windows-specific charmaps. See + * @TT_MS_ID_XXX for a list of corresponding `encoding_id' values. + * Note that most fonts contain a Unicode charmap using + * (TT_PLATFORM_MICROSOFT, @TT_MS_ID_UNICODE_CS). + * + * TT_PLATFORM_CUSTOM :: + * Used to indicate application-specific charmaps. + * + * TT_PLATFORM_ADOBE :: + * This value isn't part of any font format specification, but is used + * by FreeType to report Adobe-specific charmaps in an @FT_CharMapRec + * structure. See @TT_ADOBE_ID_XXX. + */ + +#define TT_PLATFORM_APPLE_UNICODE 0 +#define TT_PLATFORM_MACINTOSH 1 +#define TT_PLATFORM_ISO 2 /* deprecated */ +#define TT_PLATFORM_MICROSOFT 3 +#define TT_PLATFORM_CUSTOM 4 +#define TT_PLATFORM_ADOBE 7 /* artificial */ + + +/*********************************************************************** + * + * @enum: + * TT_APPLE_ID_XXX + * + * @description: + * A list of valid values for the `encoding_id' for + * @TT_PLATFORM_APPLE_UNICODE charmaps and name entries. + * + * @values: + * TT_APPLE_ID_DEFAULT :: + * Unicode version 1.0. + * + * TT_APPLE_ID_UNICODE_1_1 :: + * Unicode 1.1; specifies Hangul characters starting at U+34xx. + * + * TT_APPLE_ID_ISO_10646 :: + * Deprecated (identical to preceding). + * + * TT_APPLE_ID_UNICODE_2_0 :: + * Unicode 2.0 and beyond (UTF-16 BMP only). + * + * TT_APPLE_ID_UNICODE_32 :: + * Unicode 3.1 and beyond, using UTF-32. + * + * TT_APPLE_ID_VARIANT_SELECTOR :: + * From Adobe, not Apple. Not a normal cmap. Specifies variations + * on a real cmap. + */ + +#define TT_APPLE_ID_DEFAULT 0 /* Unicode 1.0 */ +#define TT_APPLE_ID_UNICODE_1_1 1 /* specify Hangul at U+34xx */ +#define TT_APPLE_ID_ISO_10646 2 /* deprecated */ +#define TT_APPLE_ID_UNICODE_2_0 3 /* or later */ +#define TT_APPLE_ID_UNICODE_32 4 /* 2.0 or later, full repertoire */ +#define TT_APPLE_ID_VARIANT_SELECTOR 5 /* variation selector data */ + + +/*********************************************************************** + * + * @enum: + * TT_MAC_ID_XXX + * + * @description: + * A list of valid values for the `encoding_id' for + * @TT_PLATFORM_MACINTOSH charmaps and name entries. + * + * @values: + * TT_MAC_ID_ROMAN :: + * TT_MAC_ID_JAPANESE :: + * TT_MAC_ID_TRADITIONAL_CHINESE :: + * TT_MAC_ID_KOREAN :: + * TT_MAC_ID_ARABIC :: + * TT_MAC_ID_HEBREW :: + * TT_MAC_ID_GREEK :: + * TT_MAC_ID_RUSSIAN :: + * TT_MAC_ID_RSYMBOL :: + * TT_MAC_ID_DEVANAGARI :: + * TT_MAC_ID_GURMUKHI :: + * TT_MAC_ID_GUJARATI :: + * TT_MAC_ID_ORIYA :: + * TT_MAC_ID_BENGALI :: + * TT_MAC_ID_TAMIL :: + * TT_MAC_ID_TELUGU :: + * TT_MAC_ID_KANNADA :: + * TT_MAC_ID_MALAYALAM :: + * TT_MAC_ID_SINHALESE :: + * TT_MAC_ID_BURMESE :: + * TT_MAC_ID_KHMER :: + * TT_MAC_ID_THAI :: + * TT_MAC_ID_LAOTIAN :: + * TT_MAC_ID_GEORGIAN :: + * TT_MAC_ID_ARMENIAN :: + * TT_MAC_ID_MALDIVIAN :: + * TT_MAC_ID_SIMPLIFIED_CHINESE :: + * TT_MAC_ID_TIBETAN :: + * TT_MAC_ID_MONGOLIAN :: + * TT_MAC_ID_GEEZ :: + * TT_MAC_ID_SLAVIC :: + * TT_MAC_ID_VIETNAMESE :: + * TT_MAC_ID_SINDHI :: + * TT_MAC_ID_UNINTERP :: + */ + +#define TT_MAC_ID_ROMAN 0 +#define TT_MAC_ID_JAPANESE 1 +#define TT_MAC_ID_TRADITIONAL_CHINESE 2 +#define TT_MAC_ID_KOREAN 3 +#define TT_MAC_ID_ARABIC 4 +#define TT_MAC_ID_HEBREW 5 +#define TT_MAC_ID_GREEK 6 +#define TT_MAC_ID_RUSSIAN 7 +#define TT_MAC_ID_RSYMBOL 8 +#define TT_MAC_ID_DEVANAGARI 9 +#define TT_MAC_ID_GURMUKHI 10 +#define TT_MAC_ID_GUJARATI 11 +#define TT_MAC_ID_ORIYA 12 +#define TT_MAC_ID_BENGALI 13 +#define TT_MAC_ID_TAMIL 14 +#define TT_MAC_ID_TELUGU 15 +#define TT_MAC_ID_KANNADA 16 +#define TT_MAC_ID_MALAYALAM 17 +#define TT_MAC_ID_SINHALESE 18 +#define TT_MAC_ID_BURMESE 19 +#define TT_MAC_ID_KHMER 20 +#define TT_MAC_ID_THAI 21 +#define TT_MAC_ID_LAOTIAN 22 +#define TT_MAC_ID_GEORGIAN 23 +#define TT_MAC_ID_ARMENIAN 24 +#define TT_MAC_ID_MALDIVIAN 25 +#define TT_MAC_ID_SIMPLIFIED_CHINESE 25 +#define TT_MAC_ID_TIBETAN 26 +#define TT_MAC_ID_MONGOLIAN 27 +#define TT_MAC_ID_GEEZ 28 +#define TT_MAC_ID_SLAVIC 29 +#define TT_MAC_ID_VIETNAMESE 30 +#define TT_MAC_ID_SINDHI 31 +#define TT_MAC_ID_UNINTERP 32 + + +/*********************************************************************** + * + * @enum: + * TT_ISO_ID_XXX + * + * @description: + * A list of valid values for the `encoding_id' for + * @TT_PLATFORM_ISO charmaps and name entries. + * + * Their use is now deprecated. + * + * @values: + * TT_ISO_ID_7BIT_ASCII :: + * ASCII. + * TT_ISO_ID_10646 :: + * ISO/10646. + * TT_ISO_ID_8859_1 :: + * Also known as Latin-1. + */ + +#define TT_ISO_ID_7BIT_ASCII 0 +#define TT_ISO_ID_10646 1 +#define TT_ISO_ID_8859_1 2 + + +/*********************************************************************** + * + * @enum: + * TT_MS_ID_XXX + * + * @description: + * A list of valid values for the `encoding_id' for + * @TT_PLATFORM_MICROSOFT charmaps and name entries. + * + * @values: + * TT_MS_ID_SYMBOL_CS :: + * Corresponds to Microsoft symbol encoding. See + * @FT_ENCODING_MS_SYMBOL. + * + * TT_MS_ID_UNICODE_CS :: + * Corresponds to a Microsoft WGL4 charmap, matching Unicode. See + * @FT_ENCODING_UNICODE. + * + * TT_MS_ID_SJIS :: + * Corresponds to SJIS Japanese encoding. See @FT_ENCODING_SJIS. + * + * TT_MS_ID_GB2312 :: + * Corresponds to Simplified Chinese as used in Mainland China. See + * @FT_ENCODING_GB2312. + * + * TT_MS_ID_BIG_5 :: + * Corresponds to Traditional Chinese as used in Taiwan and Hong Kong. + * See @FT_ENCODING_BIG5. + * + * TT_MS_ID_WANSUNG :: + * Corresponds to Korean Wansung encoding. See @FT_ENCODING_WANSUNG. + * + * TT_MS_ID_JOHAB :: + * Corresponds to Johab encoding. See @FT_ENCODING_JOHAB. + * + * TT_MS_ID_UCS_4 :: + * Corresponds to UCS-4 or UTF-32 charmaps. This has been added to + * the OpenType specification version 1.4 (mid-2001.) + */ + +#define TT_MS_ID_SYMBOL_CS 0 +#define TT_MS_ID_UNICODE_CS 1 +#define TT_MS_ID_SJIS 2 +#define TT_MS_ID_GB2312 3 +#define TT_MS_ID_BIG_5 4 +#define TT_MS_ID_WANSUNG 5 +#define TT_MS_ID_JOHAB 6 +#define TT_MS_ID_UCS_4 10 + + +/*********************************************************************** + * + * @enum: + * TT_ADOBE_ID_XXX + * + * @description: + * A list of valid values for the `encoding_id' for + * @TT_PLATFORM_ADOBE charmaps. This is a FreeType-specific extension! + * + * @values: + * TT_ADOBE_ID_STANDARD :: + * Adobe standard encoding. + * TT_ADOBE_ID_EXPERT :: + * Adobe expert encoding. + * TT_ADOBE_ID_CUSTOM :: + * Adobe custom encoding. + * TT_ADOBE_ID_LATIN_1 :: + * Adobe Latin~1 encoding. + */ + +#define TT_ADOBE_ID_STANDARD 0 +#define TT_ADOBE_ID_EXPERT 1 +#define TT_ADOBE_ID_CUSTOM 2 +#define TT_ADOBE_ID_LATIN_1 3 + + +/*************************************************************************/ +/* */ +/* Possible values of the language identifier field in the name records */ +/* of the TTF `name' table if the `platform' identifier code is */ +/* TT_PLATFORM_MACINTOSH. */ +/* */ +/* The canonical source for the Apple assigned Language ID's is at */ +/* */ +/* http://fonts.apple.com/TTRefMan/RM06/Chap6name.html */ +/* */ +#define TT_MAC_LANGID_ENGLISH 0 +#define TT_MAC_LANGID_FRENCH 1 +#define TT_MAC_LANGID_GERMAN 2 +#define TT_MAC_LANGID_ITALIAN 3 +#define TT_MAC_LANGID_DUTCH 4 +#define TT_MAC_LANGID_SWEDISH 5 +#define TT_MAC_LANGID_SPANISH 6 +#define TT_MAC_LANGID_DANISH 7 +#define TT_MAC_LANGID_PORTUGUESE 8 +#define TT_MAC_LANGID_NORWEGIAN 9 +#define TT_MAC_LANGID_HEBREW 10 +#define TT_MAC_LANGID_JAPANESE 11 +#define TT_MAC_LANGID_ARABIC 12 +#define TT_MAC_LANGID_FINNISH 13 +#define TT_MAC_LANGID_GREEK 14 +#define TT_MAC_LANGID_ICELANDIC 15 +#define TT_MAC_LANGID_MALTESE 16 +#define TT_MAC_LANGID_TURKISH 17 +#define TT_MAC_LANGID_CROATIAN 18 +#define TT_MAC_LANGID_CHINESE_TRADITIONAL 19 +#define TT_MAC_LANGID_URDU 20 +#define TT_MAC_LANGID_HINDI 21 +#define TT_MAC_LANGID_THAI 22 +#define TT_MAC_LANGID_KOREAN 23 +#define TT_MAC_LANGID_LITHUANIAN 24 +#define TT_MAC_LANGID_POLISH 25 +#define TT_MAC_LANGID_HUNGARIAN 26 +#define TT_MAC_LANGID_ESTONIAN 27 +#define TT_MAC_LANGID_LETTISH 28 +#define TT_MAC_LANGID_SAAMISK 29 +#define TT_MAC_LANGID_FAEROESE 30 +#define TT_MAC_LANGID_FARSI 31 +#define TT_MAC_LANGID_RUSSIAN 32 +#define TT_MAC_LANGID_CHINESE_SIMPLIFIED 33 +#define TT_MAC_LANGID_FLEMISH 34 +#define TT_MAC_LANGID_IRISH 35 +#define TT_MAC_LANGID_ALBANIAN 36 +#define TT_MAC_LANGID_ROMANIAN 37 +#define TT_MAC_LANGID_CZECH 38 +#define TT_MAC_LANGID_SLOVAK 39 +#define TT_MAC_LANGID_SLOVENIAN 40 +#define TT_MAC_LANGID_YIDDISH 41 +#define TT_MAC_LANGID_SERBIAN 42 +#define TT_MAC_LANGID_MACEDONIAN 43 +#define TT_MAC_LANGID_BULGARIAN 44 +#define TT_MAC_LANGID_UKRAINIAN 45 +#define TT_MAC_LANGID_BYELORUSSIAN 46 +#define TT_MAC_LANGID_UZBEK 47 +#define TT_MAC_LANGID_KAZAKH 48 +#define TT_MAC_LANGID_AZERBAIJANI 49 +#define TT_MAC_LANGID_AZERBAIJANI_CYRILLIC_SCRIPT 49 +#define TT_MAC_LANGID_AZERBAIJANI_ARABIC_SCRIPT 50 +#define TT_MAC_LANGID_ARMENIAN 51 +#define TT_MAC_LANGID_GEORGIAN 52 +#define TT_MAC_LANGID_MOLDAVIAN 53 +#define TT_MAC_LANGID_KIRGHIZ 54 +#define TT_MAC_LANGID_TAJIKI 55 +#define TT_MAC_LANGID_TURKMEN 56 +#define TT_MAC_LANGID_MONGOLIAN 57 +#define TT_MAC_LANGID_MONGOLIAN_MONGOLIAN_SCRIPT 57 +#define TT_MAC_LANGID_MONGOLIAN_CYRILLIC_SCRIPT 58 +#define TT_MAC_LANGID_PASHTO 59 +#define TT_MAC_LANGID_KURDISH 60 +#define TT_MAC_LANGID_KASHMIRI 61 +#define TT_MAC_LANGID_SINDHI 62 +#define TT_MAC_LANGID_TIBETAN 63 +#define TT_MAC_LANGID_NEPALI 64 +#define TT_MAC_LANGID_SANSKRIT 65 +#define TT_MAC_LANGID_MARATHI 66 +#define TT_MAC_LANGID_BENGALI 67 +#define TT_MAC_LANGID_ASSAMESE 68 +#define TT_MAC_LANGID_GUJARATI 69 +#define TT_MAC_LANGID_PUNJABI 70 +#define TT_MAC_LANGID_ORIYA 71 +#define TT_MAC_LANGID_MALAYALAM 72 +#define TT_MAC_LANGID_KANNADA 73 +#define TT_MAC_LANGID_TAMIL 74 +#define TT_MAC_LANGID_TELUGU 75 +#define TT_MAC_LANGID_SINHALESE 76 +#define TT_MAC_LANGID_BURMESE 77 +#define TT_MAC_LANGID_KHMER 78 +#define TT_MAC_LANGID_LAO 79 +#define TT_MAC_LANGID_VIETNAMESE 80 +#define TT_MAC_LANGID_INDONESIAN 81 +#define TT_MAC_LANGID_TAGALOG 82 +#define TT_MAC_LANGID_MALAY_ROMAN_SCRIPT 83 +#define TT_MAC_LANGID_MALAY_ARABIC_SCRIPT 84 +#define TT_MAC_LANGID_AMHARIC 85 +#define TT_MAC_LANGID_TIGRINYA 86 +#define TT_MAC_LANGID_GALLA 87 +#define TT_MAC_LANGID_SOMALI 88 +#define TT_MAC_LANGID_SWAHILI 89 +#define TT_MAC_LANGID_RUANDA 90 +#define TT_MAC_LANGID_RUNDI 91 +#define TT_MAC_LANGID_CHEWA 92 +#define TT_MAC_LANGID_MALAGASY 93 +#define TT_MAC_LANGID_ESPERANTO 94 +#define TT_MAC_LANGID_WELSH 128 +#define TT_MAC_LANGID_BASQUE 129 +#define TT_MAC_LANGID_CATALAN 130 +#define TT_MAC_LANGID_LATIN 131 +#define TT_MAC_LANGID_QUECHUA 132 +#define TT_MAC_LANGID_GUARANI 133 +#define TT_MAC_LANGID_AYMARA 134 +#define TT_MAC_LANGID_TATAR 135 +#define TT_MAC_LANGID_UIGHUR 136 +#define TT_MAC_LANGID_DZONGKHA 137 +#define TT_MAC_LANGID_JAVANESE 138 +#define TT_MAC_LANGID_SUNDANESE 139 + + +#if 0 /* these seem to be errors that have been dropped */ + +#define TT_MAC_LANGID_SCOTTISH_GAELIC 140 +#define TT_MAC_LANGID_IRISH_GAELIC 141 + +#endif + + +/* The following codes are new as of 2000-03-10 */ +#define TT_MAC_LANGID_GALICIAN 140 +#define TT_MAC_LANGID_AFRIKAANS 141 +#define TT_MAC_LANGID_BRETON 142 +#define TT_MAC_LANGID_INUKTITUT 143 +#define TT_MAC_LANGID_SCOTTISH_GAELIC 144 +#define TT_MAC_LANGID_MANX_GAELIC 145 +#define TT_MAC_LANGID_IRISH_GAELIC 146 +#define TT_MAC_LANGID_TONGAN 147 +#define TT_MAC_LANGID_GREEK_POLYTONIC 148 +#define TT_MAC_LANGID_GREELANDIC 149 +#define TT_MAC_LANGID_AZERBAIJANI_ROMAN_SCRIPT 150 + + +/*************************************************************************/ +/* */ +/* Possible values of the language identifier field in the name records */ +/* of the TTF `name' table if the `platform' identifier code is */ +/* TT_PLATFORM_MICROSOFT. */ +/* */ +/* The canonical source for the MS assigned LCID's (seems to) be at */ +/* */ +/* http://www.microsoft.com/globaldev/reference/lcid-all.mspx */ +/* */ +/* It used to be at various places, among them */ +/* */ +/* http://www.microsoft.com/typography/OTSPEC/lcid-cp.txt */ +/* http://www.microsoft.com/globaldev/reference/loclanghome.asp */ +/* http://support.microsoft.com/support/kb/articles/Q224/8/04.ASP */ +/* http://msdn.microsoft.com/library/en-us/passport25/ */ +/* NET_Passport_VBScript_Documentation/Single_Sign_In/ */ +/* Advanced_Single_Sign_In/Localization_and_LCIDs.asp */ +/* */ +/* Hopefully, it seems now that the Globaldev site prevails... */ +/* (updated by Antoine, 2004-02-17) */ + +#define TT_MS_LANGID_ARABIC_GENERAL 0x0001 +#define TT_MS_LANGID_ARABIC_SAUDI_ARABIA 0x0401 +#define TT_MS_LANGID_ARABIC_IRAQ 0x0801 +#define TT_MS_LANGID_ARABIC_EGYPT 0x0c01 +#define TT_MS_LANGID_ARABIC_LIBYA 0x1001 +#define TT_MS_LANGID_ARABIC_ALGERIA 0x1401 +#define TT_MS_LANGID_ARABIC_MOROCCO 0x1801 +#define TT_MS_LANGID_ARABIC_TUNISIA 0x1c01 +#define TT_MS_LANGID_ARABIC_OMAN 0x2001 +#define TT_MS_LANGID_ARABIC_YEMEN 0x2401 +#define TT_MS_LANGID_ARABIC_SYRIA 0x2801 +#define TT_MS_LANGID_ARABIC_JORDAN 0x2c01 +#define TT_MS_LANGID_ARABIC_LEBANON 0x3001 +#define TT_MS_LANGID_ARABIC_KUWAIT 0x3401 +#define TT_MS_LANGID_ARABIC_UAE 0x3801 +#define TT_MS_LANGID_ARABIC_BAHRAIN 0x3c01 +#define TT_MS_LANGID_ARABIC_QATAR 0x4001 +#define TT_MS_LANGID_BULGARIAN_BULGARIA 0x0402 +#define TT_MS_LANGID_CATALAN_SPAIN 0x0403 +#define TT_MS_LANGID_CHINESE_GENERAL 0x0004 +#define TT_MS_LANGID_CHINESE_TAIWAN 0x0404 +#define TT_MS_LANGID_CHINESE_PRC 0x0804 +#define TT_MS_LANGID_CHINESE_HONG_KONG 0x0c04 +#define TT_MS_LANGID_CHINESE_SINGAPORE 0x1004 + +#if 1 /* this looks like the correct value */ +#define TT_MS_LANGID_CHINESE_MACAU 0x1404 +#else /* but beware, Microsoft may change its mind... + the most recent Word reference has the following: */ +#define TT_MS_LANGID_CHINESE_MACAU TT_MS_LANGID_CHINESE_HONG_KONG +#endif + +#if 0 /* used only with .NET `cultures'; commented out */ +#define TT_MS_LANGID_CHINESE_TRADITIONAL 0x7C04 +#endif + +#define TT_MS_LANGID_CZECH_CZECH_REPUBLIC 0x0405 +#define TT_MS_LANGID_DANISH_DENMARK 0x0406 +#define TT_MS_LANGID_GERMAN_GERMANY 0x0407 +#define TT_MS_LANGID_GERMAN_SWITZERLAND 0x0807 +#define TT_MS_LANGID_GERMAN_AUSTRIA 0x0c07 +#define TT_MS_LANGID_GERMAN_LUXEMBOURG 0x1007 +#define TT_MS_LANGID_GERMAN_LIECHTENSTEI 0x1407 +#define TT_MS_LANGID_GREEK_GREECE 0x0408 + +/* don't ask what this one means... It is commented out currently. */ +#if 0 +#define TT_MS_LANGID_GREEK_GREECE2 0x2008 +#endif + +#define TT_MS_LANGID_ENGLISH_GENERAL 0x0009 +#define TT_MS_LANGID_ENGLISH_UNITED_STATES 0x0409 +#define TT_MS_LANGID_ENGLISH_UNITED_KINGDOM 0x0809 +#define TT_MS_LANGID_ENGLISH_AUSTRALIA 0x0c09 +#define TT_MS_LANGID_ENGLISH_CANADA 0x1009 +#define TT_MS_LANGID_ENGLISH_NEW_ZEALAND 0x1409 +#define TT_MS_LANGID_ENGLISH_IRELAND 0x1809 +#define TT_MS_LANGID_ENGLISH_SOUTH_AFRICA 0x1c09 +#define TT_MS_LANGID_ENGLISH_JAMAICA 0x2009 +#define TT_MS_LANGID_ENGLISH_CARIBBEAN 0x2409 +#define TT_MS_LANGID_ENGLISH_BELIZE 0x2809 +#define TT_MS_LANGID_ENGLISH_TRINIDAD 0x2c09 +#define TT_MS_LANGID_ENGLISH_ZIMBABWE 0x3009 +#define TT_MS_LANGID_ENGLISH_PHILIPPINES 0x3409 +#define TT_MS_LANGID_ENGLISH_INDONESIA 0x3809 +#define TT_MS_LANGID_ENGLISH_HONG_KONG 0x3c09 +#define TT_MS_LANGID_ENGLISH_INDIA 0x4009 +#define TT_MS_LANGID_ENGLISH_MALAYSIA 0x4409 +#define TT_MS_LANGID_ENGLISH_SINGAPORE 0x4809 +#define TT_MS_LANGID_SPANISH_SPAIN_TRADITIONAL_SORT 0x040a +#define TT_MS_LANGID_SPANISH_MEXICO 0x080a +#define TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT 0x0c0a +#define TT_MS_LANGID_SPANISH_GUATEMALA 0x100a +#define TT_MS_LANGID_SPANISH_COSTA_RICA 0x140a +#define TT_MS_LANGID_SPANISH_PANAMA 0x180a +#define TT_MS_LANGID_SPANISH_DOMINICAN_REPUBLIC 0x1c0a +#define TT_MS_LANGID_SPANISH_VENEZUELA 0x200a +#define TT_MS_LANGID_SPANISH_COLOMBIA 0x240a +#define TT_MS_LANGID_SPANISH_PERU 0x280a +#define TT_MS_LANGID_SPANISH_ARGENTINA 0x2c0a +#define TT_MS_LANGID_SPANISH_ECUADOR 0x300a +#define TT_MS_LANGID_SPANISH_CHILE 0x340a +#define TT_MS_LANGID_SPANISH_URUGUAY 0x380a +#define TT_MS_LANGID_SPANISH_PARAGUAY 0x3c0a +#define TT_MS_LANGID_SPANISH_BOLIVIA 0x400a +#define TT_MS_LANGID_SPANISH_EL_SALVADOR 0x440a +#define TT_MS_LANGID_SPANISH_HONDURAS 0x480a +#define TT_MS_LANGID_SPANISH_NICARAGUA 0x4c0a +#define TT_MS_LANGID_SPANISH_PUERTO_RICO 0x500a +#define TT_MS_LANGID_SPANISH_UNITED_STATES 0x540a +/* The following ID blatantly violate MS specs by using a */ +/* sublanguage > 0x1F. */ +#define TT_MS_LANGID_SPANISH_LATIN_AMERICA 0xE40aU +#define TT_MS_LANGID_FINNISH_FINLAND 0x040b +#define TT_MS_LANGID_FRENCH_FRANCE 0x040c +#define TT_MS_LANGID_FRENCH_BELGIUM 0x080c +#define TT_MS_LANGID_FRENCH_CANADA 0x0c0c +#define TT_MS_LANGID_FRENCH_SWITZERLAND 0x100c +#define TT_MS_LANGID_FRENCH_LUXEMBOURG 0x140c +#define TT_MS_LANGID_FRENCH_MONACO 0x180c +#define TT_MS_LANGID_FRENCH_WEST_INDIES 0x1c0c +#define TT_MS_LANGID_FRENCH_REUNION 0x200c +#define TT_MS_LANGID_FRENCH_CONGO 0x240c +/* which was formerly: */ +#define TT_MS_LANGID_FRENCH_ZAIRE TT_MS_LANGID_FRENCH_CONGO +#define TT_MS_LANGID_FRENCH_SENEGAL 0x280c +#define TT_MS_LANGID_FRENCH_CAMEROON 0x2c0c +#define TT_MS_LANGID_FRENCH_COTE_D_IVOIRE 0x300c +#define TT_MS_LANGID_FRENCH_MALI 0x340c +#define TT_MS_LANGID_FRENCH_MOROCCO 0x380c +#define TT_MS_LANGID_FRENCH_HAITI 0x3c0c +/* and another violation of the spec (see 0xE40aU) */ +#define TT_MS_LANGID_FRENCH_NORTH_AFRICA 0xE40cU +#define TT_MS_LANGID_HEBREW_ISRAEL 0x040d +#define TT_MS_LANGID_HUNGARIAN_HUNGARY 0x040e +#define TT_MS_LANGID_ICELANDIC_ICELAND 0x040f +#define TT_MS_LANGID_ITALIAN_ITALY 0x0410 +#define TT_MS_LANGID_ITALIAN_SWITZERLAND 0x0810 +#define TT_MS_LANGID_JAPANESE_JAPAN 0x0411 +#define TT_MS_LANGID_KOREAN_EXTENDED_WANSUNG_KOREA 0x0412 +#define TT_MS_LANGID_KOREAN_JOHAB_KOREA 0x0812 +#define TT_MS_LANGID_DUTCH_NETHERLANDS 0x0413 +#define TT_MS_LANGID_DUTCH_BELGIUM 0x0813 +#define TT_MS_LANGID_NORWEGIAN_NORWAY_BOKMAL 0x0414 +#define TT_MS_LANGID_NORWEGIAN_NORWAY_NYNORSK 0x0814 +#define TT_MS_LANGID_POLISH_POLAND 0x0415 +#define TT_MS_LANGID_PORTUGUESE_BRAZIL 0x0416 +#define TT_MS_LANGID_PORTUGUESE_PORTUGAL 0x0816 +#define TT_MS_LANGID_RHAETO_ROMANIC_SWITZERLAND 0x0417 +#define TT_MS_LANGID_ROMANIAN_ROMANIA 0x0418 +#define TT_MS_LANGID_MOLDAVIAN_MOLDAVIA 0x0818 +#define TT_MS_LANGID_RUSSIAN_RUSSIA 0x0419 +#define TT_MS_LANGID_RUSSIAN_MOLDAVIA 0x0819 +#define TT_MS_LANGID_CROATIAN_CROATIA 0x041a +#define TT_MS_LANGID_SERBIAN_SERBIA_LATIN 0x081a +#define TT_MS_LANGID_SERBIAN_SERBIA_CYRILLIC 0x0c1a + +#if 0 /* this used to be this value, but it looks like we were wrong */ +#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA 0x101a +#else /* current sources say */ +#define TT_MS_LANGID_CROATIAN_BOSNIA_HERZEGOVINA 0x101a +#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA 0x141a +/* and XPsp2 Platform SDK added (2004-07-26) */ +/* Names are shortened to be significant within 40 chars. */ +#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_LATIN 0x181a +#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_CYRILLIC 0x181a +#endif + +#define TT_MS_LANGID_SLOVAK_SLOVAKIA 0x041b +#define TT_MS_LANGID_ALBANIAN_ALBANIA 0x041c +#define TT_MS_LANGID_SWEDISH_SWEDEN 0x041d +#define TT_MS_LANGID_SWEDISH_FINLAND 0x081d +#define TT_MS_LANGID_THAI_THAILAND 0x041e +#define TT_MS_LANGID_TURKISH_TURKEY 0x041f +#define TT_MS_LANGID_URDU_PAKISTAN 0x0420 +#define TT_MS_LANGID_URDU_INDIA 0x0820 +#define TT_MS_LANGID_INDONESIAN_INDONESIA 0x0421 +#define TT_MS_LANGID_UKRAINIAN_UKRAINE 0x0422 +#define TT_MS_LANGID_BELARUSIAN_BELARUS 0x0423 +#define TT_MS_LANGID_SLOVENE_SLOVENIA 0x0424 +#define TT_MS_LANGID_ESTONIAN_ESTONIA 0x0425 +#define TT_MS_LANGID_LATVIAN_LATVIA 0x0426 +#define TT_MS_LANGID_LITHUANIAN_LITHUANIA 0x0427 +#define TT_MS_LANGID_CLASSIC_LITHUANIAN_LITHUANIA 0x0827 +#define TT_MS_LANGID_TAJIK_TAJIKISTAN 0x0428 +#define TT_MS_LANGID_FARSI_IRAN 0x0429 +#define TT_MS_LANGID_VIETNAMESE_VIET_NAM 0x042a +#define TT_MS_LANGID_ARMENIAN_ARMENIA 0x042b +#define TT_MS_LANGID_AZERI_AZERBAIJAN_LATIN 0x042c +#define TT_MS_LANGID_AZERI_AZERBAIJAN_CYRILLIC 0x082c +#define TT_MS_LANGID_BASQUE_SPAIN 0x042d +#define TT_MS_LANGID_SORBIAN_GERMANY 0x042e +#define TT_MS_LANGID_MACEDONIAN_MACEDONIA 0x042f +#define TT_MS_LANGID_SUTU_SOUTH_AFRICA 0x0430 +#define TT_MS_LANGID_TSONGA_SOUTH_AFRICA 0x0431 +#define TT_MS_LANGID_TSWANA_SOUTH_AFRICA 0x0432 +#define TT_MS_LANGID_VENDA_SOUTH_AFRICA 0x0433 +#define TT_MS_LANGID_XHOSA_SOUTH_AFRICA 0x0434 +#define TT_MS_LANGID_ZULU_SOUTH_AFRICA 0x0435 +#define TT_MS_LANGID_AFRIKAANS_SOUTH_AFRICA 0x0436 +#define TT_MS_LANGID_GEORGIAN_GEORGIA 0x0437 +#define TT_MS_LANGID_FAEROESE_FAEROE_ISLANDS 0x0438 +#define TT_MS_LANGID_HINDI_INDIA 0x0439 +#define TT_MS_LANGID_MALTESE_MALTA 0x043a +/* Added by XPsp2 Platform SDK (2004-07-26) */ +#define TT_MS_LANGID_SAMI_NORTHERN_NORWAY 0x043b +#define TT_MS_LANGID_SAMI_NORTHERN_SWEDEN 0x083b +#define TT_MS_LANGID_SAMI_NORTHERN_FINLAND 0x0C3b +#define TT_MS_LANGID_SAMI_LULE_NORWAY 0x103b +#define TT_MS_LANGID_SAMI_LULE_SWEDEN 0x143b +#define TT_MS_LANGID_SAMI_SOUTHERN_NORWAY 0x183b +#define TT_MS_LANGID_SAMI_SOUTHERN_SWEDEN 0x1C3b +#define TT_MS_LANGID_SAMI_SKOLT_FINLAND 0x203b +#define TT_MS_LANGID_SAMI_INARI_FINLAND 0x243b +/* ... and we also keep our old identifier... */ +#define TT_MS_LANGID_SAAMI_LAPONIA 0x043b + +#if 0 /* this seems to be a previous inversion */ +#define TT_MS_LANGID_IRISH_GAELIC_IRELAND 0x043c +#define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM 0x083c +#else +#define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM 0x083c +#define TT_MS_LANGID_IRISH_GAELIC_IRELAND 0x043c +#endif + +#define TT_MS_LANGID_YIDDISH_GERMANY 0x043d +#define TT_MS_LANGID_MALAY_MALAYSIA 0x043e +#define TT_MS_LANGID_MALAY_BRUNEI_DARUSSALAM 0x083e +#define TT_MS_LANGID_KAZAK_KAZAKSTAN 0x043f +#define TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN /* Cyrillic*/ 0x0440 +/* alias declared in Windows 2000 */ +#define TT_MS_LANGID_KIRGHIZ_KIRGHIZ_REPUBLIC \ + TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN + +#define TT_MS_LANGID_SWAHILI_KENYA 0x0441 +#define TT_MS_LANGID_TURKMEN_TURKMENISTAN 0x0442 +#define TT_MS_LANGID_UZBEK_UZBEKISTAN_LATIN 0x0443 +#define TT_MS_LANGID_UZBEK_UZBEKISTAN_CYRILLIC 0x0843 +#define TT_MS_LANGID_TATAR_TATARSTAN 0x0444 +#define TT_MS_LANGID_BENGALI_INDIA 0x0445 +#define TT_MS_LANGID_BENGALI_BANGLADESH 0x0845 +#define TT_MS_LANGID_PUNJABI_INDIA 0x0446 +#define TT_MS_LANGID_PUNJABI_ARABIC_PAKISTAN 0x0846 +#define TT_MS_LANGID_GUJARATI_INDIA 0x0447 +#define TT_MS_LANGID_ORIYA_INDIA 0x0448 +#define TT_MS_LANGID_TAMIL_INDIA 0x0449 +#define TT_MS_LANGID_TELUGU_INDIA 0x044a +#define TT_MS_LANGID_KANNADA_INDIA 0x044b +#define TT_MS_LANGID_MALAYALAM_INDIA 0x044c +#define TT_MS_LANGID_ASSAMESE_INDIA 0x044d +#define TT_MS_LANGID_MARATHI_INDIA 0x044e +#define TT_MS_LANGID_SANSKRIT_INDIA 0x044f +#define TT_MS_LANGID_MONGOLIAN_MONGOLIA /* Cyrillic */ 0x0450 +#define TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN 0x0850 +#define TT_MS_LANGID_TIBETAN_CHINA 0x0451 +/* Don't use the next constant! It has */ +/* (1) the wrong spelling (Dzonghka) */ +/* (2) Microsoft doesn't officially define it -- */ +/* at least it is not in the List of Local */ +/* ID Values. */ +/* (3) Dzongkha is not the same language as */ +/* Tibetan, so merging it is wrong anyway. */ +/* */ +/* TT_MS_LANGID_TIBETAN_BHUTAN is correct, BTW. */ +#define TT_MS_LANGID_DZONGHKA_BHUTAN 0x0851 + +#if 0 +/* the following used to be defined */ +#define TT_MS_LANGID_TIBETAN_BHUTAN 0x0451 +/* ... but it was changed; */ +#else +/* So we will continue to #define it, but with the correct value */ +#define TT_MS_LANGID_TIBETAN_BHUTAN TT_MS_LANGID_DZONGHKA_BHUTAN +#endif + +#define TT_MS_LANGID_WELSH_WALES 0x0452 +#define TT_MS_LANGID_KHMER_CAMBODIA 0x0453 +#define TT_MS_LANGID_LAO_LAOS 0x0454 +#define TT_MS_LANGID_BURMESE_MYANMAR 0x0455 +#define TT_MS_LANGID_GALICIAN_SPAIN 0x0456 +#define TT_MS_LANGID_KONKANI_INDIA 0x0457 +#define TT_MS_LANGID_MANIPURI_INDIA /* Bengali */ 0x0458 +#define TT_MS_LANGID_SINDHI_INDIA /* Arabic */ 0x0459 +#define TT_MS_LANGID_SINDHI_PAKISTAN 0x0859 +/* Missing a LCID for Sindhi in Devanagari script */ +#define TT_MS_LANGID_SYRIAC_SYRIA 0x045a +#define TT_MS_LANGID_SINHALESE_SRI_LANKA 0x045b +#define TT_MS_LANGID_CHEROKEE_UNITED_STATES 0x045c +#define TT_MS_LANGID_INUKTITUT_CANADA 0x045d +#define TT_MS_LANGID_AMHARIC_ETHIOPIA 0x045e +#define TT_MS_LANGID_TAMAZIGHT_MOROCCO /* Arabic */ 0x045f +#define TT_MS_LANGID_TAMAZIGHT_MOROCCO_LATIN 0x085f +/* Missing a LCID for Tifinagh script */ +#define TT_MS_LANGID_KASHMIRI_PAKISTAN /* Arabic */ 0x0460 +/* Spelled this way by XPsp2 Platform SDK (2004-07-26) */ +/* script is yet unclear... might be Arabic, Nagari or Sharada */ +#define TT_MS_LANGID_KASHMIRI_SASIA 0x0860 +/* ... and aliased (by MS) for compatibility reasons. */ +#define TT_MS_LANGID_KASHMIRI_INDIA TT_MS_LANGID_KASHMIRI_SASIA +#define TT_MS_LANGID_NEPALI_NEPAL 0x0461 +#define TT_MS_LANGID_NEPALI_INDIA 0x0861 +#define TT_MS_LANGID_FRISIAN_NETHERLANDS 0x0462 +#define TT_MS_LANGID_PASHTO_AFGHANISTAN 0x0463 +#define TT_MS_LANGID_FILIPINO_PHILIPPINES 0x0464 +#define TT_MS_LANGID_DHIVEHI_MALDIVES 0x0465 +/* alias declared in Windows 2000 */ +#define TT_MS_LANGID_DIVEHI_MALDIVES TT_MS_LANGID_DHIVEHI_MALDIVES +#define TT_MS_LANGID_EDO_NIGERIA 0x0466 +#define TT_MS_LANGID_FULFULDE_NIGERIA 0x0467 +#define TT_MS_LANGID_HAUSA_NIGERIA 0x0468 +#define TT_MS_LANGID_IBIBIO_NIGERIA 0x0469 +#define TT_MS_LANGID_YORUBA_NIGERIA 0x046a +#define TT_MS_LANGID_QUECHUA_BOLIVIA 0x046b +#define TT_MS_LANGID_QUECHUA_ECUADOR 0x086b +#define TT_MS_LANGID_QUECHUA_PERU 0x0c6b +#define TT_MS_LANGID_SEPEDI_SOUTH_AFRICA 0x046c +/* Also spelled by XPsp2 Platform SDK (2004-07-26) */ +#define TT_MS_LANGID_SOTHO_SOUTHERN_SOUTH_AFRICA \ + TT_MS_LANGID_SEPEDI_SOUTH_AFRICA +/* language codes 0x046d, 0x046e and 0x046f are (still) unknown. */ +#define TT_MS_LANGID_IGBO_NIGERIA 0x0470 +#define TT_MS_LANGID_KANURI_NIGERIA 0x0471 +#define TT_MS_LANGID_OROMO_ETHIOPIA 0x0472 +#define TT_MS_LANGID_TIGRIGNA_ETHIOPIA 0x0473 +#define TT_MS_LANGID_TIGRIGNA_ERYTHREA 0x0873 +/* also spelled in the `Passport SDK' list as: */ +#define TT_MS_LANGID_TIGRIGNA_ERYTREA TT_MS_LANGID_TIGRIGNA_ERYTHREA +#define TT_MS_LANGID_GUARANI_PARAGUAY 0x0474 +#define TT_MS_LANGID_HAWAIIAN_UNITED_STATES 0x0475 +#define TT_MS_LANGID_LATIN 0x0476 +#define TT_MS_LANGID_SOMALI_SOMALIA 0x0477 +/* Note: Yi does not have a (proper) ISO 639-2 code, since it is mostly */ +/* not written (but OTOH the peculiar writing system is worth */ +/* studying). */ +#define TT_MS_LANGID_YI_CHINA 0x0478 +#define TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES 0x0479 +/* language codes from 0x047a to 0x047f are (still) unknown. */ +#define TT_MS_LANGID_UIGHUR_CHINA 0x0480 +#define TT_MS_LANGID_MAORI_NEW_ZEALAND 0x0481 + +#if 0 /* not deemed useful for fonts */ +#define TT_MS_LANGID_HUMAN_INTERFACE_DEVICE 0x04ff +#endif + + +/*************************************************************************/ +/* */ +/* Possible values of the `name' identifier field in the name records of */ +/* the TTF `name' table. These values are platform independent. */ +/* */ +#define TT_NAME_ID_COPYRIGHT 0 +#define TT_NAME_ID_FONT_FAMILY 1 +#define TT_NAME_ID_FONT_SUBFAMILY 2 +#define TT_NAME_ID_UNIQUE_ID 3 +#define TT_NAME_ID_FULL_NAME 4 +#define TT_NAME_ID_VERSION_STRING 5 +#define TT_NAME_ID_PS_NAME 6 +#define TT_NAME_ID_TRADEMARK 7 + +/* the following values are from the OpenType spec */ +#define TT_NAME_ID_MANUFACTURER 8 +#define TT_NAME_ID_DESIGNER 9 +#define TT_NAME_ID_DESCRIPTION 10 +#define TT_NAME_ID_VENDOR_URL 11 +#define TT_NAME_ID_DESIGNER_URL 12 +#define TT_NAME_ID_LICENSE 13 +#define TT_NAME_ID_LICENSE_URL 14 +/* number 15 is reserved */ +#define TT_NAME_ID_PREFERRED_FAMILY 16 +#define TT_NAME_ID_PREFERRED_SUBFAMILY 17 +#define TT_NAME_ID_MAC_FULL_NAME 18 + +/* The following code is new as of 2000-01-21 */ +#define TT_NAME_ID_SAMPLE_TEXT 19 + +/* This is new in OpenType 1.3 */ +#define TT_NAME_ID_CID_FINDFONT_NAME 20 + +/* This is new in OpenType 1.5 */ +#define TT_NAME_ID_WWS_FAMILY 21 +#define TT_NAME_ID_WWS_SUBFAMILY 22 + + +/*************************************************************************/ +/* */ +/* Bit mask values for the Unicode Ranges from the TTF `OS2 ' table. */ +/* */ +/* Updated 08-Nov-2008. */ +/* */ + +/* Bit 0 Basic Latin */ +#define TT_UCR_BASIC_LATIN (1L << 0) /* U+0020-U+007E */ +/* Bit 1 C1 Controls and Latin-1 Supplement */ +#define TT_UCR_LATIN1_SUPPLEMENT (1L << 1) /* U+0080-U+00FF */ +/* Bit 2 Latin Extended-A */ +#define TT_UCR_LATIN_EXTENDED_A (1L << 2) /* U+0100-U+017F */ +/* Bit 3 Latin Extended-B */ +#define TT_UCR_LATIN_EXTENDED_B (1L << 3) /* U+0180-U+024F */ +/* Bit 4 IPA Extensions */ +/* Phonetic Extensions */ +/* Phonetic Extensions Supplement */ +#define TT_UCR_IPA_EXTENSIONS (1L << 4) /* U+0250-U+02AF */ +/* U+1D00-U+1D7F */ +/* U+1D80-U+1DBF */ +/* Bit 5 Spacing Modifier Letters */ +/* Modifier Tone Letters */ +#define TT_UCR_SPACING_MODIFIER (1L << 5) /* U+02B0-U+02FF */ +/* U+A700-U+A71F */ +/* Bit 6 Combining Diacritical Marks */ +/* Combining Diacritical Marks Supplement */ +#define TT_UCR_COMBINING_DIACRITICS (1L << 6) /* U+0300-U+036F */ +/* U+1DC0-U+1DFF */ +/* Bit 7 Greek and Coptic */ +#define TT_UCR_GREEK (1L << 7) /* U+0370-U+03FF */ +/* Bit 8 Coptic */ +#define TT_UCR_COPTIC (1L << 8) /* U+2C80-U+2CFF */ +/* Bit 9 Cyrillic */ +/* Cyrillic Supplement */ +/* Cyrillic Extended-A */ +/* Cyrillic Extended-B */ +#define TT_UCR_CYRILLIC (1L << 9) /* U+0400-U+04FF */ +/* U+0500-U+052F */ +/* U+2DE0-U+2DFF */ +/* U+A640-U+A69F */ +/* Bit 10 Armenian */ +#define TT_UCR_ARMENIAN (1L << 10) /* U+0530-U+058F */ +/* Bit 11 Hebrew */ +#define TT_UCR_HEBREW (1L << 11) /* U+0590-U+05FF */ +/* Bit 12 Vai */ +#define TT_UCR_VAI (1L << 12) /* U+A500-U+A63F */ +/* Bit 13 Arabic */ +/* Arabic Supplement */ +#define TT_UCR_ARABIC (1L << 13) /* U+0600-U+06FF */ +/* U+0750-U+077F */ +/* Bit 14 NKo */ +#define TT_UCR_NKO (1L << 14) /* U+07C0-U+07FF */ +/* Bit 15 Devanagari */ +#define TT_UCR_DEVANAGARI (1L << 15) /* U+0900-U+097F */ +/* Bit 16 Bengali */ +#define TT_UCR_BENGALI (1L << 16) /* U+0980-U+09FF */ +/* Bit 17 Gurmukhi */ +#define TT_UCR_GURMUKHI (1L << 17) /* U+0A00-U+0A7F */ +/* Bit 18 Gujarati */ +#define TT_UCR_GUJARATI (1L << 18) /* U+0A80-U+0AFF */ +/* Bit 19 Oriya */ +#define TT_UCR_ORIYA (1L << 19) /* U+0B00-U+0B7F */ +/* Bit 20 Tamil */ +#define TT_UCR_TAMIL (1L << 20) /* U+0B80-U+0BFF */ +/* Bit 21 Telugu */ +#define TT_UCR_TELUGU (1L << 21) /* U+0C00-U+0C7F */ +/* Bit 22 Kannada */ +#define TT_UCR_KANNADA (1L << 22) /* U+0C80-U+0CFF */ +/* Bit 23 Malayalam */ +#define TT_UCR_MALAYALAM (1L << 23) /* U+0D00-U+0D7F */ +/* Bit 24 Thai */ +#define TT_UCR_THAI (1L << 24) /* U+0E00-U+0E7F */ +/* Bit 25 Lao */ +#define TT_UCR_LAO (1L << 25) /* U+0E80-U+0EFF */ +/* Bit 26 Georgian */ +/* Georgian Supplement */ +#define TT_UCR_GEORGIAN (1L << 26) /* U+10A0-U+10FF */ +/* U+2D00-U+2D2F */ +/* Bit 27 Balinese */ +#define TT_UCR_BALINESE (1L << 27) /* U+1B00-U+1B7F */ +/* Bit 28 Hangul Jamo */ +#define TT_UCR_HANGUL_JAMO (1L << 28) /* U+1100-U+11FF */ +/* Bit 29 Latin Extended Additional */ +/* Latin Extended-C */ +/* Latin Extended-D */ +#define TT_UCR_LATIN_EXTENDED_ADDITIONAL (1L << 29) /* U+1E00-U+1EFF */ +/* U+2C60-U+2C7F */ +/* U+A720-U+A7FF */ +/* Bit 30 Greek Extended */ +#define TT_UCR_GREEK_EXTENDED (1L << 30) /* U+1F00-U+1FFF */ +/* Bit 31 General Punctuation */ +/* Supplemental Punctuation */ +#define TT_UCR_GENERAL_PUNCTUATION (1L << 31) /* U+2000-U+206F */ +/* U+2E00-U+2E7F */ +/* Bit 32 Superscripts And Subscripts */ +#define TT_UCR_SUPERSCRIPTS_SUBSCRIPTS (1L << 0) /* U+2070-U+209F */ +/* Bit 33 Currency Symbols */ +#define TT_UCR_CURRENCY_SYMBOLS (1L << 1) /* U+20A0-U+20CF */ +/* Bit 34 Combining Diacritical Marks For Symbols */ +#define TT_UCR_COMBINING_DIACRITICS_SYMB (1L << 2) /* U+20D0-U+20FF */ +/* Bit 35 Letterlike Symbols */ +#define TT_UCR_LETTERLIKE_SYMBOLS (1L << 3) /* U+2100-U+214F */ +/* Bit 36 Number Forms */ +#define TT_UCR_NUMBER_FORMS (1L << 4) /* U+2150-U+218F */ +/* Bit 37 Arrows */ +/* Supplemental Arrows-A */ +/* Supplemental Arrows-B */ +/* Miscellaneous Symbols and Arrows */ +#define TT_UCR_ARROWS (1L << 5) /* U+2190-U+21FF */ +/* U+27F0-U+27FF */ +/* U+2900-U+297F */ +/* U+2B00-U+2BFF */ +/* Bit 38 Mathematical Operators */ +/* Supplemental Mathematical Operators */ +/* Miscellaneous Mathematical Symbols-A */ +/* Miscellaneous Mathematical Symbols-B */ +#define TT_UCR_MATHEMATICAL_OPERATORS (1L << 6) /* U+2200-U+22FF */ +/* U+2A00-U+2AFF */ +/* U+27C0-U+27EF */ +/* U+2980-U+29FF */ +/* Bit 39 Miscellaneous Technical */ +#define TT_UCR_MISCELLANEOUS_TECHNICAL (1L << 7) /* U+2300-U+23FF */ +/* Bit 40 Control Pictures */ +#define TT_UCR_CONTROL_PICTURES (1L << 8) /* U+2400-U+243F */ +/* Bit 41 Optical Character Recognition */ +#define TT_UCR_OCR (1L << 9) /* U+2440-U+245F */ +/* Bit 42 Enclosed Alphanumerics */ +#define TT_UCR_ENCLOSED_ALPHANUMERICS (1L << 10) /* U+2460-U+24FF */ +/* Bit 43 Box Drawing */ +#define TT_UCR_BOX_DRAWING (1L << 11) /* U+2500-U+257F */ +/* Bit 44 Block Elements */ +#define TT_UCR_BLOCK_ELEMENTS (1L << 12) /* U+2580-U+259F */ +/* Bit 45 Geometric Shapes */ +#define TT_UCR_GEOMETRIC_SHAPES (1L << 13) /* U+25A0-U+25FF */ +/* Bit 46 Miscellaneous Symbols */ +#define TT_UCR_MISCELLANEOUS_SYMBOLS (1L << 14) /* U+2600-U+26FF */ +/* Bit 47 Dingbats */ +#define TT_UCR_DINGBATS (1L << 15) /* U+2700-U+27BF */ +/* Bit 48 CJK Symbols and Punctuation */ +#define TT_UCR_CJK_SYMBOLS (1L << 16) /* U+3000-U+303F */ +/* Bit 49 Hiragana */ +#define TT_UCR_HIRAGANA (1L << 17) /* U+3040-U+309F */ +/* Bit 50 Katakana */ +/* Katakana Phonetic Extensions */ +#define TT_UCR_KATAKANA (1L << 18) /* U+30A0-U+30FF */ +/* U+31F0-U+31FF */ +/* Bit 51 Bopomofo */ +/* Bopomofo Extended */ +#define TT_UCR_BOPOMOFO (1L << 19) /* U+3100-U+312F */ +/* U+31A0-U+31BF */ +/* Bit 52 Hangul Compatibility Jamo */ +#define TT_UCR_HANGUL_COMPATIBILITY_JAMO (1L << 20) /* U+3130-U+318F */ +/* Bit 53 Phags-Pa */ +#define TT_UCR_CJK_MISC (1L << 21) /* U+A840-U+A87F */ +#define TT_UCR_KANBUN TT_UCR_CJK_MISC /* deprecated */ +#define TT_UCR_PHAGSPA +/* Bit 54 Enclosed CJK Letters and Months */ +#define TT_UCR_ENCLOSED_CJK_LETTERS_MONTHS (1L << 22) /* U+3200-U+32FF */ +/* Bit 55 CJK Compatibility */ +#define TT_UCR_CJK_COMPATIBILITY (1L << 23) /* U+3300-U+33FF */ +/* Bit 56 Hangul Syllables */ +#define TT_UCR_HANGUL (1L << 24) /* U+AC00-U+D7A3 */ +/* Bit 57 High Surrogates */ +/* High Private Use Surrogates */ +/* Low Surrogates */ +/* */ +/* According to OpenType specs v.1.3+, */ +/* setting bit 57 implies that there is */ +/* at least one codepoint beyond the */ +/* Basic Multilingual Plane that is */ +/* supported by this font. So it really */ +/* means >= U+10000 */ +#define TT_UCR_SURROGATES (1L << 25) /* U+D800-U+DB7F */ +/* U+DB80-U+DBFF */ +/* U+DC00-U+DFFF */ +#define TT_UCR_NON_PLANE_0 TT_UCR_SURROGATES +/* Bit 58 Phoenician */ +#define TT_UCR_PHOENICIAN (1L << 26) /*U+10900-U+1091F*/ +/* Bit 59 CJK Unified Ideographs */ +/* CJK Radicals Supplement */ +/* Kangxi Radicals */ +/* Ideographic Description Characters */ +/* CJK Unified Ideographs Extension A */ +/* CJK Unified Ideographs Extension B */ +/* Kanbun */ +#define TT_UCR_CJK_UNIFIED_IDEOGRAPHS (1L << 27) /* U+4E00-U+9FFF */ +/* U+2E80-U+2EFF */ +/* U+2F00-U+2FDF */ +/* U+2FF0-U+2FFF */ +/* U+3400-U+4DB5 */ +/*U+20000-U+2A6DF*/ +/* U+3190-U+319F */ +/* Bit 60 Private Use */ +#define TT_UCR_PRIVATE_USE (1L << 28) /* U+E000-U+F8FF */ +/* Bit 61 CJK Strokes */ +/* CJK Compatibility Ideographs */ +/* CJK Compatibility Ideographs Supplement */ +#define TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS (1L << 29) /* U+31C0-U+31EF */ +/* U+F900-U+FAFF */ +/*U+2F800-U+2FA1F*/ +/* Bit 62 Alphabetic Presentation Forms */ +#define TT_UCR_ALPHABETIC_PRESENTATION_FORMS (1L << 30) /* U+FB00-U+FB4F */ +/* Bit 63 Arabic Presentation Forms-A */ +#define TT_UCR_ARABIC_PRESENTATIONS_A (1L << 31) /* U+FB50-U+FDFF */ +/* Bit 64 Combining Half Marks */ +#define TT_UCR_COMBINING_HALF_MARKS (1L << 0) /* U+FE20-U+FE2F */ +/* Bit 65 Vertical forms */ +/* CJK Compatibility Forms */ +#define TT_UCR_CJK_COMPATIBILITY_FORMS (1L << 1) /* U+FE10-U+FE1F */ +/* U+FE30-U+FE4F */ +/* Bit 66 Small Form Variants */ +#define TT_UCR_SMALL_FORM_VARIANTS (1L << 2) /* U+FE50-U+FE6F */ +/* Bit 67 Arabic Presentation Forms-B */ +#define TT_UCR_ARABIC_PRESENTATIONS_B (1L << 3) /* U+FE70-U+FEFE */ +/* Bit 68 Halfwidth and Fullwidth Forms */ +#define TT_UCR_HALFWIDTH_FULLWIDTH_FORMS (1L << 4) /* U+FF00-U+FFEF */ +/* Bit 69 Specials */ +#define TT_UCR_SPECIALS (1L << 5) /* U+FFF0-U+FFFD */ +/* Bit 70 Tibetan */ +#define TT_UCR_TIBETAN (1L << 6) /* U+0F00-U+0FFF */ +/* Bit 71 Syriac */ +#define TT_UCR_SYRIAC (1L << 7) /* U+0700-U+074F */ +/* Bit 72 Thaana */ +#define TT_UCR_THAANA (1L << 8) /* U+0780-U+07BF */ +/* Bit 73 Sinhala */ +#define TT_UCR_SINHALA (1L << 9) /* U+0D80-U+0DFF */ +/* Bit 74 Myanmar */ +#define TT_UCR_MYANMAR (1L << 10) /* U+1000-U+109F */ +/* Bit 75 Ethiopic */ +/* Ethiopic Supplement */ +/* Ethiopic Extended */ +#define TT_UCR_ETHIOPIC (1L << 11) /* U+1200-U+137F */ +/* U+1380-U+139F */ +/* U+2D80-U+2DDF */ +/* Bit 76 Cherokee */ +#define TT_UCR_CHEROKEE (1L << 12) /* U+13A0-U+13FF */ +/* Bit 77 Unified Canadian Aboriginal Syllabics */ +#define TT_UCR_CANADIAN_ABORIGINAL_SYLLABICS (1L << 13) /* U+1400-U+167F */ +/* Bit 78 Ogham */ +#define TT_UCR_OGHAM (1L << 14) /* U+1680-U+169F */ +/* Bit 79 Runic */ +#define TT_UCR_RUNIC (1L << 15) /* U+16A0-U+16FF */ +/* Bit 80 Khmer */ +/* Khmer Symbols */ +#define TT_UCR_KHMER (1L << 16) /* U+1780-U+17FF */ +/* U+19E0-U+19FF */ +/* Bit 81 Mongolian */ +#define TT_UCR_MONGOLIAN (1L << 17) /* U+1800-U+18AF */ +/* Bit 82 Braille Patterns */ +#define TT_UCR_BRAILLE (1L << 18) /* U+2800-U+28FF */ +/* Bit 83 Yi Syllables */ +/* Yi Radicals */ +#define TT_UCR_YI (1L << 19) /* U+A000-U+A48F */ +/* U+A490-U+A4CF */ +/* Bit 84 Tagalog */ +/* Hanunoo */ +/* Buhid */ +/* Tagbanwa */ +#define TT_UCR_PHILIPPINE (1L << 20) /* U+1700-U+171F */ +/* U+1720-U+173F */ +/* U+1740-U+175F */ +/* U+1760-U+177F */ +/* Bit 85 Old Italic */ +#define TT_UCR_OLD_ITALIC (1L << 21) /*U+10300-U+1032F*/ +/* Bit 86 Gothic */ +#define TT_UCR_GOTHIC (1L << 22) /*U+10330-U+1034F*/ +/* Bit 87 Deseret */ +#define TT_UCR_DESERET (1L << 23) /*U+10400-U+1044F*/ +/* Bit 88 Byzantine Musical Symbols */ +/* Musical Symbols */ +/* Ancient Greek Musical Notation */ +#define TT_UCR_MUSICAL_SYMBOLS (1L << 24) /*U+1D000-U+1D0FF*/ +/*U+1D100-U+1D1FF*/ +/*U+1D200-U+1D24F*/ +/* Bit 89 Mathematical Alphanumeric Symbols */ +#define TT_UCR_MATH_ALPHANUMERIC_SYMBOLS (1L << 25) /*U+1D400-U+1D7FF*/ +/* Bit 90 Private Use (plane 15) */ +/* Private Use (plane 16) */ +#define TT_UCR_PRIVATE_USE_SUPPLEMENTARY (1L << 26) /*U+F0000-U+FFFFD*/ +/*U+100000-U+10FFFD*/ +/* Bit 91 Variation Selectors */ +/* Variation Selectors Supplement */ +#define TT_UCR_VARIATION_SELECTORS (1L << 27) /* U+FE00-U+FE0F */ +/*U+E0100-U+E01EF*/ +/* Bit 92 Tags */ +#define TT_UCR_TAGS (1L << 28) /*U+E0000-U+E007F*/ +/* Bit 93 Limbu */ +#define TT_UCR_LIMBU (1L << 29) /* U+1900-U+194F */ +/* Bit 94 Tai Le */ +#define TT_UCR_TAI_LE (1L << 30) /* U+1950-U+197F */ +/* Bit 95 New Tai Lue */ +#define TT_UCR_NEW_TAI_LUE (1L << 31) /* U+1980-U+19DF */ +/* Bit 96 Buginese */ +#define TT_UCR_BUGINESE (1L << 0) /* U+1A00-U+1A1F */ +/* Bit 97 Glagolitic */ +#define TT_UCR_GLAGOLITIC (1L << 1) /* U+2C00-U+2C5F */ +/* Bit 98 Tifinagh */ +#define TT_UCR_TIFINAGH (1L << 2) /* U+2D30-U+2D7F */ +/* Bit 99 Yijing Hexagram Symbols */ +#define TT_UCR_YIJING (1L << 3) /* U+4DC0-U+4DFF */ +/* Bit 100 Syloti Nagri */ +#define TT_UCR_SYLOTI_NAGRI (1L << 4) /* U+A800-U+A82F */ +/* Bit 101 Linear B Syllabary */ +/* Linear B Ideograms */ +/* Aegean Numbers */ +#define TT_UCR_LINEAR_B (1L << 5) /*U+10000-U+1007F*/ +/*U+10080-U+100FF*/ +/*U+10100-U+1013F*/ +/* Bit 102 Ancient Greek Numbers */ +#define TT_UCR_ANCIENT_GREEK_NUMBERS (1L << 6) /*U+10140-U+1018F*/ +/* Bit 103 Ugaritic */ +#define TT_UCR_UGARITIC (1L << 7) /*U+10380-U+1039F*/ +/* Bit 104 Old Persian */ +#define TT_UCR_OLD_PERSIAN (1L << 8) /*U+103A0-U+103DF*/ +/* Bit 105 Shavian */ +#define TT_UCR_SHAVIAN (1L << 9) /*U+10450-U+1047F*/ +/* Bit 106 Osmanya */ +#define TT_UCR_OSMANYA (1L << 10) /*U+10480-U+104AF*/ +/* Bit 107 Cypriot Syllabary */ +#define TT_UCR_CYPRIOT_SYLLABARY (1L << 11) /*U+10800-U+1083F*/ +/* Bit 108 Kharoshthi */ +#define TT_UCR_KHAROSHTHI (1L << 12) /*U+10A00-U+10A5F*/ +/* Bit 109 Tai Xuan Jing Symbols */ +#define TT_UCR_TAI_XUAN_JING (1L << 13) /*U+1D300-U+1D35F*/ +/* Bit 110 Cuneiform */ +/* Cuneiform Numbers and Punctuation */ +#define TT_UCR_CUNEIFORM (1L << 14) /*U+12000-U+123FF*/ +/*U+12400-U+1247F*/ +/* Bit 111 Counting Rod Numerals */ +#define TT_UCR_COUNTING_ROD_NUMERALS (1L << 15) /*U+1D360-U+1D37F*/ +/* Bit 112 Sundanese */ +#define TT_UCR_SUNDANESE (1L << 16) /* U+1B80-U+1BBF */ +/* Bit 113 Lepcha */ +#define TT_UCR_LEPCHA (1L << 17) /* U+1C00-U+1C4F */ +/* Bit 114 Ol Chiki */ +#define TT_UCR_OL_CHIKI (1L << 18) /* U+1C50-U+1C7F */ +/* Bit 115 Saurashtra */ +#define TT_UCR_SAURASHTRA (1L << 19) /* U+A880-U+A8DF */ +/* Bit 116 Kayah Li */ +#define TT_UCR_KAYAH_LI (1L << 20) /* U+A900-U+A92F */ +/* Bit 117 Rejang */ +#define TT_UCR_REJANG (1L << 21) /* U+A930-U+A95F */ +/* Bit 118 Cham */ +#define TT_UCR_CHAM (1L << 22) /* U+AA00-U+AA5F */ +/* Bit 119 Ancient Symbols */ +#define TT_UCR_ANCIENT_SYMBOLS (1L << 23) /*U+10190-U+101CF*/ +/* Bit 120 Phaistos Disc */ +#define TT_UCR_PHAISTOS_DISC (1L << 24) /*U+101D0-U+101FF*/ +/* Bit 121 Carian */ +/* Lycian */ +/* Lydian */ +#define TT_UCR_OLD_ANATOLIAN (1L << 25) /*U+102A0-U+102DF*/ +/*U+10280-U+1029F*/ +/*U+10920-U+1093F*/ +/* Bit 122 Domino Tiles */ +/* Mahjong Tiles */ +#define TT_UCR_GAME_TILES (1L << 26) /*U+1F030-U+1F09F*/ +/*U+1F000-U+1F02F*/ +/* Bit 123-127 Reserved for process-internal usage */ + + +/*************************************************************************/ +/* */ +/* Some compilers have a very limited length of identifiers. */ +/* */ +#if defined( __TURBOC__ ) && __TURBOC__ < 0x0410 || defined( __PACIFIC__ ) +#define HAVE_LIMIT_ON_IDENTS +#endif + + +#ifndef HAVE_LIMIT_ON_IDENTS + + +/*************************************************************************/ +/* */ +/* Here some alias #defines in order to be clearer. */ +/* */ +/* These are not always #defined to stay within the 31~character limit */ +/* which some compilers have. */ +/* */ +/* Credits go to Dave Hoo <dhoo@flash.net> for pointing out that modern */ +/* Borland compilers (read: from BC++ 3.1 on) can increase this limit. */ +/* If you get a warning with such a compiler, use the -i40 switch. */ +/* */ +#define TT_UCR_ARABIC_PRESENTATION_FORMS_A \ + TT_UCR_ARABIC_PRESENTATIONS_A +#define TT_UCR_ARABIC_PRESENTATION_FORMS_B \ + TT_UCR_ARABIC_PRESENTATIONS_B + +#define TT_UCR_COMBINING_DIACRITICAL_MARKS \ + TT_UCR_COMBINING_DIACRITICS +#define TT_UCR_COMBINING_DIACRITICAL_MARKS_SYMB \ + TT_UCR_COMBINING_DIACRITICS_SYMB + + +#endif /* !HAVE_LIMIT_ON_IDENTS */ + + + FT_END_HEADER + +#endif /* __TTNAMEID_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/tttables.h b/app/src/main/cpp/include/freetype2/freetype/tttables.h new file mode 100644 index 0000000..c32de95 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/tttables.h @@ -0,0 +1,767 @@ +/***************************************************************************/ +/* */ +/* tttables.h */ +/* */ +/* Basic SFNT/TrueType tables definitions and interface */ +/* (specification only). */ +/* */ +/* Copyright 1996-2005, 2008-2011 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __TTTABLES_H__ +#define __TTTABLES_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + +/*************************************************************************/ +/* */ +/* <Section> */ +/* truetype_tables */ +/* */ +/* <Title> */ +/* TrueType Tables */ +/* */ +/* <Abstract> */ +/* TrueType specific table types and functions. */ +/* */ +/* <Description> */ +/* This section contains the definition of TrueType-specific tables */ +/* as well as some routines used to access and process them. */ +/* */ +/*************************************************************************/ + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* TT_Header */ +/* */ +/* <Description> */ +/* A structure used to model a TrueType font header table. All */ +/* fields follow the TrueType specification. */ +/* */ +typedef struct TT_Header_ { + FT_Fixed Table_Version; + FT_Fixed Font_Revision; + + FT_Long CheckSum_Adjust; + FT_Long Magic_Number; + + FT_UShort Flags; + FT_UShort Units_Per_EM; + + FT_Long Created[2]; + FT_Long Modified[2]; + + FT_Short xMin; + FT_Short yMin; + FT_Short xMax; + FT_Short yMax; + + FT_UShort Mac_Style; + FT_UShort Lowest_Rec_PPEM; + + FT_Short Font_Direction; + FT_Short Index_To_Loc_Format; + FT_Short Glyph_Data_Format; + +} TT_Header; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* TT_HoriHeader */ +/* */ +/* <Description> */ +/* A structure used to model a TrueType horizontal header, the `hhea' */ +/* table, as well as the corresponding horizontal metrics table, */ +/* i.e., the `hmtx' table. */ +/* */ +/* <Fields> */ +/* Version :: The table version. */ +/* */ +/* Ascender :: The font's ascender, i.e., the distance */ +/* from the baseline to the top-most of all */ +/* glyph points found in the font. */ +/* */ +/* This value is invalid in many fonts, as */ +/* it is usually set by the font designer, */ +/* and often reflects only a portion of the */ +/* glyphs found in the font (maybe ASCII). */ +/* */ +/* You should use the `sTypoAscender' field */ +/* of the OS/2 table instead if you want */ +/* the correct one. */ +/* */ +/* Descender :: The font's descender, i.e., the distance */ +/* from the baseline to the bottom-most of */ +/* all glyph points found in the font. It */ +/* is negative. */ +/* */ +/* This value is invalid in many fonts, as */ +/* it is usually set by the font designer, */ +/* and often reflects only a portion of the */ +/* glyphs found in the font (maybe ASCII). */ +/* */ +/* You should use the `sTypoDescender' */ +/* field of the OS/2 table instead if you */ +/* want the correct one. */ +/* */ +/* Line_Gap :: The font's line gap, i.e., the distance */ +/* to add to the ascender and descender to */ +/* get the BTB, i.e., the */ +/* baseline-to-baseline distance for the */ +/* font. */ +/* */ +/* advance_Width_Max :: This field is the maximum of all advance */ +/* widths found in the font. It can be */ +/* used to compute the maximum width of an */ +/* arbitrary string of text. */ +/* */ +/* min_Left_Side_Bearing :: The minimum left side bearing of all */ +/* glyphs within the font. */ +/* */ +/* min_Right_Side_Bearing :: The minimum right side bearing of all */ +/* glyphs within the font. */ +/* */ +/* xMax_Extent :: The maximum horizontal extent (i.e., the */ +/* `width' of a glyph's bounding box) for */ +/* all glyphs in the font. */ +/* */ +/* caret_Slope_Rise :: The rise coefficient of the cursor's */ +/* slope of the cursor (slope=rise/run). */ +/* */ +/* caret_Slope_Run :: The run coefficient of the cursor's */ +/* slope. */ +/* */ +/* Reserved :: 8~reserved bytes. */ +/* */ +/* metric_Data_Format :: Always~0. */ +/* */ +/* number_Of_HMetrics :: Number of HMetrics entries in the `hmtx' */ +/* table -- this value can be smaller than */ +/* the total number of glyphs in the font. */ +/* */ +/* long_metrics :: A pointer into the `hmtx' table. */ +/* */ +/* short_metrics :: A pointer into the `hmtx' table. */ +/* */ +/* <Note> */ +/* IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should */ +/* be identical except for the names of their fields which */ +/* are different. */ +/* */ +/* This ensures that a single function in the `ttload' */ +/* module is able to read both the horizontal and vertical */ +/* headers. */ +/* */ +typedef struct TT_HoriHeader_ { + FT_Fixed Version; + FT_Short Ascender; + FT_Short Descender; + FT_Short Line_Gap; + + FT_UShort advance_Width_Max; /* advance width maximum */ + + FT_Short min_Left_Side_Bearing; /* minimum left-sb */ + FT_Short min_Right_Side_Bearing; /* minimum right-sb */ + FT_Short xMax_Extent; /* xmax extents */ + FT_Short caret_Slope_Rise; + FT_Short caret_Slope_Run; + FT_Short caret_Offset; + + FT_Short Reserved[4]; + + FT_Short metric_Data_Format; + FT_UShort number_Of_HMetrics; + + /* The following fields are not defined by the TrueType specification */ + /* but they are used to connect the metrics header to the relevant */ + /* `HMTX' table. */ + + void *long_metrics; + void *short_metrics; + +} TT_HoriHeader; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* TT_VertHeader */ +/* */ +/* <Description> */ +/* A structure used to model a TrueType vertical header, the `vhea' */ +/* table, as well as the corresponding vertical metrics table, i.e., */ +/* the `vmtx' table. */ +/* */ +/* <Fields> */ +/* Version :: The table version. */ +/* */ +/* Ascender :: The font's ascender, i.e., the distance */ +/* from the baseline to the top-most of */ +/* all glyph points found in the font. */ +/* */ +/* This value is invalid in many fonts, as */ +/* it is usually set by the font designer, */ +/* and often reflects only a portion of */ +/* the glyphs found in the font (maybe */ +/* ASCII). */ +/* */ +/* You should use the `sTypoAscender' */ +/* field of the OS/2 table instead if you */ +/* want the correct one. */ +/* */ +/* Descender :: The font's descender, i.e., the */ +/* distance from the baseline to the */ +/* bottom-most of all glyph points found */ +/* in the font. It is negative. */ +/* */ +/* This value is invalid in many fonts, as */ +/* it is usually set by the font designer, */ +/* and often reflects only a portion of */ +/* the glyphs found in the font (maybe */ +/* ASCII). */ +/* */ +/* You should use the `sTypoDescender' */ +/* field of the OS/2 table instead if you */ +/* want the correct one. */ +/* */ +/* Line_Gap :: The font's line gap, i.e., the distance */ +/* to add to the ascender and descender to */ +/* get the BTB, i.e., the */ +/* baseline-to-baseline distance for the */ +/* font. */ +/* */ +/* advance_Height_Max :: This field is the maximum of all */ +/* advance heights found in the font. It */ +/* can be used to compute the maximum */ +/* height of an arbitrary string of text. */ +/* */ +/* min_Top_Side_Bearing :: The minimum top side bearing of all */ +/* glyphs within the font. */ +/* */ +/* min_Bottom_Side_Bearing :: The minimum bottom side bearing of all */ +/* glyphs within the font. */ +/* */ +/* yMax_Extent :: The maximum vertical extent (i.e., the */ +/* `height' of a glyph's bounding box) for */ +/* all glyphs in the font. */ +/* */ +/* caret_Slope_Rise :: The rise coefficient of the cursor's */ +/* slope of the cursor (slope=rise/run). */ +/* */ +/* caret_Slope_Run :: The run coefficient of the cursor's */ +/* slope. */ +/* */ +/* caret_Offset :: The cursor's offset for slanted fonts. */ +/* This value is `reserved' in vmtx */ +/* version 1.0. */ +/* */ +/* Reserved :: 8~reserved bytes. */ +/* */ +/* metric_Data_Format :: Always~0. */ +/* */ +/* number_Of_HMetrics :: Number of VMetrics entries in the */ +/* `vmtx' table -- this value can be */ +/* smaller than the total number of glyphs */ +/* in the font. */ +/* */ +/* long_metrics :: A pointer into the `vmtx' table. */ +/* */ +/* short_metrics :: A pointer into the `vmtx' table. */ +/* */ +/* <Note> */ +/* IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should */ +/* be identical except for the names of their fields which */ +/* are different. */ +/* */ +/* This ensures that a single function in the `ttload' */ +/* module is able to read both the horizontal and vertical */ +/* headers. */ +/* */ +typedef struct TT_VertHeader_ { + FT_Fixed Version; + FT_Short Ascender; + FT_Short Descender; + FT_Short Line_Gap; + + FT_UShort advance_Height_Max; /* advance height maximum */ + + FT_Short min_Top_Side_Bearing; /* minimum left-sb or top-sb */ + FT_Short min_Bottom_Side_Bearing; /* minimum right-sb or bottom-sb */ + FT_Short yMax_Extent; /* xmax or ymax extents */ + FT_Short caret_Slope_Rise; + FT_Short caret_Slope_Run; + FT_Short caret_Offset; + + FT_Short Reserved[4]; + + FT_Short metric_Data_Format; + FT_UShort number_Of_VMetrics; + + /* The following fields are not defined by the TrueType specification */ + /* but they're used to connect the metrics header to the relevant */ + /* `HMTX' or `VMTX' table. */ + + void *long_metrics; + void *short_metrics; + +} TT_VertHeader; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* TT_OS2 */ +/* */ +/* <Description> */ +/* A structure used to model a TrueType OS/2 table. This is the long */ +/* table version. All fields comply to the TrueType specification. */ +/* */ +/* Note that we now support old Mac fonts which do not include an */ +/* OS/2 table. In this case, the `version' field is always set to */ +/* 0xFFFF. */ +/* */ +typedef struct TT_OS2_ { + FT_UShort version; /* 0x0001 - more or 0xFFFF */ + FT_Short xAvgCharWidth; + FT_UShort usWeightClass; + FT_UShort usWidthClass; + FT_Short fsType; + FT_Short ySubscriptXSize; + FT_Short ySubscriptYSize; + FT_Short ySubscriptXOffset; + FT_Short ySubscriptYOffset; + FT_Short ySuperscriptXSize; + FT_Short ySuperscriptYSize; + FT_Short ySuperscriptXOffset; + FT_Short ySuperscriptYOffset; + FT_Short yStrikeoutSize; + FT_Short yStrikeoutPosition; + FT_Short sFamilyClass; + + FT_Byte panose[10]; + + FT_ULong ulUnicodeRange1; /* Bits 0-31 */ + FT_ULong ulUnicodeRange2; /* Bits 32-63 */ + FT_ULong ulUnicodeRange3; /* Bits 64-95 */ + FT_ULong ulUnicodeRange4; /* Bits 96-127 */ + + FT_Char achVendID[4]; + + FT_UShort fsSelection; + FT_UShort usFirstCharIndex; + FT_UShort usLastCharIndex; + FT_Short sTypoAscender; + FT_Short sTypoDescender; + FT_Short sTypoLineGap; + FT_UShort usWinAscent; + FT_UShort usWinDescent; + + /* only version 1 tables: */ + + FT_ULong ulCodePageRange1; /* Bits 0-31 */ + FT_ULong ulCodePageRange2; /* Bits 32-63 */ + + /* only version 2 tables: */ + + FT_Short sxHeight; + FT_Short sCapHeight; + FT_UShort usDefaultChar; + FT_UShort usBreakChar; + FT_UShort usMaxContext; + +} TT_OS2; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* TT_Postscript */ +/* */ +/* <Description> */ +/* A structure used to model a TrueType PostScript table. All fields */ +/* comply to the TrueType specification. This structure does not */ +/* reference the PostScript glyph names, which can be nevertheless */ +/* accessed with the `ttpost' module. */ +/* */ +typedef struct TT_Postscript_ { + FT_Fixed FormatType; + FT_Fixed italicAngle; + FT_Short underlinePosition; + FT_Short underlineThickness; + FT_ULong isFixedPitch; + FT_ULong minMemType42; + FT_ULong maxMemType42; + FT_ULong minMemType1; + FT_ULong maxMemType1; + + /* Glyph names follow in the file, but we don't */ + /* load them by default. See the ttpost.c file. */ + +} TT_Postscript; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* TT_PCLT */ +/* */ +/* <Description> */ +/* A structure used to model a TrueType PCLT table. All fields */ +/* comply to the TrueType specification. */ +/* */ +typedef struct TT_PCLT_ { + FT_Fixed Version; + FT_ULong FontNumber; + FT_UShort Pitch; + FT_UShort xHeight; + FT_UShort Style; + FT_UShort TypeFamily; + FT_UShort CapHeight; + FT_UShort SymbolSet; + FT_Char TypeFace[16]; + FT_Char CharacterComplement[8]; + FT_Char FileName[6]; + FT_Char StrokeWeight; + FT_Char WidthType; + FT_Byte SerifStyle; + FT_Byte Reserved; + +} TT_PCLT; + + +/*************************************************************************/ +/* */ +/* <Struct> */ +/* TT_MaxProfile */ +/* */ +/* <Description> */ +/* The maximum profile is a table containing many max values which */ +/* can be used to pre-allocate arrays. This ensures that no memory */ +/* allocation occurs during a glyph load. */ +/* */ +/* <Fields> */ +/* version :: The version number. */ +/* */ +/* numGlyphs :: The number of glyphs in this TrueType */ +/* font. */ +/* */ +/* maxPoints :: The maximum number of points in a */ +/* non-composite TrueType glyph. See also */ +/* the structure element */ +/* `maxCompositePoints'. */ +/* */ +/* maxContours :: The maximum number of contours in a */ +/* non-composite TrueType glyph. See also */ +/* the structure element */ +/* `maxCompositeContours'. */ +/* */ +/* maxCompositePoints :: The maximum number of points in a */ +/* composite TrueType glyph. See also the */ +/* structure element `maxPoints'. */ +/* */ +/* maxCompositeContours :: The maximum number of contours in a */ +/* composite TrueType glyph. See also the */ +/* structure element `maxContours'. */ +/* */ +/* maxZones :: The maximum number of zones used for */ +/* glyph hinting. */ +/* */ +/* maxTwilightPoints :: The maximum number of points in the */ +/* twilight zone used for glyph hinting. */ +/* */ +/* maxStorage :: The maximum number of elements in the */ +/* storage area used for glyph hinting. */ +/* */ +/* maxFunctionDefs :: The maximum number of function */ +/* definitions in the TrueType bytecode for */ +/* this font. */ +/* */ +/* maxInstructionDefs :: The maximum number of instruction */ +/* definitions in the TrueType bytecode for */ +/* this font. */ +/* */ +/* maxStackElements :: The maximum number of stack elements used */ +/* during bytecode interpretation. */ +/* */ +/* maxSizeOfInstructions :: The maximum number of TrueType opcodes */ +/* used for glyph hinting. */ +/* */ +/* maxComponentElements :: The maximum number of simple (i.e., non- */ +/* composite) glyphs in a composite glyph. */ +/* */ +/* maxComponentDepth :: The maximum nesting depth of composite */ +/* glyphs. */ +/* */ +/* <Note> */ +/* This structure is only used during font loading. */ +/* */ +typedef struct TT_MaxProfile_ { + FT_Fixed version; + FT_UShort numGlyphs; + FT_UShort maxPoints; + FT_UShort maxContours; + FT_UShort maxCompositePoints; + FT_UShort maxCompositeContours; + FT_UShort maxZones; + FT_UShort maxTwilightPoints; + FT_UShort maxStorage; + FT_UShort maxFunctionDefs; + FT_UShort maxInstructionDefs; + FT_UShort maxStackElements; + FT_UShort maxSizeOfInstructions; + FT_UShort maxComponentElements; + FT_UShort maxComponentDepth; + +} TT_MaxProfile; + + +/*************************************************************************/ +/* */ +/* <Enum> */ +/* FT_Sfnt_Tag */ +/* */ +/* <Description> */ +/* An enumeration used to specify the index of an SFNT table. */ +/* Used in the @FT_Get_Sfnt_Table API function. */ +/* */ +typedef enum FT_Sfnt_Tag_ { + ft_sfnt_head = 0, /* TT_Header */ + ft_sfnt_maxp = 1, /* TT_MaxProfile */ + ft_sfnt_os2 = 2, /* TT_OS2 */ + ft_sfnt_hhea = 3, /* TT_HoriHeader */ + ft_sfnt_vhea = 4, /* TT_VertHeader */ + ft_sfnt_post = 5, /* TT_Postscript */ + ft_sfnt_pclt = 6, /* TT_PCLT */ + + sfnt_max /* internal end mark */ + +} FT_Sfnt_Tag; + +/* */ + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_Sfnt_Table */ +/* */ +/* <Description> */ +/* Return a pointer to a given SFNT table within a face. */ +/* */ +/* <Input> */ +/* face :: A handle to the source. */ +/* */ +/* tag :: The index of the SFNT table. */ +/* */ +/* <Return> */ +/* A type-less pointer to the table. This will be~0 in case of */ +/* error, or if the corresponding table was not found *OR* loaded */ +/* from the file. */ +/* */ +/* Use a typecast according to `tag' to access the structure */ +/* elements. */ +/* */ +/* <Note> */ +/* The table is owned by the face object and disappears with it. */ +/* */ +/* This function is only useful to access SFNT tables that are loaded */ +/* by the sfnt, truetype, and opentype drivers. See @FT_Sfnt_Tag for */ +/* a list. */ +/* */ +FT_EXPORT(void *) + +FT_Get_Sfnt_Table( FT_Face +face, +FT_Sfnt_Tag tag +); + + +/************************************************************************** + * + * @function: + * FT_Load_Sfnt_Table + * + * @description: + * Load any font table into client memory. + * + * @input: + * face :: + * A handle to the source face. + * + * tag :: + * The four-byte tag of the table to load. Use the value~0 if you want + * to access the whole font file. Otherwise, you can use one of the + * definitions found in the @FT_TRUETYPE_TAGS_H file, or forge a new + * one with @FT_MAKE_TAG. + * + * offset :: + * The starting offset in the table (or file if tag == 0). + * + * @output: + * buffer :: + * The target buffer address. The client must ensure that the memory + * array is big enough to hold the data. + * + * @inout: + * length :: + * If the `length' parameter is NULL, then try to load the whole table. + * Return an error code if it fails. + * + * Else, if `*length' is~0, exit immediately while returning the + * table's (or file) full size in it. + * + * Else the number of bytes to read from the table or file, from the + * starting offset. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * If you need to determine the table's length you should first call this + * function with `*length' set to~0, as in the following example: + * + * { + * FT_ULong length = 0; + * + * + * error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length ); + * if ( error ) { ... table does not exist ... } + * + * buffer = malloc( length ); + * if ( buffer == NULL ) { ... not enough memory ... } + * + * error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length ); + * if ( error ) { ... could not load table ... } + * } + */ +FT_EXPORT( FT_Error ) +FT_Load_Sfnt_Table( FT_Face +face, +FT_ULong tag, + FT_Long +offset, +FT_Byte *buffer, + FT_ULong +* length ); + + +/************************************************************************** + * + * @function: + * FT_Sfnt_Table_Info + * + * @description: + * Return information on an SFNT table. + * + * @input: + * face :: + * A handle to the source face. + * + * table_index :: + * The index of an SFNT table. The function returns + * FT_Err_Table_Missing for an invalid value. + * + * @inout: + * tag :: + * The name tag of the SFNT table. If the value is NULL, `table_index' + * is ignored, and `length' returns the number of SFNT tables in the + * font. + * + * @output: + * length :: + * The length of the SFNT table (or the number of SFNT tables, depending + * on `tag'). + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * While parsing fonts, FreeType handles SFNT tables with length zero as + * missing. + * + */ +FT_EXPORT( FT_Error ) +FT_Sfnt_Table_Info( FT_Face +face, +FT_UInt table_index, + FT_ULong +*tag, +FT_ULong *length +); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_CMap_Language_ID */ +/* */ +/* <Description> */ +/* Return TrueType/sfnt specific cmap language ID. Definitions of */ +/* language ID values are in `freetype/ttnameid.h'. */ +/* */ +/* <Input> */ +/* charmap :: */ +/* The target charmap. */ +/* */ +/* <Return> */ +/* The language ID of `charmap'. If `charmap' doesn't belong to a */ +/* TrueType/sfnt face, just return~0 as the default value. */ +/* */ +FT_EXPORT( FT_ULong ) +FT_Get_CMap_Language_ID( FT_CharMap +charmap ); + + +/*************************************************************************/ +/* */ +/* <Function> */ +/* FT_Get_CMap_Format */ +/* */ +/* <Description> */ +/* Return TrueType/sfnt specific cmap format. */ +/* */ +/* <Input> */ +/* charmap :: */ +/* The target charmap. */ +/* */ +/* <Return> */ +/* The format of `charmap'. If `charmap' doesn't belong to a */ +/* TrueType/sfnt face, return -1. */ +/* */ +FT_EXPORT( FT_Long ) +FT_Get_CMap_Format( FT_CharMap +charmap ); + +/* */ + + +FT_END_HEADER + +#endif /* __TTTABLES_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/tttags.h b/app/src/main/cpp/include/freetype2/freetype/tttags.h new file mode 100644 index 0000000..b699d1b --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/tttags.h @@ -0,0 +1,107 @@ +/***************************************************************************/ +/* */ +/* tttags.h */ +/* */ +/* Tags for TrueType and OpenType tables (specification only). */ +/* */ +/* Copyright 1996-2001, 2004, 2005, 2007, 2008 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __TTAGS_H__ +#define __TTAGS_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +#define TTAG_avar FT_MAKE_TAG( 'a', 'v', 'a', 'r' ) +#define TTAG_BASE FT_MAKE_TAG( 'B', 'A', 'S', 'E' ) +#define TTAG_bdat FT_MAKE_TAG( 'b', 'd', 'a', 't' ) +#define TTAG_BDF FT_MAKE_TAG( 'B', 'D', 'F', ' ' ) +#define TTAG_bhed FT_MAKE_TAG( 'b', 'h', 'e', 'd' ) +#define TTAG_bloc FT_MAKE_TAG( 'b', 'l', 'o', 'c' ) +#define TTAG_bsln FT_MAKE_TAG( 'b', 's', 'l', 'n' ) +#define TTAG_CFF FT_MAKE_TAG( 'C', 'F', 'F', ' ' ) +#define TTAG_CID FT_MAKE_TAG( 'C', 'I', 'D', ' ' ) +#define TTAG_cmap FT_MAKE_TAG( 'c', 'm', 'a', 'p' ) +#define TTAG_cvar FT_MAKE_TAG( 'c', 'v', 'a', 'r' ) +#define TTAG_cvt FT_MAKE_TAG( 'c', 'v', 't', ' ' ) +#define TTAG_DSIG FT_MAKE_TAG( 'D', 'S', 'I', 'G' ) +#define TTAG_EBDT FT_MAKE_TAG( 'E', 'B', 'D', 'T' ) +#define TTAG_EBLC FT_MAKE_TAG( 'E', 'B', 'L', 'C' ) +#define TTAG_EBSC FT_MAKE_TAG( 'E', 'B', 'S', 'C' ) +#define TTAG_feat FT_MAKE_TAG( 'f', 'e', 'a', 't' ) +#define TTAG_FOND FT_MAKE_TAG( 'F', 'O', 'N', 'D' ) +#define TTAG_fpgm FT_MAKE_TAG( 'f', 'p', 'g', 'm' ) +#define TTAG_fvar FT_MAKE_TAG( 'f', 'v', 'a', 'r' ) +#define TTAG_gasp FT_MAKE_TAG( 'g', 'a', 's', 'p' ) +#define TTAG_GDEF FT_MAKE_TAG( 'G', 'D', 'E', 'F' ) +#define TTAG_glyf FT_MAKE_TAG( 'g', 'l', 'y', 'f' ) +#define TTAG_GPOS FT_MAKE_TAG( 'G', 'P', 'O', 'S' ) +#define TTAG_GSUB FT_MAKE_TAG( 'G', 'S', 'U', 'B' ) +#define TTAG_gvar FT_MAKE_TAG( 'g', 'v', 'a', 'r' ) +#define TTAG_hdmx FT_MAKE_TAG( 'h', 'd', 'm', 'x' ) +#define TTAG_head FT_MAKE_TAG( 'h', 'e', 'a', 'd' ) +#define TTAG_hhea FT_MAKE_TAG( 'h', 'h', 'e', 'a' ) +#define TTAG_hmtx FT_MAKE_TAG( 'h', 'm', 't', 'x' ) +#define TTAG_JSTF FT_MAKE_TAG( 'J', 'S', 'T', 'F' ) +#define TTAG_just FT_MAKE_TAG( 'j', 'u', 's', 't' ) +#define TTAG_kern FT_MAKE_TAG( 'k', 'e', 'r', 'n' ) +#define TTAG_lcar FT_MAKE_TAG( 'l', 'c', 'a', 'r' ) +#define TTAG_loca FT_MAKE_TAG( 'l', 'o', 'c', 'a' ) +#define TTAG_LTSH FT_MAKE_TAG( 'L', 'T', 'S', 'H' ) +#define TTAG_LWFN FT_MAKE_TAG( 'L', 'W', 'F', 'N' ) +#define TTAG_MATH FT_MAKE_TAG( 'M', 'A', 'T', 'H' ) +#define TTAG_maxp FT_MAKE_TAG( 'm', 'a', 'x', 'p' ) +#define TTAG_META FT_MAKE_TAG( 'M', 'E', 'T', 'A' ) +#define TTAG_MMFX FT_MAKE_TAG( 'M', 'M', 'F', 'X' ) +#define TTAG_MMSD FT_MAKE_TAG( 'M', 'M', 'S', 'D' ) +#define TTAG_mort FT_MAKE_TAG( 'm', 'o', 'r', 't' ) +#define TTAG_morx FT_MAKE_TAG( 'm', 'o', 'r', 'x' ) +#define TTAG_name FT_MAKE_TAG( 'n', 'a', 'm', 'e' ) +#define TTAG_opbd FT_MAKE_TAG( 'o', 'p', 'b', 'd' ) +#define TTAG_OS2 FT_MAKE_TAG( 'O', 'S', '/', '2' ) +#define TTAG_OTTO FT_MAKE_TAG( 'O', 'T', 'T', 'O' ) +#define TTAG_PCLT FT_MAKE_TAG( 'P', 'C', 'L', 'T' ) +#define TTAG_POST FT_MAKE_TAG( 'P', 'O', 'S', 'T' ) +#define TTAG_post FT_MAKE_TAG( 'p', 'o', 's', 't' ) +#define TTAG_prep FT_MAKE_TAG( 'p', 'r', 'e', 'p' ) +#define TTAG_prop FT_MAKE_TAG( 'p', 'r', 'o', 'p' ) +#define TTAG_sfnt FT_MAKE_TAG( 's', 'f', 'n', 't' ) +#define TTAG_SING FT_MAKE_TAG( 'S', 'I', 'N', 'G' ) +#define TTAG_trak FT_MAKE_TAG( 't', 'r', 'a', 'k' ) +#define TTAG_true FT_MAKE_TAG( 't', 'r', 'u', 'e' ) +#define TTAG_ttc FT_MAKE_TAG( 't', 't', 'c', ' ' ) +#define TTAG_ttcf FT_MAKE_TAG( 't', 't', 'c', 'f' ) +#define TTAG_TYP1 FT_MAKE_TAG( 'T', 'Y', 'P', '1' ) +#define TTAG_typ1 FT_MAKE_TAG( 't', 'y', 'p', '1' ) +#define TTAG_VDMX FT_MAKE_TAG( 'V', 'D', 'M', 'X' ) +#define TTAG_vhea FT_MAKE_TAG( 'v', 'h', 'e', 'a' ) +#define TTAG_vmtx FT_MAKE_TAG( 'v', 'm', 't', 'x' ) + + + FT_END_HEADER + +#endif /* __TTAGS_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/freetype2/freetype/ttunpat.h b/app/src/main/cpp/include/freetype2/freetype/ttunpat.h new file mode 100644 index 0000000..2c9b023 --- /dev/null +++ b/app/src/main/cpp/include/freetype2/freetype/ttunpat.h @@ -0,0 +1,59 @@ +/***************************************************************************/ +/* */ +/* ttunpat.h */ +/* */ +/* Definitions for the unpatented TrueType hinting system */ +/* */ +/* Copyright 2003, 2006 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* Written by Graham Asher <graham.asher@btinternet.com> */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __TTUNPAT_H__ +#define __TTUNPAT_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + +/*************************************************************************** + * + * @constant: + * FT_PARAM_TAG_UNPATENTED_HINTING + * + * @description: + * A constant used as the tag of an @FT_Parameter structure to indicate + * that unpatented methods only should be used by the TrueType bytecode + * interpreter for a typeface opened by @FT_Open_Face. + * + */ +#define FT_PARAM_TAG_UNPATENTED_HINTING FT_MAKE_TAG( 'u', 'n', 'p', 'a' ) + +/* */ + + FT_END_HEADER + + +#endif /* __TTUNPAT_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/fribidi/fribidi-arabic.h b/app/src/main/cpp/include/fribidi/fribidi-arabic.h new file mode 100644 index 0000000..1425990 --- /dev/null +++ b/app/src/main/cpp/include/fribidi/fribidi-arabic.h @@ -0,0 +1,88 @@ +/* fribidi-arabic.h - do Arabic shaping to presentation forms + * + * Copyright (C) 2005 Behdad Esfahbod + * + * This file is part of GNU FriBidi. + * + * GNU FriBidi is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * GNU FriBidi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with GNU FriBidi; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For licensing issues, contact <license@farsiweb.info> or write to + * Sharif FarsiWeb, Inc., PO Box 13445-389, Tehran, Iran. + */ +/* $Id: fribidi-arabic.h,v 1.1 2005/11/03 01:39:01 behdad Exp $ + * $Author: behdad $ + * $Date: 2005/11/03 01:39:01 $ + * $Revision: 1.1 $ + * $Source: /cvs/fribidi/fribidi2/lib/fribidi-arabic.h,v $ + * + * Author(s): + * Behdad Esfahbod, 2005 + */ +#ifndef _FRIBIDI_ARABIC_H +#define _FRIBIDI_ARABIC_H + +#include "fribidi-common.h" + +#include "fribidi-types.h" +#include "fribidi-flags.h" +#include "fribidi-bidi-types.h" +#include "fribidi-joining.h" + +#include "fribidi-begindecls.h" + + +#define fribidi_shape_arabic FRIBIDI_NAMESPACE(shape_arabic) +/* fribidi_shape_arabic - do Arabic shaping + * + * The actual shaping that is done depends on the flags set. Only flags + * starting with FRIBIDI_FLAG_SHAPE_ARAB_ affect this function. + * Currently these are: + * + * * FRIBIDI_FLAG_SHAPE_MIRRORING: Do mirroring. + * * FRIBIDI_FLAG_SHAPE_ARAB_PRES: Shape Arabic characters to their + * presentation form glyphs. + * * FRIBIDI_FLAG_SHAPE_ARAB_LIGA: Form mandatory Arabic ligatures. + * * FRIBIDI_FLAG_SHAPE_ARAB_CONSOLE: Perform additional Arabic shaping + * suitable for text rendered on + * grid terminals with no mark + * rendering capabilities. + * + * Of the above, FRIBIDI_FLAG_SHAPE_ARAB_CONSOLE is only used in special + * cases, but the rest are recommended in any enviroment that doesn't have + * other means for doing Arabic shaping. The set of extra flags that enable + * this level of Arabic support has a shortcut named FRIBIDI_FLAGS_ARABIC. + */ +FRIBIDI_ENTRY void +fribidi_shape_arabic( + FriBidiFlags flags, /* shaping flags */ + const FriBidiLevel *embedding_levels, + const FriBidiStrIndex len, /* input string length */ + FriBidiArabicProp *ar_props, /* input/output Arabic properties as + * computed by fribidi_join_arabic */ + FriBidiChar *str /* string to shape */ +); + +#include "fribidi-enddecls.h" + +#endif /* !_FRIBIDI_ARABIC_H */ +/* Editor directions: + * Local Variables: + * mode: c + * c-basic-offset: 2 + * indent-tabs-mode: t + * tab-width: 8 + * End: + * vim: textwidth=78: autoindent: cindent: shiftwidth=2: tabstop=8: + */ diff --git a/app/src/main/cpp/include/fribidi/fribidi-begindecls.h b/app/src/main/cpp/include/fribidi/fribidi-begindecls.h new file mode 100644 index 0000000..0f4acdd --- /dev/null +++ b/app/src/main/cpp/include/fribidi/fribidi-begindecls.h @@ -0,0 +1,3 @@ +#ifdef FRIBIDI_BEGIN_DECLS +FRIBIDI_BEGIN_DECLS +#endif /* FRIBIDI_BEGIN_DECLS */ diff --git a/app/src/main/cpp/include/fribidi/fribidi-bidi-types-list.h b/app/src/main/cpp/include/fribidi/fribidi-bidi-types-list.h new file mode 100644 index 0000000..9f27ee7 --- /dev/null +++ b/app/src/main/cpp/include/fribidi/fribidi-bidi-types-list.h @@ -0,0 +1,98 @@ +#ifndef __FRIBIDI_DOC +/* FriBidi + * fribidi-bidi-types-list.h - list of bidi types + * + * $Id: fribidi-bidi-types-list.h,v 1.5 2004/06/13 20:11:42 behdad Exp $ + * $Author: behdad $ + * $Date: 2004/06/13 20:11:42 $ + * $Revision: 1.5 $ + * $Source: /cvs/fribidi/fribidi2/lib/fribidi-bidi-types-list.h,v $ + * + * Author: + * Behdad Esfahbod, 2001, 2002, 2004 + * + * Copyright (C) 2004 Sharif FarsiWeb, Inc. + * Copyright (C) 2001,2002 Behdad Esfahbod + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library, in a file named COPYING; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA + * + * For licensing issues, contact <license@farsiweb.info>. + */ +/* *INDENT-OFF* */ +#endif /* !__FRIBIDI_DOC */ +#ifndef _FRIBIDI_ADD_TYPE +# define _FRIBIDI_ADD_TYPE(x, y) +#endif +#ifndef _FRIBIDI_ADD_ALIAS +# define _FRIBIDI_ADD_ALIAS(x1, x2) +#endif + +#if !defined(_FRIBIDI_PAR_TYPES) || defined(_FRIBIDI_ALL_TYPES) + +_FRIBIDI_ADD_TYPE (LTR, 'L') /* Left-To-Right letter */ +_FRIBIDI_ADD_TYPE (RTL, 'R') /* Right-To-Left letter */ +_FRIBIDI_ADD_TYPE (AL, 'A') /* Arabic Letter */ +_FRIBIDI_ADD_TYPE (EN, '1') /* European Numeral */ +_FRIBIDI_ADD_TYPE (AN, '9') /* Arabic Numeral */ +_FRIBIDI_ADD_TYPE (ES, 'w') /* European number Separator */ +_FRIBIDI_ADD_TYPE (ET, 'w') /* European number Terminator */ +_FRIBIDI_ADD_TYPE (CS, 'w') /* Common Separator */ +_FRIBIDI_ADD_TYPE (NSM, '`') /* Non Spacing Mark */ +_FRIBIDI_ADD_TYPE (BN, 'b') /* Boundary Neutral */ +_FRIBIDI_ADD_TYPE (BS, 'B') /* Block Separator */ +_FRIBIDI_ADD_TYPE (SS, 'S') /* Segment Separator */ +_FRIBIDI_ADD_TYPE (WS, '_') /* WhiteSpace */ +_FRIBIDI_ADD_TYPE (ON, 'n') /* Other Neutral */ +_FRIBIDI_ADD_TYPE (LRE, '+') /* Left-to-Right Embedding */ +_FRIBIDI_ADD_TYPE (RLE, '+') /* Right-to-Left Embedding */ +_FRIBIDI_ADD_TYPE (LRO, '+') /* Left-to-Right Override */ +_FRIBIDI_ADD_TYPE (RLO, '+') /* Right-to-Left Override */ +_FRIBIDI_ADD_TYPE (PDF, '-') /* Pop Directional Flag */ + +#if defined(_FRIBIDI_ADD_ALIAS) +_FRIBIDI_ADD_ALIAS (L, LTR) +_FRIBIDI_ADD_ALIAS (R, RTL) +_FRIBIDI_ADD_ALIAS (B, BS) +_FRIBIDI_ADD_ALIAS (S, SS) +#endif /* _FRIBIDI_ADD_ALIAS */ + +#if defined(_FRIBIDI_SENTINEL_TYPE) || defined(_FRIBIDI_ALL_TYPES) +_FRIBIDI_ADD_TYPE (SENTINEL, '$') /* SENTINEL */ +#endif /* _FRIBIDI_SENTINEL_TYPES || _FRIBIDI_ALL_TYPES*/ +#endif /* !_FRIBIDI_PAR_TYPES || _FRIBIDI_ALL_TYPES */ + +#if defined(_FRIBIDI_PAR_TYPES) || defined(_FRIBIDI_ALL_TYPES) +# if !defined(_FRIBIDI_ALL_TYPES) +_FRIBIDI_ADD_TYPE (LTR, 'L') /* Left-To-Right paragraph */ +_FRIBIDI_ADD_TYPE (RTL, 'R') /* Right-To-Left paragraph */ +_FRIBIDI_ADD_TYPE (ON, 'n') /* directiOn-Neutral paragraph */ +# endif /* !_FRIBIDI_ALL_TYPES */ +_FRIBIDI_ADD_TYPE (WLTR, 'l') /* Weak Left To Right paragraph */ +_FRIBIDI_ADD_TYPE (WRTL, 'r') /* Weak Right To Left paragraph */ +#endif /* _FRIBIDI_PAR_TYPES || _FRIBIDI_ALL_TYPES*/ + +#if defined(_FRIBIDI_ENUM_TYPES) +typedef enum { +# define _FRIBIDI_ADD_TYPE _FRIBIDI_ENUM_ADD_TYPE +# include "fribidi-bidi-types-list.h" +# undef _FRIBIDI_ADD_TYPE + _FRIBIDI_TYPES_MAX +} _FRIBIDI_ENUM_TYPES +#endif /* _FRIBIDI_ENUM_TYPES */ + +#ifndef __FRIBIDI_DOC +/* *INDENT-ON* */ +#endif /* !__FRIBIDI_DOC */ diff --git a/app/src/main/cpp/include/fribidi/fribidi-bidi-types.h b/app/src/main/cpp/include/fribidi/fribidi-bidi-types.h new file mode 100644 index 0000000..ef86ec4 --- /dev/null +++ b/app/src/main/cpp/include/fribidi/fribidi-bidi-types.h @@ -0,0 +1,391 @@ +/* FriBidi + * fribidi-bidi-types.h - character bidi types + * + * $Id: fribidi-bidi-types.h,v 1.15 2008-11-24 17:48:31 behdad Exp $ + * $Author: behdad $ + * $Date: 2008-11-24 17:48:31 $ + * $Revision: 1.15 $ + * $Source: /cvs/fribidi/fribidi2/lib/fribidi-bidi-types.h,v $ + * + * Author: + * Behdad Esfahbod, 2001, 2002, 2004 + * + * Copyright (C) 2004 Sharif FarsiWeb, Inc. + * Copyright (C) 2001,2002 Behdad Esfahbod + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library, in a file named COPYING; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA + * + * For licensing issues, contact <license@farsiweb.info>. + */ +#ifndef _FRIBIDI_BIDI_TYPES_H +#define _FRIBIDI_BIDI_TYPES_H + +#include "fribidi-common.h" + +#include "fribidi-types.h" + +#include "fribidi-begindecls.h" + +typedef signed char FriBidiLevel; + +/* + * Define bit masks that bidi types are based on, each mask has + * only one bit set. + */ + +/* RTL mask better be the least significant bit. */ +#define FRIBIDI_MASK_RTL 0x00000001L /* Is right to left */ +#define FRIBIDI_MASK_ARABIC 0x00000002L /* Is arabic */ + +/* Each char can be only one of the three following. */ +#define FRIBIDI_MASK_STRONG 0x00000010L /* Is strong */ +#define FRIBIDI_MASK_WEAK 0x00000020L /* Is weak */ +#define FRIBIDI_MASK_NEUTRAL 0x00000040L /* Is neutral */ +#define FRIBIDI_MASK_SENTINEL 0x00000080L /* Is sentinel */ +/* Sentinels are not valid chars, just identify the start/end of strings. */ + +/* Each char can be only one of the five following. */ +#define FRIBIDI_MASK_LETTER 0x00000100L /* Is letter: L, R, AL */ +#define FRIBIDI_MASK_NUMBER 0x00000200L /* Is number: EN, AN */ +#define FRIBIDI_MASK_NUMSEPTER 0x00000400L /* Is separator or terminator: ES, ET, CS */ +#define FRIBIDI_MASK_SPACE 0x00000800L /* Is space: BN, BS, SS, WS */ +#define FRIBIDI_MASK_EXPLICIT 0x00001000L /* Is expilict mark: LRE, RLE, LRO, RLO, PDF */ + +/* Can be set only if FRIBIDI_MASK_SPACE is also set. */ +#define FRIBIDI_MASK_SEPARATOR 0x00002000L /* Is text separator: BS, SS */ +/* Can be set only if FRIBIDI_MASK_EXPLICIT is also set. */ +#define FRIBIDI_MASK_OVERRIDE 0x00004000L /* Is explicit override: LRO, RLO */ + +/* The following exist to make types pairwise different, some of them can + * be removed but are here because of efficiency (make queries faster). */ + +#define FRIBIDI_MASK_ES 0x00010000L +#define FRIBIDI_MASK_ET 0x00020000L +#define FRIBIDI_MASK_CS 0x00040000L + +#define FRIBIDI_MASK_NSM 0x00080000L +#define FRIBIDI_MASK_BN 0x00100000L + +#define FRIBIDI_MASK_BS 0x00200000L +#define FRIBIDI_MASK_SS 0x00400000L +#define FRIBIDI_MASK_WS 0x00800000L + +/* We reserve a single bit for user's private use: we will never use it. */ +#define FRIBIDI_MASK_PRIVATE 0x01000000L + + +/* + * Define values for FriBidiCharType + */ + +/* Strong types */ + +/* Left-To-Right letter */ +#define FRIBIDI_TYPE_LTR_VAL ( FRIBIDI_MASK_STRONG | FRIBIDI_MASK_LETTER ) +/* Right-To-Left letter */ +#define FRIBIDI_TYPE_RTL_VAL ( FRIBIDI_MASK_STRONG | FRIBIDI_MASK_LETTER \ + | FRIBIDI_MASK_RTL) +/* Arabic Letter */ +#define FRIBIDI_TYPE_AL_VAL ( FRIBIDI_MASK_STRONG | FRIBIDI_MASK_LETTER \ + | FRIBIDI_MASK_RTL | FRIBIDI_MASK_ARABIC ) +/* Left-to-Right Embedding */ +#define FRIBIDI_TYPE_LRE_VAL ( FRIBIDI_MASK_STRONG | FRIBIDI_MASK_EXPLICIT) +/* Right-to-Left Embedding */ +#define FRIBIDI_TYPE_RLE_VAL ( FRIBIDI_MASK_STRONG | FRIBIDI_MASK_EXPLICIT \ + | FRIBIDI_MASK_RTL ) +/* Left-to-Right Override */ +#define FRIBIDI_TYPE_LRO_VAL ( FRIBIDI_MASK_STRONG | FRIBIDI_MASK_EXPLICIT \ + | FRIBIDI_MASK_OVERRIDE ) +/* Right-to-Left Override */ +#define FRIBIDI_TYPE_RLO_VAL ( FRIBIDI_MASK_STRONG | FRIBIDI_MASK_EXPLICIT \ + | FRIBIDI_MASK_RTL | FRIBIDI_MASK_OVERRIDE ) + +/* Weak types */ + +/* Pop Directional Flag*/ +#define FRIBIDI_TYPE_PDF_VAL ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_EXPLICIT ) +/* European Numeral */ +#define FRIBIDI_TYPE_EN_VAL ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_NUMBER ) +/* Arabic Numeral */ +#define FRIBIDI_TYPE_AN_VAL ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_NUMBER \ + | FRIBIDI_MASK_ARABIC ) +/* European number Separator */ +#define FRIBIDI_TYPE_ES_VAL ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_NUMSEPTER \ + | FRIBIDI_MASK_ES ) +/* European number Terminator */ +#define FRIBIDI_TYPE_ET_VAL ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_NUMSEPTER \ + | FRIBIDI_MASK_ET ) +/* Common Separator */ +#define FRIBIDI_TYPE_CS_VAL ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_NUMSEPTER \ + | FRIBIDI_MASK_CS ) +/* Non Spacing Mark */ +#define FRIBIDI_TYPE_NSM_VAL ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_NSM ) +/* Boundary Neutral */ +#define FRIBIDI_TYPE_BN_VAL ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_SPACE \ + | FRIBIDI_MASK_BN ) + +/* Neutral types */ + +/* Block Separator */ +#define FRIBIDI_TYPE_BS_VAL ( FRIBIDI_MASK_NEUTRAL | FRIBIDI_MASK_SPACE \ + | FRIBIDI_MASK_SEPARATOR | FRIBIDI_MASK_BS ) +/* Segment Separator */ +#define FRIBIDI_TYPE_SS_VAL ( FRIBIDI_MASK_NEUTRAL | FRIBIDI_MASK_SPACE \ + | FRIBIDI_MASK_SEPARATOR | FRIBIDI_MASK_SS ) +/* WhiteSpace */ +#define FRIBIDI_TYPE_WS_VAL ( FRIBIDI_MASK_NEUTRAL | FRIBIDI_MASK_SPACE \ + | FRIBIDI_MASK_WS ) +/* Other Neutral */ +#define FRIBIDI_TYPE_ON_VAL ( FRIBIDI_MASK_NEUTRAL ) + + +/* The following are used in specifying paragraph direction only. */ + +/* Weak Left-To-Right */ +#define FRIBIDI_TYPE_WLTR_VAL ( FRIBIDI_MASK_WEAK ) +/* Weak Right-To-Left */ +#define FRIBIDI_TYPE_WRTL_VAL ( FRIBIDI_MASK_WEAK | FRIBIDI_MASK_RTL ) + +/* start or end of text (run list) SENTINEL. Only used internally */ +#define FRIBIDI_TYPE_SENTINEL ( FRIBIDI_MASK_SENTINEL ) + +/* Private types for applications. More private types can be obtained by + * summing up from this one. */ +#define FRIBIDI_TYPE_PRIVATE ( FRIBIDI_MASK_PRIVATE ) + + +/* Define Enums only if sizeof(int) == 4 (UTF-32), and not compiling C++. + * The problem with C++ is that then casts between int32 and enum will fail! + */ +#if defined(__FRIBIDI_DOC) || (FRIBIDI_SIZEOF_INT + 0 == 4 && !defined(__cplusplus)) + +typedef enum { +# define _FRIBIDI_ADD_TYPE(TYPE, SYMBOL) \ + FRIBIDI_TYPE_##TYPE = FRIBIDI_TYPE_##TYPE##_VAL, + +# include "fribidi-bidi-types-list.h" + +# undef _FRIBIDI_ADD_TYPE + _FRIBIDI_TYPE_SENTINEL = FRIBIDI_TYPE_SENTINEL /* Don't use this */ +} FriBidiCharType; + +typedef enum { +# define _FRIBIDI_PAR_TYPES +# define _FRIBIDI_ADD_TYPE(TYPE, SYMBOL) \ + FRIBIDI_PAR_##TYPE = FRIBIDI_TYPE_##TYPE##_VAL, + +# include "fribidi-bidi-types-list.h" + +# undef _FRIBIDI_ADD_TYPE +# undef _FRIBIDI_PAR_TYPES + _FRIBIDI_PAR_SENTINEL = FRIBIDI_TYPE_SENTINEL /* Don't use this */ +} FriBidiParType; + +#else + +typedef fribidi_uint32 FriBidiCharType; +# define FRIBIDI_TYPE_LTR FRIBIDI_TYPE_LTR_VAL +# define FRIBIDI_TYPE_RTL FRIBIDI_TYPE_RTL_VAL +# define FRIBIDI_TYPE_AL FRIBIDI_TYPE_AL_VAL +# define FRIBIDI_TYPE_EN FRIBIDI_TYPE_EN_VAL +# define FRIBIDI_TYPE_AN FRIBIDI_TYPE_AN_VAL +# define FRIBIDI_TYPE_ES FRIBIDI_TYPE_ES_VAL +# define FRIBIDI_TYPE_ET FRIBIDI_TYPE_ET_VAL +# define FRIBIDI_TYPE_CS FRIBIDI_TYPE_CS_VAL +# define FRIBIDI_TYPE_NSM FRIBIDI_TYPE_NSM_VAL +# define FRIBIDI_TYPE_BN FRIBIDI_TYPE_BN_VAL +# define FRIBIDI_TYPE_BS FRIBIDI_TYPE_BS_VAL +# define FRIBIDI_TYPE_SS FRIBIDI_TYPE_SS_VAL +# define FRIBIDI_TYPE_WS FRIBIDI_TYPE_WS_VAL +# define FRIBIDI_TYPE_ON FRIBIDI_TYPE_ON_VAL +# define FRIBIDI_TYPE_LRE FRIBIDI_TYPE_LRE_VAL +# define FRIBIDI_TYPE_RLE FRIBIDI_TYPE_RLE_VAL +# define FRIBIDI_TYPE_LRO FRIBIDI_TYPE_LRO_VAL +# define FRIBIDI_TYPE_RLO FRIBIDI_TYPE_RLO_VAL +# define FRIBIDI_TYPE_PDF FRIBIDI_TYPE_PDF_VAL + +typedef fribidi_uint32 FriBidiParType; +# define FRIBIDI_PAR_LTR FRIBIDI_TYPE_LTR_VAL +# define FRIBIDI_PAR_RTL FRIBIDI_TYPE_RTL_VAL +# define FRIBIDI_PAR_ON FRIBIDI_TYPE_ON_VAL +# define FRIBIDI_PAR_WLTR FRIBIDI_TYPE_WLTR_VAL +# define FRIBIDI_PAR_WRTL FRIBIDI_TYPE_WRTL_VAL + +#endif + +/* Please don't use these two type names, use FRIBIDI_PAR_* form instead. */ +#define FRIBIDI_TYPE_WLTR FRIBIDI_PAR_WLTR +#define FRIBIDI_TYPE_WRTL FRIBIDI_PAR_WRTL + + +/* + * Defining macros for needed queries, It is fully dependent on the + * implementation of FriBidiCharType. + */ + + +/* Is right-to-left level? */ +#define FRIBIDI_LEVEL_IS_RTL(lev) ((lev) & 1) + +/* Return the bidi type corresponding to the direction of the level number, + FRIBIDI_TYPE_LTR for evens and FRIBIDI_TYPE_RTL for odds. */ +#define FRIBIDI_LEVEL_TO_DIR(lev) \ + (FRIBIDI_LEVEL_IS_RTL (lev) ? FRIBIDI_TYPE_RTL : FRIBIDI_TYPE_LTR) + +/* Return the minimum level of the direction, 0 for FRIBIDI_TYPE_LTR and + 1 for FRIBIDI_TYPE_RTL and FRIBIDI_TYPE_AL. */ +#define FRIBIDI_DIR_TO_LEVEL(dir) \ + ((FriBidiLevel) (FRIBIDI_IS_RTL (dir) ? 1 : 0)) + +/* Is right to left: RTL, AL, RLE, RLO? */ +#define FRIBIDI_IS_RTL(p) ((p) & FRIBIDI_MASK_RTL) +/* Is arabic: AL, AN? */ +#define FRIBIDI_IS_ARABIC(p) ((p) & FRIBIDI_MASK_ARABIC) + +/* Is strong? */ +#define FRIBIDI_IS_STRONG(p) ((p) & FRIBIDI_MASK_STRONG) +/* Is weak? */ +#define FRIBIDI_IS_WEAK(p) ((p) & FRIBIDI_MASK_WEAK) +/* Is neutral? */ +#define FRIBIDI_IS_NEUTRAL(p) ((p) & FRIBIDI_MASK_NEUTRAL) +/* Is sentinel? */ +#define FRIBIDI_IS_SENTINEL(p) ((p) & FRIBIDI_MASK_SENTINEL) + +/* Is letter: L, R, AL? */ +#define FRIBIDI_IS_LETTER(p) ((p) & FRIBIDI_MASK_LETTER) +/* Is number: EN, AN? */ +#define FRIBIDI_IS_NUMBER(p) ((p) & FRIBIDI_MASK_NUMBER) +/* Is number separator or terminator: ES, ET, CS? */ +#define FRIBIDI_IS_NUMBER_SEPARATOR_OR_TERMINATOR(p) \ + ((p) & FRIBIDI_MASK_NUMSEPTER) +/* Is space: BN, BS, SS, WS? */ +#define FRIBIDI_IS_SPACE(p) ((p) & FRIBIDI_MASK_SPACE) +/* Is explicit mark: LRE, RLE, LRO, RLO, PDF? */ +#define FRIBIDI_IS_EXPLICIT(p) ((p) & FRIBIDI_MASK_EXPLICIT) + +/* Is text separator: BS, SS? */ +#define FRIBIDI_IS_SEPARATOR(p) ((p) & FRIBIDI_MASK_SEPARATOR) + +/* Is explicit override: LRO, RLO? */ +#define FRIBIDI_IS_OVERRIDE(p) ((p) & FRIBIDI_MASK_OVERRIDE) + +/* Some more: */ + +/* Is left to right letter: LTR? */ +#define FRIBIDI_IS_LTR_LETTER(p) \ + ((p) & (FRIBIDI_MASK_LETTER | FRIBIDI_MASK_RTL) == FRIBIDI_MASK_LETTER) + +/* Is right to left letter: RTL, AL? */ +#define FRIBIDI_IS_RTL_LETTER(p) \ + ((p) & (FRIBIDI_MASK_LETTER | FRIBIDI_MASK_RTL) \ + == (FRIBIDI_MASK_LETTER | FRIBIDI_MASK_RTL)) + +/* Is ES or CS: ES, CS? */ +#define FRIBIDI_IS_ES_OR_CS(p) \ + ((p) & (FRIBIDI_MASK_ES | FRIBIDI_MASK_CS)) + +/* Is explicit or BN: LRE, RLE, LRO, RLO, PDF, BN? */ +#define FRIBIDI_IS_EXPLICIT_OR_BN(p) \ + ((p) & (FRIBIDI_MASK_EXPLICIT | FRIBIDI_MASK_BN)) + +/* Is explicit or BN or NSM: LRE, RLE, LRO, RLO, PDF, BN, NSM? */ +#define FRIBIDI_IS_EXPLICIT_OR_BN_OR_NSM(p) \ + ((p) & (FRIBIDI_MASK_EXPLICIT | FRIBIDI_MASK_BN | FRIBIDI_MASK_NSM)) + +/* Is explicit or BN or WS: LRE, RLE, LRO, RLO, PDF, BN, WS? */ +#define FRIBIDI_IS_EXPLICIT_OR_BN_OR_WS(p) \ + ((p) & (FRIBIDI_MASK_EXPLICIT | FRIBIDI_MASK_BN | FRIBIDI_MASK_WS)) + +/* Is explicit or separator or BN or WS: LRE, RLE, LRO, RLO, PDF, BS, SS, BN, WS? */ +#define FRIBIDI_IS_EXPLICIT_OR_SEPARATOR_OR_BN_OR_WS(p) \ + ((p) & (FRIBIDI_MASK_EXPLICIT | FRIBIDI_MASK_SEPARATOR \ + | FRIBIDI_MASK_BN | FRIBIDI_MASK_WS)) + +/* Is private-use type for application? */ +#define FRIBIDI_IS_PRIVATE(p) ((p) & FRIBIDI_MASK_PRIVATE) + +/* Define some conversions. */ + +/* Change numbers to RTL: EN,AN -> RTL. */ +#define FRIBIDI_CHANGE_NUMBER_TO_RTL(p) \ + (FRIBIDI_IS_NUMBER(p) ? FRIBIDI_TYPE_RTL : (p)) + +/* Override status of an explicit mark: + * LRO,LRE->LTR, RLO,RLE->RTL, otherwise->ON. */ +#define FRIBIDI_EXPLICIT_TO_OVERRIDE_DIR(p) \ + (FRIBIDI_IS_OVERRIDE(p) ? FRIBIDI_LEVEL_TO_DIR(FRIBIDI_DIR_TO_LEVEL(p)) \ + : FRIBIDI_TYPE_ON) + +/* Weaken type for paragraph fallback purposes: + * LTR->WLTR, RTL->WRTL. */ +#define FRIBIDI_WEAK_PARAGRAPH(p) (FRIBIDI_PAR_WLTR | ((p) & FRIBIDI_MASK_RTL)) + + +/* Functions finally */ + + +#define fribidi_get_bidi_type FRIBIDI_NAMESPACE(get_bidi_type) +/* fribidi_get_bidi_type - get character bidi type + * + * This function returns the bidi type of a character as defined in Table 3.7 + * Bidirectional Character Types of the Unicode Bidirectional Algorithm + * available at + * http://www.unicode.org/reports/tr9/#Bidirectional_Character_Types, using + * data provided in file UnicodeData.txt of the Unicode Character Database + * available at http://www.unicode.org/Public/UNIDATA/UnicodeData.txt. + * + * There are a few macros defined in fribidi-bidi-types.h for querying a bidi + * type. + */ +FRIBIDI_ENTRY FriBidiCharType +fribidi_get_bidi_type( + FriBidiChar ch /* input character */ +) FRIBIDI_GNUC_CONST; + +#define fribidi_get_bidi_types FRIBIDI_NAMESPACE(get_bidi_types) +/* fribidi_get_bidi_types - get bidi types for an string of characters + * + * This function finds the bidi types of an string of characters. See + * fribidi_get_bidi_type() for more information about the bidi types returned + * by this function. + */ +FRIBIDI_ENTRY void fribidi_get_bidi_types( + const FriBidiChar *str, /* input string */ + const FriBidiStrIndex len, /* input string length */ + FriBidiCharType *btypes /* output bidi types */ +); + +#define fribidi_get_bidi_type_name FRIBIDI_NAMESPACE(get_bidi_type_name) +/* fribidi_get_bidi_type_name - get bidi type name + * + * This function returns the bidi type name of a character type. The + * returned string is a static string and should not be freed. + * + * The type names are the same as ones defined in Table 3.7 Bidirectional + * Character Types of the Unicode Bidirectional Algorithm available at + * http://www.unicode.org/reports/tr9/#Bidirectional_Character_Types, with a + * few modifications: L->LTR, R->RTL, B->BS, S->SS. + */ +FRIBIDI_ENTRY const char *fribidi_get_bidi_type_name( + FriBidiCharType t /* input bidi type */ +) FRIBIDI_GNUC_CONST; + +#include "fribidi-enddecls.h" + +#endif /* !_FRIBIDI_BIDI_TYPES_H */ +/* Editor directions: + * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent + */ diff --git a/app/src/main/cpp/include/fribidi/fribidi-bidi.h b/app/src/main/cpp/include/fribidi/fribidi-bidi.h new file mode 100644 index 0000000..46d909f --- /dev/null +++ b/app/src/main/cpp/include/fribidi/fribidi-bidi.h @@ -0,0 +1,149 @@ +/* FriBidi + * fribidi-bidi.h - bidirectional algorithm + * + * $Id: fribidi-bidi.h,v 1.15 2005/11/03 01:39:01 behdad Exp $ + * $Author: behdad $ + * $Date: 2005/11/03 01:39:01 $ + * $Revision: 1.15 $ + * $Source: /cvs/fribidi/fribidi2/lib/fribidi-bidi.h,v $ + * + * Authors: + * Behdad Esfahbod, 2001, 2002, 2004 + * Dov Grobgeld, 1999, 2000 + * + * Copyright (C) 2004 Sharif FarsiWeb, Inc + * Copyright (C) 2001,2002 Behdad Esfahbod + * Copyright (C) 1999,2000 Dov Grobgeld + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library, in a file named COPYING; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA + * + * For licensing issues, contact <license@farsiweb.info>. + */ +#ifndef _FRIBIDI_BIDI_H +#define _FRIBIDI_BIDI_H + +#include "fribidi-common.h" + +#include "fribidi-types.h" +#include "fribidi-flags.h" +#include "fribidi-bidi-types.h" + +#include "fribidi-begindecls.h" + +#define fribidi_get_par_embedding_levels FRIBIDI_NAMESPACE(get_par_embedding_levels) +/* fribidi_get_par_direction - get base paragraph direction + * + * This function finds the base direction of a single paragraph, + * as defined by rule P2 of the Unicode Bidirectional Algorithm available at + * http://www.unicode.org/reports/tr9/#P2. + * + * You typically do not need this function as + * fribidi_get_par_embedding_levels() knows how to compute base direction + * itself, but you may need this to implement a more sophisticated paragraph + * direction handling. Note that you can pass more than a paragraph to this + * function and the direction of the first non-neutral paragraph is returned, + * which is a very good heuristic to set direction of the neutral paragraphs + * at the beginning of text. For other neutral paragraphs, you better use the + * direction of the previous paragraph. + * + * Returns: Base pargraph direction. No weak paragraph direction is returned, + * only LTR, RTL, or ON. + */ +FRIBIDI_ENTRY FriBidiParType fribidi_get_par_direction( + const FriBidiCharType *bidi_types, /* input list of bidi types as returned by + fribidi_get_bidi_types() */ + const FriBidiStrIndex len /* input string length */ +); + +#define fribidi_get_par_embedding_levels FRIBIDI_NAMESPACE(get_par_embedding_levels) +/* fribidi_get_par_embedding_levels - get bidi embedding levels of a paragraph + * + * This function finds the bidi embedding levels of a single paragraph, + * as defined by the Unicode Bidirectional Algorithm available at + * http://www.unicode.org/reports/tr9/. This function implements rules P2 to + * I1 inclusive, and parts 1 to 3 of L1, except for rule X9 which is + * implemented in fribidi_remove_bidi_marks(). Part 4 of L1 is implemented + * in fribidi_reorder_line(). + * + * There are a few macros defined in fribidi-bidi-types.h to work with this + * embedding levels. + * + * Returns: Maximum level found plus one, or zero if any error occured + * (memory allocation failure most probably). + */ +FRIBIDI_ENTRY FriBidiLevel +fribidi_get_par_embedding_levels( + const FriBidiCharType *bidi_types, /* input list of bidi types as returned by + fribidi_get_bidi_types() */ + const FriBidiStrIndex len, /* input string length of the paragraph */ + FriBidiParType *pbase_dir, /* requested and resolved paragraph + * base direction */ + FriBidiLevel *embedding_levels /* output list of embedding levels */ +) FRIBIDI_GNUC_WARN_UNUSED; + +#define fribidi_reorder_line FRIBIDI_NAMESPACE(reorder_line) +/* fribidi_reorder_line - reorder a line of logical string to visual + * + * This function reorders the characters in a line of text from logical to + * final visual order. This function implements part 4 of rule L1, and rules + * L2 and L3 of the Unicode Bidirectional Algorithm available at + * http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels. + * + * As a side effect it also sets position maps if not NULL. + * + * You should provide the resolved paragraph direction and embedding levels as + * set by fribidi_get_par_embedding_levels(). Also note that the embedding + * levels may change a bit. To be exact, the embedding level of any sequence + * of white space at the end of line is reset to the paragraph embedding level + * (That is part 4 of rule L1). + * + * Note that the bidi types and embedding levels are not reordered. You can + * reorder these (or any other) arrays using the map later. The user is + * responsible to initialize map to something sensible, like an identity + * mapping, or pass NULL if no map is needed. + * + * There is an optional part to this function, which is whether non-spacing + * marks for right-to-left parts of the text should be reordered to come after + * their base characters in the visual string or not. Most rendering engines + * expect this behavior, but console-based systems for example do not like it. + * This is controlled by the FRIBIDI_FLAG_REORDER_NSM flag. The flag is on + * in FRIBIDI_FLAGS_DEFAULT. + * + * Returns: Maximum level found in this line plus one, or zero if any error + * occured (memory allocation failure most probably). + */ +FRIBIDI_ENTRY FriBidiLevel fribidi_reorder_line( + FriBidiFlags flags, /* reorder flags */ + const FriBidiCharType *bidi_types, /* input list of bidi types as returned by + fribidi_get_bidi_types() */ + const FriBidiStrIndex len, /* input length of the line */ + const FriBidiStrIndex off, /* input offset of the beginning of the line + in the paragraph */ + const FriBidiParType base_dir, /* resolved paragraph base direction */ + FriBidiLevel *embedding_levels, /* input list of embedding levels, + as returned by + fribidi_get_par_embedding_levels */ + FriBidiChar *visual_str, /* visual string to reorder */ + FriBidiStrIndex *map /* a map of string indices which is reordered + * to reflect where each glyph ends up. */ +) FRIBIDI_GNUC_WARN_UNUSED; + +#include "fribidi-enddecls.h" + +#endif /* !_FRIBIDI_BIDI_H */ +/* Editor directions: + * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent + */ diff --git a/app/src/main/cpp/include/fribidi/fribidi-char-sets-list.h b/app/src/main/cpp/include/fribidi/fribidi-char-sets-list.h new file mode 100644 index 0000000..32a54ac --- /dev/null +++ b/app/src/main/cpp/include/fribidi/fribidi-char-sets-list.h @@ -0,0 +1,60 @@ +#ifndef __FRIBIDI_DOC +/* FriBidi + * fribidi-char-sets-list.h - list of supported character sets + * + * $Id: fribidi-char-sets-list.h,v 1.3 2004/06/09 14:59:21 behdad Exp $ + * $Author: behdad $ + * $Date: 2004/06/09 14:59:21 $ + * $Revision: 1.3 $ + * $Source: /cvs/fribidi/fribidi2/charset/fribidi-char-sets-list.h,v $ + * + * Author: + * Behdad Esfahbod, 2001, 2002, 2004 + * + * Copyright (C) 2004 Sharif FarsiWeb, Inc. + * Copyright (C) 2001,2002 Behdad Esfahbod + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library, in a file named COPYING; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA + * + * For licensing issues, contact <license@farsiweb.info>. + */ +/* *INDENT-OFF* */ + +/* The order of types in this list should not be important at compile time, + * but apparently it should not be changed after compilation! */ +#endif /* !__FRIBIDI_DOC */ +#ifdef _FRIBIDI_ADD_CHAR_SET +# define _FRIBIDI_ADD_CHAR_SET_OTHERS _FRIBIDI_ADD_CHAR_SET +# define _FRIBIDI_ADD_CHAR_SET_ONE2ONE _FRIBIDI_ADD_CHAR_SET +#endif /* _FRIBIDI_ADD_CHAR_SET */ +#ifdef _FRIBIDI_ADD_CHAR_SET_OTHERS +_FRIBIDI_ADD_CHAR_SET_OTHERS (UTF8, utf8) /* UTF-8 (Unicode) */ +_FRIBIDI_ADD_CHAR_SET_OTHERS (CAP_RTL, cap_rtl) /* CapRTL (Test) */ +#endif /* _FRIBIDI_ADD_CHAR_SET_OTHERS */ +#ifdef _FRIBIDI_ADD_CHAR_SET_ONE2ONE +_FRIBIDI_ADD_CHAR_SET_ONE2ONE (ISO8859_6, iso8859_6) /* ISO8859-6 (Arabic) */ +_FRIBIDI_ADD_CHAR_SET_ONE2ONE (ISO8859_8, iso8859_8) /* ISO8859-8 (Hebrew) */ +_FRIBIDI_ADD_CHAR_SET_ONE2ONE (CP1255, cp1255) /* CP1255 (MS Hebrew/Yiddish) */ +_FRIBIDI_ADD_CHAR_SET_ONE2ONE (CP1256, cp1256) /* CP1256 (MS Arabic) */ +#endif /* _FRIBIDI_ADD_CHAR_SET_ONE2ONE */ +#ifdef _FRIBIDI_ADD_CHAR_SET +# undef _FRIBIDI_ADD_CHAR_SET_OTHERS +# undef _FRIBIDI_ADD_CHAR_SET_ONE2ONE +#endif /* _FRIBIDI_ADD_CHAR_SET */ + +#ifndef __FRIBIDI_DOC +/* *INDENT-ON* */ +#endif /* !__FRIBIDI_DOC */ diff --git a/app/src/main/cpp/include/fribidi/fribidi-char-sets.h b/app/src/main/cpp/include/fribidi/fribidi-char-sets.h new file mode 100644 index 0000000..4b845c1 --- /dev/null +++ b/app/src/main/cpp/include/fribidi/fribidi-char-sets.h @@ -0,0 +1,119 @@ +/* FriBidi + * fribidi-char-sets.h - character set conversion routines + * + * $Id: fribidi-char-sets.h,v 1.3 2004/06/09 14:59:21 behdad Exp $ + * $Author: behdad $ + * $Date: 2004/06/09 14:59:21 $ + * $Revision: 1.3 $ + * $Source: /cvs/fribidi/fribidi2/charset/fribidi-char-sets.h,v $ + * + * Authors: + * Behdad Esfahbod, 2001, 2002, 2004 + * Dov Grobgeld, 1999, 2000 + * + * Copyright (C) 2004 Sharif FarsiWeb, Inc + * Copyright (C) 2001,2002 Behdad Esfahbod + * Copyright (C) 1999,2000 Dov Grobgeld + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library, in a file named COPYING; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA + * + * For licensing issues, contact <license@farsiweb.info>. + */ +#ifndef _FRIBIDI_CHAR_SETS_H +#define _FRIBIDI_CHAR_SETS_H + +#include "fribidi-common.h" + +#include "fribidi-types.h" + +#include "fribidi-begindecls.h" + +typedef enum { + _FRIBIDI_CHAR_SET_NOT_FOUND, +# define _FRIBIDI_ADD_CHAR_SET(CHAR_SET, char_set) FRIBIDI_CHAR_SET_##CHAR_SET, + +# include "fribidi-char-sets-list.h" + +# undef _FRIBIDI_ADD_CHAR_SET + _FRIBIDI_CHAR_SETS_NUM_PLUS_ONE +} + FriBidiCharSet; + +#define FRIBIDI_CHAR_SET_NOT_FOUND _FRIBIDI_CHAR_SET_NOT_FOUND +#define FRIBIDI_CHAR_SETS_NUM (_FRIBIDI_CHAR_SETS_NUM_PLUS_ONE - 1) + + +#define fribidi_charset_to_unicode FRIBIDI_NAMESPACE(charset_to_unicode) +/* fribidi_charset_to_unicode - convert string to Unicode + * + * This function converts an string from a character set, to a Unicode string. + * + * Returns: The length of the new string. + */ +FRIBIDI_ENTRY FriBidiStrIndex fribidi_charset_to_unicode( + FriBidiCharSet char_set, /* character set to convert from */ + const char *s, /* input string encoded in char_set */ + FriBidiStrIndex len, /* input string length */ + FriBidiChar *us /* output Unicode string */ +); + +#define fribidi_unicode_to_charset FRIBIDI_NAMESPACE(unicode_to_charset) +/* fribidi_unicode_to_charset - convert string from Unicode + * + * This function converts a Unicode string to an string in another character + * set. It also null-terminates the output string. + * + * Returns: The length of the new string. + */ +FRIBIDI_ENTRY FriBidiStrIndex fribidi_unicode_to_charset( + FriBidiCharSet char_set, /* character set to conver to */ + const FriBidiChar *us, /* input Unicode string */ + FriBidiStrIndex len, /* input string length */ + char *s /* output string encoded in char_set */ +); + +#define fribidi_parse_charset FRIBIDI_NAMESPACE(parse_charset) +/* fribidi_parse_charset - parse character set name + * + * Returns: The character set named s, or FRIBIDI_CHAR_SET_NOT_FOUND if the + * character set is not available. + */ +FRIBIDI_ENTRY FriBidiCharSet fribidi_parse_charset( + const char *s /* input name of the character set */ +); + + +#define fribidi_char_set_name FRIBIDI_NAMESPACE(char_set_name) +FRIBIDI_ENTRY const char *fribidi_char_set_name( + FriBidiCharSet char_set +); + +#define fribidi_char_set_title FRIBIDI_NAMESPACE(char_set_title) +FRIBIDI_ENTRY const char *fribidi_char_set_title( + FriBidiCharSet char_set +); + +#define fribidi_char_set_desc FRIBIDI_NAMESPACE(char_set_desc) +FRIBIDI_ENTRY const char *fribidi_char_set_desc( + FriBidiCharSet char_set +); + +#include "fribidi-enddecls.h" + +#endif /* !_FRIBIDI_CHAR_SETS_H */ +/* Editor directions: + * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent + */ diff --git a/app/src/main/cpp/include/fribidi/fribidi-common.h b/app/src/main/cpp/include/fribidi/fribidi-common.h new file mode 100644 index 0000000..cca62e1 --- /dev/null +++ b/app/src/main/cpp/include/fribidi/fribidi-common.h @@ -0,0 +1,122 @@ +/* FriBidi + * fribidi-common.h - common include for library headers + * + * $Id: fribidi-common.h,v 1.13 2007/04/05 16:13:24 behdad Exp $ + * $Author: behdad $ + * $Date: 2007/04/05 16:13:24 $ + * $Revision: 1.13 $ + * $Source: /cvs/fribidi/fribidi2/lib/fribidi-common.h,v $ + * + * Author: + * Behdad Esfahbod, 2004 + * + * Copyright (C) 2004 Sharif FarsiWeb, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library, in a file named COPYING; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA + * + * For licensing issues, contact <license@farsiweb.info>. + */ +#ifndef _FRIBIDI_COMMON_H +#define _FRIBIDI_COMMON_H + +#if DONT_HAVE_FRIBIDI_CONFIG_H + 0 +# define FRIBIDI "fribidi" +# define FRIBIDI_NAME "fribidi" +# define FRIBIDI_VERSION "unknown" +# define FRIBIDI_BUGREPORT "unknown" +# define FRIBIDI_INTERFACE_VERSION_STRING "unknown" +#else /* !DONT_HAVE_FRIBIDI_CONFIG_H */ + +# include "fribidi-config.h" + +#endif /* !DONT_HAVE_FRIBIDI_CONFIG_H */ + +#if HAVE_FRIBIDI_CUSTOM_H + 0 +# include <fribidi-custom.h> +#endif /* HAVE_FRIBIDI_CUSTOM_H */ + +/* FRIBIDI_NAMESPACE is a macro used to name library symbols. */ +#ifndef FRIBIDI_NAMESPACE +# define FRIBIDI_NAMESPACE(SYMBOL) fribidi##_##SYMBOL +#endif /* !FRIBIDI_NAMESPACE */ + +/* FRIBIDI_ENTRY is a macro used to declare library entry points. */ +#ifndef FRIBIDI_ENTRY +# if (defined(WIN32)) || (defined(_WIN32_WCE)) +# define FRIBIDI_ENTRY __declspec(dllimport) +# else /* !WIN32 */ +# define FRIBIDI_ENTRY /* empty */ +# endif /* !WIN32 */ +#endif /* !FRIBIDI_ENTRY */ + +#if FRIBIDI_USE_GLIB + 0 +# ifndef __FRIBIDI_DOC +# include <glib/gmacros.h> +# endif /* !__FRIBIDI_DOC */ +# define FRIBIDI_BEGIN_DECLS G_BEGIN_DECLS +# define FRIBIDI_END_DECLS G_END_DECLS +# define FRIBIDI_GNUC_CONST G_GNUC_CONST +# define FRIBIDI_GNUC_DEPRECATED G_GNUC_DEPRECATED +# if __GNUC__ > 2 +# define FRIBIDI_GNUC_WARN_UNUSED \ + __attribute__((__warn_unused_result__)) +# define FRIBIDI_GNUC_MALLOC \ + __attribute__((__malloc__)) +# define FRIBIDI_GNUC_HIDDEN \ + __attribute__((__visibility__ ("hidden"))) +# else /* __GNUC__ <= 2 */ +# define FRIBIDI_GNUC_WARN_UNUSED +# define FRIBIDI_GNUC_MALLOC +# define FRIBIDI_GNUC_HIDDEN +# endif /* __GNUC__ <= 2 */ +#else /* !FRIBIDI_USE_GLIB */ +# define FRIBIDI_GNUC_CONST +# define FRIBIDI_GNUC_DEPRECATED +# define FRIBIDI_GNUC_WARN_UNUSED +# define FRIBIDI_GNUC_MALLOC +# define FRIBIDI_GNUC_HIDDEN +#endif /* !FRIBIDI_USE_GLIB */ + +/* FRIBIDI_BEGIN_DECLS should be used at the beginning of your declarations, + * so that C++ compilers don't mangle their names. Use FRIBIDI_END_DECLS at + * the end of C declarations. */ +#ifndef FRIBIDI_BEGIN_DECLS +# ifdef __cplusplus +# define FRIBIDI_BEGIN_DECLS extern "C" { +# define FRIBIDI_END_DECLS } +# else /* !__cplusplus */ +# define FRIBIDI_BEGIN_DECLS /* empty */ +# define FRIBIDI_END_DECLS /* empty */ +# endif /* !__cplusplus */ +#endif /* !FRIBIDI_BEGIN_DECLS */ + + +#define fribidi_debug_status FRIBIDI_NAMESPACE(debug_status) +FRIBIDI_ENTRY int fribidi_debug_status( + void +); + +#define fribidi_set_debug FRIBIDI_NAMESPACE(set_debug) +FRIBIDI_ENTRY int +fribidi_set_debug( + int state /* new state to set */ +); + + +#endif /* !_FRIBIDI_COMMON_H */ +/* Editor directions: + * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent + */ diff --git a/app/src/main/cpp/include/fribidi/fribidi-config.h b/app/src/main/cpp/include/fribidi/fribidi-config.h new file mode 100644 index 0000000..1796324 --- /dev/null +++ b/app/src/main/cpp/include/fribidi/fribidi-config.h @@ -0,0 +1,26 @@ +/* lib/fribidi-config.h. Generated from fribidi-config.h.in by configure. */ +/* Not copyrighted, in public domain. */ +#ifndef FRIBIDI_CONFIG_H +#define FRIBIDI_CONFIG_H + +#define FRIBIDI "fribidi" +#define FRIBIDI_NAME "GNU FriBidi" +#define FRIBIDI_BUGREPORT "http://fribidi.org/bug" + +#define FRIBIDI_VERSION "0.19.2" +#define FRIBIDI_MAJOR_VERSION 0 +#define FRIBIDI_MINOR_VERSION 19 +#define FRIBIDI_MICRO_VERSION 2 +#define FRIBIDI_INTERFACE_VERSION 3 +#define FRIBIDI_INTERFACE_VERSION_STRING "3" + +/* Define to 1 if you want charset conversion codes in the library */ +#define FRIBIDI_CHARSETS 1 + +/* Define to 1 if you want to use glib */ +#define FRIBIDI_USE_GLIB 0 + +/* The size of a `int', as computed by sizeof. */ +#define FRIBIDI_SIZEOF_INT 4 + +#endif /* FRIBIDI_CONFIG_H */ diff --git a/app/src/main/cpp/include/fribidi/fribidi-deprecated.h b/app/src/main/cpp/include/fribidi/fribidi-deprecated.h new file mode 100644 index 0000000..4bf30ac --- /dev/null +++ b/app/src/main/cpp/include/fribidi/fribidi-deprecated.h @@ -0,0 +1,242 @@ +/* FriBidi + * fribidi-deprecated.h - Deprecated interfaces + * + * $Id: fribidi-deprecated.h,v 1.3 2006/01/31 03:23:13 behdad Exp $ + * $Author: behdad $ + * $Date: 2006/01/31 03:23:13 $ + * $Revision: 1.3 $ + * $Source: /cvs/fribidi/fribidi2/lib/fribidi-deprecated.h,v $ + * + * Author: + * Behdad Esfahbod, 2004, 2005 + * + * Copyright (C) 2004 Sharif FarsiWeb, Inc + * Copyright (C) 2004, 2005 Behdad Esfahbod + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library, in a file named COPYING; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA + * + * For licensing issues, contact <license@farsiweb.info>. + */ +#ifndef _FRIBIDI_DEPRECATED_H +#define _FRIBIDI_DEPRECATED_H + +#include "fribidi-common.h" + +#include "fribidi-types.h" + +#include "fribidi-bidi-types.h" + +#include "fribidi-begindecls.h" + + +#define fribidi_mirroring_status FRIBIDI_NAMESPACE(mirroring_status) +/* fribidi_mirroring_status - get current mirroring status + * + * This function is deprecated and only used with other deprecated functions. + */ +FRIBIDI_ENTRY fribidi_boolean fribidi_mirroring_status( + void +) FRIBIDI_GNUC_DEPRECATED; + +#define fribidi_set_mirroring FRIBIDI_NAMESPACE(set_mirroring) +/* fribidi_set_mirroring - set mirroring on or off + * + * This function is used to turn character mirroring on or off. + * Character mirroring is the act of replacing a mirrorable glyph + * (character), eg. left paranthesis, with the matching glyph, + * eg. right paranthesis, in a right-to-left resolved context. + * If your rendering engine does mirroring itself, you may want to + * turn it off here. + * + * This flag is on by default. + * This function is deprecated and only used with other deprecated functions. + * + * Returns: the new mirroring status. + */ +FRIBIDI_ENTRY fribidi_boolean fribidi_set_mirroring( + fribidi_boolean state /* new state to set */ +) FRIBIDI_GNUC_DEPRECATED; + + +#define fribidi_reorder_nsm_status FRIBIDI_NAMESPACE(reorder_nsm_status) +/* fribidi_reorder_nsm_status - get current marks reordering status + * + * This function is deprecated and only used with other deprecated functions. + */ +FRIBIDI_ENTRY fribidi_boolean fribidi_reorder_nsm_status( + void +) FRIBIDI_GNUC_DEPRECATED; + +#define fribidi_set_reorder_nsm FRIBIDI_NAMESPACE(set_reorder_nsm) +/* fribidi_set_reorder_nsm - set marks reordering on or off + * + * This function is used to turn non-spacing marks reordering on or + * off. Reordering non-spacing marks is the act of placing non-spacing + * marks (bidi class NSM) after their base character in a right-to-left + * resolved context. If your rendering engine expects non-spacing marks + * always after the base character in the memory representation of the + * visual string, you need this option on. An example of where people + * may need it off is when rendering in the console when non-spacing + * marks cannot be applied on top of the base character. + * + * This flag is on by default. + * This function is deprecated and only used with other deprecated functions. + * + * Returns: the new marks reordering status. + */ +FRIBIDI_ENTRY fribidi_boolean fribidi_set_reorder_nsm( + fribidi_boolean state /* new state to set */ +) FRIBIDI_GNUC_DEPRECATED; + + + + +/* fribidi_log2vis_get_embedding_levels - get embedding levels + * + * Deprecated. Replaced by fribidi_get_par_embedding_levels. + */ +#define fribidi_log2vis_get_embedding_levels FRIBIDI_NAMESPACE(log2vis_get_embedding_levels) +FRIBIDI_ENTRY FriBidiLevel +fribidi_log2vis_get_embedding_levels( + const FriBidiCharType *bidi_types, /* input list of bidi types as returned by + fribidi_get_bidi_types() */ + const FriBidiStrIndex len, /* input string length of the paragraph */ + FriBidiParType *pbase_dir, /* requested and resolved paragraph + * base direction */ + FriBidiLevel *embedding_levels /* output list of embedding levels */ +) FRIBIDI_GNUC_DEPRECATED; + +/* fribidi_get_type - get character bidi type + * + * Deprecated. Replaced by fribidi_get_bidi_type. + */ +#define fribidi_get_type FRIBIDI_NAMESPACE(get_type) +FRIBIDI_ENTRY FriBidiCharType +fribidi_get_type( + FriBidiChar ch /* input character */ +) FRIBIDI_GNUC_DEPRECATED; + +/* fribidi_get_type_internal - get character bidi type + * + * Deprecated. Replaced by fribidi_get_bidi_type. + */ +#define fribidi_get_type_internal FRIBIDI_NAMESPACE(get_type_internal) +FRIBIDI_ENTRY FriBidiCharType +fribidi_get_type_internal( + FriBidiChar ch /* input character */ +) FRIBIDI_GNUC_DEPRECATED; + +#define fribidi_remove_bidi_marks FRIBIDI_NAMESPACE(remove_bidi_marks) +/* fribidi_remove_bidi_marks - remove bidi marks out of an string + * + * This function removes the bidi and boundary-neutral marks out of an string + * and the accompanying lists. It implements rule X9 of the Unicode + * Bidirectional Algorithm available at + * http://www.unicode.org/reports/tr9/#X9, with the exception that it removes + * U+200E LEFT-TO-RIGHT MARK and U+200F RIGHT-TO-LEFT MARK too. + * + * If any of the input lists are NULL, the list is skipped. If str is the + * visual string, then positions_to_this is positions_L_to_V and + * position_from_this_list is positions_V_to_L; if str is the logical + * string, the other way. Moreover, the position maps should be filled with + * valid entries. + * + * A position map pointing to a removed character is filled with -1. By the + * way, you should not use embedding_levels if str is visual string. + * + * For best results this function should be run on a whole paragraph, not + * lines; but feel free to do otherwise if you know what you are doing. + * Deprecated. Use fribidi_remove_special_chars instead. + * + * Returns: New length of the string, or -1 if an error occured (memory + * allocation failure most probably). + */ +FRIBIDI_ENTRY FriBidiStrIndex +fribidi_remove_bidi_marks( + FriBidiChar *str, /* input string to clean */ + const FriBidiStrIndex len, /* input string length */ + FriBidiStrIndex *positions_to_this, /* list mapping positions to the + order used in str */ + FriBidiStrIndex *position_from_this_list, /* list mapping positions from the + order used in str */ + FriBidiLevel *embedding_levels /* list of embedding levels */ +) +FRIBIDI_GNUC_WARN_UNUSED FRIBIDI_GNUC_DEPRECATED; + + +#define fribidi_log2vis FRIBIDI_NAMESPACE(log2vis) +/* fribidi_log2vis - get visual string + * + * This function converts the logical input string to the visual output + * strings as specified by the Unicode Bidirectional Algorithm. As a side + * effect it also generates mapping lists between the two strings, and the + * list of embedding levels as defined by the algorithm. + * + * If NULL is passed as any of the the lists, the list is ignored and not + * filled. + * + * This function is obsolete because it only handles one-line paragraphs. + * Please consider using other functions instead. Deprecated. + * + * Returns: Maximum level found plus one, or zero if any error occured + * (memory allocation failure most probably). + */ +FRIBIDI_ENTRY FriBidiLevel fribidi_log2vis( + const FriBidiChar *str, /* input logical string */ + const FriBidiStrIndex len, /* input string length */ + FriBidiParType *pbase_dir, /* requested and resolved paragraph + * base direction */ + FriBidiChar *visual_str, /* output visual string */ + FriBidiStrIndex *positions_L_to_V, /* output mapping from logical to + * visual string positions */ + FriBidiStrIndex *positions_V_to_L, /* output mapping from visual string + * back to the logical string + * positions */ + FriBidiLevel *embedding_levels /* output list of embedding levels */ +) +FRIBIDI_GNUC_WARN_UNUSED FRIBIDI_GNUC_DEPRECATED; + + +#define UNI_MAX_BIDI_LEVEL FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL +#define UNI_LRM FRIBIDI_CHAR_LRM +#define UNI_RLM FRIBIDI_CHAR_RLM +#define UNI_LRE FRIBIDI_CHAR_LRE +#define UNI_RLE FRIBIDI_CHAR_RLE +#define UNI_LRO FRIBIDI_CHAR_LRO +#define UNI_RLO FRIBIDI_CHAR_RLO +#define UNI_LS FRIBIDI_CHAR_LS +#define UNI_PS FRIBIDI_CHAR_PS +#define UNI_ZWNJ FRIBIDI_CHAR_ZWNJ +#define UNI_ZWJ FRIBIDI_CHAR_ZWJ +#define UNI_HEBREW_ALEF FRIBIDI_CHAR_HEBREW_ALEF +#define UNI_ARABIC_ALEF FRIBIDI_CHAR_ARABIC_ALEF +#define UNI_ARABIC_ZERO FRIBIDI_CHAR_ARABIC_ZERO +#define UNI_FARSI_ZERO FRIBIDI_CHAR_PERSIAN_ZERO + +#define FRIBIDI_TYPE_WL FRIBIDI_PAR_WLTR +#define FRIBIDI_TYPE_WR FRIBIDI_PAR_WRTL +#define FRIBIDI_TYPE_L FRIBIDI_PAR_LTR +#define FRIBIDI_TYPE_R FRIBIDI_PAR_RTL +#define FRIBIDI_TYPE_N FRIBIDI_PAR_ON +#define FRIBIDI_TYPE_B FRIBIDI_TYPE_BS +#define FRIBIDI_TYPE_S FRIBIDI_TYPE_SS + +#include "fribidi-enddecls.h" + +#endif /* !_FRIBIDI_DEPRECATED_H */ +/* Editor directions: + * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent + */ diff --git a/app/src/main/cpp/include/fribidi/fribidi-enddecls.h b/app/src/main/cpp/include/fribidi/fribidi-enddecls.h new file mode 100644 index 0000000..eb300c9 --- /dev/null +++ b/app/src/main/cpp/include/fribidi/fribidi-enddecls.h @@ -0,0 +1,3 @@ +#ifdef FRIBIDI_END_DECLS +FRIBIDI_END_DECLS +#endif /* FRIBIDI_END_DECLS */ diff --git a/app/src/main/cpp/include/fribidi/fribidi-flags.h b/app/src/main/cpp/include/fribidi/fribidi-flags.h new file mode 100644 index 0000000..672d703 --- /dev/null +++ b/app/src/main/cpp/include/fribidi/fribidi-flags.h @@ -0,0 +1,78 @@ +/* FriBidi + * fribidi-flags.h - option flags + * + * $Id: fribidi-flags.h,v 1.1 2005/11/03 01:39:01 behdad Exp $ + * $Author: behdad $ + * $Date: 2005/11/03 01:39:01 $ + * $Revision: 1.1 $ + * $Source: /cvs/fribidi/fribidi2/lib/fribidi-flags.h,v $ + * + * Author: + * Behdad Esfahbod, 2005 + * + * Copyright (C) 2005 Behdad Esfahbod + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library, in a file named COPYING; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA + * + * For licensing issues, contact <license@farsiweb.info>. + */ +#ifndef _FRIBIDI_FLAGS_H +#define _FRIBIDI_FLAGS_H + +#include "fribidi-common.h" + +#include "fribidi-types.h" + +#include "fribidi-begindecls.h" + +typedef fribidi_uint32 FriBidiFlags; + +/* + * Define option flags that various functions use. Each mask has + * only one bit set. + */ + +#define FRIBIDI_FLAG_SHAPE_MIRRORING 0x00000001 +#define FRIBIDI_FLAG_REORDER_NSM 0x00000002 + +#define FRIBIDI_FLAG_SHAPE_ARAB_PRES 0x00000100 +#define FRIBIDI_FLAG_SHAPE_ARAB_LIGA 0x00000200 +#define FRIBIDI_FLAG_SHAPE_ARAB_CONSOLE 0x00000400 + +#define FRIBIDI_FLAG_REMOVE_BIDI 0x00010000 +#define FRIBIDI_FLAG_REMOVE_JOINING 0x00020000 +#define FRIBIDI_FLAG_REMOVE_SPECIALS 0x00040000 + + +/* + * And their combinations. + */ + +#define FRIBIDI_FLAGS_DEFAULT ( \ + FRIBIDI_FLAG_SHAPE_MIRRORING | \ + FRIBIDI_FLAG_REORDER_NSM | \ + FRIBIDI_FLAG_REMOVE_SPECIALS ) + +#define FRIBIDI_FLAGS_ARABIC ( \ + FRIBIDI_FLAG_SHAPE_ARAB_PRES | \ + FRIBIDI_FLAG_SHAPE_ARAB_LIGA ) + +#include "fribidi-enddecls.h" + +#endif /* !_FRIBIDI_FLAGS_H */ +/* Editor directions: + * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent + */ diff --git a/app/src/main/cpp/include/fribidi/fribidi-joining-types-list.h b/app/src/main/cpp/include/fribidi/fribidi-joining-types-list.h new file mode 100644 index 0000000..c209f1b --- /dev/null +++ b/app/src/main/cpp/include/fribidi/fribidi-joining-types-list.h @@ -0,0 +1,50 @@ +#ifndef __FRIBIDI_DOC +/* FriBidi + * fribidi-joining-types-list.h - list of joining types + * + * $Id: fribidi-joining-types-list.h,v 1.2 2004/06/15 11:52:02 behdad Exp $ + * $Author: behdad $ + * $Date: 2004/06/15 11:52:02 $ + * $Revision: 1.2 $ + * $Source: /cvs/fribidi/fribidi2/lib/fribidi-joining-types-list.h,v $ + * + * Author: + * Behdad Esfahbod, 2004 + * + * Copyright (C) 2004 Sharif FarsiWeb, Inc. + * Copyright (C) 2004 Behdad Esfahbod + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library, in a file named COPYING; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA + * + * For licensing issues, contact <license@farsiweb.info>. + */ +/* *INDENT-OFF* */ +#endif /* !__FRIBIDI_DOC */ +#ifndef _FRIBIDI_ADD_TYPE +# define _FRIBIDI_ADD_TYPE(x, y) +#endif + +_FRIBIDI_ADD_TYPE (U, '|') /* nUn-joining, e.g. Full Stop */ +_FRIBIDI_ADD_TYPE (R, '<') /* Right-joining, e.g. Arabic Letter Dal */ +_FRIBIDI_ADD_TYPE (D, '+') /* Dual-joining, e.g. Arabic Letter Ain */ +_FRIBIDI_ADD_TYPE (C, '-') /* join-Causing, e.g. Tatweel, ZWJ */ +_FRIBIDI_ADD_TYPE (T, '^') /* Transparent, e.g. Arabic Fatha */ +_FRIBIDI_ADD_TYPE (L, '>') /* Left-joining, i.e. fictional */ +_FRIBIDI_ADD_TYPE (G, '~') /* iGnored, e.g. LRE, RLE, ZWNBSP */ + +#ifndef __FRIBIDI_DOC +/* *INDENT-ON* */ +#endif /* !__FRIBIDI_DOC */ diff --git a/app/src/main/cpp/include/fribidi/fribidi-joining-types.h b/app/src/main/cpp/include/fribidi/fribidi-joining-types.h new file mode 100644 index 0000000..2c2527b --- /dev/null +++ b/app/src/main/cpp/include/fribidi/fribidi-joining-types.h @@ -0,0 +1,259 @@ +/* FriBidi + * fribidi-joining-types.h - character joining types + * + * $Id: fribidi-joining-types.h,v 1.5 2005/11/03 01:39:01 behdad Exp $ + * $Author: behdad $ + * $Date: 2005/11/03 01:39:01 $ + * $Revision: 1.5 $ + * $Source: /cvs/fribidi/fribidi2/lib/fribidi-joining-types.h,v $ + * + * Author: + * Behdad Esfahbod, 2001, 2002, 2004 + * + * Copyright (C) 2004 Sharif FarsiWeb, Inc. + * Copyright (C) 2001,2002 Behdad Esfahbod + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library, in a file named COPYING; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA + * + * For licensing issues, contact <license@farsiweb.info>. + */ +#ifndef _FRIBIDI_JOINING_TYPES_H +#define _FRIBIDI_JOINING_TYPES_H + +#include "fribidi-common.h" + +#include "fribidi-types.h" + +#include "fribidi-begindecls.h" + +/* + * Define bit masks that joining types are based on, each mask has + * only one bit set. + */ + +#define FRIBIDI_MASK_JOINS_RIGHT 0x01 /* May join to right */ +#define FRIBIDI_MASK_JOINS_LEFT 0x02 /* May join to right */ +#define FRIBIDI_MASK_ARAB_SHAPES 0x04 /* May Arabic shape */ +#define FRIBIDI_MASK_TRANSPARENT 0x08 /* Is transparent */ +#define FRIBIDI_MASK_IGNORED 0x10 /* Is ignored */ +#define FRIBIDI_MASK_LIGATURED 0x20 /* Is ligatured */ + +/* + * Define values for FriBidiJoiningType + */ + +/* nUn-joining */ +#define FRIBIDI_JOINING_TYPE_U_VAL ( 0 ) + +/* Right-joining */ +#define FRIBIDI_JOINING_TYPE_R_VAL \ + ( FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_ARAB_SHAPES ) + +/* Dual-joining */ +#define FRIBIDI_JOINING_TYPE_D_VAL \ + ( FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT \ + | FRIBIDI_MASK_ARAB_SHAPES ) + +/* join-Causing */ +#define FRIBIDI_JOINING_TYPE_C_VAL \ + ( FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT ) + +/* Left-joining */ +#define FRIBIDI_JOINING_TYPE_L_VAL \ + ( FRIBIDI_MASK_JOINS_LEFT | FRIBIDI_MASK_ARAB_SHAPES ) + +/* Transparent */ +#define FRIBIDI_JOINING_TYPE_T_VAL \ + ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_ARAB_SHAPES ) + +/* iGnored */ +#define FRIBIDI_JOINING_TYPE_G_VAL ( FRIBIDI_MASK_IGNORED ) + + +enum _FriBidiJoiningTypeEnum { +# define _FRIBIDI_ADD_TYPE(TYPE, SYMBOL) \ + FRIBIDI_JOINING_TYPE_##TYPE = FRIBIDI_JOINING_TYPE_##TYPE##_VAL, + +# include "fribidi-joining-types-list.h" + +# undef _FRIBIDI_ADD_TYPE + _FRIBIDI_JOINING_TYPE_JUNK /* Don't use this */ +}; + +#ifdef __FRIBIDI_DOC +typedef enum _FriBidiJoiningTypeEnum FriBidiJoiningType; +#else /* !__FRIBIDI_DOC */ +typedef fribidi_uint8 FriBidiJoiningType; +#endif /* !__FRIBIDI_DOC */ + +/* FriBidiArabicProp is essentially the same type as FriBidiJoiningType, but + * not limited to the few values returned by fribidi_get_joining_type. */ +typedef fribidi_uint8 FriBidiArabicProp; + +/* + * The equivalent of JoiningType values for ArabicProp + */ + +/* Primary Arabic Joining Classes (Table 8-2) */ + +/* nUn-joining */ +#define FRIBIDI_IS_JOINING_TYPE_U(p) \ + ( 0 == ( (p) & \ + ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED \ + | FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT ) ) ) + +/* Right-joining */ +#define FRIBIDI_IS_JOINING_TYPE_R(p) \ + ( FRIBIDI_MASK_JOINS_RIGHT == ( (p) & \ + ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED \ + | FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT ) ) ) + +/* Dual-joining */ +#define FRIBIDI_IS_JOINING_TYPE_D(p) \ + ( ( FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT \ + | FRIBIDI_MASK_ARAB_SHAPES ) == ( (p) & \ + ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED \ + | FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT \ + | FRIBIDI_MASK_ARAB_SHAPES ) ) ) + +/* join-Causing */ +#define FRIBIDI_IS_JOINING_TYPE_C(p) \ + ( ( FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT ) == ( (p) & \ + ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED \ + | FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT \ + | FRIBIDI_MASK_ARAB_SHAPES ) ) ) + +/* Left-joining */ +#define FRIBIDI_IS_JOINING_TYPE_L(p) \ + ( FRIBIDI_MASK_JOINS_LEFT == ( (p) & \ + ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED \ + | FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT ) ) ) + +/* Transparent */ +#define FRIBIDI_IS_JOINING_TYPE_T(p) \ + ( FRIBIDI_MASK_TRANSPARENT == ( (p) & \ + ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED ) ) ) + +/* iGnored */ +#define FRIBIDI_IS_JOINING_TYPE_G(p) \ + ( FRIBIDI_MASK_IGNORED == ( (p) & \ + ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED ) ) ) + +/* and for Derived Arabic Joining Classes (Table 8-3) */ + +/* Right join-Causing */ +#define FRIBIDI_IS_JOINING_TYPE_RC(p) \ + ( FRIBIDI_MASK_JOINS_RIGHT == ( (p) & \ + ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED \ + | FRIBIDI_MASK_JOINS_RIGHT ) ) ) + +/* Left join-Causing */ +#define FRIBIDI_IS_JOINING_TYPE_LC(p) \ + ( FRIBIDI_MASK_JOINS_LEFT == ( (p) & \ + ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED \ + | FRIBIDI_MASK_JOINS_LEFT ) ) ) + + +/* + * Defining macros for needed queries, It is fully dependent on the + * implementation of FriBidiJoiningType. + */ + +/* Joins to right: R, D, C? */ +#define FRIBIDI_JOINS_RIGHT(p) ((p) & FRIBIDI_MASK_JOINS_RIGHT) + +/* Joins to left: L, D, C? */ +#define FRIBIDI_JOINS_LEFT(p) ((p) & FRIBIDI_MASK_JOINS_LEFT) + +/* May shape: R, D, L, T? */ +#define FRIBIDI_ARAB_SHAPES(p) ((p) & FRIBIDI_MASK_ARAB_SHAPES) + +/* Is skipped in joining: T, G? */ +#define FRIBIDI_IS_JOIN_SKIPPED(p) \ + ((p) & (FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED)) + +/* Is base that will be shaped: R, D, L? */ +#define FRIBIDI_IS_JOIN_BASE_SHAPES(p) \ + ( FRIBIDI_MASK_ARAB_SHAPES == ( (p) & \ + ( FRIBIDI_MASK_TRANSPARENT | FRIBIDI_MASK_IGNORED \ + | FRIBIDI_MASK_ARAB_SHAPES ) ) ) + +#define FRIBIDI_JOINS_PRECEDING_MASK(level) \ + (FRIBIDI_LEVEL_IS_RTL (level) ? FRIBIDI_MASK_JOINS_RIGHT \ + : FRIBIDI_MASK_JOINS_LEFT) + +#define FRIBIDI_JOINS_FOLLOWING_MASK(level) \ + (FRIBIDI_LEVEL_IS_RTL (level) ? FRIBIDI_MASK_JOINS_LEFT \ + : FRIBIDI_MASK_JOINS_RIGHT) + +#define FRIBIDI_JOIN_SHAPE(p) \ + ((p) & ( FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT )) + +/* Functions finally */ + + +#define fribidi_get_joining_type FRIBIDI_NAMESPACE(get_joining_type) +/* fribidi_get_joining_type - get character joining type + * + * This function returns the joining type of a character as defined in Table + * 8-2 Primary Arabic Joining Classes of the Unicode standard available at + * http://www.unicode.org/versions/Unicode4.0.0/ch08.pdf#G7462, using data + * provided in file ArabicShaping.txt and UnicodeData.txt of the Unicode + * Character Database available at + * http://www.unicode.org/Public/UNIDATA/ArabicShaping.txt and + * http://www.unicode.org/Public/UNIDATA/UnicodeData.txt. + * + * There are a few macros defined in fribidi-joining-types.h for querying a + * joining type. + */ +FRIBIDI_ENTRY FriBidiJoiningType +fribidi_get_joining_type( + FriBidiChar ch /* input character */ +) FRIBIDI_GNUC_CONST; + +#define fribidi_get_joining_types FRIBIDI_NAMESPACE(get_joining_types) +/* fribidi_get_joining_types - get joining types for an string of characters + * + * This function finds the joining types of an string of characters. See + * fribidi_get_joining_type for more information about the joining types + * returned by this function. + */ +FRIBIDI_ENTRY void fribidi_get_joining_types( + const FriBidiChar *str, /* input string */ + const FriBidiStrIndex len, /* input string length */ + FriBidiJoiningType *jtypes /* output joining types */ +); + +#define fribidi_get_joining_type_name FRIBIDI_NAMESPACE(get_joining_type_name) +/* fribidi_get_joining_type_name - get joining type name + * + * This function returns the joining type name of a joining type. The + * returned string is a static string and should not be freed. + * + * The type names are the same as ones defined in Table 8-2 Primary Arabic + * Joining Classes of the Unicode standard available at + * http://www.unicode.org/versions/Unicode4.0.0/ch08.pdf#G7462. + */ +FRIBIDI_ENTRY const char *fribidi_get_joining_type_name( + FriBidiJoiningType j /* input joining type */ +) FRIBIDI_GNUC_CONST; + +#include "fribidi-enddecls.h" + +#endif /* !_FRIBIDI_JOINING_TYPES_H */ +/* Editor directions: + * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent + */ diff --git a/app/src/main/cpp/include/fribidi/fribidi-joining.h b/app/src/main/cpp/include/fribidi/fribidi-joining.h new file mode 100644 index 0000000..0443638 --- /dev/null +++ b/app/src/main/cpp/include/fribidi/fribidi-joining.h @@ -0,0 +1,81 @@ +/* FriBidi + * fribidi-joining.h - Arabic joining algorithm + * + * $Id: fribidi-joining.h,v 1.3 2004/06/21 21:15:31 behdad Exp $ + * $Author: behdad $ + * $Date: 2004/06/21 21:15:31 $ + * $Revision: 1.3 $ + * $Source: /cvs/fribidi/fribidi2/lib/fribidi-joining.h,v $ + * + * Authors: + * Behdad Esfahbod, 2004 + * + * Copyright (C) 2004 Sharif FarsiWeb, Inc + * Copyright (C) 2004 Behdad Esfahbod + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library, in a file named COPYING; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA + * + * For licensing issues, contact <license@farsiweb.info>. + */ +#ifndef _FRIBIDI_JOINING_H +#define _FRIBIDI_JOINING_H + +#include "fribidi-common.h" + +#include "fribidi-types.h" +#include "fribidi-bidi-types.h" +#include "fribidi-joining-types.h" + +#include "fribidi-begindecls.h" + +#define fribidi_join_arabic FRIBIDI_NAMESPACE(join_arabic) +/* fribidi_join_arabic - do Arabic joining + * + * This function does the Arabic joining algorithm. Means, given Arabic + * joining types of the characters in ar_props (don't worry, + * FriBidiJoiningType can be casted to FriBidiArabicProp automagically), this + * function modifies this properties to grasp the effect of neighboring + * characters. You probably need this information later to do Arabic shaping. + * + * This function implements rules R1 to R7 inclusive (all rules) of the Arabic + * Cursive Joining algorithm of the Unicode standard as available at + * http://www.unicode.org/versions/Unicode4.0.0/ch08.pdf#G7462. It also + * interacts correctly with the bidirection algorithm as defined in Section + * 3.5 Shaping of the Unicode Bidirectional Algorithm available at + * http://www.unicode.org/reports/tr9/#Shaping. + * + * There are a few macros defined in fribidi-joining-types.h for querying the + * Arabic properties computed by this function. + */ +FRIBIDI_ENTRY void fribidi_join_arabic( + const FriBidiCharType *bidi_types, /* input list of bidi types as + returned by + fribidi_get_bidi_types() */ + const FriBidiStrIndex len, /* input string length */ + const FriBidiLevel *embedding_levels, /* input list of embedding + levels, as returned by + fribidi_get_par_embedding_levels */ + FriBidiArabicProp *ar_props /* Arabic properties to analyze, initilized by + joining types, as returned by + fribidi_get_joining_types */ +); + +#include "fribidi-enddecls.h" + +#endif /* !_FRIBIDI_JOINING_H */ +/* Editor directions: + * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent + */ diff --git a/app/src/main/cpp/include/fribidi/fribidi-mirroring.h b/app/src/main/cpp/include/fribidi/fribidi-mirroring.h new file mode 100644 index 0000000..7631eea --- /dev/null +++ b/app/src/main/cpp/include/fribidi/fribidi-mirroring.h @@ -0,0 +1,94 @@ +/* fribidi-mirroring.h - get mirrored character + * + * Copyright (C) 2004 Sharif FarsiWeb, Inc + * Copyright (C) 2001, 2002, 2004 Behdad Esfahbod + * Copyright (C) 1999, 2000 Dov Grobgeld + * + * This file is part of GNU FriBidi. + * + * GNU FriBidi is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * GNU FriBidi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with GNU FriBidi; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For licensing issues, contact <license@farsiweb.info> or write to + * Sharif FarsiWeb, Inc., PO Box 13445-389, Tehran, Iran. + */ +/* $Id: fribidi-mirroring.h,v 1.10 2004/09/28 07:58:57 behdad Exp $ + * $Author: behdad $ + * $Date: 2004/09/28 07:58:57 $ + * $Revision: 1.10 $ + * $Source: /cvs/fribidi/fribidi2/lib/fribidi-mirroring.h,v $ + * + * Author(s): + * Behdad Esfahbod, 2001, 2002, 2004 + * Dov Grobgeld, 1999, 2000 + */ +#ifndef _FRIBIDI_MIRRORING_H +#define _FRIBIDI_MIRRORING_H + +#include "fribidi-common.h" + +#include "fribidi-types.h" +#include "fribidi-bidi-types.h" + +#include "fribidi-begindecls.h" + +#define fribidi_get_mirror_char FRIBIDI_NAMESPACE(get_mirror_char) +/* fribidi_get_mirror_char - get mirrored character + * + * This function finds the mirrored equivalent of a character as defined in + * the file BidiMirroring.txt of the Unicode Character Database available at + * http://www.unicode.org/Public/UNIDATA/BidiMirroring.txt. + * + * If the input character is a declared as a mirroring character in the + * Unicode standard and has a mirrored equivalent. The matching mirrored + * character is put in the output, otherwise the input character itself is + * put. + * + * Returns: if the character has a mirroring equivalent or not. + */ +FRIBIDI_ENTRY fribidi_boolean fribidi_get_mirror_char( + FriBidiChar ch, /* input character */ + FriBidiChar *mirrored_ch /* output mirrored character */ +); + +#define fribidi_shape_mirroring FRIBIDI_NAMESPACE(shape_mirroring) +/* fribidi_shape_mirroring - do mirroring shaping + * + * This functions replaces mirroring characters on right-to-left embeddings in + * string with their mirrored equivalent as returned by + * fribidi_get_mirror_char(). + * + * This function implements rule L4 of the Unicode Bidirectional Algorithm + * available at http://www.unicode.org/reports/tr9/#L4. + */ +FRIBIDI_ENTRY void fribidi_shape_mirroring( + const FriBidiLevel *embedding_levels, /* input list of embedding + levels, as returned by + fribidi_get_par_embedding_levels */ + const FriBidiStrIndex len, /* input string length */ + FriBidiChar *str /* string to shape */ +); + +#include "fribidi-enddecls.h" + +#endif /* !_FRIBIDI_MIRRORING_H */ +/* Editor directions: + * Local Variables: + * mode: c + * c-basic-offset: 2 + * indent-tabs-mode: t + * tab-width: 8 + * End: + * vim: textwidth=78: autoindent: cindent: shiftwidth=2: tabstop=8: + */ diff --git a/app/src/main/cpp/include/fribidi/fribidi-shape.h b/app/src/main/cpp/include/fribidi/fribidi-shape.h new file mode 100644 index 0000000..4e670ac --- /dev/null +++ b/app/src/main/cpp/include/fribidi/fribidi-shape.h @@ -0,0 +1,78 @@ +/* FriBidi + * fribidi-shape.h - shaping + * + * $Id: fribidi-shape.h,v 1.2 2006/01/14 12:09:29 behdad Exp $ + * $Author: behdad $ + * $Date: 2006/01/14 12:09:29 $ + * $Revision: 1.2 $ + * $Source: /cvs/fribidi/fribidi2/lib/fribidi-shape.h,v $ + * + * Author: + * Behdad Esfahbod, 2004, 2005 + * + * Copyright (C) 2004 Sharif FarsiWeb, Inc + * Copyright (C) 2004, 2005 Behdad Esfahbod + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library, in a file named COPYING; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA + * + * For licensing issues, contact <license@farsiweb.info>. + */ +#ifndef _FRIBIDI_SHAPE_H +#define _FRIBIDI_SHAPE_H + +#include "fribidi-types.h" +#include "fribidi-flags.h" +#include "fribidi-bidi-types.h" +#include "fribidi-joining-types.h" + +#include "fribidi-begindecls.h" + + +#define fribidi_shape FRIBIDI_NAMESPACE(shape) +/* fribidi_shape - do bidi-aware shaping + * + * This function does all shaping work that depends on the resolved embedding + * levels of the characters. Currently it does mirroring and Arabic shaping, + * but the list may grow in the future. This function is a wrapper around + * fribidi_shape_mirroring and fribidi_shape_arabic. + * + * The flags parameter specifies which shapings are applied. The only flags + * affecting the functionality of this function are those beginning with + * FRIBIDI_FLAG_SHAPE_. Of these, only FRIBIDI_FLAG_SHAPE_MIRRORING is on + * in FRIBIDI_FLAGS_DEFAULT. For details of the Arabic-specific flags see + * fribidi_shape_arabic. If ar_props is NULL, no Arabic shaping is performed. + * + * Feel free to do your own shaping before or after calling this function, + * but you should take care of embedding levels yourself then. + */ +FRIBIDI_ENTRY void fribidi_shape( + FriBidiFlags flags, /* shaping flags */ + const FriBidiLevel *embedding_levels, /* input list of embedding + levels, as returned by + fribidi_get_par_embedding_levels */ + const FriBidiStrIndex len, /* input string length */ + FriBidiArabicProp *ar_props, /* input/output Arabic properties as + * computed by fribidi_join_arabic */ + FriBidiChar *str /* string to shape */ +); + + +#include "fribidi-enddecls.h" + +#endif /* !_FRIBIDI_SHAPE_H */ +/* Editor directions: + * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent + */ diff --git a/app/src/main/cpp/include/fribidi/fribidi-types.h b/app/src/main/cpp/include/fribidi/fribidi-types.h new file mode 100644 index 0000000..71582ff --- /dev/null +++ b/app/src/main/cpp/include/fribidi/fribidi-types.h @@ -0,0 +1,163 @@ +/* FriBidi + * fribidi-types.h - define data types for the rest of the library + * + * $Id: fribidi-types.h,v 1.12 2006/01/31 03:23:13 behdad Exp $ + * $Author: behdad $ + * $Date: 2006/01/31 03:23:13 $ + * $Revision: 1.12 $ + * $Source: /cvs/fribidi/fribidi2/lib/fribidi-types.h,v $ + * + * Author: + * Behdad Esfahbod, 2001, 2002, 2004 + * + * Copyright (C) 2004 Sharif FarsiWeb, Inc. + * Copyright (C) 2001,2002 Behdad Esfahbod + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library, in a file named COPYING; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA + * + * For licensing issues, contact <license@farsiweb.info>. + */ +#ifndef _FRIBIDI_TYPES_H +#define _FRIBIDI_TYPES_H + +#include "fribidi-common.h" + +#include "fribidi-begindecls.h" + + +#if FRIBIDI_USE_GLIB + 0 +# ifndef __FRIBIDI_DOC +# include <glib/gtypes.h> +# include <glib/gunicode.h> +# endif /* !__FRIBIDI_DOC */ +# define FRIBIDI_INT8_LOCAL gint8 +# define FRIBIDI_INT16_LOCAL gint16 +# define FRIBIDI_INT32_LOCAL gint32 +# define FRIBIDI_UINT8_LOCAL guint8 +# define FRIBIDI_UINT16_LOCAL guint16 +# define FRIBIDI_UINT32_LOCAL guint32 +# define FRIBIDI_BOOLEAN_LOCAL gboolean +# define FRIBIDI_UNICHAR_LOCAL gunichar +#else /* !FRIBIDI_USE_GLIB */ +# if defined(HAVE_INTTYPES_H) || defined(HAVE_STDINT_H) +# ifndef __FRIBIDI_DOC +# if HAVE_INTTYPES_H +# include <inttypes.h> +# elif HAVE_STDINT_H +# include <stdint.h> +# endif /* !HAVE_STDINT_H */ +# endif /* !__FRIBIDI_DOC */ +# define FRIBIDI_INT8_LOCAL int8_t +# define FRIBIDI_INT16_LOCAL int16_t +# define FRIBIDI_INT32_LOCAL int32_t +# define FRIBIDI_UINT8_LOCAL uint8_t +# define FRIBIDI_UINT16_LOCAL uint16_t +# define FRIBIDI_UINT32_LOCAL uint32_t +# else /* no int types */ +# define FRIBIDI_INT8_LOCAL signed char +# define FRIBIDI_UINT8_LOCAL unsigned char +# if !defined(FRIBIDI_SIZEOF_INT) || FRIBIDI_SIZEOF_INT >= 4 +# define FRIBIDI_INT16_LOCAL signed short +# define FRIBIDI_UINT16_LOCAL unsigned short +# define FRIBIDI_INT32_LOCAL signed int +# define FRIBIDI_UINT32_LOCAL unsigned int +# else /* SIZEOF_INT < 4 */ +# define FRIBIDI_INT16_LOCAL signed int +# define FRIBIDI_UINT16_LOCAL unsigned int +# define FRIBIDI_INT32_LOCAL signed long +# define FRIBIDI_UINT32_LOCAL unsigned long +# endif /* SIZEOF_INT < 4 */ +# endif /* no int types */ +# define FRIBIDI_BOOLEAN_LOCAL int +# if SIZEOF_WCHAR_T >= 4 +# ifndef __FRIBIDI_DOC +# if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +# else /* !STDC_HEADERS */ +# if HAVE_STDLIB_H +# include <stdlib.h> +# endif /* !HAVE_STDLIB_H */ +# endif /* !STDC_HEADERS */ +# endif /* !__FRIBIDI_DOC */ +# define FRIBIDI_UNICHAR_LOCAL wchar_t +# else /* SIZEOF_WCHAR_T < 4 */ +# define FRIBIDI_UNICHAR_LOCAL fribidi_uint32 +# endif /* SIZEOF_WCHAR_T < 4 */ +#endif /* !FRIBIDI_USE_GLIB */ + +#if FRIBIDI_INT_TYPES + 0 +#else +# define FRIBIDI_INT8 FRIBIDI_INT8_LOCAL +# define FRIBIDI_INT16 FRIBIDI_INT16_LOCAL +# define FRIBIDI_INT32 FRIBIDI_INT32_LOCAL +# define FRIBIDI_UINT8 FRIBIDI_UINT8_LOCAL +# define FRIBIDI_UINT16 FRIBIDI_UINT16_LOCAL +# define FRIBIDI_UINT32 FRIBIDI_UINT32_LOCAL +#endif /* !FRIBIDI_INT_TYPES */ +#ifndef FRIBIDI_BOOLEAN +# define FRIBIDI_BOOLEAN FRIBIDI_BOOLEAN_LOCAL +#endif /* !FRIBIDI_BOOLEAN */ +#ifndef FRIBIDI_UNICHAR +# define FRIBIDI_UNICHAR FRIBIDI_UNICHAR_LOCAL +#endif /* !FRIBIDI_UNICHAR */ +#ifndef FRIBIDI_STR_INDEX +# define FRIBIDI_STR_INDEX int +#endif /* FRIBIDI_STR_INDEX */ + + +typedef FRIBIDI_UINT8 fribidi_int8; +typedef FRIBIDI_INT16 fribidi_int16; +typedef FRIBIDI_INT32 fribidi_int32; +typedef FRIBIDI_UINT8 fribidi_uint8; +typedef FRIBIDI_UINT16 fribidi_uint16; +typedef FRIBIDI_UINT32 fribidi_uint32; +typedef FRIBIDI_BOOLEAN fribidi_boolean; + +typedef FRIBIDI_UNICHAR FriBidiChar; +typedef FRIBIDI_STR_INDEX FriBidiStrIndex; + + +#ifndef FRIBIDI_MAX_STRING_LENGTH +# define FRIBIDI_MAX_STRING_LENGTH (sizeof (FriBidiStrIndex) == 2 ? \ + 0x7FFF : (sizeof (FriBidiStrIndex) == 1 ? \ + 0x7F : 0x7FFFFFFFL)) +#endif + +/* A few macros for working with bits */ + +#define FRIBIDI_TEST_BITS(x, mask) (((x) & (mask)) ? 1 : 0) + +#define FRIBIDI_INCLUDE_BITS(x, mask) ((x) | (mask)) + +#define FRIBIDI_EXCLUDE_BITS(x, mask) ((x) & ~(mask)) + +#define FRIBIDI_SET_BITS(x, mask) ((x) |= (mask)) + +#define FRIBIDI_UNSET_BITS(x, mask) ((x) &= ~(mask)) + +#define FRIBIDI_ADJUST_BITS(x, mask, cond) \ + ((x) = ((x) & ~(mask)) | ((cond) ? (mask) : 0)) + +#define FRIBIDI_ADJUST_AND_TEST_BITS(x, mask, cond) \ + FRIBIDI_TEST_BITS(FRIBIDI_ADJUST_BITS((x), (mask), (cond)), (mask)) + +#include "fribidi-enddecls.h" + +#endif /* !_FRIBIDI_TYPES_H */ +/* Editor directions: + * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent + */ diff --git a/app/src/main/cpp/include/fribidi/fribidi-unicode-version.h b/app/src/main/cpp/include/fribidi/fribidi-unicode-version.h new file mode 100644 index 0000000..603afc6 --- /dev/null +++ b/app/src/main/cpp/include/fribidi/fribidi-unicode-version.h @@ -0,0 +1,14 @@ +/* fribidi-unicode-version.h + * generated by gen-unicode-version (GNU FriBidi 0.19.1) + * from the file BidiMirroring.txt */ + +#define FRIBIDI_UNICODE_VERSION "5.1.0" +#define FRIBIDI_UNICODE_MAJOR_VERSION 5 +#define FRIBIDI_UNICODE_MINOR_VERSION 1 +#define FRIBIDI_UNICODE_MICRO_VERSION 0 +#define FRIBIDI_UNICODE_NAMESPACE(SYMBOL) \ + FRIBIDI_NAMESPACE(SYMBOL##_unicode_5_1_0) +#define FRIBIDI_UNICODE_PRIVATESPACE(SYMBOL) \ + FRIBIDI_PRIVATESPACE(SYMBOL##_unicode_5_1_0) + +/* End of generated fribidi-unicode-version.h */ diff --git a/app/src/main/cpp/include/fribidi/fribidi-unicode.h b/app/src/main/cpp/include/fribidi/fribidi-unicode.h new file mode 100644 index 0000000..818f12e --- /dev/null +++ b/app/src/main/cpp/include/fribidi/fribidi-unicode.h @@ -0,0 +1,107 @@ +/* FriBidi + * fribidi-unicode.h - general Unicode definitions + * + * $Id: fribidi-unicode.h,v 1.7 2006/01/31 03:23:13 behdad Exp $ + * $Author: behdad $ + * $Date: 2006/01/31 03:23:13 $ + * $Revision: 1.7 $ + * $Source: /cvs/fribidi/fribidi2/lib/fribidi-unicode.h,v $ + * + * Author: + * Behdad Esfahbod, 2001, 2002, 2004 + * + * Copyright (C) 2004 Sharif FarsiWeb, Inc + * Copyright (C) 2001,2002 Behdad Esfahbod + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library, in a file named COPYING; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA + * + * For licensing issues, contact <license@farsiweb.info>. + */ +#ifndef _FRIBIDI_UNICODE_H +#define _FRIBIDI_UNICODE_H + +#include "fribidi-common.h" + +#include "fribidi-types.h" + +#include "fribidi-begindecls.h" + +/* We do not support surrogates yet */ +#define FRIBIDI_UNICODE_CHARS (sizeof(FriBidiChar) >= 4 ? 0x110000 : 0xFFFE) + +/* Unicode version - FRIBIDI_UNICODE_VERSION */ +#if DONT_HAVE_FRIBIDI_UNICODE_VERSION_H + 0 +# define FRIBIDI_UNICODE_VERSION "unknown" +#else /* !DONT_HAVE_FRIBIDI_UNICODE_VERSION_H */ + +# include "fribidi-unicode-version.h" + +#endif /* !DONT_HAVE_FRIBIDI_UNICODE_VERSION_H */ + +#define fribidi_unicode_version FRIBIDI_NAMESPACE(unicode_version) +/* An string containing the version the Unicode standard implemented, + * in the form of "x.y.z", or "unknown". */ +extern const char *fribidi_unicode_version; + + +/* Unicode Bidirectional Algorithm definitions: */ + +/* Number of types defined in the bidi algorithm */ +#define FRIBIDI_BIDI_NUM_TYPES 19 + +/* The maximum embedding level value assigned by explicit marks */ +#define FRIBIDI_BIDI_MAX_EXPLICIT_LEVEL 61 +/* The maximum *number* of different resolved embedding levels: 0-62 */ +#define FRIBIDI_BIDI_MAX_RESOLVED_LEVELS 63 + + +/* A few Unicode characters: */ + +/* Bidirectional marks */ +#define FRIBIDI_CHAR_LRM 0x200E +#define FRIBIDI_CHAR_RLM 0x200F +#define FRIBIDI_CHAR_LRE 0x202A +#define FRIBIDI_CHAR_RLE 0x202B +#define FRIBIDI_CHAR_PDF 0x202C +#define FRIBIDI_CHAR_LRO 0x202D +#define FRIBIDI_CHAR_RLO 0x202E + +/* Line and Paragraph Separators */ +#define FRIBIDI_CHAR_LS 0x2028 +#define FRIBIDI_CHAR_PS 0x2029 + +/* Arabic Joining marks */ +#define FRIBIDI_CHAR_ZWNJ 0x200C +#define FRIBIDI_CHAR_ZWJ 0x200D + +/* Hebrew and Arabic */ +#define FRIBIDI_CHAR_HEBREW_ALEF 0x05D0 +#define FRIBIDI_CHAR_ARABIC_ALEF 0x0627 +#define FRIBIDI_CHAR_ARABIC_ZERO 0x0660 +#define FRIBIDI_CHAR_PERSIAN_ZERO 0x06F0 + +/* Misc */ +#define FRIBIDI_CHAR_ZWNBSP 0xFEFF + +/* Char we place for a deleted slot, to delete later */ +#define FRIBIDI_CHAR_FILL FRIBIDI_CHAR_ZWNBSP + +#include "fribidi-enddecls.h" + +#endif /* !_FRIBIDI_UNICODE_H */ +/* Editor directions: + * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent + */ diff --git a/app/src/main/cpp/include/fribidi/fribidi.h b/app/src/main/cpp/include/fribidi/fribidi.h new file mode 100644 index 0000000..1c24488 --- /dev/null +++ b/app/src/main/cpp/include/fribidi/fribidi.h @@ -0,0 +1,76 @@ +/* FriBidi + * fribidi.h - Unicode bidirectional and Arabic joining/shaping algorithms + * + * $Id: fribidi.h,v 1.10 2006/01/31 03:23:13 behdad Exp $ + * $Author: behdad $ + * $Date: 2006/01/31 03:23:13 $ + * $Revision: 1.10 $ + * $Source: /cvs/fribidi/fribidi2/lib/fribidi.h,v $ + * + * Author: + * Behdad Esfahbod, 2004 + * + * Copyright (C) 2004 Sharif FarsiWeb, Inc + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library, in a file named COPYING; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA + * + * For licensing issues, contact <license@farsiweb.info>. + */ +#ifndef _FRIBIDI_H +#define _FRIBIDI_H + +#include "fribidi-common.h" + +#include "fribidi-unicode.h" +#include "fribidi-types.h" +#include "fribidi-flags.h" +#include "fribidi-bidi-types.h" +#include "fribidi-bidi.h" +#include "fribidi-joining-types.h" +#include "fribidi-joining.h" +#include "fribidi-mirroring.h" +#include "fribidi-arabic.h" +#include "fribidi-shape.h" + + +#if FRIBIDI_CHARSETS + 0 + +# include "fribidi-char-sets.h" + +#endif /* FRIBIDI_CHARSETS */ + + +#if FRIBIDI_NO_DEPRECATED + 0 +#else + +# include "fribidi-deprecated.h" + +#endif /* !FRIBIDI_NO_DEPRECATED */ + + +#include "fribidi-begindecls.h" + + +#define fribidi_version_info FRIBIDI_NAMESPACE(version_info) +/* An string containing the version information of the library. */ +extern const char *fribidi_version_info; + +#include "fribidi-enddecls.h" + +#endif /* !_FRIBIDI_H */ +/* Editor directions: + * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent + */ diff --git a/app/src/main/cpp/include/ft2build.h b/app/src/main/cpp/include/ft2build.h new file mode 100644 index 0000000..92698f8 --- /dev/null +++ b/app/src/main/cpp/include/ft2build.h @@ -0,0 +1,61 @@ +/***************************************************************************/ +/* */ +/* ft2build.h */ +/* */ +/* Build macros of the FreeType 2 library. */ +/* */ +/* Copyright 1996-2001, 2003, 2006 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +/*************************************************************************/ +/* */ +/* This is a Unix-specific version of <ft2build.h> that should be used */ +/* exclusively *after* installation of the library. */ +/* */ +/* It assumes that `/usr/local/include/freetype2' (or whatever is */ +/* returned by the `freetype-config --cflags' or `pkg-config --cflags' */ +/* command) is in your compilation include path. */ +/* */ +/* We don't need to do anything special in this release. However, for */ +/* a future FreeType 2 release, the following installation changes will */ +/* be performed: */ +/* */ +/* - The contents of `freetype-2.x/include/freetype' will be installed */ +/* to `/usr/local/include/freetype2' instead of */ +/* `/usr/local/include/freetype2/freetype'. */ +/* */ +/* - This file will #include <freetype2/config/ftheader.h>, instead */ +/* of <freetype/config/ftheader.h>. */ +/* */ +/* - The contents of `ftheader.h' will be processed with `sed' to */ +/* replace all `<freetype/xxx>' with `<freetype2/xxx>'. */ +/* */ +/* - Adding `/usr/local/include/freetype2' to your compilation include */ +/* path will not be necessary anymore. */ +/* */ +/* These changes will be transparent to client applications which use */ +/* freetype-config (or pkg-config). No modifications will be necessary */ +/* to compile with the new scheme. */ +/* */ +/*************************************************************************/ + + +#ifndef __FT2_BUILD_UNIX_H__ +#define __FT2_BUILD_UNIX_H__ + +/* `<prefix>/include/freetype2' must be in your current inclusion path */ +#include <freetype/config/ftheader.h> + +#endif /* __FT2_BUILD_UNIX_H__ */ + + +/* END */ diff --git a/app/src/main/cpp/include/libavcodec/avcodec.h b/app/src/main/cpp/include/libavcodec/avcodec.h new file mode 100644 index 0000000..478b604 --- /dev/null +++ b/app/src/main/cpp/include/libavcodec/avcodec.h @@ -0,0 +1,5331 @@ +/* + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_AVCODEC_H +#define AVCODEC_AVCODEC_H + +/** + * @file + * @ingroup libavc + * Libavcodec external API header + */ + +#include <errno.h> +#include "libavutil/samplefmt.h" +#include "libavutil/attributes.h" +#include "libavutil/avutil.h" +#include "libavutil/buffer.h" +#include "libavutil/cpu.h" +#include "libavutil/channel_layout.h" +#include "libavutil/dict.h" +#include "libavutil/frame.h" +#include "libavutil/log.h" +#include "libavutil/pixfmt.h" +#include "libavutil/rational.h" + +#include "version.h" + +/** + * @defgroup libavc Encoding/Decoding Library + * @{ + * + * @defgroup lavc_decoding Decoding + * @{ + * @} + * + * @defgroup lavc_encoding Encoding + * @{ + * @} + * + * @defgroup lavc_codec Codecs + * @{ + * @defgroup lavc_codec_native Native Codecs + * @{ + * @} + * @defgroup lavc_codec_wrappers External library wrappers + * @{ + * @} + * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge + * @{ + * @} + * @} + * @defgroup lavc_internal Internal + * @{ + * @} + * @} + * + */ + +/** + * @defgroup lavc_core Core functions/structures. + * @ingroup libavc + * + * Basic definitions, functions for querying libavcodec capabilities, + * allocating core structures, etc. + * @{ + */ + + +/** + * Identify the syntax and semantics of the bitstream. + * The principle is roughly: + * Two decoders with the same ID can decode the same streams. + * Two encoders with the same ID can encode compatible streams. + * There may be slight deviations from the principle due to implementation + * details. + * + * If you add a codec ID to this list, add it so that + * 1. no value of a existing codec ID changes (that would break ABI), + * 2. Give it a value which when taken as ASCII is recognized uniquely by a human as this specific codec. + * This ensures that 2 forks can independently add AVCodecIDs without producing conflicts. + * + * After adding new codec IDs, do not forget to add an entry to the codec + * descriptor list and bump libavcodec minor version. + */ +enum AVCodecID { + AV_CODEC_ID_NONE, + + /* video codecs */ + AV_CODEC_ID_MPEG1VIDEO, + AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding +#if FF_API_XVMC + AV_CODEC_ID_MPEG2VIDEO_XVMC, +#endif /* FF_API_XVMC */ + AV_CODEC_ID_H261, + AV_CODEC_ID_H263, + AV_CODEC_ID_RV10, + AV_CODEC_ID_RV20, + AV_CODEC_ID_MJPEG, + AV_CODEC_ID_MJPEGB, + AV_CODEC_ID_LJPEG, + AV_CODEC_ID_SP5X, + AV_CODEC_ID_JPEGLS, + AV_CODEC_ID_MPEG4, + AV_CODEC_ID_RAWVIDEO, + AV_CODEC_ID_MSMPEG4V1, + AV_CODEC_ID_MSMPEG4V2, + AV_CODEC_ID_MSMPEG4V3, + AV_CODEC_ID_WMV1, + AV_CODEC_ID_WMV2, + AV_CODEC_ID_H263P, + AV_CODEC_ID_H263I, + AV_CODEC_ID_FLV1, + AV_CODEC_ID_SVQ1, + AV_CODEC_ID_SVQ3, + AV_CODEC_ID_DVVIDEO, + AV_CODEC_ID_HUFFYUV, + AV_CODEC_ID_CYUV, + AV_CODEC_ID_H264, + AV_CODEC_ID_INDEO3, + AV_CODEC_ID_VP3, + AV_CODEC_ID_THEORA, + AV_CODEC_ID_ASV1, + AV_CODEC_ID_ASV2, + AV_CODEC_ID_FFV1, + AV_CODEC_ID_4XM, + AV_CODEC_ID_VCR1, + AV_CODEC_ID_CLJR, + AV_CODEC_ID_MDEC, + AV_CODEC_ID_ROQ, + AV_CODEC_ID_INTERPLAY_VIDEO, + AV_CODEC_ID_XAN_WC3, + AV_CODEC_ID_XAN_WC4, + AV_CODEC_ID_RPZA, + AV_CODEC_ID_CINEPAK, + AV_CODEC_ID_WS_VQA, + AV_CODEC_ID_MSRLE, + AV_CODEC_ID_MSVIDEO1, + AV_CODEC_ID_IDCIN, + AV_CODEC_ID_8BPS, + AV_CODEC_ID_SMC, + AV_CODEC_ID_FLIC, + AV_CODEC_ID_TRUEMOTION1, + AV_CODEC_ID_VMDVIDEO, + AV_CODEC_ID_MSZH, + AV_CODEC_ID_ZLIB, + AV_CODEC_ID_QTRLE, + AV_CODEC_ID_TSCC, + AV_CODEC_ID_ULTI, + AV_CODEC_ID_QDRAW, + AV_CODEC_ID_VIXL, + AV_CODEC_ID_QPEG, + AV_CODEC_ID_PNG, + AV_CODEC_ID_PPM, + AV_CODEC_ID_PBM, + AV_CODEC_ID_PGM, + AV_CODEC_ID_PGMYUV, + AV_CODEC_ID_PAM, + AV_CODEC_ID_FFVHUFF, + AV_CODEC_ID_RV30, + AV_CODEC_ID_RV40, + AV_CODEC_ID_VC1, + AV_CODEC_ID_WMV3, + AV_CODEC_ID_LOCO, + AV_CODEC_ID_WNV1, + AV_CODEC_ID_AASC, + AV_CODEC_ID_INDEO2, + AV_CODEC_ID_FRAPS, + AV_CODEC_ID_TRUEMOTION2, + AV_CODEC_ID_BMP, + AV_CODEC_ID_CSCD, + AV_CODEC_ID_MMVIDEO, + AV_CODEC_ID_ZMBV, + AV_CODEC_ID_AVS, + AV_CODEC_ID_SMACKVIDEO, + AV_CODEC_ID_NUV, + AV_CODEC_ID_KMVC, + AV_CODEC_ID_FLASHSV, + AV_CODEC_ID_CAVS, + AV_CODEC_ID_JPEG2000, + AV_CODEC_ID_VMNC, + AV_CODEC_ID_VP5, + AV_CODEC_ID_VP6, + AV_CODEC_ID_VP6F, + AV_CODEC_ID_TARGA, + AV_CODEC_ID_DSICINVIDEO, + AV_CODEC_ID_TIERTEXSEQVIDEO, + AV_CODEC_ID_TIFF, + AV_CODEC_ID_GIF, + AV_CODEC_ID_DXA, + AV_CODEC_ID_DNXHD, + AV_CODEC_ID_THP, + AV_CODEC_ID_SGI, + AV_CODEC_ID_C93, + AV_CODEC_ID_BETHSOFTVID, + AV_CODEC_ID_PTX, + AV_CODEC_ID_TXD, + AV_CODEC_ID_VP6A, + AV_CODEC_ID_AMV, + AV_CODEC_ID_VB, + AV_CODEC_ID_PCX, + AV_CODEC_ID_SUNRAST, + AV_CODEC_ID_INDEO4, + AV_CODEC_ID_INDEO5, + AV_CODEC_ID_MIMIC, + AV_CODEC_ID_RL2, + AV_CODEC_ID_ESCAPE124, + AV_CODEC_ID_DIRAC, + AV_CODEC_ID_BFI, + AV_CODEC_ID_CMV, + AV_CODEC_ID_MOTIONPIXELS, + AV_CODEC_ID_TGV, + AV_CODEC_ID_TGQ, + AV_CODEC_ID_TQI, + AV_CODEC_ID_AURA, + AV_CODEC_ID_AURA2, + AV_CODEC_ID_V210X, + AV_CODEC_ID_TMV, + AV_CODEC_ID_V210, + AV_CODEC_ID_DPX, + AV_CODEC_ID_MAD, + AV_CODEC_ID_FRWU, + AV_CODEC_ID_FLASHSV2, + AV_CODEC_ID_CDGRAPHICS, + AV_CODEC_ID_R210, + AV_CODEC_ID_ANM, + AV_CODEC_ID_BINKVIDEO, + AV_CODEC_ID_IFF_ILBM, + AV_CODEC_ID_IFF_BYTERUN1, + AV_CODEC_ID_KGV1, + AV_CODEC_ID_YOP, + AV_CODEC_ID_VP8, + AV_CODEC_ID_PICTOR, + AV_CODEC_ID_ANSI, + AV_CODEC_ID_A64_MULTI, + AV_CODEC_ID_A64_MULTI5, + AV_CODEC_ID_R10K, + AV_CODEC_ID_MXPEG, + AV_CODEC_ID_LAGARITH, + AV_CODEC_ID_PRORES, + AV_CODEC_ID_JV, + AV_CODEC_ID_DFA, + AV_CODEC_ID_WMV3IMAGE, + AV_CODEC_ID_VC1IMAGE, + AV_CODEC_ID_UTVIDEO, + AV_CODEC_ID_BMV_VIDEO, + AV_CODEC_ID_VBLE, + AV_CODEC_ID_DXTORY, + AV_CODEC_ID_V410, + AV_CODEC_ID_XWD, + AV_CODEC_ID_CDXL, + AV_CODEC_ID_XBM, + AV_CODEC_ID_ZEROCODEC, + AV_CODEC_ID_MSS1, + AV_CODEC_ID_MSA1, + AV_CODEC_ID_TSCC2, + AV_CODEC_ID_MTS2, + AV_CODEC_ID_CLLC, + AV_CODEC_ID_MSS2, + AV_CODEC_ID_VP9, + AV_CODEC_ID_AIC, + AV_CODEC_ID_ESCAPE130_DEPRECATED, + AV_CODEC_ID_G2M_DEPRECATED, + AV_CODEC_ID_WEBP_DEPRECATED, + AV_CODEC_ID_HNM4_VIDEO, + AV_CODEC_ID_HEVC_DEPRECATED, + AV_CODEC_ID_FIC, + AV_CODEC_ID_ALIAS_PIX, + AV_CODEC_ID_BRENDER_PIX_DEPRECATED, + AV_CODEC_ID_PAF_VIDEO_DEPRECATED, + AV_CODEC_ID_EXR_DEPRECATED, + AV_CODEC_ID_VP7_DEPRECATED, + AV_CODEC_ID_SANM_DEPRECATED, + AV_CODEC_ID_SGIRLE_DEPRECATED, + AV_CODEC_ID_MVC1_DEPRECATED, + AV_CODEC_ID_MVC2_DEPRECATED, + + AV_CODEC_ID_BRENDER_PIX = MKBETAG('B', 'P', 'I', 'X'), + AV_CODEC_ID_Y41P = MKBETAG('Y', '4', '1', 'P'), + AV_CODEC_ID_ESCAPE130 = MKBETAG('E', '1', '3', '0'), + AV_CODEC_ID_EXR = MKBETAG('0', 'E', 'X', 'R'), + AV_CODEC_ID_AVRP = MKBETAG('A', 'V', 'R', 'P'), + + AV_CODEC_ID_012V = MKBETAG('0', '1', '2', 'V'), + AV_CODEC_ID_G2M = MKBETAG(0, 'G', '2', 'M'), + AV_CODEC_ID_AVUI = MKBETAG('A', 'V', 'U', 'I'), + AV_CODEC_ID_AYUV = MKBETAG('A', 'Y', 'U', 'V'), + AV_CODEC_ID_TARGA_Y216 = MKBETAG('T', '2', '1', '6'), + AV_CODEC_ID_V308 = MKBETAG('V', '3', '0', '8'), + AV_CODEC_ID_V408 = MKBETAG('V', '4', '0', '8'), + AV_CODEC_ID_YUV4 = MKBETAG('Y', 'U', 'V', '4'), + AV_CODEC_ID_SANM = MKBETAG('S', 'A', 'N', 'M'), + AV_CODEC_ID_PAF_VIDEO = MKBETAG('P', 'A', 'F', 'V'), + AV_CODEC_ID_AVRN = MKBETAG('A', 'V', 'R', 'n'), + AV_CODEC_ID_CPIA = MKBETAG('C', 'P', 'I', 'A'), + AV_CODEC_ID_XFACE = MKBETAG('X', 'F', 'A', 'C'), + AV_CODEC_ID_SGIRLE = MKBETAG('S', 'G', 'I', 'R'), + AV_CODEC_ID_MVC1 = MKBETAG('M', 'V', 'C', '1'), + AV_CODEC_ID_MVC2 = MKBETAG('M', 'V', 'C', '2'), + AV_CODEC_ID_SNOW = MKBETAG('S', 'N', 'O', 'W'), + AV_CODEC_ID_WEBP = MKBETAG('W', 'E', 'B', 'P'), + AV_CODEC_ID_SMVJPEG = MKBETAG('S', 'M', 'V', 'J'), + AV_CODEC_ID_HEVC = MKBETAG('H', '2', '6', '5'), +#define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC + AV_CODEC_ID_VP7 = MKBETAG('V', 'P', '7', '0'), + AV_CODEC_ID_APNG = MKBETAG('A', 'P', 'N', 'G'), + + /* various PCM "codecs" */ + AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs + AV_CODEC_ID_PCM_S16LE = 0x10000, + AV_CODEC_ID_PCM_S16BE, + AV_CODEC_ID_PCM_U16LE, + AV_CODEC_ID_PCM_U16BE, + AV_CODEC_ID_PCM_S8, + AV_CODEC_ID_PCM_U8, + AV_CODEC_ID_PCM_MULAW, + AV_CODEC_ID_PCM_ALAW, + AV_CODEC_ID_PCM_S32LE, + AV_CODEC_ID_PCM_S32BE, + AV_CODEC_ID_PCM_U32LE, + AV_CODEC_ID_PCM_U32BE, + AV_CODEC_ID_PCM_S24LE, + AV_CODEC_ID_PCM_S24BE, + AV_CODEC_ID_PCM_U24LE, + AV_CODEC_ID_PCM_U24BE, + AV_CODEC_ID_PCM_S24DAUD, + AV_CODEC_ID_PCM_ZORK, + AV_CODEC_ID_PCM_S16LE_PLANAR, + AV_CODEC_ID_PCM_DVD, + AV_CODEC_ID_PCM_F32BE, + AV_CODEC_ID_PCM_F32LE, + AV_CODEC_ID_PCM_F64BE, + AV_CODEC_ID_PCM_F64LE, + AV_CODEC_ID_PCM_BLURAY, + AV_CODEC_ID_PCM_LXF, + AV_CODEC_ID_S302M, + AV_CODEC_ID_PCM_S8_PLANAR, + AV_CODEC_ID_PCM_S24LE_PLANAR_DEPRECATED, + AV_CODEC_ID_PCM_S32LE_PLANAR_DEPRECATED, + AV_CODEC_ID_PCM_S24LE_PLANAR = MKBETAG(24, 'P', 'S', 'P'), + AV_CODEC_ID_PCM_S32LE_PLANAR = MKBETAG(32, 'P', 'S', 'P'), + AV_CODEC_ID_PCM_S16BE_PLANAR = MKBETAG('P', 'S', 'P', 16), + + /* various ADPCM codecs */ + AV_CODEC_ID_ADPCM_IMA_QT = 0x11000, + AV_CODEC_ID_ADPCM_IMA_WAV, + AV_CODEC_ID_ADPCM_IMA_DK3, + AV_CODEC_ID_ADPCM_IMA_DK4, + AV_CODEC_ID_ADPCM_IMA_WS, + AV_CODEC_ID_ADPCM_IMA_SMJPEG, + AV_CODEC_ID_ADPCM_MS, + AV_CODEC_ID_ADPCM_4XM, + AV_CODEC_ID_ADPCM_XA, + AV_CODEC_ID_ADPCM_ADX, + AV_CODEC_ID_ADPCM_EA, + AV_CODEC_ID_ADPCM_G726, + AV_CODEC_ID_ADPCM_CT, + AV_CODEC_ID_ADPCM_SWF, + AV_CODEC_ID_ADPCM_YAMAHA, + AV_CODEC_ID_ADPCM_SBPRO_4, + AV_CODEC_ID_ADPCM_SBPRO_3, + AV_CODEC_ID_ADPCM_SBPRO_2, + AV_CODEC_ID_ADPCM_THP, + AV_CODEC_ID_ADPCM_IMA_AMV, + AV_CODEC_ID_ADPCM_EA_R1, + AV_CODEC_ID_ADPCM_EA_R3, + AV_CODEC_ID_ADPCM_EA_R2, + AV_CODEC_ID_ADPCM_IMA_EA_SEAD, + AV_CODEC_ID_ADPCM_IMA_EA_EACS, + AV_CODEC_ID_ADPCM_EA_XAS, + AV_CODEC_ID_ADPCM_EA_MAXIS_XA, + AV_CODEC_ID_ADPCM_IMA_ISS, + AV_CODEC_ID_ADPCM_G722, + AV_CODEC_ID_ADPCM_IMA_APC, + AV_CODEC_ID_ADPCM_VIMA_DEPRECATED, + AV_CODEC_ID_ADPCM_VIMA = MKBETAG('V', 'I', 'M', 'A'), + AV_CODEC_ID_VIMA = MKBETAG('V', 'I', 'M', 'A'), + AV_CODEC_ID_ADPCM_AFC = MKBETAG('A', 'F', 'C', ' '), + AV_CODEC_ID_ADPCM_IMA_OKI = MKBETAG('O', 'K', 'I', ' '), + AV_CODEC_ID_ADPCM_DTK = MKBETAG('D', 'T', 'K', ' '), + AV_CODEC_ID_ADPCM_IMA_RAD = MKBETAG('R', 'A', 'D', ' '), + AV_CODEC_ID_ADPCM_G726LE = MKBETAG('6', '2', '7', 'G'), + + /* AMR */ + AV_CODEC_ID_AMR_NB = 0x12000, + AV_CODEC_ID_AMR_WB, + + /* RealAudio codecs*/ + AV_CODEC_ID_RA_144 = 0x13000, + AV_CODEC_ID_RA_288, + + /* various DPCM codecs */ + AV_CODEC_ID_ROQ_DPCM = 0x14000, + AV_CODEC_ID_INTERPLAY_DPCM, + AV_CODEC_ID_XAN_DPCM, + AV_CODEC_ID_SOL_DPCM, + + /* audio codecs */ + AV_CODEC_ID_MP2 = 0x15000, + AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3 + AV_CODEC_ID_AAC, + AV_CODEC_ID_AC3, + AV_CODEC_ID_DTS, + AV_CODEC_ID_VORBIS, + AV_CODEC_ID_DVAUDIO, + AV_CODEC_ID_WMAV1, + AV_CODEC_ID_WMAV2, + AV_CODEC_ID_MACE3, + AV_CODEC_ID_MACE6, + AV_CODEC_ID_VMDAUDIO, + AV_CODEC_ID_FLAC, + AV_CODEC_ID_MP3ADU, + AV_CODEC_ID_MP3ON4, + AV_CODEC_ID_SHORTEN, + AV_CODEC_ID_ALAC, + AV_CODEC_ID_WESTWOOD_SND1, + AV_CODEC_ID_GSM, ///< as in Berlin toast format + AV_CODEC_ID_QDM2, + AV_CODEC_ID_COOK, + AV_CODEC_ID_TRUESPEECH, + AV_CODEC_ID_TTA, + AV_CODEC_ID_SMACKAUDIO, + AV_CODEC_ID_QCELP, + AV_CODEC_ID_WAVPACK, + AV_CODEC_ID_DSICINAUDIO, + AV_CODEC_ID_IMC, + AV_CODEC_ID_MUSEPACK7, + AV_CODEC_ID_MLP, + AV_CODEC_ID_GSM_MS, /* as found in WAV */ + AV_CODEC_ID_ATRAC3, +#if FF_API_VOXWARE + AV_CODEC_ID_VOXWARE, +#endif + AV_CODEC_ID_APE, + AV_CODEC_ID_NELLYMOSER, + AV_CODEC_ID_MUSEPACK8, + AV_CODEC_ID_SPEEX, + AV_CODEC_ID_WMAVOICE, + AV_CODEC_ID_WMAPRO, + AV_CODEC_ID_WMALOSSLESS, + AV_CODEC_ID_ATRAC3P, + AV_CODEC_ID_EAC3, + AV_CODEC_ID_SIPR, + AV_CODEC_ID_MP1, + AV_CODEC_ID_TWINVQ, + AV_CODEC_ID_TRUEHD, + AV_CODEC_ID_MP4ALS, + AV_CODEC_ID_ATRAC1, + AV_CODEC_ID_BINKAUDIO_RDFT, + AV_CODEC_ID_BINKAUDIO_DCT, + AV_CODEC_ID_AAC_LATM, + AV_CODEC_ID_QDMC, + AV_CODEC_ID_CELT, + AV_CODEC_ID_G723_1, + AV_CODEC_ID_G729, + AV_CODEC_ID_8SVX_EXP, + AV_CODEC_ID_8SVX_FIB, + AV_CODEC_ID_BMV_AUDIO, + AV_CODEC_ID_RALF, + AV_CODEC_ID_IAC, + AV_CODEC_ID_ILBC, + AV_CODEC_ID_OPUS_DEPRECATED, + AV_CODEC_ID_COMFORT_NOISE, + AV_CODEC_ID_TAK_DEPRECATED, + AV_CODEC_ID_METASOUND, + AV_CODEC_ID_PAF_AUDIO_DEPRECATED, + AV_CODEC_ID_ON2AVC, + AV_CODEC_ID_FFWAVESYNTH = MKBETAG('F', 'F', 'W', 'S'), + AV_CODEC_ID_SONIC = MKBETAG('S', 'O', 'N', 'C'), + AV_CODEC_ID_SONIC_LS = MKBETAG('S', 'O', 'N', 'L'), + AV_CODEC_ID_PAF_AUDIO = MKBETAG('P', 'A', 'F', 'A'), + AV_CODEC_ID_OPUS = MKBETAG('O', 'P', 'U', 'S'), + AV_CODEC_ID_TAK = MKBETAG('t', 'B', 'a', 'K'), + AV_CODEC_ID_EVRC = MKBETAG('s', 'e', 'v', 'c'), + AV_CODEC_ID_SMV = MKBETAG('s', 's', 'm', 'v'), + AV_CODEC_ID_DSD_LSBF = MKBETAG('D', 'S', 'D', 'L'), + AV_CODEC_ID_DSD_MSBF = MKBETAG('D', 'S', 'D', 'M'), + AV_CODEC_ID_DSD_LSBF_PLANAR = MKBETAG('D', 'S', 'D', '1'), + AV_CODEC_ID_DSD_MSBF_PLANAR = MKBETAG('D', 'S', 'D', '8'), + + /* subtitle codecs */ + AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. + AV_CODEC_ID_DVD_SUBTITLE = 0x17000, + AV_CODEC_ID_DVB_SUBTITLE, + AV_CODEC_ID_TEXT, ///< raw UTF-8 text + AV_CODEC_ID_XSUB, + AV_CODEC_ID_SSA, + AV_CODEC_ID_MOV_TEXT, + AV_CODEC_ID_HDMV_PGS_SUBTITLE, + AV_CODEC_ID_DVB_TELETEXT, + AV_CODEC_ID_SRT, + AV_CODEC_ID_MICRODVD = MKBETAG('m', 'D', 'V', 'D'), + AV_CODEC_ID_EIA_608 = MKBETAG('c', '6', '0', '8'), + AV_CODEC_ID_JACOSUB = MKBETAG('J', 'S', 'U', 'B'), + AV_CODEC_ID_SAMI = MKBETAG('S', 'A', 'M', 'I'), + AV_CODEC_ID_REALTEXT = MKBETAG('R', 'T', 'X', 'T'), + AV_CODEC_ID_STL = MKBETAG('S', 'p', 'T', 'L'), + AV_CODEC_ID_SUBVIEWER1 = MKBETAG('S', 'b', 'V', '1'), + AV_CODEC_ID_SUBVIEWER = MKBETAG('S', 'u', 'b', 'V'), + AV_CODEC_ID_SUBRIP = MKBETAG('S', 'R', 'i', 'p'), + AV_CODEC_ID_WEBVTT = MKBETAG('W', 'V', 'T', 'T'), + AV_CODEC_ID_MPL2 = MKBETAG('M', 'P', 'L', '2'), + AV_CODEC_ID_VPLAYER = MKBETAG('V', 'P', 'l', 'r'), + AV_CODEC_ID_PJS = MKBETAG('P', 'h', 'J', 'S'), + AV_CODEC_ID_ASS = MKBETAG('A', 'S', 'S', ' '), ///< ASS as defined in Matroska + + /* other specific kind of codecs (generally used for attachments) */ + AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. + AV_CODEC_ID_TTF = 0x18000, + AV_CODEC_ID_BINTEXT = MKBETAG('B', 'T', 'X', 'T'), + AV_CODEC_ID_XBIN = MKBETAG('X', 'B', 'I', 'N'), + AV_CODEC_ID_IDF = MKBETAG(0, 'I', 'D', 'F'), + AV_CODEC_ID_OTF = MKBETAG(0, 'O', 'T', 'F'), + AV_CODEC_ID_SMPTE_KLV = MKBETAG('K', 'L', 'V', 'A'), + AV_CODEC_ID_DVD_NAV = MKBETAG('D', 'N', 'A', 'V'), + AV_CODEC_ID_TIMED_ID3 = MKBETAG('T', 'I', 'D', '3'), + AV_CODEC_ID_BIN_DATA = MKBETAG('D', 'A', 'T', 'A'), + + + AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it + + AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS + * stream (only used by libavformat) */ + AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems + * stream (only used by libavformat) */ + AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information. + +#if FF_API_CODEC_ID + +#include "old_codec_ids.h" + +#endif +}; + +/** + * This struct describes the properties of a single codec described by an + * AVCodecID. + * @see avcodec_descriptor_get() + */ +typedef struct AVCodecDescriptor { + enum AVCodecID id; + enum AVMediaType type; + /** + * Name of the codec described by this descriptor. It is non-empty and + * unique for each codec descriptor. It should contain alphanumeric + * characters and '_' only. + */ + const char *name; + /** + * A more descriptive name for this codec. May be NULL. + */ + const char *long_name; + /** + * Codec properties, a combination of AV_CODEC_PROP_* flags. + */ + int props; + + /** + * MIME type(s) associated with the codec. + * May be NULL; if not, a NULL-terminated array of MIME types. + * The first item is always non-NULL and is the preferred MIME type. + */ + const char *const *mime_types; +} AVCodecDescriptor; + +/** + * Codec uses only intra compression. + * Video codecs only. + */ +#define AV_CODEC_PROP_INTRA_ONLY (1 << 0) +/** + * Codec supports lossy compression. Audio and video codecs only. + * @note a codec may support both lossy and lossless + * compression modes + */ +#define AV_CODEC_PROP_LOSSY (1 << 1) +/** + * Codec supports lossless compression. Audio and video codecs only. + */ +#define AV_CODEC_PROP_LOSSLESS (1 << 2) +/** + * Codec supports frame reordering. That is, the coded order (the order in which + * the encoded packets are output by the encoders / stored / input to the + * decoders) may be different from the presentation order of the corresponding + * frames. + * + * For codecs that do not have this property set, PTS and DTS should always be + * equal. + */ +#define AV_CODEC_PROP_REORDER (1 << 3) +/** + * Subtitle codec is bitmap based + * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field. + */ +#define AV_CODEC_PROP_BITMAP_SUB (1 << 16) +/** + * Subtitle codec is text based. + * Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field. + */ +#define AV_CODEC_PROP_TEXT_SUB (1 << 17) + +/** + * @ingroup lavc_decoding + * Required number of additionally allocated bytes at the end of the input bitstream for decoding. + * This is mainly needed because some optimized bitstream readers read + * 32 or 64 bit at once and could read over the end.<br> + * Note: If the first 23 bits of the additional bytes are not 0, then damaged + * MPEG bitstreams could cause overread and segfault. + */ +#define FF_INPUT_BUFFER_PADDING_SIZE 32 + +/** + * @ingroup lavc_encoding + * minimum encoding buffer size + * Used to avoid some checks during header writing. + */ +#define FF_MIN_BUFFER_SIZE 16384 + + +/** + * @ingroup lavc_encoding + * motion estimation type. + */ +enum Motion_Est_ID { + ME_ZERO = 1, ///< no search, that is use 0,0 vector whenever one is needed + ME_FULL, + ME_LOG, + ME_PHODS, + ME_EPZS, ///< enhanced predictive zonal search + ME_X1, ///< reserved for experiments + ME_HEX, ///< hexagon based search + ME_UMH, ///< uneven multi-hexagon search + ME_TESA, ///< transformed exhaustive search algorithm + ME_ITER = 50, ///< iterative search +}; + +/** + * @ingroup lavc_decoding + */ +enum AVDiscard { + /* We leave some space between them for extensions (drop some + * keyframes for intra-only or drop just some bidir frames). */ + AVDISCARD_NONE = -16, ///< discard nothing + AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi + AVDISCARD_NONREF = 8, ///< discard all non reference + AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames + AVDISCARD_NONINTRA = 24, ///< discard all non intra frames + AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes + AVDISCARD_ALL = 48, ///< discard all +}; + +enum AVAudioServiceType { + AV_AUDIO_SERVICE_TYPE_MAIN = 0, + AV_AUDIO_SERVICE_TYPE_EFFECTS = 1, + AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2, + AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3, + AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4, + AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5, + AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6, + AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7, + AV_AUDIO_SERVICE_TYPE_KARAOKE = 8, + AV_AUDIO_SERVICE_TYPE_NB, ///< Not part of ABI +}; + +/** + * @ingroup lavc_encoding + */ +typedef struct RcOverride { + int start_frame; + int end_frame; + int qscale; // If this is 0 then quality_factor will be used instead. + float quality_factor; +} RcOverride; + +#if FF_API_MAX_BFRAMES +/** + * @deprecated there is no libavcodec-wide limit on the number of B-frames + */ +#define FF_MAX_B_FRAMES 16 +#endif + +/* encoding support + These flags can be passed in AVCodecContext.flags before initialization. + Note: Not everything is supported yet. +*/ + +/** + * Allow decoders to produce frames with data planes that are not aligned + * to CPU requirements (e.g. due to cropping). + */ +#define CODEC_FLAG_UNALIGNED 0x0001 +#define CODEC_FLAG_QSCALE 0x0002 ///< Use fixed qscale. +#define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed / advanced prediction for H.263. +#define CODEC_FLAG_OUTPUT_CORRUPT 0x0008 ///< Output even those frames that might be corrupted +#define CODEC_FLAG_QPEL 0x0010 ///< Use qpel MC. +#if FF_API_GMC +/** + * @deprecated use the "gmc" private option of the libxvid encoder + */ +#define CODEC_FLAG_GMC 0x0020 ///< Use GMC. +#endif +#if FF_API_MV0 +/** + * @deprecated use the flag "mv0" in the "mpv_flags" private option of the + * mpegvideo encoders + */ +#define CODEC_FLAG_MV0 0x0040 +#endif +#if FF_API_INPUT_PRESERVED +/** + * @deprecated passing reference-counted frames to the encoders replaces this + * flag + */ +#define CODEC_FLAG_INPUT_PRESERVED 0x0100 +#endif +#define CODEC_FLAG_PASS1 0x0200 ///< Use internal 2pass ratecontrol in first pass mode. +#define CODEC_FLAG_PASS2 0x0400 ///< Use internal 2pass ratecontrol in second pass mode. +#define CODEC_FLAG_GRAY 0x2000 ///< Only decode/encode grayscale. +#if FF_API_EMU_EDGE +/** + * @deprecated edges are not used/required anymore. I.e. this flag is now always + * set. + */ +#define CODEC_FLAG_EMU_EDGE 0x4000 +#endif +#define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding. +#define CODEC_FLAG_TRUNCATED 0x00010000 /** Input bitstream might be truncated at a random + location instead of only at frame boundaries. */ +#if FF_API_NORMALIZE_AQP +/** + * @deprecated use the flag "naq" in the "mpv_flags" private option of the + * mpegvideo encoders + */ +#define CODEC_FLAG_NORMALIZE_AQP 0x00020000 +#endif +#define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT. +#define CODEC_FLAG_LOW_DELAY 0x00080000 ///< Force low delay. +#define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< Place global headers in extradata instead of every keyframe. +#define CODEC_FLAG_BITEXACT 0x00800000 ///< Use only bitexact stuff (except (I)DCT). +/* Fx : Flag for h263+ extra options */ +#define CODEC_FLAG_AC_PRED 0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction +#define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter +#define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation +#define CODEC_FLAG_CLOSED_GOP 0x80000000 +#define CODEC_FLAG2_FAST 0x00000001 ///< Allow non spec compliant speedup tricks. +#define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< Skip bitstream encoding. +#define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< Place global headers at every keyframe instead of in extradata. +#define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format. DEPRECATED!!!! +#define CODEC_FLAG2_IGNORE_CROP 0x00010000 ///< Discard cropping information from SPS. + +#define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries. +#define CODEC_FLAG2_SHOW_ALL 0x00400000 ///< Show all frames before the first keyframe +#define CODEC_FLAG2_EXPORT_MVS 0x10000000 ///< Export motion vectors through frame side data +#define CODEC_FLAG2_SKIP_MANUAL 0x20000000 ///< Do not skip samples and export skip information as frame side data + +/* Unsupported options : + * Syntax Arithmetic coding (SAC) + * Reference Picture Selection + * Independent Segment Decoding */ +/* /Fx */ +/* codec capabilities */ + +#define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< Decoder can use draw_horiz_band callback. +/** + * Codec uses get_buffer() for allocating buffers and supports custom allocators. + * If not set, it might not use get_buffer() at all or use operations that + * assume the buffer was allocated by avcodec_default_get_buffer. + */ +#define CODEC_CAP_DR1 0x0002 +#define CODEC_CAP_TRUNCATED 0x0008 +#if FF_API_XVMC +/* Codec can export data for HW decoding. This flag indicates that + * the codec would call get_format() with list that might contain HW accelerated + * pixel formats (XvMC, VDPAU, VAAPI, etc). The application can pick any of them + * including raw image format. + * The application can use the passed context to determine bitstream version, + * chroma format, resolution etc. + */ +#define CODEC_CAP_HWACCEL 0x0010 +#endif /* FF_API_XVMC */ +/** + * Encoder or decoder requires flushing with NULL input at the end in order to + * give the complete and correct output. + * + * NOTE: If this flag is not set, the codec is guaranteed to never be fed with + * with NULL data. The user can still send NULL data to the public encode + * or decode function, but libavcodec will not pass it along to the codec + * unless this flag is set. + * + * Decoders: + * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL, + * avpkt->size=0 at the end to get the delayed data until the decoder no longer + * returns frames. + * + * Encoders: + * The encoder needs to be fed with NULL data at the end of encoding until the + * encoder no longer returns data. + * + * NOTE: For encoders implementing the AVCodec.encode2() function, setting this + * flag also means that the encoder must set the pts and duration for + * each output packet. If this flag is not set, the pts and duration will + * be determined by libavcodec from the input frame. + */ +#define CODEC_CAP_DELAY 0x0020 +/** + * Codec can be fed a final frame with a smaller size. + * This can be used to prevent truncation of the last audio samples. + */ +#define CODEC_CAP_SMALL_LAST_FRAME 0x0040 +#if FF_API_CAP_VDPAU +/** + * Codec can export data for HW decoding (VDPAU). + */ +#define CODEC_CAP_HWACCEL_VDPAU 0x0080 +#endif +/** + * Codec can output multiple frames per AVPacket + * Normally demuxers return one frame at a time, demuxers which do not do + * are connected to a parser to split what they return into proper frames. + * This flag is reserved to the very rare category of codecs which have a + * bitstream that cannot be split into frames without timeconsuming + * operations like full decoding. Demuxers carring such bitstreams thus + * may return multiple frames in a packet. This has many disadvantages like + * prohibiting stream copy in many cases thus it should only be considered + * as a last resort. + */ +#define CODEC_CAP_SUBFRAMES 0x0100 +/** + * Codec is experimental and is thus avoided in favor of non experimental + * encoders + */ +#define CODEC_CAP_EXPERIMENTAL 0x0200 +/** + * Codec should fill in channel configuration and samplerate instead of container + */ +#define CODEC_CAP_CHANNEL_CONF 0x0400 +#if FF_API_NEG_LINESIZES +/** + * @deprecated no codecs use this capability + */ +#define CODEC_CAP_NEG_LINESIZES 0x0800 +#endif +/** + * Codec supports frame-level multithreading. + */ +#define CODEC_CAP_FRAME_THREADS 0x1000 +/** + * Codec supports slice-based (or partition-based) multithreading. + */ +#define CODEC_CAP_SLICE_THREADS 0x2000 +/** + * Codec supports changed parameters at any point. + */ +#define CODEC_CAP_PARAM_CHANGE 0x4000 +/** + * Codec supports avctx->thread_count == 0 (auto). + */ +#define CODEC_CAP_AUTO_THREADS 0x8000 +/** + * Audio encoder supports receiving a different number of samples in each call. + */ +#define CODEC_CAP_VARIABLE_FRAME_SIZE 0x10000 +/** + * Codec is intra only. + */ +#define CODEC_CAP_INTRA_ONLY 0x40000000 +/** + * Codec is lossless. + */ +#define CODEC_CAP_LOSSLESS 0x80000000 + +#if FF_API_MB_TYPE +//The following defines may change, don't expect compatibility if you use them. +#define MB_TYPE_INTRA4x4 0x0001 +#define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific +#define MB_TYPE_INTRA_PCM 0x0004 //FIXME H.264-specific +#define MB_TYPE_16x16 0x0008 +#define MB_TYPE_16x8 0x0010 +#define MB_TYPE_8x16 0x0020 +#define MB_TYPE_8x8 0x0040 +#define MB_TYPE_INTERLACED 0x0080 +#define MB_TYPE_DIRECT2 0x0100 //FIXME +#define MB_TYPE_ACPRED 0x0200 +#define MB_TYPE_GMC 0x0400 +#define MB_TYPE_SKIP 0x0800 +#define MB_TYPE_P0L0 0x1000 +#define MB_TYPE_P1L0 0x2000 +#define MB_TYPE_P0L1 0x4000 +#define MB_TYPE_P1L1 0x8000 +#define MB_TYPE_L0 (MB_TYPE_P0L0 | MB_TYPE_P1L0) +#define MB_TYPE_L1 (MB_TYPE_P0L1 | MB_TYPE_P1L1) +#define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1) +#define MB_TYPE_QUANT 0x00010000 +#define MB_TYPE_CBP 0x00020000 +//Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...) +#endif + +/** + * Pan Scan area. + * This specifies the area which should be displayed. + * Note there may be multiple such areas for one frame. + */ +typedef struct AVPanScan { + /** + * id + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int id; + + /** + * width and height in 1/16 pel + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int width; + int height; + + /** + * position of the top left corner in 1/16 pel for up to 3 fields/frames + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int16_t position[3][2]; +} AVPanScan; + +#if FF_API_QSCALE_TYPE +#define FF_QSCALE_TYPE_MPEG1 0 +#define FF_QSCALE_TYPE_MPEG2 1 +#define FF_QSCALE_TYPE_H264 2 +#define FF_QSCALE_TYPE_VP56 3 +#endif + +#if FF_API_GET_BUFFER +#define FF_BUFFER_TYPE_INTERNAL 1 +#define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)allocated by user) +#define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared. +#define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything. + +#define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore). +#define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer. +#define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content. +#define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update). +#endif + +/** + * The decoder will keep a reference to the frame and may reuse it later. + */ +#define AV_GET_BUFFER_FLAG_REF (1 << 0) + +/** + * @defgroup lavc_packet AVPacket + * + * Types and functions for working with AVPacket. + * @{ + */ +enum AVPacketSideDataType { + AV_PKT_DATA_PALETTE, + AV_PKT_DATA_NEW_EXTRADATA, + + /** + * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows: + * @code + * u32le param_flags + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) + * s32le channel_count + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) + * u64le channel_layout + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) + * s32le sample_rate + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) + * s32le width + * s32le height + * @endcode + */ + AV_PKT_DATA_PARAM_CHANGE, + + /** + * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of + * structures with info about macroblocks relevant to splitting the + * packet into smaller packets on macroblock edges (e.g. as for RFC 2190). + * That is, it does not necessarily contain info about all macroblocks, + * as long as the distance between macroblocks in the info is smaller + * than the target payload size. + * Each MB info structure is 12 bytes, and is laid out as follows: + * @code + * u32le bit offset from the start of the packet + * u8 current quantizer at the start of the macroblock + * u8 GOB number + * u16le macroblock address within the GOB + * u8 horizontal MV predictor + * u8 vertical MV predictor + * u8 horizontal MV predictor for block number 3 + * u8 vertical MV predictor for block number 3 + * @endcode + */ + AV_PKT_DATA_H263_MB_INFO, + + /** + * This side data should be associated with an audio stream and contains + * ReplayGain information in form of the AVReplayGain struct. + */ + AV_PKT_DATA_REPLAYGAIN, + + /** + * This side data contains a 3x3 transformation matrix describing an affine + * transformation that needs to be applied to the decoded video frames for + * correct presentation. + * + * See libavutil/display.h for a detailed description of the data. + */ + AV_PKT_DATA_DISPLAYMATRIX, + + /** + * This side data should be associated with a video stream and contains + * Stereoscopic 3D information in form of the AVStereo3D struct. + */ + AV_PKT_DATA_STEREO3D, + + /** + * Recommmends skipping the specified number of samples + * @code + * u32le number of samples to skip from start of this packet + * u32le number of samples to skip from end of this packet + * u8 reason for start skip + * u8 reason for end skip (0=padding silence, 1=convergence) + * @endcode + */ + AV_PKT_DATA_SKIP_SAMPLES = 70, + + /** + * An AV_PKT_DATA_JP_DUALMONO side data packet indicates that + * the packet may contain "dual mono" audio specific to Japanese DTV + * and if it is true, recommends only the selected channel to be used. + * @code + * u8 selected channels (0=mail/left, 1=sub/right, 2=both) + * @endcode + */ + AV_PKT_DATA_JP_DUALMONO, + + /** + * A list of zero terminated key/value strings. There is no end marker for + * the list, so it is required to rely on the side data size to stop. + */ + AV_PKT_DATA_STRINGS_METADATA, + + /** + * Subtitle event position + * @code + * u32le x1 + * u32le y1 + * u32le x2 + * u32le y2 + * @endcode + */ + AV_PKT_DATA_SUBTITLE_POSITION, + + /** + * Data found in BlockAdditional element of matroska container. There is + * no end marker for the data, so it is required to rely on the side data + * size to recognize the end. 8 byte id (as found in BlockAddId) followed + * by data. + */ + AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, + + /** + * The optional first identifier line of a WebVTT cue. + */ + AV_PKT_DATA_WEBVTT_IDENTIFIER, + + /** + * The optional settings (rendering instructions) that immediately + * follow the timestamp specifier of a WebVTT cue. + */ + AV_PKT_DATA_WEBVTT_SETTINGS, + + /** + * A list of zero terminated key/value strings. There is no end marker for + * the list, so it is required to rely on the side data size to stop. This + * side data includes updated metadata which appeared in the stream. + */ + AV_PKT_DATA_METADATA_UPDATE, +}; + +typedef struct AVPacketSideData { + uint8_t *data; + int size; + enum AVPacketSideDataType type; +} AVPacketSideData; + +/** + * This structure stores compressed data. It is typically exported by demuxers + * and then passed as input to decoders, or received as output from encoders and + * then passed to muxers. + * + * For video, it should typically contain one compressed frame. For audio it may + * contain several compressed frames. + * + * AVPacket is one of the few structs in FFmpeg, whose size is a part of public + * ABI. Thus it may be allocated on stack and no new fields can be added to it + * without libavcodec and libavformat major bump. + * + * The semantics of data ownership depends on the buf or destruct (deprecated) + * fields. If either is set, the packet data is dynamically allocated and is + * valid indefinitely until av_free_packet() is called (which in turn calls + * av_buffer_unref()/the destruct callback to free the data). If neither is set, + * the packet data is typically backed by some static buffer somewhere and is + * only valid for a limited time (e.g. until the next read call when demuxing). + * + * The side data is always allocated with av_malloc() and is freed in + * av_free_packet(). + */ +typedef struct AVPacket { + /** + * A reference to the reference-counted buffer where the packet data is + * stored. + * May be NULL, then the packet data is not reference-counted. + */ + AVBufferRef *buf; + /** + * Presentation timestamp in AVStream->time_base units; the time at which + * the decompressed packet will be presented to the user. + * Can be AV_NOPTS_VALUE if it is not stored in the file. + * pts MUST be larger or equal to dts as presentation cannot happen before + * decompression, unless one wants to view hex dumps. Some formats misuse + * the terms dts and pts/cts to mean something different. Such timestamps + * must be converted to true pts/dts before they are stored in AVPacket. + */ + int64_t pts; + /** + * Decompression timestamp in AVStream->time_base units; the time at which + * the packet is decompressed. + * Can be AV_NOPTS_VALUE if it is not stored in the file. + */ + int64_t dts; + uint8_t *data; + int size; + int stream_index; + /** + * A combination of AV_PKT_FLAG values + */ + int flags; + /** + * Additional packet data that can be provided by the container. + * Packet can contain several types of side information. + */ + AVPacketSideData *side_data; + int side_data_elems; + + /** + * Duration of this packet in AVStream->time_base units, 0 if unknown. + * Equals next_pts - this_pts in presentation order. + */ + int duration; +#if FF_API_DESTRUCT_PACKET + + attribute_deprecated + void (*destruct)(struct AVPacket *); + + attribute_deprecated + void *priv; +#endif + int64_t pos; ///< byte position in stream, -1 if unknown + + /** + * Time difference in AVStream->time_base units from the pts of this + * packet to the point at which the output from the decoder has converged + * independent from the availability of previous frames. That is, the + * frames are virtually identical no matter if decoding started from + * the very first frame or from this keyframe. + * Is AV_NOPTS_VALUE if unknown. + * This field is not the display duration of the current packet. + * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY + * set. + * + * The purpose of this field is to allow seeking in streams that have no + * keyframes in the conventional sense. It corresponds to the + * recovery point SEI in H.264 and match_time_delta in NUT. It is also + * essential for some types of subtitle streams to ensure that all + * subtitles are correctly displayed after seeking. + */ + int64_t convergence_duration; +} AVPacket; +#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe +#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted + +enum AVSideDataParamChangeFlags { + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001, + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002, + AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004, + AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008, +}; +/** + * @} + */ + +struct AVCodecInternal; + +enum AVFieldOrder { + AV_FIELD_UNKNOWN, + AV_FIELD_PROGRESSIVE, + AV_FIELD_TT, //< Top coded_first, top displayed first + AV_FIELD_BB, //< Bottom coded first, bottom displayed first + AV_FIELD_TB, //< Top coded first, bottom displayed first + AV_FIELD_BT, //< Bottom coded first, top displayed first +}; + +/** + * main external API structure. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * Please use AVOptions (av_opt* / av_set/get*()) to access these fields from user + * applications. + * sizeof(AVCodecContext) must not be used outside libav*. + */ +typedef struct AVCodecContext { + /** + * information on struct for av_log + * - set by avcodec_alloc_context3 + */ + const AVClass *av_class; + int log_level_offset; + + enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */ + const struct AVCodec *codec; +#if FF_API_CODEC_NAME + /** + * @deprecated this field is not used for anything in libavcodec + */ + attribute_deprecated + char codec_name[32]; +#endif + enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */ + + /** + * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). + * This is used to work around some encoder bugs. + * A demuxer should set this to what is stored in the field used to identify the codec. + * If there are multiple such fields in a container then the demuxer should choose the one + * which maximizes the information about the used codec. + * If the codec tag field in a container is larger than 32 bits then the demuxer should + * remap the longer ID to 32 bits with a table or other structure. Alternatively a new + * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated + * first. + * - encoding: Set by user, if not then the default based on codec_id will be used. + * - decoding: Set by user, will be converted to uppercase by libavcodec during init. + */ + unsigned int codec_tag; + + /** + * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). + * This is used to work around some encoder bugs. + * - encoding: unused + * - decoding: Set by user, will be converted to uppercase by libavcodec during init. + */ + unsigned int stream_codec_tag; + + void *priv_data; + + /** + * Private context used for internal data. + * + * Unlike priv_data, this is not codec-specific. It is used in general + * libavcodec functions. + */ + struct AVCodecInternal *internal; + + /** + * Private data of the user, can be used to carry app specific stuff. + * - encoding: Set by user. + * - decoding: Set by user. + */ + void *opaque; + + /** + * the average bitrate + * - encoding: Set by user; unused for constant quantizer encoding. + * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream. + */ + int bit_rate; + + /** + * number of bits the bitstream is allowed to diverge from the reference. + * the reference can be CBR (for CBR pass1) or VBR (for pass2) + * - encoding: Set by user; unused for constant quantizer encoding. + * - decoding: unused + */ + int bit_rate_tolerance; + + /** + * Global quality for codecs which cannot change it per frame. + * This should be proportional to MPEG-1/2/4 qscale. + * - encoding: Set by user. + * - decoding: unused + */ + int global_quality; + + /** + * - encoding: Set by user. + * - decoding: unused + */ + int compression_level; +#define FF_COMPRESSION_DEFAULT -1 + + /** + * CODEC_FLAG_*. + * - encoding: Set by user. + * - decoding: Set by user. + */ + int flags; + + /** + * CODEC_FLAG2_* + * - encoding: Set by user. + * - decoding: Set by user. + */ + int flags2; + + /** + * some codecs need / can use extradata like Huffman tables. + * mjpeg: Huffman tables + * rv10: additional flags + * mpeg4: global headers (they can be in the bitstream or here) + * The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger + * than extradata_size to avoid problems if it is read with the bitstream reader. + * The bytewise contents of extradata must not depend on the architecture or CPU endianness. + * - encoding: Set/allocated/freed by libavcodec. + * - decoding: Set/allocated/freed by user. + */ + uint8_t *extradata; + int extradata_size; + + /** + * This is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. For fixed-fps content, + * timebase should be 1/framerate and timestamp increments should be + * identically 1. + * This often, but not always is the inverse of the frame rate or field rate + * for video. + * - encoding: MUST be set by user. + * - decoding: the use of this field for decoding is deprecated. + * Use framerate instead. + */ + AVRational time_base; + + /** + * For some codecs, the time base is closer to the field rate than the frame rate. + * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration + * if no telecine is used ... + * + * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2. + */ + int ticks_per_frame; + + /** + * Codec delay. + * + * Encoding: Number of frames delay there will be from the encoder input to + * the decoder output. (we assume the decoder matches the spec) + * Decoding: Number of frames delay in addition to what a standard decoder + * as specified in the spec would produce. + * + * Video: + * Number of frames the decoded output will be delayed relative to the + * encoded input. + * + * Audio: + * For encoding, this field is unused (see initial_padding). + * + * For decoding, this is the number of samples the decoder needs to + * output before the decoder's output is valid. When seeking, you should + * start decoding this many samples prior to your desired seek point. + * + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int delay; + + + /* video only */ + /** + * picture width / height. + * - encoding: MUST be set by user. + * - decoding: May be set by the user before opening the decoder if known e.g. + * from the container. Some decoders will require the dimensions + * to be set by the caller. During decoding, the decoder may + * overwrite those values as required. + */ + int width, height; + + /** + * Bitstream width / height, may be different from width/height e.g. when + * the decoded frame is cropped before being output or lowres is enabled. + * - encoding: unused + * - decoding: May be set by the user before opening the decoder if known + * e.g. from the container. During decoding, the decoder may + * overwrite those values as required. + */ + int coded_width, coded_height; + +#if FF_API_ASPECT_EXTENDED +#define FF_ASPECT_EXTENDED 15 +#endif + + /** + * the number of pictures in a group of pictures, or 0 for intra_only + * - encoding: Set by user. + * - decoding: unused + */ + int gop_size; + + /** + * Pixel format, see AV_PIX_FMT_xxx. + * May be set by the demuxer if known from headers. + * May be overridden by the decoder if it knows better. + * - encoding: Set by user. + * - decoding: Set by user if known, overridden by libavcodec if known + */ + enum AVPixelFormat pix_fmt; + + /** + * Motion estimation algorithm used for video coding. + * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex), + * 8 (umh), 9 (iter), 10 (tesa) [7, 8, 10 are x264 specific, 9 is snow specific] + * - encoding: MUST be set by user. + * - decoding: unused + */ + int me_method; + + /** + * If non NULL, 'draw_horiz_band' is called by the libavcodec + * decoder to draw a horizontal band. It improves cache usage. Not + * all codecs can do that. You must check the codec capabilities + * beforehand. + * When multithreading is used, it may be called from multiple threads + * at the same time; threads might draw different parts of the same AVFrame, + * or multiple AVFrames, and there is no guarantee that slices will be drawn + * in order. + * The function is also used by hardware acceleration APIs. + * It is called at least once during frame decoding to pass + * the data needed for hardware render. + * In that mode instead of pixel data, AVFrame points to + * a structure specific to the acceleration API. The application + * reads the structure and can change some fields to indicate progress + * or mark state. + * - encoding: unused + * - decoding: Set by user. + * @param height the height of the slice + * @param y the y position of the slice + * @param type 1->top field, 2->bottom field, 3->frame + * @param offset offset into the AVFrame.data from which the slice should be read + */ + void (*draw_horiz_band)(struct AVCodecContext *s, + const AVFrame *src, int offset[AV_NUM_DATA_POINTERS], + int y, int type, int height); + + /** + * callback to negotiate the pixelFormat + * @param fmt is the list of formats which are supported by the codec, + * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality. + * The first is always the native one. + * @note The callback may be called again immediately if initialization for + * the selected (hardware-accelerated) pixel format failed. + * @warning Behavior is undefined if the callback returns a value not + * in the fmt list of formats. + * @return the chosen format + * - encoding: unused + * - decoding: Set by user, if not set the native format will be chosen. + */ + enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat *fmt); + + /** + * maximum number of B-frames between non-B-frames + * Note: The output will be delayed by max_b_frames+1 relative to the input. + * - encoding: Set by user. + * - decoding: unused + */ + int max_b_frames; + + /** + * qscale factor between IP and B-frames + * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset). + * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset). + * - encoding: Set by user. + * - decoding: unused + */ + float b_quant_factor; + + /** obsolete FIXME remove */ + int rc_strategy; +#define FF_RC_STRATEGY_XVID 1 + + int b_frame_strategy; + + /** + * qscale offset between IP and B-frames + * - encoding: Set by user. + * - decoding: unused + */ + float b_quant_offset; + + /** + * Size of the frame reordering buffer in the decoder. + * For MPEG-2 it is 1 IPB or 0 low delay IP. + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int has_b_frames; + + /** + * 0-> h263 quant 1-> mpeg quant + * - encoding: Set by user. + * - decoding: unused + */ + int mpeg_quant; + + /** + * qscale factor between P and I-frames + * If > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset). + * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset). + * - encoding: Set by user. + * - decoding: unused + */ + float i_quant_factor; + + /** + * qscale offset between P and I-frames + * - encoding: Set by user. + * - decoding: unused + */ + float i_quant_offset; + + /** + * luminance masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float lumi_masking; + + /** + * temporary complexity masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float temporal_cplx_masking; + + /** + * spatial complexity masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float spatial_cplx_masking; + + /** + * p block masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float p_masking; + + /** + * darkness masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float dark_masking; + + /** + * slice count + * - encoding: Set by libavcodec. + * - decoding: Set by user (or 0). + */ + int slice_count; + /** + * prediction method (needed for huffyuv) + * - encoding: Set by user. + * - decoding: unused + */ + int prediction_method; +#define FF_PRED_LEFT 0 +#define FF_PRED_PLANE 1 +#define FF_PRED_MEDIAN 2 + + /** + * slice offsets in the frame in bytes + * - encoding: Set/allocated by libavcodec. + * - decoding: Set/allocated by user (or NULL). + */ + int *slice_offset; + + /** + * sample aspect ratio (0 if unknown) + * That is the width of a pixel divided by the height of the pixel. + * Numerator and denominator must be relatively prime and smaller than 256 for some video standards. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + AVRational sample_aspect_ratio; + + /** + * motion estimation comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int me_cmp; + /** + * subpixel motion estimation comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int me_sub_cmp; + /** + * macroblock comparison function (not supported yet) + * - encoding: Set by user. + * - decoding: unused + */ + int mb_cmp; + /** + * interlaced DCT comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int ildct_cmp; +#define FF_CMP_SAD 0 +#define FF_CMP_SSE 1 +#define FF_CMP_SATD 2 +#define FF_CMP_DCT 3 +#define FF_CMP_PSNR 4 +#define FF_CMP_BIT 5 +#define FF_CMP_RD 6 +#define FF_CMP_ZERO 7 +#define FF_CMP_VSAD 8 +#define FF_CMP_VSSE 9 +#define FF_CMP_NSSE 10 +#define FF_CMP_W53 11 +#define FF_CMP_W97 12 +#define FF_CMP_DCTMAX 13 +#define FF_CMP_DCT264 14 +#define FF_CMP_CHROMA 256 + + /** + * ME diamond size & shape + * - encoding: Set by user. + * - decoding: unused + */ + int dia_size; + + /** + * amount of previous MV predictors (2a+1 x 2a+1 square) + * - encoding: Set by user. + * - decoding: unused + */ + int last_predictor_count; + + /** + * prepass for motion estimation + * - encoding: Set by user. + * - decoding: unused + */ + int pre_me; + + /** + * motion estimation prepass comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int me_pre_cmp; + + /** + * ME prepass diamond size & shape + * - encoding: Set by user. + * - decoding: unused + */ + int pre_dia_size; + + /** + * subpel ME quality + * - encoding: Set by user. + * - decoding: unused + */ + int me_subpel_quality; + +#if FF_API_AFD + /** + * DTG active format information (additional aspect ratio + * information only used in DVB MPEG-2 transport streams) + * 0 if not set. + * + * - encoding: unused + * - decoding: Set by decoder. + * @deprecated Deprecated in favor of AVSideData + */ + attribute_deprecated int dtg_active_format; +#define FF_DTG_AFD_SAME 8 +#define FF_DTG_AFD_4_3 9 +#define FF_DTG_AFD_16_9 10 +#define FF_DTG_AFD_14_9 11 +#define FF_DTG_AFD_4_3_SP_14_9 13 +#define FF_DTG_AFD_16_9_SP_14_9 14 +#define FF_DTG_AFD_SP_4_3 15 +#endif /* FF_API_AFD */ + + /** + * maximum motion estimation search range in subpel units + * If 0 then no limit. + * + * - encoding: Set by user. + * - decoding: unused + */ + int me_range; + + /** + * intra quantizer bias + * - encoding: Set by user. + * - decoding: unused + */ + int intra_quant_bias; +#define FF_DEFAULT_QUANT_BIAS 999999 + + /** + * inter quantizer bias + * - encoding: Set by user. + * - decoding: unused + */ + int inter_quant_bias; + + /** + * slice flags + * - encoding: unused + * - decoding: Set by user. + */ + int slice_flags; +#define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display +#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics) +#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1) + +#if FF_API_XVMC + /** + * XVideo Motion Acceleration + * - encoding: forbidden + * - decoding: set by decoder + * @deprecated XvMC doesn't need it anymore. + */ + attribute_deprecated int xvmc_acceleration; +#endif /* FF_API_XVMC */ + + /** + * macroblock decision mode + * - encoding: Set by user. + * - decoding: unused + */ + int mb_decision; +#define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp +#define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits +#define FF_MB_DECISION_RD 2 ///< rate distortion + + /** + * custom intra quantization matrix + * - encoding: Set by user, can be NULL. + * - decoding: Set by libavcodec. + */ + uint16_t *intra_matrix; + + /** + * custom inter quantization matrix + * - encoding: Set by user, can be NULL. + * - decoding: Set by libavcodec. + */ + uint16_t *inter_matrix; + + /** + * scene change detection threshold + * 0 is default, larger means fewer detected scene changes. + * - encoding: Set by user. + * - decoding: unused + */ + int scenechange_threshold; + + /** + * noise reduction strength + * - encoding: Set by user. + * - decoding: unused + */ + int noise_reduction; + +#if FF_API_MPV_OPT + /** + * @deprecated this field is unused + */ + attribute_deprecated + int me_threshold; + + /** + * @deprecated this field is unused + */ + attribute_deprecated + int mb_threshold; +#endif + + /** + * precision of the intra DC coefficient - 8 + * - encoding: Set by user. + * - decoding: unused + */ + int intra_dc_precision; + + /** + * Number of macroblock rows at the top which are skipped. + * - encoding: unused + * - decoding: Set by user. + */ + int skip_top; + + /** + * Number of macroblock rows at the bottom which are skipped. + * - encoding: unused + * - decoding: Set by user. + */ + int skip_bottom; + +#if FF_API_MPV_OPT + /** + * @deprecated use encoder private options instead + */ + attribute_deprecated + float border_masking; +#endif + + /** + * minimum MB lagrange multipler + * - encoding: Set by user. + * - decoding: unused + */ + int mb_lmin; + + /** + * maximum MB lagrange multipler + * - encoding: Set by user. + * - decoding: unused + */ + int mb_lmax; + + /** + * + * - encoding: Set by user. + * - decoding: unused + */ + int me_penalty_compensation; + + /** + * + * - encoding: Set by user. + * - decoding: unused + */ + int bidir_refine; + + /** + * + * - encoding: Set by user. + * - decoding: unused + */ + int brd_scale; + + /** + * minimum GOP size + * - encoding: Set by user. + * - decoding: unused + */ + int keyint_min; + + /** + * number of reference frames + * - encoding: Set by user. + * - decoding: Set by lavc. + */ + int refs; + + /** + * chroma qp offset from luma + * - encoding: Set by user. + * - decoding: unused + */ + int chromaoffset; + +#if FF_API_UNUSED_MEMBERS + /** + * Multiplied by qscale for each frame and added to scene_change_score. + * - encoding: Set by user. + * - decoding: unused + */ + attribute_deprecated int scenechange_factor; +#endif + + /** + * + * Note: Value depends upon the compare function used for fullpel ME. + * - encoding: Set by user. + * - decoding: unused + */ + int mv0_threshold; + + /** + * Adjust sensitivity of b_frame_strategy 1. + * - encoding: Set by user. + * - decoding: unused + */ + int b_sensitivity; + + /** + * Chromaticity coordinates of the source primaries. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorPrimaries color_primaries; + + /** + * Color Transfer Characteristic. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorTransferCharacteristic color_trc; + + /** + * YUV colorspace type. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorSpace colorspace; + + /** + * MPEG vs JPEG YUV range. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorRange color_range; + + /** + * This defines the location of chroma samples. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVChromaLocation chroma_sample_location; + + /** + * Number of slices. + * Indicates number of picture subdivisions. Used for parallelized + * decoding. + * - encoding: Set by user + * - decoding: unused + */ + int slices; + + /** Field order + * - encoding: set by libavcodec + * - decoding: Set by user. + */ + enum AVFieldOrder field_order; + + /* audio only */ + int sample_rate; ///< samples per second + int channels; ///< number of audio channels + + /** + * audio sample format + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + enum AVSampleFormat sample_fmt; ///< sample format + + /* The following data should not be initialized. */ + /** + * Number of samples per channel in an audio frame. + * + * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame + * except the last must contain exactly frame_size samples per channel. + * May be 0 when the codec has CODEC_CAP_VARIABLE_FRAME_SIZE set, then the + * frame size is not restricted. + * - decoding: may be set by some decoders to indicate constant frame size + */ + int frame_size; + + /** + * Frame counter, set by libavcodec. + * + * - decoding: total number of frames returned from the decoder so far. + * - encoding: total number of frames passed to the encoder so far. + * + * @note the counter is not incremented if encoding/decoding resulted in + * an error. + */ + int frame_number; + + /** + * number of bytes per packet if constant and known or 0 + * Used by some WAV based audio codecs. + */ + int block_align; + + /** + * Audio cutoff bandwidth (0 means "automatic") + * - encoding: Set by user. + * - decoding: unused + */ + int cutoff; + +#if FF_API_REQUEST_CHANNELS + /** + * Decoder should decode to this many channels if it can (0 for default) + * - encoding: unused + * - decoding: Set by user. + * @deprecated Deprecated in favor of request_channel_layout. + */ + attribute_deprecated int request_channels; +#endif + + /** + * Audio channel layout. + * - encoding: set by user. + * - decoding: set by user, may be overwritten by libavcodec. + */ + uint64_t channel_layout; + + /** + * Request decoder to use this channel layout if it can (0 for default) + * - encoding: unused + * - decoding: Set by user. + */ + uint64_t request_channel_layout; + + /** + * Type of service that the audio stream conveys. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + enum AVAudioServiceType audio_service_type; + + /** + * desired sample format + * - encoding: Not used. + * - decoding: Set by user. + * Decoder will decode to this format if it can. + */ + enum AVSampleFormat request_sample_fmt; + +#if FF_API_GET_BUFFER + + /** + * Called at the beginning of each frame to get a buffer for it. + * + * The function will set AVFrame.data[], AVFrame.linesize[]. + * AVFrame.extended_data[] must also be set, but it should be the same as + * AVFrame.data[] except for planar audio with more channels than can fit + * in AVFrame.data[]. In that case, AVFrame.data[] shall still contain as + * many data pointers as it can hold. + * + * if CODEC_CAP_DR1 is not set then get_buffer() must call + * avcodec_default_get_buffer() instead of providing buffers allocated by + * some other means. + * + * AVFrame.data[] should be 32- or 16-byte-aligned unless the CPU doesn't + * need it. avcodec_default_get_buffer() aligns the output buffer properly, + * but if get_buffer() is overridden then alignment considerations should + * be taken into account. + * + * @see avcodec_default_get_buffer() + * + * Video: + * + * If pic.reference is set then the frame will be read later by libavcodec. + * avcodec_align_dimensions2() should be used to find the required width and + * height, as they normally need to be rounded up to the next multiple of 16. + * + * If frame multithreading is used and thread_safe_callbacks is set, + * it may be called from a different thread, but not from more than one at + * once. Does not need to be reentrant. + * + * @see release_buffer(), reget_buffer() + * @see avcodec_align_dimensions2() + * + * Audio: + * + * Decoders request a buffer of a particular size by setting + * AVFrame.nb_samples prior to calling get_buffer(). The decoder may, + * however, utilize only part of the buffer by setting AVFrame.nb_samples + * to a smaller value in the output frame. + * + * Decoders cannot use the buffer after returning from + * avcodec_decode_audio4(), so they will not call release_buffer(), as it + * is assumed to be released immediately upon return. In some rare cases, + * a decoder may need to call get_buffer() more than once in a single + * call to avcodec_decode_audio4(). In that case, when get_buffer() is + * called again after it has already been called once, the previously + * acquired buffer is assumed to be released at that time and may not be + * reused by the decoder. + * + * As a convenience, av_samples_get_buffer_size() and + * av_samples_fill_arrays() in libavutil may be used by custom get_buffer() + * functions to find the required data size and to fill data pointers and + * linesize. In AVFrame.linesize, only linesize[0] may be set for audio + * since all planes must be the same size. + * + * @see av_samples_get_buffer_size(), av_samples_fill_arrays() + * + * - encoding: unused + * - decoding: Set by libavcodec, user can override. + * + * @deprecated use get_buffer2() + */ + attribute_deprecated + int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic); + + /** + * Called to release buffers which were allocated with get_buffer. + * A released buffer can be reused in get_buffer(). + * pic.data[*] must be set to NULL. + * May be called from a different thread if frame multithreading is used, + * but not by more than one thread at once, so does not need to be reentrant. + * - encoding: unused + * - decoding: Set by libavcodec, user can override. + * + * @deprecated custom freeing callbacks should be set from get_buffer2() + */ + attribute_deprecated + void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic); + + /** + * Called at the beginning of a frame to get cr buffer for it. + * Buffer type (size, hints) must be the same. libavcodec won't check it. + * libavcodec will pass previous buffer in pic, function should return + * same buffer or new buffer with old frame "painted" into it. + * If pic.data[0] == NULL must behave like get_buffer(). + * if CODEC_CAP_DR1 is not set then reget_buffer() must call + * avcodec_default_reget_buffer() instead of providing buffers allocated by + * some other means. + * - encoding: unused + * - decoding: Set by libavcodec, user can override. + */ + attribute_deprecated + int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic); + +#endif + + /** + * This callback is called at the beginning of each frame to get data + * buffer(s) for it. There may be one contiguous buffer for all the data or + * there may be a buffer per each data plane or anything in between. What + * this means is, you may set however many entries in buf[] you feel necessary. + * Each buffer must be reference-counted using the AVBuffer API (see description + * of buf[] below). + * + * The following fields will be set in the frame before this callback is + * called: + * - format + * - width, height (video only) + * - sample_rate, channel_layout, nb_samples (audio only) + * Their values may differ from the corresponding values in + * AVCodecContext. This callback must use the frame values, not the codec + * context values, to calculate the required buffer size. + * + * This callback must fill the following fields in the frame: + * - data[] + * - linesize[] + * - extended_data: + * * if the data is planar audio with more than 8 channels, then this + * callback must allocate and fill extended_data to contain all pointers + * to all data planes. data[] must hold as many pointers as it can. + * extended_data must be allocated with av_malloc() and will be freed in + * av_frame_unref(). + * * otherwise exended_data must point to data + * - buf[] must contain one or more pointers to AVBufferRef structures. Each of + * the frame's data and extended_data pointers must be contained in these. That + * is, one AVBufferRef for each allocated chunk of memory, not necessarily one + * AVBufferRef per data[] entry. See: av_buffer_create(), av_buffer_alloc(), + * and av_buffer_ref(). + * - extended_buf and nb_extended_buf must be allocated with av_malloc() by + * this callback and filled with the extra buffers if there are more + * buffers than buf[] can hold. extended_buf will be freed in + * av_frame_unref(). + * + * If CODEC_CAP_DR1 is not set then get_buffer2() must call + * avcodec_default_get_buffer2() instead of providing buffers allocated by + * some other means. + * + * Each data plane must be aligned to the maximum required by the target + * CPU. + * + * @see avcodec_default_get_buffer2() + * + * Video: + * + * If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused + * (read and/or written to if it is writable) later by libavcodec. + * + * avcodec_align_dimensions2() should be used to find the required width and + * height, as they normally need to be rounded up to the next multiple of 16. + * + * Some decoders do not support linesizes changing between frames. + * + * If frame multithreading is used and thread_safe_callbacks is set, + * this callback may be called from a different thread, but not from more + * than one at once. Does not need to be reentrant. + * + * @see avcodec_align_dimensions2() + * + * Audio: + * + * Decoders request a buffer of a particular size by setting + * AVFrame.nb_samples prior to calling get_buffer2(). The decoder may, + * however, utilize only part of the buffer by setting AVFrame.nb_samples + * to a smaller value in the output frame. + * + * As a convenience, av_samples_get_buffer_size() and + * av_samples_fill_arrays() in libavutil may be used by custom get_buffer2() + * functions to find the required data size and to fill data pointers and + * linesize. In AVFrame.linesize, only linesize[0] may be set for audio + * since all planes must be the same size. + * + * @see av_samples_get_buffer_size(), av_samples_fill_arrays() + * + * - encoding: unused + * - decoding: Set by libavcodec, user can override. + */ + int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags); + + /** + * If non-zero, the decoded audio and video frames returned from + * avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted + * and are valid indefinitely. The caller must free them with + * av_frame_unref() when they are not needed anymore. + * Otherwise, the decoded frames must not be freed by the caller and are + * only valid until the next decode call. + * + * - encoding: unused + * - decoding: set by the caller before avcodec_open2(). + */ + int refcounted_frames; + + /* - encoding parameters */ + float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0) + float qblur; ///< amount of qscale smoothing over time (0.0-1.0) + + /** + * minimum quantizer + * - encoding: Set by user. + * - decoding: unused + */ + int qmin; + + /** + * maximum quantizer + * - encoding: Set by user. + * - decoding: unused + */ + int qmax; + + /** + * maximum quantizer difference between frames + * - encoding: Set by user. + * - decoding: unused + */ + int max_qdiff; + +#if FF_API_MPV_OPT + /** + * @deprecated use encoder private options instead + */ + attribute_deprecated + float rc_qsquish; + + attribute_deprecated + float rc_qmod_amp; + attribute_deprecated + int rc_qmod_freq; +#endif + + /** + * decoder bitstream buffer size + * - encoding: Set by user. + * - decoding: unused + */ + int rc_buffer_size; + + /** + * ratecontrol override, see RcOverride + * - encoding: Allocated/set/freed by user. + * - decoding: unused + */ + int rc_override_count; + RcOverride *rc_override; + +#if FF_API_MPV_OPT + /** + * @deprecated use encoder private options instead + */ + attribute_deprecated + const char *rc_eq; +#endif + + /** + * maximum bitrate + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int rc_max_rate; + + /** + * minimum bitrate + * - encoding: Set by user. + * - decoding: unused + */ + int rc_min_rate; + +#if FF_API_MPV_OPT + /** + * @deprecated use encoder private options instead + */ + attribute_deprecated + float rc_buffer_aggressivity; + + attribute_deprecated + float rc_initial_cplx; +#endif + + /** + * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow. + * - encoding: Set by user. + * - decoding: unused. + */ + float rc_max_available_vbv_use; + + /** + * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow. + * - encoding: Set by user. + * - decoding: unused. + */ + float rc_min_vbv_overflow_use; + + /** + * Number of bits which should be loaded into the rc buffer before decoding starts. + * - encoding: Set by user. + * - decoding: unused + */ + int rc_initial_buffer_occupancy; + +#define FF_CODER_TYPE_VLC 0 +#define FF_CODER_TYPE_AC 1 +#define FF_CODER_TYPE_RAW 2 +#define FF_CODER_TYPE_RLE 3 +#if FF_API_UNUSED_MEMBERS +#define FF_CODER_TYPE_DEFLATE 4 +#endif /* FF_API_UNUSED_MEMBERS */ + /** + * coder type + * - encoding: Set by user. + * - decoding: unused + */ + int coder_type; + + /** + * context model + * - encoding: Set by user. + * - decoding: unused + */ + int context_model; + +#if FF_API_MPV_OPT + /** + * @deprecated use encoder private options instead + */ + attribute_deprecated + int lmin; + + /** + * @deprecated use encoder private options instead + */ + attribute_deprecated + int lmax; +#endif + + /** + * frame skip threshold + * - encoding: Set by user. + * - decoding: unused + */ + int frame_skip_threshold; + + /** + * frame skip factor + * - encoding: Set by user. + * - decoding: unused + */ + int frame_skip_factor; + + /** + * frame skip exponent + * - encoding: Set by user. + * - decoding: unused + */ + int frame_skip_exp; + + /** + * frame skip comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int frame_skip_cmp; + + /** + * trellis RD quantization + * - encoding: Set by user. + * - decoding: unused + */ + int trellis; + + /** + * - encoding: Set by user. + * - decoding: unused + */ + int min_prediction_order; + + /** + * - encoding: Set by user. + * - decoding: unused + */ + int max_prediction_order; + + /** + * GOP timecode frame start number + * - encoding: Set by user, in non drop frame format + * - decoding: Set by libavcodec (timecode in the 25 bits format, -1 if unset) + */ + int64_t timecode_frame_start; + + /* The RTP callback: This function is called */ + /* every time the encoder has a packet to send. */ + /* It depends on the encoder if the data starts */ + /* with a Start Code (it should). H.263 does. */ + /* mb_nb contains the number of macroblocks */ + /* encoded in the RTP payload. */ + void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); + + int rtp_payload_size; /* The size of the RTP payload: the coder will */ + /* do its best to deliver a chunk with size */ + /* below rtp_payload_size, the chunk will start */ + /* with a start code on some codecs like H.263. */ + /* This doesn't take account of any particular */ + /* headers inside the transmitted RTP payload. */ + + /* statistics, used for 2-pass encoding */ + int mv_bits; + int header_bits; + int i_tex_bits; + int p_tex_bits; + int i_count; + int p_count; + int skip_count; + int misc_bits; + + /** + * number of bits used for the previously encoded frame + * - encoding: Set by libavcodec. + * - decoding: unused + */ + int frame_bits; + + /** + * pass1 encoding statistics output buffer + * - encoding: Set by libavcodec. + * - decoding: unused + */ + char *stats_out; + + /** + * pass2 encoding statistics input buffer + * Concatenated stuff from stats_out of pass1 should be placed here. + * - encoding: Allocated/set/freed by user. + * - decoding: unused + */ + char *stats_in; + + /** + * Work around bugs in encoders which sometimes cannot be detected automatically. + * - encoding: Set by user + * - decoding: Set by user + */ + int workaround_bugs; +#define FF_BUG_AUTODETECT 1 ///< autodetection +#if FF_API_OLD_MSMPEG4 +#define FF_BUG_OLD_MSMPEG4 2 +#endif +#define FF_BUG_XVID_ILACE 4 +#define FF_BUG_UMP4 8 +#define FF_BUG_NO_PADDING 16 +#define FF_BUG_AMV 32 +#if FF_API_AC_VLC +#define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default. +#endif +#define FF_BUG_QPEL_CHROMA 64 +#define FF_BUG_STD_QPEL 128 +#define FF_BUG_QPEL_CHROMA2 256 +#define FF_BUG_DIRECT_BLOCKSIZE 512 +#define FF_BUG_EDGE 1024 +#define FF_BUG_HPEL_CHROMA 2048 +#define FF_BUG_DC_CLIP 4096 +#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders. +#define FF_BUG_TRUNCATED 16384 + + /** + * strictly follow the standard (MPEG4, ...). + * - encoding: Set by user. + * - decoding: Set by user. + * Setting this to STRICT or higher means the encoder and decoder will + * generally do stupid things, whereas setting it to unofficial or lower + * will mean the encoder might produce output that is not supported by all + * spec-compliant decoders. Decoders don't differentiate between normal, + * unofficial and experimental (that is, they always try to decode things + * when they can) unless they are explicitly asked to behave stupidly + * (=strictly conform to the specs) + */ + int strict_std_compliance; +#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software. +#define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences. +#define FF_COMPLIANCE_NORMAL 0 +#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions +#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things. + + /** + * error concealment flags + * - encoding: unused + * - decoding: Set by user. + */ + int error_concealment; +#define FF_EC_GUESS_MVS 1 +#define FF_EC_DEBLOCK 2 +#define FF_EC_FAVOR_INTER 256 + + /** + * debug + * - encoding: Set by user. + * - decoding: Set by user. + */ + int debug; +#define FF_DEBUG_PICT_INFO 1 +#define FF_DEBUG_RC 2 +#define FF_DEBUG_BITSTREAM 4 +#define FF_DEBUG_MB_TYPE 8 +#define FF_DEBUG_QP 16 +#if FF_API_DEBUG_MV +/** + * @deprecated this option does nothing + */ +#define FF_DEBUG_MV 32 +#endif +#define FF_DEBUG_DCT_COEFF 0x00000040 +#define FF_DEBUG_SKIP 0x00000080 +#define FF_DEBUG_STARTCODE 0x00000100 +#if FF_API_UNUSED_MEMBERS +#define FF_DEBUG_PTS 0x00000200 +#endif /* FF_API_UNUSED_MEMBERS */ +#define FF_DEBUG_ER 0x00000400 +#define FF_DEBUG_MMCO 0x00000800 +#define FF_DEBUG_BUGS 0x00001000 +#if FF_API_DEBUG_MV +#define FF_DEBUG_VIS_QP 0x00002000 ///< only access through AVOptions from outside libavcodec +#define FF_DEBUG_VIS_MB_TYPE 0x00004000 ///< only access through AVOptions from outside libavcodec +#endif +#define FF_DEBUG_BUFFERS 0x00008000 +#define FF_DEBUG_THREADS 0x00010000 +#define FF_DEBUG_NOMC 0x01000000 + +#if FF_API_DEBUG_MV + /** + * debug + * Code outside libavcodec should access this field using AVOptions + * - encoding: Set by user. + * - decoding: Set by user. + */ + int debug_mv; +#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames +#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames +#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames +#endif + + /** + * Error recognition; may misdetect some more or less valid parts as errors. + * - encoding: unused + * - decoding: Set by user. + */ + int err_recognition; + +/** + * Verify checksums embedded in the bitstream (could be of either encoded or + * decoded data, depending on the codec) and print an error message on mismatch. + * If AV_EF_EXPLODE is also set, a mismatching checksum will result in the + * decoder returning an error. + */ +#define AV_EF_CRCCHECK (1<<0) +#define AV_EF_BITSTREAM (1<<1) ///< detect bitstream specification deviations +#define AV_EF_BUFFER (1<<2) ///< detect improper bitstream length +#define AV_EF_EXPLODE (1<<3) ///< abort decoding on minor error detection + +#define AV_EF_IGNORE_ERR (1<<15) ///< ignore errors and continue +#define AV_EF_CAREFUL (1<<16) ///< consider things that violate the spec, are fast to calculate and have not been seen in the wild as errors +#define AV_EF_COMPLIANT (1<<17) ///< consider all spec non compliances as errors +#define AV_EF_AGGRESSIVE (1<<18) ///< consider things that a sane encoder should not do as an error + + + /** + * opaque 64bit number (generally a PTS) that will be reordered and + * output in AVFrame.reordered_opaque + * - encoding: unused + * - decoding: Set by user. + */ + int64_t reordered_opaque; + + /** + * Hardware accelerator in use + * - encoding: unused. + * - decoding: Set by libavcodec + */ + struct AVHWAccel *hwaccel; + + /** + * Hardware accelerator context. + * For some hardware accelerators, a global context needs to be + * provided by the user. In that case, this holds display-dependent + * data FFmpeg cannot instantiate itself. Please refer to the + * FFmpeg HW accelerator documentation to know how to fill this + * is. e.g. for VA API, this is a struct vaapi_context. + * - encoding: unused + * - decoding: Set by user + */ + void *hwaccel_context; + + /** + * error + * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR. + * - decoding: unused + */ + uint64_t error[AV_NUM_DATA_POINTERS]; + + /** + * DCT algorithm, see FF_DCT_* below + * - encoding: Set by user. + * - decoding: unused + */ + int dct_algo; +#define FF_DCT_AUTO 0 +#define FF_DCT_FASTINT 1 +#if FF_API_UNUSED_MEMBERS +#define FF_DCT_INT 2 +#endif /* FF_API_UNUSED_MEMBERS */ +#define FF_DCT_MMX 3 +#define FF_DCT_ALTIVEC 5 +#define FF_DCT_FAAN 6 + + /** + * IDCT algorithm, see FF_IDCT_* below. + * - encoding: Set by user. + * - decoding: Set by user. + */ + int idct_algo; +#define FF_IDCT_AUTO 0 +#define FF_IDCT_INT 1 +#define FF_IDCT_SIMPLE 2 +#define FF_IDCT_SIMPLEMMX 3 +#define FF_IDCT_ARM 7 +#define FF_IDCT_ALTIVEC 8 +#if FF_API_ARCH_SH4 +#define FF_IDCT_SH4 9 +#endif +#define FF_IDCT_SIMPLEARM 10 +#if FF_API_UNUSED_MEMBERS +#define FF_IDCT_IPP 13 +#endif /* FF_API_UNUSED_MEMBERS */ +#define FF_IDCT_XVID 14 +#if FF_API_IDCT_XVIDMMX +#define FF_IDCT_XVIDMMX 14 +#endif /* FF_API_IDCT_XVIDMMX */ +#define FF_IDCT_SIMPLEARMV5TE 16 +#define FF_IDCT_SIMPLEARMV6 17 +#if FF_API_ARCH_SPARC +#define FF_IDCT_SIMPLEVIS 18 +#endif +#define FF_IDCT_FAAN 20 +#define FF_IDCT_SIMPLENEON 22 +#if FF_API_ARCH_ALPHA +#define FF_IDCT_SIMPLEALPHA 23 +#endif +#define FF_IDCT_SIMPLEAUTO 128 + + /** + * bits per sample/pixel from the demuxer (needed for huffyuv). + * - encoding: Set by libavcodec. + * - decoding: Set by user. + */ + int bits_per_coded_sample; + + /** + * Bits per sample/pixel of internal libavcodec pixel/sample format. + * - encoding: set by user. + * - decoding: set by libavcodec. + */ + int bits_per_raw_sample; + +#if FF_API_LOWRES + /** + * low resolution decoding, 1-> 1/2 size, 2->1/4 size + * - encoding: unused + * - decoding: Set by user. + * Code outside libavcodec should access this field using: + * av_codec_{get,set}_lowres(avctx) + */ + int lowres; +#endif + + /** + * the picture in the bitstream + * - encoding: Set by libavcodec. + * - decoding: unused + */ + AVFrame *coded_frame; + + /** + * thread count + * is used to decide how many independent tasks should be passed to execute() + * - encoding: Set by user. + * - decoding: Set by user. + */ + int thread_count; + + /** + * Which multithreading methods to use. + * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread, + * so clients which cannot provide future frames should not use it. + * + * - encoding: Set by user, otherwise the default is used. + * - decoding: Set by user, otherwise the default is used. + */ + int thread_type; +#define FF_THREAD_FRAME 1 ///< Decode more than one frame at once +#define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once + + /** + * Which multithreading methods are in use by the codec. + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int active_thread_type; + + /** + * Set by the client if its custom get_buffer() callback can be called + * synchronously from another thread, which allows faster multithreaded decoding. + * draw_horiz_band() will be called from other threads regardless of this setting. + * Ignored if the default get_buffer() is used. + * - encoding: Set by user. + * - decoding: Set by user. + */ + int thread_safe_callbacks; + + /** + * The codec may call this to execute several independent things. + * It will return only after finishing all tasks. + * The user may replace this with some multithreaded implementation, + * the default implementation will execute the parts serially. + * @param count the number of things to execute + * - encoding: Set by libavcodec, user can override. + * - decoding: Set by libavcodec, user can override. + */ + int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), + void *arg2, int *ret, int count, int size); + + /** + * The codec may call this to execute several independent things. + * It will return only after finishing all tasks. + * The user may replace this with some multithreaded implementation, + * the default implementation will execute the parts serially. + * Also see avcodec_thread_init and e.g. the --enable-pthread configure option. + * @param c context passed also to func + * @param count the number of things to execute + * @param arg2 argument passed unchanged to func + * @param ret return values of executed functions, must have space for "count" values. May be NULL. + * @param func function that will be called count times, with jobnr from 0 to count-1. + * threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no + * two instances of func executing at the same time will have the same threadnr. + * @return always 0 currently, but code should handle a future improvement where when any call to func + * returns < 0 no further calls to func may be done and < 0 is returned. + * - encoding: Set by libavcodec, user can override. + * - decoding: Set by libavcodec, user can override. + */ + int (*execute2)(struct AVCodecContext *c, + int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), + void *arg2, int *ret, int count); + +#if FF_API_THREAD_OPAQUE + /** + * @deprecated this field should not be used from outside of lavc + */ + attribute_deprecated + void *thread_opaque; +#endif + + /** + * noise vs. sse weight for the nsse comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int nsse_weight; + + /** + * profile + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int profile; +#define FF_PROFILE_UNKNOWN -99 +#define FF_PROFILE_RESERVED -100 + +#define FF_PROFILE_AAC_MAIN 0 +#define FF_PROFILE_AAC_LOW 1 +#define FF_PROFILE_AAC_SSR 2 +#define FF_PROFILE_AAC_LTP 3 +#define FF_PROFILE_AAC_HE 4 +#define FF_PROFILE_AAC_HE_V2 28 +#define FF_PROFILE_AAC_LD 22 +#define FF_PROFILE_AAC_ELD 38 +#define FF_PROFILE_MPEG2_AAC_LOW 128 +#define FF_PROFILE_MPEG2_AAC_HE 131 + +#define FF_PROFILE_DTS 20 +#define FF_PROFILE_DTS_ES 30 +#define FF_PROFILE_DTS_96_24 40 +#define FF_PROFILE_DTS_HD_HRA 50 +#define FF_PROFILE_DTS_HD_MA 60 + +#define FF_PROFILE_MPEG2_422 0 +#define FF_PROFILE_MPEG2_HIGH 1 +#define FF_PROFILE_MPEG2_SS 2 +#define FF_PROFILE_MPEG2_SNR_SCALABLE 3 +#define FF_PROFILE_MPEG2_MAIN 4 +#define FF_PROFILE_MPEG2_SIMPLE 5 + +#define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag +#define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag + +#define FF_PROFILE_H264_BASELINE 66 +#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED) +#define FF_PROFILE_H264_MAIN 77 +#define FF_PROFILE_H264_EXTENDED 88 +#define FF_PROFILE_H264_HIGH 100 +#define FF_PROFILE_H264_HIGH_10 110 +#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_HIGH_422 122 +#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_HIGH_444 144 +#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244 +#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_CAVLC_444 44 + +#define FF_PROFILE_VC1_SIMPLE 0 +#define FF_PROFILE_VC1_MAIN 1 +#define FF_PROFILE_VC1_COMPLEX 2 +#define FF_PROFILE_VC1_ADVANCED 3 + +#define FF_PROFILE_MPEG4_SIMPLE 0 +#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1 +#define FF_PROFILE_MPEG4_CORE 2 +#define FF_PROFILE_MPEG4_MAIN 3 +#define FF_PROFILE_MPEG4_N_BIT 4 +#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5 +#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6 +#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7 +#define FF_PROFILE_MPEG4_HYBRID 8 +#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9 +#define FF_PROFILE_MPEG4_CORE_SCALABLE 10 +#define FF_PROFILE_MPEG4_ADVANCED_CODING 11 +#define FF_PROFILE_MPEG4_ADVANCED_CORE 12 +#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13 +#define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14 +#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15 + +#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0 0 +#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1 1 +#define FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION 2 +#define FF_PROFILE_JPEG2000_DCINEMA_2K 3 +#define FF_PROFILE_JPEG2000_DCINEMA_4K 4 + + +#define FF_PROFILE_HEVC_MAIN 1 +#define FF_PROFILE_HEVC_MAIN_10 2 +#define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3 +#define FF_PROFILE_HEVC_REXT 4 + + /** + * level + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int level; +#define FF_LEVEL_UNKNOWN -99 + + /** + * Skip loop filtering for selected frames. + * - encoding: unused + * - decoding: Set by user. + */ + enum AVDiscard skip_loop_filter; + + /** + * Skip IDCT/dequantization for selected frames. + * - encoding: unused + * - decoding: Set by user. + */ + enum AVDiscard skip_idct; + + /** + * Skip decoding for selected frames. + * - encoding: unused + * - decoding: Set by user. + */ + enum AVDiscard skip_frame; + + /** + * Header containing style information for text subtitles. + * For SUBTITLE_ASS subtitle type, it should contain the whole ASS + * [Script Info] and [V4+ Styles] section, plus the [Events] line and + * the Format line following. It shouldn't include any Dialogue line. + * - encoding: Set/allocated/freed by user (before avcodec_open2()) + * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2()) + */ + uint8_t *subtitle_header; + int subtitle_header_size; + +#if FF_API_ERROR_RATE + /** + * @deprecated use the 'error_rate' private AVOption of the mpegvideo + * encoders + */ + attribute_deprecated + int error_rate; +#endif + +#if FF_API_CODEC_PKT + /** + * @deprecated this field is not supposed to be accessed from outside lavc + */ + attribute_deprecated + AVPacket + * + pkt; +#endif + + /** + * VBV delay coded in the last frame (in periods of a 27 MHz clock). + * Used for compliant TS muxing. + * - encoding: Set by libavcodec. + * - decoding: unused. + */ + uint64_t vbv_delay; + + /** + * Encoding only. Allow encoders to output packets that do not contain any + * encoded data, only side data. + * + * Some encoders need to output such packets, e.g. to update some stream + * parameters at the end of encoding. + * + * All callers are strongly recommended to set this option to 1 and update + * their code to deal with such packets, since this behaviour may become + * always enabled in the future (then this option will be deprecated and + * later removed). To avoid ABI issues when this happens, the callers should + * use AVOptions to set this field. + */ + int side_data_only_packets; + + /** + * Audio only. The number of "priming" samples (padding) inserted by the + * encoder at the beginning of the audio. I.e. this number of leading + * decoded samples must be discarded by the caller to get the original audio + * without leading padding. + * + * - decoding: unused + * - encoding: Set by libavcodec. The timestamps on the output packets are + * adjusted by the encoder so that they always refer to the + * first sample of the data actually contained in the packet, + * including any added padding. E.g. if the timebase is + * 1/samplerate and the timestamp of the first input sample is + * 0, the timestamp of the first output packet will be + * -initial_padding. + */ + int initial_padding; + + /** + * - decoding: For codecs that store a framerate value in the compressed + * bitstream, the decoder may export it here. { 0, 1} when + * unknown. + * - encoding: unused + */ + AVRational framerate; + + /** + * Timebase in which pkt_dts/pts and AVPacket.dts/pts are. + * Code outside libavcodec should access this field using: + * av_codec_{get,set}_pkt_timebase(avctx) + * - encoding unused. + * - decoding set by user. + */ + AVRational pkt_timebase; + + /** + * AVCodecDescriptor + * Code outside libavcodec should access this field using: + * av_codec_{get,set}_codec_descriptor(avctx) + * - encoding: unused. + * - decoding: set by libavcodec. + */ + const AVCodecDescriptor *codec_descriptor; + +#if !FF_API_LOWRES + /** + * low resolution decoding, 1-> 1/2 size, 2->1/4 size + * - encoding: unused + * - decoding: Set by user. + * Code outside libavcodec should access this field using: + * av_codec_{get,set}_lowres(avctx) + */ + int lowres; +#endif + + /** + * Current statistics for PTS correction. + * - decoding: maintained and used by libavcodec, not intended to be used by user apps + * - encoding: unused + */ + int64_t pts_correction_num_faulty_pts; /// Number of incorrect PTS values so far + int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values so far + int64_t pts_correction_last_pts; /// PTS of the last frame + int64_t pts_correction_last_dts; /// DTS of the last frame + + /** + * Character encoding of the input subtitles file. + * - decoding: set by user + * - encoding: unused + */ + char *sub_charenc; + + /** + * Subtitles character encoding mode. Formats or codecs might be adjusting + * this setting (if they are doing the conversion themselves for instance). + * - decoding: set by libavcodec + * - encoding: unused + */ + int sub_charenc_mode; +#define FF_SUB_CHARENC_MODE_DO_NOTHING -1 ///< do nothing (demuxer outputs a stream supposed to be already in UTF-8, or the codec is bitmap for instance) +#define FF_SUB_CHARENC_MODE_AUTOMATIC 0 ///< libavcodec will select the mode itself +#define FF_SUB_CHARENC_MODE_PRE_DECODER 1 ///< the AVPacket data needs to be recoded to UTF-8 before being fed to the decoder, requires iconv + + /** + * Skip processing alpha if supported by codec. + * Note that if the format uses pre-multiplied alpha (common with VP6, + * and recommended due to better video quality/compression) + * the image will look as if alpha-blended onto a black background. + * However for formats that do not use pre-multiplied alpha + * there might be serious artefacts (though e.g. libswscale currently + * assumes pre-multiplied alpha anyway). + * Code outside libavcodec should access this field using AVOptions + * + * - decoding: set by user + * - encoding: unused + */ + int skip_alpha; + + /** + * Number of samples to skip after a discontinuity + * - decoding: unused + * - encoding: set by libavcodec + */ + int seek_preroll; + +#if !FF_API_DEBUG_MV + /** + * debug motion vectors + * Code outside libavcodec should access this field using AVOptions + * - encoding: Set by user. + * - decoding: Set by user. + */ + int debug_mv; +#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames +#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames +#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames +#endif + + /** + * custom intra quantization matrix + * Code outside libavcodec should access this field using av_codec_g/set_chroma_intra_matrix() + * - encoding: Set by user, can be NULL. + * - decoding: unused. + */ + uint16_t *chroma_intra_matrix; + + /** + * dump format separator. + * can be ", " or "\n " or anything else + * Code outside libavcodec should access this field using AVOptions + * (NO direct access). + * - encoding: Set by user. + * - decoding: Set by user. + */ + uint8_t *dump_separator; + + /** + * ',' separated list of allowed decoders. + * If NULL then all are allowed + * - encoding: unused + * - decoding: set by user through AVOPtions (NO direct access) + */ + char *codec_whitelist; +} AVCodecContext; + +AVRational av_codec_get_pkt_timebase(const AVCodecContext *avctx); + +void av_codec_set_pkt_timebase(AVCodecContext *avctx, AVRational val); + +const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx); + +void av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc); + +int av_codec_get_lowres(const AVCodecContext *avctx); + +void av_codec_set_lowres(AVCodecContext *avctx, int val); + +int av_codec_get_seek_preroll(const AVCodecContext *avctx); + +void av_codec_set_seek_preroll(AVCodecContext *avctx, int val); + +uint16_t *av_codec_get_chroma_intra_matrix(const AVCodecContext *avctx); + +void av_codec_set_chroma_intra_matrix(AVCodecContext *avctx, uint16_t *val); + +/** + * AVProfile. + */ +typedef struct AVProfile { + int profile; + const char *name; ///< short name for the profile +} AVProfile; + +typedef struct AVCodecDefault AVCodecDefault; + +struct AVSubtitle; + +/** + * AVCodec. + */ +typedef struct AVCodec { + /** + * Name of the codec implementation. + * The name is globally unique among encoders and among decoders (but an + * encoder and a decoder can share the same name). + * This is the primary way to find a codec from the user perspective. + */ + const char *name; + /** + * Descriptive name for the codec, meant to be more human readable than name. + * You should use the NULL_IF_CONFIG_SMALL() macro to define it. + */ + const char *long_name; + enum AVMediaType type; + enum AVCodecID id; + /** + * Codec capabilities. + * see CODEC_CAP_* + */ + int capabilities; + const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0} + const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 + const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 + const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 + const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 +#if FF_API_LOWRES + uint8_t max_lowres; ///< maximum value for lowres supported by the decoder, no direct access, use av_codec_get_max_lowres() +#endif + const AVClass *priv_class; ///< AVClass for the private context + const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} + + /***************************************************************** + * No fields below this line are part of the public API. They + * may not be used outside of libavcodec and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + int priv_data_size; + struct AVCodec *next; + /** + * @name Frame-level threading support functions + * @{ + */ + /** + * If defined, called on thread contexts when they are created. + * If the codec allocates writable tables in init(), re-allocate them here. + * priv_data will be set to a copy of the original. + */ + int (*init_thread_copy)(AVCodecContext *); + + /** + * Copy necessary context variables from a previous thread context to the current one. + * If not defined, the next thread will start automatically; otherwise, the codec + * must call ff_thread_finish_setup(). + * + * dst and src will (rarely) point to the same context, in which case memcpy should be skipped. + */ + int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src); + /** @} */ + + /** + * Private codec-specific defaults. + */ + const AVCodecDefault *defaults; + + /** + * Initialize codec static data, called from avcodec_register(). + */ + void (*init_static_data)(struct AVCodec *codec); + + int (*init)(AVCodecContext *); + + int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size, + const struct AVSubtitle *sub); + + /** + * Encode data to an AVPacket. + * + * @param avctx codec context + * @param avpkt output AVPacket (may contain a user-provided buffer) + * @param[in] frame AVFrame containing the raw data to be encoded + * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a + * non-empty packet was returned in avpkt. + * @return 0 on success, negative error code on failure + */ + int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, + int *got_packet_ptr); + + int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt); + + int (*close)(AVCodecContext *); + + /** + * Flush buffers. + * Will be called when seeking + */ + void (*flush)(AVCodecContext *); +} AVCodec; + +int av_codec_get_max_lowres(const AVCodec *codec); + +struct MpegEncContext; + +/** + * @defgroup lavc_hwaccel AVHWAccel + * @{ + */ +typedef struct AVHWAccel { + /** + * Name of the hardware accelerated codec. + * The name is globally unique among encoders and among decoders (but an + * encoder and a decoder can share the same name). + */ + const char *name; + + /** + * Type of codec implemented by the hardware accelerator. + * + * See AVMEDIA_TYPE_xxx + */ + enum AVMediaType type; + + /** + * Codec implemented by the hardware accelerator. + * + * See AV_CODEC_ID_xxx + */ + enum AVCodecID id; + + /** + * Supported pixel format. + * + * Only hardware accelerated formats are supported here. + */ + enum AVPixelFormat pix_fmt; + + /** + * Hardware accelerated codec capabilities. + * see FF_HWACCEL_CODEC_CAP_* + */ + int capabilities; + + /***************************************************************** + * No fields below this line are part of the public API. They + * may not be used outside of libavcodec and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + struct AVHWAccel *next; + + /** + * Allocate a custom buffer + */ + int (*alloc_frame)(AVCodecContext *avctx, AVFrame *frame); + + /** + * Called at the beginning of each frame or field picture. + * + * Meaningful frame information (codec specific) is guaranteed to + * be parsed at this point. This function is mandatory. + * + * Note that buf can be NULL along with buf_size set to 0. + * Otherwise, this means the whole frame is available at this point. + * + * @param avctx the codec context + * @param buf the frame data buffer base + * @param buf_size the size of the frame in bytes + * @return zero if successful, a negative value otherwise + */ + int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); + + /** + * Callback for each slice. + * + * Meaningful slice information (codec specific) is guaranteed to + * be parsed at this point. This function is mandatory. + * The only exception is XvMC, that works on MB level. + * + * @param avctx the codec context + * @param buf the slice data buffer base + * @param buf_size the size of the slice in bytes + * @return zero if successful, a negative value otherwise + */ + int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); + + /** + * Called at the end of each frame or field picture. + * + * The whole picture is parsed at this point and can now be sent + * to the hardware accelerator. This function is mandatory. + * + * @param avctx the codec context + * @return zero if successful, a negative value otherwise + */ + int (*end_frame)(AVCodecContext *avctx); + + /** + * Size of per-frame hardware accelerator private data. + * + * Private data is allocated with av_mallocz() before + * AVCodecContext.get_buffer() and deallocated after + * AVCodecContext.release_buffer(). + */ + int frame_priv_data_size; + + /** + * Called for every Macroblock in a slice. + * + * XvMC uses it to replace the ff_mpv_decode_mb(). + * Instead of decoding to raw picture, MB parameters are + * stored in an array provided by the video driver. + * + * @param s the mpeg context + */ + void (*decode_mb)(struct MpegEncContext *s); + + /** + * Initialize the hwaccel private data. + * + * This will be called from ff_get_format(), after hwaccel and + * hwaccel_context are set and the hwaccel private data in AVCodecInternal + * is allocated. + */ + int (*init)(AVCodecContext *avctx); + + /** + * Uninitialize the hwaccel private data. + * + * This will be called from get_format() or avcodec_close(), after hwaccel + * and hwaccel_context are already uninitialized. + */ + int (*uninit)(AVCodecContext *avctx); + + /** + * Size of the private data to allocate in + * AVCodecInternal.hwaccel_priv_data. + */ + int priv_data_size; +} AVHWAccel; + +/** + * Hardware acceleration should be used for decoding even if the codec level + * used is unknown or higher than the maximum supported level reported by the + * hardware driver. + */ +#define AV_HWACCEL_FLAG_IGNORE_LEVEL (1 << 0) + +/** + * @} + */ + +/** + * @defgroup lavc_picture AVPicture + * + * Functions for working with AVPicture + * @{ + */ + +/** + * Picture data structure. + * + * Up to four components can be stored into it, the last component is + * alpha. + */ +typedef struct AVPicture { + uint8_t *data[AV_NUM_DATA_POINTERS]; ///< pointers to the image data planes + int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line +} AVPicture; + +/** + * @} + */ + +enum AVSubtitleType { + SUBTITLE_NONE, + + SUBTITLE_BITMAP, ///< A bitmap, pict will be set + + /** + * Plain text, the text field must be set by the decoder and is + * authoritative. ass and pict fields may contain approximations. + */ + SUBTITLE_TEXT, + + /** + * Formatted text, the ass field must be set by the decoder and is + * authoritative. pict and text fields may contain approximations. + */ + SUBTITLE_ASS, +}; + +#define AV_SUBTITLE_FLAG_FORCED 0x00000001 + +typedef struct AVSubtitleRect { + int x; ///< top left corner of pict, undefined when pict is not set + int y; ///< top left corner of pict, undefined when pict is not set + int w; ///< width of pict, undefined when pict is not set + int h; ///< height of pict, undefined when pict is not set + int nb_colors; ///< number of colors in pict, undefined when pict is not set + + /** + * data+linesize for the bitmap of this subtitle. + * can be set for text/ass as well once they where rendered + */ + AVPicture pict; + enum AVSubtitleType type; + + char *text; ///< 0 terminated plain UTF-8 text + + /** + * 0 terminated ASS/SSA compatible event line. + * The presentation of this is unaffected by the other values in this + * struct. + */ + char *ass; + + int flags; +} AVSubtitleRect; + +typedef struct AVSubtitle { + uint16_t format; /* 0 = graphics */ + uint32_t start_display_time; /* relative to packet pts, in ms */ + uint32_t end_display_time; /* relative to packet pts, in ms */ + unsigned num_rects; + AVSubtitleRect **rects; + int64_t pts; ///< Same as packet pts, in AV_TIME_BASE +} AVSubtitle; + +/** + * If c is NULL, returns the first registered codec, + * if c is non-NULL, returns the next registered codec after c, + * or NULL if c is the last one. + */ +AVCodec *av_codec_next(const AVCodec *c); + +/** + * Return the LIBAVCODEC_VERSION_INT constant. + */ +unsigned avcodec_version(void); + +/** + * Return the libavcodec build-time configuration. + */ +const char *avcodec_configuration(void); + +/** + * Return the libavcodec license. + */ +const char *avcodec_license(void); + +/** + * Register the codec codec and initialize libavcodec. + * + * @warning either this function or avcodec_register_all() must be called + * before any other libavcodec functions. + * + * @see avcodec_register_all() + */ +void avcodec_register(AVCodec *codec); + +/** + * Register all the codecs, parsers and bitstream filters which were enabled at + * configuration time. If you do not call this function you can select exactly + * which formats you want to support, by using the individual registration + * functions. + * + * @see avcodec_register + * @see av_register_codec_parser + * @see av_register_bitstream_filter + */ +void avcodec_register_all(void); + +/** + * Allocate an AVCodecContext and set its fields to default values. The + * resulting struct should be freed with avcodec_free_context(). + * + * @param codec if non-NULL, allocate private data and initialize defaults + * for the given codec. It is illegal to then call avcodec_open2() + * with a different codec. + * If NULL, then the codec-specific defaults won't be initialized, + * which may result in suboptimal default settings (this is + * important mainly for encoders, e.g. libx264). + * + * @return An AVCodecContext filled with default values or NULL on failure. + * @see avcodec_get_context_defaults + */ +AVCodecContext *avcodec_alloc_context3(const AVCodec *codec); + +/** + * Free the codec context and everything associated with it and write NULL to + * the provided pointer. + */ +void avcodec_free_context(AVCodecContext **avctx); + +/** + * Set the fields of the given AVCodecContext to default values corresponding + * to the given codec (defaults may be codec-dependent). + * + * Do not call this function if a non-NULL codec has been passed + * to avcodec_alloc_context3() that allocated this AVCodecContext. + * If codec is non-NULL, it is illegal to call avcodec_open2() with a + * different codec on this AVCodecContext. + */ +int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec); + +/** + * Get the AVClass for AVCodecContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *avcodec_get_class(void); + +/** + * Get the AVClass for AVFrame. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *avcodec_get_frame_class(void); + +/** + * Get the AVClass for AVSubtitleRect. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *avcodec_get_subtitle_rect_class(void); + +/** + * Copy the settings of the source AVCodecContext into the destination + * AVCodecContext. The resulting destination codec context will be + * unopened, i.e. you are required to call avcodec_open2() before you + * can use this AVCodecContext to decode/encode video/audio data. + * + * @param dest target codec context, should be initialized with + * avcodec_alloc_context3(NULL), but otherwise uninitialized + * @param src source codec context + * @return AVERROR() on error (e.g. memory allocation error), 0 on success + */ +int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src); + +#if FF_API_AVFRAME_LAVC +/** + * @deprecated use av_frame_alloc() + */ +attribute_deprecated +AVFrame *avcodec_alloc_frame(void); + +/** + * Set the fields of the given AVFrame to default values. + * + * @param frame The AVFrame of which the fields should be set to default values. + * + * @deprecated use av_frame_unref() + */ +attribute_deprecated +void avcodec_get_frame_defaults(AVFrame *frame); + +/** + * Free the frame and any dynamically allocated objects in it, + * e.g. extended_data. + * + * @param frame frame to be freed. The pointer will be set to NULL. + * + * @warning this function does NOT free the data buffers themselves + * (it does not know how, since they might have been allocated with + * a custom get_buffer()). + * + * @deprecated use av_frame_free() + */ +attribute_deprecated +void avcodec_free_frame(AVFrame **frame); +#endif + +/** + * Initialize the AVCodecContext to use the given AVCodec. Prior to using this + * function the context has to be allocated with avcodec_alloc_context3(). + * + * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(), + * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for + * retrieving a codec. + * + * @warning This function is not thread safe! + * + * @code + * avcodec_register_all(); + * av_dict_set(&opts, "b", "2.5M", 0); + * codec = avcodec_find_decoder(AV_CODEC_ID_H264); + * if (!codec) + * exit(1); + * + * context = avcodec_alloc_context3(codec); + * + * if (avcodec_open2(context, codec, opts) < 0) + * exit(1); + * @endcode + * + * @param avctx The context to initialize. + * @param codec The codec to open this context for. If a non-NULL codec has been + * previously passed to avcodec_alloc_context3() or + * avcodec_get_context_defaults3() for this context, then this + * parameter MUST be either NULL or equal to the previously passed + * codec. + * @param options A dictionary filled with AVCodecContext and codec-private options. + * On return this object will be filled with options that were not found. + * + * @return zero on success, a negative value on error + * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(), + * av_dict_set(), av_opt_find(). + */ +int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options); + +/** + * Close a given AVCodecContext and free all the data associated with it + * (but not the AVCodecContext itself). + * + * Calling this function on an AVCodecContext that hasn't been opened will free + * the codec-specific data allocated in avcodec_alloc_context3() / + * avcodec_get_context_defaults3() with a non-NULL codec. Subsequent calls will + * do nothing. + */ +int avcodec_close(AVCodecContext *avctx); + +/** + * Free all allocated data in the given subtitle struct. + * + * @param sub AVSubtitle to free. + */ +void avsubtitle_free(AVSubtitle *sub); + +/** + * @} + */ + +/** + * @addtogroup lavc_packet + * @{ + */ + +#if FF_API_DESTRUCT_PACKET + +/** + * Default packet destructor. + * @deprecated use the AVBuffer API instead + */ +attribute_deprecated +void av_destruct_packet(AVPacket *pkt); + +#endif + +/** + * Initialize optional fields of a packet with default values. + * + * Note, this does not touch the data and size members, which have to be + * initialized separately. + * + * @param pkt packet + */ +void av_init_packet(AVPacket *pkt); + +/** + * Allocate the payload of a packet and initialize its fields with + * default values. + * + * @param pkt packet + * @param size wanted payload size + * @return 0 if OK, AVERROR_xxx otherwise + */ +int av_new_packet(AVPacket *pkt, int size); + +/** + * Reduce packet size, correctly zeroing padding + * + * @param pkt packet + * @param size new size + */ +void av_shrink_packet(AVPacket *pkt, int size); + +/** + * Increase packet size, correctly zeroing padding + * + * @param pkt packet + * @param grow_by number of bytes by which to increase the size of the packet + */ +int av_grow_packet(AVPacket *pkt, int grow_by); + +/** + * Initialize a reference-counted packet from av_malloc()ed data. + * + * @param pkt packet to be initialized. This function will set the data, size, + * buf and destruct fields, all others are left untouched. + * @param data Data allocated by av_malloc() to be used as packet data. If this + * function returns successfully, the data is owned by the underlying AVBuffer. + * The caller may not access the data through other means. + * @param size size of data in bytes, without the padding. I.e. the full buffer + * size is assumed to be size + FF_INPUT_BUFFER_PADDING_SIZE. + * + * @return 0 on success, a negative AVERROR on error + */ +int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size); + +/** + * @warning This is a hack - the packet memory allocation stuff is broken. The + * packet is allocated if it was not really allocated. + */ +int av_dup_packet(AVPacket *pkt); + +/** + * Copy packet, including contents + * + * @return 0 on success, negative AVERROR on fail + */ +int av_copy_packet(AVPacket *dst, const AVPacket *src); + +/** + * Copy packet side data + * + * @return 0 on success, negative AVERROR on fail + */ +int av_copy_packet_side_data(AVPacket *dst, const AVPacket *src); + +/** + * Free a packet. + * + * @param pkt packet to free + */ +void av_free_packet(AVPacket *pkt); + +/** + * Allocate new information of a packet. + * + * @param pkt packet + * @param type side information type + * @param size side information size + * @return pointer to fresh allocated data or NULL otherwise + */ +uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + int size); + +/** + * Shrink the already allocated side data buffer + * + * @param pkt packet + * @param type side information type + * @param size new side information size + * @return 0 on success, < 0 on failure + */ +int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + int size); + +/** + * Get side information from packet. + * + * @param pkt packet + * @param type desired side information type + * @param size pointer for side information size to store (optional) + * @return pointer to data if present or NULL otherwise + */ +uint8_t *av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + int *size); + +int av_packet_merge_side_data(AVPacket *pkt); + +int av_packet_split_side_data(AVPacket *pkt); + +/** + * Pack a dictionary for use in side_data. + * + * @param dict The dictionary to pack. + * @param size pointer to store the size of the returned data + * @return pointer to data if successful, NULL otherwise + */ +uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size); + +/** + * Unpack a dictionary from side_data. + * + * @param data data from side_data + * @param size size of the data + * @param dict the metadata storage dictionary + * @return 0 on success, < 0 on failure + */ +int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict); + + +/** + * Convenience function to free all the side data stored. + * All the other fields stay untouched. + * + * @param pkt packet + */ +void av_packet_free_side_data(AVPacket *pkt); + +/** + * Setup a new reference to the data described by a given packet + * + * If src is reference-counted, setup dst as a new reference to the + * buffer in src. Otherwise allocate a new buffer in dst and copy the + * data from src into it. + * + * All the other fields are copied from src. + * + * @see av_packet_unref + * + * @param dst Destination packet + * @param src Source packet + * + * @return 0 on success, a negative AVERROR on error. + */ +int av_packet_ref(AVPacket *dst, const AVPacket *src); + +/** + * Wipe the packet. + * + * Unreference the buffer referenced by the packet and reset the + * remaining packet fields to their default values. + * + * @param pkt The packet to be unreferenced. + */ +void av_packet_unref(AVPacket *pkt); + +/** + * Move every field in src to dst and reset src. + * + * @see av_packet_unref + * + * @param src Source packet, will be reset + * @param dst Destination packet + */ +void av_packet_move_ref(AVPacket *dst, AVPacket *src); + +/** + * Copy only "properties" fields from src to dst. + * + * Properties for the purpose of this function are all the fields + * beside those related to the packet data (buf, data, size) + * + * @param dst Destination packet + * @param src Source packet + * + * @return 0 on success AVERROR on failure. + * + */ +int av_packet_copy_props(AVPacket *dst, const AVPacket *src); + +/** + * Convert valid timing fields (timestamps / durations) in a packet from one + * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be + * ignored. + * + * @param pkt packet on which the conversion will be performed + * @param tb_src source timebase, in which the timing fields in pkt are + * expressed + * @param tb_dst destination timebase, to which the timing fields will be + * converted + */ +void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst); + +/** + * @} + */ + +/** + * @addtogroup lavc_decoding + * @{ + */ + +/** + * Find a registered decoder with a matching codec ID. + * + * @param id AVCodecID of the requested decoder + * @return A decoder if one was found, NULL otherwise. + */ +AVCodec *avcodec_find_decoder(enum AVCodecID id); + +/** + * Find a registered decoder with the specified name. + * + * @param name name of the requested decoder + * @return A decoder if one was found, NULL otherwise. + */ +AVCodec *avcodec_find_decoder_by_name(const char *name); + +#if FF_API_GET_BUFFER + +attribute_deprecated int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic); + +attribute_deprecated void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic); + +attribute_deprecated int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic); + +#endif + +/** + * The default callback for AVCodecContext.get_buffer2(). It is made public so + * it can be called by custom get_buffer2() implementations for decoders without + * CODEC_CAP_DR1 set. + */ +int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags); + +#if FF_API_EMU_EDGE + +/** + * Return the amount of padding in pixels which the get_buffer callback must + * provide around the edge of the image for codecs which do not have the + * CODEC_FLAG_EMU_EDGE flag. + * + * @return Required padding in pixels. + * + * @deprecated CODEC_FLAG_EMU_EDGE is deprecated, so this function is no longer + * needed + */ +attribute_deprecated +unsigned avcodec_get_edge_width(void); + +#endif + +/** + * Modify width and height values so that they will result in a memory + * buffer that is acceptable for the codec if you do not use any horizontal + * padding. + * + * May only be used if a codec with CODEC_CAP_DR1 has been opened. + */ +void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); + +/** + * Modify width and height values so that they will result in a memory + * buffer that is acceptable for the codec if you also ensure that all + * line sizes are a multiple of the respective linesize_align[i]. + * + * May only be used if a codec with CODEC_CAP_DR1 has been opened. + */ +void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, + int linesize_align[AV_NUM_DATA_POINTERS]); + +/** + * Converts AVChromaLocation to swscale x/y chroma position. + * + * The positions represent the chroma (0,0) position in a coordinates system + * with luma (0,0) representing the origin and luma(1,1) representing 256,256 + * + * @param xpos horizontal chroma sample position + * @param ypos vertical chroma sample position + */ +int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos); + +/** + * Converts swscale x/y chroma position to AVChromaLocation. + * + * The positions represent the chroma (0,0) position in a coordinates system + * with luma (0,0) representing the origin and luma(1,1) representing 256,256 + * + * @param xpos horizontal chroma sample position + * @param ypos vertical chroma sample position + */ +enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos); + +#if FF_API_OLD_DECODE_AUDIO + +/** + * Wrapper function which calls avcodec_decode_audio4. + * + * @deprecated Use avcodec_decode_audio4 instead. + * + * Decode the audio frame of size avpkt->size from avpkt->data into samples. + * Some decoders may support multiple frames in a single AVPacket, such + * decoders would then just decode the first frame. In this case, + * avcodec_decode_audio3 has to be called again with an AVPacket that contains + * the remaining data in order to decode the second frame etc. + * If no frame + * could be outputted, frame_size_ptr is zero. Otherwise, it is the + * decompressed frame size in bytes. + * + * @warning You must set frame_size_ptr to the allocated size of the + * output buffer before calling avcodec_decode_audio3(). + * + * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than + * the actual read bytes because some optimized bitstream readers read 32 or 64 + * bits at once and could read over the end. + * + * @warning The end of the input buffer avpkt->data should be set to 0 to ensure that + * no overreading happens for damaged MPEG streams. + * + * @warning You must not provide a custom get_buffer() when using + * avcodec_decode_audio3(). Doing so will override it with + * avcodec_default_get_buffer. Use avcodec_decode_audio4() instead, + * which does allow the application to provide a custom get_buffer(). + * + * @note You might have to align the input buffer avpkt->data and output buffer + * samples. The alignment requirements depend on the CPU: On some CPUs it isn't + * necessary at all, on others it won't work at all if not aligned and on others + * it will work but it will have an impact on performance. + * + * In practice, avpkt->data should have 4 byte alignment at minimum and + * samples should be 16 byte aligned unless the CPU doesn't need it + * (AltiVec and SSE do). + * + * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay + * between input and output, these need to be fed with avpkt->data=NULL, + * avpkt->size=0 at the end to return the remaining frames. + * + * @param avctx the codec context + * @param[out] samples the output buffer, sample type in avctx->sample_fmt + * If the sample format is planar, each channel plane will + * be the same size, with no padding between channels. + * @param[in,out] frame_size_ptr the output buffer size in bytes + * @param[in] avpkt The input AVPacket containing the input buffer. + * You can create such packet with av_init_packet() and by then setting + * data and size, some decoders might in addition need other fields. + * All decoders are designed to use the least fields possible though. + * @return On error a negative value is returned, otherwise the number of bytes + * used or zero if no frame data was decompressed (used) from the input AVPacket. + */ +attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, + int *frame_size_ptr, + AVPacket *avpkt); + +#endif + +/** + * Decode the audio frame of size avpkt->size from avpkt->data into frame. + * + * Some decoders may support multiple frames in a single AVPacket. Such + * decoders would then just decode the first frame and the return value would be + * less than the packet size. In this case, avcodec_decode_audio4 has to be + * called again with an AVPacket containing the remaining data in order to + * decode the second frame, etc... Even if no frames are returned, the packet + * needs to be fed to the decoder with remaining data until it is completely + * consumed or an error occurs. + * + * Some decoders (those marked with CODEC_CAP_DELAY) have a delay between input + * and output. This means that for some packets they will not immediately + * produce decoded output and need to be flushed at the end of decoding to get + * all the decoded data. Flushing is done by calling this function with packets + * with avpkt->data set to NULL and avpkt->size set to 0 until it stops + * returning samples. It is safe to flush even those decoders that are not + * marked with CODEC_CAP_DELAY, then no samples will be returned. + * + * @warning The input buffer, avpkt->data must be FF_INPUT_BUFFER_PADDING_SIZE + * larger than the actual read bytes because some optimized bitstream + * readers read 32 or 64 bits at once and could read over the end. + * + * @param avctx the codec context + * @param[out] frame The AVFrame in which to store decoded audio samples. + * The decoder will allocate a buffer for the decoded frame by + * calling the AVCodecContext.get_buffer2() callback. + * When AVCodecContext.refcounted_frames is set to 1, the frame is + * reference counted and the returned reference belongs to the + * caller. The caller must release the frame using av_frame_unref() + * when the frame is no longer needed. The caller may safely write + * to the frame if av_frame_is_writable() returns 1. + * When AVCodecContext.refcounted_frames is set to 0, the returned + * reference belongs to the decoder and is valid only until the + * next call to this function or until closing or flushing the + * decoder. The caller may not write to it. + * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is + * non-zero. Note that this field being set to zero + * does not mean that an error has occurred. For + * decoders with CODEC_CAP_DELAY set, no given decode + * call is guaranteed to produce a frame. + * @param[in] avpkt The input AVPacket containing the input buffer. + * At least avpkt->data and avpkt->size should be set. Some + * decoders might also require additional fields to be set. + * @return A negative error code is returned if an error occurred during + * decoding, otherwise the number of bytes consumed from the input + * AVPacket is returned. + */ +int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, + int *got_frame_ptr, const AVPacket *avpkt); + +/** + * Decode the video frame of size avpkt->size from avpkt->data into picture. + * Some decoders may support multiple frames in a single AVPacket, such + * decoders would then just decode the first frame. + * + * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than + * the actual read bytes because some optimized bitstream readers read 32 or 64 + * bits at once and could read over the end. + * + * @warning The end of the input buffer buf should be set to 0 to ensure that + * no overreading happens for damaged MPEG streams. + * + * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay + * between input and output, these need to be fed with avpkt->data=NULL, + * avpkt->size=0 at the end to return the remaining frames. + * + * @param avctx the codec context + * @param[out] picture The AVFrame in which the decoded video frame will be stored. + * Use av_frame_alloc() to get an AVFrame. The codec will + * allocate memory for the actual bitmap by calling the + * AVCodecContext.get_buffer2() callback. + * When AVCodecContext.refcounted_frames is set to 1, the frame is + * reference counted and the returned reference belongs to the + * caller. The caller must release the frame using av_frame_unref() + * when the frame is no longer needed. The caller may safely write + * to the frame if av_frame_is_writable() returns 1. + * When AVCodecContext.refcounted_frames is set to 0, the returned + * reference belongs to the decoder and is valid only until the + * next call to this function or until closing or flushing the + * decoder. The caller may not write to it. + * + * @param[in] avpkt The input AVPacket containing the input buffer. + * You can create such packet with av_init_packet() and by then setting + * data and size, some decoders might in addition need other fields like + * flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least + * fields possible. + * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. + * @return On error a negative value is returned, otherwise the number of bytes + * used or zero if no frame could be decompressed. + */ +int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, + int *got_picture_ptr, + const AVPacket *avpkt); + +/** + * Decode a subtitle message. + * Return a negative value on error, otherwise return the number of bytes used. + * If no subtitle could be decompressed, got_sub_ptr is zero. + * Otherwise, the subtitle is stored in *sub. + * Note that CODEC_CAP_DR1 is not available for subtitle codecs. This is for + * simplicity, because the performance difference is expect to be negligible + * and reusing a get_buffer written for video codecs would probably perform badly + * due to a potentially very different allocation pattern. + * + * Some decoders (those marked with CODEC_CAP_DELAY) have a delay between input + * and output. This means that for some packets they will not immediately + * produce decoded output and need to be flushed at the end of decoding to get + * all the decoded data. Flushing is done by calling this function with packets + * with avpkt->data set to NULL and avpkt->size set to 0 until it stops + * returning subtitles. It is safe to flush even those decoders that are not + * marked with CODEC_CAP_DELAY, then no subtitles will be returned. + * + * @param avctx the codec context + * @param[out] sub The Preallocated AVSubtitle in which the decoded subtitle will be stored, + * must be freed with avsubtitle_free if *got_sub_ptr is set. + * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero. + * @param[in] avpkt The input AVPacket containing the input buffer. + */ +int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, + int *got_sub_ptr, + AVPacket *avpkt); + +/** + * @defgroup lavc_parsing Frame parsing + * @{ + */ + +enum AVPictureStructure { + AV_PICTURE_STRUCTURE_UNKNOWN, //< unknown + AV_PICTURE_STRUCTURE_TOP_FIELD, //< coded as top field + AV_PICTURE_STRUCTURE_BOTTOM_FIELD, //< coded as bottom field + AV_PICTURE_STRUCTURE_FRAME, //< coded as frame +}; + +typedef struct AVCodecParserContext { + void *priv_data; + struct AVCodecParser *parser; + int64_t frame_offset; /* offset of the current frame */ + int64_t cur_offset; /* current offset + (incremented by each av_parser_parse()) */ + int64_t next_frame_offset; /* offset of the next frame */ + /* video info */ + int pict_type; /* XXX: Put it back in AVCodecContext. */ + /** + * This field is used for proper frame duration computation in lavf. + * It signals, how much longer the frame duration of the current frame + * is compared to normal frame duration. + * + * frame_duration = (1 + repeat_pict) * time_base + * + * It is used by codecs like H.264 to display telecined material. + */ + int repeat_pict; /* XXX: Put it back in AVCodecContext. */ + int64_t pts; /* pts of the current frame */ + int64_t dts; /* dts of the current frame */ + + /* private data */ + int64_t last_pts; + int64_t last_dts; + int fetch_timestamp; + +#define AV_PARSER_PTS_NB 4 + int cur_frame_start_index; + int64_t cur_frame_offset[AV_PARSER_PTS_NB]; + int64_t cur_frame_pts[AV_PARSER_PTS_NB]; + int64_t cur_frame_dts[AV_PARSER_PTS_NB]; + + int flags; +#define PARSER_FLAG_COMPLETE_FRAMES 0x0001 +#define PARSER_FLAG_ONCE 0x0002 +/// Set if the parser has a valid file offset +#define PARSER_FLAG_FETCHED_OFFSET 0x0004 +#define PARSER_FLAG_USE_CODEC_TS 0x1000 + + int64_t offset; ///< byte offset from starting packet start + int64_t cur_frame_end[AV_PARSER_PTS_NB]; + + /** + * Set by parser to 1 for key frames and 0 for non-key frames. + * It is initialized to -1, so if the parser doesn't set this flag, + * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames + * will be used. + */ + int key_frame; + + /** + * Time difference in stream time base units from the pts of this + * packet to the point at which the output from the decoder has converged + * independent from the availability of previous frames. That is, the + * frames are virtually identical no matter if decoding started from + * the very first frame or from this keyframe. + * Is AV_NOPTS_VALUE if unknown. + * This field is not the display duration of the current frame. + * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY + * set. + * + * The purpose of this field is to allow seeking in streams that have no + * keyframes in the conventional sense. It corresponds to the + * recovery point SEI in H.264 and match_time_delta in NUT. It is also + * essential for some types of subtitle streams to ensure that all + * subtitles are correctly displayed after seeking. + */ + int64_t convergence_duration; + + // Timestamp generation support: + /** + * Synchronization point for start of timestamp generation. + * + * Set to >0 for sync point, 0 for no sync point and <0 for undefined + * (default). + * + * For example, this corresponds to presence of H.264 buffering period + * SEI message. + */ + int dts_sync_point; + + /** + * Offset of the current timestamp against last timestamp sync point in + * units of AVCodecContext.time_base. + * + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must + * contain a valid timestamp offset. + * + * Note that the timestamp of sync point has usually a nonzero + * dts_ref_dts_delta, which refers to the previous sync point. Offset of + * the next frame after timestamp sync point will be usually 1. + * + * For example, this corresponds to H.264 cpb_removal_delay. + */ + int dts_ref_dts_delta; + + /** + * Presentation delay of current frame in units of AVCodecContext.time_base. + * + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must + * contain valid non-negative timestamp delta (presentation time of a frame + * must not lie in the past). + * + * This delay represents the difference between decoding and presentation + * time of the frame. + * + * For example, this corresponds to H.264 dpb_output_delay. + */ + int pts_dts_delta; + + /** + * Position of the packet in file. + * + * Analogous to cur_frame_pts/dts + */ + int64_t cur_frame_pos[AV_PARSER_PTS_NB]; + + /** + * Byte position of currently parsed frame in stream. + */ + int64_t pos; + + /** + * Previous frame byte position. + */ + int64_t last_pos; + + /** + * Duration of the current frame. + * For audio, this is in units of 1 / AVCodecContext.sample_rate. + * For all other types, this is in units of AVCodecContext.time_base. + */ + int duration; + + enum AVFieldOrder field_order; + + /** + * Indicate whether a picture is coded as a frame, top field or bottom field. + * + * For example, H.264 field_pic_flag equal to 0 corresponds to + * AV_PICTURE_STRUCTURE_FRAME. An H.264 picture with field_pic_flag + * equal to 1 and bottom_field_flag equal to 0 corresponds to + * AV_PICTURE_STRUCTURE_TOP_FIELD. + */ + enum AVPictureStructure picture_structure; + + /** + * Picture number incremented in presentation or output order. + * This field may be reinitialized at the first picture of a new sequence. + * + * For example, this corresponds to H.264 PicOrderCnt. + */ + /*specific parameters export for H264 parsing, for the rest codec, 0 is default*/ + int output_picture_number; + int frame_num; + int max_frame_num_plus1; + int width_in_pixel; + int height_in_pixel; + int frame_rate_num; + int frame_rate_den; + int frame_has_sps; + int frame_has_pps; +} AVCodecParserContext; + +typedef struct AVCodecParser { + int codec_ids[5]; /* several codec IDs are permitted */ + int priv_data_size; + + int (*parser_init)(AVCodecParserContext *s); + + int (*parser_parse)(AVCodecParserContext *s, + AVCodecContext *avctx, + const uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size); + + void (*parser_close)(AVCodecParserContext *s); + + int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size); + + struct AVCodecParser *next; +} AVCodecParser; + +AVCodecParser *av_parser_next(const AVCodecParser *c); + +void av_register_codec_parser(AVCodecParser *parser); + +AVCodecParserContext *av_parser_init(int codec_id); + +/** + * Parse a packet. + * + * @param s parser context. + * @param avctx codec context. + * @param poutbuf set to pointer to parsed buffer or NULL if not yet finished. + * @param poutbuf_size set to size of parsed buffer or zero if not yet finished. + * @param buf input buffer. + * @param buf_size input length, to signal EOF, this should be 0 (so that the last frame can be output). + * @param pts input presentation timestamp. + * @param dts input decoding timestamp. + * @param pos input byte position in stream. + * @return the number of bytes of the input bitstream used. + * + * Example: + * @code + * while(in_len){ + * len = av_parser_parse2(myparser, AVCodecContext, &data, &size, + * in_data, in_len, + * pts, dts, pos); + * in_data += len; + * in_len -= len; + * + * if(size) + * decode_frame(data, size); + * } + * @endcode + */ +int av_parser_parse2(AVCodecParserContext *s, + AVCodecContext *avctx, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size, + int64_t pts, int64_t dts, + int64_t pos); + +/** + * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed + * @deprecated use AVBitStreamFilter + */ +int av_parser_change(AVCodecParserContext *s, + AVCodecContext *avctx, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size, int keyframe); + +void av_parser_close(AVCodecParserContext *s); + +/** + * @} + * @} + */ + +/** + * @addtogroup lavc_encoding + * @{ + */ + +/** + * Find a registered encoder with a matching codec ID. + * + * @param id AVCodecID of the requested encoder + * @return An encoder if one was found, NULL otherwise. + */ +AVCodec *avcodec_find_encoder(enum AVCodecID id); + +/** + * Find a registered encoder with the specified name. + * + * @param name name of the requested encoder + * @return An encoder if one was found, NULL otherwise. + */ +AVCodec *avcodec_find_encoder_by_name(const char *name); + +#if FF_API_OLD_ENCODE_AUDIO +/** + * Encode an audio frame from samples into buf. + * + * @deprecated Use avcodec_encode_audio2 instead. + * + * @note The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large. + * However, for codecs with avctx->frame_size equal to 0 (e.g. PCM) the user + * will know how much space is needed because it depends on the value passed + * in buf_size as described below. In that case a lower value can be used. + * + * @param avctx the codec context + * @param[out] buf the output buffer + * @param[in] buf_size the output buffer size + * @param[in] samples the input buffer containing the samples + * The number of samples read from this buffer is frame_size*channels, + * both of which are defined in avctx. + * For codecs which have avctx->frame_size equal to 0 (e.g. PCM) the number of + * samples read from samples is equal to: + * buf_size * 8 / (avctx->channels * av_get_bits_per_sample(avctx->codec_id)) + * This also implies that av_get_bits_per_sample() must not return 0 for these + * codecs. + * @return On error a negative value is returned, on success zero or the number + * of bytes used to encode the data read from the input buffer. + */ +int attribute_deprecated +avcodec_encode_audio(AVCodecContext +*avctx, +uint8_t *buf, +int buf_size, +const short *samples +); +#endif + +/** + * Encode a frame of audio. + * + * Takes input samples from frame and writes the next output packet, if + * available, to avpkt. The output packet does not necessarily contain data for + * the most recent frame, as encoders can delay, split, and combine input frames + * internally as needed. + * + * @param avctx codec context + * @param avpkt output AVPacket. + * The user can supply an output buffer by setting + * avpkt->data and avpkt->size prior to calling the + * function, but if the size of the user-provided data is not + * large enough, encoding will fail. If avpkt->data and + * avpkt->size are set, avpkt->destruct must also be set. All + * other AVPacket fields will be reset by the encoder using + * av_init_packet(). If avpkt->data is NULL, the encoder will + * allocate it. The encoder will set avpkt->size to the size + * of the output packet. + * + * If this function fails or produces no output, avpkt will be + * freed using av_free_packet() (i.e. avpkt->destruct will be + * called to free the user supplied buffer). + * @param[in] frame AVFrame containing the raw audio data to be encoded. + * May be NULL when flushing an encoder that has the + * CODEC_CAP_DELAY capability set. + * If CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame + * can have any number of samples. + * If it is not set, frame->nb_samples must be equal to + * avctx->frame_size for all frames except the last. + * The final frame may be smaller than avctx->frame_size. + * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the + * output packet is non-empty, and to 0 if it is + * empty. If the function returns an error, the + * packet can be assumed to be invalid, and the + * value of got_packet_ptr is undefined and should + * not be used. + * @return 0 on success, negative error code on failure + */ +int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, + const AVFrame *frame, int *got_packet_ptr); + +#if FF_API_OLD_ENCODE_VIDEO + +/** + * @deprecated use avcodec_encode_video2() instead. + * + * Encode a video frame from pict into buf. + * The input picture should be + * stored using a specific format, namely avctx.pix_fmt. + * + * @param avctx the codec context + * @param[out] buf the output buffer for the bitstream of encoded frame + * @param[in] buf_size the size of the output buffer in bytes + * @param[in] pict the input picture to encode + * @return On error a negative value is returned, on success zero or the number + * of bytes used from the output buffer. + */ +attribute_deprecated +int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, + const AVFrame *pict); + +#endif + +/** + * Encode a frame of video. + * + * Takes input raw video data from frame and writes the next output packet, if + * available, to avpkt. The output packet does not necessarily contain data for + * the most recent frame, as encoders can delay and reorder input frames + * internally as needed. + * + * @param avctx codec context + * @param avpkt output AVPacket. + * The user can supply an output buffer by setting + * avpkt->data and avpkt->size prior to calling the + * function, but if the size of the user-provided data is not + * large enough, encoding will fail. All other AVPacket fields + * will be reset by the encoder using av_init_packet(). If + * avpkt->data is NULL, the encoder will allocate it. + * The encoder will set avpkt->size to the size of the + * output packet. The returned data (if any) belongs to the + * caller, he is responsible for freeing it. + * + * If this function fails or produces no output, avpkt will be + * freed using av_free_packet() (i.e. avpkt->destruct will be + * called to free the user supplied buffer). + * @param[in] frame AVFrame containing the raw video data to be encoded. + * May be NULL when flushing an encoder that has the + * CODEC_CAP_DELAY capability set. + * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the + * output packet is non-empty, and to 0 if it is + * empty. If the function returns an error, the + * packet can be assumed to be invalid, and the + * value of got_packet_ptr is undefined and should + * not be used. + * @return 0 on success, negative error code on failure + */ +int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, + const AVFrame *frame, int *got_packet_ptr); + +int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, + const AVSubtitle *sub); + + +/** + * @} + */ + +#if FF_API_AVCODEC_RESAMPLE +/** + * @defgroup lavc_resample Audio resampling + * @ingroup libavc + * @deprecated use libswresample instead + * + * @{ + */ +struct ReSampleContext; +struct AVResampleContext; + +typedef struct ReSampleContext ReSampleContext; + +/** + * Initialize audio resampling context. + * + * @param output_channels number of output channels + * @param input_channels number of input channels + * @param output_rate output sample rate + * @param input_rate input sample rate + * @param sample_fmt_out requested output sample format + * @param sample_fmt_in input sample format + * @param filter_length length of each FIR filter in the filterbank relative to the cutoff frequency + * @param log2_phase_count log2 of the number of entries in the polyphase filterbank + * @param linear if 1 then the used FIR filter will be linearly interpolated + between the 2 closest, if 0 the closest will be used + * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate + * @return allocated ReSampleContext, NULL if error occurred + */ +attribute_deprecated + ReSampleContext +* + +av_audio_resample_init(int output_channels, int input_channels, + int output_rate, int input_rate, + enum AVSampleFormat sample_fmt_out, + enum AVSampleFormat sample_fmt_in, + int filter_length, int log2_phase_count, + int linear, double cutoff); + +attribute_deprecated +int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples); + +/** + * Free resample context. + * + * @param s a non-NULL pointer to a resample context previously + * created with av_audio_resample_init() + */ +attribute_deprecated +void audio_resample_close(ReSampleContext *s); + + +/** + * Initialize an audio resampler. + * Note, if either rate is not an integer then simply scale both rates up so they are. + * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq + * @param log2_phase_count log2 of the number of entries in the polyphase filterbank + * @param linear If 1 then the used FIR filter will be linearly interpolated + between the 2 closest, if 0 the closest will be used + * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate + */ +attribute_deprecated +struct AVResampleContext * +av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, + double cutoff); + +/** + * Resample an array of samples using a previously configured context. + * @param src an array of unconsumed samples + * @param consumed the number of samples of src which have been consumed are returned here + * @param src_size the number of unconsumed samples available + * @param dst_size the amount of space in samples available in dst + * @param update_ctx If this is 0 then the context will not be modified, that way several channels can be resampled with the same context. + * @return the number of samples written in dst or -1 if an error occurred + */ +attribute_deprecated +int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, + int dst_size, int update_ctx); + + +/** + * Compensate samplerate/timestamp drift. The compensation is done by changing + * the resampler parameters, so no audible clicks or similar distortions occur + * @param compensation_distance distance in output samples over which the compensation should be performed + * @param sample_delta number of output samples which should be output less + * + * example: av_resample_compensate(c, 10, 500) + * here instead of 510 samples only 500 samples would be output + * + * note, due to rounding the actual compensation might be slightly different, + * especially if the compensation_distance is large and the in_rate used during init is small + */ +attribute_deprecated +void +av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance); + +attribute_deprecated +void av_resample_close(struct AVResampleContext *c); + +/** + * @} + */ +#endif + +/** + * @addtogroup lavc_picture + * @{ + */ + +/** + * Allocate memory for the pixels of a picture and setup the AVPicture + * fields for it. + * + * Call avpicture_free() to free it. + * + * @param picture the picture structure to be filled in + * @param pix_fmt the pixel format of the picture + * @param width the width of the picture + * @param height the height of the picture + * @return zero if successful, a negative error code otherwise + * + * @see av_image_alloc(), avpicture_fill() + */ +int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height); + +/** + * Free a picture previously allocated by avpicture_alloc(). + * The data buffer used by the AVPicture is freed, but the AVPicture structure + * itself is not. + * + * @param picture the AVPicture to be freed + */ +void avpicture_free(AVPicture *picture); + +/** + * Setup the picture fields based on the specified image parameters + * and the provided image data buffer. + * + * The picture fields are filled in by using the image data buffer + * pointed to by ptr. + * + * If ptr is NULL, the function will fill only the picture linesize + * array and return the required size for the image buffer. + * + * To allocate an image buffer and fill the picture data in one call, + * use avpicture_alloc(). + * + * @param picture the picture to be filled in + * @param ptr buffer where the image data is stored, or NULL + * @param pix_fmt the pixel format of the image + * @param width the width of the image in pixels + * @param height the height of the image in pixels + * @return the size in bytes required for src, a negative error code + * in case of failure + * + * @see av_image_fill_arrays() + */ +int avpicture_fill(AVPicture *picture, const uint8_t *ptr, + enum AVPixelFormat pix_fmt, int width, int height); + +/** + * Copy pixel data from an AVPicture into a buffer. + * + * avpicture_get_size() can be used to compute the required size for + * the buffer to fill. + * + * @param src source picture with filled data + * @param pix_fmt picture pixel format + * @param width picture width + * @param height picture height + * @param dest destination buffer + * @param dest_size destination buffer size in bytes + * @return the number of bytes written to dest, or a negative value + * (error code) on error, for example if the destination buffer is not + * big enough + * + * @see av_image_copy_to_buffer() + */ +int avpicture_layout(const AVPicture *src, enum AVPixelFormat pix_fmt, + int width, int height, + unsigned char *dest, int dest_size); + +/** + * Calculate the size in bytes that a picture of the given width and height + * would occupy if stored in the given picture format. + * + * @param pix_fmt picture pixel format + * @param width picture width + * @param height picture height + * @return the computed picture buffer size or a negative error code + * in case of error + * + * @see av_image_get_buffer_size(). + */ +int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height); + +#if FF_API_DEINTERLACE + +/** + * deinterlace - if not supported return -1 + * + * @deprecated - use yadif (in libavfilter) instead + */ +attribute_deprecated +int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, + enum AVPixelFormat pix_fmt, int width, int height); + +#endif + +/** + * Copy image src to dst. Wraps av_image_copy(). + */ +void av_picture_copy(AVPicture *dst, const AVPicture *src, + enum AVPixelFormat pix_fmt, int width, int height); + +/** + * Crop image top and left side. + */ +int av_picture_crop(AVPicture *dst, const AVPicture *src, + enum AVPixelFormat pix_fmt, int top_band, int left_band); + +/** + * Pad image. + */ +int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, + enum AVPixelFormat pix_fmt, + int padtop, int padbottom, int padleft, int padright, int *color); + +/** + * @} + */ + +/** + * @defgroup lavc_misc Utility functions + * @ingroup libavc + * + * Miscellaneous utility functions related to both encoding and decoding + * (or neither). + * @{ + */ + +/** + * @defgroup lavc_misc_pixfmt Pixel formats + * + * Functions for working with pixel formats. + * @{ + */ + +/** + * Utility function to access log2_chroma_w log2_chroma_h from + * the pixel format AVPixFmtDescriptor. + * + * This function asserts that pix_fmt is valid. See av_pix_fmt_get_chroma_sub_sample + * for one that returns a failure code and continues in case of invalid + * pix_fmts. + * + * @param[in] pix_fmt the pixel format + * @param[out] h_shift store log2_chroma_w + * @param[out] v_shift store log2_chroma_h + * + * @see av_pix_fmt_get_chroma_sub_sample + */ + +void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift); + +/** + * Return a value representing the fourCC code associated to the + * pixel format pix_fmt, or 0 if no associated fourCC code can be + * found. + */ +unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt); + +/** + * @deprecated see av_get_pix_fmt_loss() + */ +int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, + int has_alpha); + +/** + * Find the best pixel format to convert to given a certain source pixel + * format. When converting from one pixel format to another, information loss + * may occur. For example, when converting from RGB24 to GRAY, the color + * information will be lost. Similarly, other losses occur when converting from + * some formats to other formats. avcodec_find_best_pix_fmt_of_2() searches which of + * the given pixel formats should be used to suffer the least amount of loss. + * The pixel formats from which it chooses one, are determined by the + * pix_fmt_list parameter. + * + * + * @param[in] pix_fmt_list AV_PIX_FMT_NONE terminated array of pixel formats to choose from + * @param[in] src_pix_fmt source pixel format + * @param[in] has_alpha Whether the source pixel format alpha channel is used. + * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur. + * @return The best pixel format to convert to or -1 if none was found. + */ +enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *pix_fmt_list, + enum AVPixelFormat src_pix_fmt, + int has_alpha, int *loss_ptr); + +/** + * @deprecated see av_find_best_pix_fmt_of_2() + */ +enum AVPixelFormat +avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, + enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); + +attribute_deprecated +#if AV_HAVE_INCOMPATIBLE_LIBAV_ABI +enum AVPixelFormat avcodec_find_best_pix_fmt2(const enum AVPixelFormat *pix_fmt_list, + enum AVPixelFormat src_pix_fmt, + int has_alpha, int *loss_ptr); +#else +enum AVPixelFormat +avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, + enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); + +#endif + + +enum AVPixelFormat +avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat *fmt); + +/** + * @} + */ + +#if FF_API_SET_DIMENSIONS + +/** + * @deprecated this function is not supposed to be used from outside of lavc + */ +attribute_deprecated +void avcodec_set_dimensions(AVCodecContext *s, int width, int height); + +#endif + +/** + * Put a string representing the codec tag codec_tag in buf. + * + * @param buf buffer to place codec tag in + * @param buf_size size in bytes of buf + * @param codec_tag codec tag to assign + * @return the length of the string that would have been generated if + * enough space had been available, excluding the trailing null + */ +size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag); + +void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); + +/** + * Return a name for the specified profile, if available. + * + * @param codec the codec that is searched for the given profile + * @param profile the profile value for which a name is requested + * @return A name for the profile if found, NULL otherwise. + */ +const char *av_get_profile_name(const AVCodec *codec, int profile); + +int +avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2), void *arg, + int *ret, int count, int size); + +int +avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int), + void *arg, int *ret, int count); +//FIXME func typedef + +/** + * Fill AVFrame audio data and linesize pointers. + * + * The buffer buf must be a preallocated buffer with a size big enough + * to contain the specified samples amount. The filled AVFrame data + * pointers will point to this buffer. + * + * AVFrame extended_data channel pointers are allocated if necessary for + * planar audio. + * + * @param frame the AVFrame + * frame->nb_samples must be set prior to calling the + * function. This function fills in frame->data, + * frame->extended_data, frame->linesize[0]. + * @param nb_channels channel count + * @param sample_fmt sample format + * @param buf buffer to use for frame data + * @param buf_size size of buffer + * @param align plane size sample alignment (0 = default) + * @return >=0 on success, negative error code on failure + * @todo return the size in bytes required to store the samples in + * case of success, at the next libavutil bump + */ +int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, + enum AVSampleFormat sample_fmt, const uint8_t *buf, + int buf_size, int align); + +/** + * Reset the internal decoder state / flush internal buffers. Should be called + * e.g. when seeking or when switching to a different stream. + * + * @note when refcounted frames are not used (i.e. avctx->refcounted_frames is 0), + * this invalidates the frames previously returned from the decoder. When + * refcounted frames are used, the decoder just releases any references it might + * keep internally, but the caller's reference remains valid. + */ +void avcodec_flush_buffers(AVCodecContext *avctx); + +/** + * Return codec bits per sample. + * + * @param[in] codec_id the codec + * @return Number of bits per sample or zero if unknown for the given codec. + */ +int av_get_bits_per_sample(enum AVCodecID codec_id); + +/** + * Return the PCM codec associated with a sample format. + * @param be endianness, 0 for little, 1 for big, + * -1 (or anything else) for native + * @return AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE + */ +enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be); + +/** + * Return codec bits per sample. + * Only return non-zero if the bits per sample is exactly correct, not an + * approximation. + * + * @param[in] codec_id the codec + * @return Number of bits per sample or zero if unknown for the given codec. + */ +int av_get_exact_bits_per_sample(enum AVCodecID codec_id); + +/** + * Return audio frame duration. + * + * @param avctx codec context + * @param frame_bytes size of the frame, or 0 if unknown + * @return frame duration, in samples, if known. 0 if not able to + * determine. + */ +int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes); + + +typedef struct AVBitStreamFilterContext { + void *priv_data; + struct AVBitStreamFilter *filter; + AVCodecParserContext *parser; + struct AVBitStreamFilterContext *next; +} AVBitStreamFilterContext; + + +typedef struct AVBitStreamFilter { + const char *name; + int priv_data_size; + + int (*filter)(AVBitStreamFilterContext *bsfc, + AVCodecContext *avctx, const char *args, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size, int keyframe); + + void (*close)(AVBitStreamFilterContext *bsfc); + + struct AVBitStreamFilter *next; +} AVBitStreamFilter; + +/** + * Register a bitstream filter. + * + * The filter will be accessible to the application code through + * av_bitstream_filter_next() or can be directly initialized with + * av_bitstream_filter_init(). + * + * @see avcodec_register_all() + */ +void av_register_bitstream_filter(AVBitStreamFilter *bsf); + +/** + * Create and initialize a bitstream filter context given a bitstream + * filter name. + * + * The returned context must be freed with av_bitstream_filter_close(). + * + * @param name the name of the bitstream filter + * @return a bitstream filter context if a matching filter was found + * and successfully initialized, NULL otherwise + */ +AVBitStreamFilterContext *av_bitstream_filter_init(const char *name); + +/** + * Filter bitstream. + * + * This function filters the buffer buf with size buf_size, and places the + * filtered buffer in the buffer pointed to by poutbuf. + * + * The output buffer must be freed by the caller. + * + * @param bsfc bitstream filter context created by av_bitstream_filter_init() + * @param avctx AVCodecContext accessed by the filter, may be NULL. + * If specified, this must point to the encoder context of the + * output stream the packet is sent to. + * @param args arguments which specify the filter configuration, may be NULL + * @param poutbuf pointer which is updated to point to the filtered buffer + * @param poutbuf_size pointer which is updated to the filtered buffer size in bytes + * @param buf buffer containing the data to filter + * @param buf_size size in bytes of buf + * @param keyframe set to non-zero if the buffer to filter corresponds to a key-frame packet data + * @return >= 0 in case of success, or a negative error code in case of failure + * + * If the return value is positive, an output buffer is allocated and + * is available in *poutbuf, and is distinct from the input buffer. + * + * If the return value is 0, the output buffer is not allocated and + * should be considered identical to the input buffer, or in case + * *poutbuf was set it points to the input buffer (not necessarily to + * its starting address). + */ +int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, + AVCodecContext *avctx, const char *args, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size, int keyframe); + +/** + * Release bitstream filter context. + * + * @param bsf the bitstream filter context created with + * av_bitstream_filter_init(), can be NULL + */ +void av_bitstream_filter_close(AVBitStreamFilterContext *bsf); + +/** + * If f is NULL, return the first registered bitstream filter, + * if f is non-NULL, return the next registered bitstream filter + * after f, or NULL if f is the last one. + * + * This function can be used to iterate over all registered bitstream + * filters. + */ +AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f); + +/* memory */ + +/** + * Same behaviour av_fast_malloc but the buffer has additional + * FF_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0. + * + * In addition the whole buffer will initially and after resizes + * be 0-initialized so that no uninitialized data will ever appear. + */ +void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size); + +/** + * Same behaviour av_fast_padded_malloc except that buffer will always + * be 0-initialized after call. + */ +void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size); + +/** + * Encode extradata length to a buffer. Used by xiph codecs. + * + * @param s buffer to write to; must be at least (v/255+1) bytes long + * @param v size of extradata in bytes + * @return number of bytes written to the buffer. + */ +unsigned int av_xiphlacing(unsigned char *s, unsigned int v); + +#if FF_API_MISSING_SAMPLE + +/** + * Log a generic warning message about a missing feature. This function is + * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.) + * only, and would normally not be used by applications. + * @param[in] avc a pointer to an arbitrary struct of which the first field is + * a pointer to an AVClass struct + * @param[in] feature string containing the name of the missing feature + * @param[in] want_sample indicates if samples are wanted which exhibit this feature. + * If want_sample is non-zero, additional verbage will be added to the log + * message which tells the user how to report samples to the development + * mailing list. + * @deprecated Use avpriv_report_missing_feature() instead. + */ +attribute_deprecated +void av_log_missing_feature(void *avc, const char *feature, int want_sample); + +/** + * Log a generic warning message asking for a sample. This function is + * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.) + * only, and would normally not be used by applications. + * @param[in] avc a pointer to an arbitrary struct of which the first field is + * a pointer to an AVClass struct + * @param[in] msg string containing an optional message, or NULL if no message + * @deprecated Use avpriv_request_sample() instead. + */ +attribute_deprecated +void av_log_ask_for_sample(void *avc, const char *msg, ...) + +av_printf_format(2, 3); +#endif /* FF_API_MISSING_SAMPLE */ + +/** + * Register the hardware accelerator hwaccel. + */ +void av_register_hwaccel(AVHWAccel *hwaccel); + +/** + * If hwaccel is NULL, returns the first registered hardware accelerator, + * if hwaccel is non-NULL, returns the next registered hardware accelerator + * after hwaccel, or NULL if hwaccel is the last one. + */ +AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel); + + +/** + * Lock operation used by lockmgr + */ +enum AVLockOp { + AV_LOCK_CREATE, ///< Create a mutex + AV_LOCK_OBTAIN, ///< Lock the mutex + AV_LOCK_RELEASE, ///< Unlock the mutex + AV_LOCK_DESTROY, ///< Free mutex resources +}; + +/** + * Register a user provided lock manager supporting the operations + * specified by AVLockOp. The "mutex" argument to the function points + * to a (void *) where the lockmgr should store/get a pointer to a user + * allocated mutex. It is NULL upon AV_LOCK_CREATE and equal to the + * value left by the last call for all other ops. If the lock manager is + * unable to perform the op then it should leave the mutex in the same + * state as when it was called and return a non-zero value. However, + * when called with AV_LOCK_DESTROY the mutex will always be assumed to + * have been successfully destroyed. If av_lockmgr_register succeeds + * it will return a non-negative value, if it fails it will return a + * negative value and destroy all mutex and unregister all callbacks. + * av_lockmgr_register is not thread-safe, it must be called from a + * single thread before any calls which make use of locking are used. + * + * @param cb User defined callback. av_lockmgr_register invokes calls + * to this callback and the previously registered callback. + * The callback will be used to create more than one mutex + * each of which must be backed by its own underlying locking + * mechanism (i.e. do not use a single static object to + * implement your lock manager). If cb is set to NULL the + * lockmgr will be unregistered. + */ +int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)); + +/** + * Get the type of the given codec. + */ +enum AVMediaType avcodec_get_type(enum AVCodecID codec_id); + +/** + * Get the name of a codec. + * @return a static string identifying the codec; never NULL + */ +const char *avcodec_get_name(enum AVCodecID id); + +/** + * @return a positive value if s is open (i.e. avcodec_open2() was called on it + * with no corresponding avcodec_close()), 0 otherwise. + */ +int avcodec_is_open(AVCodecContext *s); + +/** + * @return a non-zero number if codec is an encoder, zero otherwise + */ +int av_codec_is_encoder(const AVCodec *codec); + +/** + * @return a non-zero number if codec is a decoder, zero otherwise + */ +int av_codec_is_decoder(const AVCodec *codec); + +/** + * @return descriptor for given codec ID or NULL if no descriptor exists. + */ +const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id); + +/** + * Iterate over all codec descriptors known to libavcodec. + * + * @param prev previous descriptor. NULL to get the first descriptor. + * + * @return next descriptor or NULL after the last descriptor + */ +const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev); + +/** + * @return codec descriptor with the given name or NULL if no such descriptor + * exists. + */ +const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name); + +/** + * @} + */ + +#endif /* AVCODEC_AVCODEC_H */ diff --git a/app/src/main/cpp/include/libavcodec/avfft.h b/app/src/main/cpp/include/libavcodec/avfft.h new file mode 100644 index 0000000..7cdd4fe --- /dev/null +++ b/app/src/main/cpp/include/libavcodec/avfft.h @@ -0,0 +1,126 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_AVFFT_H +#define AVCODEC_AVFFT_H + +/** + * @file + * @ingroup lavc_fft + * FFT functions + */ + +/** + * @defgroup lavc_fft FFT functions + * @ingroup lavc_misc + * + * @{ + */ + +typedef float FFTSample; + +typedef struct FFTComplex { + FFTSample re, im; +} FFTComplex; + +typedef struct FFTContext FFTContext; + +/** + * Set up a complex FFT. + * @param nbits log2 of the length of the input array + * @param inverse if 0 perform the forward transform, if 1 perform the inverse + */ +FFTContext *av_fft_init(int nbits, int inverse); + +/** + * Do the permutation needed BEFORE calling ff_fft_calc(). + */ +void av_fft_permute(FFTContext *s, FFTComplex *z); + +/** + * Do a complex FFT with the parameters defined in av_fft_init(). The + * input data must be permuted before. No 1.0/sqrt(n) normalization is done. + */ +void av_fft_calc(FFTContext *s, FFTComplex *z); + +void av_fft_end(FFTContext *s); + +FFTContext *av_mdct_init(int nbits, int inverse, double scale); + +void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); + +void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input); + +void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); + +void av_mdct_end(FFTContext *s); + +/* Real Discrete Fourier Transform */ + +enum RDFTransformType { + DFT_R2C, + IDFT_C2R, + IDFT_R2C, + DFT_C2R, +}; + +typedef struct RDFTContext RDFTContext; + +/** + * Set up a real FFT. + * @param nbits log2 of the length of the input array + * @param trans the type of transform + */ +RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans); + +void av_rdft_calc(RDFTContext *s, FFTSample *data); + +void av_rdft_end(RDFTContext *s); + +/* Discrete Cosine Transform */ + +typedef struct DCTContext DCTContext; + +enum DCTTransformType { + DCT_II = 0, + DCT_III, + DCT_I, + DST_I, +}; + +/** + * Set up DCT. + * + * @param nbits size of the input array: + * (1 << nbits) for DCT-II, DCT-III and DST-I + * (1 << nbits) + 1 for DCT-I + * @param type the type of transform + * + * @note the first element of the input of DST-I is ignored + */ +DCTContext *av_dct_init(int nbits, enum DCTTransformType type); + +void av_dct_calc(DCTContext *s, FFTSample *data); + +void av_dct_end(DCTContext *s); + +/** + * @} + */ + +#endif /* AVCODEC_AVFFT_H */ diff --git a/app/src/main/cpp/include/libavcodec/dv_profile.h b/app/src/main/cpp/include/libavcodec/dv_profile.h new file mode 100644 index 0000000..abc9578 --- /dev/null +++ b/app/src/main/cpp/include/libavcodec/dv_profile.h @@ -0,0 +1,92 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_DV_PROFILE_H +#define AVCODEC_DV_PROFILE_H + +#include <stdint.h> + +#include "libavutil/pixfmt.h" +#include "libavutil/rational.h" +#include "avcodec.h" + +/* minimum number of bytes to read from a DV stream in order to + * determine the profile */ +#define DV_PROFILE_BYTES (6 * 80) /* 6 DIF blocks */ + + +/* + * AVDVProfile is used to express the differences between various + * DV flavors. For now it's primarily used for differentiating + * 525/60 and 625/50, but the plans are to use it for various + * DV specs as well (e.g. SMPTE314M vs. IEC 61834). + */ +typedef struct AVDVProfile { + int dsf; /* value of the dsf in the DV header */ + int video_stype; /* stype for VAUX source pack */ + int frame_size; /* total size of one frame in bytes */ + int difseg_size; /* number of DIF segments per DIF channel */ + int n_difchan; /* number of DIF channels per frame */ + AVRational time_base; /* 1/framerate */ + int ltc_divisor; /* FPS from the LTS standpoint */ + int height; /* picture height in pixels */ + int width; /* picture width in pixels */ + AVRational sar[2]; /* sample aspect ratios for 4:3 and 16:9 */ + enum AVPixelFormat pix_fmt; /* picture pixel format */ + int bpm; /* blocks per macroblock */ + const uint8_t *block_sizes; /* AC block sizes, in bits */ + int audio_stride; /* size of audio_shuffle table */ + int audio_min_samples[3]; /* min amount of audio samples */ + /* for 48kHz, 44.1kHz and 32kHz */ + int audio_samples_dist[5]; /* how many samples are supposed to be */ + /* in each frame in a 5 frames window */ + const uint8_t (*audio_shuffle)[9]; /* PCM shuffling table */ +} AVDVProfile; + +#if FF_API_DV_FRAME_PROFILE +/** + * @deprecated use av_dv_frame_profile() + */ +attribute_deprecated +const AVDVProfile +* +avpriv_dv_frame_profile2(AVCodecContext +* codec, +const AVDVProfile *sys, +const uint8_t *frame, +unsigned buf_size +); +#endif + +/** + * Get a DV profile for the provided compressed frame. + * + * @param sys the profile used for the previous frame, may be NULL + * @param frame the compressed data buffer + * @param buf_size size of the buffer in bytes + * @return the DV profile for the supplied data or NULL on failure + */ +const AVDVProfile *av_dv_frame_profile(const AVDVProfile *sys, + const uint8_t *frame, unsigned buf_size); + +/** + * Get a DV profile for the provided stream parameters. + */ +const AVDVProfile *av_dv_codec_profile(int width, int height, enum AVPixelFormat pix_fmt); + +#endif /* AVCODEC_DV_PROFILE_H */ diff --git a/app/src/main/cpp/include/libavcodec/dxva2.h b/app/src/main/cpp/include/libavcodec/dxva2.h new file mode 100644 index 0000000..255a7ee --- /dev/null +++ b/app/src/main/cpp/include/libavcodec/dxva2.h @@ -0,0 +1,93 @@ +/* + * DXVA2 HW acceleration + * + * copyright (c) 2009 Laurent Aimar + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_DXVA_H +#define AVCODEC_DXVA_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_dxva2 + * Public libavcodec DXVA2 header. + */ + +#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600 +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 +#endif + +#include <stdint.h> +#include <d3d9.h> +#include <dxva2api.h> + +/** + * @defgroup lavc_codec_hwaccel_dxva2 DXVA2 + * @ingroup lavc_codec_hwaccel + * + * @{ + */ + +#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards +#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for DXVA2 and old Intel GPUs with ClearVideo interface + +/** + * This structure is used to provides the necessary configurations and data + * to the DXVA2 FFmpeg HWAccel implementation. + * + * The application must make it available as AVCodecContext.hwaccel_context. + */ +struct dxva_context { + /** + * DXVA2 decoder object + */ + IDirectXVideoDecoder *decoder; + + /** + * DXVA2 configuration used to create the decoder + */ + const DXVA2_ConfigPictureDecode *cfg; + + /** + * The number of surface in the surface array + */ + unsigned surface_count; + + /** + * The array of Direct3D surfaces used to create the decoder + */ + LPDIRECT3DSURFACE9 *surface; + + /** + * A bit field configuring the workarounds needed for using the decoder + */ + uint64_t workaround; + + /** + * Private to the FFmpeg AVHWAccel implementation + */ + unsigned report_id; +}; + +/** + * @} + */ + +#endif /* AVCODEC_DXVA_H */ diff --git a/app/src/main/cpp/include/libavcodec/old_codec_ids.h b/app/src/main/cpp/include/libavcodec/old_codec_ids.h new file mode 100644 index 0000000..d9b8922 --- /dev/null +++ b/app/src/main/cpp/include/libavcodec/old_codec_ids.h @@ -0,0 +1,397 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_OLD_CODEC_IDS_H +#define AVCODEC_OLD_CODEC_IDS_H + +/* + * This header exists to prevent new codec IDs from being accidentally added to + * the deprecated list. + * Do not include it directly. It will be removed on next major bump + * + * Do not add new items to this list. Use the AVCodecID enum instead. + */ + +CODEC_ID_NONE = AV_CODEC_ID_NONE, + +/* video codecs */ + CODEC_ID_MPEG1VIDEO, + CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding +#if FF_API_XVMC +CODEC_ID_MPEG2VIDEO_XVMC, +#endif + CODEC_ID_H261, + CODEC_ID_H263, + CODEC_ID_RV10, + CODEC_ID_RV20, + CODEC_ID_MJPEG, + CODEC_ID_MJPEGB, + CODEC_ID_LJPEG, + CODEC_ID_SP5X, + CODEC_ID_JPEGLS, + CODEC_ID_MPEG4, + CODEC_ID_RAWVIDEO, + CODEC_ID_MSMPEG4V1, + CODEC_ID_MSMPEG4V2, + CODEC_ID_MSMPEG4V3, + CODEC_ID_WMV1, + CODEC_ID_WMV2, + CODEC_ID_H263P, + CODEC_ID_H263I, + CODEC_ID_FLV1, + CODEC_ID_SVQ1, + CODEC_ID_SVQ3, + CODEC_ID_DVVIDEO, + CODEC_ID_HUFFYUV, + CODEC_ID_CYUV, + CODEC_ID_H264, + CODEC_ID_INDEO3, + CODEC_ID_VP3, + CODEC_ID_THEORA, + CODEC_ID_ASV1, + CODEC_ID_ASV2, + CODEC_ID_FFV1, + CODEC_ID_4XM, + CODEC_ID_VCR1, + CODEC_ID_CLJR, + CODEC_ID_MDEC, + CODEC_ID_ROQ, + CODEC_ID_INTERPLAY_VIDEO, + CODEC_ID_XAN_WC3, + CODEC_ID_XAN_WC4, + CODEC_ID_RPZA, + CODEC_ID_CINEPAK, + CODEC_ID_WS_VQA, + CODEC_ID_MSRLE, + CODEC_ID_MSVIDEO1, + CODEC_ID_IDCIN, + CODEC_ID_8BPS, + CODEC_ID_SMC, + CODEC_ID_FLIC, + CODEC_ID_TRUEMOTION1, + CODEC_ID_VMDVIDEO, + CODEC_ID_MSZH, + CODEC_ID_ZLIB, + CODEC_ID_QTRLE, + CODEC_ID_TSCC, + CODEC_ID_ULTI, + CODEC_ID_QDRAW, + CODEC_ID_VIXL, + CODEC_ID_QPEG, + CODEC_ID_PNG, + CODEC_ID_PPM, + CODEC_ID_PBM, + CODEC_ID_PGM, + CODEC_ID_PGMYUV, + CODEC_ID_PAM, + CODEC_ID_FFVHUFF, + CODEC_ID_RV30, + CODEC_ID_RV40, + CODEC_ID_VC1, + CODEC_ID_WMV3, + CODEC_ID_LOCO, + CODEC_ID_WNV1, + CODEC_ID_AASC, + CODEC_ID_INDEO2, + CODEC_ID_FRAPS, + CODEC_ID_TRUEMOTION2, + CODEC_ID_BMP, + CODEC_ID_CSCD, + CODEC_ID_MMVIDEO, + CODEC_ID_ZMBV, + CODEC_ID_AVS, + CODEC_ID_SMACKVIDEO, + CODEC_ID_NUV, + CODEC_ID_KMVC, + CODEC_ID_FLASHSV, + CODEC_ID_CAVS, + CODEC_ID_JPEG2000, + CODEC_ID_VMNC, + CODEC_ID_VP5, + CODEC_ID_VP6, + CODEC_ID_VP6F, + CODEC_ID_TARGA, + CODEC_ID_DSICINVIDEO, + CODEC_ID_TIERTEXSEQVIDEO, + CODEC_ID_TIFF, + CODEC_ID_GIF, + CODEC_ID_DXA, + CODEC_ID_DNXHD, + CODEC_ID_THP, + CODEC_ID_SGI, + CODEC_ID_C93, + CODEC_ID_BETHSOFTVID, + CODEC_ID_PTX, + CODEC_ID_TXD, + CODEC_ID_VP6A, + CODEC_ID_AMV, + CODEC_ID_VB, + CODEC_ID_PCX, + CODEC_ID_SUNRAST, + CODEC_ID_INDEO4, + CODEC_ID_INDEO5, + CODEC_ID_MIMIC, + CODEC_ID_RL2, + CODEC_ID_ESCAPE124, + CODEC_ID_DIRAC, + CODEC_ID_BFI, + CODEC_ID_CMV, + CODEC_ID_MOTIONPIXELS, + CODEC_ID_TGV, + CODEC_ID_TGQ, + CODEC_ID_TQI, + CODEC_ID_AURA, + CODEC_ID_AURA2, + CODEC_ID_V210X, + CODEC_ID_TMV, + CODEC_ID_V210, + CODEC_ID_DPX, + CODEC_ID_MAD, + CODEC_ID_FRWU, + CODEC_ID_FLASHSV2, + CODEC_ID_CDGRAPHICS, + CODEC_ID_R210, + CODEC_ID_ANM, + CODEC_ID_BINKVIDEO, + CODEC_ID_IFF_ILBM, + CODEC_ID_IFF_BYTERUN1, + CODEC_ID_KGV1, + CODEC_ID_YOP, + CODEC_ID_VP8, + CODEC_ID_PICTOR, + CODEC_ID_ANSI, + CODEC_ID_A64_MULTI, + CODEC_ID_A64_MULTI5, + CODEC_ID_R10K, + CODEC_ID_MXPEG, + CODEC_ID_LAGARITH, + CODEC_ID_PRORES, + CODEC_ID_JV, + CODEC_ID_DFA, + CODEC_ID_WMV3IMAGE, + CODEC_ID_VC1IMAGE, + CODEC_ID_UTVIDEO, + CODEC_ID_BMV_VIDEO, + CODEC_ID_VBLE, + CODEC_ID_DXTORY, + CODEC_ID_V410, + CODEC_ID_XWD, + CODEC_ID_CDXL, + CODEC_ID_XBM, + CODEC_ID_ZEROCODEC, + CODEC_ID_MSS1, + CODEC_ID_MSA1, + CODEC_ID_TSCC2, + CODEC_ID_MTS2, + CODEC_ID_CLLC, + CODEC_ID_Y41P = MKBETAG('Y', '4', '1', 'P'), + CODEC_ID_ESCAPE130 = MKBETAG('E', '1', '3', '0'), + CODEC_ID_EXR = MKBETAG('0', 'E', 'X', 'R'), + CODEC_ID_AVRP = MKBETAG('A', 'V', 'R', 'P'), + + CODEC_ID_G2M = MKBETAG(0, 'G', '2', 'M'), + CODEC_ID_AVUI = MKBETAG('A', 'V', 'U', 'I'), + CODEC_ID_AYUV = MKBETAG('A', 'Y', 'U', 'V'), + CODEC_ID_V308 = MKBETAG('V', '3', '0', '8'), + CODEC_ID_V408 = MKBETAG('V', '4', '0', '8'), + CODEC_ID_YUV4 = MKBETAG('Y', 'U', 'V', '4'), + CODEC_ID_SANM = MKBETAG('S', 'A', 'N', 'M'), + CODEC_ID_PAF_VIDEO = MKBETAG('P', 'A', 'F', 'V'), + CODEC_ID_SNOW = AV_CODEC_ID_SNOW, + +/* various PCM "codecs" */ + CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs + CODEC_ID_PCM_S16LE = 0x10000, + CODEC_ID_PCM_S16BE, + CODEC_ID_PCM_U16LE, + CODEC_ID_PCM_U16BE, + CODEC_ID_PCM_S8, + CODEC_ID_PCM_U8, + CODEC_ID_PCM_MULAW, + CODEC_ID_PCM_ALAW, + CODEC_ID_PCM_S32LE, + CODEC_ID_PCM_S32BE, + CODEC_ID_PCM_U32LE, + CODEC_ID_PCM_U32BE, + CODEC_ID_PCM_S24LE, + CODEC_ID_PCM_S24BE, + CODEC_ID_PCM_U24LE, + CODEC_ID_PCM_U24BE, + CODEC_ID_PCM_S24DAUD, + CODEC_ID_PCM_ZORK, + CODEC_ID_PCM_S16LE_PLANAR, + CODEC_ID_PCM_DVD, + CODEC_ID_PCM_F32BE, + CODEC_ID_PCM_F32LE, + CODEC_ID_PCM_F64BE, + CODEC_ID_PCM_F64LE, + CODEC_ID_PCM_BLURAY, + CODEC_ID_PCM_LXF, + CODEC_ID_S302M, + CODEC_ID_PCM_S8_PLANAR, + +/* various ADPCM codecs */ + CODEC_ID_ADPCM_IMA_QT = 0x11000, + CODEC_ID_ADPCM_IMA_WAV, + CODEC_ID_ADPCM_IMA_DK3, + CODEC_ID_ADPCM_IMA_DK4, + CODEC_ID_ADPCM_IMA_WS, + CODEC_ID_ADPCM_IMA_SMJPEG, + CODEC_ID_ADPCM_MS, + CODEC_ID_ADPCM_4XM, + CODEC_ID_ADPCM_XA, + CODEC_ID_ADPCM_ADX, + CODEC_ID_ADPCM_EA, + CODEC_ID_ADPCM_G726, + CODEC_ID_ADPCM_CT, + CODEC_ID_ADPCM_SWF, + CODEC_ID_ADPCM_YAMAHA, + CODEC_ID_ADPCM_SBPRO_4, + CODEC_ID_ADPCM_SBPRO_3, + CODEC_ID_ADPCM_SBPRO_2, + CODEC_ID_ADPCM_THP, + CODEC_ID_ADPCM_IMA_AMV, + CODEC_ID_ADPCM_EA_R1, + CODEC_ID_ADPCM_EA_R3, + CODEC_ID_ADPCM_EA_R2, + CODEC_ID_ADPCM_IMA_EA_SEAD, + CODEC_ID_ADPCM_IMA_EA_EACS, + CODEC_ID_ADPCM_EA_XAS, + CODEC_ID_ADPCM_EA_MAXIS_XA, + CODEC_ID_ADPCM_IMA_ISS, + CODEC_ID_ADPCM_G722, + CODEC_ID_ADPCM_IMA_APC, + CODEC_ID_VIMA = MKBETAG('V', 'I', 'M', 'A'), + +/* AMR */ + CODEC_ID_AMR_NB = 0x12000, + CODEC_ID_AMR_WB, + +/* RealAudio codecs*/ + CODEC_ID_RA_144 = 0x13000, + CODEC_ID_RA_288, + +/* various DPCM codecs */ + CODEC_ID_ROQ_DPCM = 0x14000, + CODEC_ID_INTERPLAY_DPCM, + CODEC_ID_XAN_DPCM, + CODEC_ID_SOL_DPCM, + +/* audio codecs */ + CODEC_ID_MP2 = 0x15000, + CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3 + CODEC_ID_AAC, + CODEC_ID_AC3, + CODEC_ID_DTS, + CODEC_ID_VORBIS, + CODEC_ID_DVAUDIO, + CODEC_ID_WMAV1, + CODEC_ID_WMAV2, + CODEC_ID_MACE3, + CODEC_ID_MACE6, + CODEC_ID_VMDAUDIO, + CODEC_ID_FLAC, + CODEC_ID_MP3ADU, + CODEC_ID_MP3ON4, + CODEC_ID_SHORTEN, + CODEC_ID_ALAC, + CODEC_ID_WESTWOOD_SND1, + CODEC_ID_GSM, ///< as in Berlin toast format + CODEC_ID_QDM2, + CODEC_ID_COOK, + CODEC_ID_TRUESPEECH, + CODEC_ID_TTA, + CODEC_ID_SMACKAUDIO, + CODEC_ID_QCELP, + CODEC_ID_WAVPACK, + CODEC_ID_DSICINAUDIO, + CODEC_ID_IMC, + CODEC_ID_MUSEPACK7, + CODEC_ID_MLP, + CODEC_ID_GSM_MS, /* as found in WAV */ + CODEC_ID_ATRAC3, + CODEC_ID_VOXWARE, + CODEC_ID_APE, + CODEC_ID_NELLYMOSER, + CODEC_ID_MUSEPACK8, + CODEC_ID_SPEEX, + CODEC_ID_WMAVOICE, + CODEC_ID_WMAPRO, + CODEC_ID_WMALOSSLESS, + CODEC_ID_ATRAC3P, + CODEC_ID_EAC3, + CODEC_ID_SIPR, + CODEC_ID_MP1, + CODEC_ID_TWINVQ, + CODEC_ID_TRUEHD, + CODEC_ID_MP4ALS, + CODEC_ID_ATRAC1, + CODEC_ID_BINKAUDIO_RDFT, + CODEC_ID_BINKAUDIO_DCT, + CODEC_ID_AAC_LATM, + CODEC_ID_QDMC, + CODEC_ID_CELT, + CODEC_ID_G723_1, + CODEC_ID_G729, + CODEC_ID_8SVX_EXP, + CODEC_ID_8SVX_FIB, + CODEC_ID_BMV_AUDIO, + CODEC_ID_RALF, + CODEC_ID_IAC, + CODEC_ID_ILBC, + CODEC_ID_FFWAVESYNTH = MKBETAG('F', 'F', 'W', 'S'), + CODEC_ID_SONIC = MKBETAG('S', 'O', 'N', 'C'), + CODEC_ID_SONIC_LS = MKBETAG('S', 'O', 'N', 'L'), + CODEC_ID_PAF_AUDIO = MKBETAG('P', 'A', 'F', 'A'), + CODEC_ID_OPUS = MKBETAG('O', 'P', 'U', 'S'), + +/* subtitle codecs */ + CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. + CODEC_ID_DVD_SUBTITLE = 0x17000, + CODEC_ID_DVB_SUBTITLE, + CODEC_ID_TEXT, ///< raw UTF-8 text + CODEC_ID_XSUB, + CODEC_ID_SSA, + CODEC_ID_MOV_TEXT, + CODEC_ID_HDMV_PGS_SUBTITLE, + CODEC_ID_DVB_TELETEXT, + CODEC_ID_SRT, + CODEC_ID_MICRODVD = MKBETAG('m', 'D', 'V', 'D'), + CODEC_ID_EIA_608 = MKBETAG('c', '6', '0', '8'), + CODEC_ID_JACOSUB = MKBETAG('J', 'S', 'U', 'B'), + CODEC_ID_SAMI = MKBETAG('S', 'A', 'M', 'I'), + CODEC_ID_REALTEXT = MKBETAG('R', 'T', 'X', 'T'), + CODEC_ID_SUBVIEWER = MKBETAG('S', 'u', 'b', 'V'), + +/* other specific kind of codecs (generally used for attachments) */ + CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. + CODEC_ID_TTF = 0x18000, + CODEC_ID_BINTEXT = MKBETAG('B', 'T', 'X', 'T'), + CODEC_ID_XBIN = MKBETAG('X', 'B', 'I', 'N'), + CODEC_ID_IDF = MKBETAG(0, 'I', 'D', 'F'), + CODEC_ID_OTF = MKBETAG(0, 'O', 'T', 'F'), + + CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like CODEC_ID_NONE) but lavf should attempt to identify it + + CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS + * stream (only used by libavformat) */ + CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems + * stream (only used by libavformat) */ + CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information. + +#endif /* AVCODEC_OLD_CODEC_IDS_H */ diff --git a/app/src/main/cpp/include/libavcodec/vaapi.h b/app/src/main/cpp/include/libavcodec/vaapi.h new file mode 100644 index 0000000..815a27e --- /dev/null +++ b/app/src/main/cpp/include/libavcodec/vaapi.h @@ -0,0 +1,173 @@ +/* + * Video Acceleration API (shared data between FFmpeg and the video player) + * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1 + * + * Copyright (C) 2008-2009 Splitted-Desktop Systems + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VAAPI_H +#define AVCODEC_VAAPI_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_vaapi + * Public libavcodec VA API header. + */ + +#include <stdint.h> + +/** + * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding + * @ingroup lavc_codec_hwaccel + * @{ + */ + +/** + * This structure is used to share data between the FFmpeg library and + * the client video application. + * This shall be zero-allocated and available as + * AVCodecContext.hwaccel_context. All user members can be set once + * during initialization or through each AVCodecContext.get_buffer() + * function call. In any case, they must be valid prior to calling + * decoding functions. + */ +struct vaapi_context { + /** + * Window system dependent data + * + * - encoding: unused + * - decoding: Set by user + */ + void *display; + + /** + * Configuration ID + * + * - encoding: unused + * - decoding: Set by user + */ + uint32_t config_id; + + /** + * Context ID (video decode pipeline) + * + * - encoding: unused + * - decoding: Set by user + */ + uint32_t context_id; + + /** + * VAPictureParameterBuffer ID + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t pic_param_buf_id; + + /** + * VAIQMatrixBuffer ID + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t iq_matrix_buf_id; + + /** + * VABitPlaneBuffer ID (for VC-1 decoding) + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t bitplane_buf_id; + + /** + * Slice parameter/data buffer IDs + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t *slice_buf_ids; + + /** + * Number of effective slice buffer IDs to send to the HW + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int n_slice_buf_ids; + + /** + * Size of pre-allocated slice_buf_ids + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int slice_buf_ids_alloc; + + /** + * Pointer to VASliceParameterBuffers + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + void *slice_params; + + /** + * Size of a VASliceParameterBuffer element + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int slice_param_size; + + /** + * Size of pre-allocated slice_params + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int slice_params_alloc; + + /** + * Number of slices currently filled in + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int slice_count; + + /** + * Pointer to slice data buffer base + * - encoding: unused + * - decoding: Set by libavcodec + */ + const uint8_t *slice_data; + + /** + * Current size of slice data + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t slice_data_size; +}; + +/* @} */ + +#endif /* AVCODEC_VAAPI_H */ diff --git a/app/src/main/cpp/include/libavcodec/vda.h b/app/src/main/cpp/include/libavcodec/vda.h new file mode 100644 index 0000000..b058a7c --- /dev/null +++ b/app/src/main/cpp/include/libavcodec/vda.h @@ -0,0 +1,215 @@ +/* + * VDA HW acceleration + * + * copyright (c) 2011 Sebastien Zwickert + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VDA_H +#define AVCODEC_VDA_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_vda + * Public libavcodec VDA header. + */ + +#include "libavcodec/avcodec.h" + +#include <stdint.h> + +// emmintrin.h is unable to compile with -std=c99 -Werror=missing-prototypes +// http://openradar.appspot.com/8026390 +#undef __GNUC_STDC_INLINE__ + +#define Picture QuickdrawPicture + +#include <VideoDecodeAcceleration/VDADecoder.h> + +#undef Picture + +#include "libavcodec/version.h" + +// extra flags not defined in VDADecoder.h +enum { + kVDADecodeInfo_Asynchronous = 1UL << 0, + kVDADecodeInfo_FrameDropped = 1UL << 1 +}; + +/** + * @defgroup lavc_codec_hwaccel_vda VDA + * @ingroup lavc_codec_hwaccel + * + * @{ + */ + +/** + * This structure is used to provide the necessary configurations and data + * to the VDA FFmpeg HWAccel implementation. + * + * The application must make it available as AVCodecContext.hwaccel_context. + */ +struct vda_context { + /** + * VDA decoder object. + * + * - encoding: unused + * - decoding: Set/Unset by libavcodec. + */ + VDADecoder decoder; + + /** + * The Core Video pixel buffer that contains the current image data. + * + * encoding: unused + * decoding: Set by libavcodec. Unset by user. + */ + CVPixelBufferRef cv_buffer; + + /** + * Use the hardware decoder in synchronous mode. + * + * encoding: unused + * decoding: Set by user. + */ + int use_sync_decoding; + + /** + * The frame width. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + int width; + + /** + * The frame height. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + int height; + + /** + * The frame format. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + int format; + + /** + * The pixel format for output image buffers. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + OSType cv_pix_fmt_type; + + /** + * unused + */ + uint8_t *priv_bitstream; + + /** + * unused + */ + int priv_bitstream_size; + + /** + * unused + */ + int priv_allocated_size; + + /** + * Use av_buffer to manage buffer. + * When the flag is set, the CVPixelBuffers returned by the decoder will + * be released automatically, so you have to retain them if necessary. + * Not setting this flag may cause memory leak. + * + * encoding: unused + * decoding: Set by user. + */ + int use_ref_buffer; +}; + +/** Create the video decoder. */ +int ff_vda_create_decoder(struct vda_context *vda_ctx, + uint8_t *extradata, + int extradata_size); + +/** Destroy the video decoder. */ +int ff_vda_destroy_decoder(struct vda_context *vda_ctx); + +/** + * This struct holds all the information that needs to be passed + * between the caller and libavcodec for initializing VDA decoding. + * Its size is not a part of the public ABI, it must be allocated with + * av_vda_alloc_context() and freed with av_free(). + */ +typedef struct AVVDAContext { + /** + * VDA decoder object. Created and freed by the caller. + */ + VDADecoder decoder; + + /** + * The output callback that must be passed to VDADecoderCreate. + * Set by av_vda_alloc_context(). + */ + VDADecoderOutputCallback output_callback; +} AVVDAContext; + +/** + * Allocate and initialize a VDA context. + * + * This function should be called from the get_format() callback when the caller + * selects the AV_PIX_FMT_VDA format. The caller must then create the decoder + * object (using the output callback provided by libavcodec) that will be used + * for VDA-accelerated decoding. + * + * When decoding with VDA is finished, the caller must destroy the decoder + * object and free the VDA context using av_free(). + * + * @return the newly allocated context or NULL on failure + */ +AVVDAContext *av_vda_alloc_context(void); + +/** + * This is a convenience function that creates and sets up the VDA context using + * an internal implementation. + * + * @param avctx the corresponding codec context + * + * @return >= 0 on success, a negative AVERROR code on failure + */ +int av_vda_default_init(AVCodecContext *avctx); + +/** + * This function must be called to free the VDA context initialized with + * av_vda_default_init(). + * + * @param avctx the corresponding codec context + */ +void av_vda_default_free(AVCodecContext *avctx); + +/** + * @} + */ + +#endif /* AVCODEC_VDA_H */ diff --git a/app/src/main/cpp/include/libavcodec/vdpau.h b/app/src/main/cpp/include/libavcodec/vdpau.h new file mode 100644 index 0000000..92ee17a --- /dev/null +++ b/app/src/main/cpp/include/libavcodec/vdpau.h @@ -0,0 +1,236 @@ +/* + * The Video Decode and Presentation API for UNIX (VDPAU) is used for + * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1. + * + * Copyright (C) 2008 NVIDIA + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VDPAU_H +#define AVCODEC_VDPAU_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_vdpau + * Public libavcodec VDPAU header. + */ + + +/** + * @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer + * @ingroup lavc_codec_hwaccel + * + * VDPAU hardware acceleration has two modules + * - VDPAU decoding + * - VDPAU presentation + * + * The VDPAU decoding module parses all headers using FFmpeg + * parsing mechanisms and uses VDPAU for the actual decoding. + * + * As per the current implementation, the actual decoding + * and rendering (API calls) are done as part of the VDPAU + * presentation (vo_vdpau.c) module. + * + * @{ + */ + +#include <vdpau/vdpau.h> +#include <vdpau/vdpau_x11.h> +#include "libavutil/avconfig.h" +#include "libavutil/attributes.h" + +#include "avcodec.h" +#include "version.h" + +#if FF_API_BUFS_VDPAU +union AVVDPAUPictureInfo { + VdpPictureInfoH264 h264; + VdpPictureInfoMPEG1Or2 mpeg; + VdpPictureInfoVC1 vc1; + VdpPictureInfoMPEG4Part2 mpeg4; +}; +#endif + +struct AVCodecContext; +struct AVFrame; + +typedef int (*AVVDPAU_Render2)(struct AVCodecContext *, struct AVFrame *, + const VdpPictureInfo *, uint32_t, + const VdpBitstreamBuffer *); + +/** + * This structure is used to share data between the libavcodec library and + * the client video application. + * The user shall allocate the structure via the av_alloc_vdpau_hwaccel + * function and make it available as + * AVCodecContext.hwaccel_context. Members can be set by the user once + * during initialization or through each AVCodecContext.get_buffer() + * function call. In any case, they must be valid prior to calling + * decoding functions. + * + * The size of this structure is not a part of the public ABI and must not + * be used outside of libavcodec. Use av_vdpau_alloc_context() to allocate an + * AVVDPAUContext. + */ +typedef struct AVVDPAUContext { + /** + * VDPAU decoder handle + * + * Set by user. + */ + VdpDecoder decoder; + + /** + * VDPAU decoder render callback + * + * Set by the user. + */ + VdpDecoderRender *render; + +#if FF_API_BUFS_VDPAU + /** + * VDPAU picture information + * + * Set by libavcodec. + */ + attribute_deprecated + union AVVDPAUPictureInfo info; + + /** + * Allocated size of the bitstream_buffers table. + * + * Set by libavcodec. + */ + attribute_deprecated + int bitstream_buffers_allocated; + + /** + * Useful bitstream buffers in the bitstream buffers table. + * + * Set by libavcodec. + */ + attribute_deprecated + int bitstream_buffers_used; + + /** + * Table of bitstream buffers. + * The user is responsible for freeing this buffer using av_freep(). + * + * Set by libavcodec. + */ + attribute_deprecated + VdpBitstreamBuffer *bitstream_buffers; +#endif + AVVDPAU_Render2 render2; +} AVVDPAUContext; + +/** + * @brief allocation function for AVVDPAUContext + * + * Allows extending the struct without breaking API/ABI + */ +AVVDPAUContext *av_alloc_vdpaucontext(void); + +AVVDPAU_Render2 av_vdpau_hwaccel_get_render2(const AVVDPAUContext *); + +void av_vdpau_hwaccel_set_render2(AVVDPAUContext *, AVVDPAU_Render2); + +/** + * Associate a VDPAU device with a codec context for hardware acceleration. + * This function is meant to be called from the get_format() codec callback, + * or earlier. It can also be called after avcodec_flush_buffers() to change + * the underlying VDPAU device mid-stream (e.g. to recover from non-transparent + * display preemption). + * + * @note get_format() must return AV_PIX_FMT_VDPAU if this function completes + * successfully. + * + * @param avctx decoding context whose get_format() callback is invoked + * @param device VDPAU device handle to use for hardware acceleration + * @param get_proc_address VDPAU device driver + * @param flags zero of more OR'd AV_HWACCEL_FLAG_* flags + * + * @return 0 on success, an AVERROR code on failure. + */ +int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device, + VdpGetProcAddress *get_proc_address, unsigned flags); + +/** + * Allocate an AVVDPAUContext. + * + * @return Newly-allocated AVVDPAUContext or NULL on failure. + */ +AVVDPAUContext *av_vdpau_alloc_context(void); + +/** + * Get a decoder profile that should be used for initializing a VDPAU decoder. + * Should be called from the AVCodecContext.get_format() callback. + * + * @param avctx the codec context being used for decoding the stream + * @param profile a pointer into which the result will be written on success. + * The contents of profile are undefined if this function returns + * an error. + * + * @return 0 on success (non-negative), a negative AVERROR on failure. + */ +int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile); + +#if FF_API_CAP_VDPAU +/** @brief The videoSurface is used for rendering. */ +#define FF_VDPAU_STATE_USED_FOR_RENDER 1 + +/** + * @brief The videoSurface is needed for reference/prediction. + * The codec manipulates this. + */ +#define FF_VDPAU_STATE_USED_FOR_REFERENCE 2 + +/** + * @brief This structure is used as a callback between the FFmpeg + * decoder (vd_) and presentation (vo_) module. + * This is used for defining a video frame containing surface, + * picture parameter, bitstream information etc which are passed + * between the FFmpeg decoder and its clients. + */ +struct vdpau_render_state { + VdpVideoSurface surface; ///< Used as rendered surface, never changed. + + int state; ///< Holds FF_VDPAU_STATE_* values. + +#if AV_HAVE_INCOMPATIBLE_LIBAV_ABI + /** picture parameter information for all supported codecs */ + union AVVDPAUPictureInfo info; +#endif + + /** Describe size/location of the compressed video data. + Set to 0 when freeing bitstream_buffers. */ + int bitstream_buffers_allocated; + int bitstream_buffers_used; + /** The user is responsible for freeing this buffer using av_freep(). */ + VdpBitstreamBuffer *bitstream_buffers; + +#if !AV_HAVE_INCOMPATIBLE_LIBAV_ABI + /** picture parameter information for all supported codecs */ + union AVVDPAUPictureInfo info; +#endif +}; +#endif + +/* @}*/ + +#endif /* AVCODEC_VDPAU_H */ diff --git a/app/src/main/cpp/include/libavcodec/version.h b/app/src/main/cpp/include/libavcodec/version.h new file mode 100644 index 0000000..643838a --- /dev/null +++ b/app/src/main/cpp/include/libavcodec/version.h @@ -0,0 +1,188 @@ +/* + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VERSION_H +#define AVCODEC_VERSION_H + +/** + * @file + * @ingroup libavc + * Libavcodec version macros. + */ + +#include "libavutil/version.h" + +#define LIBAVCODEC_VERSION_MAJOR 56 +#define LIBAVCODEC_VERSION_MINOR 13 +#define LIBAVCODEC_VERSION_MICRO 100 + +#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ + LIBAVCODEC_VERSION_MINOR, \ + LIBAVCODEC_VERSION_MICRO) +#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \ + LIBAVCODEC_VERSION_MINOR, \ + LIBAVCODEC_VERSION_MICRO) +#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT + +#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + */ + +#ifndef FF_API_REQUEST_CHANNELS +#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_OLD_DECODE_AUDIO +#define FF_API_OLD_DECODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_OLD_ENCODE_AUDIO +#define FF_API_OLD_ENCODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_OLD_ENCODE_VIDEO +#define FF_API_OLD_ENCODE_VIDEO (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_CODEC_ID +#define FF_API_CODEC_ID (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_AUDIO_CONVERT +#define FF_API_AUDIO_CONVERT (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_AVCODEC_RESAMPLE +#define FF_API_AVCODEC_RESAMPLE FF_API_AUDIO_CONVERT +#endif +#ifndef FF_API_DEINTERLACE +#define FF_API_DEINTERLACE (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_DESTRUCT_PACKET +#define FF_API_DESTRUCT_PACKET (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_GET_BUFFER +#define FF_API_GET_BUFFER (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_MISSING_SAMPLE +#define FF_API_MISSING_SAMPLE (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_LOWRES +#define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_CAP_VDPAU +#define FF_API_CAP_VDPAU (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_BUFS_VDPAU +#define FF_API_BUFS_VDPAU (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_VOXWARE +#define FF_API_VOXWARE (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_SET_DIMENSIONS +#define FF_API_SET_DIMENSIONS (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_DEBUG_MV +#define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_AC_VLC +#define FF_API_AC_VLC (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_OLD_MSMPEG4 +#define FF_API_OLD_MSMPEG4 (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_ASPECT_EXTENDED +#define FF_API_ASPECT_EXTENDED (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_THREAD_OPAQUE +#define FF_API_THREAD_OPAQUE (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_CODEC_PKT +#define FF_API_CODEC_PKT (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_ARCH_ALPHA +#define FF_API_ARCH_ALPHA (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_XVMC +#define FF_API_XVMC (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_ERROR_RATE +#define FF_API_ERROR_RATE (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_QSCALE_TYPE +#define FF_API_QSCALE_TYPE (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_MB_TYPE +#define FF_API_MB_TYPE (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_MAX_BFRAMES +#define FF_API_MAX_BFRAMES (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_NEG_LINESIZES +#define FF_API_NEG_LINESIZES (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_EMU_EDGE +#define FF_API_EMU_EDGE (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_ARCH_SH4 +#define FF_API_ARCH_SH4 (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_ARCH_SPARC +#define FF_API_ARCH_SPARC (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_UNUSED_MEMBERS +#define FF_API_UNUSED_MEMBERS (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_IDCT_XVIDMMX +#define FF_API_IDCT_XVIDMMX (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_INPUT_PRESERVED +#define FF_API_INPUT_PRESERVED (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_NORMALIZE_AQP +#define FF_API_NORMALIZE_AQP (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_GMC +#define FF_API_GMC (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_MV0 +#define FF_API_MV0 (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_CODEC_NAME +#define FF_API_CODEC_NAME (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_AFD +#define FF_API_AFD (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_VISMV +/* XXX: don't forget to drop the -vismv documentation */ +#define FF_API_VISMV (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_DV_FRAME_PROFILE +#define FF_API_DV_FRAME_PROFILE (LIBAVCODEC_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_AUDIOENC_DELAY +#define FF_API_AUDIOENC_DELAY (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_AVCTX_TIMEBASE +#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_MPV_OPT +#define FF_API_MPV_OPT (LIBAVCODEC_VERSION_MAJOR < 59) +#endif + +#endif /* AVCODEC_VERSION_H */ diff --git a/app/src/main/cpp/include/libavcodec/vorbis_parser.h b/app/src/main/cpp/include/libavcodec/vorbis_parser.h new file mode 100644 index 0000000..83828d9 --- /dev/null +++ b/app/src/main/cpp/include/libavcodec/vorbis_parser.h @@ -0,0 +1,77 @@ +/* + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * A public API for Vorbis parsing + * + * Determines the duration for each packet. + */ + +#ifndef AVCODEC_VORBIS_PARSE_H +#define AVCODEC_VORBIS_PARSE_H + +#include <stdint.h> + +typedef struct AVVorbisParseContext AVVorbisParseContext; + +/** + * Allocate and initialize the Vorbis parser using headers in the extradata. + * + * @param avctx codec context + * @param s Vorbis parser context + */ +AVVorbisParseContext *av_vorbis_parse_init(const uint8_t *extradata, + int extradata_size); + +/** + * Free the parser and everything associated with it. + */ +void av_vorbis_parse_free(AVVorbisParseContext **s); + +#define VORBIS_FLAG_HEADER 0x00000001 +#define VORBIS_FLAG_COMMENT 0x00000002 + +/** + * Get the duration for a Vorbis packet. + * + * If @p flags is @c NULL, + * special frames are considered invalid. + * + * @param s Vorbis parser context + * @param buf buffer containing a Vorbis frame + * @param buf_size size of the buffer + * @param flags flags for special frames + */ +int av_vorbis_parse_frame_flags(AVVorbisParseContext *s, const uint8_t *buf, + int buf_size, int *flags); + +/** + * Get the duration for a Vorbis packet. + * + * @param s Vorbis parser context + * @param buf buffer containing a Vorbis frame + * @param buf_size size of the buffer + */ +int av_vorbis_parse_frame(AVVorbisParseContext *s, const uint8_t *buf, + int buf_size); + +void av_vorbis_parse_reset(AVVorbisParseContext *s); + +#endif /* AVCODEC_VORBIS_PARSE_H */ diff --git a/app/src/main/cpp/include/libavcodec/xvmc.h b/app/src/main/cpp/include/libavcodec/xvmc.h new file mode 100644 index 0000000..98100e3 --- /dev/null +++ b/app/src/main/cpp/include/libavcodec/xvmc.h @@ -0,0 +1,170 @@ +/* + * Copyright (C) 2003 Ivan Kalvachev + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_XVMC_H +#define AVCODEC_XVMC_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_xvmc + * Public libavcodec XvMC header. + */ + +#include <X11/extensions/XvMC.h> + +#include "libavutil/attributes.h" +#include "version.h" +#include "avcodec.h" + +/** + * @defgroup lavc_codec_hwaccel_xvmc XvMC + * @ingroup lavc_codec_hwaccel + * + * @{ + */ + +#define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct + the number is 1337 speak for the letters IDCT MCo (motion compensation) */ + +attribute_deprecated struct xvmc_pix_fmt { + /** The field contains the special constant value AV_XVMC_ID. + It is used as a test that the application correctly uses the API, + and that there is no corruption caused by pixel routines. + - application - set during initialization + - libavcodec - unchanged + */ + int xvmc_id; + + /** Pointer to the block array allocated by XvMCCreateBlocks(). + The array has to be freed by XvMCDestroyBlocks(). + Each group of 64 values represents one data block of differential + pixel information (in MoCo mode) or coefficients for IDCT. + - application - set the pointer during initialization + - libavcodec - fills coefficients/pixel data into the array + */ + short *data_blocks; + + /** Pointer to the macroblock description array allocated by + XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks(). + - application - set the pointer during initialization + - libavcodec - fills description data into the array + */ + XvMCMacroBlock *mv_blocks; + + /** Number of macroblock descriptions that can be stored in the mv_blocks + array. + - application - set during initialization + - libavcodec - unchanged + */ + int allocated_mv_blocks; + + /** Number of blocks that can be stored at once in the data_blocks array. + - application - set during initialization + - libavcodec - unchanged + */ + int allocated_data_blocks; + + /** Indicate that the hardware would interpret data_blocks as IDCT + coefficients and perform IDCT on them. + - application - set during initialization + - libavcodec - unchanged + */ + int idct; + + /** In MoCo mode it indicates that intra macroblocks are assumed to be in + unsigned format; same as the XVMC_INTRA_UNSIGNED flag. + - application - set during initialization + - libavcodec - unchanged + */ + int unsigned_intra; + + /** Pointer to the surface allocated by XvMCCreateSurface(). + It has to be freed by XvMCDestroySurface() on application exit. + It identifies the frame and its state on the video hardware. + - application - set during initialization + - libavcodec - unchanged + */ + XvMCSurface *p_surface; + +/** Set by the decoder before calling ff_draw_horiz_band(), + needed by the XvMCRenderSurface function. */ +//@{ + /** Pointer to the surface used as past reference + - application - unchanged + - libavcodec - set + */ + XvMCSurface *p_past_surface; + + /** Pointer to the surface used as future reference + - application - unchanged + - libavcodec - set + */ + XvMCSurface *p_future_surface; + + /** top/bottom field or frame + - application - unchanged + - libavcodec - set + */ + unsigned int picture_structure; + + /** XVMC_SECOND_FIELD - 1st or 2nd field in the sequence + - application - unchanged + - libavcodec - set + */ + unsigned int flags; +//}@ + + /** Number of macroblock descriptions in the mv_blocks array + that have already been passed to the hardware. + - application - zeroes it on get_buffer(). + A successful ff_draw_horiz_band() may increment it + with filled_mb_block_num or zero both. + - libavcodec - unchanged + */ + int start_mv_blocks_num; + + /** Number of new macroblock descriptions in the mv_blocks array (after + start_mv_blocks_num) that are filled by libavcodec and have to be + passed to the hardware. + - application - zeroes it on get_buffer() or after successful + ff_draw_horiz_band(). + - libavcodec - increment with one of each stored MB + */ + int filled_mv_blocks_num; + + /** Number of the next free data block; one data block consists of + 64 short values in the data_blocks array. + All blocks before this one have already been claimed by placing their + position into the corresponding block description structure field, + that are part of the mv_blocks array. + - application - zeroes it on get_buffer(). + A successful ff_draw_horiz_band() may zero it together + with start_mb_blocks_num. + - libavcodec - each decoded macroblock increases it by the number + of coded blocks it contains. + */ + int next_free_data_block_num; +}; + +/** + * @} + */ + +#endif /* AVCODEC_XVMC_H */ diff --git a/app/src/main/cpp/include/libavdevice/avdevice.h b/app/src/main/cpp/include/libavdevice/avdevice.h new file mode 100644 index 0000000..4b52ecc --- /dev/null +++ b/app/src/main/cpp/include/libavdevice/avdevice.h @@ -0,0 +1,487 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVDEVICE_AVDEVICE_H +#define AVDEVICE_AVDEVICE_H + +#include "version.h" + +/** + * @file + * @ingroup lavd + * Main libavdevice API header + */ + +/** + * @defgroup lavd Special devices muxing/demuxing library + * @{ + * Libavdevice is a complementary library to @ref libavf "libavformat". It + * provides various "special" platform-specific muxers and demuxers, e.g. for + * grabbing devices, audio capture and playback etc. As a consequence, the + * (de)muxers in libavdevice are of the AVFMT_NOFILE type (they use their own + * I/O functions). The filename passed to avformat_open_input() often does not + * refer to an actually existing file, but has some special device-specific + * meaning - e.g. for x11grab it is the display name. + * + * To use libavdevice, simply call avdevice_register_all() to register all + * compiled muxers and demuxers. They all use standard libavformat API. + * @} + */ + +#include "libavutil/log.h" +#include "libavutil/opt.h" +#include "libavutil/dict.h" +#include "libavformat/avformat.h" + +/** + * Return the LIBAVDEVICE_VERSION_INT constant. + */ +unsigned avdevice_version(void); + +/** + * Return the libavdevice build-time configuration. + */ +const char *avdevice_configuration(void); + +/** + * Return the libavdevice license. + */ +const char *avdevice_license(void); + +/** + * Initialize libavdevice and register all the input and output devices. + * @warning This function is not thread safe. + */ +void avdevice_register_all(void); + +/** + * Audio input devices iterator. + * + * If d is NULL, returns the first registered input audio/video device, + * if d is non-NULL, returns the next registered input audio/video device after d + * or NULL if d is the last one. + */ +AVInputFormat *av_input_audio_device_next(AVInputFormat *d); + +/** + * Video input devices iterator. + * + * If d is NULL, returns the first registered input audio/video device, + * if d is non-NULL, returns the next registered input audio/video device after d + * or NULL if d is the last one. + */ +AVInputFormat *av_input_video_device_next(AVInputFormat *d); + +/** + * Audio output devices iterator. + * + * If d is NULL, returns the first registered output audio/video device, + * if d is non-NULL, returns the next registered output audio/video device after d + * or NULL if d is the last one. + */ +AVOutputFormat *av_output_audio_device_next(AVOutputFormat *d); + +/** + * Video output devices iterator. + * + * If d is NULL, returns the first registered output audio/video device, + * if d is non-NULL, returns the next registered output audio/video device after d + * or NULL if d is the last one. + */ +AVOutputFormat *av_output_video_device_next(AVOutputFormat *d); + +typedef struct AVDeviceRect { + int x; /**< x coordinate of top left corner */ + int y; /**< y coordinate of top left corner */ + int width; /**< width */ + int height; /**< height */ +} AVDeviceRect; + +/** + * Message types used by avdevice_app_to_dev_control_message(). + */ +enum AVAppToDevMessageType { + /** + * Dummy message. + */ + AV_APP_TO_DEV_NONE = MKBETAG('N', 'O', 'N', 'E'), + + /** + * Window size change message. + * + * Message is sent to the device every time the application changes the size + * of the window device renders to. + * Message should also be sent right after window is created. + * + * data: AVDeviceRect: new window size. + */ + AV_APP_TO_DEV_WINDOW_SIZE = MKBETAG('G', 'E', 'O', 'M'), + + /** + * Repaint request message. + * + * Message is sent to the device when window has to be repainted. + * + * data: AVDeviceRect: area required to be repainted. + * NULL: whole area is required to be repainted. + */ + AV_APP_TO_DEV_WINDOW_REPAINT = MKBETAG('R', 'E', 'P', 'A'), + + /** + * Request pause/play. + * + * Application requests pause/unpause playback. + * Mostly usable with devices that have internal buffer. + * By default devices are not paused. + * + * data: NULL + */ + AV_APP_TO_DEV_PAUSE = MKBETAG('P', 'A', 'U', ' '), + AV_APP_TO_DEV_PLAY = MKBETAG('P', 'L', 'A', 'Y'), + AV_APP_TO_DEV_TOGGLE_PAUSE = MKBETAG('P', 'A', 'U', 'T'), + + /** + * Volume control message. + * + * Set volume level. It may be device-dependent if volume + * is changed per stream or system wide. Per stream volume + * change is expected when possible. + * + * data: double: new volume with range of 0.0 - 1.0. + */ + AV_APP_TO_DEV_SET_VOLUME = MKBETAG('S', 'V', 'O', 'L'), + + /** + * Mute control messages. + * + * Change mute state. It may be device-dependent if mute status + * is changed per stream or system wide. Per stream mute status + * change is expected when possible. + * + * data: NULL. + */ + AV_APP_TO_DEV_MUTE = MKBETAG(' ', 'M', 'U', 'T'), + AV_APP_TO_DEV_UNMUTE = MKBETAG('U', 'M', 'U', 'T'), + AV_APP_TO_DEV_TOGGLE_MUTE = MKBETAG('T', 'M', 'U', 'T'), + + /** + * Get volume/mute messages. + * + * Force the device to send AV_DEV_TO_APP_VOLUME_LEVEL_CHANGED or + * AV_DEV_TO_APP_MUTE_STATE_CHANGED command respectively. + * + * data: NULL. + */ + AV_APP_TO_DEV_GET_VOLUME = MKBETAG('G', 'V', 'O', 'L'), + AV_APP_TO_DEV_GET_MUTE = MKBETAG('G', 'M', 'U', 'T'), +}; + +/** + * Message types used by avdevice_dev_to_app_control_message(). + */ +enum AVDevToAppMessageType { + /** + * Dummy message. + */ + AV_DEV_TO_APP_NONE = MKBETAG('N', 'O', 'N', 'E'), + + /** + * Create window buffer message. + * + * Device requests to create a window buffer. Exact meaning is device- + * and application-dependent. Message is sent before rendering first + * frame and all one-shot initializations should be done here. + * Application is allowed to ignore preferred window buffer size. + * + * @note: Application is obligated to inform about window buffer size + * with AV_APP_TO_DEV_WINDOW_SIZE message. + * + * data: AVDeviceRect: preferred size of the window buffer. + * NULL: no preferred size of the window buffer. + */ + AV_DEV_TO_APP_CREATE_WINDOW_BUFFER = MKBETAG('B', 'C', 'R', 'E'), + + /** + * Prepare window buffer message. + * + * Device requests to prepare a window buffer for rendering. + * Exact meaning is device- and application-dependent. + * Message is sent before rendering of each frame. + * + * data: NULL. + */ + AV_DEV_TO_APP_PREPARE_WINDOW_BUFFER = MKBETAG('B', 'P', 'R', 'E'), + + /** + * Display window buffer message. + * + * Device requests to display a window buffer. + * Message is sent when new frame is ready to be displayed. + * Usually buffers need to be swapped in handler of this message. + * + * data: NULL. + */ + AV_DEV_TO_APP_DISPLAY_WINDOW_BUFFER = MKBETAG('B', 'D', 'I', 'S'), + + /** + * Destroy window buffer message. + * + * Device requests to destroy a window buffer. + * Message is sent when device is about to be destroyed and window + * buffer is not required anymore. + * + * data: NULL. + */ + AV_DEV_TO_APP_DESTROY_WINDOW_BUFFER = MKBETAG('B', 'D', 'E', 'S'), + + /** + * Buffer fullness status messages. + * + * Device signals buffer overflow/underflow. + * + * data: NULL. + */ + AV_DEV_TO_APP_BUFFER_OVERFLOW = MKBETAG('B', 'O', 'F', 'L'), + AV_DEV_TO_APP_BUFFER_UNDERFLOW = MKBETAG('B', 'U', 'F', 'L'), + + /** + * Buffer readable/writable. + * + * Device informs that buffer is readable/writable. + * When possible, device informs how many bytes can be read/write. + * + * @warning Device may not inform when number of bytes than can be read/write changes. + * + * data: int64_t: amount of bytes available to read/write. + * NULL: amount of bytes available to read/write is not known. + */ + AV_DEV_TO_APP_BUFFER_READABLE = MKBETAG('B', 'R', 'D', ' '), + AV_DEV_TO_APP_BUFFER_WRITABLE = MKBETAG('B', 'W', 'R', ' '), + + /** + * Mute state change message. + * + * Device informs that mute state has changed. + * + * data: int: 0 for not muted state, non-zero for muted state. + */ + AV_DEV_TO_APP_MUTE_STATE_CHANGED = MKBETAG('C', 'M', 'U', 'T'), + + /** + * Volume level change message. + * + * Device informs that volume level has changed. + * + * data: double: new volume with range of 0.0 - 1.0. + */ + AV_DEV_TO_APP_VOLUME_LEVEL_CHANGED = MKBETAG('C', 'V', 'O', 'L'), +}; + +/** + * Send control message from application to device. + * + * @param s device context. + * @param type message type. + * @param data message data. Exact type depends on message type. + * @param data_size size of message data. + * @return >= 0 on success, negative on error. + * AVERROR(ENOSYS) when device doesn't implement handler of the message. + */ +int avdevice_app_to_dev_control_message(struct AVFormatContext *s, + enum AVAppToDevMessageType type, + void *data, size_t data_size); + +/** + * Send control message from device to application. + * + * @param s device context. + * @param type message type. + * @param data message data. Can be NULL. + * @param data_size size of message data. + * @return >= 0 on success, negative on error. + * AVERROR(ENOSYS) when application doesn't implement handler of the message. + */ +int avdevice_dev_to_app_control_message(struct AVFormatContext *s, + enum AVDevToAppMessageType type, + void *data, size_t data_size); + +/** + * Following API allows user to probe device capabilities (supported codecs, + * pixel formats, sample formats, resolutions, channel counts, etc). + * It is build on top op AVOption API. + * Queried capabilities allows to set up converters of video or audio + * parameters that fit to the device. + * + * List of capabilities that can be queried: + * - Capabilities valid for both audio and video devices: + * - codec: supported audio/video codecs. + * type: AV_OPT_TYPE_INT (AVCodecID value) + * - Capabilities valid for audio devices: + * - sample_format: supported sample formats. + * type: AV_OPT_TYPE_INT (AVSampleFormat value) + * - sample_rate: supported sample rates. + * type: AV_OPT_TYPE_INT + * - channels: supported number of channels. + * type: AV_OPT_TYPE_INT + * - channel_layout: supported channel layouts. + * type: AV_OPT_TYPE_INT64 + * - Capabilities valid for video devices: + * - pixel_format: supported pixel formats. + * type: AV_OPT_TYPE_INT (AVPixelFormat value) + * - window_size: supported window sizes (describes size of the window size presented to the user). + * type: AV_OPT_TYPE_IMAGE_SIZE + * - frame_size: supported frame sizes (describes size of provided video frames). + * type: AV_OPT_TYPE_IMAGE_SIZE + * - fps: supported fps values + * type: AV_OPT_TYPE_RATIONAL + * + * Value of the capability may be set by user using av_opt_set() function + * and AVDeviceCapabilitiesQuery object. Following queries will + * limit results to the values matching already set capabilities. + * For example, setting a codec may impact number of formats or fps values + * returned during next query. Setting invalid value may limit results to zero. + * + * Example of the usage basing on opengl output device: + * + * @code + * AVFormatContext *oc = NULL; + * AVDeviceCapabilitiesQuery *caps = NULL; + * AVOptionRanges *ranges; + * int ret; + * + * if ((ret = avformat_alloc_output_context2(&oc, NULL, "opengl", NULL)) < 0) + * goto fail; + * if (avdevice_capabilities_create(&caps, oc, NULL) < 0) + * goto fail; + * + * //query codecs + * if (av_opt_query_ranges(&ranges, caps, "codec", AV_OPT_MULTI_COMPONENT_RANGE)) < 0) + * goto fail; + * //pick codec here and set it + * av_opt_set(caps, "codec", AV_CODEC_ID_RAWVIDEO, 0); + * + * //query format + * if (av_opt_query_ranges(&ranges, caps, "pixel_format", AV_OPT_MULTI_COMPONENT_RANGE)) < 0) + * goto fail; + * //pick format here and set it + * av_opt_set(caps, "pixel_format", AV_PIX_FMT_YUV420P, 0); + * + * //query and set more capabilities + * + * fail: + * //clean up code + * avdevice_capabilities_free(&query, oc); + * avformat_free_context(oc); + * @endcode + */ + +/** + * Structure describes device capabilities. + * + * It is used by devices in conjunction with av_device_capabilities AVOption table + * to implement capabilities probing API based on AVOption API. Should not be used directly. + */ +typedef struct AVDeviceCapabilitiesQuery { + const AVClass *av_class; + AVFormatContext *device_context; + enum AVCodecID codec; + enum AVSampleFormat sample_format; + enum AVPixelFormat pixel_format; + int sample_rate; + int channels; + int64_t channel_layout; + int window_width; + int window_height; + int frame_width; + int frame_height; + AVRational fps; +} AVDeviceCapabilitiesQuery; + +/** + * AVOption table used by devices to implement device capabilities API. Should not be used by a user. + */ +extern const AVOption av_device_capabilities[]; + +/** + * Initialize capabilities probing API based on AVOption API. + * + * avdevice_capabilities_free() must be called when query capabilities API is + * not used anymore. + * + * @param[out] caps Device capabilities data. Pointer to a NULL pointer must be passed. + * @param s Context of the device. + * @param device_options An AVDictionary filled with device-private options. + * On return this parameter will be destroyed and replaced with a dict + * containing options that were not found. May be NULL. + * The same options must be passed later to avformat_write_header() for output + * devices or avformat_open_input() for input devices, or at any other place + * that affects device-private options. + * + * @return >= 0 on success, negative otherwise. + */ +int avdevice_capabilities_create(AVDeviceCapabilitiesQuery **caps, AVFormatContext *s, + AVDictionary **device_options); + +/** + * Free resources created by avdevice_capabilities_create() + * + * @param caps Device capabilities data to be freed. + * @param s Context of the device. + */ +void avdevice_capabilities_free(AVDeviceCapabilitiesQuery **caps, AVFormatContext *s); + +/** + * Structure describes basic parameters of the device. + */ +typedef struct AVDeviceInfo { + char *device_name; /**< device name, format depends on device */ + char *device_description; /**< human friendly name */ +} AVDeviceInfo; + +/** + * List of devices. + */ +typedef struct AVDeviceInfoList { + AVDeviceInfo **devices; /**< list of autodetected devices */ + int nb_devices; /**< number of autodetected devices */ + int default_device; /**< index of default device or -1 if no default */ +} AVDeviceInfoList; + +/** + * List devices. + * + * Returns available device names and their parameters. + * + * @note: Some devices may accept system-dependent device names that cannot be + * autodetected. The list returned by this function cannot be assumed to + * be always completed. + * + * @param s device context. + * @param[out] device_list list of autodetected devices. + * @return count of autodetected devices, negative on error. + */ +int avdevice_list_devices(struct AVFormatContext *s, AVDeviceInfoList **device_list); + +/** + * Convenient function to free result of avdevice_list_devices(). + * + * @param devices device list to be freed. + */ +void avdevice_free_list_devices(AVDeviceInfoList **device_list); + +#endif /* AVDEVICE_AVDEVICE_H */ diff --git a/app/src/main/cpp/include/libavdevice/version.h b/app/src/main/cpp/include/libavdevice/version.h new file mode 100644 index 0000000..b9c62be --- /dev/null +++ b/app/src/main/cpp/include/libavdevice/version.h @@ -0,0 +1,50 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVDEVICE_VERSION_H +#define AVDEVICE_VERSION_H + +/** + * @file + * @ingroup lavd + * Libavdevice version macros + */ + +#include "libavutil/version.h" + +#define LIBAVDEVICE_VERSION_MAJOR 56 +#define LIBAVDEVICE_VERSION_MINOR 3 +#define LIBAVDEVICE_VERSION_MICRO 100 + +#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \ + LIBAVDEVICE_VERSION_MINOR, \ + LIBAVDEVICE_VERSION_MICRO) +#define LIBAVDEVICE_VERSION AV_VERSION(LIBAVDEVICE_VERSION_MAJOR, \ + LIBAVDEVICE_VERSION_MINOR, \ + LIBAVDEVICE_VERSION_MICRO) +#define LIBAVDEVICE_BUILD LIBAVDEVICE_VERSION_INT + +#define LIBAVDEVICE_IDENT "Lavd" AV_STRINGIFY(LIBAVDEVICE_VERSION) + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + */ + +#endif /* AVDEVICE_VERSION_H */ diff --git a/app/src/main/cpp/include/libavfilter/asrc_abuffer.h b/app/src/main/cpp/include/libavfilter/asrc_abuffer.h new file mode 100644 index 0000000..aa34461 --- /dev/null +++ b/app/src/main/cpp/include/libavfilter/asrc_abuffer.h @@ -0,0 +1,91 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_ASRC_ABUFFER_H +#define AVFILTER_ASRC_ABUFFER_H + +#include "avfilter.h" + +/** + * @file + * memory buffer source for audio + * + * @deprecated use buffersrc.h instead. + */ + +/** + * Queue an audio buffer to the audio buffer source. + * + * @param abuffersrc audio source buffer context + * @param data pointers to the samples planes + * @param linesize linesizes of each audio buffer plane + * @param nb_samples number of samples per channel + * @param sample_fmt sample format of the audio data + * @param ch_layout channel layout of the audio data + * @param planar flag to indicate if audio data is planar or packed + * @param pts presentation timestamp of the audio buffer + * @param flags unused + * + * @deprecated use av_buffersrc_add_ref() instead. + */ +attribute_deprecated +int av_asrc_buffer_add_samples(AVFilterContext *abuffersrc, + uint8_t *data[8], int linesize[8], + int nb_samples, int sample_rate, + int sample_fmt, int64_t ch_layout, int planar, + int64_t pts, int av_unused flags); + +/** + * Queue an audio buffer to the audio buffer source. + * + * This is similar to av_asrc_buffer_add_samples(), but the samples + * are stored in a buffer with known size. + * + * @param abuffersrc audio source buffer context + * @param buf pointer to the samples data, packed is assumed + * @param size the size in bytes of the buffer, it must contain an + * integer number of samples + * @param sample_fmt sample format of the audio data + * @param ch_layout channel layout of the audio data + * @param pts presentation timestamp of the audio buffer + * @param flags unused + * + * @deprecated use av_buffersrc_add_ref() instead. + */ +attribute_deprecated +int av_asrc_buffer_add_buffer(AVFilterContext *abuffersrc, + uint8_t *buf, int buf_size, + int sample_rate, + int sample_fmt, int64_t ch_layout, int planar, + int64_t pts, int av_unused flags); + +/** + * Queue an audio buffer to the audio buffer source. + * + * @param abuffersrc audio source buffer context + * @param samplesref buffer ref to queue + * @param flags unused + * + * @deprecated use av_buffersrc_add_ref() instead. + */ +attribute_deprecated +int av_asrc_buffer_add_audio_buffer_ref(AVFilterContext *abuffersrc, + AVFilterBufferRef *samplesref, + int av_unused flags); + +#endif /* AVFILTER_ASRC_ABUFFER_H */ diff --git a/app/src/main/cpp/include/libavfilter/avcodec.h b/app/src/main/cpp/include/libavfilter/avcodec.h new file mode 100644 index 0000000..cd1aa78 --- /dev/null +++ b/app/src/main/cpp/include/libavfilter/avcodec.h @@ -0,0 +1,69 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_AVCODEC_H +#define AVFILTER_AVCODEC_H + +/** + * @file + * libavcodec/libavfilter gluing utilities + * + * This should be included in an application ONLY if the installed + * libavfilter has been compiled with libavcodec support, otherwise + * symbols defined below will not be available. + */ + +#include "avfilter.h" + +#if FF_API_AVFILTERBUFFER +/** + * Create and return a picref reference from the data and properties + * contained in frame. + * + * @param perms permissions to assign to the new buffer reference + * @deprecated avfilter APIs work natively with AVFrame instead. + */ +attribute_deprecated +AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame, int perms); + + +/** + * Create and return a picref reference from the data and properties + * contained in frame. + * + * @param perms permissions to assign to the new buffer reference + * @deprecated avfilter APIs work natively with AVFrame instead. + */ +attribute_deprecated +AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(const AVFrame *frame, + int perms); + +/** + * Create and return a buffer reference from the data and properties + * contained in frame. + * + * @param perms permissions to assign to the new buffer reference + * @deprecated avfilter APIs work natively with AVFrame instead. + */ +attribute_deprecated +AVFilterBufferRef *avfilter_get_buffer_ref_from_frame(enum AVMediaType type, + const AVFrame *frame, + int perms); +#endif + +#endif /* AVFILTER_AVCODEC_H */ diff --git a/app/src/main/cpp/include/libavfilter/avfilter.h b/app/src/main/cpp/include/libavfilter/avfilter.h new file mode 100644 index 0000000..a9550bc --- /dev/null +++ b/app/src/main/cpp/include/libavfilter/avfilter.h @@ -0,0 +1,1539 @@ +/* + * filter layer + * Copyright (c) 2007 Bobby Bingham + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_AVFILTER_H +#define AVFILTER_AVFILTER_H + +/** + * @file + * @ingroup lavfi + * Main libavfilter public API header + */ + +/** + * @defgroup lavfi Libavfilter - graph-based frame editing library + * @{ + */ + +#include <stddef.h> + +#include "libavutil/attributes.h" +#include "libavutil/avutil.h" +#include "libavutil/dict.h" +#include "libavutil/frame.h" +#include "libavutil/log.h" +#include "libavutil/samplefmt.h" +#include "libavutil/pixfmt.h" +#include "libavutil/rational.h" + +#include "libavfilter/version.h" + +/** + * Return the LIBAVFILTER_VERSION_INT constant. + */ +unsigned avfilter_version(void); + +/** + * Return the libavfilter build-time configuration. + */ +const char *avfilter_configuration(void); + +/** + * Return the libavfilter license. + */ +const char *avfilter_license(void); + +typedef struct AVFilterContext AVFilterContext; +typedef struct AVFilterLink AVFilterLink; +typedef struct AVFilterPad AVFilterPad; +typedef struct AVFilterFormats AVFilterFormats; + +#if FF_API_AVFILTERBUFFER +/** + * A reference-counted buffer data type used by the filter system. Filters + * should not store pointers to this structure directly, but instead use the + * AVFilterBufferRef structure below. + */ +typedef struct AVFilterBuffer { + uint8_t *data[8]; ///< buffer data for each plane/channel + + /** + * pointers to the data planes/channels. + * + * For video, this should simply point to data[]. + * + * For planar audio, each channel has a separate data pointer, and + * linesize[0] contains the size of each channel buffer. + * For packed audio, there is just one data pointer, and linesize[0] + * contains the total size of the buffer for all channels. + * + * Note: Both data and extended_data will always be set, but for planar + * audio with more channels that can fit in data, extended_data must be used + * in order to access all channels. + */ + uint8_t **extended_data; + int linesize[8]; ///< number of bytes per line + + /** private data to be used by a custom free function */ + void *priv; + /** + * A pointer to the function to deallocate this buffer if the default + * function is not sufficient. This could, for example, add the memory + * back into a memory pool to be reused later without the overhead of + * reallocating it from scratch. + */ + void (*free)(struct AVFilterBuffer *buf); + + int format; ///< media format + int w, h; ///< width and height of the allocated buffer + unsigned refcount; ///< number of references to this buffer +} AVFilterBuffer; + +#define AV_PERM_READ 0x01 ///< can read from the buffer +#define AV_PERM_WRITE 0x02 ///< can write to the buffer +#define AV_PERM_PRESERVE 0x04 ///< nobody else can overwrite the buffer +#define AV_PERM_REUSE 0x08 ///< can output the buffer multiple times, with the same contents each time +#define AV_PERM_REUSE2 0x10 ///< can output the buffer multiple times, modified each time +#define AV_PERM_NEG_LINESIZES 0x20 ///< the buffer requested can have negative linesizes +#define AV_PERM_ALIGN 0x40 ///< the buffer must be aligned + +#define AVFILTER_ALIGN 16 //not part of ABI + +/** + * Audio specific properties in a reference to an AVFilterBuffer. Since + * AVFilterBufferRef is common to different media formats, audio specific + * per reference properties must be separated out. + */ +typedef struct AVFilterBufferRefAudioProps { + uint64_t channel_layout; ///< channel layout of audio buffer + int nb_samples; ///< number of audio samples per channel + int sample_rate; ///< audio buffer sample rate + int channels; ///< number of channels (do not access directly) +} AVFilterBufferRefAudioProps; + +/** + * Video specific properties in a reference to an AVFilterBuffer. Since + * AVFilterBufferRef is common to different media formats, video specific + * per reference properties must be separated out. + */ +typedef struct AVFilterBufferRefVideoProps { + int w; ///< image width + int h; ///< image height + AVRational sample_aspect_ratio; ///< sample aspect ratio + int interlaced; ///< is frame interlaced + int top_field_first; ///< field order + enum AVPictureType pict_type; ///< picture type of the frame + int key_frame; ///< 1 -> keyframe, 0-> not + int qp_table_linesize; ///< qp_table stride + int qp_table_size; ///< qp_table size + int8_t *qp_table; ///< array of Quantization Parameters +} AVFilterBufferRefVideoProps; + +/** + * A reference to an AVFilterBuffer. Since filters can manipulate the origin of + * a buffer to, for example, crop image without any memcpy, the buffer origin + * and dimensions are per-reference properties. Linesize is also useful for + * image flipping, frame to field filters, etc, and so is also per-reference. + * + * TODO: add anything necessary for frame reordering + */ +typedef struct AVFilterBufferRef { + AVFilterBuffer *buf; ///< the buffer that this is a reference to + uint8_t *data[8]; ///< picture/audio data for each plane + /** + * pointers to the data planes/channels. + * + * For video, this should simply point to data[]. + * + * For planar audio, each channel has a separate data pointer, and + * linesize[0] contains the size of each channel buffer. + * For packed audio, there is just one data pointer, and linesize[0] + * contains the total size of the buffer for all channels. + * + * Note: Both data and extended_data will always be set, but for planar + * audio with more channels that can fit in data, extended_data must be used + * in order to access all channels. + */ + uint8_t **extended_data; + int linesize[8]; ///< number of bytes per line + + AVFilterBufferRefVideoProps *video; ///< video buffer specific properties + AVFilterBufferRefAudioProps *audio; ///< audio buffer specific properties + + /** + * presentation timestamp. The time unit may change during + * filtering, as it is specified in the link and the filter code + * may need to rescale the PTS accordingly. + */ + int64_t pts; + int64_t pos; ///< byte position in stream, -1 if unknown + + int format; ///< media format + + int perms; ///< permissions, see the AV_PERM_* flags + + enum AVMediaType type; ///< media type of buffer data + + AVDictionary *metadata; ///< dictionary containing metadata key=value tags +} AVFilterBufferRef; + +/** + * Copy properties of src to dst, without copying the actual data + */ +attribute_deprecated +void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, const AVFilterBufferRef *src); + +/** + * Add a new reference to a buffer. + * + * @param ref an existing reference to the buffer + * @param pmask a bitmask containing the allowable permissions in the new + * reference + * @return a new reference to the buffer with the same properties as the + * old, excluding any permissions denied by pmask + */ +attribute_deprecated +AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask); + +/** + * Remove a reference to a buffer. If this is the last reference to the + * buffer, the buffer itself is also automatically freed. + * + * @param ref reference to the buffer, may be NULL + * + * @note it is recommended to use avfilter_unref_bufferp() instead of this + * function + */ +attribute_deprecated +void avfilter_unref_buffer(AVFilterBufferRef *ref); + +/** + * Remove a reference to a buffer and set the pointer to NULL. + * If this is the last reference to the buffer, the buffer itself + * is also automatically freed. + * + * @param ref pointer to the buffer reference + */ +attribute_deprecated +void avfilter_unref_bufferp(AVFilterBufferRef **ref); +#endif + +/** + * Get the number of channels of a buffer reference. + */ +attribute_deprecated +int avfilter_ref_get_channels(AVFilterBufferRef *ref); + +#if FF_API_AVFILTERPAD_PUBLIC +/** + * A filter pad used for either input or output. + * + * See doc/filter_design.txt for details on how to implement the methods. + * + * @warning this struct might be removed from public API. + * users should call avfilter_pad_get_name() and avfilter_pad_get_type() + * to access the name and type fields; there should be no need to access + * any other fields from outside of libavfilter. + */ +struct AVFilterPad { + /** + * Pad name. The name is unique among inputs and among outputs, but an + * input may have the same name as an output. This may be NULL if this + * pad has no need to ever be referenced by name. + */ + const char *name; + + /** + * AVFilterPad type. + */ + enum AVMediaType type; + + /** + * Input pads: + * Minimum required permissions on incoming buffers. Any buffer with + * insufficient permissions will be automatically copied by the filter + * system to a new buffer which provides the needed access permissions. + * + * Output pads: + * Guaranteed permissions on outgoing buffers. Any buffer pushed on the + * link must have at least these permissions; this fact is checked by + * asserts. It can be used to optimize buffer allocation. + */ + attribute_deprecated int min_perms; + + /** + * Input pads: + * Permissions which are not accepted on incoming buffers. Any buffer + * which has any of these permissions set will be automatically copied + * by the filter system to a new buffer which does not have those + * permissions. This can be used to easily disallow buffers with + * AV_PERM_REUSE. + * + * Output pads: + * Permissions which are automatically removed on outgoing buffers. It + * can be used to optimize buffer allocation. + */ + attribute_deprecated int rej_perms; + + /** + * @deprecated unused + */ + int (*start_frame)(AVFilterLink *link, AVFilterBufferRef *picref); + + /** + * Callback function to get a video buffer. If NULL, the filter system will + * use ff_default_get_video_buffer(). + * + * Input video pads only. + */ + AVFrame *(*get_video_buffer)(AVFilterLink *link, int w, int h); + + /** + * Callback function to get an audio buffer. If NULL, the filter system will + * use ff_default_get_audio_buffer(). + * + * Input audio pads only. + */ + AVFrame *(*get_audio_buffer)(AVFilterLink *link, int nb_samples); + + /** + * @deprecated unused + */ + int (*end_frame)(AVFilterLink *link); + + /** + * @deprecated unused + */ + int (*draw_slice)(AVFilterLink *link, int y, int height, int slice_dir); + + /** + * Filtering callback. This is where a filter receives a frame with + * audio/video data and should do its processing. + * + * Input pads only. + * + * @return >= 0 on success, a negative AVERROR on error. This function + * must ensure that frame is properly unreferenced on error if it + * hasn't been passed on to another filter. + */ + int (*filter_frame)(AVFilterLink *link, AVFrame *frame); + + /** + * Frame poll callback. This returns the number of immediately available + * samples. It should return a positive value if the next request_frame() + * is guaranteed to return one frame (with no delay). + * + * Defaults to just calling the source poll_frame() method. + * + * Output pads only. + */ + int (*poll_frame)(AVFilterLink *link); + + /** + * Frame request callback. A call to this should result in at least one + * frame being output over the given link. This should return zero on + * success, and another value on error. + * See ff_request_frame() for the error codes with a specific + * meaning. + * + * Output pads only. + */ + int (*request_frame)(AVFilterLink *link); + + /** + * Link configuration callback. + * + * For output pads, this should set the following link properties: + * video: width, height, sample_aspect_ratio, time_base + * audio: sample_rate. + * + * This should NOT set properties such as format, channel_layout, etc which + * are negotiated between filters by the filter system using the + * query_formats() callback before this function is called. + * + * For input pads, this should check the properties of the link, and update + * the filter's internal state as necessary. + * + * For both input and output pads, this should return zero on success, + * and another value on error. + */ + int (*config_props)(AVFilterLink *link); + + /** + * The filter expects a fifo to be inserted on its input link, + * typically because it has a delay. + * + * input pads only. + */ + int needs_fifo; + + /** + * The filter expects writable frames from its input link, + * duplicating data buffers if needed. + * + * input pads only. + */ + int needs_writable; +}; +#endif + +/** + * Get the number of elements in a NULL-terminated array of AVFilterPads (e.g. + * AVFilter.inputs/outputs). + */ +int avfilter_pad_count(const AVFilterPad *pads); + +/** + * Get the name of an AVFilterPad. + * + * @param pads an array of AVFilterPads + * @param pad_idx index of the pad in the array it; is the caller's + * responsibility to ensure the index is valid + * + * @return name of the pad_idx'th pad in pads + */ +const char *avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx); + +/** + * Get the type of an AVFilterPad. + * + * @param pads an array of AVFilterPads + * @param pad_idx index of the pad in the array; it is the caller's + * responsibility to ensure the index is valid + * + * @return type of the pad_idx'th pad in pads + */ +enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx); + +/** + * The number of the filter inputs is not determined just by AVFilter.inputs. + * The filter might add additional inputs during initialization depending on the + * options supplied to it. + */ +#define AVFILTER_FLAG_DYNAMIC_INPUTS (1 << 0) +/** + * The number of the filter outputs is not determined just by AVFilter.outputs. + * The filter might add additional outputs during initialization depending on + * the options supplied to it. + */ +#define AVFILTER_FLAG_DYNAMIC_OUTPUTS (1 << 1) +/** + * The filter supports multithreading by splitting frames into multiple parts + * and processing them concurrently. + */ +#define AVFILTER_FLAG_SLICE_THREADS (1 << 2) +/** + * Some filters support a generic "enable" expression option that can be used + * to enable or disable a filter in the timeline. Filters supporting this + * option have this flag set. When the enable expression is false, the default + * no-op filter_frame() function is called in place of the filter_frame() + * callback defined on each input pad, thus the frame is passed unchanged to + * the next filters. + */ +#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC (1 << 16) +/** + * Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will + * have its filter_frame() callback(s) called as usual even when the enable + * expression is false. The filter will disable filtering within the + * filter_frame() callback(s) itself, for example executing code depending on + * the AVFilterContext->is_disabled value. + */ +#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL (1 << 17) +/** + * Handy mask to test whether the filter supports or no the timeline feature + * (internally or generically). + */ +#define AVFILTER_FLAG_SUPPORT_TIMELINE (AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL) + +/** + * Filter definition. This defines the pads a filter contains, and all the + * callback functions used to interact with the filter. + */ +typedef struct AVFilter { + /** + * Filter name. Must be non-NULL and unique among filters. + */ + const char *name; + + /** + * A description of the filter. May be NULL. + * + * You should use the NULL_IF_CONFIG_SMALL() macro to define it. + */ + const char *description; + + /** + * List of inputs, terminated by a zeroed element. + * + * NULL if there are no (static) inputs. Instances of filters with + * AVFILTER_FLAG_DYNAMIC_INPUTS set may have more inputs than present in + * this list. + */ + const AVFilterPad *inputs; + /** + * List of outputs, terminated by a zeroed element. + * + * NULL if there are no (static) outputs. Instances of filters with + * AVFILTER_FLAG_DYNAMIC_OUTPUTS set may have more outputs than present in + * this list. + */ + const AVFilterPad *outputs; + + /** + * A class for the private data, used to declare filter private AVOptions. + * This field is NULL for filters that do not declare any options. + * + * If this field is non-NULL, the first member of the filter private data + * must be a pointer to AVClass, which will be set by libavfilter generic + * code to this class. + */ + const AVClass *priv_class; + + /** + * A combination of AVFILTER_FLAG_* + */ + int flags; + + /***************************************************************** + * All fields below this line are not part of the public API. They + * may not be used outside of libavfilter and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + + /** + * Filter initialization function. + * + * This callback will be called only once during the filter lifetime, after + * all the options have been set, but before links between filters are + * established and format negotiation is done. + * + * Basic filter initialization should be done here. Filters with dynamic + * inputs and/or outputs should create those inputs/outputs here based on + * provided options. No more changes to this filter's inputs/outputs can be + * done after this callback. + * + * This callback must not assume that the filter links exist or frame + * parameters are known. + * + * @ref AVFilter.uninit "uninit" is guaranteed to be called even if + * initialization fails, so this callback does not have to clean up on + * failure. + * + * @return 0 on success, a negative AVERROR on failure + */ + int (*init)(AVFilterContext *ctx); + + /** + * Should be set instead of @ref AVFilter.init "init" by the filters that + * want to pass a dictionary of AVOptions to nested contexts that are + * allocated during init. + * + * On return, the options dict should be freed and replaced with one that + * contains all the options which could not be processed by this filter (or + * with NULL if all the options were processed). + * + * Otherwise the semantics is the same as for @ref AVFilter.init "init". + */ + int (*init_dict)(AVFilterContext *ctx, AVDictionary **options); + + /** + * Filter uninitialization function. + * + * Called only once right before the filter is freed. Should deallocate any + * memory held by the filter, release any buffer references, etc. It does + * not need to deallocate the AVFilterContext.priv memory itself. + * + * This callback may be called even if @ref AVFilter.init "init" was not + * called or failed, so it must be prepared to handle such a situation. + */ + void (*uninit)(AVFilterContext *ctx); + + /** + * Query formats supported by the filter on its inputs and outputs. + * + * This callback is called after the filter is initialized (so the inputs + * and outputs are fixed), shortly before the format negotiation. This + * callback may be called more than once. + * + * This callback must set AVFilterLink.out_formats on every input link and + * AVFilterLink.in_formats on every output link to a list of pixel/sample + * formats that the filter supports on that link. For audio links, this + * filter must also set @ref AVFilterLink.in_samplerates "in_samplerates" / + * @ref AVFilterLink.out_samplerates "out_samplerates" and + * @ref AVFilterLink.in_channel_layouts "in_channel_layouts" / + * @ref AVFilterLink.out_channel_layouts "out_channel_layouts" analogously. + * + * This callback may be NULL for filters with one input, in which case + * libavfilter assumes that it supports all input formats and preserves + * them on output. + * + * @return zero on success, a negative value corresponding to an + * AVERROR code otherwise + */ + int (*query_formats)(AVFilterContext *); + + int priv_size; ///< size of private data to allocate for the filter + + /** + * Used by the filter registration system. Must not be touched by any other + * code. + */ + struct AVFilter *next; + + /** + * Make the filter instance process a command. + * + * @param cmd the command to process, for handling simplicity all commands must be alphanumeric only + * @param arg the argument for the command + * @param res a buffer with size res_size where the filter(s) can return a response. This must not change when the command is not supported. + * @param flags if AVFILTER_CMD_FLAG_FAST is set and the command would be + * time consuming then a filter should treat it like an unsupported command + * + * @returns >=0 on success otherwise an error code. + * AVERROR(ENOSYS) on unsupported commands + */ + int + (*process_command)(AVFilterContext *, const char *cmd, const char *arg, char *res, int res_len, + int flags); + + /** + * Filter initialization function, alternative to the init() + * callback. Args contains the user-supplied parameters, opaque is + * used for providing binary data. + */ + int (*init_opaque)(AVFilterContext *ctx, void *opaque); +} AVFilter; + +/** + * Process multiple parts of the frame concurrently. + */ +#define AVFILTER_THREAD_SLICE (1 << 0) + +typedef struct AVFilterInternal AVFilterInternal; + +/** An instance of a filter */ +struct AVFilterContext { + const AVClass *av_class; ///< needed for av_log() and filters common options + + const AVFilter *filter; ///< the AVFilter of which this is an instance + + char *name; ///< name of this filter instance + + AVFilterPad *input_pads; ///< array of input pads + AVFilterLink **inputs; ///< array of pointers to input links +#if FF_API_FOO_COUNT + attribute_deprecated unsigned input_count; ///< @deprecated use nb_inputs +#endif + unsigned nb_inputs; ///< number of input pads + + AVFilterPad *output_pads; ///< array of output pads + AVFilterLink **outputs; ///< array of pointers to output links +#if FF_API_FOO_COUNT + attribute_deprecated unsigned output_count; ///< @deprecated use nb_outputs +#endif + unsigned nb_outputs; ///< number of output pads + + void *priv; ///< private data for use by the filter + + struct AVFilterGraph *graph; ///< filtergraph this filter belongs to + + /** + * Type of multithreading being allowed/used. A combination of + * AVFILTER_THREAD_* flags. + * + * May be set by the caller before initializing the filter to forbid some + * or all kinds of multithreading for this filter. The default is allowing + * everything. + * + * When the filter is initialized, this field is combined using bit AND with + * AVFilterGraph.thread_type to get the final mask used for determining + * allowed threading types. I.e. a threading type needs to be set in both + * to be allowed. + * + * After the filter is initialized, libavfilter sets this field to the + * threading type that is actually used (0 for no multithreading). + */ + int thread_type; + + /** + * An opaque struct for libavfilter internal use. + */ + AVFilterInternal *internal; + + struct AVFilterCommand *command_queue; + + char *enable_str; ///< enable expression string + void *enable; ///< parsed expression (AVExpr*) + double *var_values; ///< variable values for the enable expression + int is_disabled; ///< the enabled state from the last expression evaluation +}; + +/** + * A link between two filters. This contains pointers to the source and + * destination filters between which this link exists, and the indexes of + * the pads involved. In addition, this link also contains the parameters + * which have been negotiated and agreed upon between the filter, such as + * image dimensions, format, etc. + */ +struct AVFilterLink { + AVFilterContext *src; ///< source filter + AVFilterPad *srcpad; ///< output pad on the source filter + + AVFilterContext *dst; ///< dest filter + AVFilterPad *dstpad; ///< input pad on the dest filter + + enum AVMediaType type; ///< filter media type + + /* These parameters apply only to video */ + int w; ///< agreed upon image width + int h; ///< agreed upon image height + AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio + /* These parameters apply only to audio */ + uint64_t channel_layout; ///< channel layout of current buffer (see libavutil/channel_layout.h) + int sample_rate; ///< samples per second + + int format; ///< agreed upon media format + + /** + * Define the time base used by the PTS of the frames/samples + * which will pass through this link. + * During the configuration stage, each filter is supposed to + * change only the output timebase, while the timebase of the + * input link is assumed to be an unchangeable property. + */ + AVRational time_base; + + /***************************************************************** + * All fields below this line are not part of the public API. They + * may not be used outside of libavfilter and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + /** + * Lists of formats and channel layouts supported by the input and output + * filters respectively. These lists are used for negotiating the format + * to actually be used, which will be loaded into the format and + * channel_layout members, above, when chosen. + * + */ + AVFilterFormats *in_formats; + AVFilterFormats *out_formats; + + /** + * Lists of channel layouts and sample rates used for automatic + * negotiation. + */ + AVFilterFormats *in_samplerates; + AVFilterFormats *out_samplerates; + struct AVFilterChannelLayouts *in_channel_layouts; + struct AVFilterChannelLayouts *out_channel_layouts; + + /** + * Audio only, the destination filter sets this to a non-zero value to + * request that buffers with the given number of samples should be sent to + * it. AVFilterPad.needs_fifo must also be set on the corresponding input + * pad. + * Last buffer before EOF will be padded with silence. + */ + int request_samples; + + /** stage of the initialization of the link properties (dimensions, etc) */ + enum { + AVLINK_UNINIT = 0, ///< not started + AVLINK_STARTINIT, ///< started, but incomplete + AVLINK_INIT ///< complete + } init_state; + + struct AVFilterPool *pool; + + /** + * Graph the filter belongs to. + */ + struct AVFilterGraph *graph; + + /** + * Current timestamp of the link, as defined by the most recent + * frame(s), in AV_TIME_BASE units. + */ + int64_t current_pts; + + /** + * Index in the age array. + */ + int age_index; + + /** + * Frame rate of the stream on the link, or 1/0 if unknown; + * if left to 0/0, will be automatically be copied from the first input + * of the source filter if it exists. + * + * Sources should set it to the best estimation of the real frame rate. + * Filters should update it if necessary depending on their function. + * Sinks can use it to set a default output frame rate. + * It is similar to the r_frame_rate field in AVStream. + */ + AVRational frame_rate; + + /** + * Buffer partially filled with samples to achieve a fixed/minimum size. + */ + AVFrame *partial_buf; + + /** + * Size of the partial buffer to allocate. + * Must be between min_samples and max_samples. + */ + int partial_buf_size; + + /** + * Minimum number of samples to filter at once. If filter_frame() is + * called with fewer samples, it will accumulate them in partial_buf. + * This field and the related ones must not be changed after filtering + * has started. + * If 0, all related fields are ignored. + */ + int min_samples; + + /** + * Maximum number of samples to filter at once. If filter_frame() is + * called with more samples, it will split them. + */ + int max_samples; + + /** + * The buffer reference currently being received across the link by the + * destination filter. This is used internally by the filter system to + * allow automatic copying of buffers which do not have sufficient + * permissions for the destination. This should not be accessed directly + * by the filters. + */ + AVFilterBufferRef *cur_buf_copy; + + /** + * True if the link is closed. + * If set, all attempts of start_frame, filter_frame or request_frame + * will fail with AVERROR_EOF, and if necessary the reference will be + * destroyed. + * If request_frame returns AVERROR_EOF, this flag is set on the + * corresponding link. + * It can be set also be set by either the source or the destination + * filter. + */ + int closed; + + /** + * Number of channels. + */ + int channels; + + /** + * True if a frame is being requested on the link. + * Used internally by the framework. + */ + unsigned frame_requested; + + /** + * Link processing flags. + */ + unsigned flags; + + /** + * Number of past frames sent through the link. + */ + int64_t frame_count; +}; + +/** + * Link two filters together. + * + * @param src the source filter + * @param srcpad index of the output pad on the source filter + * @param dst the destination filter + * @param dstpad index of the input pad on the destination filter + * @return zero on success + */ +int avfilter_link(AVFilterContext *src, unsigned srcpad, + AVFilterContext *dst, unsigned dstpad); + +/** + * Free the link in *link, and set its pointer to NULL. + */ +void avfilter_link_free(AVFilterLink **link); + +/** + * Get the number of channels of a link. + */ +int avfilter_link_get_channels(AVFilterLink *link); + +/** + * Set the closed field of a link. + */ +void avfilter_link_set_closed(AVFilterLink *link, int closed); + +/** + * Negotiate the media format, dimensions, etc of all inputs to a filter. + * + * @param filter the filter to negotiate the properties for its inputs + * @return zero on successful negotiation + */ +int avfilter_config_links(AVFilterContext *filter); + +#if FF_API_AVFILTERBUFFER +/** + * Create a buffer reference wrapped around an already allocated image + * buffer. + * + * @param data pointers to the planes of the image to reference + * @param linesize linesizes for the planes of the image to reference + * @param perms the required access permissions + * @param w the width of the image specified by the data and linesize arrays + * @param h the height of the image specified by the data and linesize arrays + * @param format the pixel format of the image specified by the data and linesize arrays + */ +attribute_deprecated +AVFilterBufferRef * +avfilter_get_video_buffer_ref_from_arrays(uint8_t * const data[4], const int linesize[4], int perms, + int w, int h, enum AVPixelFormat format); + +/** + * Create an audio buffer reference wrapped around an already + * allocated samples buffer. + * + * See avfilter_get_audio_buffer_ref_from_arrays_channels() for a version + * that can handle unknown channel layouts. + * + * @param data pointers to the samples plane buffers + * @param linesize linesize for the samples plane buffers + * @param perms the required access permissions + * @param nb_samples number of samples per channel + * @param sample_fmt the format of each sample in the buffer to allocate + * @param channel_layout the channel layout of the buffer + */ +attribute_deprecated +AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_arrays(uint8_t **data, + int linesize, + int perms, + int nb_samples, + enum AVSampleFormat sample_fmt, + uint64_t channel_layout); +/** + * Create an audio buffer reference wrapped around an already + * allocated samples buffer. + * + * @param data pointers to the samples plane buffers + * @param linesize linesize for the samples plane buffers + * @param perms the required access permissions + * @param nb_samples number of samples per channel + * @param sample_fmt the format of each sample in the buffer to allocate + * @param channels the number of channels of the buffer + * @param channel_layout the channel layout of the buffer, + * must be either 0 or consistent with channels + */ +attribute_deprecated +AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_arrays_channels(uint8_t **data, + int linesize, + int perms, + int nb_samples, + enum AVSampleFormat sample_fmt, + int channels, + uint64_t channel_layout); + +#endif + + +#define AVFILTER_CMD_FLAG_ONE 1 ///< Stop once a filter understood the command (for target=all for example), fast filters are favored automatically +#define AVFILTER_CMD_FLAG_FAST 2 ///< Only execute command when its fast (like a video out that supports contrast adjustment in hw) + +/** + * Make the filter instance process a command. + * It is recommended to use avfilter_graph_send_command(). + */ +int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, + int res_len, int flags); + +/** Initialize the filter system. Register all builtin filters. */ +void avfilter_register_all(void); + +#if FF_API_OLD_FILTER_REGISTER +/** Uninitialize the filter system. Unregister all filters. */ +attribute_deprecated +void avfilter_uninit(void); +#endif + +/** + * Register a filter. This is only needed if you plan to use + * avfilter_get_by_name later to lookup the AVFilter structure by name. A + * filter can still by instantiated with avfilter_graph_alloc_filter even if it + * is not registered. + * + * @param filter the filter to register + * @return 0 if the registration was successful, a negative value + * otherwise + */ +int avfilter_register(AVFilter *filter); + +/** + * Get a filter definition matching the given name. + * + * @param name the filter name to find + * @return the filter definition, if any matching one is registered. + * NULL if none found. + */ +#if !FF_API_NOCONST_GET_NAME + +const +#endif +AVFilter *avfilter_get_by_name(const char *name); + +/** + * Iterate over all registered filters. + * @return If prev is non-NULL, next registered filter after prev or NULL if + * prev is the last filter. If prev is NULL, return the first registered filter. + */ +const AVFilter *avfilter_next(const AVFilter *prev); + +#if FF_API_OLD_FILTER_REGISTER +/** + * If filter is NULL, returns a pointer to the first registered filter pointer, + * if filter is non-NULL, returns the next pointer after filter. + * If the returned pointer points to NULL, the last registered filter + * was already reached. + * @deprecated use avfilter_next() + */ +attribute_deprecated +AVFilter **av_filter_next(AVFilter **filter); +#endif + +#if FF_API_AVFILTER_OPEN +/** + * Create a filter instance. + * + * @param filter_ctx put here a pointer to the created filter context + * on success, NULL on failure + * @param filter the filter to create an instance of + * @param inst_name Name to give to the new instance. Can be NULL for none. + * @return >= 0 in case of success, a negative error code otherwise + * @deprecated use avfilter_graph_alloc_filter() instead + */ +attribute_deprecated +int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name); +#endif + + +#if FF_API_AVFILTER_INIT_FILTER +/** + * Initialize a filter. + * + * @param filter the filter to initialize + * @param args A string of parameters to use when initializing the filter. + * The format and meaning of this string varies by filter. + * @param opaque Any extra non-string data needed by the filter. The meaning + * of this parameter varies by filter. + * @return zero on success + */ +attribute_deprecated +int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque); +#endif + +/** + * Initialize a filter with the supplied parameters. + * + * @param ctx uninitialized filter context to initialize + * @param args Options to initialize the filter with. This must be a + * ':'-separated list of options in the 'key=value' form. + * May be NULL if the options have been set directly using the + * AVOptions API or there are no options that need to be set. + * @return 0 on success, a negative AVERROR on failure + */ +int avfilter_init_str(AVFilterContext *ctx, const char *args); + +/** + * Initialize a filter with the supplied dictionary of options. + * + * @param ctx uninitialized filter context to initialize + * @param options An AVDictionary filled with options for this filter. On + * return this parameter will be destroyed and replaced with + * a dict containing options that were not found. This dictionary + * must be freed by the caller. + * May be NULL, then this function is equivalent to + * avfilter_init_str() with the second parameter set to NULL. + * @return 0 on success, a negative AVERROR on failure + * + * @note This function and avfilter_init_str() do essentially the same thing, + * the difference is in manner in which the options are passed. It is up to the + * calling code to choose whichever is more preferable. The two functions also + * behave differently when some of the provided options are not declared as + * supported by the filter. In such a case, avfilter_init_str() will fail, but + * this function will leave those extra options in the options AVDictionary and + * continue as usual. + */ +int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options); + +/** + * Free a filter context. This will also remove the filter from its + * filtergraph's list of filters. + * + * @param filter the filter to free + */ +void avfilter_free(AVFilterContext *filter); + +/** + * Insert a filter in the middle of an existing link. + * + * @param link the link into which the filter should be inserted + * @param filt the filter to be inserted + * @param filt_srcpad_idx the input pad on the filter to connect + * @param filt_dstpad_idx the output pad on the filter to connect + * @return zero on success + */ +int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, + unsigned filt_srcpad_idx, unsigned filt_dstpad_idx); + +#if FF_API_AVFILTERBUFFER +/** + * Copy the frame properties of src to dst, without copying the actual + * image data. + * + * @return 0 on success, a negative number on error. + */ +attribute_deprecated +int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src); + +/** + * Copy the frame properties and data pointers of src to dst, without copying + * the actual data. + * + * @return 0 on success, a negative number on error. + */ +attribute_deprecated +int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src); +#endif + +/** + * @return AVClass for AVFilterContext. + * + * @see av_opt_find(). + */ +const AVClass *avfilter_get_class(void); + +typedef struct AVFilterGraphInternal AVFilterGraphInternal; + +/** + * A function pointer passed to the @ref AVFilterGraph.execute callback to be + * executed multiple times, possibly in parallel. + * + * @param ctx the filter context the job belongs to + * @param arg an opaque parameter passed through from @ref + * AVFilterGraph.execute + * @param jobnr the index of the job being executed + * @param nb_jobs the total number of jobs + * + * @return 0 on success, a negative AVERROR on error + */ +typedef int (avfilter_action_func)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); + +/** + * A function executing multiple jobs, possibly in parallel. + * + * @param ctx the filter context to which the jobs belong + * @param func the function to be called multiple times + * @param arg the argument to be passed to func + * @param ret a nb_jobs-sized array to be filled with return values from each + * invocation of func + * @param nb_jobs the number of jobs to execute + * + * @return 0 on success, a negative AVERROR on error + */ +typedef int (avfilter_execute_func)(AVFilterContext *ctx, avfilter_action_func *func, + void *arg, int *ret, int nb_jobs); + +typedef struct AVFilterGraph { + const AVClass *av_class; +#if FF_API_FOO_COUNT + attribute_deprecated + unsigned filter_count_unused; +#endif + AVFilterContext **filters; +#if !FF_API_FOO_COUNT + unsigned nb_filters; +#endif + + char *scale_sws_opts; ///< sws options to use for the auto-inserted scale filters + char *resample_lavr_opts; ///< libavresample options to use for the auto-inserted resample filters +#if FF_API_FOO_COUNT + unsigned nb_filters; +#endif + + /** + * Type of multithreading allowed for filters in this graph. A combination + * of AVFILTER_THREAD_* flags. + * + * May be set by the caller at any point, the setting will apply to all + * filters initialized after that. The default is allowing everything. + * + * When a filter in this graph is initialized, this field is combined using + * bit AND with AVFilterContext.thread_type to get the final mask used for + * determining allowed threading types. I.e. a threading type needs to be + * set in both to be allowed. + */ + int thread_type; + + /** + * Maximum number of threads used by filters in this graph. May be set by + * the caller before adding any filters to the filtergraph. Zero (the + * default) means that the number of threads is determined automatically. + */ + int nb_threads; + + /** + * Opaque object for libavfilter internal use. + */ + AVFilterGraphInternal *internal; + + /** + * Opaque user data. May be set by the caller to an arbitrary value, e.g. to + * be used from callbacks like @ref AVFilterGraph.execute. + * Libavfilter will not touch this field in any way. + */ + void *opaque; + + /** + * This callback may be set by the caller immediately after allocating the + * graph and before adding any filters to it, to provide a custom + * multithreading implementation. + * + * If set, filters with slice threading capability will call this callback + * to execute multiple jobs in parallel. + * + * If this field is left unset, libavfilter will use its internal + * implementation, which may or may not be multithreaded depending on the + * platform and build options. + */ + avfilter_execute_func *execute; + + char *aresample_swr_opts; ///< swr options to use for the auto-inserted aresample filters, Access ONLY through AVOptions + + /** + * Private fields + * + * The following fields are for internal use only. + * Their type, offset, number and semantic can change without notice. + */ + + AVFilterLink **sink_links; + int sink_links_count; + + unsigned disable_auto_convert; +} AVFilterGraph; + +/** + * Allocate a filter graph. + */ +AVFilterGraph *avfilter_graph_alloc(void); + +/** + * Create a new filter instance in a filter graph. + * + * @param graph graph in which the new filter will be used + * @param filter the filter to create an instance of + * @param name Name to give to the new instance (will be copied to + * AVFilterContext.name). This may be used by the caller to identify + * different filters, libavfilter itself assigns no semantics to + * this parameter. May be NULL. + * + * @return the context of the newly created filter instance (note that it is + * also retrievable directly through AVFilterGraph.filters or with + * avfilter_graph_get_filter()) on success or NULL on failure. + */ +AVFilterContext *avfilter_graph_alloc_filter(AVFilterGraph *graph, + const AVFilter *filter, + const char *name); + +/** + * Get a filter instance identified by instance name from graph. + * + * @param graph filter graph to search through. + * @param name filter instance name (should be unique in the graph). + * @return the pointer to the found filter instance or NULL if it + * cannot be found. + */ +AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, const char *name); + +#if FF_API_AVFILTER_OPEN +/** + * Add an existing filter instance to a filter graph. + * + * @param graphctx the filter graph + * @param filter the filter to be added + * + * @deprecated use avfilter_graph_alloc_filter() to allocate a filter in a + * filter graph + */ +attribute_deprecated +int avfilter_graph_add_filter(AVFilterGraph *graphctx, AVFilterContext *filter); +#endif + +/** + * Create and add a filter instance into an existing graph. + * The filter instance is created from the filter filt and inited + * with the parameters args and opaque. + * + * In case of success put in *filt_ctx the pointer to the created + * filter instance, otherwise set *filt_ctx to NULL. + * + * @param name the instance name to give to the created filter instance + * @param graph_ctx the filter graph + * @return a negative AVERROR error code in case of failure, a non + * negative value otherwise + */ +int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter *filt, + const char *name, const char *args, void *opaque, + AVFilterGraph *graph_ctx); + +/** + * Enable or disable automatic format conversion inside the graph. + * + * Note that format conversion can still happen inside explicitly inserted + * scale and aresample filters. + * + * @param flags any of the AVFILTER_AUTO_CONVERT_* constants + */ +void avfilter_graph_set_auto_convert(AVFilterGraph *graph, unsigned flags); + +enum { + AVFILTER_AUTO_CONVERT_ALL = 0, /**< all automatic conversions enabled */ + AVFILTER_AUTO_CONVERT_NONE = -1, /**< all automatic conversions disabled */ +}; + +/** + * Check validity and configure all the links and formats in the graph. + * + * @param graphctx the filter graph + * @param log_ctx context used for logging + * @return >= 0 in case of success, a negative AVERROR code otherwise + */ +int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx); + +/** + * Free a graph, destroy its links, and set *graph to NULL. + * If *graph is NULL, do nothing. + */ +void avfilter_graph_free(AVFilterGraph **graph); + +/** + * A linked-list of the inputs/outputs of the filter chain. + * + * This is mainly useful for avfilter_graph_parse() / avfilter_graph_parse2(), + * where it is used to communicate open (unlinked) inputs and outputs from and + * to the caller. + * This struct specifies, per each not connected pad contained in the graph, the + * filter context and the pad index required for establishing a link. + */ +typedef struct AVFilterInOut { + /** unique name for this input/output in the list */ + char *name; + + /** filter context associated to this input/output */ + AVFilterContext *filter_ctx; + + /** index of the filt_ctx pad to use for linking */ + int pad_idx; + + /** next input/input in the list, NULL if this is the last */ + struct AVFilterInOut *next; +} AVFilterInOut; + +/** + * Allocate a single AVFilterInOut entry. + * Must be freed with avfilter_inout_free(). + * @return allocated AVFilterInOut on success, NULL on failure. + */ +AVFilterInOut *avfilter_inout_alloc(void); + +/** + * Free the supplied list of AVFilterInOut and set *inout to NULL. + * If *inout is NULL, do nothing. + */ +void avfilter_inout_free(AVFilterInOut **inout); + +#if AV_HAVE_INCOMPATIBLE_LIBAV_ABI || !FF_API_OLD_GRAPH_PARSE + +/** + * Add a graph described by a string to a graph. + * + * @note The caller must provide the lists of inputs and outputs, + * which therefore must be known before calling the function. + * + * @note The inputs parameter describes inputs of the already existing + * part of the graph; i.e. from the point of view of the newly created + * part, they are outputs. Similarly the outputs parameter describes + * outputs of the already existing filters, which are provided as + * inputs to the parsed filters. + * + * @param graph the filter graph where to link the parsed graph context + * @param filters string to be parsed + * @param inputs linked list to the inputs of the graph + * @param outputs linked list to the outputs of the graph + * @return zero on success, a negative AVERROR code on error + */ +int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, + AVFilterInOut *inputs, AVFilterInOut *outputs, + void *log_ctx); + +#else +/** + * Add a graph described by a string to a graph. + * + * @param graph the filter graph where to link the parsed graph context + * @param filters string to be parsed + * @param inputs pointer to a linked list to the inputs of the graph, may be NULL. + * If non-NULL, *inputs is updated to contain the list of open inputs + * after the parsing, should be freed with avfilter_inout_free(). + * @param outputs pointer to a linked list to the outputs of the graph, may be NULL. + * If non-NULL, *outputs is updated to contain the list of open outputs + * after the parsing, should be freed with avfilter_inout_free(). + * @return non negative on success, a negative AVERROR code on error + * @deprecated Use avfilter_graph_parse_ptr() instead. + */ +attribute_deprecated +int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, + AVFilterInOut **inputs, AVFilterInOut **outputs, + void *log_ctx); +#endif + +/** + * Add a graph described by a string to a graph. + * + * @param graph the filter graph where to link the parsed graph context + * @param filters string to be parsed + * @param inputs pointer to a linked list to the inputs of the graph, may be NULL. + * If non-NULL, *inputs is updated to contain the list of open inputs + * after the parsing, should be freed with avfilter_inout_free(). + * @param outputs pointer to a linked list to the outputs of the graph, may be NULL. + * If non-NULL, *outputs is updated to contain the list of open outputs + * after the parsing, should be freed with avfilter_inout_free(). + * @return non negative on success, a negative AVERROR code on error + */ +int avfilter_graph_parse_ptr(AVFilterGraph *graph, const char *filters, + AVFilterInOut **inputs, AVFilterInOut **outputs, + void *log_ctx); + +/** + * Add a graph described by a string to a graph. + * + * @param[in] graph the filter graph where to link the parsed graph context + * @param[in] filters string to be parsed + * @param[out] inputs a linked list of all free (unlinked) inputs of the + * parsed graph will be returned here. It is to be freed + * by the caller using avfilter_inout_free(). + * @param[out] outputs a linked list of all free (unlinked) outputs of the + * parsed graph will be returned here. It is to be freed by the + * caller using avfilter_inout_free(). + * @return zero on success, a negative AVERROR code on error + * + * @note This function returns the inputs and outputs that are left + * unlinked after parsing the graph and the caller then deals with + * them. + * @note This function makes no reference whatsoever to already + * existing parts of the graph and the inputs parameter will on return + * contain inputs of the newly parsed part of the graph. Analogously + * the outputs parameter will contain outputs of the newly created + * filters. + */ +int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, + AVFilterInOut **inputs, + AVFilterInOut **outputs); + +/** + * Send a command to one or more filter instances. + * + * @param graph the filter graph + * @param target the filter(s) to which the command should be sent + * "all" sends to all filters + * otherwise it can be a filter or filter instance name + * which will send the command to all matching filters. + * @param cmd the command to send, for handling simplicity all commands must be alphanumeric only + * @param arg the argument for the command + * @param res a buffer with size res_size where the filter(s) can return a response. + * + * @returns >=0 on success otherwise an error code. + * AVERROR(ENOSYS) on unsupported commands + */ +int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const char *cmd, + const char *arg, char *res, int res_len, int flags); + +/** + * Queue a command for one or more filter instances. + * + * @param graph the filter graph + * @param target the filter(s) to which the command should be sent + * "all" sends to all filters + * otherwise it can be a filter or filter instance name + * which will send the command to all matching filters. + * @param cmd the command to sent, for handling simplicity all commands must be alphanumeric only + * @param arg the argument for the command + * @param ts time at which the command should be sent to the filter + * + * @note As this executes commands after this function returns, no return code + * from the filter is provided, also AVFILTER_CMD_FLAG_ONE is not supported. + */ +int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const char *cmd, + const char *arg, int flags, double ts); + + +/** + * Dump a graph into a human-readable string representation. + * + * @param graph the graph to dump + * @param options formatting options; currently ignored + * @return a string, or NULL in case of memory allocation failure; + * the string must be freed using av_free + */ +char *avfilter_graph_dump(AVFilterGraph *graph, const char *options); + +/** + * Request a frame on the oldest sink link. + * + * If the request returns AVERROR_EOF, try the next. + * + * Note that this function is not meant to be the sole scheduling mechanism + * of a filtergraph, only a convenience function to help drain a filtergraph + * in a balanced way under normal circumstances. + * + * Also note that AVERROR_EOF does not mean that frames did not arrive on + * some of the sinks during the process. + * When there are multiple sink links, in case the requested link + * returns an EOF, this may cause a filter to flush pending frames + * which are sent to another sink link, although unrequested. + * + * @return the return value of ff_request_frame(), + * or AVERROR_EOF if all links returned AVERROR_EOF + */ +int avfilter_graph_request_oldest(AVFilterGraph *graph); + +/** + * @} + */ + +#endif /* AVFILTER_AVFILTER_H */ diff --git a/app/src/main/cpp/include/libavfilter/avfiltergraph.h b/app/src/main/cpp/include/libavfilter/avfiltergraph.h new file mode 100644 index 0000000..b31d581 --- /dev/null +++ b/app/src/main/cpp/include/libavfilter/avfiltergraph.h @@ -0,0 +1,28 @@ +/* + * Filter graphs + * copyright (c) 2007 Bobby Bingham + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_AVFILTERGRAPH_H +#define AVFILTER_AVFILTERGRAPH_H + +#include "avfilter.h" +#include "libavutil/log.h" + +#endif /* AVFILTER_AVFILTERGRAPH_H */ diff --git a/app/src/main/cpp/include/libavfilter/buffersink.h b/app/src/main/cpp/include/libavfilter/buffersink.h new file mode 100644 index 0000000..24cd2fe --- /dev/null +++ b/app/src/main/cpp/include/libavfilter/buffersink.h @@ -0,0 +1,204 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_BUFFERSINK_H +#define AVFILTER_BUFFERSINK_H + +/** + * @file + * @ingroup lavfi_buffersink + * memory buffer sink API for audio and video + */ + +#include "avfilter.h" + +/** + * @defgroup lavfi_buffersink Buffer sink API + * @ingroup lavfi + * @{ + */ + +#if FF_API_AVFILTERBUFFER +/** + * Get an audio/video buffer data from buffer_sink and put it in bufref. + * + * This function works with both audio and video buffer sinks. + * + * @param buffer_sink pointer to a buffersink or abuffersink context + * @param flags a combination of AV_BUFFERSINK_FLAG_* flags + * @return >= 0 in case of success, a negative AVERROR code in case of + * failure + */ +attribute_deprecated +int av_buffersink_get_buffer_ref(AVFilterContext *buffer_sink, + AVFilterBufferRef **bufref, int flags); + +/** + * Get the number of immediately available frames. + */ +attribute_deprecated +int av_buffersink_poll_frame(AVFilterContext *ctx); + +/** + * Get a buffer with filtered data from sink and put it in buf. + * + * @param ctx pointer to a context of a buffersink or abuffersink AVFilter. + * @param buf pointer to the buffer will be written here if buf is non-NULL. buf + * must be freed by the caller using avfilter_unref_buffer(). + * Buf may also be NULL to query whether a buffer is ready to be + * output. + * + * @return >= 0 in case of success, a negative AVERROR code in case of + * failure. + */ +attribute_deprecated +int av_buffersink_read(AVFilterContext *ctx, AVFilterBufferRef **buf); + +/** + * Same as av_buffersink_read, but with the ability to specify the number of + * samples read. This function is less efficient than av_buffersink_read(), + * because it copies the data around. + * + * @param ctx pointer to a context of the abuffersink AVFilter. + * @param buf pointer to the buffer will be written here if buf is non-NULL. buf + * must be freed by the caller using avfilter_unref_buffer(). buf + * will contain exactly nb_samples audio samples, except at the end + * of stream, when it can contain less than nb_samples. + * Buf may also be NULL to query whether a buffer is ready to be + * output. + * + * @warning do not mix this function with av_buffersink_read(). Use only one or + * the other with a single sink, not both. + */ +attribute_deprecated +int av_buffersink_read_samples(AVFilterContext *ctx, AVFilterBufferRef **buf, + int nb_samples); +#endif + +/** + * Get a frame with filtered data from sink and put it in frame. + * + * @param ctx pointer to a buffersink or abuffersink filter context. + * @param frame pointer to an allocated frame that will be filled with data. + * The data must be freed using av_frame_unref() / av_frame_free() + * @param flags a combination of AV_BUFFERSINK_FLAG_* flags + * + * @return >= 0 in for success, a negative AVERROR code for failure. + */ +int av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flags); + +/** + * Tell av_buffersink_get_buffer_ref() to read video/samples buffer + * reference, but not remove it from the buffer. This is useful if you + * need only to read a video/samples buffer, without to fetch it. + */ +#define AV_BUFFERSINK_FLAG_PEEK 1 + +/** + * Tell av_buffersink_get_buffer_ref() not to request a frame from its input. + * If a frame is already buffered, it is read (and removed from the buffer), + * but if no frame is present, return AVERROR(EAGAIN). + */ +#define AV_BUFFERSINK_FLAG_NO_REQUEST 2 + +/** + * Struct to use for initializing a buffersink context. + */ +typedef struct { + const enum AVPixelFormat *pixel_fmts; ///< list of allowed pixel formats, terminated by AV_PIX_FMT_NONE +} AVBufferSinkParams; + +/** + * Create an AVBufferSinkParams structure. + * + * Must be freed with av_free(). + */ +AVBufferSinkParams *av_buffersink_params_alloc(void); + +/** + * Struct to use for initializing an abuffersink context. + */ +typedef struct { + const enum AVSampleFormat *sample_fmts; ///< list of allowed sample formats, terminated by AV_SAMPLE_FMT_NONE + const int64_t *channel_layouts; ///< list of allowed channel layouts, terminated by -1 + const int *channel_counts; ///< list of allowed channel counts, terminated by -1 + int all_channel_counts; ///< if not 0, accept any channel count or layout + int *sample_rates; ///< list of allowed sample rates, terminated by -1 +} AVABufferSinkParams; + +/** + * Create an AVABufferSinkParams structure. + * + * Must be freed with av_free(). + */ +AVABufferSinkParams *av_abuffersink_params_alloc(void); + +/** + * Set the frame size for an audio buffer sink. + * + * All calls to av_buffersink_get_buffer_ref will return a buffer with + * exactly the specified number of samples, or AVERROR(EAGAIN) if there is + * not enough. The last buffer at EOF will be padded with 0. + */ +void av_buffersink_set_frame_size(AVFilterContext *ctx, unsigned frame_size); + +/** + * Get the frame rate of the input. + */ +AVRational av_buffersink_get_frame_rate(AVFilterContext *ctx); + +/** + * Get a frame with filtered data from sink and put it in frame. + * + * @param ctx pointer to a context of a buffersink or abuffersink AVFilter. + * @param frame pointer to an allocated frame that will be filled with data. + * The data must be freed using av_frame_unref() / av_frame_free() + * + * @return + * - >= 0 if a frame was successfully returned. + * - AVERROR(EAGAIN) if no frames are available at this point; more + * input frames must be added to the filtergraph to get more output. + * - AVERROR_EOF if there will be no more output frames on this sink. + * - A different negative AVERROR code in other failure cases. + */ +int av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame); + +/** + * Same as av_buffersink_get_frame(), but with the ability to specify the number + * of samples read. This function is less efficient than + * av_buffersink_get_frame(), because it copies the data around. + * + * @param ctx pointer to a context of the abuffersink AVFilter. + * @param frame pointer to an allocated frame that will be filled with data. + * The data must be freed using av_frame_unref() / av_frame_free() + * frame will contain exactly nb_samples audio samples, except at + * the end of stream, when it can contain less than nb_samples. + * + * @return The return codes have the same meaning as for + * av_buffersink_get_samples(). + * + * @warning do not mix this function with av_buffersink_get_frame(). Use only one or + * the other with a single sink, not both. + */ +int av_buffersink_get_samples(AVFilterContext *ctx, AVFrame *frame, int nb_samples); + +/** + * @} + */ + +#endif /* AVFILTER_BUFFERSINK_H */ diff --git a/app/src/main/cpp/include/libavfilter/buffersrc.h b/app/src/main/cpp/include/libavfilter/buffersrc.h new file mode 100644 index 0000000..eb1375b --- /dev/null +++ b/app/src/main/cpp/include/libavfilter/buffersrc.h @@ -0,0 +1,160 @@ +/* + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_BUFFERSRC_H +#define AVFILTER_BUFFERSRC_H + +/** + * @file + * @ingroup lavfi_buffersrc + * Memory buffer source API. + */ + +#include "libavcodec/avcodec.h" +#include "avfilter.h" + +/** + * @defgroup lavfi_buffersrc Buffer source API + * @ingroup lavfi + * @{ + */ + +enum { + + /** + * Do not check for format changes. + */ + AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT = 1, + +#if FF_API_AVFILTERBUFFER + /** + * Ignored + */ + AV_BUFFERSRC_FLAG_NO_COPY = 2, +#endif + + /** + * Immediately push the frame to the output. + */ + AV_BUFFERSRC_FLAG_PUSH = 4, + + /** + * Keep a reference to the frame. + * If the frame if reference-counted, create a new reference; otherwise + * copy the frame data. + */ + AV_BUFFERSRC_FLAG_KEEP_REF = 8, + +}; + +/** + * Add buffer data in picref to buffer_src. + * + * @param buffer_src pointer to a buffer source context + * @param picref a buffer reference, or NULL to mark EOF + * @param flags a combination of AV_BUFFERSRC_FLAG_* + * @return >= 0 in case of success, a negative AVERROR code + * in case of failure + */ +int av_buffersrc_add_ref(AVFilterContext *buffer_src, + AVFilterBufferRef *picref, int flags); + +/** + * Get the number of failed requests. + * + * A failed request is when the request_frame method is called while no + * frame is present in the buffer. + * The number is reset when a frame is added. + */ +unsigned av_buffersrc_get_nb_failed_requests(AVFilterContext *buffer_src); + +#if FF_API_AVFILTERBUFFER +/** + * Add a buffer to a filtergraph. + * + * @param ctx an instance of the buffersrc filter + * @param buf buffer containing frame data to be passed down the filtergraph. + * This function will take ownership of buf, the user must not free it. + * A NULL buf signals EOF -- i.e. no more frames will be sent to this filter. + * + * @deprecated use av_buffersrc_write_frame() or av_buffersrc_add_frame() + */ +attribute_deprecated +int av_buffersrc_buffer(AVFilterContext *ctx, AVFilterBufferRef *buf); +#endif + +/** + * Add a frame to the buffer source. + * + * @param ctx an instance of the buffersrc filter + * @param frame frame to be added. If the frame is reference counted, this + * function will make a new reference to it. Otherwise the frame data will be + * copied. + * + * @return 0 on success, a negative AVERROR on error + * + * This function is equivalent to av_buffersrc_add_frame_flags() with the + * AV_BUFFERSRC_FLAG_KEEP_REF flag. + */ +int av_buffersrc_write_frame(AVFilterContext *ctx, const AVFrame *frame); + +/** + * Add a frame to the buffer source. + * + * @param ctx an instance of the buffersrc filter + * @param frame frame to be added. If the frame is reference counted, this + * function will take ownership of the reference(s) and reset the frame. + * Otherwise the frame data will be copied. If this function returns an error, + * the input frame is not touched. + * + * @return 0 on success, a negative AVERROR on error. + * + * @note the difference between this function and av_buffersrc_write_frame() is + * that av_buffersrc_write_frame() creates a new reference to the input frame, + * while this function takes ownership of the reference passed to it. + * + * This function is equivalent to av_buffersrc_add_frame_flags() without the + * AV_BUFFERSRC_FLAG_KEEP_REF flag. + */ +int av_buffersrc_add_frame(AVFilterContext *ctx, AVFrame *frame); + +/** + * Add a frame to the buffer source. + * + * By default, if the frame is reference-counted, this function will take + * ownership of the reference(s) and reset the frame. This can be controlled + * using the flags. + * + * If this function returns an error, the input frame is not touched. + * + * @param buffer_src pointer to a buffer source context + * @param frame a frame, or NULL to mark EOF + * @param flags a combination of AV_BUFFERSRC_FLAG_* + * @return >= 0 in case of success, a negative AVERROR code + * in case of failure + */ +int av_buffersrc_add_frame_flags(AVFilterContext *buffer_src, + AVFrame *frame, int flags); + + +/** + * @} + */ + +#endif /* AVFILTER_BUFFERSRC_H */ diff --git a/app/src/main/cpp/include/libavfilter/version.h b/app/src/main/cpp/include/libavfilter/version.h new file mode 100644 index 0000000..335583c --- /dev/null +++ b/app/src/main/cpp/include/libavfilter/version.h @@ -0,0 +1,80 @@ +/* + * Version macros. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_VERSION_H +#define AVFILTER_VERSION_H + +/** + * @file + * @ingroup lavfi + * Libavfilter version macros + */ + +#include "libavutil/version.h" + +#define LIBAVFILTER_VERSION_MAJOR 5 +#define LIBAVFILTER_VERSION_MINOR 2 +#define LIBAVFILTER_VERSION_MICRO 103 + +#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ + LIBAVFILTER_VERSION_MINOR, \ + LIBAVFILTER_VERSION_MICRO) +#define LIBAVFILTER_VERSION AV_VERSION(LIBAVFILTER_VERSION_MAJOR, \ + LIBAVFILTER_VERSION_MINOR, \ + LIBAVFILTER_VERSION_MICRO) +#define LIBAVFILTER_BUILD LIBAVFILTER_VERSION_INT + +#define LIBAVFILTER_IDENT "Lavfi" AV_STRINGIFY(LIBAVFILTER_VERSION) + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + */ + +#ifndef FF_API_AVFILTERPAD_PUBLIC +#define FF_API_AVFILTERPAD_PUBLIC (LIBAVFILTER_VERSION_MAJOR < 6) +#endif +#ifndef FF_API_FOO_COUNT +#define FF_API_FOO_COUNT (LIBAVFILTER_VERSION_MAJOR < 6) +#endif +#ifndef FF_API_AVFILTERBUFFER +#define FF_API_AVFILTERBUFFER (LIBAVFILTER_VERSION_MAJOR < 6) +#endif +#ifndef FF_API_OLD_FILTER_OPTS +#define FF_API_OLD_FILTER_OPTS (LIBAVFILTER_VERSION_MAJOR < 6) +#endif +#ifndef FF_API_AVFILTER_OPEN +#define FF_API_AVFILTER_OPEN (LIBAVFILTER_VERSION_MAJOR < 6) +#endif +#ifndef FF_API_AVFILTER_INIT_FILTER +#define FF_API_AVFILTER_INIT_FILTER (LIBAVFILTER_VERSION_MAJOR < 6) +#endif +#ifndef FF_API_OLD_FILTER_REGISTER +#define FF_API_OLD_FILTER_REGISTER (LIBAVFILTER_VERSION_MAJOR < 6) +#endif +#ifndef FF_API_OLD_GRAPH_PARSE +#define FF_API_OLD_GRAPH_PARSE (LIBAVFILTER_VERSION_MAJOR < 5) +#endif +#ifndef FF_API_NOCONST_GET_NAME +#define FF_API_NOCONST_GET_NAME (LIBAVFILTER_VERSION_MAJOR < 6) +#endif + +#endif /* AVFILTER_VERSION_H */ diff --git a/app/src/main/cpp/include/libavformat/avformat.h b/app/src/main/cpp/include/libavformat/avformat.h new file mode 100644 index 0000000..9c07cb0 --- /dev/null +++ b/app/src/main/cpp/include/libavformat/avformat.h @@ -0,0 +1,2751 @@ +/* + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_AVFORMAT_H +#define AVFORMAT_AVFORMAT_H + +/** + * @file + * @ingroup libavf + * Main libavformat public API header + */ + +/** + * @defgroup libavf I/O and Muxing/Demuxing Library + * @{ + * + * Libavformat (lavf) is a library for dealing with various media container + * formats. Its main two purposes are demuxing - i.e. splitting a media file + * into component streams, and the reverse process of muxing - writing supplied + * data in a specified container format. It also has an @ref lavf_io + * "I/O module" which supports a number of protocols for accessing the data (e.g. + * file, tcp, http and others). Before using lavf, you need to call + * av_register_all() to register all compiled muxers, demuxers and protocols. + * Unless you are absolutely sure you won't use libavformat's network + * capabilities, you should also call avformat_network_init(). + * + * A supported input format is described by an AVInputFormat struct, conversely + * an output format is described by AVOutputFormat. You can iterate over all + * registered input/output formats using the av_iformat_next() / + * av_oformat_next() functions. The protocols layer is not part of the public + * API, so you can only get the names of supported protocols with the + * avio_enum_protocols() function. + * + * Main lavf structure used for both muxing and demuxing is AVFormatContext, + * which exports all information about the file being read or written. As with + * most Libavformat structures, its size is not part of public ABI, so it cannot be + * allocated on stack or directly with av_malloc(). To create an + * AVFormatContext, use avformat_alloc_context() (some functions, like + * avformat_open_input() might do that for you). + * + * Most importantly an AVFormatContext contains: + * @li the @ref AVFormatContext.iformat "input" or @ref AVFormatContext.oformat + * "output" format. It is either autodetected or set by user for input; + * always set by user for output. + * @li an @ref AVFormatContext.streams "array" of AVStreams, which describe all + * elementary streams stored in the file. AVStreams are typically referred to + * using their index in this array. + * @li an @ref AVFormatContext.pb "I/O context". It is either opened by lavf or + * set by user for input, always set by user for output (unless you are dealing + * with an AVFMT_NOFILE format). + * + * @section lavf_options Passing options to (de)muxers + * Lavf allows to configure muxers and demuxers using the @ref avoptions + * mechanism. Generic (format-independent) libavformat options are provided by + * AVFormatContext, they can be examined from a user program by calling + * av_opt_next() / av_opt_find() on an allocated AVFormatContext (or its AVClass + * from avformat_get_class()). Private (format-specific) options are provided by + * AVFormatContext.priv_data if and only if AVInputFormat.priv_class / + * AVOutputFormat.priv_class of the corresponding format struct is non-NULL. + * Further options may be provided by the @ref AVFormatContext.pb "I/O context", + * if its AVClass is non-NULL, and the protocols layer. See the discussion on + * nesting in @ref avoptions documentation to learn how to access those. + * + * @defgroup lavf_decoding Demuxing + * @{ + * Demuxers read a media file and split it into chunks of data (@em packets). A + * @ref AVPacket "packet" contains one or more encoded frames which belongs to a + * single elementary stream. In the lavf API this process is represented by the + * avformat_open_input() function for opening a file, av_read_frame() for + * reading a single packet and finally avformat_close_input(), which does the + * cleanup. + * + * @section lavf_decoding_open Opening a media file + * The minimum information required to open a file is its URL or filename, which + * is passed to avformat_open_input(), as in the following code: + * @code + * const char *url = "in.mp3"; + * AVFormatContext *s = NULL; + * int ret = avformat_open_input(&s, url, NULL, NULL); + * if (ret < 0) + * abort(); + * @endcode + * The above code attempts to allocate an AVFormatContext, open the + * specified file (autodetecting the format) and read the header, exporting the + * information stored there into s. Some formats do not have a header or do not + * store enough information there, so it is recommended that you call the + * avformat_find_stream_info() function which tries to read and decode a few + * frames to find missing information. + * + * In some cases you might want to preallocate an AVFormatContext yourself with + * avformat_alloc_context() and do some tweaking on it before passing it to + * avformat_open_input(). One such case is when you want to use custom functions + * for reading input data instead of lavf internal I/O layer. + * To do that, create your own AVIOContext with avio_alloc_context(), passing + * your reading callbacks to it. Then set the @em pb field of your + * AVFormatContext to newly created AVIOContext. + * + * Since the format of the opened file is in general not known until after + * avformat_open_input() has returned, it is not possible to set demuxer private + * options on a preallocated context. Instead, the options should be passed to + * avformat_open_input() wrapped in an AVDictionary: + * @code + * AVDictionary *options = NULL; + * av_dict_set(&options, "video_size", "640x480", 0); + * av_dict_set(&options, "pixel_format", "rgb24", 0); + * + * if (avformat_open_input(&s, url, NULL, &options) < 0) + * abort(); + * av_dict_free(&options); + * @endcode + * This code passes the private options 'video_size' and 'pixel_format' to the + * demuxer. They would be necessary for e.g. the rawvideo demuxer, since it + * cannot know how to interpret raw video data otherwise. If the format turns + * out to be something different than raw video, those options will not be + * recognized by the demuxer and therefore will not be applied. Such unrecognized + * options are then returned in the options dictionary (recognized options are + * consumed). The calling program can handle such unrecognized options as it + * wishes, e.g. + * @code + * AVDictionaryEntry *e; + * if (e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX)) { + * fprintf(stderr, "Option %s not recognized by the demuxer.\n", e->key); + * abort(); + * } + * @endcode + * + * After you have finished reading the file, you must close it with + * avformat_close_input(). It will free everything associated with the file. + * + * @section lavf_decoding_read Reading from an opened file + * Reading data from an opened AVFormatContext is done by repeatedly calling + * av_read_frame() on it. Each call, if successful, will return an AVPacket + * containing encoded data for one AVStream, identified by + * AVPacket.stream_index. This packet may be passed straight into the libavcodec + * decoding functions avcodec_decode_video2(), avcodec_decode_audio4() or + * avcodec_decode_subtitle2() if the caller wishes to decode the data. + * + * AVPacket.pts, AVPacket.dts and AVPacket.duration timing information will be + * set if known. They may also be unset (i.e. AV_NOPTS_VALUE for + * pts/dts, 0 for duration) if the stream does not provide them. The timing + * information will be in AVStream.time_base units, i.e. it has to be + * multiplied by the timebase to convert them to seconds. + * + * If AVPacket.buf is set on the returned packet, then the packet is + * allocated dynamically and the user may keep it indefinitely. + * Otherwise, if AVPacket.buf is NULL, the packet data is backed by a + * static storage somewhere inside the demuxer and the packet is only valid + * until the next av_read_frame() call or closing the file. If the caller + * requires a longer lifetime, av_dup_packet() will make an av_malloc()ed copy + * of it. + * In both cases, the packet must be freed with av_free_packet() when it is no + * longer needed. + * + * @section lavf_decoding_seek Seeking + * @} + * + * @defgroup lavf_encoding Muxing + * @{ + * Muxers take encoded data in the form of @ref AVPacket "AVPackets" and write + * it into files or other output bytestreams in the specified container format. + * + * The main API functions for muxing are avformat_write_header() for writing the + * file header, av_write_frame() / av_interleaved_write_frame() for writing the + * packets and av_write_trailer() for finalizing the file. + * + * At the beginning of the muxing process, the caller must first call + * avformat_alloc_context() to create a muxing context. The caller then sets up + * the muxer by filling the various fields in this context: + * + * - The @ref AVFormatContext.oformat "oformat" field must be set to select the + * muxer that will be used. + * - Unless the format is of the AVFMT_NOFILE type, the @ref AVFormatContext.pb + * "pb" field must be set to an opened IO context, either returned from + * avio_open2() or a custom one. + * - Unless the format is of the AVFMT_NOSTREAMS type, at least one stream must + * be created with the avformat_new_stream() function. The caller should fill + * the @ref AVStream.codec "stream codec context" information, such as the + * codec @ref AVCodecContext.codec_type "type", @ref AVCodecContext.codec_id + * "id" and other parameters (e.g. width / height, the pixel or sample format, + * etc.) as known. The @ref AVStream.time_base "stream timebase" should + * be set to the timebase that the caller desires to use for this stream (note + * that the timebase actually used by the muxer can be different, as will be + * described later). + * - The caller may fill in additional information, such as @ref + * AVFormatContext.metadata "global" or @ref AVStream.metadata "per-stream" + * metadata, @ref AVFormatContext.chapters "chapters", @ref + * AVFormatContext.programs "programs", etc. as described in the + * AVFormatContext documentation. Whether such information will actually be + * stored in the output depends on what the container format and the muxer + * support. + * + * When the muxing context is fully set up, the caller must call + * avformat_write_header() to initialize the muxer internals and write the file + * header. Whether anything actually is written to the IO context at this step + * depends on the muxer, but this function must always be called. Any muxer + * private options must be passed in the options parameter to this function. + * + * The data is then sent to the muxer by repeatedly calling av_write_frame() or + * av_interleaved_write_frame() (consult those functions' documentation for + * discussion on the difference between them; only one of them may be used with + * a single muxing context, they should not be mixed). Do note that the timing + * information on the packets sent to the muxer must be in the corresponding + * AVStream's timebase. That timebase is set by the muxer (in the + * avformat_write_header() step) and may be different from the timebase + * requested by the caller. + * + * Once all the data has been written, the caller must call av_write_trailer() + * to flush any buffered packets and finalize the output file, then close the IO + * context (if any) and finally free the muxing context with + * avformat_free_context(). + * @} + * + * @defgroup lavf_io I/O Read/Write + * @{ + * @} + * + * @defgroup lavf_codec Demuxers + * @{ + * @defgroup lavf_codec_native Native Demuxers + * @{ + * @} + * @defgroup lavf_codec_wrappers External library wrappers + * @{ + * @} + * @} + * @defgroup lavf_protos I/O Protocols + * @{ + * @} + * @defgroup lavf_internal Internal + * @{ + * @} + * @} + * + */ + +#include <time.h> +#include <stdio.h> /* FILE */ +#include "libavcodec/avcodec.h" +#include "libavutil/dict.h" +#include "libavutil/log.h" + +#include "avio.h" +#include "libavformat/version.h" + +struct AVFormatContext; + +struct AVDeviceInfoList; +struct AVDeviceCapabilitiesQuery; + +/** + * @defgroup metadata_api Public Metadata API + * @{ + * @ingroup libavf + * The metadata API allows libavformat to export metadata tags to a client + * application when demuxing. Conversely it allows a client application to + * set metadata when muxing. + * + * Metadata is exported or set as pairs of key/value strings in the 'metadata' + * fields of the AVFormatContext, AVStream, AVChapter and AVProgram structs + * using the @ref lavu_dict "AVDictionary" API. Like all strings in FFmpeg, + * metadata is assumed to be UTF-8 encoded Unicode. Note that metadata + * exported by demuxers isn't checked to be valid UTF-8 in most cases. + * + * Important concepts to keep in mind: + * - Keys are unique; there can never be 2 tags with the same key. This is + * also meant semantically, i.e., a demuxer should not knowingly produce + * several keys that are literally different but semantically identical. + * E.g., key=Author5, key=Author6. In this example, all authors must be + * placed in the same tag. + * - Metadata is flat, not hierarchical; there are no subtags. If you + * want to store, e.g., the email address of the child of producer Alice + * and actor Bob, that could have key=alice_and_bobs_childs_email_address. + * - Several modifiers can be applied to the tag name. This is done by + * appending a dash character ('-') and the modifier name in the order + * they appear in the list below -- e.g. foo-eng-sort, not foo-sort-eng. + * - language -- a tag whose value is localized for a particular language + * is appended with the ISO 639-2/B 3-letter language code. + * For example: Author-ger=Michael, Author-eng=Mike + * The original/default language is in the unqualified "Author" tag. + * A demuxer should set a default if it sets any translated tag. + * - sorting -- a modified version of a tag that should be used for + * sorting will have '-sort' appended. E.g. artist="The Beatles", + * artist-sort="Beatles, The". + * - Some protocols and demuxers support metadata updates. After a successful + * call to av_read_packet(), AVFormatContext.event_flags or AVStream.event_flags + * will be updated to indicate if metadata changed. In order to detect metadata + * changes on a stream, you need to loop through all streams in the AVFormatContext + * and check their individual event_flags. + * + * - Demuxers attempt to export metadata in a generic format, however tags + * with no generic equivalents are left as they are stored in the container. + * Follows a list of generic tag names: + * + @verbatim + album -- name of the set this work belongs to + album_artist -- main creator of the set/album, if different from artist. + e.g. "Various Artists" for compilation albums. + artist -- main creator of the work + comment -- any additional description of the file. + composer -- who composed the work, if different from artist. + copyright -- name of copyright holder. + creation_time-- date when the file was created, preferably in ISO 8601. + date -- date when the work was created, preferably in ISO 8601. + disc -- number of a subset, e.g. disc in a multi-disc collection. + encoder -- name/settings of the software/hardware that produced the file. + encoded_by -- person/group who created the file. + filename -- original name of the file. + genre -- <self-evident>. + language -- main language in which the work is performed, preferably + in ISO 639-2 format. Multiple languages can be specified by + separating them with commas. + performer -- artist who performed the work, if different from artist. + E.g for "Also sprach Zarathustra", artist would be "Richard + Strauss" and performer "London Philharmonic Orchestra". + publisher -- name of the label/publisher. + service_name -- name of the service in broadcasting (channel name). + service_provider -- name of the service provider in broadcasting. + title -- name of the work. + track -- number of this work in the set, can be in form current/total. + variant_bitrate -- the total bitrate of the bitrate variant that the current stream is part of + @endverbatim + * + * Look in the examples section for an application example how to use the Metadata API. + * + * @} + */ + +/* packet functions */ + + +/** + * Allocate and read the payload of a packet and initialize its + * fields with default values. + * + * @param s associated IO context + * @param pkt packet + * @param size desired payload size + * @return >0 (read size) if OK, AVERROR_xxx otherwise + */ +int av_get_packet(AVIOContext *s, AVPacket *pkt, int size); + + +/** + * Read data and append it to the current content of the AVPacket. + * If pkt->size is 0 this is identical to av_get_packet. + * Note that this uses av_grow_packet and thus involves a realloc + * which is inefficient. Thus this function should only be used + * when there is no reasonable way to know (an upper bound of) + * the final size. + * + * @param s associated IO context + * @param pkt packet + * @param size amount of data to read + * @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data + * will not be lost even if an error occurs. + */ +int av_append_packet(AVIOContext *s, AVPacket *pkt, int size); + +#if FF_API_LAVF_FRAC +/*************************************************/ +/* fractional numbers for exact pts handling */ + +/** + * The exact value of the fractional number is: 'val + num / den'. + * num is assumed to be 0 <= num < den. + */ +typedef struct AVFrac { + int64_t val, num, den; +} AVFrac; +#endif + +/*************************************************/ +/* input/output formats */ + +struct AVCodecTag; + +/** + * This structure contains the data a format has to probe a file. + */ +typedef struct AVProbeData { + const char *filename; + unsigned char *buf; /**< Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero. */ + int buf_size; /**< Size of buf except extra allocated bytes */ + const char *mime_type; /**< mime_type, when known. */ +} AVProbeData; + +#define AVPROBE_SCORE_RETRY (AVPROBE_SCORE_MAX/4) +#define AVPROBE_SCORE_STREAM_RETRY (AVPROBE_SCORE_MAX/4-1) + +#define AVPROBE_SCORE_EXTENSION 50 ///< score for file extension +#define AVPROBE_SCORE_MIME 75 ///< score for file mime type +#define AVPROBE_SCORE_MAX 100 ///< maximum score + +#define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer + +/// Demuxer will use avio_open, no opened file should be provided by the caller. +#define AVFMT_NOFILE 0x0001 +#define AVFMT_NEEDNUMBER 0x0002 /**< Needs '%d' in filename. */ +#define AVFMT_SHOW_IDS 0x0008 /**< Show format stream IDs numbers. */ +#define AVFMT_RAWPICTURE 0x0020 /**< Format wants AVPicture structure for + raw picture data. */ +#define AVFMT_GLOBALHEADER 0x0040 /**< Format wants global header. */ +#define AVFMT_NOTIMESTAMPS 0x0080 /**< Format does not need / have any timestamps. */ +#define AVFMT_GENERIC_INDEX 0x0100 /**< Use generic index building code. */ +#define AVFMT_TS_DISCONT 0x0200 /**< Format allows timestamp discontinuities. Note, muxers always require valid (monotone) timestamps */ +#define AVFMT_VARIABLE_FPS 0x0400 /**< Format allows variable fps. */ +#define AVFMT_NODIMENSIONS 0x0800 /**< Format does not need width/height */ +#define AVFMT_NOSTREAMS 0x1000 /**< Format does not require any streams */ +#define AVFMT_NOBINSEARCH 0x2000 /**< Format does not allow to fall back on binary search via read_timestamp */ +#define AVFMT_NOGENSEARCH 0x4000 /**< Format does not allow to fall back on generic search */ +#define AVFMT_NO_BYTE_SEEK 0x8000 /**< Format does not allow seeking by bytes */ +#define AVFMT_ALLOW_FLUSH 0x10000 /**< Format allows flushing. If not set, the muxer will not receive a NULL packet in the write_packet function. */ +#if LIBAVFORMAT_VERSION_MAJOR <= 54 +#define AVFMT_TS_NONSTRICT 0x8020000 //we try to be compatible to the ABIs of ffmpeg and major forks +#else +#define AVFMT_TS_NONSTRICT 0x20000 +#endif +/**< Format does not require strictly + increasing timestamps, but they must + still be monotonic */ +#define AVFMT_TS_NEGATIVE 0x40000 /**< Format allows muxing negative + timestamps. If not set the timestamp + will be shifted in av_write_frame and + av_interleaved_write_frame so they + start from 0. + The user or muxer can override this through + AVFormatContext.avoid_negative_ts + */ + +#define AVFMT_SEEK_TO_PTS 0x4000000 /**< Seeking is based on PTS */ + +/** + * @addtogroup lavf_encoding + * @{ + */ +typedef struct AVOutputFormat { + const char *name; + /** + * Descriptive name for the format, meant to be more human-readable + * than name. You should use the NULL_IF_CONFIG_SMALL() macro + * to define it. + */ + const char *long_name; + const char *mime_type; + const char *extensions; /**< comma-separated filename extensions */ + /* output support */ + enum AVCodecID audio_codec; /**< default audio codec */ + enum AVCodecID video_codec; /**< default video codec */ + enum AVCodecID subtitle_codec; /**< default subtitle codec */ + /** + * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE, + * AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS, + * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH, + * AVFMT_TS_NONSTRICT + */ + int flags; + + /** + * List of supported codec_id-codec_tag pairs, ordered by "better + * choice first". The arrays are all terminated by AV_CODEC_ID_NONE. + */ + const struct AVCodecTag *const *codec_tag; + + + const AVClass *priv_class; ///< AVClass for the private context + + /***************************************************************** + * No fields below this line are part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + struct AVOutputFormat *next; + /** + * size of private data so that it can be allocated in the wrapper + */ + int priv_data_size; + + int (*write_header)(struct AVFormatContext *); + + /** + * Write a packet. If AVFMT_ALLOW_FLUSH is set in flags, + * pkt can be NULL in order to flush data buffered in the muxer. + * When flushing, return 0 if there still is more data to flush, + * or 1 if everything was flushed and there is no more buffered + * data. + */ + int (*write_packet)(struct AVFormatContext *, AVPacket *pkt); + + int (*write_trailer)(struct AVFormatContext *); + + /** + * Currently only used to set pixel format if not YUV420P. + */ + int (*interleave_packet)(struct AVFormatContext *, AVPacket *out, + AVPacket *in, int flush); + + /** + * Test if the given codec can be stored in this container. + * + * @return 1 if the codec is supported, 0 if it is not. + * A negative number if unknown. + * MKTAG('A', 'P', 'I', 'C') if the codec is only supported as AV_DISPOSITION_ATTACHED_PIC + */ + int (*query_codec)(enum AVCodecID id, int std_compliance); + + void (*get_output_timestamp)(struct AVFormatContext *s, int stream, + int64_t *dts, int64_t *wall); + + /** + * Allows sending messages from application to device. + */ + int (*control_message)(struct AVFormatContext *s, int type, + void *data, size_t data_size); + + /** + * Write an uncoded AVFrame. + * + * See av_write_uncoded_frame() for details. + * + * The library will free *frame afterwards, but the muxer can prevent it + * by setting the pointer to NULL. + */ + int (*write_uncoded_frame)(struct AVFormatContext *, int stream_index, + AVFrame **frame, unsigned flags); + + /** + * Returns device list with it properties. + * @see avdevice_list_devices() for more details. + */ + int (*get_device_list)(struct AVFormatContext *s, struct AVDeviceInfoList *device_list); + + /** + * Initialize device capabilities submodule. + * @see avdevice_capabilities_create() for more details. + */ + int (*create_device_capabilities)(struct AVFormatContext *s, + struct AVDeviceCapabilitiesQuery *caps); + + /** + * Free device capabilities submodule. + * @see avdevice_capabilities_free() for more details. + */ + int + (*free_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps); +} AVOutputFormat; +/** + * @} + */ + +/** + * @addtogroup lavf_decoding + * @{ + */ +typedef struct AVInputFormat { + /** + * A comma separated list of short names for the format. New names + * may be appended with a minor bump. + */ + const char *name; + + /** + * Descriptive name for the format, meant to be more human-readable + * than name. You should use the NULL_IF_CONFIG_SMALL() macro + * to define it. + */ + const char *long_name; + + /** + * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS, + * AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH, + * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEEK_TO_PTS. + */ + int flags; + + /** + * If extensions are defined, then no probe is done. You should + * usually not use extension format guessing because it is not + * reliable enough + */ + const char *extensions; + + const struct AVCodecTag *const *codec_tag; + + const AVClass *priv_class; ///< AVClass for the private context + + /** + * Comma-separated list of mime types. + * It is used check for matching mime types while probing. + * @see av_probe_input_format2 + */ + const char *mime_type; + + /***************************************************************** + * No fields below this line are part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + struct AVInputFormat *next; + + /** + * Raw demuxers store their codec ID here. + */ + int raw_codec_id; + + /** + * Size of private data so that it can be allocated in the wrapper. + */ + int priv_data_size; + + /** + * Tell if a given file has a chance of being parsed as this format. + * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes + * big so you do not have to check for that unless you need more. + */ + int (*read_probe)(AVProbeData *); + + /** + * Read the format header and initialize the AVFormatContext + * structure. Return 0 if OK. Only used in raw format right + * now. 'avformat_new_stream' should be called to create new streams. + */ + int (*read_header)(struct AVFormatContext *); + + /** + * Read one packet and put it in 'pkt'. pts and flags are also + * set. 'avformat_new_stream' can be called only if the flag + * AVFMTCTX_NOHEADER is used and only in the calling thread (not in a + * background thread). + * @return 0 on success, < 0 on error. + * When returning an error, pkt must not have been allocated + * or must be freed before returning + */ + int (*read_packet)(struct AVFormatContext *, AVPacket *pkt); + + /** + * Close the stream. The AVFormatContext and AVStreams are not + * freed by this function + */ + int (*read_close)(struct AVFormatContext *); + + /** + * Seek to a given timestamp relative to the frames in + * stream component stream_index. + * @param stream_index Must not be -1. + * @param flags Selects which direction should be preferred if no exact + * match is available. + * @return >= 0 on success (but not necessarily the new offset) + */ + int (*read_seek)(struct AVFormatContext *, + int stream_index, int64_t timestamp, int flags); + + /** + * Get the next timestamp in stream[stream_index].time_base units. + * @return the timestamp or AV_NOPTS_VALUE if an error occurred + */ + int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index, + int64_t *pos, int64_t pos_limit); + + /** + * Start/resume playing - only meaningful if using a network-based format + * (RTSP). + */ + int (*read_play)(struct AVFormatContext *); + + /** + * Pause playing - only meaningful if using a network-based format + * (RTSP). + */ + int (*read_pause)(struct AVFormatContext *); + + /** + * Seek to timestamp ts. + * Seeking will be done so that the point from which all active streams + * can be presented successfully will be closest to ts and within min/max_ts. + * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. + */ + int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, + int64_t max_ts, int flags); + + /** + * Returns device list with it properties. + * @see avdevice_list_devices() for more details. + */ + int (*get_device_list)(struct AVFormatContext *s, struct AVDeviceInfoList *device_list); + + /** + * Initialize device capabilities submodule. + * @see avdevice_capabilities_create() for more details. + */ + int (*create_device_capabilities)(struct AVFormatContext *s, + struct AVDeviceCapabilitiesQuery *caps); + + /** + * Free device capabilities submodule. + * @see avdevice_capabilities_free() for more details. + */ + int + (*free_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps); +} AVInputFormat; +/** + * @} + */ + +enum AVStreamParseType { + AVSTREAM_PARSE_NONE, + AVSTREAM_PARSE_FULL, /**< full parsing and repack */ + AVSTREAM_PARSE_HEADERS, /**< Only parse headers, do not repack. */ + AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps for frames not starting on a packet boundary */ + AVSTREAM_PARSE_FULL_ONCE, /**< full parsing and repack of the first frame only, only implemented for H.264 currently */ + AVSTREAM_PARSE_FULL_RAW = MKTAG(0, 'R', 'A', 'W'), /**< full parsing and repack with timestamp and position generation by parser for raw + this assumes that each packet in the file contains no demuxer level headers and + just codec level data, otherwise position generation would fail */ +}; + +typedef struct AVIndexEntry { + int64_t pos; + int64_t timestamp; /**< + * Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are available + * when seeking to this entry. That means preferable PTS on keyframe based formats. + * But demuxers can choose to store a different timestamp, if it is more convenient for the implementation or nothing better + * is known + */ +#define AVINDEX_KEYFRAME 0x0001 + int flags:2; + int size + :30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs. 32 bytes due to possible 8-byte alignment). + int min_distance; /**< Minimum distance between this and the previous keyframe, used to avoid unneeded searching. */ +} AVIndexEntry; + +#define AV_DISPOSITION_DEFAULT 0x0001 +#define AV_DISPOSITION_DUB 0x0002 +#define AV_DISPOSITION_ORIGINAL 0x0004 +#define AV_DISPOSITION_COMMENT 0x0008 +#define AV_DISPOSITION_LYRICS 0x0010 +#define AV_DISPOSITION_KARAOKE 0x0020 + +/** + * Track should be used during playback by default. + * Useful for subtitle track that should be displayed + * even when user did not explicitly ask for subtitles. + */ +#define AV_DISPOSITION_FORCED 0x0040 +#define AV_DISPOSITION_HEARING_IMPAIRED 0x0080 /**< stream for hearing impaired audiences */ +#define AV_DISPOSITION_VISUAL_IMPAIRED 0x0100 /**< stream for visual impaired audiences */ +#define AV_DISPOSITION_CLEAN_EFFECTS 0x0200 /**< stream without voice */ +/** + * The stream is stored in the file as an attached picture/"cover art" (e.g. + * APIC frame in ID3v2). The single packet associated with it will be returned + * among the first few packets read from the file unless seeking takes place. + * It can also be accessed at any time in AVStream.attached_pic. + */ +#define AV_DISPOSITION_ATTACHED_PIC 0x0400 + +/** + * To specify text track kind (different from subtitles default). + */ +#define AV_DISPOSITION_CAPTIONS 0x10000 +#define AV_DISPOSITION_DESCRIPTIONS 0x20000 +#define AV_DISPOSITION_METADATA 0x40000 + +/** + * Options for behavior on timestamp wrap detection. + */ +#define AV_PTS_WRAP_IGNORE 0 ///< ignore the wrap +#define AV_PTS_WRAP_ADD_OFFSET 1 ///< add the format specific offset on wrap detection +#define AV_PTS_WRAP_SUB_OFFSET -1 ///< subtract the format specific offset on wrap detection + +/** + * Stream structure. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVStream) must not be used outside libav*. + */ +typedef struct AVStream { + int index; /**< stream index in AVFormatContext */ + /** + * Format-specific stream ID. + * decoding: set by libavformat + * encoding: set by the user, replaced by libavformat if left unset + */ + int id; + /** + * Codec context associated with this stream. Allocated and freed by + * libavformat. + * + * - decoding: The demuxer exports codec information stored in the headers + * here. + * - encoding: The user sets codec information, the muxer writes it to the + * output. Mandatory fields as specified in AVCodecContext + * documentation must be set even if this AVCodecContext is + * not actually used for encoding. + */ + AVCodecContext *codec; + void *priv_data; + +#if FF_API_LAVF_FRAC + /** + * @deprecated this field is unused + */ + attribute_deprecated + struct AVFrac pts; +#endif + + /** + * This is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. + * + * decoding: set by libavformat + * encoding: May be set by the caller before avformat_write_header() to + * provide a hint to the muxer about the desired timebase. In + * avformat_write_header(), the muxer will overwrite this field + * with the timebase that will actually be used for the timestamps + * written into the file (which may or may not be related to the + * user-provided one, depending on the format). + */ + AVRational time_base; + + /** + * Decoding: pts of the first frame of the stream in presentation order, in stream time base. + * Only set this if you are absolutely 100% sure that the value you set + * it to really is the pts of the first frame. + * This may be undefined (AV_NOPTS_VALUE). + * @note The ASF header does NOT contain a correct start_time the ASF + * demuxer must NOT set this. + */ + int64_t start_time; + + /** + * Decoding: duration of the stream, in stream time base. + * If a source file does not specify a duration, but does specify + * a bitrate, this value will be estimated from bitrate and file size. + */ + int64_t duration; + + int64_t nb_frames; ///< number of frames in this stream if known or 0 + + int disposition; /**< AV_DISPOSITION_* bit field */ + + enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed. + + /** + * sample aspect ratio (0 if unknown) + * - encoding: Set by user. + * - decoding: Set by libavformat. + */ + AVRational sample_aspect_ratio; + + AVDictionary *metadata; + + /** + * Average framerate + * + * - demuxing: May be set by libavformat when creating the stream or in + * avformat_find_stream_info(). + * - muxing: May be set by the caller before avformat_write_header(). + */ + AVRational avg_frame_rate; + + /** + * For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet + * will contain the attached picture. + * + * decoding: set by libavformat, must not be modified by the caller. + * encoding: unused + */ + AVPacket attached_pic; + + /** + * An array of side data that applies to the whole stream (i.e. the + * container does not allow it to change between packets). + * + * There may be no overlap between the side data in this array and side data + * in the packets. I.e. a given side data is either exported by the muxer + * (demuxing) / set by the caller (muxing) in this array, then it never + * appears in the packets, or the side data is exported / sent through + * the packets (always in the first packet where the value becomes known or + * changes), then it does not appear in this array. + * + * - demuxing: Set by libavformat when the stream is created. + * - muxing: May be set by the caller before avformat_write_header(). + * + * Freed by libavformat in avformat_free_context(). + * + * @see av_format_inject_global_side_data() + */ + AVPacketSideData *side_data; + /** + * The number of elements in the AVStream.side_data array. + */ + int nb_side_data; + + /** + * Flags for the user to detect events happening on the stream. Flags must + * be cleared by the user once the event has been handled. + * A combination of AVSTREAM_EVENT_FLAG_*. + */ + int event_flags; +#define AVSTREAM_EVENT_FLAG_METADATA_UPDATED 0x0001 ///< The call resulted in updated metadata. + + /***************************************************************** + * All fields below this line are not part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + + /** + * Stream information used internally by av_find_stream_info() + */ +#define MAX_STD_TIMEBASES (30*12+7+6) + struct { + int64_t last_dts; + int64_t duration_gcd; + int duration_count; + int64_t rfps_duration_sum; + double (*duration_error)[2][MAX_STD_TIMEBASES]; + int64_t codec_info_duration; + int64_t codec_info_duration_fields; + + /** + * 0 -> decoder has not been searched for yet. + * >0 -> decoder found + * <0 -> decoder with codec_id == -found_decoder has not been found + */ + int found_decoder; + + int64_t last_duration; + + /** + * Those are used for average framerate estimation. + */ + int64_t fps_first_dts; + int fps_first_dts_idx; + int64_t fps_last_dts; + int fps_last_dts_idx; + + } *info; + + int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */ + + // Timestamp generation support: + /** + * Timestamp corresponding to the last dts sync point. + * + * Initialized when AVCodecParserContext.dts_sync_point >= 0 and + * a DTS is received from the underlying container. Otherwise set to + * AV_NOPTS_VALUE by default. + */ + int64_t first_dts; + int64_t cur_dts; + int64_t last_IP_pts; + int last_IP_duration; + + /** + * Number of packets to buffer for codec probing + */ +#define MAX_PROBE_PACKETS 2500 + int probe_packets; + + /** + * Number of frames that have been demuxed during av_find_stream_info() + */ + int codec_info_nb_frames; + + /* av_read_frame() support */ + enum AVStreamParseType need_parsing; + struct AVCodecParserContext *parser; + + /** + * last packet in packet_buffer for this stream when muxing. + */ + struct AVPacketList *last_in_packet_buffer; + AVProbeData probe_data; +#define MAX_REORDER_DELAY 16 + int64_t pts_buffer[MAX_REORDER_DELAY + 1]; + + AVIndexEntry *index_entries; /**< Only used if the format does not + support seeking natively. */ + int nb_index_entries; + unsigned int index_entries_allocated_size; + + /** + * Real base framerate of the stream. + * This is the lowest framerate with which all timestamps can be + * represented accurately (it is the least common multiple of all + * framerates in the stream). Note, this value is just a guess! + * For example, if the time base is 1/90000 and all frames have either + * approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1. + * + * Code outside avformat should access this field using: + * av_stream_get/set_r_frame_rate(stream) + */ + AVRational r_frame_rate; + + /** + * Stream Identifier + * This is the MPEG-TS stream identifier +1 + * 0 means unknown + */ + int stream_identifier; + + int64_t interleaver_chunk_size; + int64_t interleaver_chunk_duration; + + /** + * stream probing state + * -1 -> probing finished + * 0 -> no probing requested + * rest -> perform probing with request_probe being the minimum score to accept. + * NOT PART OF PUBLIC API + */ + int request_probe; + /** + * Indicates that everything up to the next keyframe + * should be discarded. + */ + int skip_to_keyframe; + + /** + * Number of samples to skip at the start of the frame decoded from the next packet. + */ + int skip_samples; + + /** + * If not 0, the first audio sample that should be discarded from the stream. + * This is broken by design (needs global sample count), but can't be + * avoided for broken by design formats such as mp3 with ad-hoc gapless + * audio support. + */ + int64_t first_discard_sample; + + /** + * The sample after last sample that is intended to be discarded after + * first_discard_sample. Works on frame boundaries only. Used to prevent + * early EOF if the gapless info is broken (considered concatenated mp3s). + */ + int64_t last_discard_sample; + + /** + * Number of internally decoded frames, used internally in libavformat, do not access + * its lifetime differs from info which is why it is not in that structure. + */ + int nb_decoded_frames; + + /** + * Timestamp offset added to timestamps before muxing + * NOT PART OF PUBLIC API + */ + int64_t mux_ts_offset; + + /** + * Internal data to check for wrapping of the time stamp + */ + int64_t pts_wrap_reference; + + /** + * Options for behavior, when a wrap is detected. + * + * Defined by AV_PTS_WRAP_ values. + * + * If correction is enabled, there are two possibilities: + * If the first time stamp is near the wrap point, the wrap offset + * will be subtracted, which will create negative time stamps. + * Otherwise the offset will be added. + */ + int pts_wrap_behavior; + + /** + * Internal data to prevent doing update_initial_durations() twice + */ + int update_initial_durations_done; + + /** + * Internal data to generate dts from pts + */ + int64_t pts_reorder_error[MAX_REORDER_DELAY + 1]; + uint8_t pts_reorder_error_count[MAX_REORDER_DELAY + 1]; + + /** + * Internal data to analyze DTS and detect faulty mpeg streams + */ + int64_t last_dts_for_order_check; + uint8_t dts_ordered; + uint8_t dts_misordered; + + /** + * Internal data to inject global side data + */ + int inject_global_side_data; + + /** + * String containing paris of key and values describing recommended encoder configuration. + * Paris are separated by ','. + * Keys are separated from values by '='. + */ + char *recommended_encoder_configuration; + + /** + * display aspect ratio (0 if unknown) + * - encoding: unused + * - decoding: Set by libavformat to calculate sample_aspect_ratio internally + */ + AVRational display_aspect_ratio; +} AVStream; + +AVRational av_stream_get_r_frame_rate(const AVStream *s); + +void av_stream_set_r_frame_rate(AVStream *s, AVRational r); + +struct AVCodecParserContext *av_stream_get_parser(const AVStream *s); + +char *av_stream_get_recommended_encoder_configuration(const AVStream *s); + +void av_stream_set_recommended_encoder_configuration(AVStream *s, char *configuration); + +/** + * Returns the pts of the last muxed packet + its duration + * + * the retuned value is undefined when used with a demuxer. + */ +int64_t av_stream_get_end_pts(const AVStream *st); + +#define AV_PROGRAM_RUNNING 1 + +/** + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVProgram) must not be used outside libav*. + */ +typedef struct AVProgram { + int id; + int flags; + enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller + unsigned int *stream_index; + unsigned int nb_stream_indexes; + AVDictionary *metadata; + + int program_num; + int pmt_pid; + int pcr_pid; + + /***************************************************************** + * All fields below this line are not part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + int64_t start_time; + int64_t end_time; + + int64_t pts_wrap_reference; ///< reference dts for wrap detection + int pts_wrap_behavior; ///< behavior on wrap detection +} AVProgram; + +#define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present + (streams are added dynamically) */ + +typedef struct AVChapter { + int id; ///< unique ID to identify the chapter + AVRational time_base; ///< time base in which the start/end timestamps are specified + int64_t start, end; ///< chapter start/end time in time_base units + AVDictionary *metadata; +} AVChapter; + + +/** + * Callback used by devices to communicate with application. + */ +typedef int (*av_format_control_message)(struct AVFormatContext *s, int type, + void *data, size_t data_size); + + +/** + * The duration of a video can be estimated through various ways, and this enum can be used + * to know how the duration was estimated. + */ +enum AVDurationEstimationMethod { + AVFMT_DURATION_FROM_PTS, ///< Duration accurately estimated from PTSes + AVFMT_DURATION_FROM_STREAM, ///< Duration estimated from a stream with a known duration + AVFMT_DURATION_FROM_BITRATE ///< Duration estimated from bitrate (less accurate) +}; + +typedef struct AVFormatInternal AVFormatInternal; + +/** + * Format I/O context. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVFormatContext) must not be used outside libav*, use + * avformat_alloc_context() to create an AVFormatContext. + */ +typedef struct AVFormatContext { + /** + * A class for logging and @ref avoptions. Set by avformat_alloc_context(). + * Exports (de)muxer private options if they exist. + */ + const AVClass *av_class; + + /** + * The input container format. + * + * Demuxing only, set by avformat_open_input(). + */ + struct AVInputFormat *iformat; + + /** + * The output container format. + * + * Muxing only, must be set by the caller before avformat_write_header(). + */ + struct AVOutputFormat *oformat; + + /** + * Format private data. This is an AVOptions-enabled struct + * if and only if iformat/oformat.priv_class is not NULL. + * + * - muxing: set by avformat_write_header() + * - demuxing: set by avformat_open_input() + */ + void *priv_data; + + /** + * I/O context. + * + * - demuxing: either set by the user before avformat_open_input() (then + * the user must close it manually) or set by avformat_open_input(). + * - muxing: set by the user before avformat_write_header(). The caller must + * take care of closing / freeing the IO context. + * + * Do NOT set this field if AVFMT_NOFILE flag is set in + * iformat/oformat.flags. In such a case, the (de)muxer will handle + * I/O in some other way and this field will be NULL. + */ + AVIOContext *pb; + + /* stream info */ + /** + * Flags signalling stream properties. A combination of AVFMTCTX_*. + * Set by libavformat. + */ + int ctx_flags; + + /** + * Number of elements in AVFormatContext.streams. + * + * Set by avformat_new_stream(), must not be modified by any other code. + */ + unsigned int nb_streams; + /** + * A list of all streams in the file. New streams are created with + * avformat_new_stream(). + * + * - demuxing: streams are created by libavformat in avformat_open_input(). + * If AVFMTCTX_NOHEADER is set in ctx_flags, then new streams may also + * appear in av_read_frame(). + * - muxing: streams are created by the user before avformat_write_header(). + * + * Freed by libavformat in avformat_free_context(). + */ + AVStream **streams; + + /** + * input or output filename + * + * - demuxing: set by avformat_open_input() + * - muxing: may be set by the caller before avformat_write_header() + */ + char filename[1024]; + + /** + * Position of the first frame of the component, in + * AV_TIME_BASE fractional seconds. NEVER set this value directly: + * It is deduced from the AVStream values. + * + * Demuxing only, set by libavformat. + */ + int64_t start_time; + + /** + * Duration of the stream, in AV_TIME_BASE fractional + * seconds. Only set this value if you know none of the individual stream + * durations and also do not set any of them. This is deduced from the + * AVStream values if not set. + * + * Demuxing only, set by libavformat. + */ + int64_t duration; + + /** + * Total stream bitrate in bit/s, 0 if not + * available. Never set it directly if the file_size and the + * duration are known as FFmpeg can compute it automatically. + */ + int bit_rate; + + unsigned int packet_size; + int max_delay; + + /** + * Flags modifying the (de)muxer behaviour. A combination of AVFMT_FLAG_*. + * Set by the user before avformat_open_input() / avformat_write_header(). + */ + int flags; +#define AVFMT_FLAG_GENPTS 0x0001 ///< Generate missing pts even if it requires parsing future frames. +#define AVFMT_FLAG_IGNIDX 0x0002 ///< Ignore index. +#define AVFMT_FLAG_NONBLOCK 0x0004 ///< Do not block when reading packets from input. +#define AVFMT_FLAG_IGNDTS 0x0008 ///< Ignore DTS on frames that contain both DTS & PTS +#define AVFMT_FLAG_NOFILLIN 0x0010 ///< Do not infer any values from other values, just return what is stored in the container +#define AVFMT_FLAG_NOPARSE 0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled +#define AVFMT_FLAG_NOBUFFER 0x0040 ///< Do not buffer frames when possible +#define AVFMT_FLAG_CUSTOM_IO 0x0080 ///< The caller has supplied a custom AVIOContext, don't avio_close() it. +#define AVFMT_FLAG_DISCARD_CORRUPT 0x0100 ///< Discard frames marked corrupted +#define AVFMT_FLAG_FLUSH_PACKETS 0x0200 ///< Flush the AVIOContext every packet. +/** + * When muxing, try to avoid writing any random/volatile data to the output. + * This includes any random IDs, real-time timestamps/dates, muxer version, etc. + * + * This flag is mainly intended for testing. + */ +#define AVFMT_FLAG_BITEXACT 0x0400 +#define AVFMT_FLAG_MP4A_LATM 0x8000 ///< Enable RTP MP4A-LATM payload +#define AVFMT_FLAG_SORT_DTS 0x10000 ///< try to interleave outputted packets by dts (using this flag can slow demuxing down) +#define AVFMT_FLAG_PRIV_OPT 0x20000 ///< Enable use of private options by delaying codec open (this could be made default once all code is converted) +#define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000 ///< Don't merge side data but keep it separate. + + /** + * @deprecated deprecated in favor of probesize2 + */ + unsigned int probesize; + + /** + * @deprecated deprecated in favor of max_analyze_duration2 + */ + attribute_deprecated + int max_analyze_duration; + + const uint8_t *key; + int keylen; + + unsigned int nb_programs; + AVProgram **programs; + + /** + * Forced video codec_id. + * Demuxing: Set by user. + */ + enum AVCodecID video_codec_id; + + /** + * Forced audio codec_id. + * Demuxing: Set by user. + */ + enum AVCodecID audio_codec_id; + + /** + * Forced subtitle codec_id. + * Demuxing: Set by user. + */ + enum AVCodecID subtitle_codec_id; + + /** + * Maximum amount of memory in bytes to use for the index of each stream. + * If the index exceeds this size, entries will be discarded as + * needed to maintain a smaller size. This can lead to slower or less + * accurate seeking (depends on demuxer). + * Demuxers for which a full in-memory index is mandatory will ignore + * this. + * - muxing: unused + * - demuxing: set by user + */ + unsigned int max_index_size; + + /** + * Maximum amount of memory in bytes to use for buffering frames + * obtained from realtime capture devices. + */ + unsigned int max_picture_buffer; + + /** + * Number of chapters in AVChapter array. + * When muxing, chapters are normally written in the file header, + * so nb_chapters should normally be initialized before write_header + * is called. Some muxers (e.g. mov and mkv) can also write chapters + * in the trailer. To write chapters in the trailer, nb_chapters + * must be zero when write_header is called and non-zero when + * write_trailer is called. + * - muxing: set by user + * - demuxing: set by libavformat + */ + unsigned int nb_chapters; + AVChapter **chapters; + + /** + * Metadata that applies to the whole file. + * + * - demuxing: set by libavformat in avformat_open_input() + * - muxing: may be set by the caller before avformat_write_header() + * + * Freed by libavformat in avformat_free_context(). + */ + AVDictionary *metadata; + + /** + * Start time of the stream in real world time, in microseconds + * since the Unix epoch (00:00 1st January 1970). That is, pts=0 in the + * stream was captured at this real world time. + * - muxing: Set by the caller before avformat_write_header(). If set to + * either 0 or AV_NOPTS_VALUE, then the current wall-time will + * be used. + * - demuxing: Set by libavformat. AV_NOPTS_VALUE if unknown. Note that + * the value may become known after some number of frames + * have been received. + */ + int64_t start_time_realtime; + + /** + * The number of frames used for determining the framerate in + * avformat_find_stream_info(). + * Demuxing only, set by the caller before avformat_find_stream_info(). + */ + int fps_probe_size; + + /** + * Error recognition; higher values will detect more errors but may + * misdetect some more or less valid parts as errors. + * Demuxing only, set by the caller before avformat_open_input(). + */ + int error_recognition; + + /** + * Custom interrupt callbacks for the I/O layer. + * + * demuxing: set by the user before avformat_open_input(). + * muxing: set by the user before avformat_write_header() + * (mainly useful for AVFMT_NOFILE formats). The callback + * should also be passed to avio_open2() if it's used to + * open the file. + */ + AVIOInterruptCB interrupt_callback; + + /** + * Flags to enable debugging. + */ + int debug; +#define FF_FDEBUG_TS 0x0001 + + /** + * Maximum buffering duration for interleaving. + * + * To ensure all the streams are interleaved correctly, + * av_interleaved_write_frame() will wait until it has at least one packet + * for each stream before actually writing any packets to the output file. + * When some streams are "sparse" (i.e. there are large gaps between + * successive packets), this can result in excessive buffering. + * + * This field specifies the maximum difference between the timestamps of the + * first and the last packet in the muxing queue, above which libavformat + * will output a packet regardless of whether it has queued a packet for all + * the streams. + * + * Muxing only, set by the caller before avformat_write_header(). + */ + int64_t max_interleave_delta; + + /** + * Allow non-standard and experimental extension + * @see AVCodecContext.strict_std_compliance + */ + int strict_std_compliance; + + /** + * Flags for the user to detect events happening on the file. Flags must + * be cleared by the user once the event has been handled. + * A combination of AVFMT_EVENT_FLAG_*. + */ + int event_flags; +#define AVFMT_EVENT_FLAG_METADATA_UPDATED 0x0001 ///< The call resulted in updated metadata. + + /** + * Maximum number of packets to read while waiting for the first timestamp. + * Decoding only. + */ + int max_ts_probe; + + /** + * Avoid negative timestamps during muxing. + * Any value of the AVFMT_AVOID_NEG_TS_* constants. + * Note, this only works when using av_interleaved_write_frame. (interleave_packet_per_dts is in use) + * - muxing: Set by user + * - demuxing: unused + */ + int avoid_negative_ts; +#define AVFMT_AVOID_NEG_TS_AUTO -1 ///< Enabled when required by target format +#define AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE 1 ///< Shift timestamps so they are non negative +#define AVFMT_AVOID_NEG_TS_MAKE_ZERO 2 ///< Shift timestamps so that they start at 0 + + + /** + * Transport stream id. + * This will be moved into demuxer private options. Thus no API/ABI compatibility + */ + int ts_id; + + /** + * Audio preload in microseconds. + * Note, not all formats support this and unpredictable things may happen if it is used when not supported. + * - encoding: Set by user via AVOptions (NO direct access) + * - decoding: unused + */ + int audio_preload; + + /** + * Max chunk time in microseconds. + * Note, not all formats support this and unpredictable things may happen if it is used when not supported. + * - encoding: Set by user via AVOptions (NO direct access) + * - decoding: unused + */ + int max_chunk_duration; + + /** + * Max chunk size in bytes + * Note, not all formats support this and unpredictable things may happen if it is used when not supported. + * - encoding: Set by user via AVOptions (NO direct access) + * - decoding: unused + */ + int max_chunk_size; + + /** + * forces the use of wallclock timestamps as pts/dts of packets + * This has undefined results in the presence of B frames. + * - encoding: unused + * - decoding: Set by user via AVOptions (NO direct access) + */ + int use_wallclock_as_timestamps; + + /** + * avio flags, used to force AVIO_FLAG_DIRECT. + * - encoding: unused + * - decoding: Set by user via AVOptions (NO direct access) + */ + int avio_flags; + + /** + * The duration field can be estimated through various ways, and this field can be used + * to know how the duration was estimated. + * - encoding: unused + * - decoding: Read by user via AVOptions (NO direct access) + */ + enum AVDurationEstimationMethod duration_estimation_method; + + /** + * Skip initial bytes when opening stream + * - encoding: unused + * - decoding: Set by user via AVOptions (NO direct access) + */ + int64_t skip_initial_bytes; + + /** + * Correct single timestamp overflows + * - encoding: unused + * - decoding: Set by user via AVOptions (NO direct access) + */ + unsigned int correct_ts_overflow; + + /** + * Force seeking to any (also non key) frames. + * - encoding: unused + * - decoding: Set by user via AVOptions (NO direct access) + */ + int seek2any; + + /** + * Flush the I/O context after each packet. + * - encoding: Set by user via AVOptions (NO direct access) + * - decoding: unused + */ + int flush_packets; + + /** + * format probing score. + * The maximal score is AVPROBE_SCORE_MAX, its set when the demuxer probes + * the format. + * - encoding: unused + * - decoding: set by avformat, read by user via av_format_get_probe_score() (NO direct access) + */ + int probe_score; + + /** + * number of bytes to read maximally to identify format. + * - encoding: unused + * - decoding: set by user through AVOPtions (NO direct access) + */ + int format_probesize; + + /** + * ',' separated list of allowed decoders. + * If NULL then all are allowed + * - encoding: unused + * - decoding: set by user through AVOptions (NO direct access) + */ + char *codec_whitelist; + + /** + * ',' separated list of allowed demuxers. + * If NULL then all are allowed + * - encoding: unused + * - decoding: set by user through AVOptions (NO direct access) + */ + char *format_whitelist; + + /***************************************************************** + * All fields below this line are not part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + + /** + * This buffer is only needed when packets were already buffered but + * not decoded, for example to get the codec parameters in MPEG + * streams. + */ + struct AVPacketList *packet_buffer; + struct AVPacketList *packet_buffer_end; + + /* av_seek_frame() support */ + int64_t data_offset; /**< offset of the first packet */ + + /** + * Raw packets from the demuxer, prior to parsing and decoding. + * This buffer is used for buffering packets until the codec can + * be identified, as parsing cannot be done without knowing the + * codec. + */ + struct AVPacketList *raw_packet_buffer; + struct AVPacketList *raw_packet_buffer_end; + /** + * Packets split by the parser get queued here. + */ + struct AVPacketList *parse_queue; + struct AVPacketList *parse_queue_end; + /** + * Remaining size available for raw_packet_buffer, in bytes. + */ +#define RAW_PACKET_BUFFER_SIZE 2500000 + int raw_packet_buffer_remaining_size; + + /** + * Offset to remap timestamps to be non-negative. + * Expressed in timebase units. + * @see AVStream.mux_ts_offset + */ + int64_t offset; + + /** + * Timebase for the timestamp offset. + */ + AVRational offset_timebase; + + /** + * An opaque field for libavformat internal usage. + * Must not be accessed in any way by callers. + */ + AVFormatInternal *internal; + + /** + * IO repositioned flag. + * This is set by avformat when the underlaying IO context read pointer + * is repositioned, for example when doing byte based seeking. + * Demuxers can use the flag to detect such changes. + */ + int io_repositioned; + + /** + * Forced video codec. + * This allows forcing a specific decoder, even when there are multiple with + * the same codec_id. + * Demuxing: Set by user via av_format_set_video_codec (NO direct access). + */ + AVCodec *video_codec; + + /** + * Forced audio codec. + * This allows forcing a specific decoder, even when there are multiple with + * the same codec_id. + * Demuxing: Set by user via av_format_set_audio_codec (NO direct access). + */ + AVCodec *audio_codec; + + /** + * Forced subtitle codec. + * This allows forcing a specific decoder, even when there are multiple with + * the same codec_id. + * Demuxing: Set by user via av_format_set_subtitle_codec (NO direct access). + */ + AVCodec *subtitle_codec; + + /** + * Number of bytes to be written as padding in a metadata header. + * Demuxing: Unused. + * Muxing: Set by user via av_format_set_metadata_header_padding. + */ + int metadata_header_padding; + + /** + * User data. + * This is a place for some private data of the user. + * Mostly usable with control_message_cb or any future callbacks in device's context. + */ + void *opaque; + + /** + * Callback used by devices to communicate with application. + */ + av_format_control_message control_message_cb; + + /** + * Output timestamp offset, in microseconds. + * Muxing: set by user via AVOptions (NO direct access) + */ + int64_t output_ts_offset; + + /** + * Maximum duration (in AV_TIME_BASE units) of the data read + * from input in avformat_find_stream_info(). + * Demuxing only, set by the caller before avformat_find_stream_info() + * via AVOptions (NO direct access). + * Can be set to 0 to let avformat choose using a heuristic. + */ + int64_t max_analyze_duration2; + + /** + * Maximum size of the data read from input for determining + * the input container format. + * Demuxing only, set by the caller before avformat_open_input() + * via AVOptions (NO direct access). + */ + int64_t probesize2; + + /** + * dump format separator. + * can be ", " or "\n " or anything else + * Code outside libavformat should access this field using AVOptions + * (NO direct access). + * - muxing: Set by user. + * - demuxing: Set by user. + */ + uint8_t *dump_separator; +} AVFormatContext; + +int av_format_get_probe_score(const AVFormatContext *s); + +AVCodec *av_format_get_video_codec(const AVFormatContext *s); + +void av_format_set_video_codec(AVFormatContext *s, AVCodec *c); + +AVCodec *av_format_get_audio_codec(const AVFormatContext *s); + +void av_format_set_audio_codec(AVFormatContext *s, AVCodec *c); + +AVCodec *av_format_get_subtitle_codec(const AVFormatContext *s); + +void av_format_set_subtitle_codec(AVFormatContext *s, AVCodec *c); + +int av_format_get_metadata_header_padding(const AVFormatContext *s); + +void av_format_set_metadata_header_padding(AVFormatContext *s, int c); + +void *av_format_get_opaque(const AVFormatContext *s); + +void av_format_set_opaque(AVFormatContext *s, void *opaque); + +av_format_control_message av_format_get_control_message_cb(const AVFormatContext *s); + +void av_format_set_control_message_cb(AVFormatContext *s, av_format_control_message callback); + +/** + * This function will cause global side data to be injected in the next packet + * of each stream as well as after any subsequent seek. + */ +void av_format_inject_global_side_data(AVFormatContext *s); + +/** + * Returns the method used to set ctx->duration. + * + * @return AVFMT_DURATION_FROM_PTS, AVFMT_DURATION_FROM_STREAM, or AVFMT_DURATION_FROM_BITRATE. + */ +enum AVDurationEstimationMethod +av_fmt_ctx_get_duration_estimation_method(const AVFormatContext *ctx); + +typedef struct AVPacketList { + AVPacket pkt; + struct AVPacketList *next; +} AVPacketList; + + +/** + * @defgroup lavf_core Core functions + * @ingroup libavf + * + * Functions for querying libavformat capabilities, allocating core structures, + * etc. + * @{ + */ + +/** + * Return the LIBAVFORMAT_VERSION_INT constant. + */ +unsigned avformat_version(void); + +/** + * Return the libavformat build-time configuration. + */ +const char *avformat_configuration(void); + +/** + * Return the libavformat license. + */ +const char *avformat_license(void); + +/** + * Initialize libavformat and register all the muxers, demuxers and + * protocols. If you do not call this function, then you can select + * exactly which formats you want to support. + * + * @see av_register_input_format() + * @see av_register_output_format() + */ +void av_register_all(void); + +void av_register_input_format(AVInputFormat *format); + +void av_register_output_format(AVOutputFormat *format); + +/** + * Do global initialization of network components. This is optional, + * but recommended, since it avoids the overhead of implicitly + * doing the setup for each session. + * + * Calling this function will become mandatory if using network + * protocols at some major version bump. + */ +int avformat_network_init(void); + +/** + * Undo the initialization done by avformat_network_init. + */ +int avformat_network_deinit(void); + +/** + * If f is NULL, returns the first registered input format, + * if f is non-NULL, returns the next registered input format after f + * or NULL if f is the last one. + */ +AVInputFormat *av_iformat_next(const AVInputFormat *f); + +/** + * If f is NULL, returns the first registered output format, + * if f is non-NULL, returns the next registered output format after f + * or NULL if f is the last one. + */ +AVOutputFormat *av_oformat_next(const AVOutputFormat *f); + +/** + * Allocate an AVFormatContext. + * avformat_free_context() can be used to free the context and everything + * allocated by the framework within it. + */ +AVFormatContext *avformat_alloc_context(void); + +/** + * Free an AVFormatContext and all its streams. + * @param s context to free + */ +void avformat_free_context(AVFormatContext *s); + +/** + * Get the AVClass for AVFormatContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *avformat_get_class(void); + +/** + * Add a new stream to a media file. + * + * When demuxing, it is called by the demuxer in read_header(). If the + * flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also + * be called in read_packet(). + * + * When muxing, should be called by the user before avformat_write_header(). + * + * User is required to call avcodec_close() and avformat_free_context() to + * clean up the allocation by avformat_new_stream(). + * + * @param s media file handle + * @param c If non-NULL, the AVCodecContext corresponding to the new stream + * will be initialized to use this codec. This is needed for e.g. codec-specific + * defaults to be set, so codec should be provided if it is known. + * + * @return newly created stream or NULL on error. + */ +AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c); + +/** + * Get side information from stream. + * + * @param stream stream + * @param type desired side information type + * @param size pointer for side information size to store (optional) + * @return pointer to data if present or NULL otherwise + */ +uint8_t *av_stream_get_side_data(AVStream *stream, + enum AVPacketSideDataType type, int *size); + +AVProgram *av_new_program(AVFormatContext *s, int id); + +/** + * @} + */ + + +/** + * Allocate an AVFormatContext for an output format. + * avformat_free_context() can be used to free the context and + * everything allocated by the framework within it. + * + * @param *ctx is set to the created format context, or to NULL in + * case of failure + * @param oformat format to use for allocating the context, if NULL + * format_name and filename are used instead + * @param format_name the name of output format to use for allocating the + * context, if NULL filename is used instead + * @param filename the name of the filename to use for allocating the + * context, may be NULL + * @return >= 0 in case of success, a negative AVERROR code in case of + * failure + */ +int avformat_alloc_output_context2(AVFormatContext **ctx, AVOutputFormat *oformat, + const char *format_name, const char *filename); + +/** + * @addtogroup lavf_decoding + * @{ + */ + +/** + * Find AVInputFormat based on the short name of the input format. + */ +AVInputFormat *av_find_input_format(const char *short_name); + +/** + * Guess the file format. + * + * @param pd data to be probed + * @param is_opened Whether the file is already opened; determines whether + * demuxers with or without AVFMT_NOFILE are probed. + */ +AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened); + +/** + * Guess the file format. + * + * @param pd data to be probed + * @param is_opened Whether the file is already opened; determines whether + * demuxers with or without AVFMT_NOFILE are probed. + * @param score_max A probe score larger that this is required to accept a + * detection, the variable is set to the actual detection + * score afterwards. + * If the score is <= AVPROBE_SCORE_MAX / 4 it is recommended + * to retry with a larger probe buffer. + */ +AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max); + +/** + * Guess the file format. + * + * @param is_opened Whether the file is already opened; determines whether + * demuxers with or without AVFMT_NOFILE are probed. + * @param score_ret The score of the best detection. + */ +AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score_ret); + +/** + * Probe a bytestream to determine the input format. Each time a probe returns + * with a score that is too low, the probe buffer size is increased and another + * attempt is made. When the maximum probe size is reached, the input format + * with the highest score is returned. + * + * @param pb the bytestream to probe + * @param fmt the input format is put here + * @param filename the filename of the stream + * @param logctx the log context + * @param offset the offset within the bytestream to probe from + * @param max_probe_size the maximum probe buffer size (zero for default) + * @return the score in case of success, a negative value corresponding to an + * the maximal score is AVPROBE_SCORE_MAX + * AVERROR code otherwise + */ +int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, + const char *filename, void *logctx, + unsigned int offset, unsigned int max_probe_size); + +/** + * Like av_probe_input_buffer2() but returns 0 on success + */ +int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, + const char *filename, void *logctx, + unsigned int offset, unsigned int max_probe_size); + +/** + returns the global variable to the input demuxer specified by the codec_name. +Input: +codec_name: +a string name of the codec, i.e. "h264", "mp4" and "mov" +Returns: +unkown demuxer: NULL +otherwise: ff_h264_demuxer for h264 raw input +ff_mp4_demuxer for mp4 input +ff_mov_demuxer for mpv input + */ +AVInputFormat *avformat_open_specific_input(char *codec_name); + +/** + returns the global variable to the output muxer specified by the codec_name. +Input: +codec_name: +a string name of the codec, i.e. "h264", "mp4" and "mov" +Returns: +unkown muxer: NULL +otherwise: ff_h264_muxer for h264 raw output +ff_mp4_muxer for mp4 output +ff_mov_muxer for mpv output + */ +AVOutputFormat *avformat_open_specific_output(char *codec_name); + +/** + * Open an input stream and read the header. The codecs are not opened. + * The stream must be closed with avformat_close_input(). + * + * @param ps Pointer to user-supplied AVFormatContext (allocated by avformat_alloc_context). + * May be a pointer to NULL, in which case an AVFormatContext is allocated by this + * function and written into ps. + * Note that a user-supplied AVFormatContext will be freed on failure. + * @param filename Name of the stream to open. + * @param fmt If non-NULL, this parameter forces a specific input format. + * Otherwise the format is autodetected. + * @param options A dictionary filled with AVFormatContext and demuxer-private options. + * On return this parameter will be destroyed and replaced with a dict containing + * options that were not found. May be NULL. + * + * @return 0 on success, a negative AVERROR on failure. + * + * @note If you want to use custom IO, preallocate the format context and set its pb field. + */ +int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, + AVDictionary **options); + +attribute_deprecated +int av_demuxer_open(AVFormatContext *ic); + +/** + * Read packets of a media file to get stream information. This + * is useful for file formats with no headers such as MPEG. This + * function also computes the real framerate in case of MPEG-2 repeat + * frame mode. + * The logical file position is not changed by this function; + * examined packets may be buffered for later processing. + * + * @param ic media file handle + * @param options If non-NULL, an ic.nb_streams long array of pointers to + * dictionaries, where i-th member contains options for + * codec corresponding to i-th stream. + * On return each dictionary will be filled with options that were not found. + * @return >=0 if OK, AVERROR_xxx on error + * + * @note this function isn't guaranteed to open all the codecs, so + * options being non-empty at return is a perfectly normal behavior. + * + * @todo Let the user decide somehow what information is needed so that + * we do not waste time getting stuff the user does not need. + */ +int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options); + +/** + * Find the programs which belong to a given stream. + * + * @param ic media file handle + * @param last the last found program, the search will start after this + * program, or from the beginning if it is NULL + * @param s stream index + * @return the next program which belongs to s, NULL if no program is found or + * the last program is not among the programs of ic. + */ +AVProgram *av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s); + +/** + * Find the "best" stream in the file. + * The best stream is determined according to various heuristics as the most + * likely to be what the user expects. + * If the decoder parameter is non-NULL, av_find_best_stream will find the + * default decoder for the stream's codec; streams for which no decoder can + * be found are ignored. + * + * @param ic media file handle + * @param type stream type: video, audio, subtitles, etc. + * @param wanted_stream_nb user-requested stream number, + * or -1 for automatic selection + * @param related_stream try to find a stream related (eg. in the same + * program) to this one, or -1 if none + * @param decoder_ret if non-NULL, returns the decoder for the + * selected stream + * @param flags flags; none are currently defined + * @return the non-negative stream number in case of success, + * AVERROR_STREAM_NOT_FOUND if no stream with the requested type + * could be found, + * AVERROR_DECODER_NOT_FOUND if streams were found but no decoder + * @note If av_find_best_stream returns successfully and decoder_ret is not + * NULL, then *decoder_ret is guaranteed to be set to a valid AVCodec. + */ +int av_find_best_stream(AVFormatContext *ic, + enum AVMediaType type, + int wanted_stream_nb, + int related_stream, + AVCodec **decoder_ret, + int flags); + +/** + * Return the next frame of a stream. + * This function returns what is stored in the file, and does not validate + * that what is there are valid frames for the decoder. It will split what is + * stored in the file into frames and return one for each call. It will not + * omit invalid data between valid frames so as to give the decoder the maximum + * information possible for decoding. + * + * If pkt->buf is NULL, then the packet is valid until the next + * av_read_frame() or until avformat_close_input(). Otherwise the packet + * is valid indefinitely. In both cases the packet must be freed with + * av_free_packet when it is no longer needed. For video, the packet contains + * exactly one frame. For audio, it contains an integer number of frames if each + * frame has a known fixed size (e.g. PCM or ADPCM data). If the audio frames + * have a variable size (e.g. MPEG audio), then it contains one frame. + * + * pkt->pts, pkt->dts and pkt->duration are always set to correct + * values in AVStream.time_base units (and guessed if the format cannot + * provide them). pkt->pts can be AV_NOPTS_VALUE if the video format + * has B-frames, so it is better to rely on pkt->dts if you do not + * decompress the payload. + * + * @return 0 if OK, < 0 on error or end of file + */ +int av_read_frame(AVFormatContext *s, AVPacket *pkt); + +/** + * Seek to the keyframe at timestamp. + * 'timestamp' in 'stream_index'. + * + * @param s media file handle + * @param stream_index If stream_index is (-1), a default + * stream is selected, and timestamp is automatically converted + * from AV_TIME_BASE units to the stream specific time_base. + * @param timestamp Timestamp in AVStream.time_base units + * or, if no stream is specified, in AV_TIME_BASE units. + * @param flags flags which select direction and seeking mode + * @return >= 0 on success + */ +int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, + int flags); + +/** + * Seek to timestamp ts. + * Seeking will be done so that the point from which all active streams + * can be presented successfully will be closest to ts and within min/max_ts. + * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. + * + * If flags contain AVSEEK_FLAG_BYTE, then all timestamps are in bytes and + * are the file position (this may not be supported by all demuxers). + * If flags contain AVSEEK_FLAG_FRAME, then all timestamps are in frames + * in the stream with stream_index (this may not be supported by all demuxers). + * Otherwise all timestamps are in units of the stream selected by stream_index + * or if stream_index is -1, in AV_TIME_BASE units. + * If flags contain AVSEEK_FLAG_ANY, then non-keyframes are treated as + * keyframes (this may not be supported by all demuxers). + * If flags contain AVSEEK_FLAG_BACKWARD, it is ignored. + * + * @param s media file handle + * @param stream_index index of the stream which is used as time base reference + * @param min_ts smallest acceptable timestamp + * @param ts target timestamp + * @param max_ts largest acceptable timestamp + * @param flags flags + * @return >=0 on success, error code otherwise + * + * @note This is part of the new seek API which is still under construction. + * Thus do not use this yet. It may change at any time, do not expect + * ABI compatibility yet! + */ +int +avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, + int flags); + +/** + * Start playing a network-based stream (e.g. RTSP stream) at the + * current position. + */ +int av_read_play(AVFormatContext *s); + +/** + * Pause a network-based stream (e.g. RTSP stream). + * + * Use av_read_play() to resume it. + */ +int av_read_pause(AVFormatContext *s); + +/** + * Close an opened input AVFormatContext. Free it and all its contents + * and set *s to NULL. + */ +void avformat_close_input(AVFormatContext **s); +/** + * @} + */ + +#define AVSEEK_FLAG_BACKWARD 1 ///< seek backward +#define AVSEEK_FLAG_BYTE 2 ///< seeking based on position in bytes +#define AVSEEK_FLAG_ANY 4 ///< seek to any frame, even non-keyframes +#define AVSEEK_FLAG_FRAME 8 ///< seeking based on frame number + +/** + * @addtogroup lavf_encoding + * @{ + */ +/** + * Allocate the stream private data and write the stream header to + * an output media file. + * + * @param s Media file handle, must be allocated with avformat_alloc_context(). + * Its oformat field must be set to the desired output format; + * Its pb field must be set to an already opened AVIOContext. + * @param options An AVDictionary filled with AVFormatContext and muxer-private options. + * On return this parameter will be destroyed and replaced with a dict containing + * options that were not found. May be NULL. + * + * @return 0 on success, negative AVERROR on failure. + * + * @see av_opt_find, av_dict_set, avio_open, av_oformat_next. + */ +int avformat_write_header(AVFormatContext *s, AVDictionary **options); + +/** + * Write a packet to an output media file. + * + * This function passes the packet directly to the muxer, without any buffering + * or reordering. The caller is responsible for correctly interleaving the + * packets if the format requires it. Callers that want libavformat to handle + * the interleaving should call av_interleaved_write_frame() instead of this + * function. + * + * @param s media file handle + * @param pkt The packet containing the data to be written. Note that unlike + * av_interleaved_write_frame(), this function does not take + * ownership of the packet passed to it (though some muxers may make + * an internal reference to the input packet). + * <br> + * This parameter can be NULL (at any time, not just at the end), in + * order to immediately flush data buffered within the muxer, for + * muxers that buffer up data internally before writing it to the + * output. + * <br> + * Packet's @ref AVPacket.stream_index "stream_index" field must be + * set to the index of the corresponding stream in @ref + * AVFormatContext.streams "s->streams". It is very strongly + * recommended that timing information (@ref AVPacket.pts "pts", @ref + * AVPacket.dts "dts", @ref AVPacket.duration "duration") is set to + * correct values. + * @return < 0 on error, = 0 if OK, 1 if flushed and there is no more data to flush + * + * @see av_interleaved_write_frame() + */ +int av_write_frame(AVFormatContext *s, AVPacket *pkt); + +/** + * Write a packet to an output media file ensuring correct interleaving. + * + * This function will buffer the packets internally as needed to make sure the + * packets in the output file are properly interleaved in the order of + * increasing dts. Callers doing their own interleaving should call + * av_write_frame() instead of this function. + * + * @param s media file handle + * @param pkt The packet containing the data to be written. + * <br> + * If the packet is reference-counted, this function will take + * ownership of this reference and unreference it later when it sees + * fit. + * The caller must not access the data through this reference after + * this function returns. If the packet is not reference-counted, + * libavformat will make a copy. + * <br> + * This parameter can be NULL (at any time, not just at the end), to + * flush the interleaving queues. + * <br> + * Packet's @ref AVPacket.stream_index "stream_index" field must be + * set to the index of the corresponding stream in @ref + * AVFormatContext.streams "s->streams". It is very strongly + * recommended that timing information (@ref AVPacket.pts "pts", @ref + * AVPacket.dts "dts", @ref AVPacket.duration "duration") is set to + * correct values. + * + * @return 0 on success, a negative AVERROR on error. Libavformat will always + * take care of freeing the packet, even if this function fails. + * + * @see av_write_frame(), AVFormatContext.max_interleave_delta + */ +int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt); + +/** + * Write a uncoded frame to an output media file. + * + * The frame must be correctly interleaved according to the container + * specification; if not, then av_interleaved_write_frame() must be used. + * + * See av_interleaved_write_frame() for details. + */ +int av_write_uncoded_frame(AVFormatContext *s, int stream_index, + AVFrame *frame); + +/** + * Write a uncoded frame to an output media file. + * + * If the muxer supports it, this function allows to write an AVFrame + * structure directly, without encoding it into a packet. + * It is mostly useful for devices and similar special muxers that use raw + * video or PCM data and will not serialize it into a byte stream. + * + * To test whether it is possible to use it with a given muxer and stream, + * use av_write_uncoded_frame_query(). + * + * The caller gives up ownership of the frame and must not access it + * afterwards. + * + * @return >=0 for success, a negative code on error + */ +int av_interleaved_write_uncoded_frame(AVFormatContext *s, int stream_index, + AVFrame *frame); + +/** + * Test whether a muxer supports uncoded frame. + * + * @return >=0 if an uncoded frame can be written to that muxer and stream, + * <0 if not + */ +int av_write_uncoded_frame_query(AVFormatContext *s, int stream_index); + +/** + * Write the stream trailer to an output media file and free the + * file private data. + * + * May only be called after a successful call to avformat_write_header. + * + * @param s media file handle + * @return 0 if OK, AVERROR_xxx on error + */ +int av_write_trailer(AVFormatContext *s); + +/** + * Return the output format in the list of registered output formats + * which best matches the provided parameters, or return NULL if + * there is no match. + * + * @param short_name if non-NULL checks if short_name matches with the + * names of the registered formats + * @param filename if non-NULL checks if filename terminates with the + * extensions of the registered formats + * @param mime_type if non-NULL checks if mime_type matches with the + * MIME type of the registered formats + */ +AVOutputFormat *av_guess_format(const char *short_name, + const char *filename, + const char *mime_type); + +/** + * Guess the codec ID based upon muxer and filename. + */ +enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, + const char *filename, const char *mime_type, + enum AVMediaType type); + +/** + * Get timing information for the data currently output. + * The exact meaning of "currently output" depends on the format. + * It is mostly relevant for devices that have an internal buffer and/or + * work in real time. + * @param s media file handle + * @param stream stream in the media file + * @param[out] dts DTS of the last packet output for the stream, in stream + * time_base units + * @param[out] wall absolute time when that packet whas output, + * in microsecond + * @return 0 if OK, AVERROR(ENOSYS) if the format does not support it + * Note: some formats or devices may not allow to measure dts and wall + * atomically. + */ +int av_get_output_timestamp(struct AVFormatContext *s, int stream, + int64_t *dts, int64_t *wall); + + +/** + * @} + */ + + +/** + * @defgroup lavf_misc Utility functions + * @ingroup libavf + * @{ + * + * Miscellaneous utility functions related to both muxing and demuxing + * (or neither). + */ + +/** + * Send a nice hexadecimal dump of a buffer to the specified file stream. + * + * @param f The file stream pointer where the dump should be sent to. + * @param buf buffer + * @param size buffer size + * + * @see av_hex_dump_log, av_pkt_dump2, av_pkt_dump_log2 + */ +void av_hex_dump(FILE *f, const uint8_t *buf, int size); + +/** + * Send a nice hexadecimal dump of a buffer to the log. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message, lower values signifying + * higher importance. + * @param buf buffer + * @param size buffer size + * + * @see av_hex_dump, av_pkt_dump2, av_pkt_dump_log2 + */ +void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size); + +/** + * Send a nice dump of a packet to the specified file stream. + * + * @param f The file stream pointer where the dump should be sent to. + * @param pkt packet to dump + * @param dump_payload True if the payload must be displayed, too. + * @param st AVStream that the packet belongs to + */ +void av_pkt_dump2(FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st); + + +/** + * Send a nice dump of a packet to the log. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message, lower values signifying + * higher importance. + * @param pkt packet to dump + * @param dump_payload True if the payload must be displayed, too. + * @param st AVStream that the packet belongs to + */ +void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_payload, + const AVStream *st); + +/** + * Get the AVCodecID for the given codec tag tag. + * If no codec id is found returns AV_CODEC_ID_NONE. + * + * @param tags list of supported codec_id-codec_tag pairs, as stored + * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag + * @param tag codec tag to match to a codec ID + */ +enum AVCodecID av_codec_get_id(const struct AVCodecTag *const *tags, unsigned int tag); + +/** + * Get the codec tag for the given codec id id. + * If no codec tag is found returns 0. + * + * @param tags list of supported codec_id-codec_tag pairs, as stored + * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag + * @param id codec ID to match to a codec tag + */ +unsigned int av_codec_get_tag(const struct AVCodecTag *const *tags, enum AVCodecID id); + +/** + * Get the codec tag for the given codec id. + * + * @param tags list of supported codec_id - codec_tag pairs, as stored + * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag + * @param id codec id that should be searched for in the list + * @param tag A pointer to the found tag + * @return 0 if id was not found in tags, > 0 if it was found + */ +int av_codec_get_tag2(const struct AVCodecTag *const *tags, enum AVCodecID id, + unsigned int *tag); + +int av_find_default_stream_index(AVFormatContext *s); + +/** + * Get the index for a specific timestamp. + * + * @param st stream that the timestamp belongs to + * @param timestamp timestamp to retrieve the index for + * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond + * to the timestamp which is <= the requested one, if backward + * is 0, then it will be >= + * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise + * @return < 0 if no such timestamp could be found + */ +int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags); + +/** + * Add an index entry into a sorted list. Update the entry if the list + * already contains it. + * + * @param timestamp timestamp in the time base of the given stream + */ +int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, + int size, int distance, int flags); + + +/** + * Split a URL string into components. + * + * The pointers to buffers for storing individual components may be null, + * in order to ignore that component. Buffers for components not found are + * set to empty strings. If the port is not found, it is set to a negative + * value. + * + * @param proto the buffer for the protocol + * @param proto_size the size of the proto buffer + * @param authorization the buffer for the authorization + * @param authorization_size the size of the authorization buffer + * @param hostname the buffer for the host name + * @param hostname_size the size of the hostname buffer + * @param port_ptr a pointer to store the port number in + * @param path the buffer for the path + * @param path_size the size of the path buffer + * @param url the URL to split + */ +void av_url_split(char *proto, int proto_size, + char *authorization, int authorization_size, + char *hostname, int hostname_size, + int *port_ptr, + char *path, int path_size, + const char *url); + + +/** + * Print detailed information about the input or output format, such as + * duration, bitrate, streams, container, programs, metadata, side data, + * codec and time base. + * + * @param ic the context to analyze + * @param index index of the stream to dump information about + * @param url the URL to print, such as source or destination file + * @param is_output Select whether the specified context is an input(0) or output(1) + */ +void av_dump_format(AVFormatContext *ic, + int index, + const char *url, + int is_output); + +/** + * Return in 'buf' the path with '%d' replaced by a number. + * + * Also handles the '%0nd' format where 'n' is the total number + * of digits and '%%'. + * + * @param buf destination buffer + * @param buf_size destination buffer size + * @param path numbered sequence string + * @param number frame number + * @return 0 if OK, -1 on format error + */ +int av_get_frame_filename(char *buf, int buf_size, + const char *path, int number); + +/** + * Check whether filename actually is a numbered sequence generator. + * + * @param filename possible numbered sequence string + * @return 1 if a valid numbered sequence string, 0 otherwise + */ +int av_filename_number_test(const char *filename); + +/** + * Generate an SDP for an RTP session. + * + * Note, this overwrites the id values of AVStreams in the muxer contexts + * for getting unique dynamic payload types. + * + * @param ac array of AVFormatContexts describing the RTP streams. If the + * array is composed by only one context, such context can contain + * multiple AVStreams (one AVStream per RTP stream). Otherwise, + * all the contexts in the array (an AVCodecContext per RTP stream) + * must contain only one AVStream. + * @param n_files number of AVCodecContexts contained in ac + * @param buf buffer where the SDP will be stored (must be allocated by + * the caller) + * @param size the size of the buffer + * @return 0 if OK, AVERROR_xxx on error + */ +int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size); + +/** + * Return a positive value if the given filename has one of the given + * extensions, 0 otherwise. + * + * @param filename file name to check against the given extensions + * @param extensions a comma-separated list of filename extensions + */ +int av_match_ext(const char *filename, const char *extensions); + +/** + * Test if the given container can store a codec. + * + * @param ofmt container to check for compatibility + * @param codec_id codec to potentially store in container + * @param std_compliance standards compliance level, one of FF_COMPLIANCE_* + * + * @return 1 if codec with ID codec_id can be stored in ofmt, 0 if it cannot. + * A negative number if this information is not available. + */ +int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id, + int std_compliance); + +/** + * @defgroup riff_fourcc RIFF FourCCs + * @{ + * Get the tables mapping RIFF FourCCs to libavcodec AVCodecIDs. The tables are + * meant to be passed to av_codec_get_id()/av_codec_get_tag() as in the + * following code: + * @code + * uint32_t tag = MKTAG('H', '2', '6', '4'); + * const struct AVCodecTag *table[] = { avformat_get_riff_video_tags(), 0 }; + * enum AVCodecID id = av_codec_get_id(table, tag); + * @endcode + */ +/** + * @return the table mapping RIFF FourCCs for video to libavcodec AVCodecID. + */ +const struct AVCodecTag *avformat_get_riff_video_tags(void); + +/** + * @return the table mapping RIFF FourCCs for audio to AVCodecID. + */ +const struct AVCodecTag *avformat_get_riff_audio_tags(void); + +/** + * @return the table mapping MOV FourCCs for video to libavcodec AVCodecID. + */ +const struct AVCodecTag *avformat_get_mov_video_tags(void); + +/** + * @return the table mapping MOV FourCCs for audio to AVCodecID. + */ +const struct AVCodecTag *avformat_get_mov_audio_tags(void); + +/** + * @} + */ + +/** + * Guess the sample aspect ratio of a frame, based on both the stream and the + * frame aspect ratio. + * + * Since the frame aspect ratio is set by the codec but the stream aspect ratio + * is set by the demuxer, these two may not be equal. This function tries to + * return the value that you should use if you would like to display the frame. + * + * Basic logic is to use the stream aspect ratio if it is set to something sane + * otherwise use the frame aspect ratio. This way a container setting, which is + * usually easy to modify can override the coded value in the frames. + * + * @param format the format context which the stream is part of + * @param stream the stream which the frame is part of + * @param frame the frame with the aspect ratio to be determined + * @return the guessed (valid) sample_aspect_ratio, 0/1 if no idea + */ +AVRational av_guess_sample_aspect_ratio(AVFormatContext *format, AVStream *stream, AVFrame *frame); + +/** + * Guess the frame rate, based on both the container and codec information. + * + * @param ctx the format context which the stream is part of + * @param stream the stream which the frame is part of + * @param frame the frame for which the frame rate should be determined, may be NULL + * @return the guessed (valid) frame rate, 0/1 if no idea + */ +AVRational av_guess_frame_rate(AVFormatContext *ctx, AVStream *stream, AVFrame *frame); + +/** + * Check if the stream st contained in s is matched by the stream specifier + * spec. + * + * See the "stream specifiers" chapter in the documentation for the syntax + * of spec. + * + * @return >0 if st is matched by spec; + * 0 if st is not matched by spec; + * AVERROR code if spec is invalid + * + * @note A stream specifier can match several streams in the format. + */ +int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, + const char *spec); + +int avformat_queue_attached_pictures(AVFormatContext *s); + + +/** + * @} + */ + +#endif /* AVFORMAT_AVFORMAT_H */ diff --git a/app/src/main/cpp/include/libavformat/avio.h b/app/src/main/cpp/include/libavformat/avio.h new file mode 100644 index 0000000..3a0e21a --- /dev/null +++ b/app/src/main/cpp/include/libavformat/avio.h @@ -0,0 +1,582 @@ +/* + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef AVFORMAT_AVIO_H +#define AVFORMAT_AVIO_H + +/** + * @file + * @ingroup lavf_io + * Buffered I/O operations + */ + +#include <stdint.h> + +#include "libavutil/common.h" +#include "libavutil/dict.h" +#include "libavutil/log.h" + +#include "libavformat/version.h" + + +#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */ + +/** + * Callback for checking whether to abort blocking functions. + * AVERROR_EXIT is returned in this case by the interrupted + * function. During blocking operations, callback is called with + * opaque as parameter. If the callback returns 1, the + * blocking operation will be aborted. + * + * No members can be added to this struct without a major bump, if + * new elements have been added after this struct in AVFormatContext + * or AVIOContext. + */ +typedef struct AVIOInterruptCB { + int (*callback)(void *); + + void *opaque; +} AVIOInterruptCB; + +/** + * Bytestream IO Context. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVIOContext) must not be used outside libav*. + * + * @note None of the function pointers in AVIOContext should be called + * directly, they should only be set by the client application + * when implementing custom I/O. Normally these are set to the + * function pointers specified in avio_alloc_context() + */ +typedef struct AVIOContext { + /** + * A class for private options. + * + * If this AVIOContext is created by avio_open2(), av_class is set and + * passes the options down to protocols. + * + * If this AVIOContext is manually allocated, then av_class may be set by + * the caller. + * + * warning -- this field can be NULL, be sure to not pass this AVIOContext + * to any av_opt_* functions in that case. + */ + const AVClass *av_class; + unsigned char *buffer; /**< Start of the buffer. */ + int buffer_size; /**< Maximum buffer size */ + unsigned char *buf_ptr; /**< Current position in the buffer */ + unsigned char *buf_end; /**< End of the data, may be less than + buffer+buffer_size if the read function returned + less data than requested, e.g. for streams where + no more data has been received yet. */ + void *opaque; /**< A private pointer, passed to the read/write/seek/... + functions. */ + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); + + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size); + + int64_t (*seek)(void *opaque, int64_t offset, int whence); + + int64_t pos; /**< position in the file of the current buffer */ + int must_flush; /**< true if the next seek should flush */ + int eof_reached; /**< true if eof reached */ + int write_flag; /**< true if open for writing */ + int max_packet_size; + unsigned long checksum; + unsigned char *checksum_ptr; + + unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size); + + int error; /**< contains the error code or 0 if no error happened */ + /** + * Pause or resume playback for network streaming protocols - e.g. MMS. + */ + int (*read_pause)(void *opaque, int pause); + + /** + * Seek to a given timestamp in stream with the specified stream_index. + * Needed for some network streaming protocols which don't support seeking + * to byte position. + */ + int64_t (*read_seek)(void *opaque, int stream_index, + int64_t timestamp, int flags); + + /** + * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable. + */ + int seekable; + + /** + * max filesize, used to limit allocations + * This field is internal to libavformat and access from outside is not allowed. + */ + int64_t maxsize; + + /** + * avio_read and avio_write should if possible be satisfied directly + * instead of going through a buffer, and avio_seek will always + * call the underlying seek function directly. + */ + int direct; + + /** + * Bytes read statistic + * This field is internal to libavformat and access from outside is not allowed. + */ + int64_t bytes_read; + + /** + * seek statistic + * This field is internal to libavformat and access from outside is not allowed. + */ + int seek_count; + + /** + * writeout statistic + * This field is internal to libavformat and access from outside is not allowed. + */ + int writeout_count; + + /** + * Original buffer size + * used internally after probing and ensure seekback to reset the buffer size + * This field is internal to libavformat and access from outside is not allowed. + */ + int orig_buffer_size; +} AVIOContext; + +/* unbuffered I/O */ + +/** + * Return the name of the protocol that will handle the passed URL. + * + * NULL is returned if no protocol could be found for the given URL. + * + * @return Name of the protocol or NULL. + */ +const char *avio_find_protocol_name(const char *url); + +/** + * Return AVIO_FLAG_* access flags corresponding to the access permissions + * of the resource in url, or a negative value corresponding to an + * AVERROR code in case of failure. The returned access flags are + * masked by the value in flags. + * + * @note This function is intrinsically unsafe, in the sense that the + * checked resource may change its existence or permission status from + * one call to another. Thus you should not trust the returned value, + * unless you are sure that no other processes are accessing the + * checked resource. + */ +int avio_check(const char *url, int flags); + +/** + * Allocate and initialize an AVIOContext for buffered I/O. It must be later + * freed with av_free(). + * + * @param buffer Memory block for input/output operations via AVIOContext. + * The buffer must be allocated with av_malloc() and friends. + * It may be freed and replaced with a new buffer by libavformat. + * AVIOContext.buffer holds the buffer currently in use, + * which must be later freed with av_free(). + * @param buffer_size The buffer size is very important for performance. + * For protocols with fixed blocksize it should be set to this blocksize. + * For others a typical size is a cache page, e.g. 4kb. + * @param write_flag Set to 1 if the buffer should be writable, 0 otherwise. + * @param opaque An opaque pointer to user-specific data. + * @param read_packet A function for refilling the buffer, may be NULL. + * @param write_packet A function for writing the buffer contents, may be NULL. + * The function may not change the input buffers content. + * @param seek A function for seeking to specified byte position, may be NULL. + * + * @return Allocated AVIOContext or NULL on failure. + */ +AVIOContext *avio_alloc_context( + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + int64_t (*seek)(void *opaque, int64_t offset, int whence)); + +void avio_w8(AVIOContext *s, int b); + +void avio_write(AVIOContext *s, const unsigned char *buf, int size); + +void avio_wl64(AVIOContext *s, uint64_t val); + +void avio_wb64(AVIOContext *s, uint64_t val); + +void avio_wl32(AVIOContext *s, unsigned int val); + +void avio_wb32(AVIOContext *s, unsigned int val); + +void avio_wl24(AVIOContext *s, unsigned int val); + +void avio_wb24(AVIOContext *s, unsigned int val); + +void avio_wl16(AVIOContext *s, unsigned int val); + +void avio_wb16(AVIOContext *s, unsigned int val); + +/** + * Write a NULL-terminated string. + * @return number of bytes written. + */ +int avio_put_str(AVIOContext *s, const char *str); + +/** + * Convert an UTF-8 string to UTF-16LE and write it. + * @return number of bytes written. + */ +int avio_put_str16le(AVIOContext *s, const char *str); + +/** + * Passing this as the "whence" parameter to a seek function causes it to + * return the filesize without seeking anywhere. Supporting this is optional. + * If it is not supported then the seek function will return <0. + */ +#define AVSEEK_SIZE 0x10000 + +/** + * Oring this flag as into the "whence" parameter to a seek function causes it to + * seek by any means (like reopening and linear reading) or other normally unreasonable + * means that can be extremely slow. + * This may be ignored by the seek code. + */ +#define AVSEEK_FORCE 0x20000 + +/** + * fseek() equivalent for AVIOContext. + * @return new position or AVERROR. + */ +int64_t avio_seek(AVIOContext *s, int64_t offset, int whence); + +/** + * Skip given number of bytes forward + * @return new position or AVERROR. + */ +int64_t avio_skip(AVIOContext *s, int64_t offset); + +/** + * ftell() equivalent for AVIOContext. + * @return position or AVERROR. + */ +static av_always_inline int64_t +avio_tell(AVIOContext +*s) +{ +return +avio_seek(s, +0, SEEK_CUR); +} + +/** + * Get the filesize. + * @return filesize or AVERROR + */ +int64_t avio_size(AVIOContext *s); + +/** + * feof() equivalent for AVIOContext. + * @return non zero if and only if end of file + */ +int avio_feof(AVIOContext *s); + +#if FF_API_URL_FEOF +/** + * @deprecated use avio_feof() + */ +attribute_deprecated +int url_feof(AVIOContext *s); +#endif + +/** @warning currently size is limited */ +int avio_printf(AVIOContext *s, const char *fmt, ...) + +av_printf_format(2, 3); + +/** + * Force flushing of buffered data. + * + * For write streams, force the buffered data to be immediately written to the output, + * without to wait to fill the internal buffer. + * + * For read streams, discard all currently buffered data, and advance the + * reported file position to that of the underlying stream. This does not + * read new data, and does not perform any seeks. + */ +void avio_flush(AVIOContext *s); + +/** + * Read size bytes from AVIOContext into buf. + * @return number of bytes read or AVERROR + */ +int avio_read(AVIOContext *s, unsigned char *buf, int size); + +/** + * @name Functions for reading from AVIOContext + * @{ + * + * @note return 0 if EOF, so you cannot use it if EOF handling is + * necessary + */ +int avio_r8(AVIOContext *s); + +unsigned int avio_rl16(AVIOContext *s); + +unsigned int avio_rl24(AVIOContext *s); + +unsigned int avio_rl32(AVIOContext *s); + +uint64_t avio_rl64(AVIOContext *s); + +unsigned int avio_rb16(AVIOContext *s); + +unsigned int avio_rb24(AVIOContext *s); + +unsigned int avio_rb32(AVIOContext *s); + +uint64_t avio_rb64(AVIOContext *s); +/** + * @} + */ + +/** + * Read a string from pb into buf. The reading will terminate when either + * a NULL character was encountered, maxlen bytes have been read, or nothing + * more can be read from pb. The result is guaranteed to be NULL-terminated, it + * will be truncated if buf is too small. + * Note that the string is not interpreted or validated in any way, it + * might get truncated in the middle of a sequence for multi-byte encodings. + * + * @return number of bytes read (is always <= maxlen). + * If reading ends on EOF or error, the return value will be one more than + * bytes actually read. + */ +int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen); + +/** + * Read a UTF-16 string from pb and convert it to UTF-8. + * The reading will terminate when either a null or invalid character was + * encountered or maxlen bytes have been read. + * @return number of bytes read (is always <= maxlen) + */ +int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen); + +int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); + + +/** + * @name URL open modes + * The flags argument to avio_open must be one of the following + * constants, optionally ORed with other flags. + * @{ + */ +#define AVIO_FLAG_READ 1 /**< read-only */ +#define AVIO_FLAG_WRITE 2 /**< write-only */ +#define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE) /**< read-write pseudo flag */ +/** + * @} + */ + +/** + * Use non-blocking mode. + * If this flag is set, operations on the context will return + * AVERROR(EAGAIN) if they can not be performed immediately. + * If this flag is not set, operations on the context will never return + * AVERROR(EAGAIN). + * Note that this flag does not affect the opening/connecting of the + * context. Connecting a protocol will always block if necessary (e.g. on + * network protocols) but never hang (e.g. on busy devices). + * Warning: non-blocking protocols is work-in-progress; this flag may be + * silently ignored. + */ +#define AVIO_FLAG_NONBLOCK 8 + +/** + * Use direct mode. + * avio_read and avio_write should if possible be satisfied directly + * instead of going through a buffer, and avio_seek will always + * call the underlying seek function directly. + */ +#define AVIO_FLAG_DIRECT 0x8000 + +/** + * Create and initialize a AVIOContext for accessing the + * resource indicated by url. + * @note When the resource indicated by url has been opened in + * read+write mode, the AVIOContext can be used only for writing. + * + * @param s Used to return the pointer to the created AVIOContext. + * In case of failure the pointed to value is set to NULL. + * @param url resource to access + * @param flags flags which control how the resource indicated by url + * is to be opened + * @return >= 0 in case of success, a negative value corresponding to an + * AVERROR code in case of failure + */ +int avio_open(AVIOContext **s, const char *url, int flags); + +/** + * Create and initialize a AVIOContext for accessing the + * resource indicated by url. + * @note When the resource indicated by url has been opened in + * read+write mode, the AVIOContext can be used only for writing. + * + * @param s Used to return the pointer to the created AVIOContext. + * In case of failure the pointed to value is set to NULL. + * @param url resource to access + * @param flags flags which control how the resource indicated by url + * is to be opened + * @param int_cb an interrupt callback to be used at the protocols level + * @param options A dictionary filled with protocol-private options. On return + * this parameter will be destroyed and replaced with a dict containing options + * that were not found. May be NULL. + * @return >= 0 in case of success, a negative value corresponding to an + * AVERROR code in case of failure + */ +int avio_open2(AVIOContext **s, const char *url, int flags, + const AVIOInterruptCB *int_cb, AVDictionary **options); + +/** + * Close the resource accessed by the AVIOContext s and free it. + * This function can only be used if s was opened by avio_open(). + * + * The internal buffer is automatically flushed before closing the + * resource. + * + * @return 0 on success, an AVERROR < 0 on error. + * @see avio_closep + */ +int avio_close(AVIOContext *s); + +/** + * Open the resource accessed by the AVIOContext: + * The pb it openned is an empty one. Data is get from external device + * which is not accessable by ffmpeg + * + * @return 0 on success, an AVERROR < 0 on error. + * @see avio_closep + */ + +int avio_open_stream(AVIOContext **s); + +/** + * Close the resource accessed by the AVIOContext s and free it. + * This function can only be used if s was opened by avio_open_stream(). + * + * @return 0 on success, an AVERROR < 0 on error. + * @see avio_closep + */ +int avio_close_stream(AVIOContext *s); + + +/** + * Close the resource accessed by the AVIOContext *s, free it + * and set the pointer pointing to it to NULL. + * This function can only be used if s was opened by avio_open(). + * + * The internal buffer is automatically flushed before closing the + * resource. + * + * @return 0 on success, an AVERROR < 0 on error. + * @see avio_close + */ +int avio_closep(AVIOContext **s); + + +/** + * Open a write only memory stream. + * + * @param s new IO context + * @return zero if no error. + */ +int avio_open_dyn_buf(AVIOContext **s); + +/** + * Return the written size and a pointer to the buffer. The buffer + * must be freed with av_free(). + * Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer. + * + * @param s IO context + * @param pbuffer pointer to a byte buffer + * @return the length of the byte buffer + */ +int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); + +/** + * Iterate through names of available protocols. + * + * @param opaque A private pointer representing current protocol. + * It must be a pointer to NULL on first iteration and will + * be updated by successive calls to avio_enum_protocols. + * @param output If set to 1, iterate over output protocols, + * otherwise over input protocols. + * + * @return A static string containing the name of current protocol or NULL + */ +const char *avio_enum_protocols(void **opaque, int output); + +/** + * Pause and resume playing - only meaningful if using a network streaming + * protocol (e.g. MMS). + * + * @param h IO context from which to call the read_pause function pointer + * @param pause 1 for pause, 0 for resume + */ +int avio_pause(AVIOContext *h, int pause); + +/** + * Seek to a given timestamp relative to some component stream. + * Only meaningful if using a network streaming protocol (e.g. MMS.). + * + * @param h IO context from which to call the seek function pointers + * @param stream_index The stream index that the timestamp is relative to. + * If stream_index is (-1) the timestamp should be in AV_TIME_BASE + * units from the beginning of the presentation. + * If a stream_index >= 0 is used and the protocol does not support + * seeking based on component streams, the call will fail. + * @param timestamp timestamp in AVStream.time_base units + * or if there is no stream specified then in AV_TIME_BASE units. + * @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE + * and AVSEEK_FLAG_ANY. The protocol may silently ignore + * AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will + * fail if used and not supported. + * @return >= 0 on success + * @see AVInputFormat::read_seek + */ +int64_t avio_seek_time(AVIOContext *h, int stream_index, + int64_t timestamp, int flags); + +/* Avoid a warning. The header can not be included because it breaks c++. */ +struct AVBPrint; + +/** + * Read contents of h into print buffer, up to max_size bytes, or up to EOF. + * + * @return 0 for success (max_size bytes read or EOF reached), negative error + * code otherwise + */ +int avio_read_to_bprint(AVIOContext *h, struct AVBPrint *pb, size_t max_size); + +#endif /* AVFORMAT_AVIO_H */ diff --git a/app/src/main/cpp/include/libavformat/version.h b/app/src/main/cpp/include/libavformat/version.h new file mode 100644 index 0000000..bb86e98 --- /dev/null +++ b/app/src/main/cpp/include/libavformat/version.h @@ -0,0 +1,67 @@ +/* + * Version macros. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_VERSION_H +#define AVFORMAT_VERSION_H + +/** + * @file + * @ingroup libavf + * Libavformat version macros + */ + +#include "libavutil/version.h" + +#define LIBAVFORMAT_VERSION_MAJOR 56 +#define LIBAVFORMAT_VERSION_MINOR 15 +#define LIBAVFORMAT_VERSION_MICRO 102 + +#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ + LIBAVFORMAT_VERSION_MINOR, \ + LIBAVFORMAT_VERSION_MICRO) +#define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \ + LIBAVFORMAT_VERSION_MINOR, \ + LIBAVFORMAT_VERSION_MICRO) +#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT + +#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + */ +#ifndef FF_API_LAVF_BITEXACT +#define FF_API_LAVF_BITEXACT (LIBAVFORMAT_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_LAVF_FRAC +#define FF_API_LAVF_FRAC (LIBAVFORMAT_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_LAVF_CODEC_TB +#define FF_API_LAVF_CODEC_TB (LIBAVFORMAT_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_URL_FEOF +#define FF_API_URL_FEOF (LIBAVFORMAT_VERSION_MAJOR < 57) +#endif + +#ifndef FF_API_R_FRAME_RATE +#define FF_API_R_FRAME_RATE 1 +#endif +#endif /* AVFORMAT_VERSION_H */ diff --git a/app/src/main/cpp/include/libavresample/avresample.h b/app/src/main/cpp/include/libavresample/avresample.h new file mode 100644 index 0000000..7aee12d --- /dev/null +++ b/app/src/main/cpp/include/libavresample/avresample.h @@ -0,0 +1,498 @@ +/* + * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVRESAMPLE_AVRESAMPLE_H +#define AVRESAMPLE_AVRESAMPLE_H + +/** + * @file + * @ingroup lavr + * external API header + */ + +/** + * @defgroup lavr Libavresample + * @{ + * + * Libavresample (lavr) is a library that handles audio resampling, sample + * format conversion and mixing. + * + * Interaction with lavr is done through AVAudioResampleContext, which is + * allocated with avresample_alloc_context(). It is opaque, so all parameters + * must be set with the @ref avoptions API. + * + * For example the following code will setup conversion from planar float sample + * format to interleaved signed 16-bit integer, downsampling from 48kHz to + * 44.1kHz and downmixing from 5.1 channels to stereo (using the default mixing + * matrix): + * @code + * AVAudioResampleContext *avr = avresample_alloc_context(); + * av_opt_set_int(avr, "in_channel_layout", AV_CH_LAYOUT_5POINT1, 0); + * av_opt_set_int(avr, "out_channel_layout", AV_CH_LAYOUT_STEREO, 0); + * av_opt_set_int(avr, "in_sample_rate", 48000, 0); + * av_opt_set_int(avr, "out_sample_rate", 44100, 0); + * av_opt_set_int(avr, "in_sample_fmt", AV_SAMPLE_FMT_FLTP, 0); + * av_opt_set_int(avr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0); + * @endcode + * + * Once the context is initialized, it must be opened with avresample_open(). If + * you need to change the conversion parameters, you must close the context with + * avresample_close(), change the parameters as described above, then reopen it + * again. + * + * The conversion itself is done by repeatedly calling avresample_convert(). + * Note that the samples may get buffered in two places in lavr. The first one + * is the output FIFO, where the samples end up if the output buffer is not + * large enough. The data stored in there may be retrieved at any time with + * avresample_read(). The second place is the resampling delay buffer, + * applicable only when resampling is done. The samples in it require more input + * before they can be processed. Their current amount is returned by + * avresample_get_delay(). At the end of conversion the resampling buffer can be + * flushed by calling avresample_convert() with NULL input. + * + * The following code demonstrates the conversion loop assuming the parameters + * from above and caller-defined functions get_input() and handle_output(): + * @code + * uint8_t **input; + * int in_linesize, in_samples; + * + * while (get_input(&input, &in_linesize, &in_samples)) { + * uint8_t *output + * int out_linesize; + * int out_samples = avresample_get_out_samples(avr, in_samples); + * + * av_samples_alloc(&output, &out_linesize, 2, out_samples, + * AV_SAMPLE_FMT_S16, 0); + * out_samples = avresample_convert(avr, &output, out_linesize, out_samples, + * input, in_linesize, in_samples); + * handle_output(output, out_linesize, out_samples); + * av_freep(&output); + * } + * @endcode + * + * When the conversion is finished and the FIFOs are flushed if required, the + * conversion context and everything associated with it must be freed with + * avresample_free(). + */ + +#include "libavutil/avutil.h" +#include "libavutil/channel_layout.h" +#include "libavutil/dict.h" +#include "libavutil/frame.h" +#include "libavutil/log.h" +#include "libavutil/mathematics.h" + +#include "libavresample/version.h" + +#define AVRESAMPLE_MAX_CHANNELS 32 + +typedef struct AVAudioResampleContext AVAudioResampleContext; + +/** Mixing Coefficient Types */ +enum AVMixCoeffType { + AV_MIX_COEFF_TYPE_Q8, /** 16-bit 8.8 fixed-point */ + AV_MIX_COEFF_TYPE_Q15, /** 32-bit 17.15 fixed-point */ + AV_MIX_COEFF_TYPE_FLT, /** floating-point */ + AV_MIX_COEFF_TYPE_NB, /** Number of coeff types. Not part of ABI */ +}; + +/** Resampling Filter Types */ +enum AVResampleFilterType { + AV_RESAMPLE_FILTER_TYPE_CUBIC, /**< Cubic */ + AV_RESAMPLE_FILTER_TYPE_BLACKMAN_NUTTALL, /**< Blackman Nuttall Windowed Sinc */ + AV_RESAMPLE_FILTER_TYPE_KAISER, /**< Kaiser Windowed Sinc */ +}; + +enum AVResampleDitherMethod { + AV_RESAMPLE_DITHER_NONE, /**< Do not use dithering */ + AV_RESAMPLE_DITHER_RECTANGULAR, /**< Rectangular Dither */ + AV_RESAMPLE_DITHER_TRIANGULAR, /**< Triangular Dither*/ + AV_RESAMPLE_DITHER_TRIANGULAR_HP, /**< Triangular Dither with High Pass */ + AV_RESAMPLE_DITHER_TRIANGULAR_NS, /**< Triangular Dither with Noise Shaping */ + AV_RESAMPLE_DITHER_NB, /**< Number of dither types. Not part of ABI. */ +}; + +/** + * Return the LIBAVRESAMPLE_VERSION_INT constant. + */ +unsigned avresample_version(void); + +/** + * Return the libavresample build-time configuration. + * @return configure string + */ +const char *avresample_configuration(void); + +/** + * Return the libavresample license. + */ +const char *avresample_license(void); + +/** + * Get the AVClass for AVAudioResampleContext. + * + * Can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options + * without allocating a context. + * + * @see av_opt_find(). + * + * @return AVClass for AVAudioResampleContext + */ +const AVClass *avresample_get_class(void); + +/** + * Allocate AVAudioResampleContext and set options. + * + * @return allocated audio resample context, or NULL on failure + */ +AVAudioResampleContext *avresample_alloc_context(void); + +/** + * Initialize AVAudioResampleContext. + * @note The context must be configured using the AVOption API. + * + * @see av_opt_set_int() + * @see av_opt_set_dict() + * + * @param avr audio resample context + * @return 0 on success, negative AVERROR code on failure + */ +int avresample_open(AVAudioResampleContext *avr); + +/** + * Check whether an AVAudioResampleContext is open or closed. + * + * @param avr AVAudioResampleContext to check + * @return 1 if avr is open, 0 if avr is closed. + */ +int avresample_is_open(AVAudioResampleContext *avr); + +/** + * Close AVAudioResampleContext. + * + * This closes the context, but it does not change the parameters. The context + * can be reopened with avresample_open(). It does, however, clear the output + * FIFO and any remaining leftover samples in the resampling delay buffer. If + * there was a custom matrix being used, that is also cleared. + * + * @see avresample_convert() + * @see avresample_set_matrix() + * + * @param avr audio resample context + */ +void avresample_close(AVAudioResampleContext *avr); + +/** + * Free AVAudioResampleContext and associated AVOption values. + * + * This also calls avresample_close() before freeing. + * + * @param avr audio resample context + */ +void avresample_free(AVAudioResampleContext **avr); + +/** + * Generate a channel mixing matrix. + * + * This function is the one used internally by libavresample for building the + * default mixing matrix. It is made public just as a utility function for + * building custom matrices. + * + * @param in_layout input channel layout + * @param out_layout output channel layout + * @param center_mix_level mix level for the center channel + * @param surround_mix_level mix level for the surround channel(s) + * @param lfe_mix_level mix level for the low-frequency effects channel + * @param normalize if 1, coefficients will be normalized to prevent + * overflow. if 0, coefficients will not be + * normalized. + * @param[out] matrix mixing coefficients; matrix[i + stride * o] is + * the weight of input channel i in output channel o. + * @param stride distance between adjacent input channels in the + * matrix array + * @param matrix_encoding matrixed stereo downmix mode (e.g. dplii) + * @return 0 on success, negative AVERROR code on failure + */ +int avresample_build_matrix(uint64_t in_layout, uint64_t out_layout, + double center_mix_level, double surround_mix_level, + double lfe_mix_level, int normalize, double *matrix, + int stride, enum AVMatrixEncoding matrix_encoding); + +/** + * Get the current channel mixing matrix. + * + * If no custom matrix has been previously set or the AVAudioResampleContext is + * not open, an error is returned. + * + * @param avr audio resample context + * @param matrix mixing coefficients; matrix[i + stride * o] is the weight of + * input channel i in output channel o. + * @param stride distance between adjacent input channels in the matrix array + * @return 0 on success, negative AVERROR code on failure + */ +int avresample_get_matrix(AVAudioResampleContext *avr, double *matrix, + int stride); + +/** + * Set channel mixing matrix. + * + * Allows for setting a custom mixing matrix, overriding the default matrix + * generated internally during avresample_open(). This function can be called + * anytime on an allocated context, either before or after calling + * avresample_open(), as long as the channel layouts have been set. + * avresample_convert() always uses the current matrix. + * Calling avresample_close() on the context will clear the current matrix. + * + * @see avresample_close() + * + * @param avr audio resample context + * @param matrix mixing coefficients; matrix[i + stride * o] is the weight of + * input channel i in output channel o. + * @param stride distance between adjacent input channels in the matrix array + * @return 0 on success, negative AVERROR code on failure + */ +int avresample_set_matrix(AVAudioResampleContext *avr, const double *matrix, + int stride); + +/** + * Set a customized input channel mapping. + * + * This function can only be called when the allocated context is not open. + * Also, the input channel layout must have already been set. + * + * Calling avresample_close() on the context will clear the channel mapping. + * + * The map for each input channel specifies the channel index in the source to + * use for that particular channel, or -1 to mute the channel. Source channels + * can be duplicated by using the same index for multiple input channels. + * + * Examples: + * + * Reordering 5.1 AAC order (C,L,R,Ls,Rs,LFE) to FFmpeg order (L,R,C,LFE,Ls,Rs): + * { 1, 2, 0, 5, 3, 4 } + * + * Muting the 3rd channel in 4-channel input: + * { 0, 1, -1, 3 } + * + * Duplicating the left channel of stereo input: + * { 0, 0 } + * + * @param avr audio resample context + * @param channel_map customized input channel mapping + * @return 0 on success, negative AVERROR code on failure + */ +int avresample_set_channel_mapping(AVAudioResampleContext *avr, + const int *channel_map); + +/** + * Set compensation for resampling. + * + * This can be called anytime after avresample_open(). If resampling is not + * automatically enabled because of a sample rate conversion, the + * "force_resampling" option must have been set to 1 when opening the context + * in order to use resampling compensation. + * + * @param avr audio resample context + * @param sample_delta compensation delta, in samples + * @param compensation_distance compensation distance, in samples + * @return 0 on success, negative AVERROR code on failure + */ +int avresample_set_compensation(AVAudioResampleContext *avr, int sample_delta, + int compensation_distance); + +/** + * Provide the upper bound on the number of samples the configured + * conversion would output. + * + * @param avr audio resample context + * @param in_nb_samples number of input samples + * + * @return number of samples or AVERROR(EINVAL) if the value + * would exceed INT_MAX + */ + +int avresample_get_out_samples(AVAudioResampleContext *avr, int in_nb_samples); + +/** + * Convert input samples and write them to the output FIFO. + * + * The upper bound on the number of output samples can be obtained through + * avresample_get_out_samples(). + * + * The output data can be NULL or have fewer allocated samples than required. + * In this case, any remaining samples not written to the output will be added + * to an internal FIFO buffer, to be returned at the next call to this function + * or to avresample_read(). + * + * If converting sample rate, there may be data remaining in the internal + * resampling delay buffer. avresample_get_delay() tells the number of remaining + * samples. To get this data as output, call avresample_convert() with NULL + * input. + * + * At the end of the conversion process, there may be data remaining in the + * internal FIFO buffer. avresample_available() tells the number of remaining + * samples. To get this data as output, either call avresample_convert() with + * NULL input or call avresample_read(). + * + * @see avresample_get_out_samples() + * @see avresample_read() + * @see avresample_get_delay() + * + * @param avr audio resample context + * @param output output data pointers + * @param out_plane_size output plane size, in bytes. + * This can be 0 if unknown, but that will lead to + * optimized functions not being used directly on the + * output, which could slow down some conversions. + * @param out_samples maximum number of samples that the output buffer can hold + * @param input input data pointers + * @param in_plane_size input plane size, in bytes + * This can be 0 if unknown, but that will lead to + * optimized functions not being used directly on the + * input, which could slow down some conversions. + * @param in_samples number of input samples to convert + * @return number of samples written to the output buffer, + * not including converted samples added to the internal + * output FIFO + */ +int avresample_convert(AVAudioResampleContext *avr, uint8_t **output, + int out_plane_size, int out_samples, uint8_t **input, + int in_plane_size, int in_samples); + +/** + * Return the number of samples currently in the resampling delay buffer. + * + * When resampling, there may be a delay between the input and output. Any + * unconverted samples in each call are stored internally in a delay buffer. + * This function allows the user to determine the current number of samples in + * the delay buffer, which can be useful for synchronization. + * + * @see avresample_convert() + * + * @param avr audio resample context + * @return number of samples currently in the resampling delay buffer + */ +int avresample_get_delay(AVAudioResampleContext *avr); + +/** + * Return the number of available samples in the output FIFO. + * + * During conversion, if the user does not specify an output buffer or + * specifies an output buffer that is smaller than what is needed, remaining + * samples that are not written to the output are stored to an internal FIFO + * buffer. The samples in the FIFO can be read with avresample_read() or + * avresample_convert(). + * + * @see avresample_read() + * @see avresample_convert() + * + * @param avr audio resample context + * @return number of samples available for reading + */ +int avresample_available(AVAudioResampleContext *avr); + +/** + * Read samples from the output FIFO. + * + * During conversion, if the user does not specify an output buffer or + * specifies an output buffer that is smaller than what is needed, remaining + * samples that are not written to the output are stored to an internal FIFO + * buffer. This function can be used to read samples from that internal FIFO. + * + * @see avresample_available() + * @see avresample_convert() + * + * @param avr audio resample context + * @param output output data pointers. May be NULL, in which case + * nb_samples of data is discarded from output FIFO. + * @param nb_samples number of samples to read from the FIFO + * @return the number of samples written to output + */ +int avresample_read(AVAudioResampleContext *avr, uint8_t **output, int nb_samples); + +/** + * Convert the samples in the input AVFrame and write them to the output AVFrame. + * + * Input and output AVFrames must have channel_layout, sample_rate and format set. + * + * The upper bound on the number of output samples is obtained through + * avresample_get_out_samples(). + * + * If the output AVFrame does not have the data pointers allocated the nb_samples + * field will be set using avresample_get_out_samples() and av_frame_get_buffer() + * is called to allocate the frame. + * + * The output AVFrame can be NULL or have fewer allocated samples than required. + * In this case, any remaining samples not written to the output will be added + * to an internal FIFO buffer, to be returned at the next call to this function + * or to avresample_convert() or to avresample_read(). + * + * If converting sample rate, there may be data remaining in the internal + * resampling delay buffer. avresample_get_delay() tells the number of + * remaining samples. To get this data as output, call this function or + * avresample_convert() with NULL input. + * + * At the end of the conversion process, there may be data remaining in the + * internal FIFO buffer. avresample_available() tells the number of remaining + * samples. To get this data as output, either call this function or + * avresample_convert() with NULL input or call avresample_read(). + * + * If the AVAudioResampleContext configuration does not match the output and + * input AVFrame settings the conversion does not take place and depending on + * which AVFrame is not matching AVERROR_OUTPUT_CHANGED, AVERROR_INPUT_CHANGED + * or AVERROR_OUTPUT_CHANGED|AVERROR_INPUT_CHANGED is returned. + * + * @see avresample_get_out_samples() + * @see avresample_available() + * @see avresample_convert() + * @see avresample_read() + * @see avresample_get_delay() + * + * @param avr audio resample context + * @param output output AVFrame + * @param input input AVFrame + * @return 0 on success, AVERROR on failure or nonmatching + * configuration. + */ +int avresample_convert_frame(AVAudioResampleContext *avr, + AVFrame *output, AVFrame *input); + +/** + * Configure or reconfigure the AVAudioResampleContext using the information + * provided by the AVFrames. + * + * The original resampling context is reset even on failure. + * The function calls avresample_close() internally if the context is open. + * + * @see avresample_open(); + * @see avresample_close(); + * + * @param avr audio resample context + * @param output output AVFrame + * @param input input AVFrame + * @return 0 on success, AVERROR on failure. + */ +int avresample_config(AVAudioResampleContext *avr, AVFrame *out, AVFrame *in); + +/** + * @} + */ + +#endif /* AVRESAMPLE_AVRESAMPLE_H */ diff --git a/app/src/main/cpp/include/libavresample/version.h b/app/src/main/cpp/include/libavresample/version.h new file mode 100644 index 0000000..e3b8100 --- /dev/null +++ b/app/src/main/cpp/include/libavresample/version.h @@ -0,0 +1,54 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVRESAMPLE_VERSION_H +#define AVRESAMPLE_VERSION_H + +/** + * @file + * @ingroup lavr + * Libavresample version macros. + */ + +#include "libavutil/version.h" + +#define LIBAVRESAMPLE_VERSION_MAJOR 2 +#define LIBAVRESAMPLE_VERSION_MINOR 1 +#define LIBAVRESAMPLE_VERSION_MICRO 0 + +#define LIBAVRESAMPLE_VERSION_INT AV_VERSION_INT(LIBAVRESAMPLE_VERSION_MAJOR, \ + LIBAVRESAMPLE_VERSION_MINOR, \ + LIBAVRESAMPLE_VERSION_MICRO) +#define LIBAVRESAMPLE_VERSION AV_VERSION(LIBAVRESAMPLE_VERSION_MAJOR, \ + LIBAVRESAMPLE_VERSION_MINOR, \ + LIBAVRESAMPLE_VERSION_MICRO) +#define LIBAVRESAMPLE_BUILD LIBAVRESAMPLE_VERSION_INT + +#define LIBAVRESAMPLE_IDENT "Lavr" AV_STRINGIFY(LIBAVRESAMPLE_VERSION) + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + */ + +#ifndef FF_API_RESAMPLE_CLOSE_OPEN +#define FF_API_RESAMPLE_CLOSE_OPEN (LIBAVRESAMPLE_VERSION_MAJOR < 3) +#endif + +#endif /* AVRESAMPLE_VERSION_H */ diff --git a/app/src/main/cpp/include/libavutil/adler32.h b/app/src/main/cpp/include/libavutil/adler32.h new file mode 100644 index 0000000..0dc69ec --- /dev/null +++ b/app/src/main/cpp/include/libavutil/adler32.h @@ -0,0 +1,55 @@ +/* + * copyright (c) 2006 Mans Rullgard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_ADLER32_H +#define AVUTIL_ADLER32_H + +#include <stdint.h> +#include "attributes.h" + +/** + * @file + * Public header for libavutil Adler32 hasher + * + * @defgroup lavu_adler32 Adler32 + * @ingroup lavu_crypto + * @{ + */ + +/** + * Calculate the Adler32 checksum of a buffer. + * + * Passing the return value to a subsequent av_adler32_update() call + * allows the checksum of multiple buffers to be calculated as though + * they were concatenated. + * + * @param adler initial checksum value + * @param buf pointer to input buffer + * @param len size of input buffer + * @return updated checksum + */ +unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, + unsigned int len) av_pure; + +/** + * @} + */ + +#endif /* AVUTIL_ADLER32_H */ diff --git a/app/src/main/cpp/include/libavutil/aes.h b/app/src/main/cpp/include/libavutil/aes.h new file mode 100644 index 0000000..05bb7c8 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/aes.h @@ -0,0 +1,66 @@ +/* + * copyright (c) 2007 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AES_H +#define AVUTIL_AES_H + +#include <stdint.h> + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_aes AES + * @ingroup lavu_crypto + * @{ + */ + +extern const int av_aes_size; + +struct AVAES; + +/** + * Allocate an AVAES context. + */ +struct AVAES *av_aes_alloc(void); + +/** + * Initialize an AVAES context. + * @param key_bits 128, 192 or 256 + * @param decrypt 0 for encryption, 1 for decryption + */ +int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * @param count number of 16 byte blocks + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param iv initialization vector for CBC mode, if NULL then ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, + int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_AES_H */ diff --git a/app/src/main/cpp/include/libavutil/attributes.h b/app/src/main/cpp/include/libavutil/attributes.h new file mode 100644 index 0000000..db95a2a --- /dev/null +++ b/app/src/main/cpp/include/libavutil/attributes.h @@ -0,0 +1,160 @@ +/* + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Macro definitions for various function/variable attributes + */ + +#ifndef AVUTIL_ATTRIBUTES_H +#define AVUTIL_ATTRIBUTES_H + +#ifdef __GNUC__ +# define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y) +#else +# define AV_GCC_VERSION_AT_LEAST(x, y) 0 +#endif + +#ifndef av_always_inline +#if AV_GCC_VERSION_AT_LEAST(3, 1) +# define av_always_inline __attribute__((always_inline)) inline +#elif defined(_MSC_VER) +# define av_always_inline __forceinline +#else +# define av_always_inline inline +#endif +#endif + +#ifndef av_extern_inline +#if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__) +# define av_extern_inline extern inline +#else +# define av_extern_inline inline +#endif +#endif + +#if AV_GCC_VERSION_AT_LEAST(3, 1) +# define av_noinline __attribute__((noinline)) +#elif defined(_MSC_VER) +# define av_noinline __declspec(noinline) +#else +# define av_noinline +#endif + +#if AV_GCC_VERSION_AT_LEAST(3, 1) +# define av_pure __attribute__((pure)) +#else +# define av_pure +#endif + +#if AV_GCC_VERSION_AT_LEAST(2, 6) +# define av_const __attribute__((const)) +#else +# define av_const +#endif + +#if AV_GCC_VERSION_AT_LEAST(4, 3) +# define av_cold __attribute__((cold)) +#else +# define av_cold +#endif + +#if AV_GCC_VERSION_AT_LEAST(4, 1) && !defined(__llvm__) +# define av_flatten __attribute__((flatten)) +#else +# define av_flatten +#endif + +#if AV_GCC_VERSION_AT_LEAST(3, 1) +# define attribute_deprecated __attribute__((deprecated)) +#elif defined(_MSC_VER) +# define attribute_deprecated __declspec(deprecated) +#else +# define attribute_deprecated +#endif + +/** + * Disable warnings about deprecated features + * This is useful for sections of code kept for backward compatibility and + * scheduled for removal. + */ +#ifndef AV_NOWARN_DEPRECATED +#if AV_GCC_VERSION_AT_LEAST(4, 6) +# define AV_NOWARN_DEPRECATED(code) \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \ + code \ + _Pragma("GCC diagnostic pop") +#elif defined(_MSC_VER) +# define AV_NOWARN_DEPRECATED(code) \ + __pragma(warning(push)) \ + __pragma(warning(disable : 4996)) \ + code; \ + __pragma(warning(pop)) +#else +# define AV_NOWARN_DEPRECATED(code) code +#endif +#endif + + +#if defined(__GNUC__) +# define av_unused __attribute__((unused)) +#else +# define av_unused +#endif + +/** + * Mark a variable as used and prevent the compiler from optimizing it + * away. This is useful for variables accessed only from inline + * assembler without the compiler being aware. + */ +#if AV_GCC_VERSION_AT_LEAST(3, 1) +# define av_used __attribute__((used)) +#else +# define av_used +#endif + +#if AV_GCC_VERSION_AT_LEAST(3, 3) +# define av_alias __attribute__((may_alias)) +#else +# define av_alias +#endif + +#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__) +# define av_uninit(x) x=x +#else +# define av_uninit(x) x +#endif + +#ifdef __GNUC__ +# define av_builtin_constant_p __builtin_constant_p +# define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos))) +#else +# define av_builtin_constant_p(x) 0 +# define av_printf_format(fmtpos, attrpos) +#endif + +#if AV_GCC_VERSION_AT_LEAST(2, 5) +# define av_noreturn __attribute__((noreturn)) +#else +# define av_noreturn +#endif + +#endif /* AVUTIL_ATTRIBUTES_H */ diff --git a/app/src/main/cpp/include/libavutil/audio_fifo.h b/app/src/main/cpp/include/libavutil/audio_fifo.h new file mode 100644 index 0000000..d21e6a1 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/audio_fifo.h @@ -0,0 +1,153 @@ +/* + * Audio FIFO + * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Audio FIFO Buffer + */ + +#ifndef AVUTIL_AUDIO_FIFO_H +#define AVUTIL_AUDIO_FIFO_H + +#include "avutil.h" +#include "fifo.h" +#include "samplefmt.h" + +/** + * @addtogroup lavu_audio + * @{ + * + * @defgroup lavu_audiofifo Audio FIFO Buffer + * @{ + */ + +/** + * Context for an Audio FIFO Buffer. + * + * - Operates at the sample level rather than the byte level. + * - Supports multiple channels with either planar or packed sample format. + * - Automatic reallocation when writing to a full buffer. + */ +typedef struct AVAudioFifo AVAudioFifo; + +/** + * Free an AVAudioFifo. + * + * @param af AVAudioFifo to free + */ +void av_audio_fifo_free(AVAudioFifo *af); + +/** + * Allocate an AVAudioFifo. + * + * @param sample_fmt sample format + * @param channels number of channels + * @param nb_samples initial allocation size, in samples + * @return newly allocated AVAudioFifo, or NULL on error + */ +AVAudioFifo *av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels, + int nb_samples); + +/** + * Reallocate an AVAudioFifo. + * + * @param af AVAudioFifo to reallocate + * @param nb_samples new allocation size, in samples + * @return 0 if OK, or negative AVERROR code on failure + */ +int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples); + +/** + * Write data to an AVAudioFifo. + * + * The AVAudioFifo will be reallocated automatically if the available space + * is less than nb_samples. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param af AVAudioFifo to write to + * @param data audio data plane pointers + * @param nb_samples number of samples to write + * @return number of samples actually written, or negative AVERROR + * code on failure. If successful, the number of samples + * actually written will always be nb_samples. + */ +int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples); + +/** + * Read data from an AVAudioFifo. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param af AVAudioFifo to read from + * @param data audio data plane pointers + * @param nb_samples number of samples to read + * @return number of samples actually read, or negative AVERROR code + * on failure. The number of samples actually read will not + * be greater than nb_samples, and will only be less than + * nb_samples if av_audio_fifo_size is less than nb_samples. + */ +int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples); + +/** + * Drain data from an AVAudioFifo. + * + * Removes the data without reading it. + * + * @param af AVAudioFifo to drain + * @param nb_samples number of samples to drain + * @return 0 if OK, or negative AVERROR code on failure + */ +int av_audio_fifo_drain(AVAudioFifo *af, int nb_samples); + +/** + * Reset the AVAudioFifo buffer. + * + * This empties all data in the buffer. + * + * @param af AVAudioFifo to reset + */ +void av_audio_fifo_reset(AVAudioFifo *af); + +/** + * Get the current number of samples in the AVAudioFifo available for reading. + * + * @param af the AVAudioFifo to query + * @return number of samples available for reading + */ +int av_audio_fifo_size(AVAudioFifo *af); + +/** + * Get the current number of samples in the AVAudioFifo available for writing. + * + * @param af the AVAudioFifo to query + * @return number of samples available for writing + */ +int av_audio_fifo_space(AVAudioFifo *af); + +/** + * @} + * @} + */ + +#endif /* AVUTIL_AUDIO_FIFO_H */ diff --git a/app/src/main/cpp/include/libavutil/audioconvert.h b/app/src/main/cpp/include/libavutil/audioconvert.h new file mode 100644 index 0000000..cbc908e --- /dev/null +++ b/app/src/main/cpp/include/libavutil/audioconvert.h @@ -0,0 +1,8 @@ + +#include "version.h" + +#if FF_API_AUDIOCONVERT + +#include "channel_layout.h" + +#endif diff --git a/app/src/main/cpp/include/libavutil/avassert.h b/app/src/main/cpp/include/libavutil/avassert.h new file mode 100644 index 0000000..41f5e0e --- /dev/null +++ b/app/src/main/cpp/include/libavutil/avassert.h @@ -0,0 +1,66 @@ +/* + * copyright (c) 2010 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * simple assert() macros that are a bit more flexible than ISO C assert(). + * @author Michael Niedermayer <michaelni@gmx.at> + */ + +#ifndef AVUTIL_AVASSERT_H +#define AVUTIL_AVASSERT_H + +#include <stdlib.h> +#include "avutil.h" +#include "log.h" + +/** + * assert() equivalent, that is always enabled. + */ +#define av_assert0(cond) do { \ + if (!(cond)) { \ + av_log(NULL, AV_LOG_PANIC, "Assertion %s failed at %s:%d\n", \ + AV_STRINGIFY(cond), __FILE__, __LINE__); \ + abort(); \ + } \ +} while (0) + + +/** + * assert() equivalent, that does not lie in speed critical code. + * These asserts() thus can be enabled without fearing speedloss. + */ +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0 +#define av_assert1(cond) av_assert0(cond) +#else +#define av_assert1(cond) ((void)0) +#endif + + +/** + * assert() equivalent, that does lie in speed critical code. + */ +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 +#define av_assert2(cond) av_assert0(cond) +#else +#define av_assert2(cond) ((void)0) +#endif + +#endif /* AVUTIL_AVASSERT_H */ diff --git a/app/src/main/cpp/include/libavutil/avconfig.h b/app/src/main/cpp/include/libavutil/avconfig.h new file mode 100644 index 0000000..36a8cd1 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/avconfig.h @@ -0,0 +1,7 @@ +/* Generated by ffconf */ +#ifndef AVUTIL_AVCONFIG_H +#define AVUTIL_AVCONFIG_H +#define AV_HAVE_BIGENDIAN 0 +#define AV_HAVE_FAST_UNALIGNED 1 +#define AV_HAVE_INCOMPATIBLE_LIBAV_ABI 0 +#endif /* AVUTIL_AVCONFIG_H */ diff --git a/app/src/main/cpp/include/libavutil/avstring.h b/app/src/main/cpp/include/libavutil/avstring.h new file mode 100644 index 0000000..a92f250 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/avstring.h @@ -0,0 +1,367 @@ +/* + * Copyright (c) 2007 Mans Rullgard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AVSTRING_H +#define AVUTIL_AVSTRING_H + +#include <stddef.h> +#include <stdint.h> +#include "attributes.h" + +/** + * @addtogroup lavu_string + * @{ + */ + +/** + * Return non-zero if pfx is a prefix of str. If it is, *ptr is set to + * the address of the first character in str after the prefix. + * + * @param str input string + * @param pfx prefix to test + * @param ptr updated if the prefix is matched inside str + * @return non-zero if the prefix matches, zero otherwise + */ +int av_strstart(const char *str, const char *pfx, const char **ptr); + +/** + * Return non-zero if pfx is a prefix of str independent of case. If + * it is, *ptr is set to the address of the first character in str + * after the prefix. + * + * @param str input string + * @param pfx prefix to test + * @param ptr updated if the prefix is matched inside str + * @return non-zero if the prefix matches, zero otherwise + */ +int av_stristart(const char *str, const char *pfx, const char **ptr); + +/** + * Locate the first case-independent occurrence in the string haystack + * of the string needle. A zero-length string needle is considered to + * match at the start of haystack. + * + * This function is a case-insensitive version of the standard strstr(). + * + * @param haystack string to search in + * @param needle string to search for + * @return pointer to the located match within haystack + * or a null pointer if no match + */ +char *av_stristr(const char *haystack, const char *needle); + +/** + * Locate the first occurrence of the string needle in the string haystack + * where not more than hay_length characters are searched. A zero-length + * string needle is considered to match at the start of haystack. + * + * This function is a length-limited version of the standard strstr(). + * + * @param haystack string to search in + * @param needle string to search for + * @param hay_length length of string to search in + * @return pointer to the located match within haystack + * or a null pointer if no match + */ +char *av_strnstr(const char *haystack, const char *needle, size_t hay_length); + +/** + * Copy the string src to dst, but no more than size - 1 bytes, and + * null-terminate dst. + * + * This function is the same as BSD strlcpy(). + * + * @param dst destination buffer + * @param src source string + * @param size size of destination buffer + * @return the length of src + * + * @warning since the return value is the length of src, src absolutely + * _must_ be a properly 0-terminated string, otherwise this will read beyond + * the end of the buffer and possibly crash. + */ +size_t av_strlcpy(char *dst, const char *src, size_t size); + +/** + * Append the string src to the string dst, but to a total length of + * no more than size - 1 bytes, and null-terminate dst. + * + * This function is similar to BSD strlcat(), but differs when + * size <= strlen(dst). + * + * @param dst destination buffer + * @param src source string + * @param size size of destination buffer + * @return the total length of src and dst + * + * @warning since the return value use the length of src and dst, these + * absolutely _must_ be a properly 0-terminated strings, otherwise this + * will read beyond the end of the buffer and possibly crash. + */ +size_t av_strlcat(char *dst, const char *src, size_t size); + +/** + * Append output to a string, according to a format. Never write out of + * the destination buffer, and always put a terminating 0 within + * the buffer. + * @param dst destination buffer (string to which the output is + * appended) + * @param size total size of the destination buffer + * @param fmt printf-compatible format string, specifying how the + * following parameters are used + * @return the length of the string that would have been generated + * if enough space had been available + */ +size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) av_printf_format(3, 4); + +/** + * Get the count of continuous non zero chars starting from the beginning. + * + * @param len maximum number of characters to check in the string, that + * is the maximum value which is returned by the function + */ +static inline size_t av_strnlen(const char *s, size_t len) { + size_t i; + for (i = 0; i < len && s[i]; i++); + return i; +} + +/** + * Print arguments following specified format into a large enough auto + * allocated buffer. It is similar to GNU asprintf(). + * @param fmt printf-compatible format string, specifying how the + * following parameters are used. + * @return the allocated string + * @note You have to free the string yourself with av_free(). + */ +char *av_asprintf(const char *fmt, ...) av_printf_format(1, 2); + +/** + * Convert a number to a av_malloced string. + */ +char *av_d2str(double d); + +/** + * Unescape the given string until a non escaped terminating char, + * and return the token corresponding to the unescaped string. + * + * The normal \ and ' escaping is supported. Leading and trailing + * whitespaces are removed, unless they are escaped with '\' or are + * enclosed between ''. + * + * @param buf the buffer to parse, buf will be updated to point to the + * terminating char + * @param term a 0-terminated list of terminating chars + * @return the malloced unescaped string, which must be av_freed by + * the user, NULL in case of allocation failure + */ +char *av_get_token(const char **buf, const char *term); + +/** + * Split the string into several tokens which can be accessed by + * successive calls to av_strtok(). + * + * A token is defined as a sequence of characters not belonging to the + * set specified in delim. + * + * On the first call to av_strtok(), s should point to the string to + * parse, and the value of saveptr is ignored. In subsequent calls, s + * should be NULL, and saveptr should be unchanged since the previous + * call. + * + * This function is similar to strtok_r() defined in POSIX.1. + * + * @param s the string to parse, may be NULL + * @param delim 0-terminated list of token delimiters, must be non-NULL + * @param saveptr user-provided pointer which points to stored + * information necessary for av_strtok() to continue scanning the same + * string. saveptr is updated to point to the next character after the + * first delimiter found, or to NULL if the string was terminated + * @return the found token, or NULL when no token is found + */ +char *av_strtok(char *s, const char *delim, char **saveptr); + +/** + * Locale-independent conversion of ASCII isdigit. + */ +av_const int av_isdigit(int c); + +/** + * Locale-independent conversion of ASCII isgraph. + */ +av_const int av_isgraph(int c); + +/** + * Locale-independent conversion of ASCII isspace. + */ +av_const int av_isspace(int c); + +/** + * Locale-independent conversion of ASCII characters to uppercase. + */ +static inline av_const int av_toupper(int c) { + if (c >= 'a' && c <= 'z') + c ^= 0x20; + return c; +} + +/** + * Locale-independent conversion of ASCII characters to lowercase. + */ +static inline av_const int av_tolower(int c) { + if (c >= 'A' && c <= 'Z') + c ^= 0x20; + return c; +} + +/** + * Locale-independent conversion of ASCII isxdigit. + */ +av_const int av_isxdigit(int c); + +/** + * Locale-independent case-insensitive compare. + * @note This means only ASCII-range characters are case-insensitive + */ +int av_strcasecmp(const char *a, const char *b); + +/** + * Locale-independent case-insensitive compare. + * @note This means only ASCII-range characters are case-insensitive + */ +int av_strncasecmp(const char *a, const char *b, size_t n); + + +/** + * Thread safe basename. + * @param path the path, on DOS both \ and / are considered separators. + * @return pointer to the basename substring. + */ +const char *av_basename(const char *path); + +/** + * Thread safe dirname. + * @param path the path, on DOS both \ and / are considered separators. + * @return the path with the separator replaced by the string terminator or ".". + * @note the function may change the input string. + */ +const char *av_dirname(char *path); + +/** + * Match instances of a name in a comma-separated list of names. + * @param name Name to look for. + * @param names List of names. + * @return 1 on match, 0 otherwise. + */ +int av_match_name(const char *name, const char *names); + +enum AVEscapeMode { + AV_ESCAPE_MODE_AUTO, ///< Use auto-selected escaping mode. + AV_ESCAPE_MODE_BACKSLASH, ///< Use backslash escaping. + AV_ESCAPE_MODE_QUOTE, ///< Use single-quote escaping. +}; + +/** + * Consider spaces special and escape them even in the middle of the + * string. + * + * This is equivalent to adding the whitespace characters to the special + * characters lists, except it is guaranteed to use the exact same list + * of whitespace characters as the rest of libavutil. + */ +#define AV_ESCAPE_FLAG_WHITESPACE 0x01 + +/** + * Escape only specified special characters. + * Without this flag, escape also any characters that may be considered + * special by av_get_token(), such as the single quote. + */ +#define AV_ESCAPE_FLAG_STRICT 0x02 + +/** + * Escape string in src, and put the escaped string in an allocated + * string in *dst, which must be freed with av_free(). + * + * @param dst pointer where an allocated string is put + * @param src string to escape, must be non-NULL + * @param special_chars string containing the special characters which + * need to be escaped, can be NULL + * @param mode escape mode to employ, see AV_ESCAPE_MODE_* macros. + * Any unknown value for mode will be considered equivalent to + * AV_ESCAPE_MODE_BACKSLASH, but this behaviour can change without + * notice. + * @param flags flags which control how to escape, see AV_ESCAPE_FLAG_ macros + * @return the length of the allocated string, or a negative error code in case of error + * @see av_bprint_escape() + */ +int av_escape(char **dst, const char *src, const char *special_chars, + enum AVEscapeMode mode, int flags); + +#define AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES 1 ///< accept codepoints over 0x10FFFF +#define AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS 2 ///< accept non-characters - 0xFFFE and 0xFFFF +#define AV_UTF8_FLAG_ACCEPT_SURROGATES 4 ///< accept UTF-16 surrogates codes +#define AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES 8 ///< exclude control codes not accepted by XML + +#define AV_UTF8_FLAG_ACCEPT_ALL \ + AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES|AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS|AV_UTF8_FLAG_ACCEPT_SURROGATES + +/** + * Read and decode a single UTF-8 code point (character) from the + * buffer in *buf, and update *buf to point to the next byte to + * decode. + * + * In case of an invalid byte sequence, the pointer will be updated to + * the next byte after the invalid sequence and the function will + * return an error code. + * + * Depending on the specified flags, the function will also fail in + * case the decoded code point does not belong to a valid range. + * + * @note For speed-relevant code a carefully implemented use of + * GET_UTF8() may be preferred. + * + * @param codep pointer used to return the parsed code in case of success. + * The value in *codep is set even in case the range check fails. + * @param bufp pointer to the address the first byte of the sequence + * to decode, updated by the function to point to the + * byte next after the decoded sequence + * @param buf_end pointer to the end of the buffer, points to the next + * byte past the last in the buffer. This is used to + * avoid buffer overreads (in case of an unfinished + * UTF-8 sequence towards the end of the buffer). + * @param flags a collection of AV_UTF8_FLAG_* flags + * @return >= 0 in case a sequence was successfully read, a negative + * value in case of invalid sequence + */ +int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end, + unsigned int flags); + +/** + * Check if a name is in a list. + * @returns 0 if not found, or the 1 based index where it has been found in the + * list. + */ +int av_match_list(const char *name, const char *list, char separator); + +/** + * @} + */ + +#endif /* AVUTIL_AVSTRING_H */ diff --git a/app/src/main/cpp/include/libavutil/avutil.h b/app/src/main/cpp/include/libavutil/avutil.h new file mode 100644 index 0000000..82674a5 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/avutil.h @@ -0,0 +1,343 @@ +/* + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AVUTIL_H +#define AVUTIL_AVUTIL_H + +/** + * @file + * external API header + */ + +/** + * @mainpage + * + * @section ffmpeg_intro Introduction + * + * This document describes the usage of the different libraries + * provided by FFmpeg. + * + * @li @ref libavc "libavcodec" encoding/decoding library + * @li @ref lavfi "libavfilter" graph-based frame editing library + * @li @ref libavf "libavformat" I/O and muxing/demuxing library + * @li @ref lavd "libavdevice" special devices muxing/demuxing library + * @li @ref lavu "libavutil" common utility library + * @li @ref lswr "libswresample" audio resampling, format conversion and mixing + * @li @ref lpp "libpostproc" post processing library + * @li @ref libsws "libswscale" color conversion and scaling library + * + * @section ffmpeg_versioning Versioning and compatibility + * + * Each of the FFmpeg libraries contains a version.h header, which defines a + * major, minor and micro version number with the + * <em>LIBRARYNAME_VERSION_{MAJOR,MINOR,MICRO}</em> macros. The major version + * number is incremented with backward incompatible changes - e.g. removing + * parts of the public API, reordering public struct members, etc. The minor + * version number is incremented for backward compatible API changes or major + * new features - e.g. adding a new public function or a new decoder. The micro + * version number is incremented for smaller changes that a calling program + * might still want to check for - e.g. changing behavior in a previously + * unspecified situation. + * + * FFmpeg guarantees backward API and ABI compatibility for each library as long + * as its major version number is unchanged. This means that no public symbols + * will be removed or renamed. Types and names of the public struct members and + * values of public macros and enums will remain the same (unless they were + * explicitly declared as not part of the public API). Documented behavior will + * not change. + * + * In other words, any correct program that works with a given FFmpeg snapshot + * should work just as well without any changes with any later snapshot with the + * same major versions. This applies to both rebuilding the program against new + * FFmpeg versions or to replacing the dynamic FFmpeg libraries that a program + * links against. + * + * However, new public symbols may be added and new members may be appended to + * public structs whose size is not part of public ABI (most public structs in + * FFmpeg). New macros and enum values may be added. Behavior in undocumented + * situations may change slightly (and be documented). All those are accompanied + * by an entry in doc/APIchanges and incrementing either the minor or micro + * version number. + */ + +/** + * @defgroup lavu Common utility functions + * + * @brief + * libavutil contains the code shared across all the other FFmpeg + * libraries + * + * @note In order to use the functions provided by avutil you must include + * the specific header. + * + * @{ + * + * @defgroup lavu_crypto Crypto and Hashing + * + * @{ + * @} + * + * @defgroup lavu_math Maths + * @{ + * + * @} + * + * @defgroup lavu_string String Manipulation + * + * @{ + * + * @} + * + * @defgroup lavu_mem Memory Management + * + * @{ + * + * @} + * + * @defgroup lavu_data Data Structures + * @{ + * + * @} + * + * @defgroup lavu_audio Audio related + * + * @{ + * + * @} + * + * @defgroup lavu_error Error Codes + * + * @{ + * + * @} + * + * @defgroup lavu_log Logging Facility + * + * @{ + * + * @} + * + * @defgroup lavu_misc Other + * + * @{ + * + * @defgroup lavu_internal Internal + * + * Not exported functions, for internal usage only + * + * @{ + * + * @} + * + * @defgroup preproc_misc Preprocessor String Macros + * + * @{ + * + * @} + * + * @defgroup version_utils Library Version Macros + * + * @{ + * + * @} + */ + + +/** + * @addtogroup lavu_ver + * @{ + */ + +/** + * Return the LIBAVUTIL_VERSION_INT constant. + */ +unsigned avutil_version(void); + +/** + * Return the libavutil build-time configuration. + */ +const char *avutil_configuration(void); + +/** + * Return the libavutil license. + */ +const char *avutil_license(void); + +/** + * @} + */ + +/** + * @addtogroup lavu_media Media Type + * @brief Media Type + */ + +enum AVMediaType { + AVMEDIA_TYPE_UNKNOWN = -1, ///< Usually treated as AVMEDIA_TYPE_DATA + AVMEDIA_TYPE_VIDEO, + AVMEDIA_TYPE_AUDIO, + AVMEDIA_TYPE_DATA, ///< Opaque data information usually continuous + AVMEDIA_TYPE_SUBTITLE, + AVMEDIA_TYPE_ATTACHMENT, ///< Opaque data information usually sparse + AVMEDIA_TYPE_NB +}; + +/** + * Return a string describing the media_type enum, NULL if media_type + * is unknown. + */ +const char *av_get_media_type_string(enum AVMediaType media_type); + +/** + * @defgroup lavu_const Constants + * @{ + * + * @defgroup lavu_enc Encoding specific + * + * @note those definition should move to avcodec + * @{ + */ + +#define FF_LAMBDA_SHIFT 7 +#define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT) +#define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda +#define FF_LAMBDA_MAX (256*128-1) + +#define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove + +/** + * @} + * @defgroup lavu_time Timestamp specific + * + * FFmpeg internal timebase and timestamp definitions + * + * @{ + */ + +/** + * @brief Undefined timestamp value + * + * Usually reported by demuxer that work on containers that do not provide + * either pts or dts. + */ + +#define AV_NOPTS_VALUE ((int64_t)UINT64_C(0x8000000000000000)) + +/** + * Internal time base represented as integer + */ + +#define AV_TIME_BASE 1000000 + +/** + * Internal time base represented as fractional value + */ + +#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} + +/** + * @} + * @} + * @defgroup lavu_picture Image related + * + * AVPicture types, pixel formats and basic image planes manipulation. + * + * @{ + */ + +enum AVPictureType { + AV_PICTURE_TYPE_NONE = 0, ///< Undefined + AV_PICTURE_TYPE_I, ///< Intra + AV_PICTURE_TYPE_P, ///< Predicted + AV_PICTURE_TYPE_B, ///< Bi-dir predicted + AV_PICTURE_TYPE_S, ///< S(GMC)-VOP MPEG4 + AV_PICTURE_TYPE_SI, ///< Switching Intra + AV_PICTURE_TYPE_SP, ///< Switching Predicted + AV_PICTURE_TYPE_BI, ///< BI type +}; + +/** + * Return a single letter to describe the given picture type + * pict_type. + * + * @param[in] pict_type the picture type @return a single character + * representing the picture type, '?' if pict_type is unknown + */ +char av_get_picture_type_char(enum AVPictureType pict_type); + +/** + * @} + */ + +#include "common.h" +#include "error.h" +#include "rational.h" +#include "version.h" +#include "macros.h" +#include "mathematics.h" +#include "log.h" +#include "pixfmt.h" + +/** + * Return x default pointer in case p is NULL. + */ +static inline void *av_x_if_null(const void *p, const void *x) { + return (void *) (intptr_t) (p ? p : x); +} + +/** + * Compute the length of an integer list. + * + * @param elsize size in bytes of each list element (only 1, 2, 4 or 8) + * @param term list terminator (usually 0 or -1) + * @param list pointer to the list + * @return length of the list, in elements, not counting the terminator + */ +unsigned av_int_list_length_for_size(unsigned elsize, + const void *list, uint64_t term) av_pure; + +/** + * Compute the length of an integer list. + * + * @param term list terminator (usually 0 or -1) + * @param list pointer to the list + * @return length of the list, in elements, not counting the terminator + */ +#define av_int_list_length(list, term) \ + av_int_list_length_for_size(sizeof(*(list)), list, term) + +/** + * Open a file using a UTF-8 filename. + * The API of this function matches POSIX fopen(), errors are returned through + * errno. + */ +FILE *av_fopen_utf8(const char *path, const char *mode); + +/** + * Return the fractional representation of the internal time base. + */ +AVRational av_get_time_base_q(void); + +/** + * @} + * @} + */ + +#endif /* AVUTIL_AVUTIL_H */ diff --git a/app/src/main/cpp/include/libavutil/base64.h b/app/src/main/cpp/include/libavutil/base64.h new file mode 100644 index 0000000..0f2be64 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/base64.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com) + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_BASE64_H +#define AVUTIL_BASE64_H + +#include <stdint.h> + +/** + * @defgroup lavu_base64 Base64 + * @ingroup lavu_crypto + * @{ + */ + + +/** + * Decode a base64-encoded string. + * + * @param out buffer for decoded data + * @param in null-terminated input string + * @param out_size size in bytes of the out buffer, must be at + * least 3/4 of the length of in + * @return number of bytes written, or a negative value in case of + * invalid input + */ +int av_base64_decode(uint8_t *out, const char *in, int out_size); + +/** + * Encode data to base64 and null-terminate. + * + * @param out buffer for encoded data + * @param out_size size in bytes of the out buffer (including the + * null terminator), must be at least AV_BASE64_SIZE(in_size) + * @param in input buffer containing the data to encode + * @param in_size size in bytes of the in buffer + * @return out or NULL in case of error + */ +char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); + +/** + * Calculate the output size needed to base64-encode x bytes to a + * null-terminated string. + */ +#define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) + +/** + * @} + */ + +#endif /* AVUTIL_BASE64_H */ diff --git a/app/src/main/cpp/include/libavutil/blowfish.h b/app/src/main/cpp/include/libavutil/blowfish.h new file mode 100644 index 0000000..0b00453 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/blowfish.h @@ -0,0 +1,77 @@ +/* + * Blowfish algorithm + * Copyright (c) 2012 Samuel Pitoiset + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_BLOWFISH_H +#define AVUTIL_BLOWFISH_H + +#include <stdint.h> + +/** + * @defgroup lavu_blowfish Blowfish + * @ingroup lavu_crypto + * @{ + */ + +#define AV_BF_ROUNDS 16 + +typedef struct AVBlowfish { + uint32_t p[AV_BF_ROUNDS + 2]; + uint32_t s[4][256]; +} AVBlowfish; + +/** + * Initialize an AVBlowfish context. + * + * @param ctx an AVBlowfish context + * @param key a key + * @param key_len length of the key + */ +void av_blowfish_init(struct AVBlowfish *ctx, const uint8_t *key, int key_len); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * + * @param ctx an AVBlowfish context + * @param xl left four bytes halves of input to be encrypted + * @param xr right four bytes halves of input to be encrypted + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_blowfish_crypt_ecb(struct AVBlowfish *ctx, uint32_t *xl, uint32_t *xr, + int decrypt); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * + * @param ctx an AVBlowfish context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param iv initialization vector for CBC mode, if NULL ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_blowfish_crypt(struct AVBlowfish *ctx, uint8_t *dst, const uint8_t *src, + int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_BLOWFISH_H */ diff --git a/app/src/main/cpp/include/libavutil/bprint.h b/app/src/main/cpp/include/libavutil/bprint.h new file mode 100644 index 0000000..fe04e76 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/bprint.h @@ -0,0 +1,219 @@ +/* + * Copyright (c) 2012 Nicolas George + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_BPRINT_H +#define AVUTIL_BPRINT_H + +#include <stdarg.h> + +#include "attributes.h" +#include "avstring.h" + +/** + * Define a structure with extra padding to a fixed size + * This helps ensuring binary compatibility with future versions. + */ + +#define FF_PAD_STRUCTURE(name, size, ...) \ +struct ff_pad_helper_##name { __VA_ARGS__ }; \ +typedef struct name { \ + __VA_ARGS__ \ + char reserved_padding[size - sizeof(struct ff_pad_helper_##name)]; \ +} name; + +/** + * Buffer to print data progressively + * + * The string buffer grows as necessary and is always 0-terminated. + * The content of the string is never accessed, and thus is + * encoding-agnostic and can even hold binary data. + * + * Small buffers are kept in the structure itself, and thus require no + * memory allocation at all (unless the contents of the buffer is needed + * after the structure goes out of scope). This is almost as lightweight as + * declaring a local "char buf[512]". + * + * The length of the string can go beyond the allocated size: the buffer is + * then truncated, but the functions still keep account of the actual total + * length. + * + * In other words, buf->len can be greater than buf->size and records the + * total length of what would have been to the buffer if there had been + * enough memory. + * + * Append operations do not need to be tested for failure: if a memory + * allocation fails, data stop being appended to the buffer, but the length + * is still updated. This situation can be tested with + * av_bprint_is_complete(). + * + * The size_max field determines several possible behaviours: + * + * size_max = -1 (= UINT_MAX) or any large value will let the buffer be + * reallocated as necessary, with an amortized linear cost. + * + * size_max = 0 prevents writing anything to the buffer: only the total + * length is computed. The write operations can then possibly be repeated in + * a buffer with exactly the necessary size + * (using size_init = size_max = len + 1). + * + * size_max = 1 is automatically replaced by the exact size available in the + * structure itself, thus ensuring no dynamic memory allocation. The + * internal buffer is large enough to hold a reasonable paragraph of text, + * such as the current paragraph. + */ + +FF_PAD_STRUCTURE(AVBPrint, 1024, + char *str; /**< string so far */ + unsigned len; /**< length so far */ + unsigned size; /**< allocated memory */ + unsigned size_max; /**< maximum allocated memory */ + char reserved_internal_buffer[1]; +) + +/** + * Convenience macros for special values for av_bprint_init() size_max + * parameter. + */ +#define AV_BPRINT_SIZE_UNLIMITED ((unsigned)-1) +#define AV_BPRINT_SIZE_AUTOMATIC 1 +#define AV_BPRINT_SIZE_COUNT_ONLY 0 + +/** + * Init a print buffer. + * + * @param buf buffer to init + * @param size_init initial size (including the final 0) + * @param size_max maximum size; + * 0 means do not write anything, just count the length; + * 1 is replaced by the maximum value for automatic storage; + * any large value means that the internal buffer will be + * reallocated as needed up to that limit; -1 is converted to + * UINT_MAX, the largest limit possible. + * Check also AV_BPRINT_SIZE_* macros. + */ +void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max); + +/** + * Init a print buffer using a pre-existing buffer. + * + * The buffer will not be reallocated. + * + * @param buf buffer structure to init + * @param buffer byte buffer to use for the string data + * @param size size of buffer + */ +void av_bprint_init_for_buffer(AVBPrint *buf, char *buffer, unsigned size); + +/** + * Append a formatted string to a print buffer. + */ +void av_bprintf(AVBPrint *buf, const char *fmt, ...) av_printf_format(2, 3); + +/** + * Append a formatted string to a print buffer. + */ +void av_vbprintf(AVBPrint *buf, const char *fmt, va_list vl_arg); + +/** + * Append char c n times to a print buffer. + */ +void av_bprint_chars(AVBPrint *buf, char c, unsigned n); + +/** + * Append data to a print buffer. + * + * param buf bprint buffer to use + * param data pointer to data + * param size size of data + */ +void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size); + +struct tm; + +/** + * Append a formatted date and time to a print buffer. + * + * param buf bprint buffer to use + * param fmt date and time format string, see strftime() + * param tm broken-down time structure to translate + * + * @note due to poor design of the standard strftime function, it may + * produce poor results if the format string expands to a very long text and + * the bprint buffer is near the limit stated by the size_max option. + */ +void av_bprint_strftime(AVBPrint *buf, const char *fmt, const struct tm *tm); + +/** + * Allocate bytes in the buffer for external use. + * + * @param[in] buf buffer structure + * @param[in] size required size + * @param[out] mem pointer to the memory area + * @param[out] actual_size size of the memory area after allocation; + * can be larger or smaller than size + */ +void av_bprint_get_buffer(AVBPrint *buf, unsigned size, + unsigned char **mem, unsigned *actual_size); + +/** + * Reset the string to "" but keep internal allocated data. + */ +void av_bprint_clear(AVBPrint *buf); + +/** + * Test if the print buffer is complete (not truncated). + * + * It may have been truncated due to a memory allocation failure + * or the size_max limit (compare size and size_max if necessary). + */ +static inline int av_bprint_is_complete(const AVBPrint *buf) { + return buf->len < buf->size; +} + +/** + * Finalize a print buffer. + * + * The print buffer can no longer be used afterwards, + * but the len and size fields are still valid. + * + * @arg[out] ret_str if not NULL, used to return a permanent copy of the + * buffer contents, or NULL if memory allocation fails; + * if NULL, the buffer is discarded and freed + * @return 0 for success or error code (probably AVERROR(ENOMEM)) + */ +int av_bprint_finalize(AVBPrint *buf, char **ret_str); + +/** + * Escape the content in src and append it to dstbuf. + * + * @param dstbuf already inited destination bprint buffer + * @param src string containing the text to escape + * @param special_chars string containing the special characters which + * need to be escaped, can be NULL + * @param mode escape mode to employ, see AV_ESCAPE_MODE_* macros. + * Any unknown value for mode will be considered equivalent to + * AV_ESCAPE_MODE_BACKSLASH, but this behaviour can change without + * notice. + * @param flags flags which control how to escape, see AV_ESCAPE_FLAG_* macros + */ +void av_bprint_escape(AVBPrint *dstbuf, const char *src, const char *special_chars, + enum AVEscapeMode mode, int flags); + +#endif /* AVUTIL_BPRINT_H */ diff --git a/app/src/main/cpp/include/libavutil/bswap.h b/app/src/main/cpp/include/libavutil/bswap.h new file mode 100644 index 0000000..f651a11 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/bswap.h @@ -0,0 +1,112 @@ +/* + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * byte swapping routines + */ + +#ifndef AVUTIL_BSWAP_H +#define AVUTIL_BSWAP_H + +#include <stdint.h> +#include "libavutil/avconfig.h" +#include "attributes.h" + +#ifdef HAVE_AV_CONFIG_H + +#include "config.h" + +#if ARCH_AARCH64 +# include "aarch64/bswap.h" +#elif ARCH_ARM +# include "arm/bswap.h" +#elif ARCH_AVR32 +# include "avr32/bswap.h" +#elif ARCH_SH4 +# include "sh4/bswap.h" +#elif ARCH_X86 +# include "x86/bswap.h" +#endif + +#endif /* HAVE_AV_CONFIG_H */ + +#define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff)) +#define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16)) +#define AV_BSWAP64C(x) (AV_BSWAP32C(x) << 32 | AV_BSWAP32C((x) >> 32)) + +#define AV_BSWAPC(s, x) AV_BSWAP##s##C(x) + +#ifndef av_bswap16 + +static av_always_inline av_const uint16_t av_bswap16(uint16_t x) { + x = (x >> 8) | (x << 8); + return x; +} + +#endif + +#ifndef av_bswap32 + +static av_always_inline av_const uint32_t av_bswap32(uint32_t x) { + return AV_BSWAP32C(x); +} + +#endif + +#ifndef av_bswap64 + +static inline uint64_t av_const av_bswap64(uint64_t x) { + return (uint64_t) av_bswap32(x) << 32 | av_bswap32(x >> 32); +} + +#endif + +// be2ne ... big-endian to native-endian +// le2ne ... little-endian to native-endian + +#if AV_HAVE_BIGENDIAN +#define av_be2ne16(x) (x) +#define av_be2ne32(x) (x) +#define av_be2ne64(x) (x) +#define av_le2ne16(x) av_bswap16(x) +#define av_le2ne32(x) av_bswap32(x) +#define av_le2ne64(x) av_bswap64(x) +#define AV_BE2NEC(s, x) (x) +#define AV_LE2NEC(s, x) AV_BSWAPC(s, x) +#else +#define av_be2ne16(x) av_bswap16(x) +#define av_be2ne32(x) av_bswap32(x) +#define av_be2ne64(x) av_bswap64(x) +#define av_le2ne16(x) (x) +#define av_le2ne32(x) (x) +#define av_le2ne64(x) (x) +#define AV_BE2NEC(s, x) AV_BSWAPC(s, x) +#define AV_LE2NEC(s, x) (x) +#endif + +#define AV_BE2NE16C(x) AV_BE2NEC(16, x) +#define AV_BE2NE32C(x) AV_BE2NEC(32, x) +#define AV_BE2NE64C(x) AV_BE2NEC(64, x) +#define AV_LE2NE16C(x) AV_LE2NEC(16, x) +#define AV_LE2NE32C(x) AV_LE2NEC(32, x) +#define AV_LE2NE64C(x) AV_LE2NEC(64, x) + +#endif /* AVUTIL_BSWAP_H */ diff --git a/app/src/main/cpp/include/libavutil/buffer.h b/app/src/main/cpp/include/libavutil/buffer.h new file mode 100644 index 0000000..980b741 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/buffer.h @@ -0,0 +1,274 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu_buffer + * refcounted data buffer API + */ + +#ifndef AVUTIL_BUFFER_H +#define AVUTIL_BUFFER_H + +#include <stdint.h> + +/** + * @defgroup lavu_buffer AVBuffer + * @ingroup lavu_data + * + * @{ + * AVBuffer is an API for reference-counted data buffers. + * + * There are two core objects in this API -- AVBuffer and AVBufferRef. AVBuffer + * represents the data buffer itself; it is opaque and not meant to be accessed + * by the caller directly, but only through AVBufferRef. However, the caller may + * e.g. compare two AVBuffer pointers to check whether two different references + * are describing the same data buffer. AVBufferRef represents a single + * reference to an AVBuffer and it is the object that may be manipulated by the + * caller directly. + * + * There are two functions provided for creating a new AVBuffer with a single + * reference -- av_buffer_alloc() to just allocate a new buffer, and + * av_buffer_create() to wrap an existing array in an AVBuffer. From an existing + * reference, additional references may be created with av_buffer_ref(). + * Use av_buffer_unref() to free a reference (this will automatically free the + * data once all the references are freed). + * + * The convention throughout this API and the rest of FFmpeg is such that the + * buffer is considered writable if there exists only one reference to it (and + * it has not been marked as read-only). The av_buffer_is_writable() function is + * provided to check whether this is true and av_buffer_make_writable() will + * automatically create a new writable buffer when necessary. + * Of course nothing prevents the calling code from violating this convention, + * however that is safe only when all the existing references are under its + * control. + * + * @note Referencing and unreferencing the buffers is thread-safe and thus + * may be done from multiple threads simultaneously without any need for + * additional locking. + * + * @note Two different references to the same buffer can point to different + * parts of the buffer (i.e. their AVBufferRef.data will not be equal). + */ + +/** + * A reference counted buffer type. It is opaque and is meant to be used through + * references (AVBufferRef). + */ +typedef struct AVBuffer AVBuffer; + +/** + * A reference to a data buffer. + * + * The size of this struct is not a part of the public ABI and it is not meant + * to be allocated directly. + */ +typedef struct AVBufferRef { + AVBuffer *buffer; + + /** + * The data buffer. It is considered writable if and only if + * this is the only reference to the buffer, in which case + * av_buffer_is_writable() returns 1. + */ + uint8_t *data; + /** + * Size of data in bytes. + */ + int size; +} AVBufferRef; + +/** + * Allocate an AVBuffer of the given size using av_malloc(). + * + * @return an AVBufferRef of given size or NULL when out of memory + */ +AVBufferRef *av_buffer_alloc(int size); + +/** + * Same as av_buffer_alloc(), except the returned buffer will be initialized + * to zero. + */ +AVBufferRef *av_buffer_allocz(int size); + +/** + * Always treat the buffer as read-only, even when it has only one + * reference. + */ +#define AV_BUFFER_FLAG_READONLY (1 << 0) + +/** + * Create an AVBuffer from an existing array. + * + * If this function is successful, data is owned by the AVBuffer. The caller may + * only access data through the returned AVBufferRef and references derived from + * it. + * If this function fails, data is left untouched. + * @param data data array + * @param size size of data in bytes + * @param free a callback for freeing this buffer's data + * @param opaque parameter to be got for processing or passed to free + * @param flags a combination of AV_BUFFER_FLAG_* + * + * @return an AVBufferRef referring to data on success, NULL on failure. + */ +AVBufferRef *av_buffer_create(uint8_t *data, int size, + void (*free)(void *opaque, uint8_t *data), + void *opaque, int flags); + +/** + * Default free callback, which calls av_free() on the buffer data. + * This function is meant to be passed to av_buffer_create(), not called + * directly. + */ +void av_buffer_default_free(void *opaque, uint8_t *data); + +/** + * Create a new reference to an AVBuffer. + * + * @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on + * failure. + */ +AVBufferRef *av_buffer_ref(AVBufferRef *buf); + +/** + * Free a given reference and automatically free the buffer if there are no more + * references to it. + * + * @param buf the reference to be freed. The pointer is set to NULL on return. + */ +void av_buffer_unref(AVBufferRef **buf); + +/** + * @return 1 if the caller may write to the data referred to by buf (which is + * true if and only if buf is the only reference to the underlying AVBuffer). + * Return 0 otherwise. + * A positive answer is valid until av_buffer_ref() is called on buf. + */ +int av_buffer_is_writable(const AVBufferRef *buf); + +/** + * @return the opaque parameter set by av_buffer_create. + */ +void *av_buffer_get_opaque(const AVBufferRef *buf); + +int av_buffer_get_ref_count(const AVBufferRef *buf); + +/** + * Create a writable reference from a given buffer reference, avoiding data copy + * if possible. + * + * @param buf buffer reference to make writable. On success, buf is either left + * untouched, or it is unreferenced and a new writable AVBufferRef is + * written in its place. On failure, buf is left untouched. + * @return 0 on success, a negative AVERROR on failure. + */ +int av_buffer_make_writable(AVBufferRef **buf); + +/** + * Reallocate a given buffer. + * + * @param buf a buffer reference to reallocate. On success, buf will be + * unreferenced and a new reference with the required size will be + * written in its place. On failure buf will be left untouched. *buf + * may be NULL, then a new buffer is allocated. + * @param size required new buffer size. + * @return 0 on success, a negative AVERROR on failure. + * + * @note the buffer is actually reallocated with av_realloc() only if it was + * initially allocated through av_buffer_realloc(NULL) and there is only one + * reference to it (i.e. the one passed to this function). In all other cases + * a new buffer is allocated and the data is copied. + */ +int av_buffer_realloc(AVBufferRef **buf, int size); + +/** + * @} + */ + +/** + * @defgroup lavu_bufferpool AVBufferPool + * @ingroup lavu_data + * + * @{ + * AVBufferPool is an API for a lock-free thread-safe pool of AVBuffers. + * + * Frequently allocating and freeing large buffers may be slow. AVBufferPool is + * meant to solve this in cases when the caller needs a set of buffers of the + * same size (the most obvious use case being buffers for raw video or audio + * frames). + * + * At the beginning, the user must call av_buffer_pool_init() to create the + * buffer pool. Then whenever a buffer is needed, call av_buffer_pool_get() to + * get a reference to a new buffer, similar to av_buffer_alloc(). This new + * reference works in all aspects the same way as the one created by + * av_buffer_alloc(). However, when the last reference to this buffer is + * unreferenced, it is returned to the pool instead of being freed and will be + * reused for subsequent av_buffer_pool_get() calls. + * + * When the caller is done with the pool and no longer needs to allocate any new + * buffers, av_buffer_pool_uninit() must be called to mark the pool as freeable. + * Once all the buffers are released, it will automatically be freed. + * + * Allocating and releasing buffers with this API is thread-safe as long as + * either the default alloc callback is used, or the user-supplied one is + * thread-safe. + */ + +/** + * The buffer pool. This structure is opaque and not meant to be accessed + * directly. It is allocated with av_buffer_pool_init() and freed with + * av_buffer_pool_uninit(). + */ +typedef struct AVBufferPool AVBufferPool; + +/** + * Allocate and initialize a buffer pool. + * + * @param size size of each buffer in this pool + * @param alloc a function that will be used to allocate new buffers when the + * pool is empty. May be NULL, then the default allocator will be used + * (av_buffer_alloc()). + * @return newly created buffer pool on success, NULL on error. + */ +AVBufferPool *av_buffer_pool_init(int size, AVBufferRef *(*alloc)(int size)); + +/** + * Mark the pool as being available for freeing. It will actually be freed only + * once all the allocated buffers associated with the pool are released. Thus it + * is safe to call this function while some of the allocated buffers are still + * in use. + * + * @param pool pointer to the pool to be freed. It will be set to NULL. + * @see av_buffer_pool_can_uninit() + */ +void av_buffer_pool_uninit(AVBufferPool **pool); + +/** + * Allocate a new AVBuffer, reusing an old buffer from the pool when available. + * This function may be called simultaneously from multiple threads. + * + * @return a reference to the new buffer on success, NULL on error. + */ +AVBufferRef *av_buffer_pool_get(AVBufferPool *pool); + +/** + * @} + */ + +#endif /* AVUTIL_BUFFER_H */ diff --git a/app/src/main/cpp/include/libavutil/cast5.h b/app/src/main/cpp/include/libavutil/cast5.h new file mode 100644 index 0000000..3bb5144 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/cast5.h @@ -0,0 +1,68 @@ +/* + * An implementation of the CAST128 algorithm as mentioned in RFC2144 + * Copyright (c) 2014 Supraja Meedinti + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CAST5_H +#define AVUTIL_CAST5_H + +#include <stdint.h> + + +/** + * @file + * @brief Public header for libavutil CAST5 algorithm + * @defgroup lavu_cast5 CAST5 + * @ingroup lavu_crypto + * @{ + */ + +extern const int av_cast5_size; + +struct AVCAST5; + +/** + * Allocate an AVCAST5 context + * To free the struct: av_free(ptr) + */ +struct AVCAST5 *av_cast5_alloc(void); + +/** + * Initialize an AVCAST5 context. + * + * @param ctx an AVCAST5 context + * @param key a key of 5,6,...16 bytes used for encryption/decryption + * @param key_bits number of keybits: possible are 40,48,...,128 + */ +int av_cast5_init(struct AVCAST5 *ctx, const uint8_t *key, int key_bits); + +/** + * Encrypt or decrypt a buffer using a previously initialized context + * + * @param ctx an AVCAST5 context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_cast5_crypt(struct AVCAST5 *ctx, uint8_t *dst, const uint8_t *src, int count, int decrypt); +/** + * @} + */ +#endif /* AVUTIL_CAST5_H */ diff --git a/app/src/main/cpp/include/libavutil/channel_layout.h b/app/src/main/cpp/include/libavutil/channel_layout.h new file mode 100644 index 0000000..bbdae47 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/channel_layout.h @@ -0,0 +1,224 @@ +/* + * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> + * Copyright (c) 2008 Peter Ross + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CHANNEL_LAYOUT_H +#define AVUTIL_CHANNEL_LAYOUT_H + +#include <stdint.h> + +/** + * @file + * audio channel layout utility functions + */ + +/** + * @addtogroup lavu_audio + * @{ + */ + +/** + * @defgroup channel_masks Audio channel masks + * + * A channel layout is a 64-bits integer with a bit set for every channel. + * The number of bits set must be equal to the number of channels. + * The value 0 means that the channel layout is not known. + * @note this data structure is not powerful enough to handle channels + * combinations that have the same channel multiple times, such as + * dual-mono. + * + * @{ + */ +#define AV_CH_FRONT_LEFT 0x00000001 +#define AV_CH_FRONT_RIGHT 0x00000002 +#define AV_CH_FRONT_CENTER 0x00000004 +#define AV_CH_LOW_FREQUENCY 0x00000008 +#define AV_CH_BACK_LEFT 0x00000010 +#define AV_CH_BACK_RIGHT 0x00000020 +#define AV_CH_FRONT_LEFT_OF_CENTER 0x00000040 +#define AV_CH_FRONT_RIGHT_OF_CENTER 0x00000080 +#define AV_CH_BACK_CENTER 0x00000100 +#define AV_CH_SIDE_LEFT 0x00000200 +#define AV_CH_SIDE_RIGHT 0x00000400 +#define AV_CH_TOP_CENTER 0x00000800 +#define AV_CH_TOP_FRONT_LEFT 0x00001000 +#define AV_CH_TOP_FRONT_CENTER 0x00002000 +#define AV_CH_TOP_FRONT_RIGHT 0x00004000 +#define AV_CH_TOP_BACK_LEFT 0x00008000 +#define AV_CH_TOP_BACK_CENTER 0x00010000 +#define AV_CH_TOP_BACK_RIGHT 0x00020000 +#define AV_CH_STEREO_LEFT 0x20000000 ///< Stereo downmix. +#define AV_CH_STEREO_RIGHT 0x40000000 ///< See AV_CH_STEREO_LEFT. +#define AV_CH_WIDE_LEFT 0x0000000080000000ULL +#define AV_CH_WIDE_RIGHT 0x0000000100000000ULL +#define AV_CH_SURROUND_DIRECT_LEFT 0x0000000200000000ULL +#define AV_CH_SURROUND_DIRECT_RIGHT 0x0000000400000000ULL +#define AV_CH_LOW_FREQUENCY_2 0x0000000800000000ULL + +/** Channel mask value used for AVCodecContext.request_channel_layout + to indicate that the user requests the channel order of the decoder output + to be the native codec channel order. */ +#define AV_CH_LAYOUT_NATIVE 0x8000000000000000ULL + +/** + * @} + * @defgroup channel_mask_c Audio channel layouts + * @{ + * */ +#define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER) +#define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT) +#define AV_CH_LAYOUT_2POINT1 (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER) +#define AV_CH_LAYOUT_3POINT1 (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_4POINT1 (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) +#define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) +#define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT0_FRONT (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT1_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT1_FRONT (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_7POINT0_FRONT (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT) + +enum AVMatrixEncoding { + AV_MATRIX_ENCODING_NONE, + AV_MATRIX_ENCODING_DOLBY, + AV_MATRIX_ENCODING_DPLII, + AV_MATRIX_ENCODING_DPLIIX, + AV_MATRIX_ENCODING_DPLIIZ, + AV_MATRIX_ENCODING_DOLBYEX, + AV_MATRIX_ENCODING_DOLBYHEADPHONE, + AV_MATRIX_ENCODING_NB +}; + +/** + * Return a channel layout id that matches name, or 0 if no match is found. + * + * name can be one or several of the following notations, + * separated by '+' or '|': + * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0, + * 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix); + * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC, + * SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR); + * - a number of channels, in decimal, optionally followed by 'c', yielding + * the default channel layout for that number of channels (@see + * av_get_default_channel_layout); + * - a channel layout mask, in hexadecimal starting with "0x" (see the + * AV_CH_* macros). + * + * @warning Starting from the next major bump the trailing character + * 'c' to specify a number of channels will be required, while a + * channel layout mask could also be specified as a decimal number + * (if and only if not followed by "c"). + * + * Example: "stereo+FC" = "2c+FC" = "2c+1c" = "0x7" + */ +uint64_t av_get_channel_layout(const char *name); + +/** + * Return a description of a channel layout. + * If nb_channels is <= 0, it is guessed from the channel_layout. + * + * @param buf put here the string containing the channel layout + * @param buf_size size in bytes of the buffer + */ +void +av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout); + +struct AVBPrint; + +/** + * Append a description of a channel layout to a bprint buffer. + */ +void av_bprint_channel_layout(struct AVBPrint *bp, int nb_channels, uint64_t channel_layout); + +/** + * Return the number of channels in the channel layout. + */ +int av_get_channel_layout_nb_channels(uint64_t channel_layout); + +/** + * Return default channel layout for a given number of channels. + */ +int64_t av_get_default_channel_layout(int nb_channels); + +/** + * Get the index of a channel in channel_layout. + * + * @param channel a channel layout describing exactly one channel which must be + * present in channel_layout. + * + * @return index of channel in channel_layout on success, a negative AVERROR + * on error. + */ +int av_get_channel_layout_channel_index(uint64_t channel_layout, + uint64_t channel); + +/** + * Get the channel with the given index in channel_layout. + */ +uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index); + +/** + * Get the name of a given channel. + * + * @return channel name on success, NULL on error. + */ +const char *av_get_channel_name(uint64_t channel); + +/** + * Get the description of a given channel. + * + * @param channel a channel layout with a single channel + * @return channel description on success, NULL on error + */ +const char *av_get_channel_description(uint64_t channel); + +/** + * Get the value and name of a standard channel layout. + * + * @param[in] index index in an internal list, starting at 0 + * @param[out] layout channel layout mask + * @param[out] name name of the layout + * @return 0 if the layout exists, + * <0 if index is beyond the limits + */ +int av_get_standard_channel_layout(unsigned index, uint64_t *layout, + const char **name); + +/** + * @} + * @} + */ + +#endif /* AVUTIL_CHANNEL_LAYOUT_H */ diff --git a/app/src/main/cpp/include/libavutil/common.h b/app/src/main/cpp/include/libavutil/common.h new file mode 100644 index 0000000..13fae0b --- /dev/null +++ b/app/src/main/cpp/include/libavutil/common.h @@ -0,0 +1,458 @@ +/* + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * common internal and external API header + */ + +#ifndef AVUTIL_COMMON_H +#define AVUTIL_COMMON_H + +#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS) && !defined(UINT64_C) +#error missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS +#endif + +#include <errno.h> +#include <inttypes.h> +#include <limits.h> +#include <math.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "attributes.h" +#include "version.h" +#include "libavutil/avconfig.h" + +#if AV_HAVE_BIGENDIAN +# define AV_NE(be, le) (be) +#else +# define AV_NE(be, le) (le) +#endif + +//rounded division & shift +#define RSHIFT(a, b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) +/* assume b>0 */ +#define ROUNDED_DIV(a, b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) +/* assume a>0 and b>0 */ +#define FF_CEIL_RSHIFT(a, b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \ + : ((a) + (1<<(b)) - 1) >> (b)) +#define FFUDIV(a, b) (((a)>0 ?(a):(a)-(b)+1) / (b)) +#define FFUMOD(a, b) ((a)-(b)*FFUDIV(a,b)) +#define FFABS(a) ((a) >= 0 ? (a) : (-(a))) +#define FFSIGN(a) ((a) > 0 ? 1 : -1) + +#define FFMAX(a, b) ((a) > (b) ? (a) : (b)) +#define FFMAX3(a, b, c) FFMAX(FFMAX(a,b),c) +#define FFMIN(a, b) ((a) > (b) ? (b) : (a)) +#define FFMIN3(a, b, c) FFMIN(FFMIN(a,b),c) + +#define FFSWAP(type, a, b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) +#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) +#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1)) + +/* misc math functions */ + +/** + * Reverse the order of the bits of an 8-bits unsigned integer. + */ +#if FF_API_AV_REVERSE +extern attribute_deprecated const uint8_t av_reverse[256]; +#endif + +#ifdef HAVE_AV_CONFIG_H +# include "config.h" +# include "intmath.h" +#endif + +/* Pull in unguarded fallback defines at the end of this file. */ +#include "common.h" + +#ifndef av_log2 + +av_const int av_log2(unsigned v); + +#endif + +#ifndef av_log2_16bit + +av_const int av_log2_16bit(unsigned v); + +#endif + +/** + * Clip a signed integer value into the amin-amax range. + * @param a value to clip + * @param amin minimum value of the clip range + * @param amax maximum value of the clip range + * @return clipped value + */ +static av_always_inline av_const int av_clip_c(int a, int amin, int amax) { +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 + if (amin > amax) abort(); +#endif + if (a < amin) return amin; + else if (a > amax) return amax; + else return a; +} + +/** + * Clip a signed 64bit integer value into the amin-amax range. + * @param a value to clip + * @param amin minimum value of the clip range + * @param amax maximum value of the clip range + * @return clipped value + */ +static av_always_inline av_const int64_t av_clip64_c(int64_t a, int64_t amin, int64_t amax) { +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 + if (amin > amax) abort(); +#endif + if (a < amin) return amin; + else if (a > amax) return amax; + else return a; +} + +/** + * Clip a signed integer value into the 0-255 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const uint8_t av_clip_uint8_c(int a) { + if (a & (~0xFF)) return (-a) >> 31; + else return a; +} + +/** + * Clip a signed integer value into the -128,127 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const int8_t av_clip_int8_c(int a) { + if ((a + 0x80) & ~0xFF) return (a >> 31) ^ 0x7F; + else return a; +} + +/** + * Clip a signed integer value into the 0-65535 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const uint16_t av_clip_uint16_c(int a) { + if (a & (~0xFFFF)) return (-a) >> 31; + else return a; +} + +/** + * Clip a signed integer value into the -32768,32767 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const int16_t av_clip_int16_c(int a) { + if ((a + 0x8000) & ~0xFFFF) return (a >> 31) ^ 0x7FFF; + else return a; +} + +/** + * Clip a signed 64-bit integer value into the -2147483648,2147483647 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a) { + if ((a + 0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (int32_t) ((a >> 63) ^ 0x7FFFFFFF); + else return (int32_t) a; +} + +/** + * Clip a signed integer to an unsigned power of two range. + * @param a value to clip + * @param p bit position to clip at + * @return clipped value + */ +static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p) { + if (a & ~((1 << p) - 1)) return -a >> 31 & ((1 << p) - 1); + else return a; +} + +/** + * Add two signed 32-bit values with saturation. + * + * @param a one value + * @param b another value + * @return sum with signed saturation + */ +static av_always_inline int av_sat_add32_c(int a, int b) { + return av_clipl_int32((int64_t) a + b); +} + +/** + * Add a doubled value to another value with saturation at both stages. + * + * @param a first value + * @param b value doubled and added to a + * @return sum with signed saturation + */ +static av_always_inline int av_sat_dadd32_c(int a, int b) { + return av_sat_add32(a, av_sat_add32(b, b)); +} + +/** + * Clip a float value into the amin-amax range. + * @param a value to clip + * @param amin minimum value of the clip range + * @param amax maximum value of the clip range + * @return clipped value + */ +static av_always_inline av_const float av_clipf_c(float a, float amin, float amax) { +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 + if (amin > amax) abort(); +#endif + if (a < amin) return amin; + else if (a > amax) return amax; + else return a; +} + +/** + * Clip a double value into the amin-amax range. + * @param a value to clip + * @param amin minimum value of the clip range + * @param amax maximum value of the clip range + * @return clipped value + */ +static av_always_inline av_const double av_clipd_c(double a, double amin, double amax) { +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 + if (amin > amax) abort(); +#endif + if (a < amin) return amin; + else if (a > amax) return amax; + else return a; +} + +/** Compute ceil(log2(x)). + * @param x value used to compute ceil(log2(x)) + * @return computed ceiling of log2(x) + */ +static av_always_inline av_const int av_ceil_log2_c(int x) { + return av_log2((x - 1) << 1); +} + +/** + * Count number of bits set to one in x + * @param x value to count bits of + * @return the number of bits set to one in x + */ +static av_always_inline av_const int av_popcount_c(uint32_t x) { + x -= (x >> 1) & 0x55555555; + x = (x & 0x33333333) + ((x >> 2) & 0x33333333); + x = (x + (x >> 4)) & 0x0F0F0F0F; + x += x >> 8; + return (x + (x >> 16)) & 0x3F; +} + +/** + * Count number of bits set to one in x + * @param x value to count bits of + * @return the number of bits set to one in x + */ +static av_always_inline av_const int av_popcount64_c(uint64_t x) { + return av_popcount((uint32_t) x) + av_popcount((uint32_t) (x >> 32)); +} + +#define MKTAG(a, b, c, d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) +#define MKBETAG(a, b, c, d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) + +/** + * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form. + * + * @param val Output value, must be an lvalue of type uint32_t. + * @param GET_BYTE Expression reading one byte from the input. + * Evaluated up to 7 times (4 for the currently + * assigned Unicode range). With a memory buffer + * input, this could be *ptr++. + * @param ERROR Expression to be evaluated on invalid input, + * typically a goto statement. + * + * @warning ERROR should not contain a loop control statement which + * could interact with the internal while loop, and should force an + * exit from the macro code (e.g. through a goto or a return) in order + * to prevent undefined results. + */ +#define GET_UTF8(val, GET_BYTE, ERROR)\ + val= GET_BYTE;\ + {\ + uint32_t top = (val & 128) >> 1;\ + if ((val & 0xc0) == 0x80 || val >= 0xFE)\ + ERROR\ + while (val & top) {\ + int tmp= GET_BYTE - 128;\ + if(tmp>>6)\ + ERROR\ + val= (val<<6) + tmp;\ + top <<= 5;\ + }\ + val &= (top << 1) - 1;\ + } + +/** + * Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form. + * + * @param val Output value, must be an lvalue of type uint32_t. + * @param GET_16BIT Expression returning two bytes of UTF-16 data converted + * to native byte order. Evaluated one or two times. + * @param ERROR Expression to be evaluated on invalid input, + * typically a goto statement. + */ +#define GET_UTF16(val, GET_16BIT, ERROR)\ + val = GET_16BIT;\ + {\ + unsigned int hi = val - 0xD800;\ + if (hi < 0x800) {\ + val = GET_16BIT - 0xDC00;\ + if (val > 0x3FFU || hi > 0x3FFU)\ + ERROR\ + val += (hi<<10) + 0x10000;\ + }\ + }\ + +/** + * @def PUT_UTF8(val, tmp, PUT_BYTE) + * Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long). + * @param val is an input-only argument and should be of type uint32_t. It holds + * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If + * val is given as a function it is executed only once. + * @param tmp is a temporary variable and should be of type uint8_t. It + * represents an intermediate value during conversion that is to be + * output by PUT_BYTE. + * @param PUT_BYTE writes the converted UTF-8 bytes to any proper destination. + * It could be a function or a statement, and uses tmp as the input byte. + * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be + * executed up to 4 times for values in the valid UTF-8 range and up to + * 7 times in the general case, depending on the length of the converted + * Unicode character. + */ +#define PUT_UTF8(val, tmp, PUT_BYTE)\ + {\ + int bytes, shift;\ + uint32_t in = val;\ + if (in < 0x80) {\ + tmp = in;\ + PUT_BYTE\ + } else {\ + bytes = (av_log2(in) + 4) / 5;\ + shift = (bytes - 1) * 6;\ + tmp = (256 - (256 >> bytes)) | (in >> shift);\ + PUT_BYTE\ + while (shift >= 6) {\ + shift -= 6;\ + tmp = 0x80 | ((in >> shift) & 0x3f);\ + PUT_BYTE\ + }\ + }\ + } + +/** + * @def PUT_UTF16(val, tmp, PUT_16BIT) + * Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes). + * @param val is an input-only argument and should be of type uint32_t. It holds + * a UCS-4 encoded Unicode character that is to be converted to UTF-16. If + * val is given as a function it is executed only once. + * @param tmp is a temporary variable and should be of type uint16_t. It + * represents an intermediate value during conversion that is to be + * output by PUT_16BIT. + * @param PUT_16BIT writes the converted UTF-16 data to any proper destination + * in desired endianness. It could be a function or a statement, and uses tmp + * as the input byte. For example, PUT_BYTE could be "*output++ = tmp;" + * PUT_BYTE will be executed 1 or 2 times depending on input character. + */ +#define PUT_UTF16(val, tmp, PUT_16BIT)\ + {\ + uint32_t in = val;\ + if (in < 0x10000) {\ + tmp = in;\ + PUT_16BIT\ + } else {\ + tmp = 0xD800 | ((in - 0x10000) >> 10);\ + PUT_16BIT\ + tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\ + PUT_16BIT\ + }\ + }\ + + + +#include "mem.h" + +#ifdef HAVE_AV_CONFIG_H +# include "internal.h" +#endif /* HAVE_AV_CONFIG_H */ + +#endif /* AVUTIL_COMMON_H */ + +/* + * The following definitions are outside the multiple inclusion guard + * to ensure they are immediately available in intmath.h. + */ + +#ifndef av_ceil_log2 +# define av_ceil_log2 av_ceil_log2_c +#endif +#ifndef av_clip +# define av_clip av_clip_c +#endif +#ifndef av_clip64 +# define av_clip64 av_clip64_c +#endif +#ifndef av_clip_uint8 +# define av_clip_uint8 av_clip_uint8_c +#endif +#ifndef av_clip_int8 +# define av_clip_int8 av_clip_int8_c +#endif +#ifndef av_clip_uint16 +# define av_clip_uint16 av_clip_uint16_c +#endif +#ifndef av_clip_int16 +# define av_clip_int16 av_clip_int16_c +#endif +#ifndef av_clipl_int32 +# define av_clipl_int32 av_clipl_int32_c +#endif +#ifndef av_clip_uintp2 +# define av_clip_uintp2 av_clip_uintp2_c +#endif +#ifndef av_sat_add32 +# define av_sat_add32 av_sat_add32_c +#endif +#ifndef av_sat_dadd32 +# define av_sat_dadd32 av_sat_dadd32_c +#endif +#ifndef av_clipf +# define av_clipf av_clipf_c +#endif +#ifndef av_clipd +# define av_clipd av_clipd_c +#endif +#ifndef av_popcount +# define av_popcount av_popcount_c +#endif +#ifndef av_popcount64 +# define av_popcount64 av_popcount64_c +#endif diff --git a/app/src/main/cpp/include/libavutil/cpu.h b/app/src/main/cpp/include/libavutil/cpu.h new file mode 100644 index 0000000..072c76c --- /dev/null +++ b/app/src/main/cpp/include/libavutil/cpu.h @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2000, 2001, 2002 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CPU_H +#define AVUTIL_CPU_H + +#include "attributes.h" + +#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ + +/* lower 16 bits - CPU features */ +#define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX +#define AV_CPU_FLAG_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext +#define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext +#define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW +#define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions +#define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions +#define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster +///< than regular MMX/SSE (e.g. Core1) +#define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt +#define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions +#define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster +///< than regular MMX/SSE (e.g. Core1) +#define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions +#define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower +#define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions +#define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions +#define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used +#define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions +#define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions +// #if LIBAVUTIL_VERSION_MAJOR <52 +#define AV_CPU_FLAG_CMOV 0x1001000 ///< supports cmov instruction +// #else +// #define AV_CPU_FLAG_CMOV 0x1000 ///< supports cmov instruction +// #endif +#define AV_CPU_FLAG_AVX2 0x8000 ///< AVX2 functions: requires OS support even if YMM registers aren't used +#define AV_CPU_FLAG_FMA3 0x10000 ///< Haswell FMA3 functions +#define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1 +#define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2 + +#define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard + +#define AV_CPU_FLAG_ARMV5TE (1 << 0) +#define AV_CPU_FLAG_ARMV6 (1 << 1) +#define AV_CPU_FLAG_ARMV6T2 (1 << 2) +#define AV_CPU_FLAG_VFP (1 << 3) +#define AV_CPU_FLAG_VFPV3 (1 << 4) +#define AV_CPU_FLAG_NEON (1 << 5) +#define AV_CPU_FLAG_ARMV8 (1 << 6) +#define AV_CPU_FLAG_SETEND (1 <<16) + +/** + * Return the flags which specify extensions supported by the CPU. + * The returned value is affected by av_force_cpu_flags() if that was used + * before. So av_get_cpu_flags() can easily be used in a application to + * detect the enabled cpu flags. + */ +int av_get_cpu_flags(void); + +/** + * Disables cpu detection and forces the specified flags. + * -1 is a special case that disables forcing of specific flags. + */ +void av_force_cpu_flags(int flags); + +/** + * Set a mask on flags returned by av_get_cpu_flags(). + * This function is mainly useful for testing. + * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible + * + * @warning this function is not thread safe. + */ +attribute_deprecated void av_set_cpu_flags_mask(int mask); + +/** + * Parse CPU flags from a string. + * + * The returned flags contain the specified flags as well as related unspecified flags. + * + * This function exists only for compatibility with libav. + * Please use av_parse_cpu_caps() when possible. + * @return a combination of AV_CPU_* flags, negative on error. + */ +attribute_deprecated +int av_parse_cpu_flags(const char *s); + +/** + * Parse CPU caps from a string and update the given AV_CPU_* flags based on that. + * + * @return negative on error. + */ +int av_parse_cpu_caps(unsigned *flags, const char *s); + +/** + * @return the number of logical CPU cores present. + */ +int av_cpu_count(void); + +#endif /* AVUTIL_CPU_H */ diff --git a/app/src/main/cpp/include/libavutil/crc.h b/app/src/main/cpp/include/libavutil/crc.h new file mode 100644 index 0000000..ef27a20 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/crc.h @@ -0,0 +1,86 @@ +/* + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CRC_H +#define AVUTIL_CRC_H + +#include <stdint.h> +#include <stddef.h> +#include "attributes.h" + +/** + * @defgroup lavu_crc32 CRC32 + * @ingroup lavu_crypto + * @{ + */ + +typedef uint32_t AVCRC; + +typedef enum { + AV_CRC_8_ATM, + AV_CRC_16_ANSI, + AV_CRC_16_CCITT, + AV_CRC_32_IEEE, + AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ + AV_CRC_16_ANSI_LE, /*< reversed bitorder version of AV_CRC_16_ANSI */ + AV_CRC_24_IEEE = 12, + AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ +} AVCRCId; + +/** + * Initialize a CRC table. + * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024 + * @param le If 1, the lowest bit represents the coefficient for the highest + * exponent of the corresponding polynomial (both for poly and + * actual CRC). + * If 0, you must swap the CRC parameter and the result of av_crc + * if you need the standard representation (can be simplified in + * most cases to e.g. bswap16): + * av_bswap32(crc << (32-bits)) + * @param bits number of bits for the CRC + * @param poly generator polynomial without the x**bits coefficient, in the + * representation as specified by le + * @param ctx_size size of ctx in bytes + * @return <0 on failure + */ +int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size); + +/** + * Get an initialized standard CRC table. + * @param crc_id ID of a standard CRC + * @return a pointer to the CRC table or NULL on failure + */ +const AVCRC *av_crc_get_table(AVCRCId crc_id); + +/** + * Calculate the CRC of a block. + * @param crc CRC of previous blocks if any or initial value for CRC + * @return CRC updated with the data from the given block + * + * @see av_crc_init() "le" parameter + */ +uint32_t av_crc(const AVCRC *ctx, uint32_t crc, + const uint8_t *buffer, size_t length) av_pure; + +/** + * @} + */ + +#endif /* AVUTIL_CRC_H */ diff --git a/app/src/main/cpp/include/libavutil/dict.h b/app/src/main/cpp/include/libavutil/dict.h new file mode 100644 index 0000000..8720307 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/dict.h @@ -0,0 +1,196 @@ +/* + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Public dictionary API. + * @deprecated + * AVDictionary is provided for compatibility with libav. It is both in + * implementation as well as API inefficient. It does not scale and is + * extremely slow with large dictionaries. + * It is recommended that new code uses our tree container from tree.c/h + * where applicable, which uses AVL trees to achieve O(log n) performance. + */ + +#ifndef AVUTIL_DICT_H +#define AVUTIL_DICT_H + +#include <stdint.h> + +#include "version.h" + +/** + * @addtogroup lavu_dict AVDictionary + * @ingroup lavu_data + * + * @brief Simple key:value store + * + * @{ + * Dictionaries are used for storing key:value pairs. To create + * an AVDictionary, simply pass an address of a NULL pointer to + * av_dict_set(). NULL can be used as an empty dictionary wherever + * a pointer to an AVDictionary is required. + * Use av_dict_get() to retrieve an entry or iterate over all + * entries and finally av_dict_free() to free the dictionary + * and all its contents. + * + @code + AVDictionary *d = NULL; // "create" an empty dictionary + AVDictionaryEntry *t = NULL; + + av_dict_set(&d, "foo", "bar", 0); // add an entry + + char *k = av_strdup("key"); // if your strings are already allocated, + char *v = av_strdup("value"); // you can avoid copying them like this + av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); + + while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) { + <....> // iterate over all entries in d + } + av_dict_free(&d); + @endcode + * + */ + +#define AV_DICT_MATCH_CASE 1 /**< Only get an entry with exact-case key match. Only relevant in av_dict_get(). */ +#define AV_DICT_IGNORE_SUFFIX 2 /**< Return first entry in a dictionary whose first part corresponds to the search key, + ignoring the suffix of the found key string. Only relevant in av_dict_get(). */ +#define AV_DICT_DONT_STRDUP_KEY 4 /**< Take ownership of a key that's been + allocated with av_malloc() or another memory allocation function. */ +#define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been + allocated with av_malloc() or another memory allocation function. */ +#define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries. +#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no + delimiter is added, the strings are simply concatenated. */ + +typedef struct AVDictionaryEntry { + char *key; + char *value; +} AVDictionaryEntry; + +typedef struct AVDictionary AVDictionary; + +/** + * Get a dictionary entry with matching key. + * + * The returned entry key or value must not be changed, or it will + * cause undefined behavior. + * + * To iterate through all the dictionary entries, you can set the matching key + * to the null string "" and set the AV_DICT_IGNORE_SUFFIX flag. + * + * @param prev Set to the previous matching element to find the next. + * If set to NULL the first matching element is returned. + * @param key matching key + * @param flags a collection of AV_DICT_* flags controlling how the entry is retrieved + * @return found entry or NULL in case no matching entry was found in the dictionary + */ +AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key, + const AVDictionaryEntry *prev, int flags); + +/** + * Get number of entries in dictionary. + * + * @param m dictionary + * @return number of entries in dictionary + */ +int av_dict_count(const AVDictionary *m); + +/** + * Set the given entry in *pm, overwriting an existing entry. + * + * Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set, + * these arguments will be freed on error. + * + * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL + * a dictionary struct is allocated and put in *pm. + * @param key entry key to add to *pm (will be av_strduped depending on flags) + * @param value entry value to add to *pm (will be av_strduped depending on flags). + * Passing a NULL value will cause an existing entry to be deleted. + * @return >= 0 on success otherwise an error code <0 + */ +int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags); + +/** + * Convenience wrapper for av_dict_set that converts the value to a string + * and stores it. + * + * Note: If AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error. + */ +int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags); + +/** + * Parse the key/value pairs list and add the parsed entries to a dictionary. + * + * In case of failure, all the successfully set entries are stored in + * *pm. You may need to manually free the created dictionary. + * + * @param key_val_sep a 0-terminated list of characters used to separate + * key from value + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other + * @param flags flags to use when adding to dictionary. + * AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL + * are ignored since the key/value tokens will always + * be duplicated. + * @return 0 on success, negative AVERROR code on failure + */ +int av_dict_parse_string(AVDictionary **pm, const char *str, + const char *key_val_sep, const char *pairs_sep, + int flags); + +/** + * Copy entries from one AVDictionary struct into another. + * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL, + * this function will allocate a struct for you and put it in *dst + * @param src pointer to source AVDictionary struct + * @param flags flags to use when setting entries in *dst + * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag + */ +void av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags); + +/** + * Free all the memory allocated for an AVDictionary struct + * and all keys and values. + */ +void av_dict_free(AVDictionary **m); + +/** + * Get dictionary entries as a string. + * + * Create a string containing dictionary's entries. + * Such string may be passed back to av_dict_parse_string(). + * @note String is escaped with backslashes ('\'). + * + * @param[in] m dictionary + * @param[out] buffer Pointer to buffer that will be allocated with string containg entries. + * Buffer must be freed by the caller when is no longer needed. + * @param[in] key_val_sep character used to separate key from value + * @param[in] pairs_sep character used to separate two pairs from each other + * @return >= 0 on success, negative on error + * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same. + */ +int av_dict_get_string(const AVDictionary *m, char **buffer, + const char key_val_sep, const char pairs_sep); + +/** + * @} + */ + +#endif /* AVUTIL_DICT_H */ diff --git a/app/src/main/cpp/include/libavutil/display.h b/app/src/main/cpp/include/libavutil/display.h new file mode 100644 index 0000000..2cb930d --- /dev/null +++ b/app/src/main/cpp/include/libavutil/display.h @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2014 Vittorio Giovara <vittorio.giovara@gmail.com> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_DISPLAY_H +#define AVUTIL_DISPLAY_H + +#include <stdint.h> + +/** + * The display transformation matrix specifies an affine transformation that + * should be applied to video frames for correct presentation. It is compatible + * with the matrices stored in the ISO/IEC 14496-12 container format. + * + * The data is a 3x3 matrix represented as a 9-element array: + * + * | a b u | + * (a, b, u, c, d, v, x, y, w) -> | c d v | + * | x y w | + * + * All numbers are stored in native endianness, as 16.16 fixed-point values, + * except for u, v and w, which are stored as 2.30 fixed-point values. + * + * The transformation maps a point (p, q) in the source (pre-transformation) + * frame to the point (p', q') in the destination (post-transformation) frame as + * follows: + * | a b u | + * (p, q, 1) . | c d v | = z * (p', q', 1) + * | x y w | + * + * The transformation can also be more explicitly written in components as + * follows: + * p' = (a * p + c * q + x) / z; + * q' = (b * p + d * q + y) / z; + * z = u * p + v * q + w + */ + +/** + * Extract the rotation component of the transformation matrix. + * + * @param matrix the transformation matrix + * @return the angle (in degrees) by which the transformation rotates the frame. + * The angle will be in range [-180.0, 180.0], or NaN if the matrix is + * singular. + * + * @note floating point numbers are inherently inexact, so callers are + * recommended to round the return value to nearest integer before use. + */ +double av_display_rotation_get(const int32_t matrix[9]); + +/** + * Initialize a transformation matrix describing a pure rotation by the + * specified angle (in degrees). + * + * @param matrix an allocated transformation matrix (will be fully overwritten + * by this function) + * @param angle rotation angle in degrees. + */ +void av_display_rotation_set(int32_t matrix[9], double angle); + +/** + * Flip the input matrix horizontally and/or vertically. + * + * @param matrix an allocated transformation matrix + * @param hflip whether the matrix should be flipped horizontally + * @param vflip whether the matrix should be flipped vertically + */ +void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip); + +#endif /* AVUTIL_DISPLAY_H */ diff --git a/app/src/main/cpp/include/libavutil/downmix_info.h b/app/src/main/cpp/include/libavutil/downmix_info.h new file mode 100644 index 0000000..221cf5b --- /dev/null +++ b/app/src/main/cpp/include/libavutil/downmix_info.h @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2014 Tim Walker <tdskywalker@gmail.com> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_DOWNMIX_INFO_H +#define AVUTIL_DOWNMIX_INFO_H + +#include "frame.h" + +/** + * @file + * audio downmix medatata + */ + +/** + * @addtogroup lavu_audio + * @{ + */ + +/** + * @defgroup downmix_info Audio downmix metadata + * @{ + */ + +/** + * Possible downmix types. + */ +enum AVDownmixType { + AV_DOWNMIX_TYPE_UNKNOWN, /**< Not indicated. */ + AV_DOWNMIX_TYPE_LORO, /**< Lo/Ro 2-channel downmix (Stereo). */ + AV_DOWNMIX_TYPE_LTRT, /**< Lt/Rt 2-channel downmix, Dolby Surround compatible. */ + AV_DOWNMIX_TYPE_DPLII, /**< Lt/Rt 2-channel downmix, Dolby Pro Logic II compatible. */ + AV_DOWNMIX_TYPE_NB /**< Number of downmix types. Not part of ABI. */ +}; + +/** + * This structure describes optional metadata relevant to a downmix procedure. + * + * All fields are set by the decoder to the value indicated in the audio + * bitstream (if present), or to a "sane" default otherwise. + */ +typedef struct AVDownmixInfo { + /** + * Type of downmix preferred by the mastering engineer. + */ + enum AVDownmixType preferred_downmix_type; + + /** + * Absolute scale factor representing the nominal level of the center + * channel during a regular downmix. + */ + double center_mix_level; + + /** + * Absolute scale factor representing the nominal level of the center + * channel during an Lt/Rt compatible downmix. + */ + double center_mix_level_ltrt; + + /** + * Absolute scale factor representing the nominal level of the surround + * channels during a regular downmix. + */ + double surround_mix_level; + + /** + * Absolute scale factor representing the nominal level of the surround + * channels during an Lt/Rt compatible downmix. + */ + double surround_mix_level_ltrt; + + /** + * Absolute scale factor representing the level at which the LFE data is + * mixed into L/R channels during downmixing. + */ + double lfe_mix_level; +} AVDownmixInfo; + +/** + * Get a frame's AV_FRAME_DATA_DOWNMIX_INFO side data for editing. + * + * If the side data is absent, it is created and added to the frame. + * + * @param frame the frame for which the side data is to be obtained or created + * + * @return the AVDownmixInfo structure to be edited by the caller, or NULL if + * the structure cannot be allocated. + */ +AVDownmixInfo *av_downmix_info_update_side_data(AVFrame *frame); + +/** + * @} + */ + +/** + * @} + */ + +#endif /* AVUTIL_DOWNMIX_INFO_H */ diff --git a/app/src/main/cpp/include/libavutil/error.h b/app/src/main/cpp/include/libavutil/error.h new file mode 100644 index 0000000..597730b --- /dev/null +++ b/app/src/main/cpp/include/libavutil/error.h @@ -0,0 +1,132 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * error code definitions + */ + +#ifndef AVUTIL_ERROR_H +#define AVUTIL_ERROR_H + +#include <errno.h> +#include <stddef.h> +#include <stdio.h> + +/** + * @addtogroup lavu_error + * + * @{ + */ + + +/* error handling */ +#if EDOM > 0 +#define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions. +#define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value. +#else +/* Some platforms have E* and errno already negated. */ +#define AVERROR(e) (e) +#define AVUNERROR(e) (e) +#endif + +#define FFERRTAG(a, b, c, d) (-(int)MKTAG(a, b, c, d)) + +#define AVERROR_BSF_NOT_FOUND FFERRTAG(0xF8,'B','S','F') ///< Bitstream filter not found +#define AVERROR_BUG FFERRTAG( 'B','U','G','!') ///< Internal bug, also see AVERROR_BUG2 +#define AVERROR_BUFFER_TOO_SMALL FFERRTAG( 'B','U','F','S') ///< Buffer too small +#define AVERROR_DECODER_NOT_FOUND FFERRTAG(0xF8,'D','E','C') ///< Decoder not found +#define AVERROR_DEMUXER_NOT_FOUND FFERRTAG(0xF8,'D','E','M') ///< Demuxer not found +#define AVERROR_ENCODER_NOT_FOUND FFERRTAG(0xF8,'E','N','C') ///< Encoder not found +#define AVERROR_EOF FFERRTAG( 'E','O','F',' ') ///< End of file +#define AVERROR_EXIT FFERRTAG( 'E','X','I','T') ///< Immediate exit was requested; the called function should not be restarted +#define AVERROR_EXTERNAL FFERRTAG( 'E','X','T',' ') ///< Generic error in an external library +#define AVERROR_FILTER_NOT_FOUND FFERRTAG(0xF8,'F','I','L') ///< Filter not found +#define AVERROR_INVALIDDATA FFERRTAG( 'I','N','D','A') ///< Invalid data found when processing input +#define AVERROR_MUXER_NOT_FOUND FFERRTAG(0xF8,'M','U','X') ///< Muxer not found +#define AVERROR_OPTION_NOT_FOUND FFERRTAG(0xF8,'O','P','T') ///< Option not found +#define AVERROR_PATCHWELCOME FFERRTAG( 'P','A','W','E') ///< Not yet implemented in FFmpeg, patches welcome +#define AVERROR_PROTOCOL_NOT_FOUND FFERRTAG(0xF8,'P','R','O') ///< Protocol not found + +#define AVERROR_STREAM_NOT_FOUND FFERRTAG(0xF8,'S','T','R') ///< Stream not found +/** + * This is semantically identical to AVERROR_BUG + * it has been introduced in Libav after our AVERROR_BUG and with a modified value. + */ +#define AVERROR_BUG2 FFERRTAG( 'B','U','G',' ') +#define AVERROR_UNKNOWN FFERRTAG( 'U','N','K','N') ///< Unknown error, typically from an external library +#define AVERROR_EXPERIMENTAL (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it. +#define AVERROR_INPUT_CHANGED (-0x636e6701) ///< Input changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_OUTPUT_CHANGED) +#define AVERROR_OUTPUT_CHANGED (-0x636e6702) ///< Output changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_INPUT_CHANGED) +/* HTTP & RTSP errors */ +#define AVERROR_HTTP_BAD_REQUEST FFERRTAG(0xF8,'4','0','0') +#define AVERROR_HTTP_UNAUTHORIZED FFERRTAG(0xF8,'4','0','1') +#define AVERROR_HTTP_FORBIDDEN FFERRTAG(0xF8,'4','0','3') +#define AVERROR_HTTP_NOT_FOUND FFERRTAG(0xF8,'4','0','4') +#define AVERROR_HTTP_OTHER_4XX FFERRTAG(0xF8,'4','X','X') +#define AVERROR_HTTP_SERVER_ERROR FFERRTAG(0xF8,'5','X','X') + +#define AV_ERROR_MAX_STRING_SIZE 64 + +/** + * Put a description of the AVERROR code errnum in errbuf. + * In case of failure the global variable errno is set to indicate the + * error. Even in case of failure av_strerror() will print a generic + * error message indicating the errnum provided to errbuf. + * + * @param errnum error code to describe + * @param errbuf buffer to which description is written + * @param errbuf_size the size in bytes of errbuf + * @return 0 on success, a negative value if a description for errnum + * cannot be found + */ +int av_strerror(int errnum, char *errbuf, size_t errbuf_size); + +/** + * Fill the provided buffer with a string containing an error string + * corresponding to the AVERROR code errnum. + * + * @param errbuf a buffer + * @param errbuf_size size in bytes of errbuf + * @param errnum error code to describe + * @return the buffer in input, filled with the error description + * @see av_strerror() + */ +static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int errnum) { + av_strerror(errnum, errbuf, errbuf_size); + return errbuf; +} + +/** + * Convenience macro, the return value should be used only directly in + * function arguments but never stand-alone. + */ +av_always_inline char *av_err2str(int errnum) { + + static char str[AV_ERROR_MAX_STRING_SIZE]; + + memset(str, 0, sizeof(str)); + + return av_make_error_string(str, AV_ERROR_MAX_STRING_SIZE, errnum); + +} +/** + * @} + */ + +#endif /* AVUTIL_ERROR_H */ diff --git a/app/src/main/cpp/include/libavutil/error.h.orig b/app/src/main/cpp/include/libavutil/error.h.orig new file mode 100644 index 0000000..3c2a212 Binary files /dev/null and b/app/src/main/cpp/include/libavutil/error.h.orig differ diff --git a/app/src/main/cpp/include/libavutil/eval.h b/app/src/main/cpp/include/libavutil/eval.h new file mode 100644 index 0000000..07f927f --- /dev/null +++ b/app/src/main/cpp/include/libavutil/eval.h @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2002 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * simple arithmetic expression evaluator + */ + +#ifndef AVUTIL_EVAL_H +#define AVUTIL_EVAL_H + +#include "avutil.h" + +typedef struct AVExpr AVExpr; + +/** + * Parse and evaluate an expression. + * Note, this is significantly slower than av_expr_eval(). + * + * @param res a pointer to a double where is put the result value of + * the expression, or NAN in case of error + * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" + * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} + * @param const_values a zero terminated array of values for the identifiers from const_names + * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers + * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument + * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers + * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments + * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 + * @param log_ctx parent logging context + * @return >= 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_expr_parse_and_eval(double *res, const char *s, + const char *const *const_names, const double *const_values, + const char *const *func1_names, double (*const *funcs1)(void *, double), + const char *const *func2_names, + double (*const *funcs2)(void *, double, double), + void *opaque, int log_offset, void *log_ctx); + +/** + * Parse an expression. + * + * @param expr a pointer where is put an AVExpr containing the parsed + * value in case of successful parsing, or NULL otherwise. + * The pointed to AVExpr must be freed with av_expr_free() by the user + * when it is not needed anymore. + * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" + * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} + * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers + * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument + * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers + * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments + * @param log_ctx parent logging context + * @return >= 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_expr_parse(AVExpr **expr, const char *s, + const char *const *const_names, + const char *const *func1_names, double (*const *funcs1)(void *, double), + const char *const *func2_names, double (*const *funcs2)(void *, double, double), + int log_offset, void *log_ctx); + +/** + * Evaluate a previously parsed expression. + * + * @param const_values a zero terminated array of values for the identifiers from av_expr_parse() const_names + * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 + * @return the value of the expression + */ +double av_expr_eval(AVExpr *e, const double *const_values, void *opaque); + +/** + * Free a parsed expression previously created with av_expr_parse(). + */ +void av_expr_free(AVExpr *e); + +/** + * Parse the string in numstr and return its value as a double. If + * the string is empty, contains only whitespaces, or does not contain + * an initial substring that has the expected syntax for a + * floating-point number, no conversion is performed. In this case, + * returns a value of zero and the value returned in tail is the value + * of numstr. + * + * @param numstr a string representing a number, may contain one of + * the International System number postfixes, for example 'K', 'M', + * 'G'. If 'i' is appended after the postfix, powers of 2 are used + * instead of powers of 10. The 'B' postfix multiplies the value for + * 8, and can be appended after another postfix or used alone. This + * allows using for example 'KB', 'MiB', 'G' and 'B' as postfix. + * @param tail if non-NULL puts here the pointer to the char next + * after the last parsed character + */ +double av_strtod(const char *numstr, char **tail); + +#endif /* AVUTIL_EVAL_H */ diff --git a/app/src/main/cpp/include/libavutil/ffversion.h b/app/src/main/cpp/include/libavutil/ffversion.h new file mode 100644 index 0000000..b494660 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/ffversion.h @@ -0,0 +1,4 @@ +#ifndef AVUTIL_FFVERSION_H +#define AVUTIL_FFVERSION_H +#define FFMPEG_VERSION "2.5.3" +#endif /* AVUTIL_FFVERSION_H */ diff --git a/app/src/main/cpp/include/libavutil/fifo.h b/app/src/main/cpp/include/libavutil/fifo.h new file mode 100644 index 0000000..7c52265 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/fifo.h @@ -0,0 +1,158 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * a very simple circular buffer FIFO implementation + */ + +#ifndef AVUTIL_FIFO_H +#define AVUTIL_FIFO_H + +#include <stdint.h> +#include "avutil.h" +#include "attributes.h" + +typedef struct AVFifoBuffer { + uint8_t *buffer; + uint8_t *rptr, *wptr, *end; + uint32_t rndx, wndx; +} AVFifoBuffer; + +/** + * Initialize an AVFifoBuffer. + * @param size of FIFO + * @return AVFifoBuffer or NULL in case of memory allocation failure + */ +AVFifoBuffer *av_fifo_alloc(unsigned int size); + +/** + * Initialize an AVFifoBuffer. + * @param nmemb number of elements + * @param size size of the single element + * @return AVFifoBuffer or NULL in case of memory allocation failure + */ +AVFifoBuffer *av_fifo_alloc_array(size_t nmemb, size_t size); + +/** + * Free an AVFifoBuffer. + * @param f AVFifoBuffer to free + */ +void av_fifo_free(AVFifoBuffer *f); + +/** + * Free an AVFifoBuffer and reset pointer to NULL. + * @param f AVFifoBuffer to free + */ +void av_fifo_freep(AVFifoBuffer **f); + +/** + * Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied. + * @param f AVFifoBuffer to reset + */ +void av_fifo_reset(AVFifoBuffer *f); + +/** + * Return the amount of data in bytes in the AVFifoBuffer, that is the + * amount of data you can read from it. + * @param f AVFifoBuffer to read from + * @return size + */ +int av_fifo_size(const AVFifoBuffer *f); + +/** + * Return the amount of space in bytes in the AVFifoBuffer, that is the + * amount of data you can write into it. + * @param f AVFifoBuffer to write into + * @return size + */ +int av_fifo_space(const AVFifoBuffer *f); + +/** + * Feed data from an AVFifoBuffer to a user-supplied callback. + * @param f AVFifoBuffer to read from + * @param buf_size number of bytes to read + * @param func generic read function + * @param dest data destination + */ +int +av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void *, void *, int)); + +/** + * Feed data from a user-supplied callback to an AVFifoBuffer. + * @param f AVFifoBuffer to write to + * @param src data source; non-const since it may be used as a + * modifiable context by the function defined in func + * @param size number of bytes to write + * @param func generic write function; the first parameter is src, + * the second is dest_buf, the third is dest_buf_size. + * func must return the number of bytes written to dest_buf, or <= 0 to + * indicate no more data available to write. + * If func is NULL, src is interpreted as a simple byte array for source data. + * @return the number of bytes written to the FIFO + */ +int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void *, void *, int)); + +/** + * Resize an AVFifoBuffer. + * In case of reallocation failure, the old FIFO is kept unchanged. + * + * @param f AVFifoBuffer to resize + * @param size new AVFifoBuffer size in bytes + * @return <0 for failure, >=0 otherwise + */ +int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size); + +/** + * Enlarge an AVFifoBuffer. + * In case of reallocation failure, the old FIFO is kept unchanged. + * The new fifo size may be larger than the requested size. + * + * @param f AVFifoBuffer to resize + * @param additional_space the amount of space in bytes to allocate in addition to av_fifo_size() + * @return <0 for failure, >=0 otherwise + */ +int av_fifo_grow(AVFifoBuffer *f, unsigned int additional_space); + +/** + * Read and discard the specified amount of data from an AVFifoBuffer. + * @param f AVFifoBuffer to read from + * @param size amount of data to read in bytes + */ +void av_fifo_drain(AVFifoBuffer *f, int size); + +/** + * Return a pointer to the data stored in a FIFO buffer at a certain offset. + * The FIFO buffer is not modified. + * + * @param f AVFifoBuffer to peek at, f must be non-NULL + * @param offs an offset in bytes, its absolute value must be less + * than the used buffer size or the returned pointer will + * point outside to the buffer data. + * The used buffer size can be checked with av_fifo_size(). + */ +static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs) { + uint8_t *ptr = f->rptr + offs; + if (ptr >= f->end) + ptr = f->buffer + (ptr - f->end); + else if (ptr < f->buffer) + ptr = f->end - (f->buffer - ptr); + return ptr; +} + +#endif /* AVUTIL_FIFO_H */ diff --git a/app/src/main/cpp/include/libavutil/file.h b/app/src/main/cpp/include/libavutil/file.h new file mode 100644 index 0000000..0cc5a43 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/file.h @@ -0,0 +1,67 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_FILE_H +#define AVUTIL_FILE_H + +#include <stdint.h> + +#include "avutil.h" + +/** + * @file + * Misc file utilities. + */ + +/** + * Read the file with name filename, and put its content in a newly + * allocated buffer or map it with mmap() when available. + * In case of success set *bufptr to the read or mmapped buffer, and + * *size to the size in bytes of the buffer in *bufptr. + * The returned buffer must be released with av_file_unmap(). + * + * @param log_offset loglevel offset used for logging + * @param log_ctx context used for logging + * @return a non negative number in case of success, a negative value + * corresponding to an AVERROR error code in case of failure + */ +int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, + int log_offset, void *log_ctx); + +/** + * Unmap or free the buffer bufptr created by av_file_map(). + * + * @param size size in bytes of bufptr, must be the same as returned + * by av_file_map() + */ +void av_file_unmap(uint8_t *bufptr, size_t size); + +/** + * Wrapper to work around the lack of mkstemp() on mingw. + * Also, tries to create file in /tmp first, if possible. + * *prefix can be a character constant; *filename will be allocated internally. + * @return file descriptor of opened file (or negative value corresponding to an + * AVERROR code on error) + * and opened file name in **filename. + * @note On very old libcs it is necessary to set a secure umask before + * calling this, av_tempfile() can't call umask itself as it is used in + * libraries and could interfere with the calling application. + */ +int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx); + +#endif /* AVUTIL_FILE_H */ diff --git a/app/src/main/cpp/include/libavutil/frame.h b/app/src/main/cpp/include/libavutil/frame.h new file mode 100644 index 0000000..c644460 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/frame.h @@ -0,0 +1,796 @@ +/* + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu_frame + * reference-counted frame API + */ + +#ifndef AVUTIL_FRAME_H +#define AVUTIL_FRAME_H + +#include <stdint.h> + +#include "avutil.h" +#include "buffer.h" +#include "dict.h" +#include "rational.h" +#include "samplefmt.h" +#include "pixfmt.h" +#include "version.h" + + +/** + * @defgroup lavu_frame AVFrame + * @ingroup lavu_data + * + * @{ + * AVFrame is an abstraction for reference-counted raw multimedia data. + */ + +enum AVFrameSideDataType { + /** + * The data is the AVPanScan struct defined in libavcodec. + */ + AV_FRAME_DATA_PANSCAN, + /** + * ATSC A53 Part 4 Closed Captions. + * A53 CC bitstream is stored as uint8_t in AVFrameSideData.data. + * The number of bytes of CC data is AVFrameSideData.size. + */ + AV_FRAME_DATA_A53_CC, + /** + * Stereoscopic 3d metadata. + * The data is the AVStereo3D struct defined in libavutil/stereo3d.h. + */ + AV_FRAME_DATA_STEREO3D, + /** + * The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h. + */ + AV_FRAME_DATA_MATRIXENCODING, + /** + * Metadata relevant to a downmix procedure. + * The data is the AVDownmixInfo struct defined in libavutil/downmix_info.h. + */ + AV_FRAME_DATA_DOWNMIX_INFO, + /** + * ReplayGain information in the form of the AVReplayGain struct. + */ + AV_FRAME_DATA_REPLAYGAIN, + /** + * This side data contains a 3x3 transformation matrix describing an affine + * transformation that needs to be applied to the frame for correct + * presentation. + * + * See libavutil/display.h for a detailed description of the data. + */ + AV_FRAME_DATA_DISPLAYMATRIX, + /** + * Active Format Description data consisting of a single byte as specified + * in ETSI TS 101 154 using AVActiveFormatDescription enum. + */ + AV_FRAME_DATA_AFD, + /** + * Motion vectors exported by some codecs (on demand through the export_mvs + * flag set in the libavcodec AVCodecContext flags2 option). + * The data is the AVMotionVector struct defined in + * libavutil/motion_vector.h. + */ + AV_FRAME_DATA_MOTION_VECTORS, + /** + * Recommmends skipping the specified number of samples. This is exported + * only if the "skip_manual" AVOption is set in libavcodec. + * This has the same format as AV_PKT_DATA_SKIP_SAMPLES. + * @code + * u32le number of samples to skip from start of this packet + * u32le number of samples to skip from end of this packet + * u8 reason for start skip + * u8 reason for end skip (0=padding silence, 1=convergence) + * @endcode + */ + AV_FRAME_DATA_SKIP_SAMPLES, +}; + +enum AVActiveFormatDescription { + AV_AFD_SAME = 8, + AV_AFD_4_3 = 9, + AV_AFD_16_9 = 10, + AV_AFD_14_9 = 11, + AV_AFD_4_3_SP_14_9 = 13, + AV_AFD_16_9_SP_14_9 = 14, + AV_AFD_SP_4_3 = 15, +}; + +typedef struct AVFrameSideData { + enum AVFrameSideDataType type; + uint8_t *data; + int size; + AVDictionary *metadata; +} AVFrameSideData; + +/** + * This structure describes decoded (raw) audio or video data. + * + * AVFrame must be allocated using av_frame_alloc(). Note that this only + * allocates the AVFrame itself, the buffers for the data must be managed + * through other means (see below). + * AVFrame must be freed with av_frame_free(). + * + * AVFrame is typically allocated once and then reused multiple times to hold + * different data (e.g. a single AVFrame to hold frames received from a + * decoder). In such a case, av_frame_unref() will free any references held by + * the frame and reset it to its original clean state before it + * is reused again. + * + * The data described by an AVFrame is usually reference counted through the + * AVBuffer API. The underlying buffer references are stored in AVFrame.buf / + * AVFrame.extended_buf. An AVFrame is considered to be reference counted if at + * least one reference is set, i.e. if AVFrame.buf[0] != NULL. In such a case, + * every single data plane must be contained in one of the buffers in + * AVFrame.buf or AVFrame.extended_buf. + * There may be a single buffer for all the data, or one separate buffer for + * each plane, or anything in between. + * + * sizeof(AVFrame) is not a part of the public ABI, so new fields may be added + * to the end with a minor bump. + * Similarly fields that are marked as to be only accessed by + * av_opt_ptr() can be reordered. This allows 2 forks to add fields + * without breaking compatibility with each other. + */ +typedef struct AVFrame { +#define AV_NUM_DATA_POINTERS 8 + /** + * pointer to the picture/channel planes. + * This might be different from the first allocated byte + * + * Some decoders access areas outside 0,0 - width,height, please + * see avcodec_align_dimensions2(). Some filters and swscale can read + * up to 16 bytes beyond the planes, if these filters are to be used, + * then 16 extra bytes must be allocated. + */ + uint8_t *data[AV_NUM_DATA_POINTERS]; + + /** + * For video, size in bytes of each picture line. + * For audio, size in bytes of each plane. + * + * For audio, only linesize[0] may be set. For planar audio, each channel + * plane must be the same size. + * + * For video the linesizes should be multiples of the CPUs alignment + * preference, this is 16 or 32 for modern desktop CPUs. + * Some code requires such alignment other code can be slower without + * correct alignment, for yet other it makes no difference. + * + * @note The linesize may be larger than the size of usable data -- there + * may be extra padding present for performance reasons. + */ + int linesize[AV_NUM_DATA_POINTERS]; + + /** + * pointers to the data planes/channels. + * + * For video, this should simply point to data[]. + * + * For planar audio, each channel has a separate data pointer, and + * linesize[0] contains the size of each channel buffer. + * For packed audio, there is just one data pointer, and linesize[0] + * contains the total size of the buffer for all channels. + * + * Note: Both data and extended_data should always be set in a valid frame, + * but for planar audio with more channels that can fit in data, + * extended_data must be used in order to access all channels. + */ + uint8_t **extended_data; + + /** + * width and height of the video frame + */ + int width, height; + + /** + * number of audio samples (per channel) described by this frame + */ + int nb_samples; + + /** + * format of the frame, -1 if unknown or unset + * Values correspond to enum AVPixelFormat for video frames, + * enum AVSampleFormat for audio) + */ + int format; + + /** + * 1 -> keyframe, 0-> not + */ + int key_frame; + + /** + * Picture type of the frame. + */ + enum AVPictureType pict_type; + +#if FF_API_AVFRAME_LAVC + attribute_deprecated + uint8_t *base[AV_NUM_DATA_POINTERS]; +#endif + + /** + * Sample aspect ratio for the video frame, 0/1 if unknown/unspecified. + */ + AVRational sample_aspect_ratio; + + /** + * Presentation timestamp in time_base units (time when frame should be shown to user). + */ + int64_t pts; + + /** + * PTS copied from the AVPacket that was decoded to produce this frame. + */ + int64_t pkt_pts; + + /** + * DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used) + * This is also the Presentation time of this AVFrame calculated from + * only AVPacket.dts values without pts values. + */ + int64_t pkt_dts; + + /** + * picture number in bitstream order + */ + int coded_picture_number; + /** + * picture number in display order + */ + int display_picture_number; + + /** + * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) + */ + int quality; + +#if FF_API_AVFRAME_LAVC + attribute_deprecated + int reference; + + /** + * QP table + */ + attribute_deprecated + int8_t *qscale_table; + /** + * QP store stride + */ + attribute_deprecated + int qstride; + + attribute_deprecated + int qscale_type; + + /** + * mbskip_table[mb]>=1 if MB didn't change + * stride= mb_width = (width+15)>>4 + */ + attribute_deprecated + uint8_t *mbskip_table; + + /** + * motion vector table + * @code + * example: + * int mv_sample_log2= 4 - motion_subsample_log2; + * int mb_width= (width+15)>>4; + * int mv_stride= (mb_width << mv_sample_log2) + 1; + * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y]; + * @endcode + */ + int16_t (*motion_val[2])[2]; + + /** + * macroblock type table + * mb_type_base + mb_width + 2 + */ + attribute_deprecated + uint32_t *mb_type; + + /** + * DCT coefficients + */ + attribute_deprecated + short *dct_coeff; + + /** + * motion reference frame index + * the order in which these are stored can depend on the codec. + */ + attribute_deprecated + int8_t *ref_index[2]; +#endif + + /** + * for some private data of the user + */ + void *opaque; + + /** + * error + */ + uint64_t error[AV_NUM_DATA_POINTERS]; + +#if FF_API_AVFRAME_LAVC + attribute_deprecated + int type; +#endif + + /** + * When decoding, this signals how much the picture must be delayed. + * extra_delay = repeat_pict / (2*fps) + */ + int repeat_pict; + + /** + * The content of the picture is interlaced. + */ + int interlaced_frame; + + /** + * If the content is interlaced, is top field displayed first. + */ + int top_field_first; + + /** + * Tell user application that palette has changed from previous frame. + */ + int palette_has_changed; + +#if FF_API_AVFRAME_LAVC + attribute_deprecated + int buffer_hints; + + /** + * Pan scan. + */ + attribute_deprecated + struct AVPanScan *pan_scan; +#endif + + /** + * reordered opaque 64bit (generally an integer or a double precision float + * PTS but can be anything). + * The user sets AVCodecContext.reordered_opaque to represent the input at + * that time, + * the decoder reorders values as needed and sets AVFrame.reordered_opaque + * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque + * @deprecated in favor of pkt_pts + */ + int64_t reordered_opaque; + +#if FF_API_AVFRAME_LAVC + /** + * @deprecated this field is unused + */ + attribute_deprecated void *hwaccel_picture_private; + + attribute_deprecated + struct AVCodecContext *owner; + attribute_deprecated + void *thread_opaque; + + /** + * log2 of the size of the block which a single vector in motion_val represents: + * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2) + */ + uint8_t motion_subsample_log2; +#endif + + /** + * Sample rate of the audio data. + */ + int sample_rate; + + /** + * Channel layout of the audio data. + */ + uint64_t channel_layout; + + /** + * AVBuffer references backing the data for this frame. If all elements of + * this array are NULL, then this frame is not reference counted. + * + * There may be at most one AVBuffer per data plane, so for video this array + * always contains all the references. For planar audio with more than + * AV_NUM_DATA_POINTERS channels, there may be more buffers than can fit in + * this array. Then the extra AVBufferRef pointers are stored in the + * extended_buf array. + */ + AVBufferRef *buf[AV_NUM_DATA_POINTERS]; + + /** + * For planar audio which requires more than AV_NUM_DATA_POINTERS + * AVBufferRef pointers, this array will hold all the references which + * cannot fit into AVFrame.buf. + * + * Note that this is different from AVFrame.extended_data, which always + * contains all the pointers. This array only contains the extra pointers, + * which cannot fit into AVFrame.buf. + * + * This array is always allocated using av_malloc() by whoever constructs + * the frame. It is freed in av_frame_unref(). + */ + AVBufferRef **extended_buf; + /** + * Number of elements in extended_buf. + */ + int nb_extended_buf; + + AVFrameSideData **side_data; + int nb_side_data; + +/** + * @defgroup lavu_frame_flags AV_FRAME_FLAGS + * Flags describing additional frame properties. + * + * @{ + */ + +/** + * The frame data may be corrupted, e.g. due to decoding errors. + */ +#define AV_FRAME_FLAG_CORRUPT (1 << 0) +/** + * @} + */ + + /** + * Frame flags, a combination of @ref lavu_frame_flags + */ + int flags; + + /** + * MPEG vs JPEG YUV range. + * It must be accessed using av_frame_get_color_range() and + * av_frame_set_color_range(). + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorRange color_range; + + enum AVColorPrimaries color_primaries; + + enum AVColorTransferCharacteristic color_trc; + + /** + * YUV colorspace type. + * It must be accessed using av_frame_get_colorspace() and + * av_frame_set_colorspace(). + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorSpace colorspace; + + enum AVChromaLocation chroma_location; + + /** + * frame timestamp estimated using various heuristics, in stream time base + * Code outside libavcodec should access this field using: + * av_frame_get_best_effort_timestamp(frame) + * - encoding: unused + * - decoding: set by libavcodec, read by user. + */ + int64_t best_effort_timestamp; + + /** + * reordered pos from the last AVPacket that has been input into the decoder + * Code outside libavcodec should access this field using: + * av_frame_get_pkt_pos(frame) + * - encoding: unused + * - decoding: Read by user. + */ + int64_t pkt_pos; + + /** + * duration of the corresponding packet, expressed in + * AVStream->time_base units, 0 if unknown. + * Code outside libavcodec should access this field using: + * av_frame_get_pkt_duration(frame) + * - encoding: unused + * - decoding: Read by user. + */ + int64_t pkt_duration; + + /** + * metadata. + * Code outside libavcodec should access this field using: + * av_frame_get_metadata(frame) + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + AVDictionary *metadata; + + /** + * decode error flags of the frame, set to a combination of + * FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there + * were errors during the decoding. + * Code outside libavcodec should access this field using: + * av_frame_get_decode_error_flags(frame) + * - encoding: unused + * - decoding: set by libavcodec, read by user. + */ + int decode_error_flags; +#define FF_DECODE_ERROR_INVALID_BITSTREAM 1 +#define FF_DECODE_ERROR_MISSING_REFERENCE 2 + + /** + * number of audio channels, only used for audio. + * Code outside libavcodec should access this field using: + * av_frame_get_channels(frame) + * - encoding: unused + * - decoding: Read by user. + */ + int channels; + + /** + * size of the corresponding packet containing the compressed + * frame. It must be accessed using av_frame_get_pkt_size() and + * av_frame_set_pkt_size(). + * It is set to a negative value if unknown. + * - encoding: unused + * - decoding: set by libavcodec, read by user. + */ + int pkt_size; + + /** + * Not to be accessed directly from outside libavutil + */ + AVBufferRef *qp_table_buf; + int poc; +} AVFrame; + +/** + * Accessors for some AVFrame fields. + * The position of these field in the structure is not part of the ABI, + * they should not be accessed directly outside libavcodec. + */ +int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame); + +void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val); + +int64_t av_frame_get_pkt_duration(const AVFrame *frame); + +void av_frame_set_pkt_duration(AVFrame *frame, int64_t val); + +int64_t av_frame_get_pkt_pos(const AVFrame *frame); + +void av_frame_set_pkt_pos(AVFrame *frame, int64_t val); + +int64_t av_frame_get_channel_layout(const AVFrame *frame); + +void av_frame_set_channel_layout(AVFrame *frame, int64_t val); + +int av_frame_get_channels(const AVFrame *frame); + +void av_frame_set_channels(AVFrame *frame, int val); + +int av_frame_get_sample_rate(const AVFrame *frame); + +void av_frame_set_sample_rate(AVFrame *frame, int val); + +AVDictionary *av_frame_get_metadata(const AVFrame *frame); + +void av_frame_set_metadata(AVFrame *frame, AVDictionary *val); + +int av_frame_get_decode_error_flags(const AVFrame *frame); + +void av_frame_set_decode_error_flags(AVFrame *frame, int val); + +int av_frame_get_pkt_size(const AVFrame *frame); + +void av_frame_set_pkt_size(AVFrame *frame, int val); + +AVDictionary **avpriv_frame_get_metadatap(AVFrame *frame); + +int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type); + +int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type); + +enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame); + +void av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val); + +enum AVColorRange av_frame_get_color_range(const AVFrame *frame); + +void av_frame_set_color_range(AVFrame *frame, enum AVColorRange val); + +/** + * Get the name of a colorspace. + * @return a static string identifying the colorspace; can be NULL. + */ +const char *av_get_colorspace_name(enum AVColorSpace val); + +/** + * Allocate an AVFrame and set its fields to default values. The resulting + * struct must be freed using av_frame_free(). + * + * @return An AVFrame filled with default values or NULL on failure. + * + * @note this only allocates the AVFrame itself, not the data buffers. Those + * must be allocated through other means, e.g. with av_frame_get_buffer() or + * manually. + */ +AVFrame *av_frame_alloc(void); + +/** + * Free the frame and any dynamically allocated objects in it, + * e.g. extended_data. If the frame is reference counted, it will be + * unreferenced first. + * + * @param frame frame to be freed. The pointer will be set to NULL. + */ +void av_frame_free(AVFrame **frame); + +/** + * Set up a new reference to the data described by the source frame. + * + * Copy frame properties from src to dst and create a new reference for each + * AVBufferRef from src. + * + * If src is not reference counted, new buffers are allocated and the data is + * copied. + * + * @return 0 on success, a negative AVERROR on error + */ +int av_frame_ref(AVFrame *dst, const AVFrame *src); + +/** + * Create a new frame that references the same data as src. + * + * This is a shortcut for av_frame_alloc()+av_frame_ref(). + * + * @return newly created AVFrame on success, NULL on error. + */ +AVFrame *av_frame_clone(const AVFrame *src); + +/** + * Unreference all the buffers referenced by frame and reset the frame fields. + */ +void av_frame_unref(AVFrame *frame); + +/** + * Move everythnig contained in src to dst and reset src. + */ +void av_frame_move_ref(AVFrame *dst, AVFrame *src); + +/** + * Allocate new buffer(s) for audio or video data. + * + * The following fields must be set on frame before calling this function: + * - format (pixel format for video, sample format for audio) + * - width and height for video + * - nb_samples and channel_layout for audio + * + * This function will fill AVFrame.data and AVFrame.buf arrays and, if + * necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf. + * For planar formats, one buffer will be allocated for each plane. + * + * @param frame frame in which to store the new buffers. + * @param align required buffer size alignment + * + * @return 0 on success, a negative AVERROR on error. + */ +int av_frame_get_buffer(AVFrame *frame, int align); + +/** + * Check if the frame data is writable. + * + * @return A positive value if the frame data is writable (which is true if and + * only if each of the underlying buffers has only one reference, namely the one + * stored in this frame). Return 0 otherwise. + * + * If 1 is returned the answer is valid until av_buffer_ref() is called on any + * of the underlying AVBufferRefs (e.g. through av_frame_ref() or directly). + * + * @see av_frame_make_writable(), av_buffer_is_writable() + */ +int av_frame_is_writable(AVFrame *frame); + +/** + * Ensure that the frame data is writable, avoiding data copy if possible. + * + * Do nothing if the frame is writable, allocate new buffers and copy the data + * if it is not. + * + * @return 0 on success, a negative AVERROR on error. + * + * @see av_frame_is_writable(), av_buffer_is_writable(), + * av_buffer_make_writable() + */ +int av_frame_make_writable(AVFrame *frame); + +/** + * Copy the frame data from src to dst. + * + * This function does not allocate anything, dst must be already initialized and + * allocated with the same parameters as src. + * + * This function only copies the frame data (i.e. the contents of the data / + * extended data arrays), not any other properties. + * + * @return >= 0 on success, a negative AVERROR on error. + */ +int av_frame_copy(AVFrame *dst, const AVFrame *src); + +/** + * Copy only "metadata" fields from src to dst. + * + * Metadata for the purpose of this function are those fields that do not affect + * the data layout in the buffers. E.g. pts, sample rate (for audio) or sample + * aspect ratio (for video), but not width/height or channel layout. + * Side data is also copied. + */ +int av_frame_copy_props(AVFrame *dst, const AVFrame *src); + +/** + * Get the buffer reference a given data plane is stored in. + * + * @param plane index of the data plane of interest in frame->extended_data. + * + * @return the buffer reference that contains the plane or NULL if the input + * frame is not valid. + */ +AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane); + +/** + * Add a new side data to a frame. + * + * @param frame a frame to which the side data should be added + * @param type type of the added side data + * @param size size of the side data + * + * @return newly added side data on success, NULL on error + */ +AVFrameSideData *av_frame_new_side_data(AVFrame *frame, + enum AVFrameSideDataType type, + int size); + +/** + * @return a pointer to the side data of a given type on success, NULL if there + * is no side data with such type in this frame. + */ +AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, + enum AVFrameSideDataType type); + +/** + * If side data of the supplied type exists in the frame, free it and remove it + * from the frame. + */ +void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type); + +/** + * @return a string identifying the side data type + */ +const char *av_frame_side_data_name(enum AVFrameSideDataType type); + +/** + * @} + */ + +#endif /* AVUTIL_FRAME_H */ diff --git a/app/src/main/cpp/include/libavutil/hash.h b/app/src/main/cpp/include/libavutil/hash.h new file mode 100644 index 0000000..d4bcbf8 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/hash.h @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2013 Reimar Döffinger <Reimar.Doeffinger@gmx.de> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_HASH_H +#define AVUTIL_HASH_H + +#include <stdint.h> + +struct AVHashContext; + +/** + * Allocate a hash context for the algorithm specified by name. + * + * @return >= 0 for success, a negative error code for failure + * @note The context is not initialized, you must call av_hash_init(). + */ +int av_hash_alloc(struct AVHashContext **ctx, const char *name); + +/** + * Get the names of available hash algorithms. + * + * This function can be used to enumerate the algorithms. + * + * @param i index of the hash algorithm, starting from 0 + * @return a pointer to a static string or NULL if i is out of range + */ +const char *av_hash_names(int i); + +/** + * Get the name of the algorithm corresponding to the given hash context. + */ +const char *av_hash_get_name(const struct AVHashContext *ctx); + +/** + * Maximum value that av_hash_get_size will currently return. + * + * You can use this if you absolutely want or need to use static allocation + * and are fine with not supporting hashes newly added to libavutil without + * recompilation. + * Note that you still need to check against av_hash_get_size, adding new hashes + * with larger sizes will not be considered an ABI change and should not cause + * your code to overflow a buffer. + */ +#define AV_HASH_MAX_SIZE 64 + +/** + * Get the size of the resulting hash value in bytes. + * + * The pointer passed to av_hash_final have space for at least this many bytes. + */ +int av_hash_get_size(const struct AVHashContext *ctx); + +/** + * Initialize or reset a hash context. + */ +void av_hash_init(struct AVHashContext *ctx); + +/** + * Update a hash context with additional data. + */ +void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, int len); + +/** + * Finalize a hash context and compute the actual hash value. + */ +void av_hash_final(struct AVHashContext *ctx, uint8_t *dst); + +/** + * Finalize a hash context and compute the actual hash value. + * If size is smaller than the hash size, the hash is truncated; + * if size is larger, the buffer is padded with 0. + */ +void av_hash_final_bin(struct AVHashContext *ctx, uint8_t *dst, int size); + +/** + * Finalize a hash context and compute the actual hash value as a hex string. + * The string is always 0-terminated. + * If size is smaller than 2 * hash_size + 1, the hex string is truncated. + */ +void av_hash_final_hex(struct AVHashContext *ctx, uint8_t *dst, int size); + +/** + * Finalize a hash context and compute the actual hash value as a base64 string. + * The string is always 0-terminated. + * If size is smaller than AV_BASE64_SIZE(hash_size), the base64 string is + * truncated. + */ +void av_hash_final_b64(struct AVHashContext *ctx, uint8_t *dst, int size); + +/** + * Free hash context. + */ +void av_hash_freep(struct AVHashContext **ctx); + +#endif /* AVUTIL_HASH_H */ diff --git a/app/src/main/cpp/include/libavutil/hmac.h b/app/src/main/cpp/include/libavutil/hmac.h new file mode 100644 index 0000000..d36d4de --- /dev/null +++ b/app/src/main/cpp/include/libavutil/hmac.h @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2012 Martin Storsjo + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_HMAC_H +#define AVUTIL_HMAC_H + +#include <stdint.h> + +/** + * @defgroup lavu_hmac HMAC + * @ingroup lavu_crypto + * @{ + */ + +enum AVHMACType { + AV_HMAC_MD5, + AV_HMAC_SHA1, + AV_HMAC_SHA224 = 10, + AV_HMAC_SHA256, + AV_HMAC_SHA384, + AV_HMAC_SHA512, +}; + +typedef struct AVHMAC AVHMAC; + +/** + * Allocate an AVHMAC context. + * @param type The hash function used for the HMAC. + */ +AVHMAC *av_hmac_alloc(enum AVHMACType type); + +/** + * Free an AVHMAC context. + * @param ctx The context to free, may be NULL + */ +void av_hmac_free(AVHMAC *ctx); + +/** + * Initialize an AVHMAC context with an authentication key. + * @param ctx The HMAC context + * @param key The authentication key + * @param keylen The length of the key, in bytes + */ +void av_hmac_init(AVHMAC *ctx, const uint8_t *key, unsigned int keylen); + +/** + * Hash data with the HMAC. + * @param ctx The HMAC context + * @param data The data to hash + * @param len The length of the data, in bytes + */ +void av_hmac_update(AVHMAC *ctx, const uint8_t *data, unsigned int len); + +/** + * Finish hashing and output the HMAC digest. + * @param ctx The HMAC context + * @param out The output buffer to write the digest into + * @param outlen The length of the out buffer, in bytes + * @return The number of bytes written to out, or a negative error code. + */ +int av_hmac_final(AVHMAC *ctx, uint8_t *out, unsigned int outlen); + +/** + * Hash an array of data with a key. + * @param ctx The HMAC context + * @param data The data to hash + * @param len The length of the data, in bytes + * @param key The authentication key + * @param keylen The length of the key, in bytes + * @param out The output buffer to write the digest into + * @param outlen The length of the out buffer, in bytes + * @return The number of bytes written to out, or a negative error code. + */ +int av_hmac_calc(AVHMAC *ctx, const uint8_t *data, unsigned int len, + const uint8_t *key, unsigned int keylen, + uint8_t *out, unsigned int outlen); + +/** + * @} + */ + +#endif /* AVUTIL_HMAC_H */ diff --git a/app/src/main/cpp/include/libavutil/imgutils.h b/app/src/main/cpp/include/libavutil/imgutils.h new file mode 100644 index 0000000..f6f8461 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/imgutils.h @@ -0,0 +1,213 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_IMGUTILS_H +#define AVUTIL_IMGUTILS_H + +/** + * @file + * misc image utilities + * + * @addtogroup lavu_picture + * @{ + */ + +#include "avutil.h" +#include "pixdesc.h" +#include "rational.h" + +/** + * Compute the max pixel step for each plane of an image with a + * format described by pixdesc. + * + * The pixel step is the distance in bytes between the first byte of + * the group of bytes which describe a pixel component and the first + * byte of the successive group in the same plane for the same + * component. + * + * @param max_pixsteps an array which is filled with the max pixel step + * for each plane. Since a plane may contain different pixel + * components, the computed max_pixsteps[plane] is relative to the + * component in the plane with the max pixel step. + * @param max_pixstep_comps an array which is filled with the component + * for each plane which has the max pixel step. May be NULL. + */ +void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], + const AVPixFmtDescriptor *pixdesc); + +/** + * Compute the size of an image line with format pix_fmt and width + * width for the plane plane. + * + * @return the computed size in bytes + */ +int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane); + +/** + * Fill plane linesizes for an image with pixel format pix_fmt and + * width width. + * + * @param linesizes array to be filled with the linesize for each plane + * @return >= 0 in case of success, a negative error code otherwise + */ +int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width); + +/** + * Fill plane data pointers for an image with pixel format pix_fmt and + * height height. + * + * @param data pointers array to be filled with the pointer for each image plane + * @param ptr the pointer to a buffer which will contain the image + * @param linesizes the array containing the linesize for each + * plane, should be filled by av_image_fill_linesizes() + * @return the size in bytes required for the image buffer, a negative + * error code in case of failure + */ +int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int height, + uint8_t *ptr, const int linesizes[4]); + +/** + * Allocate an image with size w and h and pixel format pix_fmt, and + * fill pointers and linesizes accordingly. + * The allocated image buffer has to be freed by using + * av_freep(&pointers[0]). + * + * @param align the value to use for buffer size alignment + * @return the size in bytes required for the image buffer, a negative + * error code in case of failure + */ +int av_image_alloc(uint8_t *pointers[4], int linesizes[4], + int w, int h, enum AVPixelFormat pix_fmt, int align); + +/** + * Copy image plane from src to dst. + * That is, copy "height" number of lines of "bytewidth" bytes each. + * The first byte of each successive line is separated by *_linesize + * bytes. + * + * bytewidth must be contained by both absolute values of dst_linesize + * and src_linesize, otherwise the function behavior is undefined. + * + * @param dst_linesize linesize for the image plane in dst + * @param src_linesize linesize for the image plane in src + */ +void av_image_copy_plane(uint8_t *dst, int dst_linesize, + const uint8_t *src, int src_linesize, + int bytewidth, int height); + +/** + * Copy image in src_data to dst_data. + * + * @param dst_linesizes linesizes for the image in dst_data + * @param src_linesizes linesizes for the image in src_data + */ +void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], + const uint8_t *src_data[4], const int src_linesizes[4], + enum AVPixelFormat pix_fmt, int width, int height); + +/** + * Setup the data pointers and linesizes based on the specified image + * parameters and the provided array. + * + * The fields of the given image are filled in by using the src + * address which points to the image data buffer. Depending on the + * specified pixel format, one or multiple image data pointers and + * line sizes will be set. If a planar format is specified, several + * pointers will be set pointing to the different picture planes and + * the line sizes of the different planes will be stored in the + * lines_sizes array. Call with !src to get the required + * size for the src buffer. + * + * To allocate the buffer and fill in the dst_data and dst_linesize in + * one call, use av_image_alloc(). + * + * @param dst_data data pointers to be filled in + * @param dst_linesizes linesizes for the image in dst_data to be filled in + * @param src buffer which will contain or contains the actual image data, can be NULL + * @param pix_fmt the pixel format of the image + * @param width the width of the image in pixels + * @param height the height of the image in pixels + * @param align the value used in src for linesize alignment + * @return the size in bytes required for src, a negative error code + * in case of failure + */ +int av_image_fill_arrays(uint8_t *dst_data[4], int dst_linesize[4], + const uint8_t *src, + enum AVPixelFormat pix_fmt, int width, int height, int align); + +/** + * Return the size in bytes of the amount of data required to store an + * image with the given parameters. + * + * @param[in] align the assumed linesize alignment + */ +int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height, int align); + +/** + * Copy image data from an image into a buffer. + * + * av_image_get_buffer_size() can be used to compute the required size + * for the buffer to fill. + * + * @param dst a buffer into which picture data will be copied + * @param dst_size the size in bytes of dst + * @param src_data pointers containing the source image data + * @param src_linesizes linesizes for the image in src_data + * @param pix_fmt the pixel format of the source image + * @param width the width of the source image in pixels + * @param height the height of the source image in pixels + * @param align the assumed linesize alignment for dst + * @return the number of bytes written to dst, or a negative value + * (error code) on error + */ +int av_image_copy_to_buffer(uint8_t *dst, int dst_size, + const uint8_t *const src_data[4], const int src_linesize[4], + enum AVPixelFormat pix_fmt, int width, int height, int align); + +/** + * Check if the given dimension of an image is valid, meaning that all + * bytes of the image can be addressed with a signed int. + * + * @param w the width of the picture + * @param h the height of the picture + * @param log_offset the offset to sum to the log level for logging with log_ctx + * @param log_ctx the parent logging context, it may be NULL + * @return >= 0 if valid, a negative error code otherwise + */ +int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); + +/** + * Check if the given sample aspect ratio of an image is valid. + * + * It is considered invalid if the denominator is 0 or if applying the ratio + * to the image size would make the smaller dimension less than 1. If the + * sar numerator is 0, it is considered unknown and will return as valid. + * + * @param w width of the image + * @param h height of the image + * @param sar sample aspect ratio of the image + * @return 0 if valid, a negative AVERROR code otherwise + */ +int av_image_check_sar(unsigned int w, unsigned int h, AVRational sar); + +/** + * @} + */ + + +#endif /* AVUTIL_IMGUTILS_H */ diff --git a/app/src/main/cpp/include/libavutil/intfloat.h b/app/src/main/cpp/include/libavutil/intfloat.h new file mode 100644 index 0000000..6db8bb9 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/intfloat.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2011 Mans Rullgard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_INTFLOAT_H +#define AVUTIL_INTFLOAT_H + +#include <stdint.h> +#include "attributes.h" + +union av_intfloat32 { + uint32_t i; + float f; +}; + +union av_intfloat64 { + uint64_t i; + double f; +}; + +/** + * Reinterpret a 32-bit integer as a float. + */ +static av_always_inline float av_int2float(uint32_t i) { + union av_intfloat32 v; + v.i = i; + return v.f; +} + +/** + * Reinterpret a float as a 32-bit integer. + */ +static av_always_inline uint32_t av_float2int(float f) { + union av_intfloat32 v; + v.f = f; + return v.i; +} + +/** + * Reinterpret a 64-bit integer as a double. + */ +static av_always_inline double av_int2double(uint64_t i) { + union av_intfloat64 v; + v.i = i; + return v.f; +} + +/** + * Reinterpret a double as a 64-bit integer. + */ +static av_always_inline uint64_t av_double2int(double f) { + union av_intfloat64 v; + v.f = f; + return v.i; +} + +#endif /* AVUTIL_INTFLOAT_H */ diff --git a/app/src/main/cpp/include/libavutil/intreadwrite.h b/app/src/main/cpp/include/libavutil/intreadwrite.h new file mode 100644 index 0000000..7c35771 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/intreadwrite.h @@ -0,0 +1,629 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_INTREADWRITE_H +#define AVUTIL_INTREADWRITE_H + +#include <stdint.h> +#include "libavutil/avconfig.h" +#include "attributes.h" +#include "bswap.h" + +typedef union { + uint64_t u64; + uint32_t u32[2]; + uint16_t u16[4]; + uint8_t u8[8]; + double f64; + float f32[2]; +} av_alias av_alias64; + +typedef union { + uint32_t u32; + uint16_t u16[2]; + uint8_t u8[4]; + float f32; +} av_alias av_alias32; + +typedef union { + uint16_t u16; + uint8_t u8[2]; +} av_alias av_alias16; + +/* + * Arch-specific headers can provide any combination of + * AV_[RW][BLN](16|24|32|48|64) and AV_(COPY|SWAP|ZERO)(64|128) macros. + * Preprocessor symbols must be defined, even if these are implemented + * as inline functions. + * + * R/W means read/write, B/L/N means big/little/native endianness. + * The following macros require aligned access, compared to their + * unaligned variants: AV_(COPY|SWAP|ZERO)(64|128), AV_[RW]N[8-64]A. + * Incorrect usage may range from abysmal performance to crash + * depending on the platform. + * + * The unaligned variants are AV_[RW][BLN][8-64] and AV_COPY*U. + */ + +#ifdef HAVE_AV_CONFIG_H + +#include "config.h" + +#if ARCH_ARM +# include "arm/intreadwrite.h" +#elif ARCH_AVR32 +# include "avr32/intreadwrite.h" +#elif ARCH_MIPS +# include "mips/intreadwrite.h" +#elif ARCH_PPC +# include "ppc/intreadwrite.h" +#elif ARCH_TOMI +# include "tomi/intreadwrite.h" +#elif ARCH_X86 +# include "x86/intreadwrite.h" +#endif + +#endif /* HAVE_AV_CONFIG_H */ + +/* + * Map AV_RNXX <-> AV_R[BL]XX for all variants provided by per-arch headers. + */ + +#if AV_HAVE_BIGENDIAN + +# if defined(AV_RN16) && !defined(AV_RB16) +# define AV_RB16(p) AV_RN16(p) +# elif !defined(AV_RN16) && defined(AV_RB16) +# define AV_RN16(p) AV_RB16(p) +# endif + +# if defined(AV_WN16) && !defined(AV_WB16) +# define AV_WB16(p, v) AV_WN16(p, v) +# elif !defined(AV_WN16) && defined(AV_WB16) +# define AV_WN16(p, v) AV_WB16(p, v) +# endif + +# if defined(AV_RN24) && !defined(AV_RB24) +# define AV_RB24(p) AV_RN24(p) +# elif !defined(AV_RN24) && defined(AV_RB24) +# define AV_RN24(p) AV_RB24(p) +# endif + +# if defined(AV_WN24) && !defined(AV_WB24) +# define AV_WB24(p, v) AV_WN24(p, v) +# elif !defined(AV_WN24) && defined(AV_WB24) +# define AV_WN24(p, v) AV_WB24(p, v) +# endif + +# if defined(AV_RN32) && !defined(AV_RB32) +# define AV_RB32(p) AV_RN32(p) +# elif !defined(AV_RN32) && defined(AV_RB32) +# define AV_RN32(p) AV_RB32(p) +# endif + +# if defined(AV_WN32) && !defined(AV_WB32) +# define AV_WB32(p, v) AV_WN32(p, v) +# elif !defined(AV_WN32) && defined(AV_WB32) +# define AV_WN32(p, v) AV_WB32(p, v) +# endif + +# if defined(AV_RN48) && !defined(AV_RB48) +# define AV_RB48(p) AV_RN48(p) +# elif !defined(AV_RN48) && defined(AV_RB48) +# define AV_RN48(p) AV_RB48(p) +# endif + +# if defined(AV_WN48) && !defined(AV_WB48) +# define AV_WB48(p, v) AV_WN48(p, v) +# elif !defined(AV_WN48) && defined(AV_WB48) +# define AV_WN48(p, v) AV_WB48(p, v) +# endif + +# if defined(AV_RN64) && !defined(AV_RB64) +# define AV_RB64(p) AV_RN64(p) +# elif !defined(AV_RN64) && defined(AV_RB64) +# define AV_RN64(p) AV_RB64(p) +# endif + +# if defined(AV_WN64) && !defined(AV_WB64) +# define AV_WB64(p, v) AV_WN64(p, v) +# elif !defined(AV_WN64) && defined(AV_WB64) +# define AV_WN64(p, v) AV_WB64(p, v) +# endif + +#else /* AV_HAVE_BIGENDIAN */ + +# if defined(AV_RN16) && !defined(AV_RL16) +# define AV_RL16(p) AV_RN16(p) +# elif !defined(AV_RN16) && defined(AV_RL16) +# define AV_RN16(p) AV_RL16(p) +# endif + +# if defined(AV_WN16) && !defined(AV_WL16) +# define AV_WL16(p, v) AV_WN16(p, v) +# elif !defined(AV_WN16) && defined(AV_WL16) +# define AV_WN16(p, v) AV_WL16(p, v) +# endif + +# if defined(AV_RN24) && !defined(AV_RL24) +# define AV_RL24(p) AV_RN24(p) +# elif !defined(AV_RN24) && defined(AV_RL24) +# define AV_RN24(p) AV_RL24(p) +# endif + +# if defined(AV_WN24) && !defined(AV_WL24) +# define AV_WL24(p, v) AV_WN24(p, v) +# elif !defined(AV_WN24) && defined(AV_WL24) +# define AV_WN24(p, v) AV_WL24(p, v) +# endif + +# if defined(AV_RN32) && !defined(AV_RL32) +# define AV_RL32(p) AV_RN32(p) +# elif !defined(AV_RN32) && defined(AV_RL32) +# define AV_RN32(p) AV_RL32(p) +# endif + +# if defined(AV_WN32) && !defined(AV_WL32) +# define AV_WL32(p, v) AV_WN32(p, v) +# elif !defined(AV_WN32) && defined(AV_WL32) +# define AV_WN32(p, v) AV_WL32(p, v) +# endif + +# if defined(AV_RN48) && !defined(AV_RL48) +# define AV_RL48(p) AV_RN48(p) +# elif !defined(AV_RN48) && defined(AV_RL48) +# define AV_RN48(p) AV_RL48(p) +# endif + +# if defined(AV_WN48) && !defined(AV_WL48) +# define AV_WL48(p, v) AV_WN48(p, v) +# elif !defined(AV_WN48) && defined(AV_WL48) +# define AV_WN48(p, v) AV_WL48(p, v) +# endif + +# if defined(AV_RN64) && !defined(AV_RL64) +# define AV_RL64(p) AV_RN64(p) +# elif !defined(AV_RN64) && defined(AV_RL64) +# define AV_RN64(p) AV_RL64(p) +# endif + +# if defined(AV_WN64) && !defined(AV_WL64) +# define AV_WL64(p, v) AV_WN64(p, v) +# elif !defined(AV_WN64) && defined(AV_WL64) +# define AV_WN64(p, v) AV_WL64(p, v) +# endif + +#endif /* !AV_HAVE_BIGENDIAN */ + +/* + * Define AV_[RW]N helper macros to simplify definitions not provided + * by per-arch headers. + */ + +#if defined(__GNUC__) && !defined(__TI_COMPILER_VERSION__) + +union unaligned_64 { uint64_t l; } __attribute__((packed)) av_alias; +union unaligned_32 { uint32_t l; } __attribute__((packed)) av_alias; +union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias; + +# define AV_RN(s, p) (((const union unaligned_##s *) (p))->l) +# define AV_WN(s, p, v) ((((union unaligned_##s *) (p))->l) = (v)) + +#elif defined(__DECC) + +# define AV_RN(s, p) (*((const __unaligned uint##s##_t*)(p))) +# define AV_WN(s, p, v) (*((__unaligned uint##s##_t*)(p)) = (v)) + +#elif AV_HAVE_FAST_UNALIGNED + +# define AV_RN(s, p) (((const av_alias##s*)(p))->u##s) +# define AV_WN(s, p, v) (((av_alias##s*)(p))->u##s = (v)) + +#else + +#ifndef AV_RB16 +# define AV_RB16(x) \ + ((((const uint8_t*)(x))[0] << 8) | \ + ((const uint8_t*)(x))[1]) +#endif +#ifndef AV_WB16 +# define AV_WB16(p, darg) do { \ + unsigned d = (darg); \ + ((uint8_t*)(p))[1] = (d); \ + ((uint8_t*)(p))[0] = (d)>>8; \ + } while(0) +#endif + +#ifndef AV_RL16 +# define AV_RL16(x) \ + ((((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL16 +# define AV_WL16(p, darg) do { \ + unsigned d = (darg); \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + } while(0) +#endif + +#ifndef AV_RB32 +# define AV_RB32(x) \ + (((uint32_t)((const uint8_t*)(x))[0] << 24) | \ + (((const uint8_t*)(x))[1] << 16) | \ + (((const uint8_t*)(x))[2] << 8) | \ + ((const uint8_t*)(x))[3]) +#endif +#ifndef AV_WB32 +# define AV_WB32(p, darg) do { \ + unsigned d = (darg); \ + ((uint8_t*)(p))[3] = (d); \ + ((uint8_t*)(p))[2] = (d)>>8; \ + ((uint8_t*)(p))[1] = (d)>>16; \ + ((uint8_t*)(p))[0] = (d)>>24; \ + } while(0) +#endif + +#ifndef AV_RL32 +# define AV_RL32(x) \ + (((uint32_t)((const uint8_t*)(x))[3] << 24) | \ + (((const uint8_t*)(x))[2] << 16) | \ + (((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL32 +# define AV_WL32(p, darg) do { \ + unsigned d = (darg); \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + ((uint8_t*)(p))[3] = (d)>>24; \ + } while(0) +#endif + +#ifndef AV_RB64 +# define AV_RB64(x) \ + (((uint64_t)((const uint8_t*)(x))[0] << 56) | \ + ((uint64_t)((const uint8_t*)(x))[1] << 48) | \ + ((uint64_t)((const uint8_t*)(x))[2] << 40) | \ + ((uint64_t)((const uint8_t*)(x))[3] << 32) | \ + ((uint64_t)((const uint8_t*)(x))[4] << 24) | \ + ((uint64_t)((const uint8_t*)(x))[5] << 16) | \ + ((uint64_t)((const uint8_t*)(x))[6] << 8) | \ + (uint64_t)((const uint8_t*)(x))[7]) +#endif +#ifndef AV_WB64 +# define AV_WB64(p, darg) do { \ + uint64_t d = (darg); \ + ((uint8_t*)(p))[7] = (d); \ + ((uint8_t*)(p))[6] = (d)>>8; \ + ((uint8_t*)(p))[5] = (d)>>16; \ + ((uint8_t*)(p))[4] = (d)>>24; \ + ((uint8_t*)(p))[3] = (d)>>32; \ + ((uint8_t*)(p))[2] = (d)>>40; \ + ((uint8_t*)(p))[1] = (d)>>48; \ + ((uint8_t*)(p))[0] = (d)>>56; \ + } while(0) +#endif + +#ifndef AV_RL64 +# define AV_RL64(x) \ + (((uint64_t)((const uint8_t*)(x))[7] << 56) | \ + ((uint64_t)((const uint8_t*)(x))[6] << 48) | \ + ((uint64_t)((const uint8_t*)(x))[5] << 40) | \ + ((uint64_t)((const uint8_t*)(x))[4] << 32) | \ + ((uint64_t)((const uint8_t*)(x))[3] << 24) | \ + ((uint64_t)((const uint8_t*)(x))[2] << 16) | \ + ((uint64_t)((const uint8_t*)(x))[1] << 8) | \ + (uint64_t)((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL64 +# define AV_WL64(p, darg) do { \ + uint64_t d = (darg); \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + ((uint8_t*)(p))[3] = (d)>>24; \ + ((uint8_t*)(p))[4] = (d)>>32; \ + ((uint8_t*)(p))[5] = (d)>>40; \ + ((uint8_t*)(p))[6] = (d)>>48; \ + ((uint8_t*)(p))[7] = (d)>>56; \ + } while(0) +#endif + +#if AV_HAVE_BIGENDIAN +# define AV_RN(s, p) AV_RB##s(p) +# define AV_WN(s, p, v) AV_WB##s(p, v) +#else +# define AV_RN(s, p) AV_RL##s(p) +# define AV_WN(s, p, v) AV_WL##s(p, v) +#endif + +#endif /* HAVE_FAST_UNALIGNED */ + +#ifndef AV_RN16 +# define AV_RN16(p) AV_RN(16, p) +#endif + +#ifndef AV_RN32 +# define AV_RN32(p) AV_RN(32, p) +#endif + +#ifndef AV_RN64 +# define AV_RN64(p) AV_RN(64, p) +#endif + +#ifndef AV_WN16 +# define AV_WN16(p, v) AV_WN(16, p, v) +#endif + +#ifndef AV_WN32 +# define AV_WN32(p, v) AV_WN(32, p, v) +#endif + +#ifndef AV_WN64 +# define AV_WN64(p, v) AV_WN(64, p, v) +#endif + +#if AV_HAVE_BIGENDIAN +# define AV_RB(s, p) AV_RN##s(p) +# define AV_WB(s, p, v) AV_WN##s(p, v) +# define AV_RL(s, p) av_bswap##s(AV_RN##s(p)) +# define AV_WL(s, p, v) AV_WN##s(p, av_bswap##s(v)) +#else +# define AV_RB(s, p) av_bswap##s(AV_RN##s(p)) +# define AV_WB(s, p, v) AV_WN##s(p, av_bswap##s(v)) +# define AV_RL(s, p) AV_RN##s(p) +# define AV_WL(s, p, v) AV_WN##s(p, v) +#endif + +#define AV_RB8(x) (((const uint8_t*)(x))[0]) +#define AV_WB8(p, d) do { ((uint8_t*)(p))[0] = (d); } while(0) + +#define AV_RL8(x) AV_RB8(x) +#define AV_WL8(p, d) AV_WB8(p, d) + +#ifndef AV_RB16 +# define AV_RB16(p) AV_RB(16, p) +#endif +#ifndef AV_WB16 +# define AV_WB16(p, v) AV_WB(16, p, v) +#endif + +#ifndef AV_RL16 +# define AV_RL16(p) AV_RL(16, p) +#endif +#ifndef AV_WL16 +# define AV_WL16(p, v) AV_WL(16, p, v) +#endif + +#ifndef AV_RB32 +# define AV_RB32(p) AV_RB(32, p) +#endif +#ifndef AV_WB32 +# define AV_WB32(p, v) AV_WB(32, p, v) +#endif + +#ifndef AV_RL32 +# define AV_RL32(p) AV_RL(32, p) +#endif +#ifndef AV_WL32 +# define AV_WL32(p, v) AV_WL(32, p, v) +#endif + +#ifndef AV_RB64 +# define AV_RB64(p) AV_RB(64, p) +#endif +#ifndef AV_WB64 +# define AV_WB64(p, v) AV_WB(64, p, v) +#endif + +#ifndef AV_RL64 +# define AV_RL64(p) AV_RL(64, p) +#endif +#ifndef AV_WL64 +# define AV_WL64(p, v) AV_WL(64, p, v) +#endif + +#ifndef AV_RB24 +# define AV_RB24(x) \ + ((((const uint8_t*)(x))[0] << 16) | \ + (((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[2]) +#endif +#ifndef AV_WB24 +# define AV_WB24(p, d) do { \ + ((uint8_t*)(p))[2] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[0] = (d)>>16; \ + } while(0) +#endif + +#ifndef AV_RL24 +# define AV_RL24(x) \ + ((((const uint8_t*)(x))[2] << 16) | \ + (((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL24 +# define AV_WL24(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + } while(0) +#endif + +#ifndef AV_RB48 +# define AV_RB48(x) \ + (((uint64_t)((const uint8_t*)(x))[0] << 40) | \ + ((uint64_t)((const uint8_t*)(x))[1] << 32) | \ + ((uint64_t)((const uint8_t*)(x))[2] << 24) | \ + ((uint64_t)((const uint8_t*)(x))[3] << 16) | \ + ((uint64_t)((const uint8_t*)(x))[4] << 8) | \ + (uint64_t)((const uint8_t*)(x))[5]) +#endif +#ifndef AV_WB48 +# define AV_WB48(p, darg) do { \ + uint64_t d = (darg); \ + ((uint8_t*)(p))[5] = (d); \ + ((uint8_t*)(p))[4] = (d)>>8; \ + ((uint8_t*)(p))[3] = (d)>>16; \ + ((uint8_t*)(p))[2] = (d)>>24; \ + ((uint8_t*)(p))[1] = (d)>>32; \ + ((uint8_t*)(p))[0] = (d)>>40; \ + } while(0) +#endif + +#ifndef AV_RL48 +# define AV_RL48(x) \ + (((uint64_t)((const uint8_t*)(x))[5] << 40) | \ + ((uint64_t)((const uint8_t*)(x))[4] << 32) | \ + ((uint64_t)((const uint8_t*)(x))[3] << 24) | \ + ((uint64_t)((const uint8_t*)(x))[2] << 16) | \ + ((uint64_t)((const uint8_t*)(x))[1] << 8) | \ + (uint64_t)((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL48 +# define AV_WL48(p, darg) do { \ + uint64_t d = (darg); \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + ((uint8_t*)(p))[3] = (d)>>24; \ + ((uint8_t*)(p))[4] = (d)>>32; \ + ((uint8_t*)(p))[5] = (d)>>40; \ + } while(0) +#endif + +/* + * The AV_[RW]NA macros access naturally aligned data + * in a type-safe way. + */ + +#define AV_RNA(s, p) (((const av_alias##s*)(p))->u##s) +#define AV_WNA(s, p, v) (((av_alias##s*)(p))->u##s = (v)) + +#ifndef AV_RN16A +# define AV_RN16A(p) AV_RNA(16, p) +#endif + +#ifndef AV_RN32A +# define AV_RN32A(p) AV_RNA(32, p) +#endif + +#ifndef AV_RN64A +# define AV_RN64A(p) AV_RNA(64, p) +#endif + +#ifndef AV_WN16A +# define AV_WN16A(p, v) AV_WNA(16, p, v) +#endif + +#ifndef AV_WN32A +# define AV_WN32A(p, v) AV_WNA(32, p, v) +#endif + +#ifndef AV_WN64A +# define AV_WN64A(p, v) AV_WNA(64, p, v) +#endif + +/* + * The AV_COPYxxU macros are suitable for copying data to/from unaligned + * memory locations. + */ + +#define AV_COPYU(n, d, s) AV_WN##n(d, AV_RN##n(s)); + +#ifndef AV_COPY16U +# define AV_COPY16U(d, s) AV_COPYU(16, d, s) +#endif + +#ifndef AV_COPY32U +# define AV_COPY32U(d, s) AV_COPYU(32, d, s) +#endif + +#ifndef AV_COPY64U +# define AV_COPY64U(d, s) AV_COPYU(64, d, s) +#endif + +#ifndef AV_COPY128U +# define AV_COPY128U(d, s) \ + do { \ + AV_COPY64U(d, s); \ + AV_COPY64U((char *)(d) + 8, (const char *)(s) + 8); \ + } while(0) +#endif + +/* Parameters for AV_COPY*, AV_SWAP*, AV_ZERO* must be + * naturally aligned. They may be implemented using MMX, + * so emms_c() must be called before using any float code + * afterwards. + */ + +#define AV_COPY(n, d, s) \ + (((av_alias##n*)(d))->u##n = ((const av_alias##n*)(s))->u##n) + +#ifndef AV_COPY16 +# define AV_COPY16(d, s) AV_COPY(16, d, s) +#endif + +#ifndef AV_COPY32 +# define AV_COPY32(d, s) AV_COPY(32, d, s) +#endif + +#ifndef AV_COPY64 +# define AV_COPY64(d, s) AV_COPY(64, d, s) +#endif + +#ifndef AV_COPY128 +# define AV_COPY128(d, s) \ + do { \ + AV_COPY64(d, s); \ + AV_COPY64((char*)(d)+8, (char*)(s)+8); \ + } while(0) +#endif + +#define AV_SWAP(n, a, b) FFSWAP(av_alias##n, *(av_alias##n*)(a), *(av_alias##n*)(b)) + +#ifndef AV_SWAP64 +# define AV_SWAP64(a, b) AV_SWAP(64, a, b) +#endif + +#define AV_ZERO(n, d) (((av_alias##n*)(d))->u##n = 0) + +#ifndef AV_ZERO16 +# define AV_ZERO16(d) AV_ZERO(16, d) +#endif + +#ifndef AV_ZERO32 +# define AV_ZERO32(d) AV_ZERO(32, d) +#endif + +#ifndef AV_ZERO64 +# define AV_ZERO64(d) AV_ZERO(64, d) +#endif + +#ifndef AV_ZERO128 +# define AV_ZERO128(d) \ + do { \ + AV_ZERO64(d); \ + AV_ZERO64((char*)(d)+8); \ + } while(0) +#endif + +#endif /* AVUTIL_INTREADWRITE_H */ diff --git a/app/src/main/cpp/include/libavutil/lfg.h b/app/src/main/cpp/include/libavutil/lfg.h new file mode 100644 index 0000000..6ccaf3d --- /dev/null +++ b/app/src/main/cpp/include/libavutil/lfg.h @@ -0,0 +1,62 @@ +/* + * Lagged Fibonacci PRNG + * Copyright (c) 2008 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_LFG_H +#define AVUTIL_LFG_H + +typedef struct AVLFG { + unsigned int state[64]; + int index; +} AVLFG; + +void av_lfg_init(AVLFG *c, unsigned int seed); + +/** + * Get the next random unsigned 32-bit number using an ALFG. + * + * Please also consider a simple LCG like state= state*1664525+1013904223, + * it may be good enough and faster for your specific use case. + */ +static inline unsigned int av_lfg_get(AVLFG *c) { + c->state[c->index & 63] = c->state[(c->index - 24) & 63] + c->state[(c->index - 55) & 63]; + return c->state[c->index++ & 63]; +} + +/** + * Get the next random unsigned 32-bit number using a MLFG. + * + * Please also consider av_lfg_get() above, it is faster. + */ +static inline unsigned int av_mlfg_get(AVLFG *c) { + unsigned int a = c->state[(c->index - 55) & 63]; + unsigned int b = c->state[(c->index - 24) & 63]; + return c->state[c->index++ & 63] = 2 * a * b + a + b; +} + +/** + * Get the next two numbers generated by a Box-Muller Gaussian + * generator using the random numbers issued by lfg. + * + * @param out array where the two generated numbers are placed + */ +void av_bmg_get(AVLFG *lfg, double out[2]); + +#endif /* AVUTIL_LFG_H */ diff --git a/app/src/main/cpp/include/libavutil/log.h b/app/src/main/cpp/include/libavutil/log.h new file mode 100644 index 0000000..31bc13e --- /dev/null +++ b/app/src/main/cpp/include/libavutil/log.h @@ -0,0 +1,352 @@ +/* + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_LOG_H +#define AVUTIL_LOG_H + +#include <stdarg.h> +#include "avutil.h" +#include "attributes.h" + +typedef enum { + AV_CLASS_CATEGORY_NA = 0, + AV_CLASS_CATEGORY_INPUT, + AV_CLASS_CATEGORY_OUTPUT, + AV_CLASS_CATEGORY_MUXER, + AV_CLASS_CATEGORY_DEMUXER, + AV_CLASS_CATEGORY_ENCODER, + AV_CLASS_CATEGORY_DECODER, + AV_CLASS_CATEGORY_FILTER, + AV_CLASS_CATEGORY_BITSTREAM_FILTER, + AV_CLASS_CATEGORY_SWSCALER, + AV_CLASS_CATEGORY_SWRESAMPLER, + AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT = 40, + AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT, + AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT, + AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT, + AV_CLASS_CATEGORY_DEVICE_OUTPUT, + AV_CLASS_CATEGORY_DEVICE_INPUT, + AV_CLASS_CATEGORY_NB, ///< not part of ABI/API +} AVClassCategory; + +#define AV_IS_INPUT_DEVICE(category) \ + (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_INPUT)) + +#define AV_IS_OUTPUT_DEVICE(category) \ + (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_OUTPUT)) + +struct AVOptionRanges; + +/** + * Describe the class of an AVClass context structure. That is an + * arbitrary struct of which the first field is a pointer to an + * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.). + */ +typedef struct AVClass { + /** + * The name of the class; usually it is the same name as the + * context structure type to which the AVClass is associated. + */ + const char *class_name; + + /** + * A pointer to a function which returns the name of a context + * instance ctx associated with the class. + */ + const char *(*item_name)(void *ctx); + + /** + * a pointer to the first option specified in the class if any or NULL + * + * @see av_set_default_options() + */ + const struct AVOption *option; + + /** + * LIBAVUTIL_VERSION with which this structure was created. + * This is used to allow fields to be added without requiring major + * version bumps everywhere. + */ + + int version; + + /** + * Offset in the structure where log_level_offset is stored. + * 0 means there is no such variable + */ + int log_level_offset_offset; + + /** + * Offset in the structure where a pointer to the parent context for + * logging is stored. For example a decoder could pass its AVCodecContext + * to eval as such a parent context, which an av_log() implementation + * could then leverage to display the parent context. + * The offset can be NULL. + */ + int parent_log_context_offset; + + /** + * Return next AVOptions-enabled child or NULL + */ + void *(*child_next)(void *obj, void *prev); + + /** + * Return an AVClass corresponding to the next potential + * AVOptions-enabled child. + * + * The difference between child_next and this is that + * child_next iterates over _already existing_ objects, while + * child_class_next iterates over _all possible_ children. + */ + const struct AVClass *(*child_class_next)(const struct AVClass *prev); + + /** + * Category used for visualization (like color) + * This is only set if the category is equal for all objects using this class. + * available since version (51 << 16 | 56 << 8 | 100) + */ + AVClassCategory category; + + /** + * Callback to return the category. + * available since version (51 << 16 | 59 << 8 | 100) + */ + AVClassCategory (*get_category)(void *ctx); + + /** + * Callback to return the supported/allowed ranges. + * available since version (52.12) + */ + int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags); +} AVClass; + +/** + * @addtogroup lavu_log + * + * @{ + * + * @defgroup lavu_log_constants Logging Constants + * + * @{ + */ + +/** + * Print no output. + */ +#define AV_LOG_QUIET -8 + +/** + * Something went really wrong and we will crash now. + */ +#define AV_LOG_PANIC 0 + +/** + * Something went wrong and recovery is not possible. + * For example, no header was found for a format which depends + * on headers or an illegal combination of parameters is used. + */ +#define AV_LOG_FATAL 8 + +/** + * Something went wrong and cannot losslessly be recovered. + * However, not all future data is affected. + */ +#define AV_LOG_ERROR 16 + +/** + * Something somehow does not look correct. This may or may not + * lead to problems. An example would be the use of '-vstrict -2'. + */ +#define AV_LOG_WARNING 24 + +/** + * Standard information. + */ +#define AV_LOG_INFO 32 + +/** + * Detailed information. + */ +#define AV_LOG_VERBOSE 40 + +/** + * Stuff which is only useful for libav* developers. + */ +#define AV_LOG_DEBUG 48 + +#define AV_LOG_MAX_OFFSET (AV_LOG_DEBUG - AV_LOG_QUIET) + +/** + * @} + */ + +/** + * Sets additional colors for extended debugging sessions. + * @code + av_log(ctx, AV_LOG_DEBUG|AV_LOG_C(134), "Message in purple\n"); + @endcode + * Requires 256color terminal support. Uses outside debugging is not + * recommended. + */ +#define AV_LOG_C(x) (x << 8) + +/** + * Send the specified message to the log if the level is less than or equal + * to the current av_log_level. By default, all logging messages are sent to + * stderr. This behavior can be altered by setting a different logging callback + * function. + * @see av_log_set_callback + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message expressed using a @ref + * lavu_log_constants "Logging Constant". + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + */ +void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4); + + +/** + * Send the specified message to the log if the level is less than or equal + * to the current av_log_level. By default, all logging messages are sent to + * stderr. This behavior can be altered by setting a different logging callback + * function. + * @see av_log_set_callback + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message expressed using a @ref + * lavu_log_constants "Logging Constant". + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + * @param vl The arguments referenced by the format string. + */ +void av_vlog(void *avcl, int level, const char *fmt, va_list vl); + +/** + * Get the current log level + * + * @see lavu_log_constants + * + * @return Current log level + */ +int av_log_get_level(void); + +/** + * Set the log level + * + * @see lavu_log_constants + * + * @param level Logging level + */ +void av_log_set_level(int level); + +/** + * Set the logging callback + * + * @note The callback must be thread safe, even if the application does not use + * threads itself as some codecs are multithreaded. + * + * @see av_log_default_callback + * + * @param callback A logging function with a compatible signature. + */ +void av_log_set_callback(void (*callback)(void *, int, const char *, va_list)); + +/** + * Default logging callback + * + * It prints the message to stderr, optionally colorizing it. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message expressed using a @ref + * lavu_log_constants "Logging Constant". + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + * @param vl The arguments referenced by the format string. + */ +void av_log_default_callback(void *avcl, int level, const char *fmt, + va_list vl); + +/** + * Return the context name + * + * @param ctx The AVClass context + * + * @return The AVClass class_name + */ +const char *av_default_item_name(void *ctx); + +AVClassCategory av_default_get_category(void *ptr); + +/** + * Format a line of log the same way as the default callback. + * @param line buffer to receive the formated line + * @param line_size size of the buffer + * @param print_prefix used to store whether the prefix must be printed; + * must point to a persistent integer initially set to 1 + */ +void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl, + char *line, int line_size, int *print_prefix); + +/** + * av_dlog macros + * Useful to print debug messages that shouldn't get compiled in normally. + */ + +#ifdef DEBUG +# define av_dlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__) +#else +# define av_dlog(pctx, ...) do { if (0) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0) +#endif + +/** + * Skip repeated messages, this requires the user app to use av_log() instead of + * (f)printf as the 2 would otherwise interfere and lead to + * "Last message repeated x times" messages below (f)printf messages with some + * bad luck. + * Also to receive the last, "last repeated" line if any, the user app must + * call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end + */ +#define AV_LOG_SKIP_REPEATED 1 + +/** + * Include the log severity in messages originating from codecs. + * + * Results in messages such as: + * [rawvideo @ 0xDEADBEEF] [error] encode did not produce valid pts + */ +#define AV_LOG_PRINT_LEVEL 2 + +void av_log_set_flags(int arg); + +int av_log_get_flags(void); + +/** + * @} + */ + +#endif /* AVUTIL_LOG_H */ diff --git a/app/src/main/cpp/include/libavutil/lzo.h b/app/src/main/cpp/include/libavutil/lzo.h new file mode 100644 index 0000000..c034039 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/lzo.h @@ -0,0 +1,66 @@ +/* + * LZO 1x decompression + * copyright (c) 2006 Reimar Doeffinger + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_LZO_H +#define AVUTIL_LZO_H + +/** + * @defgroup lavu_lzo LZO + * @ingroup lavu_crypto + * + * @{ + */ + +#include <stdint.h> + +/** @name Error flags returned by av_lzo1x_decode + * @{ */ +/// end of the input buffer reached before decoding finished +#define AV_LZO_INPUT_DEPLETED 1 +/// decoded data did not fit into output buffer +#define AV_LZO_OUTPUT_FULL 2 +/// a reference to previously decoded data was wrong +#define AV_LZO_INVALID_BACKPTR 4 +/// a non-specific error in the compressed bitstream +#define AV_LZO_ERROR 8 +/** @} */ + +#define AV_LZO_INPUT_PADDING 8 +#define AV_LZO_OUTPUT_PADDING 12 + +/** + * @brief Decodes LZO 1x compressed data. + * @param out output buffer + * @param outlen size of output buffer, number of bytes left are returned here + * @param in input buffer + * @param inlen size of input buffer, number of bytes left are returned here + * @return 0 on success, otherwise a combination of the error flags above + * + * Make sure all buffers are appropriately padded, in must provide + * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes. + */ +int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen); + +/** + * @} + */ + +#endif /* AVUTIL_LZO_H */ diff --git a/app/src/main/cpp/include/libavutil/macros.h b/app/src/main/cpp/include/libavutil/macros.h new file mode 100644 index 0000000..4465323 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/macros.h @@ -0,0 +1,48 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu + * Utility Preprocessor macros + */ + +#ifndef AVUTIL_MACROS_H +#define AVUTIL_MACROS_H + +/** + * @addtogroup preproc_misc Preprocessor String Macros + * + * String manipulation macros + * + * @{ + */ + +#define AV_STRINGIFY(s) AV_TOSTRING(s) +#define AV_TOSTRING(s) #s + +#define AV_GLUE(a, b) a ## b +#define AV_JOIN(a, b) AV_GLUE(a, b) + +/** + * @} + */ + +#define AV_PRAGMA(s) _Pragma(#s) + +#endif /* AVUTIL_MACROS_H */ diff --git a/app/src/main/cpp/include/libavutil/mathematics.h b/app/src/main/cpp/include/libavutil/mathematics.h new file mode 100644 index 0000000..1954065 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/mathematics.h @@ -0,0 +1,166 @@ +/* + * copyright (c) 2005-2012 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_MATHEMATICS_H +#define AVUTIL_MATHEMATICS_H + +#include <stdint.h> +#include <math.h> +#include "attributes.h" +#include "rational.h" +#include "intfloat.h" + +#ifndef M_E +#define M_E 2.7182818284590452354 /* e */ +#endif +#ifndef M_LN2 +#define M_LN2 0.69314718055994530942 /* log_e 2 */ +#endif +#ifndef M_LN10 +#define M_LN10 2.30258509299404568402 /* log_e 10 */ +#endif +#ifndef M_LOG2_10 +#define M_LOG2_10 3.32192809488736234787 /* log_2 10 */ +#endif +#ifndef M_PHI +#define M_PHI 1.61803398874989484820 /* phi / golden ratio */ +#endif +#ifndef M_PI +#define M_PI 3.14159265358979323846 /* pi */ +#endif +#ifndef M_PI_2 +#define M_PI_2 1.57079632679489661923 /* pi/2 */ +#endif +#ifndef M_SQRT1_2 +#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ +#endif +#ifndef M_SQRT2 +#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ +#endif +#ifndef NAN +#define NAN av_int2float(0x7fc00000) +#endif +#ifndef INFINITY +#define INFINITY av_int2float(0x7f800000) +#endif + +/** + * @addtogroup lavu_math + * @{ + */ + + +enum AVRounding { + AV_ROUND_ZERO = 0, ///< Round toward zero. + AV_ROUND_INF = 1, ///< Round away from zero. + AV_ROUND_DOWN = 2, ///< Round toward -infinity. + AV_ROUND_UP = 3, ///< Round toward +infinity. + AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero. + AV_ROUND_PASS_MINMAX = 8192, ///< Flag to pass INT64_MIN/MAX through instead of rescaling, this avoids special cases for AV_NOPTS_VALUE +}; + +/** + * Return the greatest common divisor of a and b. + * If both a and b are 0 or either or both are <0 then behavior is + * undefined. + */ +int64_t av_const av_gcd(int64_t a, int64_t b); + +/** + * Rescale a 64-bit integer with rounding to nearest. + * A simple a*b/c isn't possible as it can overflow. + */ +int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const; + +/** + * Rescale a 64-bit integer with specified rounding. + * A simple a*b/c isn't possible as it can overflow. + * + * @return rescaled value a, or if AV_ROUND_PASS_MINMAX is set and a is + * INT64_MIN or INT64_MAX then a is passed through unchanged. + */ +int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const; + +/** + * Rescale a 64-bit integer by 2 rational numbers. + */ +int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const; + +/** + * Rescale a 64-bit integer by 2 rational numbers with specified rounding. + * + * @return rescaled value a, or if AV_ROUND_PASS_MINMAX is set and a is + * INT64_MIN or INT64_MAX then a is passed through unchanged. + */ +int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, + enum AVRounding) av_const; + +/** + * Compare 2 timestamps each in its own timebases. + * The result of the function is undefined if one of the timestamps + * is outside the int64_t range when represented in the others timebase. + * @return -1 if ts_a is before ts_b, 1 if ts_a is after ts_b or 0 if they represent the same position + */ +int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b); + +/** + * Compare 2 integers modulo mod. + * That is we compare integers a and b for which only the least + * significant log2(mod) bits are known. + * + * @param mod must be a power of 2 + * @return a negative value if a is smaller than b + * a positive value if a is greater than b + * 0 if a equals b + */ +int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod); + +/** + * Rescale a timestamp while preserving known durations. + * + * @param in_ts Input timestamp + * @param in_tb Input timebase + * @param fs_tb Duration and *last timebase + * @param duration duration till the next call + * @param out_tb Output timebase + */ +int64_t +av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int duration, int64_t *last, + AVRational out_tb); + +/** + * Add a value to a timestamp. + * + * This function guarantees that when the same value is repeatly added that + * no accumulation of rounding errors occurs. + * + * @param ts Input timestamp + * @param ts_tb Input timestamp timebase + * @param inc value to add to ts + * @param inc_tb inc timebase + */ +int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc); + + +/** +* @} +*/ + +#endif /* AVUTIL_MATHEMATICS_H */ diff --git a/app/src/main/cpp/include/libavutil/md5.h b/app/src/main/cpp/include/libavutil/md5.h new file mode 100644 index 0000000..79702c8 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/md5.h @@ -0,0 +1,81 @@ +/* + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_MD5_H +#define AVUTIL_MD5_H + +#include <stdint.h> + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_md5 MD5 + * @ingroup lavu_crypto + * @{ + */ + +extern const int av_md5_size; + +struct AVMD5; + +/** + * Allocate an AVMD5 context. + */ +struct AVMD5 *av_md5_alloc(void); + +/** + * Initialize MD5 hashing. + * + * @param ctx pointer to the function context (of size av_md5_size) + */ +void av_md5_init(struct AVMD5 *ctx); + +/** + * Update hash value. + * + * @param ctx hash function context + * @param src input data to update hash with + * @param len input data length + */ +void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len); + +/** + * Finish hashing and output digest value. + * + * @param ctx hash function context + * @param dst buffer where output digest value is stored + */ +void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); + +/** + * Hash an array of data. + * + * @param dst The output buffer to write the digest into + * @param src The data to hash + * @param len The length of the data, in bytes + */ +void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); + +/** + * @} + */ + +#endif /* AVUTIL_MD5_H */ diff --git a/app/src/main/cpp/include/libavutil/mem.h b/app/src/main/cpp/include/libavutil/mem.h new file mode 100644 index 0000000..fc113e4 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/mem.h @@ -0,0 +1,386 @@ +/* + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * memory handling functions + */ + +#ifndef AVUTIL_MEM_H +#define AVUTIL_MEM_H + +#include <limits.h> +#include <stdint.h> + +#include "attributes.h" +#include "error.h" +#include "avutil.h" + +/** + * @addtogroup lavu_mem + * @{ + */ + + +#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C) +#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v +#define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v +#elif defined(__TI_COMPILER_VERSION__) +#define DECLARE_ALIGNED(n,t,v) \ + AV_PRAGMA(DATA_ALIGN(v,n)) \ + t __attribute__((aligned(n))) v +#define DECLARE_ASM_CONST(n,t,v) \ + AV_PRAGMA(DATA_ALIGN(v,n)) \ + static const t __attribute__((aligned(n))) v +#elif defined(__GNUC__) +#define DECLARE_ALIGNED(n, t, v) t __attribute__ ((aligned (n))) v +#define DECLARE_ASM_CONST(n, t, v) static const t av_used __attribute__ ((aligned (n))) v +#elif defined(_MSC_VER) +#define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v +#define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v +#else +#define DECLARE_ALIGNED(n,t,v) t v +#define DECLARE_ASM_CONST(n,t,v) static const t v +#endif + +#if AV_GCC_VERSION_AT_LEAST(3, 1) +#define av_malloc_attrib __attribute__((__malloc__)) +#else +#define av_malloc_attrib +#endif + +#if AV_GCC_VERSION_AT_LEAST(4, 3) +#define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__))) +#else +#define av_alloc_size(...) +#endif + +/** + * Allocate a block of size bytes with alignment suitable for all + * memory accesses (including vectors if available on the CPU). + * @param size Size in bytes for the memory block to be allocated. + * @return Pointer to the allocated block, NULL if the block cannot + * be allocated. + * @see av_mallocz() + */ +void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1); + +/** + * Allocate a block of size * nmemb bytes with av_malloc(). + * @param nmemb Number of elements + * @param size Size of the single element + * @return Pointer to the allocated block, NULL if the block cannot + * be allocated. + * @see av_malloc() + */ +av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t size) { + if (!size || nmemb >= INT_MAX / size) + return NULL; + return av_malloc(nmemb * size); +} + +/** + * Allocate or reallocate a block of memory. + * If ptr is NULL and size > 0, allocate a new block. If + * size is zero, free the memory block pointed to by ptr. + * @param ptr Pointer to a memory block already allocated with + * av_realloc() or NULL. + * @param size Size in bytes of the memory block to be allocated or + * reallocated. + * @return Pointer to a newly-reallocated block or NULL if the block + * cannot be reallocated or the function is used to free the memory block. + * @warning Pointers originating from the av_malloc() family of functions must + * not be passed to av_realloc(). The former can be implemented using + * memalign() (or other functions), and there is no guarantee that + * pointers from such functions can be passed to realloc() at all. + * The situation is undefined according to POSIX and may crash with + * some libc implementations. + * @see av_fast_realloc() + */ +void *av_realloc(void *ptr, size_t size) av_alloc_size(2); + +/** + * Allocate or reallocate a block of memory. + * This function does the same thing as av_realloc, except: + * - It takes two arguments and checks the result of the multiplication for + * integer overflow. + * - It frees the input block in case of failure, thus avoiding the memory + * leak with the classic "buf = realloc(buf); if (!buf) return -1;". + */ +void *av_realloc_f(void *ptr, size_t nelem, size_t elsize); + +/** + * Allocate or reallocate a block of memory. + * If *ptr is NULL and size > 0, allocate a new block. If + * size is zero, free the memory block pointed to by ptr. + * @param ptr Pointer to a pointer to a memory block already allocated + * with av_realloc(), or pointer to a pointer to NULL. + * The pointer is updated on success, or freed on failure. + * @param size Size in bytes for the memory block to be allocated or + * reallocated + * @return Zero on success, an AVERROR error code on failure. + * @warning Pointers originating from the av_malloc() family of functions must + * not be passed to av_reallocp(). The former can be implemented using + * memalign() (or other functions), and there is no guarantee that + * pointers from such functions can be passed to realloc() at all. + * The situation is undefined according to POSIX and may crash with + * some libc implementations. + */ +int av_reallocp(void *ptr, size_t size); + +/** + * Allocate or reallocate an array. + * If ptr is NULL and nmemb > 0, allocate a new block. If + * nmemb is zero, free the memory block pointed to by ptr. + * @param ptr Pointer to a memory block already allocated with + * av_realloc() or NULL. + * @param nmemb Number of elements + * @param size Size of the single element + * @return Pointer to a newly-reallocated block or NULL if the block + * cannot be reallocated or the function is used to free the memory block. + * @warning Pointers originating from the av_malloc() family of functions must + * not be passed to av_realloc(). The former can be implemented using + * memalign() (or other functions), and there is no guarantee that + * pointers from such functions can be passed to realloc() at all. + * The situation is undefined according to POSIX and may crash with + * some libc implementations. + */ +av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size); + +/** + * Allocate or reallocate an array through a pointer to a pointer. + * If *ptr is NULL and nmemb > 0, allocate a new block. If + * nmemb is zero, free the memory block pointed to by ptr. + * @param ptr Pointer to a pointer to a memory block already allocated + * with av_realloc(), or pointer to a pointer to NULL. + * The pointer is updated on success, or freed on failure. + * @param nmemb Number of elements + * @param size Size of the single element + * @return Zero on success, an AVERROR error code on failure. + * @warning Pointers originating from the av_malloc() family of functions must + * not be passed to av_realloc(). The former can be implemented using + * memalign() (or other functions), and there is no guarantee that + * pointers from such functions can be passed to realloc() at all. + * The situation is undefined according to POSIX and may crash with + * some libc implementations. + */ +av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size); + +/** + * Free a memory block which has been allocated with av_malloc(z)() or + * av_realloc(). + * @param ptr Pointer to the memory block which should be freed. + * @note ptr = NULL is explicitly allowed. + * @note It is recommended that you use av_freep() instead. + * @see av_freep() + */ +void av_free(void *ptr); + +/** + * Allocate a block of size bytes with alignment suitable for all + * memory accesses (including vectors if available on the CPU) and + * zero all the bytes of the block. + * @param size Size in bytes for the memory block to be allocated. + * @return Pointer to the allocated block, NULL if it cannot be allocated. + * @see av_malloc() + */ +void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1); + +/** + * Allocate a block of nmemb * size bytes with alignment suitable for all + * memory accesses (including vectors if available on the CPU) and + * zero all the bytes of the block. + * The allocation will fail if nmemb * size is greater than or equal + * to INT_MAX. + * @param nmemb + * @param size + * @return Pointer to the allocated block, NULL if it cannot be allocated. + */ +void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib; + +/** + * Allocate a block of size * nmemb bytes with av_mallocz(). + * @param nmemb Number of elements + * @param size Size of the single element + * @return Pointer to the allocated block, NULL if the block cannot + * be allocated. + * @see av_mallocz() + * @see av_malloc_array() + */ +av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t size) { + if (!size || nmemb >= INT_MAX / size) + return NULL; + return av_mallocz(nmemb * size); +} + +/** + * Duplicate the string s. + * @param s string to be duplicated + * @return Pointer to a newly-allocated string containing a + * copy of s or NULL if the string cannot be allocated. + */ +char *av_strdup(const char *s) av_malloc_attrib; + +/** + * Duplicate a substring of the string s. + * @param s string to be duplicated + * @param len the maximum length of the resulting string (not counting the + * terminating byte). + * @return Pointer to a newly-allocated string containing a + * copy of s or NULL if the string cannot be allocated. + */ +char *av_strndup(const char *s, size_t len) av_malloc_attrib; + +/** + * Duplicate the buffer p. + * @param p buffer to be duplicated + * @return Pointer to a newly allocated buffer containing a + * copy of p or NULL if the buffer cannot be allocated. + */ +void *av_memdup(const void *p, size_t size); + +/** + * Free a memory block which has been allocated with av_malloc(z)() or + * av_realloc() and set the pointer pointing to it to NULL. + * @param ptr Pointer to the pointer to the memory block which should + * be freed. + * @note passing a pointer to a NULL pointer is safe and leads to no action. + * @see av_free() + */ +void av_freep(void *ptr); + +/** + * Add an element to a dynamic array. + * + * The array to grow is supposed to be an array of pointers to + * structures, and the element to add must be a pointer to an already + * allocated structure. + * + * The array is reallocated when its size reaches powers of 2. + * Therefore, the amortized cost of adding an element is constant. + * + * In case of success, the pointer to the array is updated in order to + * point to the new grown array, and the number pointed to by nb_ptr + * is incremented. + * In case of failure, the array is freed, *tab_ptr is set to NULL and + * *nb_ptr is set to 0. + * + * @param tab_ptr pointer to the array to grow + * @param nb_ptr pointer to the number of elements in the array + * @param elem element to add + * @see av_dynarray_add_nofree(), av_dynarray2_add() + */ +void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem); + +/** + * Add an element to a dynamic array. + * + * Function has the same functionality as av_dynarray_add(), + * but it doesn't free memory on fails. It returns error code + * instead and leave current buffer untouched. + * + * @param tab_ptr pointer to the array to grow + * @param nb_ptr pointer to the number of elements in the array + * @param elem element to add + * @return >=0 on success, negative otherwise. + * @see av_dynarray_add(), av_dynarray2_add() + */ +int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem); + +/** + * Add an element of size elem_size to a dynamic array. + * + * The array is reallocated when its number of elements reaches powers of 2. + * Therefore, the amortized cost of adding an element is constant. + * + * In case of success, the pointer to the array is updated in order to + * point to the new grown array, and the number pointed to by nb_ptr + * is incremented. + * In case of failure, the array is freed, *tab_ptr is set to NULL and + * *nb_ptr is set to 0. + * + * @param tab_ptr pointer to the array to grow + * @param nb_ptr pointer to the number of elements in the array + * @param elem_size size in bytes of the elements in the array + * @param elem_data pointer to the data of the element to add. If NULL, the space of + * the new added element is not filled. + * @return pointer to the data of the element to copy in the new allocated space. + * If NULL, the new allocated space is left uninitialized." + * @see av_dynarray_add(), av_dynarray_add_nofree() + */ +void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size, + const uint8_t *elem_data); + +/** + * Multiply two size_t values checking for overflow. + * @return 0 if success, AVERROR(EINVAL) if overflow. + */ +static inline int av_size_mult(size_t a, size_t b, size_t *r) { + size_t t = a * b; + /* Hack inspired from glibc: only try the division if nelem and elsize + * are both greater than sqrt(SIZE_MAX). */ + if ((a | b) >= ((size_t) 1 << (sizeof(size_t) * 4)) && a && t / a != b) + return AVERROR(EINVAL); + *r = t; + return 0; +} + +/** + * Set the maximum size that may me allocated in one block. + */ +void av_max_alloc(size_t max); + +/** + * deliberately overlapping memcpy implementation + * @param dst destination buffer + * @param back how many bytes back we start (the initial size of the overlapping window), must be > 0 + * @param cnt number of bytes to copy, must be >= 0 + * + * cnt > back is valid, this will copy the bytes we just copied, + * thus creating a repeating pattern with a period length of back. + */ +void av_memcpy_backptr(uint8_t *dst, int back, int cnt); + +/** + * Reallocate the given block if it is not large enough, otherwise do nothing. + * + * @see av_realloc + */ +void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size); + +/** + * Allocate a buffer, reusing the given one if large enough. + * + * Contrary to av_fast_realloc the current buffer contents might not be + * preserved and on error the old buffer is freed, thus no special + * handling to avoid memleaks is necessary. + * + * @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer + * @param size size of the buffer *ptr points to + * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and + * *size 0 if an error occurred. + */ +void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size); + +/** + * @} + */ + +#endif /* AVUTIL_MEM_H */ diff --git a/app/src/main/cpp/include/libavutil/motion_vector.h b/app/src/main/cpp/include/libavutil/motion_vector.h new file mode 100644 index 0000000..3aa517e --- /dev/null +++ b/app/src/main/cpp/include/libavutil/motion_vector.h @@ -0,0 +1,50 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_MOTION_VECTOR_H +#define AVUTIL_MOTION_VECTOR_H + +#include <stdint.h> + +typedef struct AVMotionVector { + /** + * Where the current macroblock comes from; negative value when it comes + * from the past, positive value when it comes from the future. + * XXX: set exact relative ref frame reference instead of a +/- 1 "direction". + */ + int32_t source; + /** + * Width and height of the block. + */ + uint8_t w, h; + /** + * Absolute source position. Can be outside the frame area. + */ + int16_t src_x, src_y; + /** + * Absolute destination position. Can be outside the frame area. + */ + int16_t dst_x, dst_y; + /** + * Extra flag information. + * Currently unused. + */ + uint64_t flags; +} AVMotionVector; + +#endif /* AVUTIL_MOTION_VECTOR_H */ diff --git a/app/src/main/cpp/include/libavutil/murmur3.h b/app/src/main/cpp/include/libavutil/murmur3.h new file mode 100644 index 0000000..1940825 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/murmur3.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2013 Reimar Döffinger <Reimar.Doeffinger@gmx.de> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_MURMUR3_H +#define AVUTIL_MURMUR3_H + +#include <stdint.h> + +struct AVMurMur3 *av_murmur3_alloc(void); + +void av_murmur3_init_seeded(struct AVMurMur3 *c, uint64_t seed); + +void av_murmur3_init(struct AVMurMur3 *c); + +void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, int len); + +void av_murmur3_final(struct AVMurMur3 *c, uint8_t dst[16]); + +#endif /* AVUTIL_MURMUR3_H */ diff --git a/app/src/main/cpp/include/libavutil/old_pix_fmts.h b/app/src/main/cpp/include/libavutil/old_pix_fmts.h new file mode 100644 index 0000000..70c4f7d --- /dev/null +++ b/app/src/main/cpp/include/libavutil/old_pix_fmts.h @@ -0,0 +1,177 @@ +/* + * copyright (c) 2006-2012 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_OLD_PIX_FMTS_H +#define AVUTIL_OLD_PIX_FMTS_H + +/* + * This header exists to prevent new pixel formats from being accidentally added + * to the deprecated list. + * Do not include it directly. It will be removed on next major bump + * + * Do not add new items to this list. Use the AVPixelFormat enum instead. + */ +PIX_FMT_NONE = AV_PIX_FMT_NONE, + PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) + PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr + PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB... + PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR... + PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) + PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) + PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) + PIX_FMT_GRAY8, ///< Y , 8bpp + PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb + PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb + PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette + PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range + PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range + PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range +#if FF_API_XVMC +PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing +PIX_FMT_XVMC_MPEG2_IDCT, +#endif /* FF_API_XVMC */ + PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 + PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 + PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) + PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits + PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) + PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) + PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits + PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) + PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V) + PIX_FMT_NV21, ///< as above, but U and V bytes are swapped + + PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB... + PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA... + PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR... + PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA... + + PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian + PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian + PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) + PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range + PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) +#if FF_API_VDPAU +PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers +PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers +PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers +PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers +PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers +#endif + PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian + PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian + + PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian + PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian + PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0 + PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0 + + PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian + PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian + PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1 + PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1 + + PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers + PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers + PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + + PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian +#if FF_API_VDPAU +PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers +#endif + PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer + + PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0 + PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0 + PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1 + PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1 + PIX_FMT_GRAY8A, ///< 8bit gray, 8bit alpha + PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian + PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian + +//the following 10 formats have the disadvantage of needing 1 format for each bit depth, thus +//If you want to support multiple bit depths, then using PIX_FMT_YUV420P16* with the bpp stored separately +//is better + PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + PIX_FMT_VDA_VLD, ///< hardware decoding through VDA + +#ifdef AV_PIX_FMT_ABI_GIT_MASTER +PIX_FMT_RGBA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian +PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian +PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian +PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian +#endif + PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp + PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big endian + PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little endian + PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big endian + PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little endian + PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big endian + PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little endian + +#ifndef AV_PIX_FMT_ABI_GIT_MASTER + PIX_FMT_RGBA64BE = 0x123, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian + PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian +#endif + PIX_FMT_0RGB = 0x123 + 4, ///< packed RGB 8:8:8, 32bpp, 0RGB0RGB... + PIX_FMT_RGB0, ///< packed RGB 8:8:8, 32bpp, RGB0RGB0... + PIX_FMT_0BGR, ///< packed BGR 8:8:8, 32bpp, 0BGR0BGR... + PIX_FMT_BGR0, ///< packed BGR 8:8:8, 32bpp, BGR0BGR0... + PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples) + PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples) + + PIX_FMT_YUV420P12BE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + PIX_FMT_YUV420P12LE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + PIX_FMT_YUV420P14BE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + PIX_FMT_YUV420P14LE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + PIX_FMT_YUV422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + PIX_FMT_YUV422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + PIX_FMT_YUV422P14BE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + PIX_FMT_YUV422P14LE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + PIX_FMT_YUV444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + PIX_FMT_YUV444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + PIX_FMT_YUV444P14BE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + PIX_FMT_YUV444P14LE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + PIX_FMT_GBRP12BE, ///< planar GBR 4:4:4 36bpp, big endian + PIX_FMT_GBRP12LE, ///< planar GBR 4:4:4 36bpp, little endian + PIX_FMT_GBRP14BE, ///< planar GBR 4:4:4 42bpp, big endian + PIX_FMT_GBRP14LE, ///< planar GBR 4:4:4 42bpp, little endian + + PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions +#endif /* AVUTIL_OLD_PIX_FMTS_H */ diff --git a/app/src/main/cpp/include/libavutil/opt.h b/app/src/main/cpp/include/libavutil/opt.h new file mode 100644 index 0000000..18fc9e5 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/opt.h @@ -0,0 +1,939 @@ +/* + * AVOptions + * copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_OPT_H +#define AVUTIL_OPT_H + +/** + * @file + * AVOptions + */ + +#include "rational.h" +#include "avutil.h" +#include "dict.h" +#include "log.h" +#include "pixfmt.h" +#include "samplefmt.h" +#include "version.h" + +/** + * @defgroup avoptions AVOptions + * @ingroup lavu_data + * @{ + * AVOptions provide a generic system to declare options on arbitrary structs + * ("objects"). An option can have a help text, a type and a range of possible + * values. Options may then be enumerated, read and written to. + * + * @section avoptions_implement Implementing AVOptions + * This section describes how to add AVOptions capabilities to a struct. + * + * All AVOptions-related information is stored in an AVClass. Therefore + * the first member of the struct should be a pointer to an AVClass describing it. + * The option field of the AVClass must be set to a NULL-terminated static array + * of AVOptions. Each AVOption must have a non-empty name, a type, a default + * value and for number-type AVOptions also a range of allowed values. It must + * also declare an offset in bytes from the start of the struct, where the field + * associated with this AVOption is located. Other fields in the AVOption struct + * should also be set when applicable, but are not required. + * + * The following example illustrates an AVOptions-enabled struct: + * @code + * typedef struct test_struct { + * AVClass *class; + * int int_opt; + * char *str_opt; + * uint8_t *bin_opt; + * int bin_len; + * } test_struct; + * + * static const AVOption test_options[] = { + * { "test_int", "This is a test option of int type.", offsetof(test_struct, int_opt), + * AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX }, + * { "test_str", "This is a test option of string type.", offsetof(test_struct, str_opt), + * AV_OPT_TYPE_STRING }, + * { "test_bin", "This is a test option of binary type.", offsetof(test_struct, bin_opt), + * AV_OPT_TYPE_BINARY }, + * { NULL }, + * }; + * + * static const AVClass test_class = { + * .class_name = "test class", + * .item_name = av_default_item_name, + * .option = test_options, + * .version = LIBAVUTIL_VERSION_INT, + * }; + * @endcode + * + * Next, when allocating your struct, you must ensure that the AVClass pointer + * is set to the correct value. Then, av_opt_set_defaults() can be called to + * initialize defaults. After that the struct is ready to be used with the + * AVOptions API. + * + * When cleaning up, you may use the av_opt_free() function to automatically + * free all the allocated string and binary options. + * + * Continuing with the above example: + * + * @code + * test_struct *alloc_test_struct(void) + * { + * test_struct *ret = av_malloc(sizeof(*ret)); + * ret->class = &test_class; + * av_opt_set_defaults(ret); + * return ret; + * } + * void free_test_struct(test_struct **foo) + * { + * av_opt_free(*foo); + * av_freep(foo); + * } + * @endcode + * + * @subsection avoptions_implement_nesting Nesting + * It may happen that an AVOptions-enabled struct contains another + * AVOptions-enabled struct as a member (e.g. AVCodecContext in + * libavcodec exports generic options, while its priv_data field exports + * codec-specific options). In such a case, it is possible to set up the + * parent struct to export a child's options. To do that, simply + * implement AVClass.child_next() and AVClass.child_class_next() in the + * parent struct's AVClass. + * Assuming that the test_struct from above now also contains a + * child_struct field: + * + * @code + * typedef struct child_struct { + * AVClass *class; + * int flags_opt; + * } child_struct; + * static const AVOption child_opts[] = { + * { "test_flags", "This is a test option of flags type.", + * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX }, + * { NULL }, + * }; + * static const AVClass child_class = { + * .class_name = "child class", + * .item_name = av_default_item_name, + * .option = child_opts, + * .version = LIBAVUTIL_VERSION_INT, + * }; + * + * void *child_next(void *obj, void *prev) + * { + * test_struct *t = obj; + * if (!prev && t->child_struct) + * return t->child_struct; + * return NULL + * } + * const AVClass child_class_next(const AVClass *prev) + * { + * return prev ? NULL : &child_class; + * } + * @endcode + * Putting child_next() and child_class_next() as defined above into + * test_class will now make child_struct's options accessible through + * test_struct (again, proper setup as described above needs to be done on + * child_struct right after it is created). + * + * From the above example it might not be clear why both child_next() + * and child_class_next() are needed. The distinction is that child_next() + * iterates over actually existing objects, while child_class_next() + * iterates over all possible child classes. E.g. if an AVCodecContext + * was initialized to use a codec which has private options, then its + * child_next() will return AVCodecContext.priv_data and finish + * iterating. OTOH child_class_next() on AVCodecContext.av_class will + * iterate over all available codecs with private options. + * + * @subsection avoptions_implement_named_constants Named constants + * It is possible to create named constants for options. Simply set the unit + * field of the option the constants should apply to a string and + * create the constants themselves as options of type AV_OPT_TYPE_CONST + * with their unit field set to the same string. + * Their default_val field should contain the value of the named + * constant. + * For example, to add some named constants for the test_flags option + * above, put the following into the child_opts array: + * @code + * { "test_flags", "This is a test option of flags type.", + * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX, "test_unit" }, + * { "flag1", "This is a flag with value 16", 0, AV_OPT_TYPE_CONST, { .i64 = 16 }, 0, 0, "test_unit" }, + * @endcode + * + * @section avoptions_use Using AVOptions + * This section deals with accessing options in an AVOptions-enabled struct. + * Such structs in FFmpeg are e.g. AVCodecContext in libavcodec or + * AVFormatContext in libavformat. + * + * @subsection avoptions_use_examine Examining AVOptions + * The basic functions for examining options are av_opt_next(), which iterates + * over all options defined for one object, and av_opt_find(), which searches + * for an option with the given name. + * + * The situation is more complicated with nesting. An AVOptions-enabled struct + * may have AVOptions-enabled children. Passing the AV_OPT_SEARCH_CHILDREN flag + * to av_opt_find() will make the function search children recursively. + * + * For enumerating there are basically two cases. The first is when you want to + * get all options that may potentially exist on the struct and its children + * (e.g. when constructing documentation). In that case you should call + * av_opt_child_class_next() recursively on the parent struct's AVClass. The + * second case is when you have an already initialized struct with all its + * children and you want to get all options that can be actually written or read + * from it. In that case you should call av_opt_child_next() recursively (and + * av_opt_next() on each result). + * + * @subsection avoptions_use_get_set Reading and writing AVOptions + * When setting options, you often have a string read directly from the + * user. In such a case, simply passing it to av_opt_set() is enough. For + * non-string type options, av_opt_set() will parse the string according to the + * option type. + * + * Similarly av_opt_get() will read any option type and convert it to a string + * which will be returned. Do not forget that the string is allocated, so you + * have to free it with av_free(). + * + * In some cases it may be more convenient to put all options into an + * AVDictionary and call av_opt_set_dict() on it. A specific case of this + * are the format/codec open functions in lavf/lavc which take a dictionary + * filled with option as a parameter. This allows to set some options + * that cannot be set otherwise, since e.g. the input file format is not known + * before the file is actually opened. + */ + +enum AVOptionType { + AV_OPT_TYPE_FLAGS, + AV_OPT_TYPE_INT, + AV_OPT_TYPE_INT64, + AV_OPT_TYPE_DOUBLE, + AV_OPT_TYPE_FLOAT, + AV_OPT_TYPE_STRING, + AV_OPT_TYPE_RATIONAL, + AV_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length + AV_OPT_TYPE_DICT, + AV_OPT_TYPE_CONST = 128, + AV_OPT_TYPE_IMAGE_SIZE = MKBETAG('S', 'I', 'Z', + 'E'), ///< offset must point to two consecutive integers + AV_OPT_TYPE_PIXEL_FMT = MKBETAG('P', 'F', 'M', 'T'), + AV_OPT_TYPE_SAMPLE_FMT = MKBETAG('S', 'F', 'M', 'T'), + AV_OPT_TYPE_VIDEO_RATE = MKBETAG('V', 'R', 'A', 'T'), ///< offset must point to AVRational + AV_OPT_TYPE_DURATION = MKBETAG('D', 'U', 'R', ' '), + AV_OPT_TYPE_COLOR = MKBETAG('C', 'O', 'L', 'R'), + AV_OPT_TYPE_CHANNEL_LAYOUT = MKBETAG('C', 'H', 'L', 'A'), +#if FF_API_OLD_AVOPTIONS + FF_OPT_TYPE_FLAGS = 0, + FF_OPT_TYPE_INT, + FF_OPT_TYPE_INT64, + FF_OPT_TYPE_DOUBLE, + FF_OPT_TYPE_FLOAT, + FF_OPT_TYPE_STRING, + FF_OPT_TYPE_RATIONAL, + FF_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length + FF_OPT_TYPE_CONST = 128, +#endif +}; + +/** + * AVOption + */ +typedef struct AVOption { + const char *name; + + /** + * short English help text + * @todo What about other languages? + */ + const char *help; + + /** + * The offset relative to the context structure where the option + * value is stored. It should be 0 for named constants. + */ + int offset; + enum AVOptionType type; + + /** + * the default value for scalar options + */ + union { + int64_t i64; + double dbl; + const char *str; + /* TODO those are unused now */ + AVRational q; + } default_val; + double min; ///< minimum valid value for the option + double max; ///< maximum valid value for the option + + int flags; +#define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding +#define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding +#if FF_API_OPT_TYPE_METADATA +#define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... +#endif +#define AV_OPT_FLAG_AUDIO_PARAM 8 +#define AV_OPT_FLAG_VIDEO_PARAM 16 +#define AV_OPT_FLAG_SUBTITLE_PARAM 32 +/** + * The option is inteded for exporting values to the caller. + */ +#define AV_OPT_FLAG_EXPORT 64 +/** + * The option may not be set through the AVOptions API, only read. + * This flag only makes sense when AV_OPT_FLAG_EXPORT is also set. + */ +#define AV_OPT_FLAG_READONLY 128 +#define AV_OPT_FLAG_FILTERING_PARAM (1<<16) ///< a generic parameter which can be set by the user for filtering +//FIXME think about enc-audio, ... style flags + + /** + * The logical unit to which the option belongs. Non-constant + * options and corresponding named constants share the same + * unit. May be NULL. + */ + const char *unit; +} AVOption; + +/** + * A single allowed range of values, or a single allowed value. + */ +typedef struct AVOptionRange { + const char *str; + /** + * Value range. + * For string ranges this represents the min/max length. + * For dimensions this represents the min/max pixel count or width/height in multi-component case. + */ + double value_min, value_max; + /** + * Value's component range. + * For string this represents the unicode range for chars, 0-127 limits to ASCII. + */ + double component_min, component_max; + /** + * Range flag. + * If set to 1 the struct encodes a range, if set to 0 a single value. + */ + int is_range; +} AVOptionRange; + +/** + * List of AVOptionRange structs. + */ +typedef struct AVOptionRanges { + /** + * Array of option ranges. + * + * Most of option types use just one component. + * Following describes multi-component option types: + * + * AV_OPT_TYPE_IMAGE_SIZE: + * component index 0: range of pixel count (width * height). + * component index 1: range of width. + * component index 2: range of height. + * + * @note To obtain multi-component version of this structure, user must + * provide AV_OPT_MULTI_COMPONENT_RANGE to av_opt_query_ranges or + * av_opt_query_ranges_default function. + * + * Multi-component range can be read as in following example: + * + * @code + * int range_index, component_index; + * AVOptionRanges *ranges; + * AVOptionRange *range[3]; //may require more than 3 in the future. + * av_opt_query_ranges(&ranges, obj, key, AV_OPT_MULTI_COMPONENT_RANGE); + * for (range_index = 0; range_index < ranges->nb_ranges; range_index++) { + * for (component_index = 0; component_index < ranges->nb_components; component_index++) + * range[component_index] = ranges->range[ranges->nb_ranges * component_index + range_index]; + * //do something with range here. + * } + * av_opt_freep_ranges(&ranges); + * @endcode + */ + AVOptionRange **range; + /** + * Number of ranges per component. + */ + int nb_ranges; + /** + * Number of componentes. + */ + int nb_components; +} AVOptionRanges; + + +#if FF_API_OLD_AVOPTIONS +/** + * Set the field of obj with the given name to value. + * + * @param[in] obj A struct whose first element is a pointer to an + * AVClass. + * @param[in] name the name of the field to set + * @param[in] val The value to set. If the field is not of a string + * type, then the given string is parsed. + * SI postfixes and some named scalars are supported. + * If the field is of a numeric type, it has to be a numeric or named + * scalar. Behavior with more than one scalar and +- infix operators + * is undefined. + * If the field is of a flags type, it has to be a sequence of numeric + * scalars or named flags separated by '+' or '-'. Prefixing a flag + * with '+' causes it to be set without affecting the other flags; + * similarly, '-' unsets a flag. + * @param[out] o_out if non-NULL put here a pointer to the AVOption + * found + * @param alloc this parameter is currently ignored + * @return 0 if the value has been set, or an AVERROR code in case of + * error: + * AVERROR_OPTION_NOT_FOUND if no matching option exists + * AVERROR(ERANGE) if the value is out of range + * AVERROR(EINVAL) if the value is not valid + * @deprecated use av_opt_set() + */ +attribute_deprecated +int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out); + +attribute_deprecated const AVOption *av_set_double(void *obj, const char *name, double n); + +attribute_deprecated const AVOption *av_set_q(void *obj, const char *name, AVRational n); + +attribute_deprecated const AVOption *av_set_int(void *obj, const char *name, int64_t n); + +double av_get_double(void *obj, const char *name, const AVOption **o_out); + +AVRational av_get_q(void *obj, const char *name, const AVOption **o_out); + +int64_t av_get_int(void *obj, const char *name, const AVOption **o_out); + +attribute_deprecated const char * +av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len); + +attribute_deprecated const AVOption * +av_next_option(FF_CONST_AVUTIL55 void *obj, const AVOption *last); + +#endif + +/** + * Show the obj options. + * + * @param req_flags requested flags for the options to show. Show only the + * options for which it is opt->flags & req_flags. + * @param rej_flags rejected flags for the options to show. Show only the + * options for which it is !(opt->flags & req_flags). + * @param av_log_obj log context to use for showing the options + */ +int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags); + +/** + * Set the values of all AVOption fields to their default values. + * + * @param s an AVOption-enabled struct (its first member must be a pointer to AVClass) + */ +void av_opt_set_defaults(void *s); + +#if FF_API_OLD_AVOPTIONS +attribute_deprecated +void av_opt_set_defaults2(void *s, int mask, int flags); + +#endif + +/** + * Parse the key/value pairs list in opts. For each key/value pair + * found, stores the value in the field in ctx that is named like the + * key. ctx must be an AVClass context, storing is done using + * AVOptions. + * + * @param opts options string to parse, may be NULL + * @param key_val_sep a 0-terminated list of characters used to + * separate key from value + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other + * @return the number of successfully set key/value pairs, or a negative + * value corresponding to an AVERROR code in case of error: + * AVERROR(EINVAL) if opts cannot be parsed, + * the error code issued by av_opt_set() if a key/value pair + * cannot be set + */ +int av_set_options_string(void *ctx, const char *opts, + const char *key_val_sep, const char *pairs_sep); + +/** + * Parse the key-value pairs list in opts. For each key=value pair found, + * set the value of the corresponding option in ctx. + * + * @param ctx the AVClass object to set options on + * @param opts the options string, key-value pairs separated by a + * delimiter + * @param shorthand a NULL-terminated array of options names for shorthand + * notation: if the first field in opts has no key part, + * the key is taken from the first element of shorthand; + * then again for the second, etc., until either opts is + * finished, shorthand is finished or a named option is + * found; after that, all options must be named + * @param key_val_sep a 0-terminated list of characters used to separate + * key from value, for example '=' + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other, for example ':' or ',' + * @return the number of successfully set key=value pairs, or a negative + * value corresponding to an AVERROR code in case of error: + * AVERROR(EINVAL) if opts cannot be parsed, + * the error code issued by av_set_string3() if a key/value pair + * cannot be set + * + * Options names must use only the following characters: a-z A-Z 0-9 - . / _ + * Separators must use characters distinct from option names and from each + * other. + */ +int av_opt_set_from_string(void *ctx, const char *opts, + const char *const *shorthand, + const char *key_val_sep, const char *pairs_sep); + +/** + * Free all allocated objects in obj. + */ +void av_opt_free(void *obj); + +/** + * Check whether a particular flag is set in a flags field. + * + * @param field_name the name of the flag field option + * @param flag_name the name of the flag to check + * @return non-zero if the flag is set, zero if the flag isn't set, + * isn't of the right type, or the flags field doesn't exist. + */ +int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name); + +/** + * Set all the options from a given dictionary on an object. + * + * @param obj a struct whose first element is a pointer to AVClass + * @param options options to process. This dictionary will be freed and replaced + * by a new one containing all options not found in obj. + * Of course this new dictionary needs to be freed by caller + * with av_dict_free(). + * + * @return 0 on success, a negative AVERROR if some option was found in obj, + * but could not be set. + * + * @see av_dict_copy() + */ +int av_opt_set_dict(void *obj, struct AVDictionary **options); + + +/** + * Set all the options from a given dictionary on an object. + * + * @param obj a struct whose first element is a pointer to AVClass + * @param options options to process. This dictionary will be freed and replaced + * by a new one containing all options not found in obj. + * Of course this new dictionary needs to be freed by caller + * with av_dict_free(). + * @param search_flags A combination of AV_OPT_SEARCH_*. + * + * @return 0 on success, a negative AVERROR if some option was found in obj, + * but could not be set. + * + * @see av_dict_copy() + */ +int av_opt_set_dict2(void *obj, struct AVDictionary **options, int search_flags); + +/** + * Extract a key-value pair from the beginning of a string. + * + * @param ropts pointer to the options string, will be updated to + * point to the rest of the string (one of the pairs_sep + * or the final NUL) + * @param key_val_sep a 0-terminated list of characters used to separate + * key from value, for example '=' + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other, for example ':' or ',' + * @param flags flags; see the AV_OPT_FLAG_* values below + * @param rkey parsed key; must be freed using av_free() + * @param rval parsed value; must be freed using av_free() + * + * @return >=0 for success, or a negative value corresponding to an + * AVERROR code in case of error; in particular: + * AVERROR(EINVAL) if no key is present + * + */ +int av_opt_get_key_value(const char **ropts, + const char *key_val_sep, const char *pairs_sep, + unsigned flags, + char **rkey, char **rval); + +enum { + + /** + * Accept to parse a value without a key; the key will then be returned + * as NULL. + */ + AV_OPT_FLAG_IMPLICIT_KEY = 1, +}; + +/** + * @defgroup opt_eval_funcs Evaluating option strings + * @{ + * This group of functions can be used to evaluate option strings + * and get numbers out of them. They do the same thing as av_opt_set(), + * except the result is written into the caller-supplied pointer. + * + * @param obj a struct whose first element is a pointer to AVClass. + * @param o an option for which the string is to be evaluated. + * @param val string to be evaluated. + * @param *_out value of the string will be written here. + * + * @return 0 on success, a negative number on failure. + */ +int av_opt_eval_flags(void *obj, const AVOption *o, const char *val, int *flags_out); + +int av_opt_eval_int(void *obj, const AVOption *o, const char *val, int *int_out); + +int av_opt_eval_int64(void *obj, const AVOption *o, const char *val, int64_t *int64_out); + +int av_opt_eval_float(void *obj, const AVOption *o, const char *val, float *float_out); + +int av_opt_eval_double(void *obj, const AVOption *o, const char *val, double *double_out); + +int av_opt_eval_q(void *obj, const AVOption *o, const char *val, AVRational *q_out); +/** + * @} + */ + +#define AV_OPT_SEARCH_CHILDREN 0x0001 /**< Search in possible children of the + given object first. */ +/** + * The obj passed to av_opt_find() is fake -- only a double pointer to AVClass + * instead of a required pointer to a struct containing AVClass. This is + * useful for searching for options without needing to allocate the corresponding + * object. + */ +#define AV_OPT_SEARCH_FAKE_OBJ 0x0002 + +/** + * Allows av_opt_query_ranges and av_opt_query_ranges_default to return more than + * one component for certain option types. + * @see AVOptionRanges for details. + */ +#define AV_OPT_MULTI_COMPONENT_RANGE 0x1000 + +/** + * Look for an option in an object. Consider only options which + * have all the specified flags set. + * + * @param[in] obj A pointer to a struct whose first element is a + * pointer to an AVClass. + * Alternatively a double pointer to an AVClass, if + * AV_OPT_SEARCH_FAKE_OBJ search flag is set. + * @param[in] name The name of the option to look for. + * @param[in] unit When searching for named constants, name of the unit + * it belongs to. + * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG). + * @param search_flags A combination of AV_OPT_SEARCH_*. + * + * @return A pointer to the option found, or NULL if no option + * was found. + * + * @note Options found with AV_OPT_SEARCH_CHILDREN flag may not be settable + * directly with av_opt_set(). Use special calls which take an options + * AVDictionary (e.g. avformat_open_input()) to set options found with this + * flag. + */ +const AVOption *av_opt_find(void *obj, const char *name, const char *unit, + int opt_flags, int search_flags); + +/** + * Look for an option in an object. Consider only options which + * have all the specified flags set. + * + * @param[in] obj A pointer to a struct whose first element is a + * pointer to an AVClass. + * Alternatively a double pointer to an AVClass, if + * AV_OPT_SEARCH_FAKE_OBJ search flag is set. + * @param[in] name The name of the option to look for. + * @param[in] unit When searching for named constants, name of the unit + * it belongs to. + * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG). + * @param search_flags A combination of AV_OPT_SEARCH_*. + * @param[out] target_obj if non-NULL, an object to which the option belongs will be + * written here. It may be different from obj if AV_OPT_SEARCH_CHILDREN is present + * in search_flags. This parameter is ignored if search_flags contain + * AV_OPT_SEARCH_FAKE_OBJ. + * + * @return A pointer to the option found, or NULL if no option + * was found. + */ +const AVOption *av_opt_find2(void *obj, const char *name, const char *unit, + int opt_flags, int search_flags, void **target_obj); + +/** + * Iterate over all AVOptions belonging to obj. + * + * @param obj an AVOptions-enabled struct or a double pointer to an + * AVClass describing it. + * @param prev result of the previous call to av_opt_next() on this object + * or NULL + * @return next AVOption or NULL + */ +const AVOption *av_opt_next(FF_CONST_AVUTIL55 void *obj, const AVOption *prev); + +/** + * Iterate over AVOptions-enabled children of obj. + * + * @param prev result of a previous call to this function or NULL + * @return next AVOptions-enabled child or NULL + */ +void *av_opt_child_next(void *obj, void *prev); + +/** + * Iterate over potential AVOptions-enabled children of parent. + * + * @param prev result of a previous call to this function or NULL + * @return AVClass corresponding to next potential child or NULL + */ +const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev); + +/** + * @defgroup opt_set_funcs Option setting functions + * @{ + * Those functions set the field of obj with the given name to value. + * + * @param[in] obj A struct whose first element is a pointer to an AVClass. + * @param[in] name the name of the field to set + * @param[in] val The value to set. In case of av_opt_set() if the field is not + * of a string type, then the given string is parsed. + * SI postfixes and some named scalars are supported. + * If the field is of a numeric type, it has to be a numeric or named + * scalar. Behavior with more than one scalar and +- infix operators + * is undefined. + * If the field is of a flags type, it has to be a sequence of numeric + * scalars or named flags separated by '+' or '-'. Prefixing a flag + * with '+' causes it to be set without affecting the other flags; + * similarly, '-' unsets a flag. + * @param search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN + * is passed here, then the option may be set on a child of obj. + * + * @return 0 if the value has been set, or an AVERROR code in case of + * error: + * AVERROR_OPTION_NOT_FOUND if no matching option exists + * AVERROR(ERANGE) if the value is out of range + * AVERROR(EINVAL) if the value is not valid + */ +int av_opt_set(void *obj, const char *name, const char *val, int search_flags); + +int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags); + +int av_opt_set_double(void *obj, const char *name, double val, int search_flags); + +int av_opt_set_q(void *obj, const char *name, AVRational val, int search_flags); + +int av_opt_set_bin(void *obj, const char *name, const uint8_t *val, int size, int search_flags); + +int av_opt_set_image_size(void *obj, const char *name, int w, int h, int search_flags); + +int av_opt_set_pixel_fmt(void *obj, const char *name, enum AVPixelFormat fmt, int search_flags); + +int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags); + +int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int search_flags); + +int av_opt_set_channel_layout(void *obj, const char *name, int64_t ch_layout, int search_flags); + +/** + * @note Any old dictionary present is discarded and replaced with a copy of the new one. The + * caller still owns val is and responsible for freeing it. + */ +int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, int search_flags); + +/** + * Set a binary option to an integer list. + * + * @param obj AVClass object to set options on + * @param name name of the binary option + * @param val pointer to an integer list (must have the correct type with + * regard to the contents of the list) + * @param term list terminator (usually 0 or -1) + * @param flags search flags + */ +#define av_opt_set_int_list(obj, name, val, term, flags) \ + (av_int_list_length(val, term) > INT_MAX / sizeof(*(val)) ? \ + AVERROR(EINVAL) : \ + av_opt_set_bin(obj, name, (const uint8_t *)(val), \ + av_int_list_length(val, term) * sizeof(*(val)), flags)) + +/** + * @} + */ + +/** + * @defgroup opt_get_funcs Option getting functions + * @{ + * Those functions get a value of the option with the given name from an object. + * + * @param[in] obj a struct whose first element is a pointer to an AVClass. + * @param[in] name name of the option to get. + * @param[in] search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN + * is passed here, then the option may be found in a child of obj. + * @param[out] out_val value of the option will be written here + * @return >=0 on success, a negative error code otherwise + */ +/** + * @note the returned string will be av_malloc()ed and must be av_free()ed by the caller + */ +int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val); + +int av_opt_get_int(void *obj, const char *name, int search_flags, int64_t *out_val); + +int av_opt_get_double(void *obj, const char *name, int search_flags, double *out_val); + +int av_opt_get_q(void *obj, const char *name, int search_flags, AVRational *out_val); + +int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_out, int *h_out); + +int +av_opt_get_pixel_fmt(void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt); + +int +av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt); + +int av_opt_get_video_rate(void *obj, const char *name, int search_flags, AVRational *out_val); + +int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *ch_layout); + +/** + * @param[out] out_val The returned dictionary is a copy of the actual value and must + * be freed with av_dict_free() by the caller + */ +int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDictionary **out_val); +/** + * @} + */ +/** + * Gets a pointer to the requested field in a struct. + * This function allows accessing a struct even when its fields are moved or + * renamed since the application making the access has been compiled, + * + * @returns a pointer to the field, it can be cast to the correct type and read + * or written to. + */ +void *av_opt_ptr(const AVClass *avclass, void *obj, const char *name); + +/** + * Free an AVOptionRanges struct and set it to NULL. + */ +void av_opt_freep_ranges(AVOptionRanges **ranges); + +/** + * Get a list of allowed ranges for the given option. + * + * The returned list may depend on other fields in obj like for example profile. + * + * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored + * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance + * AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges + * + * The result must be freed with av_opt_freep_ranges. + * + * @return number of compontents returned on success, a negative errro code otherwise + */ +int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags); + +/** + * Copy options from src object into dest object. + * + * Options that require memory allocation (e.g. string or binary) are malloc'ed in dest object. + * Original memory allocated for such options is freed unless both src and dest options points to the same memory. + * + * @param dest Object to copy from + * @param src Object to copy into + * @return 0 on success, negative on error + */ +int av_opt_copy(void *dest, FF_CONST_AVUTIL55 void *src); + +/** + * Get a default list of allowed ranges for the given option. + * + * This list is constructed without using the AVClass.query_ranges() callback + * and can be used as fallback from within the callback. + * + * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored + * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance + * AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges + * + * The result must be freed with av_opt_free_ranges. + * + * @return number of compontents returned on success, a negative errro code otherwise + */ +int av_opt_query_ranges_default(AVOptionRanges **, void *obj, const char *key, int flags); + +/** + * Check if given option is set to its default value. + * + * Options o must belong to the obj. This function must not be called to check child's options state. + * @see av_opt_is_set_to_default_by_name(). + * + * @param obj AVClass object to check option on + * @param o option to be checked + * @return >0 when option is set to its default, + * 0 when option is not set its default, + * <0 on error + */ +int av_opt_is_set_to_default(void *obj, const AVOption *o); + +/** + * Check if given option is set to its default value. + * + * @param obj AVClass object to check option on + * @param name option name + * @param search_flags combination of AV_OPT_SEARCH_* + * @return >0 when option is set to its default, + * 0 when option is not set its default, + * <0 on error + */ +int av_opt_is_set_to_default_by_name(void *obj, const char *name, int search_flags); + + +#define AV_OPT_SERIALIZE_SKIP_DEFAULTS 0x00000001 ///< Serialize options that are not set to default values only. +#define AV_OPT_SERIALIZE_OPT_FLAGS_EXACT 0x00000002 ///< Serialize options that exactly match opt_flags only. + +/** + * Serialize object's options. + * + * Create a string containing object's serialized options. + * Such string may be passed back to av_opt_set_from_string() in order to restore option values. + * A key/value or pairs separator occurring in the serialized value or + * name string are escaped through the av_escape() function. + * + * @param[in] obj AVClass object to serialize + * @param[in] opt_flags serialize options with all the specified flags set (AV_OPT_FLAG) + * @param[in] flags combination of AV_OPT_SERIALIZE_* flags + * @param[out] buffer Pointer to buffer that will be allocated with string containg serialized options. + * Buffer must be freed by the caller when is no longer needed. + * @param[in] key_val_sep character used to separate key from value + * @param[in] pairs_sep character used to separate two pairs from each other + * @return >= 0 on success, negative on error + * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same. + */ +int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer, + const char key_val_sep, const char pairs_sep); +/** + * @} + */ + +#endif /* AVUTIL_OPT_H */ diff --git a/app/src/main/cpp/include/libavutil/parseutils.h b/app/src/main/cpp/include/libavutil/parseutils.h new file mode 100644 index 0000000..c80f0de --- /dev/null +++ b/app/src/main/cpp/include/libavutil/parseutils.h @@ -0,0 +1,187 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_PARSEUTILS_H +#define AVUTIL_PARSEUTILS_H + +#include <time.h> + +#include "rational.h" + +/** + * @file + * misc parsing utilities + */ + +/** + * Parse str and store the parsed ratio in q. + * + * Note that a ratio with infinite (1/0) or negative value is + * considered valid, so you should check on the returned value if you + * want to exclude those values. + * + * The undefined value can be expressed using the "0:0" string. + * + * @param[in,out] q pointer to the AVRational which will contain the ratio + * @param[in] str the string to parse: it has to be a string in the format + * num:den, a float number or an expression + * @param[in] max the maximum allowed numerator and denominator + * @param[in] log_offset log level offset which is applied to the log + * level of log_ctx + * @param[in] log_ctx parent logging context + * @return >= 0 on success, a negative error code otherwise + */ +int av_parse_ratio(AVRational *q, const char *str, int max, + int log_offset, void *log_ctx); + +#define av_parse_ratio_quiet(rate, str, max) \ + av_parse_ratio(rate, str, max, AV_LOG_MAX_OFFSET, NULL) + +/** + * Parse str and put in width_ptr and height_ptr the detected values. + * + * @param[in,out] width_ptr pointer to the variable which will contain the detected + * width value + * @param[in,out] height_ptr pointer to the variable which will contain the detected + * height value + * @param[in] str the string to parse: it has to be a string in the format + * width x height or a valid video size abbreviation. + * @return >= 0 on success, a negative error code otherwise + */ +int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str); + +/** + * Parse str and store the detected values in *rate. + * + * @param[in,out] rate pointer to the AVRational which will contain the detected + * frame rate + * @param[in] str the string to parse: it has to be a string in the format + * rate_num / rate_den, a float number or a valid video rate abbreviation + * @return >= 0 on success, a negative error code otherwise + */ +int av_parse_video_rate(AVRational *rate, const char *str); + +/** + * Put the RGBA values that correspond to color_string in rgba_color. + * + * @param color_string a string specifying a color. It can be the name of + * a color (case insensitive match) or a [0x|#]RRGGBB[AA] sequence, + * possibly followed by "@" and a string representing the alpha + * component. + * The alpha component may be a string composed by "0x" followed by an + * hexadecimal number or a decimal number between 0.0 and 1.0, which + * represents the opacity value (0x00/0.0 means completely transparent, + * 0xff/1.0 completely opaque). + * If the alpha component is not specified then 0xff is assumed. + * The string "random" will result in a random color. + * @param slen length of the initial part of color_string containing the + * color. It can be set to -1 if color_string is a null terminated string + * containing nothing else than the color. + * @return >= 0 in case of success, a negative value in case of + * failure (for example if color_string cannot be parsed). + */ +int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, + void *log_ctx); + +/** + * Get the name of a color from the internal table of hard-coded named + * colors. + * + * This function is meant to enumerate the color names recognized by + * av_parse_color(). + * + * @param color_idx index of the requested color, starting from 0 + * @param rgbp if not NULL, will point to a 3-elements array with the color value in RGB + * @return the color name string or NULL if color_idx is not in the array + */ +const char *av_get_known_color_name(int color_idx, const uint8_t **rgb); + +/** + * Parse timestr and return in *time a corresponding number of + * microseconds. + * + * @param timeval puts here the number of microseconds corresponding + * to the string in timestr. If the string represents a duration, it + * is the number of microseconds contained in the time interval. If + * the string is a date, is the number of microseconds since 1st of + * January, 1970 up to the time of the parsed date. If timestr cannot + * be successfully parsed, set *time to INT64_MIN. + + * @param timestr a string representing a date or a duration. + * - If a date the syntax is: + * @code + * [{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH:MM:SS[.m...]]]}|{HHMMSS[.m...]]]}}[Z] + * now + * @endcode + * If the value is "now" it takes the current time. + * Time is local time unless Z is appended, in which case it is + * interpreted as UTC. + * If the year-month-day part is not specified it takes the current + * year-month-day. + * - If a duration the syntax is: + * @code + * [-][HH:]MM:SS[.m...] + * [-]S+[.m...] + * @endcode + * @param duration flag which tells how to interpret timestr, if not + * zero timestr is interpreted as a duration, otherwise as a date + * @return >= 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_parse_time(int64_t *timeval, const char *timestr, int duration); + +/** + * Parse the input string p according to the format string fmt and + * store its results in the structure dt. + * This implementation supports only a subset of the formats supported + * by the standard strptime(). + * + * In particular it actually supports the parameters: + * - %H: the hour as a decimal number, using a 24-hour clock, in the + * range '00' through '23' + * - %J: hours as a decimal number, in the range '0' through INT_MAX + * - %M: the minute as a decimal number, using a 24-hour clock, in the + * range '00' through '59' + * - %S: the second as a decimal number, using a 24-hour clock, in the + * range '00' through '59' + * - %Y: the year as a decimal number, using the Gregorian calendar + * - %m: the month as a decimal number, in the range '1' through '12' + * - %d: the day of the month as a decimal number, in the range '1' + * through '31' + * - %%: a literal '%' + * + * @return a pointer to the first character not processed in this + * function call, or NULL in case the function fails to match all of + * the fmt string and therefore an error occurred + */ +char *av_small_strptime(const char *p, const char *fmt, struct tm *dt); + +/** + * Attempt to find a specific tag in a URL. + * + * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. + * Return 1 if found. + */ +int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); + +/** + * Convert the decomposed UTC time in tm to a time_t value. + */ +time_t av_timegm(struct tm *tm); + +#endif /* AVUTIL_PARSEUTILS_H */ diff --git a/app/src/main/cpp/include/libavutil/pixdesc.h b/app/src/main/cpp/include/libavutil/pixdesc.h new file mode 100644 index 0000000..56f0cd5 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/pixdesc.h @@ -0,0 +1,386 @@ +/* + * pixel format descriptor + * Copyright (c) 2009 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_PIXDESC_H +#define AVUTIL_PIXDESC_H + +#include <inttypes.h> + +#include "attributes.h" +#include "pixfmt.h" + +typedef struct AVComponentDescriptor { + /** + * Which of the 4 planes contains the component. + */ + uint16_t plane : 2; + + /** + * Number of elements between 2 horizontally consecutive pixels minus 1. + * Elements are bits for bitstream formats, bytes otherwise. + */ + uint16_t step_minus1 : 3; + + /** + * Number of elements before the component of the first pixel plus 1. + * Elements are bits for bitstream formats, bytes otherwise. + */ + uint16_t offset_plus1 : 3; + + /** + * Number of least significant bits that must be shifted away + * to get the value. + */ + uint16_t shift : 3; + + /** + * Number of bits in the component minus 1. + */ + uint16_t depth_minus1 : 4; +} AVComponentDescriptor; + +/** + * Descriptor that unambiguously describes how the bits of a pixel are + * stored in the up to 4 data planes of an image. It also stores the + * subsampling factors and number of components. + * + * @note This is separate of the colorspace (RGB, YCbCr, YPbPr, JPEG-style YUV + * and all the YUV variants) AVPixFmtDescriptor just stores how values + * are stored not what these values represent. + */ +typedef struct AVPixFmtDescriptor { + const char *name; + uint8_t nb_components; ///< The number of components each pixel has, (1-4) + + /** + * Amount to shift the luma width right to find the chroma width. + * For YV12 this is 1 for example. + * chroma_width = -((-luma_width) >> log2_chroma_w) + * The note above is needed to ensure rounding up. + * This value only refers to the chroma components. + */ + uint8_t log2_chroma_w; ///< chroma_width = -((-luma_width )>>log2_chroma_w) + + /** + * Amount to shift the luma height right to find the chroma height. + * For YV12 this is 1 for example. + * chroma_height= -((-luma_height) >> log2_chroma_h) + * The note above is needed to ensure rounding up. + * This value only refers to the chroma components. + */ + uint8_t log2_chroma_h; + uint8_t flags; + + /** + * Parameters that describe how pixels are packed. + * If the format has 2 or 4 components, then alpha is last. + * If the format has 1 or 2 components, then luma is 0. + * If the format has 3 or 4 components, + * if the RGB flag is set then 0 is red, 1 is green and 2 is blue; + * otherwise 0 is luma, 1 is chroma-U and 2 is chroma-V. + */ + AVComponentDescriptor comp[4]; + + /** + * Alternative comma-separated names. + */ + const char *alias; +} AVPixFmtDescriptor; + +/** + * Pixel format is big-endian. + */ +#define AV_PIX_FMT_FLAG_BE (1 << 0) +/** + * Pixel format has a palette in data[1], values are indexes in this palette. + */ +#define AV_PIX_FMT_FLAG_PAL (1 << 1) +/** + * All values of a component are bit-wise packed end to end. + */ +#define AV_PIX_FMT_FLAG_BITSTREAM (1 << 2) +/** + * Pixel format is an HW accelerated format. + */ +#define AV_PIX_FMT_FLAG_HWACCEL (1 << 3) +/** + * At least one pixel component is not in the first data plane. + */ +#define AV_PIX_FMT_FLAG_PLANAR (1 << 4) +/** + * The pixel format contains RGB-like data (as opposed to YUV/grayscale). + */ +#define AV_PIX_FMT_FLAG_RGB (1 << 5) +/** + * The pixel format is "pseudo-paletted". This means that FFmpeg treats it as + * paletted internally, but the palette is generated by the decoder and is not + * stored in the file. + */ +#define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6) +/** + * The pixel format has an alpha channel. + */ +#define AV_PIX_FMT_FLAG_ALPHA (1 << 7) + +#if FF_API_PIX_FMT +/** + * @deprecated use the AV_PIX_FMT_FLAG_* flags + */ +#define PIX_FMT_BE AV_PIX_FMT_FLAG_BE +#define PIX_FMT_PAL AV_PIX_FMT_FLAG_PAL +#define PIX_FMT_BITSTREAM AV_PIX_FMT_FLAG_BITSTREAM +#define PIX_FMT_HWACCEL AV_PIX_FMT_FLAG_HWACCEL +#define PIX_FMT_PLANAR AV_PIX_FMT_FLAG_PLANAR +#define PIX_FMT_RGB AV_PIX_FMT_FLAG_RGB +#define PIX_FMT_PSEUDOPAL AV_PIX_FMT_FLAG_PSEUDOPAL +#define PIX_FMT_ALPHA AV_PIX_FMT_FLAG_ALPHA +#endif + +#if FF_API_PIX_FMT_DESC +/** + * The array of all the pixel format descriptors. + */ +extern attribute_deprecated const AVPixFmtDescriptor av_pix_fmt_descriptors[]; +#endif + +/** + * Read a line from an image, and write the values of the + * pixel format component c to dst. + * + * @param data the array containing the pointers to the planes of the image + * @param linesize the array containing the linesizes of the image + * @param desc the pixel format descriptor for the image + * @param x the horizontal coordinate of the first pixel to read + * @param y the vertical coordinate of the first pixel to read + * @param w the width of the line to read, that is the number of + * values to write to dst + * @param read_pal_component if not zero and the format is a paletted + * format writes the values corresponding to the palette + * component c in data[1] to dst, rather than the palette indexes in + * data[0]. The behavior is undefined if the format is not paletted. + */ +void av_read_image_line(uint16_t *dst, const uint8_t *data[4], + const int linesize[4], const AVPixFmtDescriptor *desc, + int x, int y, int c, int w, int read_pal_component); + +/** + * Write the values from src to the pixel format component c of an + * image line. + * + * @param src array containing the values to write + * @param data the array containing the pointers to the planes of the + * image to write into. It is supposed to be zeroed. + * @param linesize the array containing the linesizes of the image + * @param desc the pixel format descriptor for the image + * @param x the horizontal coordinate of the first pixel to write + * @param y the vertical coordinate of the first pixel to write + * @param w the width of the line to write, that is the number of + * values to write to the image line + */ +void av_write_image_line(const uint16_t *src, uint8_t *data[4], + const int linesize[4], const AVPixFmtDescriptor *desc, + int x, int y, int c, int w); + +/** + * Return the pixel format corresponding to name. + * + * If there is no pixel format with name name, then looks for a + * pixel format with the name corresponding to the native endian + * format of name. + * For example in a little-endian system, first looks for "gray16", + * then for "gray16le". + * + * Finally if no pixel format has been found, returns AV_PIX_FMT_NONE. + */ +enum AVPixelFormat av_get_pix_fmt(const char *name); + +/** + * Return the short name for a pixel format, NULL in case pix_fmt is + * unknown. + * + * @see av_get_pix_fmt(), av_get_pix_fmt_string() + */ +const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt); + +/** + * Print in buf the string corresponding to the pixel format with + * number pix_fmt, or a header if pix_fmt is negative. + * + * @param buf the buffer where to write the string + * @param buf_size the size of buf + * @param pix_fmt the number of the pixel format to print the + * corresponding info string, or a negative value to print the + * corresponding header. + */ +char *av_get_pix_fmt_string(char *buf, int buf_size, + enum AVPixelFormat pix_fmt); + +/** + * Return the number of bits per pixel used by the pixel format + * described by pixdesc. Note that this is not the same as the number + * of bits per sample. + * + * The returned number of bits refers to the number of bits actually + * used for storing the pixel information, that is padding bits are + * not counted. + */ +int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc); + +/** + * Return the number of bits per pixel for the pixel format + * described by pixdesc, including any padding or unused bits. + */ +int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc); + +/** + * @return a pixel format descriptor for provided pixel format or NULL if + * this pixel format is unknown. + */ +const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt); + +/** + * Iterate over all pixel format descriptors known to libavutil. + * + * @param prev previous descriptor. NULL to get the first descriptor. + * + * @return next descriptor or NULL after the last descriptor + */ +const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev); + +/** + * @return an AVPixelFormat id described by desc, or AV_PIX_FMT_NONE if desc + * is not a valid pointer to a pixel format descriptor. + */ +enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc); + +/** + * Utility function to access log2_chroma_w log2_chroma_h from + * the pixel format AVPixFmtDescriptor. + * + * See av_get_chroma_sub_sample() for a function that asserts a + * valid pixel format instead of returning an error code. + * Its recommended that you use avcodec_get_chroma_sub_sample unless + * you do check the return code! + * + * @param[in] pix_fmt the pixel format + * @param[out] h_shift store log2_chroma_w + * @param[out] v_shift store log2_chroma_h + * + * @return 0 on success, AVERROR(ENOSYS) on invalid or unknown pixel format + */ +int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, + int *h_shift, int *v_shift); + +/** + * @return number of planes in pix_fmt, a negative AVERROR if pix_fmt is not a + * valid pixel format. + */ +int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt); + +void ff_check_pixfmt_descriptors(void); + +/** + * Utility function to swap the endianness of a pixel format. + * + * @param[in] pix_fmt the pixel format + * + * @return pixel format with swapped endianness if it exists, + * otherwise AV_PIX_FMT_NONE + */ +enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt); + +#define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */ +#define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */ +#define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */ +#define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */ +#define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */ +#define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */ + +/** + * Compute what kind of losses will occur when converting from one specific + * pixel format to another. + * When converting from one pixel format to another, information loss may occur. + * For example, when converting from RGB24 to GRAY, the color information will + * be lost. Similarly, other losses occur when converting from some formats to + * other formats. These losses can involve loss of chroma, but also loss of + * resolution, loss of color depth, loss due to the color space conversion, loss + * of the alpha bits or loss due to color quantization. + * av_get_fix_fmt_loss() informs you about the various types of losses + * which will occur when converting from one pixel format to another. + * + * @param[in] dst_pix_fmt destination pixel format + * @param[in] src_pix_fmt source pixel format + * @param[in] has_alpha Whether the source pixel format alpha channel is used. + * @return Combination of flags informing you what kind of losses will occur + * (maximum loss for an invalid dst_pix_fmt). + */ +int av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, + enum AVPixelFormat src_pix_fmt, + int has_alpha); + +/** + * Compute what kind of losses will occur when converting from one specific + * pixel format to another. + * When converting from one pixel format to another, information loss may occur. + * For example, when converting from RGB24 to GRAY, the color information will + * be lost. Similarly, other losses occur when converting from some formats to + * other formats. These losses can involve loss of chroma, but also loss of + * resolution, loss of color depth, loss due to the color space conversion, loss + * of the alpha bits or loss due to color quantization. + * av_get_fix_fmt_loss() informs you about the various types of losses + * which will occur when converting from one pixel format to another. + * + * @param[in] dst_pix_fmt destination pixel format + * @param[in] src_pix_fmt source pixel format + * @param[in] has_alpha Whether the source pixel format alpha channel is used. + * @return Combination of flags informing you what kind of losses will occur + * (maximum loss for an invalid dst_pix_fmt). + */ +enum AVPixelFormat +av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, + enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); + +/** + * @return the name for provided color range or NULL if unknown. + */ +const char *av_color_range_name(enum AVColorRange range); + +/** + * @return the name for provided color primaries or NULL if unknown. + */ +const char *av_color_primaries_name(enum AVColorPrimaries primaries); + +/** + * @return the name for provided color transfer or NULL if unknown. + */ +const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer); + +/** + * @return the name for provided color space or NULL if unknown. + */ +const char *av_color_space_name(enum AVColorSpace space); + +/** + * @return the name for provided chroma location or NULL if unknown. + */ +const char *av_chroma_location_name(enum AVChromaLocation location); + +#endif /* AVUTIL_PIXDESC_H */ diff --git a/app/src/main/cpp/include/libavutil/pixelutils.h b/app/src/main/cpp/include/libavutil/pixelutils.h new file mode 100644 index 0000000..eddf437 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/pixelutils.h @@ -0,0 +1,52 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_PIXELUTILS_H +#define AVUTIL_PIXELUTILS_H + +#include <stddef.h> +#include <stdint.h> +#include "common.h" + +/** + * Sum of abs(src1[x] - src2[x]) + */ +typedef int (*av_pixelutils_sad_fn)(const uint8_t *src1, ptrdiff_t stride1, + const uint8_t *src2, ptrdiff_t stride2); + +/** + * Get a potentially optimized pointer to a Sum-of-absolute-differences + * function (see the av_pixelutils_sad_fn prototype). + * + * @param w_bits 1<<w_bits is the requested width of the block size + * @param h_bits 1<<h_bits is the requested height of the block size + * @param aligned If set to 2, the returned sad function will assume src1 and + * src2 addresses are aligned on the block size. + * If set to 1, the returned sad function will assume src1 is + * aligned on the block size. + * If set to 0, the returned sad function assume no particular + * alignment. + * @param log_ctx context used for logging, can be NULL + * + * @return a pointer to the SAD function or NULL in case of error (because of + * invalid parameters) + */ +av_pixelutils_sad_fn av_pixelutils_get_sad_fn(int w_bits, int h_bits, + int aligned, void *log_ctx); + +#endif /* AVUTIL_PIXELUTILS_H */ diff --git a/app/src/main/cpp/include/libavutil/pixfmt.h b/app/src/main/cpp/include/libavutil/pixfmt.h new file mode 100644 index 0000000..9cc6635 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/pixfmt.h @@ -0,0 +1,523 @@ +/* + * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_PIXFMT_H +#define AVUTIL_PIXFMT_H + +/** + * @file + * pixel format definitions + * + */ + +#include "libavutil/avconfig.h" +#include "version.h" + +#define AVPALETTE_SIZE 1024 +#define AVPALETTE_COUNT 256 + +/** + * Pixel format. + * + * @note + * AV_PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA + * color is put together as: + * (A << 24) | (R << 16) | (G << 8) | B + * This is stored as BGRA on little-endian CPU architectures and ARGB on + * big-endian CPUs. + * + * @par + * When the pixel format is palettized RGB (AV_PIX_FMT_PAL8), the palettized + * image data is stored in AVFrame.data[0]. The palette is transported in + * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is + * formatted the same as in AV_PIX_FMT_RGB32 described above (i.e., it is + * also endian-specific). Note also that the individual RGB palette + * components stored in AVFrame.data[1] should be in the range 0..255. + * This is important as many custom PAL8 video codecs that were designed + * to run on the IBM VGA graphics adapter use 6-bit palette components. + * + * @par + * For all the 8bit per pixel formats, an RGB32 palette is in data[1] like + * for pal8. This palette is filled in automatically by the function + * allocating the picture. + * + * @note + * Make sure that all newly added big-endian formats have (pix_fmt & 1) == 1 + * and that all newly added little-endian formats have (pix_fmt & 1) == 0. + * This allows simpler detection of big vs little-endian. + */ +enum AVPixelFormat { + AV_PIX_FMT_NONE = -1, + AV_PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) + AV_PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr + AV_PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB... + AV_PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR... + AV_PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + AV_PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) + AV_PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) + AV_PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) + AV_PIX_FMT_GRAY8, ///< Y , 8bpp + AV_PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb + AV_PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb + AV_PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette + AV_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range + AV_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range + AV_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range +#if FF_API_XVMC + AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing + AV_PIX_FMT_XVMC_MPEG2_IDCT, +#define AV_PIX_FMT_XVMC AV_PIX_FMT_XVMC_MPEG2_IDCT +#endif /* FF_API_XVMC */ + AV_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 + AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 + AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) + AV_PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits + AV_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) + AV_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) + AV_PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits + AV_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) + AV_PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V) + AV_PIX_FMT_NV21, ///< as above, but U and V bytes are swapped + + AV_PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB... + AV_PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA... + AV_PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR... + AV_PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA... + + AV_PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian + AV_PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian + AV_PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) + AV_PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range + AV_PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) +#if FF_API_VDPAU + AV_PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + AV_PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + AV_PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + AV_PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + AV_PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers +#endif + AV_PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian + AV_PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian + + AV_PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian + AV_PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian + AV_PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0 + AV_PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0 + + AV_PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian + AV_PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian + AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1 + AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1 + + AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers + AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers + AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + + AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian +#if FF_API_VDPAU + AV_PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers +#endif + AV_PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer + + AV_PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0 + AV_PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0 + AV_PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1 + AV_PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1 + AV_PIX_FMT_YA8, ///< 8bit gray, 8bit alpha + + AV_PIX_FMT_Y400A = AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8 + AV_PIX_FMT_GRAY8A = AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8 + + AV_PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian + AV_PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian + + /** + * The following 12 formats have the disadvantage of needing 1 format for each bit depth. + * Notice that each 9/10 bits sample is stored in 16 bits with extra padding. + * If you want to support multiple bit depths, then using AV_PIX_FMT_YUV420P16* with the bpp stored separately is better. + */ + AV_PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_VDA_VLD, ///< hardware decoding through VDA + +#ifdef AV_PIX_FMT_ABI_GIT_MASTER + AV_PIX_FMT_RGBA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian + AV_PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian +#endif + AV_PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp + AV_PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big-endian + AV_PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little-endian + AV_PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big-endian + AV_PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little-endian + AV_PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big-endian + AV_PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little-endian + + /** + * duplicated pixel formats for compatibility with libav. + * FFmpeg supports these formats since May 8 2012 and Jan 28 2012 (commits f9ca1ac7 and 143a5c55) + * Libav added them Oct 12 2012 with incompatible values (commit 6d5600e85) + */ + AV_PIX_FMT_YUVA422P_LIBAV, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples) + AV_PIX_FMT_YUVA444P_LIBAV, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples) + + AV_PIX_FMT_YUVA420P9BE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian + AV_PIX_FMT_YUVA420P9LE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian + AV_PIX_FMT_YUVA422P9BE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian + AV_PIX_FMT_YUVA422P9LE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian + AV_PIX_FMT_YUVA444P9BE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian + AV_PIX_FMT_YUVA444P9LE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian + AV_PIX_FMT_YUVA420P10BE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian) + AV_PIX_FMT_YUVA420P10LE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian) + AV_PIX_FMT_YUVA422P10BE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA422P10LE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA444P10BE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA444P10LE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA420P16BE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian) + AV_PIX_FMT_YUVA420P16LE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian) + AV_PIX_FMT_YUVA422P16BE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA422P16LE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA444P16BE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA444P16LE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian) + + AV_PIX_FMT_VDPAU, ///< HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface + + AV_PIX_FMT_XYZ12LE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as little-endian, the 4 lower bits are set to 0 + AV_PIX_FMT_XYZ12BE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as big-endian, the 4 lower bits are set to 0 + AV_PIX_FMT_NV16, ///< interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + AV_PIX_FMT_NV20LE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_NV20BE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + + /** + * duplicated pixel formats for compatibility with libav. + * FFmpeg supports these formats since Sat Sep 24 06:01:45 2011 +0200 (commits 9569a3c9f41387a8c7d1ce97d8693520477a66c3) + * also see Fri Nov 25 01:38:21 2011 +0100 92afb431621c79155fcb7171d26f137eb1bee028 + * Libav added them Sun Mar 16 23:05:47 2014 +0100 with incompatible values (commit 1481d24c3a0abf81e1d7a514547bd5305232be30) + */ + AV_PIX_FMT_RGBA64BE_LIBAV, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_RGBA64LE_LIBAV, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian + AV_PIX_FMT_BGRA64BE_LIBAV, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_BGRA64LE_LIBAV, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian + + AV_PIX_FMT_YVYU422, ///< packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb + + AV_PIX_FMT_VDA, ///< HW acceleration through VDA, data[3] contains a CVPixelBufferRef + + AV_PIX_FMT_YA16BE, ///< 16bit gray, 16bit alpha (big-endian) + AV_PIX_FMT_YA16LE, ///< 16bit gray, 16bit alpha (little-endian) + + +#ifndef AV_PIX_FMT_ABI_GIT_MASTER + AV_PIX_FMT_RGBA64BE = 0x123, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian + AV_PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian +#endif + AV_PIX_FMT_0RGB = 0x123 + 4, ///< packed RGB 8:8:8, 32bpp, 0RGB0RGB... + AV_PIX_FMT_RGB0, ///< packed RGB 8:8:8, 32bpp, RGB0RGB0... + AV_PIX_FMT_0BGR, ///< packed BGR 8:8:8, 32bpp, 0BGR0BGR... + AV_PIX_FMT_BGR0, ///< packed BGR 8:8:8, 32bpp, BGR0BGR0... + AV_PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples) + AV_PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples) + + AV_PIX_FMT_YUV420P12BE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P12LE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV420P14BE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P14LE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV422P14BE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P14LE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444P14BE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P14LE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_GBRP12BE, ///< planar GBR 4:4:4 36bpp, big-endian + AV_PIX_FMT_GBRP12LE, ///< planar GBR 4:4:4 36bpp, little-endian + AV_PIX_FMT_GBRP14BE, ///< planar GBR 4:4:4 42bpp, big-endian + AV_PIX_FMT_GBRP14LE, ///< planar GBR 4:4:4 42bpp, little-endian + AV_PIX_FMT_GBRAP, ///< planar GBRA 4:4:4:4 32bpp + AV_PIX_FMT_GBRAP16BE, ///< planar GBRA 4:4:4:4 64bpp, big-endian + AV_PIX_FMT_GBRAP16LE, ///< planar GBRA 4:4:4:4 64bpp, little-endian + AV_PIX_FMT_YUVJ411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor of PIX_FMT_YUV411P and setting color_range + + AV_PIX_FMT_BAYER_BGGR8, ///< bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples */ + AV_PIX_FMT_BAYER_RGGB8, ///< bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples */ + AV_PIX_FMT_BAYER_GBRG8, ///< bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples */ + AV_PIX_FMT_BAYER_GRBG8, ///< bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples */ + AV_PIX_FMT_BAYER_BGGR16LE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian */ + AV_PIX_FMT_BAYER_BGGR16BE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian */ + AV_PIX_FMT_BAYER_RGGB16LE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian */ + AV_PIX_FMT_BAYER_RGGB16BE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian */ + AV_PIX_FMT_BAYER_GBRG16LE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian */ + AV_PIX_FMT_BAYER_GBRG16BE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian */ + AV_PIX_FMT_BAYER_GRBG16LE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian */ + AV_PIX_FMT_BAYER_GRBG16BE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian */ +#if !FF_API_XVMC + AV_PIX_FMT_XVMC,///< XVideo Motion Acceleration via common packet passing +#endif /* !FF_API_XVMC */ + + AV_PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions + +#if FF_API_PIX_FMT + +#include "old_pix_fmts.h" + +#endif +}; + +#if AV_HAVE_INCOMPATIBLE_LIBAV_ABI +#define AV_PIX_FMT_YUVA422P AV_PIX_FMT_YUVA422P_LIBAV +#define AV_PIX_FMT_YUVA444P AV_PIX_FMT_YUVA444P_LIBAV +#define AV_PIX_FMT_RGBA64BE AV_PIX_FMT_RGBA64BE_LIBAV +#define AV_PIX_FMT_RGBA64LE AV_PIX_FMT_RGBA64LE_LIBAV +#define AV_PIX_FMT_BGRA64BE AV_PIX_FMT_BGRA64BE_LIBAV +#define AV_PIX_FMT_BGRA64LE AV_PIX_FMT_BGRA64LE_LIBAV +#endif + + +#define AV_PIX_FMT_Y400A AV_PIX_FMT_GRAY8A +#define AV_PIX_FMT_GBR24P AV_PIX_FMT_GBRP + +#if AV_HAVE_BIGENDIAN +# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##be +#else +# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##le +#endif + +#define AV_PIX_FMT_RGB32 AV_PIX_FMT_NE(ARGB, BGRA) +#define AV_PIX_FMT_RGB32_1 AV_PIX_FMT_NE(RGBA, ABGR) +#define AV_PIX_FMT_BGR32 AV_PIX_FMT_NE(ABGR, RGBA) +#define AV_PIX_FMT_BGR32_1 AV_PIX_FMT_NE(BGRA, ARGB) +#define AV_PIX_FMT_0RGB32 AV_PIX_FMT_NE(0RGB, BGR0) +#define AV_PIX_FMT_0BGR32 AV_PIX_FMT_NE(0BGR, RGB0) + +#define AV_PIX_FMT_GRAY16 AV_PIX_FMT_NE(GRAY16BE, GRAY16LE) +#define AV_PIX_FMT_YA16 AV_PIX_FMT_NE(YA16BE, YA16LE) +#define AV_PIX_FMT_RGB48 AV_PIX_FMT_NE(RGB48BE, RGB48LE) +#define AV_PIX_FMT_RGB565 AV_PIX_FMT_NE(RGB565BE, RGB565LE) +#define AV_PIX_FMT_RGB555 AV_PIX_FMT_NE(RGB555BE, RGB555LE) +#define AV_PIX_FMT_RGB444 AV_PIX_FMT_NE(RGB444BE, RGB444LE) +#define AV_PIX_FMT_RGBA64 AV_PIX_FMT_NE(RGBA64BE, RGBA64LE) +#define AV_PIX_FMT_BGR48 AV_PIX_FMT_NE(BGR48BE, BGR48LE) +#define AV_PIX_FMT_BGR565 AV_PIX_FMT_NE(BGR565BE, BGR565LE) +#define AV_PIX_FMT_BGR555 AV_PIX_FMT_NE(BGR555BE, BGR555LE) +#define AV_PIX_FMT_BGR444 AV_PIX_FMT_NE(BGR444BE, BGR444LE) +#define AV_PIX_FMT_BGRA64 AV_PIX_FMT_NE(BGRA64BE, BGRA64LE) + +#define AV_PIX_FMT_YUV420P9 AV_PIX_FMT_NE(YUV420P9BE , YUV420P9LE) +#define AV_PIX_FMT_YUV422P9 AV_PIX_FMT_NE(YUV422P9BE , YUV422P9LE) +#define AV_PIX_FMT_YUV444P9 AV_PIX_FMT_NE(YUV444P9BE , YUV444P9LE) +#define AV_PIX_FMT_YUV420P10 AV_PIX_FMT_NE(YUV420P10BE, YUV420P10LE) +#define AV_PIX_FMT_YUV422P10 AV_PIX_FMT_NE(YUV422P10BE, YUV422P10LE) +#define AV_PIX_FMT_YUV444P10 AV_PIX_FMT_NE(YUV444P10BE, YUV444P10LE) +#define AV_PIX_FMT_YUV420P12 AV_PIX_FMT_NE(YUV420P12BE, YUV420P12LE) +#define AV_PIX_FMT_YUV422P12 AV_PIX_FMT_NE(YUV422P12BE, YUV422P12LE) +#define AV_PIX_FMT_YUV444P12 AV_PIX_FMT_NE(YUV444P12BE, YUV444P12LE) +#define AV_PIX_FMT_YUV420P14 AV_PIX_FMT_NE(YUV420P14BE, YUV420P14LE) +#define AV_PIX_FMT_YUV422P14 AV_PIX_FMT_NE(YUV422P14BE, YUV422P14LE) +#define AV_PIX_FMT_YUV444P14 AV_PIX_FMT_NE(YUV444P14BE, YUV444P14LE) +#define AV_PIX_FMT_YUV420P16 AV_PIX_FMT_NE(YUV420P16BE, YUV420P16LE) +#define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE) +#define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE) + +#define AV_PIX_FMT_GBRP9 AV_PIX_FMT_NE(GBRP9BE , GBRP9LE) +#define AV_PIX_FMT_GBRP10 AV_PIX_FMT_NE(GBRP10BE, GBRP10LE) +#define AV_PIX_FMT_GBRP12 AV_PIX_FMT_NE(GBRP12BE, GBRP12LE) +#define AV_PIX_FMT_GBRP14 AV_PIX_FMT_NE(GBRP14BE, GBRP14LE) +#define AV_PIX_FMT_GBRP16 AV_PIX_FMT_NE(GBRP16BE, GBRP16LE) +#define AV_PIX_FMT_GBRAP16 AV_PIX_FMT_NE(GBRAP16BE, GBRAP16LE) + +#define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE, BAYER_BGGR16LE) +#define AV_PIX_FMT_BAYER_RGGB16 AV_PIX_FMT_NE(BAYER_RGGB16BE, BAYER_RGGB16LE) +#define AV_PIX_FMT_BAYER_GBRG16 AV_PIX_FMT_NE(BAYER_GBRG16BE, BAYER_GBRG16LE) +#define AV_PIX_FMT_BAYER_GRBG16 AV_PIX_FMT_NE(BAYER_GRBG16BE, BAYER_GRBG16LE) + + +#define AV_PIX_FMT_YUVA420P9 AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE) +#define AV_PIX_FMT_YUVA422P9 AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE) +#define AV_PIX_FMT_YUVA444P9 AV_PIX_FMT_NE(YUVA444P9BE , YUVA444P9LE) +#define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE) +#define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE) +#define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE) +#define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE) +#define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE) +#define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE) + +#define AV_PIX_FMT_XYZ12 AV_PIX_FMT_NE(XYZ12BE, XYZ12LE) +#define AV_PIX_FMT_NV20 AV_PIX_FMT_NE(NV20BE, NV20LE) + + +#if FF_API_PIX_FMT +#define PixelFormat AVPixelFormat + +#define PIX_FMT_Y400A AV_PIX_FMT_Y400A +#define PIX_FMT_GBR24P AV_PIX_FMT_GBR24P + +#define PIX_FMT_NE(be, le) AV_PIX_FMT_NE(be, le) + +#define PIX_FMT_RGB32 AV_PIX_FMT_RGB32 +#define PIX_FMT_RGB32_1 AV_PIX_FMT_RGB32_1 +#define PIX_FMT_BGR32 AV_PIX_FMT_BGR32 +#define PIX_FMT_BGR32_1 AV_PIX_FMT_BGR32_1 +#define PIX_FMT_0RGB32 AV_PIX_FMT_0RGB32 +#define PIX_FMT_0BGR32 AV_PIX_FMT_0BGR32 + +#define PIX_FMT_GRAY16 AV_PIX_FMT_GRAY16 +#define PIX_FMT_RGB48 AV_PIX_FMT_RGB48 +#define PIX_FMT_RGB565 AV_PIX_FMT_RGB565 +#define PIX_FMT_RGB555 AV_PIX_FMT_RGB555 +#define PIX_FMT_RGB444 AV_PIX_FMT_RGB444 +#define PIX_FMT_BGR48 AV_PIX_FMT_BGR48 +#define PIX_FMT_BGR565 AV_PIX_FMT_BGR565 +#define PIX_FMT_BGR555 AV_PIX_FMT_BGR555 +#define PIX_FMT_BGR444 AV_PIX_FMT_BGR444 + +#define PIX_FMT_YUV420P9 AV_PIX_FMT_YUV420P9 +#define PIX_FMT_YUV422P9 AV_PIX_FMT_YUV422P9 +#define PIX_FMT_YUV444P9 AV_PIX_FMT_YUV444P9 +#define PIX_FMT_YUV420P10 AV_PIX_FMT_YUV420P10 +#define PIX_FMT_YUV422P10 AV_PIX_FMT_YUV422P10 +#define PIX_FMT_YUV444P10 AV_PIX_FMT_YUV444P10 +#define PIX_FMT_YUV420P12 AV_PIX_FMT_YUV420P12 +#define PIX_FMT_YUV422P12 AV_PIX_FMT_YUV422P12 +#define PIX_FMT_YUV444P12 AV_PIX_FMT_YUV444P12 +#define PIX_FMT_YUV420P14 AV_PIX_FMT_YUV420P14 +#define PIX_FMT_YUV422P14 AV_PIX_FMT_YUV422P14 +#define PIX_FMT_YUV444P14 AV_PIX_FMT_YUV444P14 +#define PIX_FMT_YUV420P16 AV_PIX_FMT_YUV420P16 +#define PIX_FMT_YUV422P16 AV_PIX_FMT_YUV422P16 +#define PIX_FMT_YUV444P16 AV_PIX_FMT_YUV444P16 + +#define PIX_FMT_RGBA64 AV_PIX_FMT_RGBA64 +#define PIX_FMT_BGRA64 AV_PIX_FMT_BGRA64 +#define PIX_FMT_GBRP9 AV_PIX_FMT_GBRP9 +#define PIX_FMT_GBRP10 AV_PIX_FMT_GBRP10 +#define PIX_FMT_GBRP12 AV_PIX_FMT_GBRP12 +#define PIX_FMT_GBRP14 AV_PIX_FMT_GBRP14 +#define PIX_FMT_GBRP16 AV_PIX_FMT_GBRP16 +#endif + +/** + * Chromaticity coordinates of the source primaries. + */ +enum AVColorPrimaries { + AVCOL_PRI_RESERVED0 = 0, + AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B + AVCOL_PRI_UNSPECIFIED = 2, + AVCOL_PRI_RESERVED = 3, + AVCOL_PRI_BT470M = 4, ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20) + + AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM + AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC + AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above + AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C + AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020 + AVCOL_PRI_NB, ///< Not part of ABI +}; + +/** + * Color Transfer Characteristic. + */ +enum AVColorTransferCharacteristic { + AVCOL_TRC_RESERVED0 = 0, + AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361 + AVCOL_TRC_UNSPECIFIED = 2, + AVCOL_TRC_RESERVED = 3, + AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM + AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG + AVCOL_TRC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC + AVCOL_TRC_SMPTE240M = 7, + AVCOL_TRC_LINEAR = 8, ///< "Linear transfer characteristics" + AVCOL_TRC_LOG = 9, ///< "Logarithmic transfer characteristic (100:1 range)" + AVCOL_TRC_LOG_SQRT = 10, ///< "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)" + AVCOL_TRC_IEC61966_2_4 = 11, ///< IEC 61966-2-4 + AVCOL_TRC_BT1361_ECG = 12, ///< ITU-R BT1361 Extended Colour Gamut + AVCOL_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC) + AVCOL_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10 bit system + AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12 bit system + AVCOL_TRC_NB, ///< Not part of ABI +}; + +/** + * YUV colorspace type. + */ +enum AVColorSpace { + AVCOL_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB) + AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B + AVCOL_SPC_UNSPECIFIED = 2, + AVCOL_SPC_RESERVED = 3, + AVCOL_SPC_FCC = 4, ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20) + AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 + AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above + AVCOL_SPC_SMPTE240M = 7, + AVCOL_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 + AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system + AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system + AVCOL_SPC_NB, ///< Not part of ABI +}; +#define AVCOL_SPC_YCGCO AVCOL_SPC_YCOCG + + +/** + * MPEG vs JPEG YUV range. + */ +enum AVColorRange { + AVCOL_RANGE_UNSPECIFIED = 0, + AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges + AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges + AVCOL_RANGE_NB, ///< Not part of ABI +}; + +/** + * Location of chroma samples. + * + * X X 3 4 X X are luma samples, + * 1 2 1-6 are possible chroma positions + * X X 5 6 X 0 is undefined/unknown position + */ +enum AVChromaLocation { + AVCHROMA_LOC_UNSPECIFIED = 0, + AVCHROMA_LOC_LEFT = 1, ///< mpeg2/4, h264 default + AVCHROMA_LOC_CENTER = 2, ///< mpeg1, jpeg, h263 + AVCHROMA_LOC_TOPLEFT = 3, ///< DV + AVCHROMA_LOC_TOP = 4, + AVCHROMA_LOC_BOTTOMLEFT = 5, + AVCHROMA_LOC_BOTTOM = 6, + AVCHROMA_LOC_NB, ///< Not part of ABI +}; + +#endif /* AVUTIL_PIXFMT_H */ diff --git a/app/src/main/cpp/include/libavutil/random_seed.h b/app/src/main/cpp/include/libavutil/random_seed.h new file mode 100644 index 0000000..0462a04 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/random_seed.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2009 Baptiste Coudurier <baptiste.coudurier@gmail.com> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_RANDOM_SEED_H +#define AVUTIL_RANDOM_SEED_H + +#include <stdint.h> +/** + * @addtogroup lavu_crypto + * @{ + */ + +/** + * Get a seed to use in conjunction with random functions. + * This function tries to provide a good seed at a best effort bases. + * Its possible to call this function multiple times if more bits are needed. + * It can be quite slow, which is why it should only be used as seed for a faster + * PRNG. The quality of the seed depends on the platform. + */ +uint32_t av_get_random_seed(void); + +/** + * @} + */ + +#endif /* AVUTIL_RANDOM_SEED_H */ diff --git a/app/src/main/cpp/include/libavutil/rational.h b/app/src/main/cpp/include/libavutil/rational.h new file mode 100644 index 0000000..a79f4b8 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/rational.h @@ -0,0 +1,164 @@ +/* + * rational numbers + * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * rational numbers + * @author Michael Niedermayer <michaelni@gmx.at> + */ + +#ifndef AVUTIL_RATIONAL_H +#define AVUTIL_RATIONAL_H + +#include <stdint.h> +#include <limits.h> +#include "attributes.h" + +/** + * @addtogroup lavu_math + * @{ + */ + +/** + * rational number numerator/denominator + */ +typedef struct AVRational { + int num; ///< numerator + int den; ///< denominator +} AVRational; + +/** + * Create a rational. + * Useful for compilers that do not support compound literals. + * @note The return value is not reduced. + */ +static inline AVRational av_make_q(int num, int den) { + AVRational r = {num, den}; + return r; +} + +/** + * Compare two rationals. + * @param a first rational + * @param b second rational + * @return 0 if a==b, 1 if a>b, -1 if a<b, and INT_MIN if one of the + * values is of the form 0/0 + */ +static inline int av_cmp_q(AVRational a, AVRational b) { + const int64_t tmp = a.num * (int64_t) b.den - b.num * (int64_t) a.den; + + if (tmp) return (int) ((tmp ^ a.den ^ b.den) >> 63) | 1; + else if (b.den && a.den) return 0; + else if (a.num && b.num) return (a.num >> 31) - (b.num >> 31); + else return INT_MIN; +} + +/** + * Convert rational to double. + * @param a rational to convert + * @return (double) a + */ +static inline double av_q2d(AVRational a) { + return a.num / (double) a.den; +} + +/** + * Reduce a fraction. + * This is useful for framerate calculations. + * @param dst_num destination numerator + * @param dst_den destination denominator + * @param num source numerator + * @param den source denominator + * @param max the maximum allowed for dst_num & dst_den + * @return 1 if exact, 0 otherwise + */ +int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max); + +/** + * Multiply two rationals. + * @param b first rational + * @param c second rational + * @return b*c + */ +AVRational av_mul_q(AVRational b, AVRational c) av_const; + +/** + * Divide one rational by another. + * @param b first rational + * @param c second rational + * @return b/c + */ +AVRational av_div_q(AVRational b, AVRational c) av_const; + +/** + * Add two rationals. + * @param b first rational + * @param c second rational + * @return b+c + */ +AVRational av_add_q(AVRational b, AVRational c) av_const; + +/** + * Subtract one rational from another. + * @param b first rational + * @param c second rational + * @return b-c + */ +AVRational av_sub_q(AVRational b, AVRational c) av_const; + +/** + * Invert a rational. + * @param q value + * @return 1 / q + */ +static av_always_inline AVRational av_inv_q(AVRational q) { + AVRational r = {q.den, q.num}; + return r; +} + +/** + * Convert a double precision floating point number to a rational. + * inf is expressed as {1,0} or {-1,0} depending on the sign. + * + * @param d double to convert + * @param max the maximum allowed numerator and denominator + * @return (AVRational) d + */ +AVRational av_d2q(double d, int max) av_const; + +/** + * @return 1 if q1 is nearer to q than q2, -1 if q2 is nearer + * than q1, 0 if they have the same distance. + */ +int av_nearer_q(AVRational q, AVRational q1, AVRational q2); + +/** + * Find the nearest value in q_list to q. + * @param q_list an array of rationals terminated by {0, 0} + * @return the index of the nearest value found in the array + */ +int av_find_nearest_q_idx(AVRational q, const AVRational *q_list); + +/** + * @} + */ + +#endif /* AVUTIL_RATIONAL_H */ diff --git a/app/src/main/cpp/include/libavutil/replaygain.h b/app/src/main/cpp/include/libavutil/replaygain.h new file mode 100644 index 0000000..5c03e19 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/replaygain.h @@ -0,0 +1,51 @@ +/* + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_REPLAYGAIN_H +#define AVUTIL_REPLAYGAIN_H + +#include <stdint.h> + +/** + * ReplayGain information (see + * http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification). + * The size of this struct is a part of the public ABI. + */ +typedef struct AVReplayGain { + /** + * Track replay gain in microbels (divide by 100000 to get the value in dB). + * Should be set to INT32_MIN when unknown. + */ + int32_t track_gain; + /** + * Peak track amplitude, with 100000 representing full scale (but values + * may overflow). 0 when unknown. + */ + uint32_t track_peak; + /** + * Same as track_gain, but for the whole album. + */ + int32_t album_gain; + /** + * Same as track_peak, but for the whole album, + */ + uint32_t album_peak; +} AVReplayGain; + +#endif /* AVUTIL_REPLAYGAIN_H */ diff --git a/app/src/main/cpp/include/libavutil/ripemd.h b/app/src/main/cpp/include/libavutil/ripemd.h new file mode 100644 index 0000000..655d656 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/ripemd.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2007 Michael Niedermayer <michaelni@gmx.at> + * Copyright (C) 2013 James Almer <jamrial@gmail.com> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_RIPEMD_H +#define AVUTIL_RIPEMD_H + +#include <stdint.h> + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_ripemd RIPEMD + * @ingroup lavu_crypto + * @{ + */ + +extern const int av_ripemd_size; + +struct AVRIPEMD; + +/** + * Allocate an AVRIPEMD context. + */ +struct AVRIPEMD *av_ripemd_alloc(void); + +/** + * Initialize RIPEMD hashing. + * + * @param context pointer to the function context (of size av_ripemd_size) + * @param bits number of bits in digest (128, 160, 256 or 320 bits) + * @return zero if initialization succeeded, -1 otherwise + */ +int av_ripemd_init(struct AVRIPEMD *context, int bits); + +/** + * Update hash value. + * + * @param context hash function context + * @param data input data to update hash with + * @param len input data length + */ +void av_ripemd_update(struct AVRIPEMD *context, const uint8_t *data, unsigned int len); + +/** + * Finish hashing and output digest value. + * + * @param context hash function context + * @param digest buffer where output digest value is stored + */ +void av_ripemd_final(struct AVRIPEMD *context, uint8_t *digest); + +/** + * @} + */ + +#endif /* AVUTIL_RIPEMD_H */ diff --git a/app/src/main/cpp/include/libavutil/samplefmt.h b/app/src/main/cpp/include/libavutil/samplefmt.h new file mode 100644 index 0000000..e16045b --- /dev/null +++ b/app/src/main/cpp/include/libavutil/samplefmt.h @@ -0,0 +1,271 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_SAMPLEFMT_H +#define AVUTIL_SAMPLEFMT_H + +#include <stdint.h> + +#include "avutil.h" +#include "attributes.h" + +/** + * @addtogroup lavu_audio + * @{ + * + * @defgroup lavu_sampfmts Audio sample formats + * + * Audio sample format enumeration and related convenience functions. + * @{ + * + */ + +/** + * Audio sample formats + * + * - The data described by the sample format is always in native-endian order. + * Sample values can be expressed by native C types, hence the lack of a signed + * 24-bit sample format even though it is a common raw audio data format. + * + * - The floating-point formats are based on full volume being in the range + * [-1.0, 1.0]. Any values outside this range are beyond full volume level. + * + * - The data layout as used in av_samples_fill_arrays() and elsewhere in FFmpeg + * (such as AVFrame in libavcodec) is as follows: + * + * @par + * For planar sample formats, each audio channel is in a separate data plane, + * and linesize is the buffer size, in bytes, for a single plane. All data + * planes must be the same size. For packed sample formats, only the first data + * plane is used, and samples for each channel are interleaved. In this case, + * linesize is the buffer size, in bytes, for the 1 plane. + * + */ +enum AVSampleFormat { + AV_SAMPLE_FMT_NONE = -1, + AV_SAMPLE_FMT_U8, ///< unsigned 8 bits + AV_SAMPLE_FMT_S16, ///< signed 16 bits + AV_SAMPLE_FMT_S32, ///< signed 32 bits + AV_SAMPLE_FMT_FLT, ///< float + AV_SAMPLE_FMT_DBL, ///< double + + AV_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar + AV_SAMPLE_FMT_S16P, ///< signed 16 bits, planar + AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar + AV_SAMPLE_FMT_FLTP, ///< float, planar + AV_SAMPLE_FMT_DBLP, ///< double, planar + + AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically +}; + +/** + * Return the name of sample_fmt, or NULL if sample_fmt is not + * recognized. + */ +const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt); + +/** + * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE + * on error. + */ +enum AVSampleFormat av_get_sample_fmt(const char *name); + +/** + * Return the planar<->packed alternative form of the given sample format, or + * AV_SAMPLE_FMT_NONE on error. If the passed sample_fmt is already in the + * requested planar/packed format, the format returned is the same as the + * input. + */ +enum AVSampleFormat av_get_alt_sample_fmt(enum AVSampleFormat sample_fmt, int planar); + +/** + * Get the packed alternative form of the given sample format. + * + * If the passed sample_fmt is already in packed format, the format returned is + * the same as the input. + * + * @return the packed alternative form of the given sample format or + AV_SAMPLE_FMT_NONE on error. + */ +enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt); + +/** + * Get the planar alternative form of the given sample format. + * + * If the passed sample_fmt is already in planar format, the format returned is + * the same as the input. + * + * @return the planar alternative form of the given sample format or + AV_SAMPLE_FMT_NONE on error. + */ +enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt); + +/** + * Generate a string corresponding to the sample format with + * sample_fmt, or a header if sample_fmt is negative. + * + * @param buf the buffer where to write the string + * @param buf_size the size of buf + * @param sample_fmt the number of the sample format to print the + * corresponding info string, or a negative value to print the + * corresponding header. + * @return the pointer to the filled buffer or NULL if sample_fmt is + * unknown or in case of other errors + */ +char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt); + +/** + * Return number of bytes per sample. + * + * @param sample_fmt the sample format + * @return number of bytes per sample or zero if unknown for the given + * sample format + */ +int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt); + +/** + * Check if the sample format is planar. + * + * @param sample_fmt the sample format to inspect + * @return 1 if the sample format is planar, 0 if it is interleaved + */ +int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt); + +/** + * Get the required buffer size for the given audio parameters. + * + * @param[out] linesize calculated linesize, may be NULL + * @param nb_channels the number of channels + * @param nb_samples the number of samples in a single channel + * @param sample_fmt the sample format + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return required buffer size, or negative error code on failure + */ +int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, + enum AVSampleFormat sample_fmt, int align); + +/** + * @} + * + * @defgroup lavu_sampmanip Samples manipulation + * + * Functions that manipulate audio samples + * @{ + */ + +/** + * Fill plane data pointers and linesize for samples with sample + * format sample_fmt. + * + * The audio_data array is filled with the pointers to the samples data planes: + * for planar, set the start point of each channel's data within the buffer, + * for packed, set the start point of the entire buffer only. + * + * The value pointed to by linesize is set to the aligned size of each + * channel's data buffer for planar layout, or to the aligned size of the + * buffer for all channels for packed layout. + * + * The buffer in buf must be big enough to contain all the samples + * (use av_samples_get_buffer_size() to compute its minimum size), + * otherwise the audio_data pointers will point to invalid data. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param[out] audio_data array to be filled with the pointer for each channel + * @param[out] linesize calculated linesize, may be NULL + * @param buf the pointer to a buffer containing the samples + * @param nb_channels the number of channels + * @param nb_samples the number of samples in a single channel + * @param sample_fmt the sample format + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return >=0 on success or a negative error code on failure + * @todo return minimum size in bytes required for the buffer in case + * of success at the next bump + */ +int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, + const uint8_t *buf, + int nb_channels, int nb_samples, + enum AVSampleFormat sample_fmt, int align); + +/** + * Allocate a samples buffer for nb_samples samples, and fill data pointers and + * linesize accordingly. + * The allocated samples buffer can be freed by using av_freep(&audio_data[0]) + * Allocated data will be initialized to silence. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param[out] audio_data array to be filled with the pointer for each channel + * @param[out] linesize aligned size for audio buffer(s), may be NULL + * @param nb_channels number of audio channels + * @param nb_samples number of samples per channel + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return >=0 on success or a negative error code on failure + * @todo return the size of the allocated buffer in case of success at the next bump + * @see av_samples_fill_arrays() + * @see av_samples_alloc_array_and_samples() + */ +int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels, + int nb_samples, enum AVSampleFormat sample_fmt, int align); + +/** + * Allocate a data pointers array, samples buffer for nb_samples + * samples, and fill data pointers and linesize accordingly. + * + * This is the same as av_samples_alloc(), but also allocates the data + * pointers array. + * + * @see av_samples_alloc() + */ +int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int nb_channels, + int nb_samples, enum AVSampleFormat sample_fmt, int align); + +/** + * Copy samples from src to dst. + * + * @param dst destination array of pointers to data planes + * @param src source array of pointers to data planes + * @param dst_offset offset in samples at which the data will be written to dst + * @param src_offset offset in samples at which the data will be read from src + * @param nb_samples number of samples to be copied + * @param nb_channels number of audio channels + * @param sample_fmt audio sample format + */ +int av_samples_copy(uint8_t **dst, uint8_t *const *src, int dst_offset, + int src_offset, int nb_samples, int nb_channels, + enum AVSampleFormat sample_fmt); + +/** + * Fill an audio buffer with silence. + * + * @param audio_data array of pointers to data planes + * @param offset offset in samples at which to start filling + * @param nb_samples number of samples to fill + * @param nb_channels number of audio channels + * @param sample_fmt audio sample format + */ +int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples, + int nb_channels, enum AVSampleFormat sample_fmt); + +/** + * @} + * @} + */ +#endif /* AVUTIL_SAMPLEFMT_H */ diff --git a/app/src/main/cpp/include/libavutil/sha.h b/app/src/main/cpp/include/libavutil/sha.h new file mode 100644 index 0000000..6c80ae5 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/sha.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2007 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_SHA_H +#define AVUTIL_SHA_H + +#include <stdint.h> + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_sha SHA + * @ingroup lavu_crypto + * @{ + */ + +extern const int av_sha_size; + +struct AVSHA; + +/** + * Allocate an AVSHA context. + */ +struct AVSHA *av_sha_alloc(void); + +/** + * Initialize SHA-1 or SHA-2 hashing. + * + * @param context pointer to the function context (of size av_sha_size) + * @param bits number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits) + * @return zero if initialization succeeded, -1 otherwise + */ +int av_sha_init(struct AVSHA *context, int bits); + +/** + * Update hash value. + * + * @param context hash function context + * @param data input data to update hash with + * @param len input data length + */ +void av_sha_update(struct AVSHA *context, const uint8_t *data, unsigned int len); + +/** + * Finish hashing and output digest value. + * + * @param context hash function context + * @param digest buffer where output digest value is stored + */ +void av_sha_final(struct AVSHA *context, uint8_t *digest); + +/** + * @} + */ + +#endif /* AVUTIL_SHA_H */ diff --git a/app/src/main/cpp/include/libavutil/sha512.h b/app/src/main/cpp/include/libavutil/sha512.h new file mode 100644 index 0000000..23f97ca --- /dev/null +++ b/app/src/main/cpp/include/libavutil/sha512.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2007 Michael Niedermayer <michaelni@gmx.at> + * Copyright (C) 2013 James Almer <jamrial@gmail.com> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_SHA512_H +#define AVUTIL_SHA512_H + +#include <stdint.h> + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_sha512 SHA512 + * @ingroup lavu_crypto + * @{ + */ + +extern const int av_sha512_size; + +struct AVSHA512; + +/** + * Allocate an AVSHA512 context. + */ +struct AVSHA512 *av_sha512_alloc(void); + +/** + * Initialize SHA-2 512 hashing. + * + * @param context pointer to the function context (of size av_sha512_size) + * @param bits number of bits in digest (224, 256, 384 or 512 bits) + * @return zero if initialization succeeded, -1 otherwise + */ +int av_sha512_init(struct AVSHA512 *context, int bits); + +/** + * Update hash value. + * + * @param context hash function context + * @param data input data to update hash with + * @param len input data length + */ +void av_sha512_update(struct AVSHA512 *context, const uint8_t *data, unsigned int len); + +/** + * Finish hashing and output digest value. + * + * @param context hash function context + * @param digest buffer where output digest value is stored + */ +void av_sha512_final(struct AVSHA512 *context, uint8_t *digest); + +/** + * @} + */ + +#endif /* AVUTIL_SHA512_H */ diff --git a/app/src/main/cpp/include/libavutil/stereo3d.h b/app/src/main/cpp/include/libavutil/stereo3d.h new file mode 100644 index 0000000..e4512fd --- /dev/null +++ b/app/src/main/cpp/include/libavutil/stereo3d.h @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2013 Vittorio Giovara <vittorio.giovara@gmail.com> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_STEREO3D_H +#define AVUTIL_STEREO3D_H + +#include <stdint.h> + +#include "frame.h" + +/** + * List of possible 3D Types + */ +enum AVStereo3DType { + /** + * Video is not stereoscopic (and metadata has to be there). + */ + AV_STEREO3D_2D, + + /** + * Views are next to each other. + * + * LLLLRRRR + * LLLLRRRR + * LLLLRRRR + * ... + */ + AV_STEREO3D_SIDEBYSIDE, + + /** + * Views are on top of each other. + * + * LLLLLLLL + * LLLLLLLL + * RRRRRRRR + * RRRRRRRR + */ + AV_STEREO3D_TOPBOTTOM, + + /** + * Views are alternated temporally. + * + * frame0 frame1 frame2 ... + * LLLLLLLL RRRRRRRR LLLLLLLL + * LLLLLLLL RRRRRRRR LLLLLLLL + * LLLLLLLL RRRRRRRR LLLLLLLL + * ... ... ... + */ + AV_STEREO3D_FRAMESEQUENCE, + + /** + * Views are packed in a checkerboard-like structure per pixel. + * + * LRLRLRLR + * RLRLRLRL + * LRLRLRLR + * ... + */ + AV_STEREO3D_CHECKERBOARD, + + /** + * Views are next to each other, but when upscaling + * apply a checkerboard pattern. + * + * LLLLRRRR L L L L R R R R + * LLLLRRRR => L L L L R R R R + * LLLLRRRR L L L L R R R R + * LLLLRRRR L L L L R R R R + */ + AV_STEREO3D_SIDEBYSIDE_QUINCUNX, + + /** + * Views are packed per line, as if interlaced. + * + * LLLLLLLL + * RRRRRRRR + * LLLLLLLL + * ... + */ + AV_STEREO3D_LINES, + + /** + * Views are packed per column. + * + * LRLRLRLR + * LRLRLRLR + * LRLRLRLR + * ... + */ + AV_STEREO3D_COLUMNS, +}; + + +/** + * Inverted views, Right/Bottom represents the left view. + */ +#define AV_STEREO3D_FLAG_INVERT (1 << 0) + +/** + * Stereo 3D type: this structure describes how two videos are packed + * within a single video surface, with additional information as needed. + * + * @note The struct must be allocated with av_stereo3d_alloc() and + * its size is not a part of the public ABI. + */ +typedef struct AVStereo3D { + /** + * How views are packed within the video. + */ + enum AVStereo3DType type; + + /** + * Additional information about the frame packing. + */ + int flags; +} AVStereo3D; + +/** + * Allocate an AVStereo3D structure and set its fields to default values. + * The resulting struct can be freed using av_freep(). + * + * @return An AVStereo3D filled with default values or NULL on failure. + */ +AVStereo3D *av_stereo3d_alloc(void); + +/** + * Allocate a complete AVFrameSideData and add it to the frame. + * + * @param frame The frame which side data is added to. + * + * @return The AVStereo3D structure to be filled by caller. + */ +AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame); + +#endif /* AVUTIL_STEREO3D_H */ diff --git a/app/src/main/cpp/include/libavutil/threadmessage.h b/app/src/main/cpp/include/libavutil/threadmessage.h new file mode 100644 index 0000000..0578892 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/threadmessage.h @@ -0,0 +1,91 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with FFmpeg; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_THREADMESSAGE_H +#define AVUTIL_THREADMESSAGE_H + +typedef struct AVThreadMessageQueue AVThreadMessageQueue; + +typedef enum AVThreadMessageFlags { + + /** + * Perform non-blocking operation. + * If this flag is set, send and recv operations are non-blocking and + * return AVERROR(EAGAIN) immediately if they can not proceed. + */ + AV_THREAD_MESSAGE_NONBLOCK = 1, + +} AVThreadMessageFlags; + +/** + * Allocate a new message queue. + * + * @param mq pointer to the message queue + * @param nelem maximum number of elements in the queue + * @param elsize size of each element in the queue + * @return >=0 for success; <0 for error, in particular AVERROR(ENOSYS) if + * lavu was built without thread support + */ +int av_thread_message_queue_alloc(AVThreadMessageQueue **mq, + unsigned nelem, + unsigned elsize); + +/** + * Free a message queue. + * + * The message queue must no longer be in use by another thread. + */ +void av_thread_message_queue_free(AVThreadMessageQueue **mq); + +/** + * Send a message on the queue. + */ +int av_thread_message_queue_send(AVThreadMessageQueue *mq, + void *msg, + unsigned flags); + +/** + * Receive a message from the queue. + */ +int av_thread_message_queue_recv(AVThreadMessageQueue *mq, + void *msg, + unsigned flags); + +/** + * Set the sending error code. + * + * If the error code is set to non-zero, av_thread_message_queue_recv() will + * return it immediately when there are no longer available messages. + * Conventional values, such as AVERROR_EOF or AVERROR(EAGAIN), can be used + * to cause the receiving thread to stop or suspend its operation. + */ +void av_thread_message_queue_set_err_send(AVThreadMessageQueue *mq, + int err); + +/** + * Set the receiving error code. + * + * If the error code is set to non-zero, av_thread_message_queue_send() will + * return it immediately. Conventional values, such as AVERROR_EOF or + * AVERROR(EAGAIN), can be used to cause the sending thread to stop or + * suspend its operation. + */ +void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq, + int err); + +#endif /* AVUTIL_THREADMESSAGE_H */ diff --git a/app/src/main/cpp/include/libavutil/time.h b/app/src/main/cpp/include/libavutil/time.h new file mode 100644 index 0000000..4e54379 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/time.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2000-2003 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_TIME_H +#define AVUTIL_TIME_H + +#include <stdint.h> + +/** + * Get the current time in microseconds. + */ +int64_t av_gettime(void); + +/** + * Get the current time in microseconds since some unspecified starting point. + * On platforms that support it, the time comes from a monotonic clock + * This property makes this time source ideal for measuring relative time. + * The returned values may not be monotonic on platforms where a monotonic + * clock is not available. + */ +int64_t av_gettime_relative(void); + +/** + * Indicates with a boolean result if the av_gettime_relative() time source + * is monotonic. + */ +int av_gettime_relative_is_monotonic(void); + +/** + * Sleep for a period of time. Although the duration is expressed in + * microseconds, the actual delay may be rounded to the precision of the + * system timer. + * + * @param usec Number of microseconds to sleep. + * @return zero on success or (negative) error code. + */ +int av_usleep(unsigned usec); + +#endif /* AVUTIL_TIME_H */ diff --git a/app/src/main/cpp/include/libavutil/timecode.h b/app/src/main/cpp/include/libavutil/timecode.h new file mode 100644 index 0000000..f3d20d0 --- /dev/null +++ b/app/src/main/cpp/include/libavutil/timecode.h @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2006 Smartjog S.A.S, Baptiste Coudurier <baptiste.coudurier@gmail.com> + * Copyright (c) 2011-2012 Smartjog S.A.S, Clément Bœsch <clement.boesch@smartjog.com> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Timecode helpers header + */ + +#ifndef AVUTIL_TIMECODE_H +#define AVUTIL_TIMECODE_H + +#include <stdint.h> +#include "rational.h" + +#define AV_TIMECODE_STR_SIZE 16 + +enum AVTimecodeFlag { + AV_TIMECODE_FLAG_DROPFRAME = 1 << 0, ///< timecode is drop frame + AV_TIMECODE_FLAG_24HOURSMAX = 1 << 1, ///< timecode wraps after 24 hours + AV_TIMECODE_FLAG_ALLOWNEGATIVE = 1 << 2, ///< negative time values are allowed +}; + +typedef struct { + int start; ///< timecode frame start (first base frame number) + uint32_t flags; ///< flags such as drop frame, +24 hours support, ... + AVRational rate; ///< frame rate in rational form + unsigned fps; ///< frame per second; must be consistent with the rate field +} AVTimecode; + +/** + * Adjust frame number for NTSC drop frame time code. + * + * @param framenum frame number to adjust + * @param fps frame per second, 30 or 60 + * @return adjusted frame number + * @warning adjustment is only valid in NTSC 29.97 and 59.94 + */ +int av_timecode_adjust_ntsc_framenum2(int framenum, int fps); + +/** + * Convert frame number to SMPTE 12M binary representation. + * + * @param tc timecode data correctly initialized + * @param framenum frame number + * @return the SMPTE binary representation + * + * @note Frame number adjustment is automatically done in case of drop timecode, + * you do NOT have to call av_timecode_adjust_ntsc_framenum2(). + * @note The frame number is relative to tc->start. + * @note Color frame (CF), binary group flags (BGF) and biphase mark polarity + * correction (PC) bits are set to zero. + */ +uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum); + +/** + * Load timecode string in buf. + * + * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long + * @param tc timecode data correctly initialized + * @param framenum frame number + * @return the buf parameter + * + * @note Timecode representation can be a negative timecode and have more than + * 24 hours, but will only be honored if the flags are correctly set. + * @note The frame number is relative to tc->start. + */ +char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum); + +/** + * Get the timecode string from the SMPTE timecode format. + * + * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long + * @param tcsmpte the 32-bit SMPTE timecode + * @param prevent_df prevent the use of a drop flag when it is known the DF bit + * is arbitrary + * @return the buf parameter + */ +char *av_timecode_make_smpte_tc_string(char *buf, uint32_t tcsmpte, int prevent_df); + +/** + * Get the timecode string from the 25-bit timecode format (MPEG GOP format). + * + * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long + * @param tc25bit the 25-bits timecode + * @return the buf parameter + */ +char *av_timecode_make_mpeg_tc_string(char *buf, uint32_t tc25bit); + +/** + * Init a timecode struct with the passed parameters. + * + * @param log_ctx a pointer to an arbitrary struct of which the first field + * is a pointer to an AVClass struct (used for av_log) + * @param tc pointer to an allocated AVTimecode + * @param rate frame rate in rational form + * @param flags miscellaneous flags such as drop frame, +24 hours, ... + * (see AVTimecodeFlag) + * @param frame_start the first frame number + * @return 0 on success, AVERROR otherwise + */ +int av_timecode_init(AVTimecode *tc, AVRational rate, int flags, int frame_start, void *log_ctx); + +/** + * Parse timecode representation (hh:mm:ss[:;.]ff). + * + * @param log_ctx a pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct (used for av_log). + * @param tc pointer to an allocated AVTimecode + * @param rate frame rate in rational form + * @param str timecode string which will determine the frame start + * @return 0 on success, AVERROR otherwise + */ +int av_timecode_init_from_string(AVTimecode *tc, AVRational rate, const char *str, void *log_ctx); + +/** + * Check if the timecode feature is available for the given frame rate + * + * @return 0 if supported, <0 otherwise + */ +int av_timecode_check_frame_rate(AVRational rate); + +#endif /* AVUTIL_TIMECODE_H */ diff --git a/app/src/main/cpp/include/libavutil/timestamp.h b/app/src/main/cpp/include/libavutil/timestamp.h new file mode 100644 index 0000000..91aadbf --- /dev/null +++ b/app/src/main/cpp/include/libavutil/timestamp.h @@ -0,0 +1,76 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * timestamp utils, mostly useful for debugging/logging purposes + */ + +#ifndef AVUTIL_TIMESTAMP_H +#define AVUTIL_TIMESTAMP_H + +#include "common.h" + +#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) && !defined(PRId64) +#error missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS +#endif + +#define AV_TS_MAX_STRING_SIZE 32 + +/** + * Fill the provided buffer with a string containing a timestamp + * representation. + * + * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE + * @param ts the timestamp to represent + * @return the buffer in input + */ +static inline char *av_ts_make_string(char *buf, int64_t ts) { + if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS"); + else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%"PRId64, ts); + return buf; +} + +/** + * Convenience macro, the return value should be used only directly in + * function arguments but never stand-alone. + */ +#define av_ts2str(ts) av_ts_make_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts) + +/** + * Fill the provided buffer with a string containing a timestamp time + * representation. + * + * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE + * @param ts the timestamp to represent + * @param tb the timebase of the timestamp + * @return the buffer in input + */ +static inline char *av_ts_make_time_string(char *buf, int64_t ts, AVRational *tb) { + if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS"); + else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%.6g", av_q2d(*tb) * ts); + return buf; +} + +/** + * Convenience macro, the return value should be used only directly in + * function arguments but never stand-alone. + */ +#define av_ts2timestr(ts, tb) av_ts_make_time_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts, tb) + +#endif /* AVUTIL_TIMESTAMP_H */ diff --git a/app/src/main/cpp/include/libavutil/version.h b/app/src/main/cpp/include/libavutil/version.h new file mode 100644 index 0000000..da8d0ea --- /dev/null +++ b/app/src/main/cpp/include/libavutil/version.h @@ -0,0 +1,136 @@ +/* + * copyright (c) 2003 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_VERSION_H +#define AVUTIL_VERSION_H + +#include "macros.h" + +/** + * @addtogroup version_utils + * + * Useful to check and match library version in order to maintain + * backward compatibility. + * + * @{ + */ + +#define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c) +#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c +#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) + +/** + * @} + */ + +/** + * @file + * @ingroup lavu + * Libavutil version macros + */ + +/** + * @defgroup lavu_ver Version and Build diagnostics + * + * Macros and function useful to check at compiletime and at runtime + * which version of libavutil is in use. + * + * @{ + */ + +#define LIBAVUTIL_VERSION_MAJOR 54 +#define LIBAVUTIL_VERSION_MINOR 15 +#define LIBAVUTIL_VERSION_MICRO 100 + +#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ + LIBAVUTIL_VERSION_MINOR, \ + LIBAVUTIL_VERSION_MICRO) +#define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \ + LIBAVUTIL_VERSION_MINOR, \ + LIBAVUTIL_VERSION_MICRO) +#define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT + +#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) + +/** + * @} + * + * @defgroup depr_guards Deprecation guards + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + * + * @{ + */ + +#ifndef FF_API_OLD_AVOPTIONS +#define FF_API_OLD_AVOPTIONS (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_PIX_FMT +#define FF_API_PIX_FMT (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_CONTEXT_SIZE +#define FF_API_CONTEXT_SIZE (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_PIX_FMT_DESC +#define FF_API_PIX_FMT_DESC (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_AV_REVERSE +#define FF_API_AV_REVERSE (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_AUDIOCONVERT +#define FF_API_AUDIOCONVERT (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_CPU_FLAG_MMX2 +#define FF_API_CPU_FLAG_MMX2 (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_LLS_PRIVATE +#define FF_API_LLS_PRIVATE (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_AVFRAME_LAVC +#define FF_API_AVFRAME_LAVC (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_VDPAU +#define FF_API_VDPAU (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_GET_CHANNEL_LAYOUT_COMPAT +#define FF_API_GET_CHANNEL_LAYOUT_COMPAT (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_XVMC +#define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_OPT_TYPE_METADATA +#define FF_API_OPT_TYPE_METADATA (LIBAVUTIL_VERSION_MAJOR < 55) +#endif + +#ifndef FF_CONST_AVUTIL55 +#if LIBAVUTIL_VERSION_MAJOR >= 55 +#define FF_CONST_AVUTIL55 const +#else +#define FF_CONST_AVUTIL55 +#endif +#endif + +/** + * @} + */ + +#endif /* AVUTIL_VERSION_H */ + diff --git a/app/src/main/cpp/include/libavutil/xtea.h b/app/src/main/cpp/include/libavutil/xtea.h new file mode 100644 index 0000000..6f1e71e --- /dev/null +++ b/app/src/main/cpp/include/libavutil/xtea.h @@ -0,0 +1,64 @@ +/* + * A 32-bit implementation of the XTEA algorithm + * Copyright (c) 2012 Samuel Pitoiset + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_XTEA_H +#define AVUTIL_XTEA_H + +#include <stdint.h> + +/** + * @file + * @brief Public header for libavutil XTEA algorithm + * @defgroup lavu_xtea XTEA + * @ingroup lavu_crypto + * @{ + */ + +typedef struct AVXTEA { + uint32_t key[16]; +} AVXTEA; + +/** + * Initialize an AVXTEA context. + * + * @param ctx an AVXTEA context + * @param key a key of 16 bytes used for encryption/decryption + */ +void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * + * @param ctx an AVXTEA context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param iv initialization vector for CBC mode, if NULL then ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, + int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_XTEA_H */ diff --git a/app/src/main/cpp/include/libpostproc/postprocess.h b/app/src/main/cpp/include/libpostproc/postprocess.h new file mode 100644 index 0000000..4dfe380 --- /dev/null +++ b/app/src/main/cpp/include/libpostproc/postprocess.h @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2001-2003 Michael Niedermayer (michaelni@gmx.at) + * + * This file is part of FFmpeg. + * + * FFmpeg 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. + * + * FFmpeg 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 FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef POSTPROC_POSTPROCESS_H +#define POSTPROC_POSTPROCESS_H + +/** + * @file + * @ingroup lpp + * external API header + */ + +/** + * @defgroup lpp Libpostproc + * @{ + */ + +#include "libpostproc/version.h" + +/** + * Return the LIBPOSTPROC_VERSION_INT constant. + */ +unsigned postproc_version(void); + +/** + * Return the libpostproc build-time configuration. + */ +const char *postproc_configuration(void); + +/** + * Return the libpostproc license. + */ +const char *postproc_license(void); + +#define PP_QUALITY_MAX 6 + +#define QP_STORE_T int8_t + +#include <inttypes.h> + +typedef void pp_context; +typedef void pp_mode; + +#if LIBPOSTPROC_VERSION_INT < (52 << 16) +typedef pp_context pp_context_t; +typedef pp_mode pp_mode_t; +extern const char *const pp_help; ///< a simple help text +#else +extern const char pp_help[]; ///< a simple help text +#endif + +void pp_postprocess(const uint8_t *src[3], const int srcStride[3], + uint8_t *dst[3], const int dstStride[3], + int horizontalSize, int verticalSize, + const QP_STORE_T *QP_store, int QP_stride, + pp_mode *mode, pp_context *ppContext, int pict_type); + + +/** + * Return a pp_mode or NULL if an error occurred. + * + * @param name the string after "-pp" on the command line + * @param quality a number from 0 to PP_QUALITY_MAX + */ +pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality); + +void pp_free_mode(pp_mode *mode); + +pp_context *pp_get_context(int width, int height, int flags); + +void pp_free_context(pp_context *ppContext); + +#define PP_CPU_CAPS_MMX 0x80000000 +#define PP_CPU_CAPS_MMX2 0x20000000 +#define PP_CPU_CAPS_3DNOW 0x40000000 +#define PP_CPU_CAPS_ALTIVEC 0x10000000 +#define PP_CPU_CAPS_AUTO 0x00080000 + +#define PP_FORMAT 0x00000008 +#define PP_FORMAT_420 (0x00000011|PP_FORMAT) +#define PP_FORMAT_422 (0x00000001|PP_FORMAT) +#define PP_FORMAT_411 (0x00000002|PP_FORMAT) +#define PP_FORMAT_444 (0x00000000|PP_FORMAT) +#define PP_FORMAT_440 (0x00000010|PP_FORMAT) + +#define PP_PICT_TYPE_QP2 0x00000010 ///< MPEG2 style QScale + +/** + * @} + */ + +#endif /* POSTPROC_POSTPROCESS_H */ diff --git a/app/src/main/cpp/include/libpostproc/version.h b/app/src/main/cpp/include/libpostproc/version.h new file mode 100644 index 0000000..a0cfa4a --- /dev/null +++ b/app/src/main/cpp/include/libpostproc/version.h @@ -0,0 +1,45 @@ +/* + * Version macros. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef POSTPROC_POSTPROCESS_VERSION_H +#define POSTPROC_POSTPROCESS_VERSION_H + +/** + * @file + * Libpostproc version macros + */ + +#include "libavutil/avutil.h" + +#define LIBPOSTPROC_VERSION_MAJOR 53 +#define LIBPOSTPROC_VERSION_MINOR 3 +#define LIBPOSTPROC_VERSION_MICRO 100 + +#define LIBPOSTPROC_VERSION_INT AV_VERSION_INT(LIBPOSTPROC_VERSION_MAJOR, \ + LIBPOSTPROC_VERSION_MINOR, \ + LIBPOSTPROC_VERSION_MICRO) +#define LIBPOSTPROC_VERSION AV_VERSION(LIBPOSTPROC_VERSION_MAJOR, \ + LIBPOSTPROC_VERSION_MINOR, \ + LIBPOSTPROC_VERSION_MICRO) +#define LIBPOSTPROC_BUILD LIBPOSTPROC_VERSION_INT + +#define LIBPOSTPROC_IDENT "postproc" AV_STRINGIFY(LIBPOSTPROC_VERSION) + +#endif /* POSTPROC_POSTPROCESS_VERSION_H */ diff --git a/app/src/main/cpp/include/libswresample/swresample.h b/app/src/main/cpp/include/libswresample/swresample.h new file mode 100644 index 0000000..b3036b7 --- /dev/null +++ b/app/src/main/cpp/include/libswresample/swresample.h @@ -0,0 +1,536 @@ +/* + * Copyright (C) 2011-2013 Michael Niedermayer (michaelni@gmx.at) + * + * This file is part of libswresample + * + * libswresample is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * libswresample is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with libswresample; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SWRESAMPLE_SWRESAMPLE_H +#define SWRESAMPLE_SWRESAMPLE_H + +/** + * @file + * @ingroup lswr + * libswresample public header + */ + +/** + * @defgroup lswr Libswresample + * @{ + * + * Libswresample (lswr) is a library that handles audio resampling, sample + * format conversion and mixing. + * + * Interaction with lswr is done through SwrContext, which is + * allocated with swr_alloc() or swr_alloc_set_opts(). It is opaque, so all parameters + * must be set with the @ref avoptions API. + * + * The first thing you will need to do in order to use lswr is to allocate + * SwrContext. This can be done with swr_alloc() or swr_alloc_set_opts(). If you + * are using the former, you must set options through the @ref avoptions API. + * The latter function provides the same feature, but it allows you to set some + * common options in the same statement. + * + * For example the following code will setup conversion from planar float sample + * format to interleaved signed 16-bit integer, downsampling from 48kHz to + * 44.1kHz and downmixing from 5.1 channels to stereo (using the default mixing + * matrix). This is using the swr_alloc() function. + * @code + * SwrContext *swr = swr_alloc(); + * av_opt_set_channel_layout(swr, "in_channel_layout", AV_CH_LAYOUT_5POINT1, 0); + * av_opt_set_channel_layout(swr, "out_channel_layout", AV_CH_LAYOUT_STEREO, 0); + * av_opt_set_int(swr, "in_sample_rate", 48000, 0); + * av_opt_set_int(swr, "out_sample_rate", 44100, 0); + * av_opt_set_sample_fmt(swr, "in_sample_fmt", AV_SAMPLE_FMT_FLTP, 0); + * av_opt_set_sample_fmt(swr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0); + * @endcode + * + * The same job can be done using swr_alloc_set_opts() as well: + * @code + * SwrContext *swr = swr_alloc_set_opts(NULL, // we're allocating a new context + * AV_CH_LAYOUT_STEREO, // out_ch_layout + * AV_SAMPLE_FMT_S16, // out_sample_fmt + * 44100, // out_sample_rate + * AV_CH_LAYOUT_5POINT1, // in_ch_layout + * AV_SAMPLE_FMT_FLTP, // in_sample_fmt + * 48000, // in_sample_rate + * 0, // log_offset + * NULL); // log_ctx + * @endcode + * + * Once all values have been set, it must be initialized with swr_init(). If + * you need to change the conversion parameters, you can change the parameters + * using @ref AVOptions, as described above in the first example; or by using + * swr_alloc_set_opts(), but with the first argument the allocated context. + * You must then call swr_init() again. + * + * The conversion itself is done by repeatedly calling swr_convert(). + * Note that the samples may get buffered in swr if you provide insufficient + * output space or if sample rate conversion is done, which requires "future" + * samples. Samples that do not require future input can be retrieved at any + * time by using swr_convert() (in_count can be set to 0). + * At the end of conversion the resampling buffer can be flushed by calling + * swr_convert() with NULL in and 0 in_count. + * + * The samples used in the conversion process can be managed with the libavutil + * @ref lavu_sampmanip "samples manipulation" API, including av_samples_alloc() + * function used in the following example. + * + * The delay between input and output, can at any time be found by using + * swr_get_delay(). + * + * The following code demonstrates the conversion loop assuming the parameters + * from above and caller-defined functions get_input() and handle_output(): + * @code + * uint8_t **input; + * int in_samples; + * + * while (get_input(&input, &in_samples)) { + * uint8_t *output; + * int out_samples = av_rescale_rnd(swr_get_delay(swr, 48000) + + * in_samples, 44100, 48000, AV_ROUND_UP); + * av_samples_alloc(&output, NULL, 2, out_samples, + * AV_SAMPLE_FMT_S16, 0); + * out_samples = swr_convert(swr, &output, out_samples, + * input, in_samples); + * handle_output(output, out_samples); + * av_freep(&output); + * } + * @endcode + * + * When the conversion is finished, the conversion + * context and everything associated with it must be freed with swr_free(). + * A swr_close() function is also available, but it exists mainly for + * compatibility with libavresample, and is not required to be called. + * + * There will be no memory leak if the data is not completely flushed before + * swr_free(). + */ + +#include <stdint.h> +#include "libavutil/frame.h" +#include "libavutil/samplefmt.h" + +#include "libswresample/version.h" + +#if LIBSWRESAMPLE_VERSION_MAJOR < 1 +#define SWR_CH_MAX 32 ///< Maximum number of channels +#endif + +/** + * @name Option constants + * These constants are used for the @ref avoptions interface for lswr. + * @{ + * + */ + +#define SWR_FLAG_RESAMPLE 1 ///< Force resampling even if equal sample rate +//TODO use int resample ? +//long term TODO can we enable this dynamically? + +/** Dithering algorithms */ +enum SwrDitherType { + SWR_DITHER_NONE = 0, + SWR_DITHER_RECTANGULAR, + SWR_DITHER_TRIANGULAR, + SWR_DITHER_TRIANGULAR_HIGHPASS, + + SWR_DITHER_NS = 64, ///< not part of API/ABI + SWR_DITHER_NS_LIPSHITZ, + SWR_DITHER_NS_F_WEIGHTED, + SWR_DITHER_NS_MODIFIED_E_WEIGHTED, + SWR_DITHER_NS_IMPROVED_E_WEIGHTED, + SWR_DITHER_NS_SHIBATA, + SWR_DITHER_NS_LOW_SHIBATA, + SWR_DITHER_NS_HIGH_SHIBATA, + SWR_DITHER_NB, ///< not part of API/ABI +}; + +/** Resampling Engines */ +enum SwrEngine { + SWR_ENGINE_SWR, /**< SW Resampler */ + SWR_ENGINE_SOXR, /**< SoX Resampler */ + SWR_ENGINE_NB, ///< not part of API/ABI +}; + +/** Resampling Filter Types */ +enum SwrFilterType { + SWR_FILTER_TYPE_CUBIC, /**< Cubic */ + SWR_FILTER_TYPE_BLACKMAN_NUTTALL, /**< Blackman Nuttall Windowed Sinc */ + SWR_FILTER_TYPE_KAISER, /**< Kaiser Windowed Sinc */ +}; + +/** + * @} + */ + +/** + * The libswresample context. Unlike libavcodec and libavformat, this structure + * is opaque. This means that if you would like to set options, you must use + * the @ref avoptions API and cannot directly set values to members of the + * structure. + */ +typedef struct SwrContext SwrContext; + +/** + * Get the AVClass for SwrContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + * @return the AVClass of SwrContext + */ +const AVClass *swr_get_class(void); + +/** + * @name SwrContext constructor functions + * @{ + */ + +/** + * Allocate SwrContext. + * + * If you use this function you will need to set the parameters (manually or + * with swr_alloc_set_opts()) before calling swr_init(). + * + * @see swr_alloc_set_opts(), swr_init(), swr_free() + * @return NULL on error, allocated context otherwise + */ +struct SwrContext *swr_alloc(void); + +/** + * Initialize context after user parameters have been set. + * @note The context must be configured using the AVOption API. + * + * @see av_opt_set_int() + * @see av_opt_set_dict() + * + * @param[in,out] s Swr context to initialize + * @return AVERROR error code in case of failure. + */ +int swr_init(struct SwrContext *s); + +/** + * Check whether an swr context has been initialized or not. + * + * @param[in] s Swr context to check + * @see swr_init() + * @return positive if it has been initialized, 0 if not initialized + */ +int swr_is_initialized(struct SwrContext *s); + +/** + * Allocate SwrContext if needed and set/reset common parameters. + * + * This function does not require s to be allocated with swr_alloc(). On the + * other hand, swr_alloc() can use swr_alloc_set_opts() to set the parameters + * on the allocated context. + * + * @param s existing Swr context if available, or NULL if not + * @param out_ch_layout output channel layout (AV_CH_LAYOUT_*) + * @param out_sample_fmt output sample format (AV_SAMPLE_FMT_*). + * @param out_sample_rate output sample rate (frequency in Hz) + * @param in_ch_layout input channel layout (AV_CH_LAYOUT_*) + * @param in_sample_fmt input sample format (AV_SAMPLE_FMT_*). + * @param in_sample_rate input sample rate (frequency in Hz) + * @param log_offset logging level offset + * @param log_ctx parent logging context, can be NULL + * + * @see swr_init(), swr_free() + * @return NULL on error, allocated context otherwise + */ +struct SwrContext *swr_alloc_set_opts(struct SwrContext *s, + int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, + int out_sample_rate, + int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, + int in_sample_rate, + int log_offset, void *log_ctx); + +/** + * @} + * + * @name SwrContext destructor functions + * @{ + */ + +/** + * Free the given SwrContext and set the pointer to NULL. + * + * @param[in] s a pointer to a pointer to Swr context + */ +void swr_free(struct SwrContext **s); + +/** + * Closes the context so that swr_is_initialized() returns 0. + * + * The context can be brought back to life by running swr_init(), + * swr_init() can also be used without swr_close(). + * This function is mainly provided for simplifying the usecase + * where one tries to support libavresample and libswresample. + * + * @param[in,out] s Swr context to be closed + */ +void swr_close(struct SwrContext *s); + +/** + * @} + * + * @name Core conversion functions + * @{ + */ + +/** Convert audio. + * + * in and in_count can be set to 0 to flush the last few samples out at the + * end. + * + * If more input is provided than output space then the input will be buffered. + * You can avoid this buffering by providing more output space than input. + * Conversion will run directly without copying whenever possible. + * + * @param s allocated Swr context, with parameters set + * @param out output buffers, only the first one need be set in case of packed audio + * @param out_count amount of space available for output in samples per channel + * @param in input buffers, only the first one need to be set in case of packed audio + * @param in_count number of input samples available in one channel + * + * @return number of samples output per channel, negative value on error + */ +int swr_convert(struct SwrContext *s, uint8_t **out, int out_count, + const uint8_t **in, int in_count); + +/** + * Convert the next timestamp from input to output + * timestamps are in 1/(in_sample_rate * out_sample_rate) units. + * + * @note There are 2 slightly differently behaving modes. + * @li When automatic timestamp compensation is not used, (min_compensation >= FLT_MAX) + * in this case timestamps will be passed through with delays compensated + * @li When automatic timestamp compensation is used, (min_compensation < FLT_MAX) + * in this case the output timestamps will match output sample numbers. + * See ffmpeg-resampler(1) for the two modes of compensation. + * + * @param s[in] initialized Swr context + * @param pts[in] timestamp for the next input sample, INT64_MIN if unknown + * @see swr_set_compensation(), swr_drop_output(), and swr_inject_silence() are + * function used internally for timestamp compensation. + * @return the output timestamp for the next output sample + */ +int64_t swr_next_pts(struct SwrContext *s, int64_t pts); + +/** + * @} + * + * @name Low-level option setting functions + * These functons provide a means to set low-level options that is not possible + * with the AVOption API. + * @{ + */ + +/** + * Activate resampling compensation ("soft" compensation). This function is + * internally called when needed in swr_next_pts(). + * + * @param[in,out] s allocated Swr context. If it is not initialized, + * or SWR_FLAG_RESAMPLE is not set, swr_init() is + * called with the flag set. + * @param[in] sample_delta delta in PTS per sample + * @param[in] compensation_distance number of samples to compensate for + * @return >= 0 on success, AVERROR error codes if: + * @li @c s is NULL, + * @li @c compensation_distance is less than 0, + * @li @c compensation_distance is 0 but sample_delta is not, + * @li compensation unsupported by resampler, or + * @li swr_init() fails when called. + */ +int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensation_distance); + +/** + * Set a customized input channel mapping. + * + * @param[in,out] s allocated Swr context, not yet initialized + * @param[in] channel_map customized input channel mapping (array of channel + * indexes, -1 for a muted channel) + * @return >= 0 on success, or AVERROR error code in case of failure. + */ +int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map); + +/** + * Set a customized remix matrix. + * + * @param s allocated Swr context, not yet initialized + * @param matrix remix coefficients; matrix[i + stride * o] is + * the weight of input channel i in output channel o + * @param stride offset between lines of the matrix + * @return >= 0 on success, or AVERROR error code in case of failure. + */ +int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride); + +/** + * @} + * + * @name Sample handling functions + * @{ + */ + +/** + * Drops the specified number of output samples. + * + * This function, along with swr_inject_silence(), is called by swr_next_pts() + * if needed for "hard" compensation. + * + * @param s allocated Swr context + * @param count number of samples to be dropped + * + * @return >= 0 on success, or a negative AVERROR code on failure + */ +int swr_drop_output(struct SwrContext *s, int count); + +/** + * Injects the specified number of silence samples. + * + * This function, along with swr_drop_output(), is called by swr_next_pts() + * if needed for "hard" compensation. + * + * @param s allocated Swr context + * @param count number of samples to be dropped + * + * @return >= 0 on success, or a negative AVERROR code on failure + */ +int swr_inject_silence(struct SwrContext *s, int count); + +/** + * Gets the delay the next input sample will experience relative to the next output sample. + * + * Swresample can buffer data if more input has been provided than available + * output space, also converting between sample rates needs a delay. + * This function returns the sum of all such delays. + * The exact delay is not necessarily an integer value in either input or + * output sample rate. Especially when downsampling by a large value, the + * output sample rate may be a poor choice to represent the delay, similarly + * for upsampling and the input sample rate. + * + * @param s swr context + * @param base timebase in which the returned delay will be: + * @li if it's set to 1 the returned delay is in seconds + * @li if it's set to 1000 the returned delay is in milliseconds + * @li if it's set to the input sample rate then the returned + * delay is in input samples + * @li if it's set to the output sample rate then the returned + * delay is in output samples + * @li if it's the least common multiple of in_sample_rate and + * out_sample_rate then an exact rounding-free delay will be + * returned + * @returns the delay in 1 / @c base units. + */ +int64_t swr_get_delay(struct SwrContext *s, int64_t base); + +/** + * @} + * + * @name Configuration accessors + * @{ + */ + +/** + * Return the @ref LIBSWRESAMPLE_VERSION_INT constant. + * + * This is useful to check if the build-time libswresample has the same version + * as the run-time one. + * + * @returns the unsigned int-typed version + */ +unsigned swresample_version(void); + +/** + * Return the swr build-time configuration. + * + * @returns the build-time @c ./configure flags + */ +const char *swresample_configuration(void); + +/** + * Return the swr license. + * + * @returns the license of libswresample, determined at build-time + */ +const char *swresample_license(void); + +/** + * @} + * + * @name AVFrame based API + * @{ + */ + +/** + * Convert the samples in the input AVFrame and write them to the output AVFrame. + * + * Input and output AVFrames must have channel_layout, sample_rate and format set. + * + * If the output AVFrame does not have the data pointers allocated the nb_samples + * field will be set using av_frame_get_buffer() + * is called to allocate the frame. + * + * The output AVFrame can be NULL or have fewer allocated samples than required. + * In this case, any remaining samples not written to the output will be added + * to an internal FIFO buffer, to be returned at the next call to this function + * or to swr_convert(). + * + * If converting sample rate, there may be data remaining in the internal + * resampling delay buffer. swr_get_delay() tells the number of + * remaining samples. To get this data as output, call this function or + * swr_convert() with NULL input. + * + * If the SwrContext configuration does not match the output and + * input AVFrame settings the conversion does not take place and depending on + * which AVFrame is not matching AVERROR_OUTPUT_CHANGED, AVERROR_INPUT_CHANGED + * or the result of a bitwise-OR of them is returned. + * + * @see swr_delay() + * @see swr_convert() + * @see swr_get_delay() + * + * @param swr audio resample context + * @param output output AVFrame + * @param input input AVFrame + * @return 0 on success, AVERROR on failure or nonmatching + * configuration. + */ +int swr_convert_frame(SwrContext *swr, + AVFrame *output, const AVFrame *input); + +/** + * Configure or reconfigure the SwrContext using the information + * provided by the AVFrames. + * + * The original resampling context is reset even on failure. + * The function calls swr_close() internally if the context is open. + * + * @see swr_close(); + * + * @param swr audio resample context + * @param output output AVFrame + * @param input input AVFrame + * @return 0 on success, AVERROR on failure. + */ +int swr_config_frame(SwrContext *swr, const AVFrame *out, const AVFrame *in); + +/** + * @} + * @} + */ + +#endif /* SWRESAMPLE_SWRESAMPLE_H */ diff --git a/app/src/main/cpp/include/libswresample/version.h b/app/src/main/cpp/include/libswresample/version.h new file mode 100644 index 0000000..5a1c4aa --- /dev/null +++ b/app/src/main/cpp/include/libswresample/version.h @@ -0,0 +1,45 @@ +/* + * Version macros. + * + * This file is part of libswresample + * + * libswresample is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * libswresample is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with libswresample; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SWR_VERSION_H +#define SWR_VERSION_H + +/** + * @file + * Libswresample version macros + */ + +#include "libavutil/avutil.h" + +#define LIBSWRESAMPLE_VERSION_MAJOR 1 +#define LIBSWRESAMPLE_VERSION_MINOR 1 +#define LIBSWRESAMPLE_VERSION_MICRO 100 + +#define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \ + LIBSWRESAMPLE_VERSION_MINOR, \ + LIBSWRESAMPLE_VERSION_MICRO) +#define LIBSWRESAMPLE_VERSION AV_VERSION(LIBSWRESAMPLE_VERSION_MAJOR, \ + LIBSWRESAMPLE_VERSION_MINOR, \ + LIBSWRESAMPLE_VERSION_MICRO) +#define LIBSWRESAMPLE_BUILD LIBSWRESAMPLE_VERSION_INT + +#define LIBSWRESAMPLE_IDENT "SwR" AV_STRINGIFY(LIBSWRESAMPLE_VERSION) + +#endif /* SWR_VERSION_H */ diff --git a/app/src/main/cpp/include/libswscale/swscale.h b/app/src/main/cpp/include/libswscale/swscale.h new file mode 100644 index 0000000..10e8585 --- /dev/null +++ b/app/src/main/cpp/include/libswscale/swscale.h @@ -0,0 +1,366 @@ +/* + * Copyright (C) 2001-2011 Michael Niedermayer <michaelni@gmx.at> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SWSCALE_SWSCALE_H +#define SWSCALE_SWSCALE_H + +/** + * @file + * @ingroup libsws + * external API header + */ + +#include <stdint.h> + +#include "libavutil/avutil.h" +#include "libavutil/log.h" +#include "libavutil/pixfmt.h" +#include "version.h" + +/** + * @defgroup libsws Color conversion and scaling + * @{ + * + * Return the LIBSWSCALE_VERSION_INT constant. + */ +unsigned swscale_version(void); + +/** + * Return the libswscale build-time configuration. + */ +const char *swscale_configuration(void); + +/** + * Return the libswscale license. + */ +const char *swscale_license(void); + +/* values for the flags, the stuff on the command line is different */ +#define SWS_FAST_BILINEAR 1 +#define SWS_BILINEAR 2 +#define SWS_BICUBIC 4 +#define SWS_X 8 +#define SWS_POINT 0x10 +#define SWS_AREA 0x20 +#define SWS_BICUBLIN 0x40 +#define SWS_GAUSS 0x80 +#define SWS_SINC 0x100 +#define SWS_LANCZOS 0x200 +#define SWS_SPLINE 0x400 + +#define SWS_SRC_V_CHR_DROP_MASK 0x30000 +#define SWS_SRC_V_CHR_DROP_SHIFT 16 + +#define SWS_PARAM_DEFAULT 123456 + +#define SWS_PRINT_INFO 0x1000 + +//the following 3 flags are not completely implemented +//internal chrominace subsampling info +#define SWS_FULL_CHR_H_INT 0x2000 +//input subsampling info +#define SWS_FULL_CHR_H_INP 0x4000 +#define SWS_DIRECT_BGR 0x8000 +#define SWS_ACCURATE_RND 0x40000 +#define SWS_BITEXACT 0x80000 +#define SWS_ERROR_DIFFUSION 0x800000 + +#if FF_API_SWS_CPU_CAPS +/** + * CPU caps are autodetected now, those flags + * are only provided for API compatibility. + */ +#define SWS_CPU_CAPS_MMX 0x80000000 +#define SWS_CPU_CAPS_MMXEXT 0x20000000 +#define SWS_CPU_CAPS_MMX2 0x20000000 +#define SWS_CPU_CAPS_3DNOW 0x40000000 +#define SWS_CPU_CAPS_ALTIVEC 0x10000000 +#if FF_API_ARCH_BFIN +#define SWS_CPU_CAPS_BFIN 0x01000000 +#endif +#define SWS_CPU_CAPS_SSE2 0x02000000 +#endif + +#define SWS_MAX_REDUCE_CUTOFF 0.002 + +#define SWS_CS_ITU709 1 +#define SWS_CS_FCC 4 +#define SWS_CS_ITU601 5 +#define SWS_CS_ITU624 5 +#define SWS_CS_SMPTE170M 5 +#define SWS_CS_SMPTE240M 7 +#define SWS_CS_DEFAULT 5 + +/** + * Return a pointer to yuv<->rgb coefficients for the given colorspace + * suitable for sws_setColorspaceDetails(). + * + * @param colorspace One of the SWS_CS_* macros. If invalid, + * SWS_CS_DEFAULT is used. + */ +const int *sws_getCoefficients(int colorspace); + +// when used for filters they must have an odd number of elements +// coeffs cannot be shared between vectors +typedef struct SwsVector { + double *coeff; ///< pointer to the list of coefficients + int length; ///< number of coefficients in the vector +} SwsVector; + +// vectors can be shared +typedef struct SwsFilter { + SwsVector *lumH; + SwsVector *lumV; + SwsVector *chrH; + SwsVector *chrV; +} SwsFilter; + +struct SwsContext; + +/** + * Return a positive value if pix_fmt is a supported input format, 0 + * otherwise. + */ +int sws_isSupportedInput(enum AVPixelFormat pix_fmt); + +/** + * Return a positive value if pix_fmt is a supported output format, 0 + * otherwise. + */ +int sws_isSupportedOutput(enum AVPixelFormat pix_fmt); + +/** + * @param[in] pix_fmt the pixel format + * @return a positive value if an endianness conversion for pix_fmt is + * supported, 0 otherwise. + */ +int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt); + +/** + * Allocate an empty SwsContext. This must be filled and passed to + * sws_init_context(). For filling see AVOptions, options.c and + * sws_setColorspaceDetails(). + */ +struct SwsContext *sws_alloc_context(void); + +/** + * Initialize the swscaler context sws_context. + * + * @return zero or positive value on success, a negative value on + * error + */ +int sws_init_context(struct SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter); + +/** + * Free the swscaler context swsContext. + * If swsContext is NULL, then does nothing. + */ +void sws_freeContext(struct SwsContext *swsContext); + +/** + * Allocate and return an SwsContext. You need it to perform + * scaling/conversion operations using sws_scale(). + * + * @param srcW the width of the source image + * @param srcH the height of the source image + * @param srcFormat the source image format + * @param dstW the width of the destination image + * @param dstH the height of the destination image + * @param dstFormat the destination image format + * @param flags specify which algorithm and options to use for rescaling + * @return a pointer to an allocated context, or NULL in case of error + * @note this function is to be removed after a saner alternative is + * written + */ +struct SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat, + int dstW, int dstH, enum AVPixelFormat dstFormat, + int flags, SwsFilter *srcFilter, + SwsFilter *dstFilter, const double *param); + +/** + * Scale the image slice in srcSlice and put the resulting scaled + * slice in the image in dst. A slice is a sequence of consecutive + * rows in an image. + * + * Slices have to be provided in sequential order, either in + * top-bottom or bottom-top order. If slices are provided in + * non-sequential order the behavior of the function is undefined. + * + * @param c the scaling context previously created with + * sws_getContext() + * @param srcSlice the array containing the pointers to the planes of + * the source slice + * @param srcStride the array containing the strides for each plane of + * the source image + * @param srcSliceY the position in the source image of the slice to + * process, that is the number (counted starting from + * zero) in the image of the first row of the slice + * @param srcSliceH the height of the source slice, that is the number + * of rows in the slice + * @param dst the array containing the pointers to the planes of + * the destination image + * @param dstStride the array containing the strides for each plane of + * the destination image + * @return the height of the output slice + */ +int sws_scale(struct SwsContext *c, const uint8_t *const srcSlice[], + const int srcStride[], int srcSliceY, int srcSliceH, + uint8_t *const dst[], const int dstStride[]); + +/** + * @param dstRange flag indicating the while-black range of the output (1=jpeg / 0=mpeg) + * @param srcRange flag indicating the while-black range of the input (1=jpeg / 0=mpeg) + * @param table the yuv2rgb coefficients describing the output yuv space, normally ff_yuv2rgb_coeffs[x] + * @param inv_table the yuv2rgb coefficients describing the input yuv space, normally ff_yuv2rgb_coeffs[x] + * @param brightness 16.16 fixed point brightness correction + * @param contrast 16.16 fixed point contrast correction + * @param saturation 16.16 fixed point saturation correction + * @return -1 if not supported + */ +int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], + int srcRange, const int table[4], int dstRange, + int brightness, int contrast, int saturation); + +/** + * @return -1 if not supported + */ +int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table, + int *srcRange, int **table, int *dstRange, + int *brightness, int *contrast, int *saturation); + +/** + * Allocate and return an uninitialized vector with length coefficients. + */ +SwsVector *sws_allocVec(int length); + +/** + * Return a normalized Gaussian curve used to filter stuff + * quality = 3 is high quality, lower is lower quality. + */ +SwsVector *sws_getGaussianVec(double variance, double quality); + +/** + * Allocate and return a vector with length coefficients, all + * with the same value c. + */ +SwsVector *sws_getConstVec(double c, int length); + +/** + * Allocate and return a vector with just one coefficient, with + * value 1.0. + */ +SwsVector *sws_getIdentityVec(void); + +/** + * Scale all the coefficients of a by the scalar value. + */ +void sws_scaleVec(SwsVector *a, double scalar); + +/** + * Scale all the coefficients of a so that their sum equals height. + */ +void sws_normalizeVec(SwsVector *a, double height); + +void sws_convVec(SwsVector *a, SwsVector *b); + +void sws_addVec(SwsVector *a, SwsVector *b); + +void sws_subVec(SwsVector *a, SwsVector *b); + +void sws_shiftVec(SwsVector *a, int shift); + +/** + * Allocate and return a clone of the vector a, that is a vector + * with the same coefficients as a. + */ +SwsVector *sws_cloneVec(SwsVector *a); + +/** + * Print with av_log() a textual representation of the vector a + * if log_level <= av_log_level. + */ +void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level); + +void sws_freeVec(SwsVector *a); + +SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, + float lumaSharpen, float chromaSharpen, + float chromaHShift, float chromaVShift, + int verbose); + +void sws_freeFilter(SwsFilter *filter); + +/** + * Check if context can be reused, otherwise reallocate a new one. + * + * If context is NULL, just calls sws_getContext() to get a new + * context. Otherwise, checks if the parameters are the ones already + * saved in context. If that is the case, returns the current + * context. Otherwise, frees context and gets a new context with + * the new parameters. + * + * Be warned that srcFilter and dstFilter are not checked, they + * are assumed to remain the same. + */ +struct SwsContext *sws_getCachedContext(struct SwsContext *context, + int srcW, int srcH, enum AVPixelFormat srcFormat, + int dstW, int dstH, enum AVPixelFormat dstFormat, + int flags, SwsFilter *srcFilter, + SwsFilter *dstFilter, const double *param); + +/** + * Convert an 8-bit paletted frame into a frame with a color depth of 32 bits. + * + * The output frame will have the same packed format as the palette. + * + * @param src source frame buffer + * @param dst destination frame buffer + * @param num_pixels number of pixels to convert + * @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src + */ +void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, int num_pixels, + const uint8_t *palette); + +/** + * Convert an 8-bit paletted frame into a frame with a color depth of 24 bits. + * + * With the palette format "ABCD", the destination frame ends up with the format "ABC". + * + * @param src source frame buffer + * @param dst destination frame buffer + * @param num_pixels number of pixels to convert + * @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src + */ +void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, + const uint8_t *palette); + +/** + * Get the AVClass for swsContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *sws_get_class(void); + +/** + * @} + */ + +#endif /* SWSCALE_SWSCALE_H */ diff --git a/app/src/main/cpp/include/libswscale/version.h b/app/src/main/cpp/include/libswscale/version.h new file mode 100644 index 0000000..caad84e --- /dev/null +++ b/app/src/main/cpp/include/libswscale/version.h @@ -0,0 +1,56 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SWSCALE_VERSION_H +#define SWSCALE_VERSION_H + +/** + * @file + * swscale version macros + */ + +#include "libavutil/version.h" + +#define LIBSWSCALE_VERSION_MAJOR 3 +#define LIBSWSCALE_VERSION_MINOR 1 +#define LIBSWSCALE_VERSION_MICRO 101 + +#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ + LIBSWSCALE_VERSION_MINOR, \ + LIBSWSCALE_VERSION_MICRO) +#define LIBSWSCALE_VERSION AV_VERSION(LIBSWSCALE_VERSION_MAJOR, \ + LIBSWSCALE_VERSION_MINOR, \ + LIBSWSCALE_VERSION_MICRO) +#define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT + +#define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION) + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + */ + +#ifndef FF_API_SWS_CPU_CAPS +#define FF_API_SWS_CPU_CAPS (LIBSWSCALE_VERSION_MAJOR < 4) +#endif +#ifndef FF_API_ARCH_BFIN +#define FF_API_ARCH_BFIN (LIBSWSCALE_VERSION_MAJOR < 4) +#endif + +#endif /* SWSCALE_VERSION_H */ diff --git a/app/src/main/cpp/include/libyuv/include/libyuv.h b/app/src/main/cpp/include/libyuv/include/libyuv.h new file mode 100644 index 0000000..3bebe64 --- /dev/null +++ b/app/src/main/cpp/include/libyuv/include/libyuv.h @@ -0,0 +1,33 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_H_ // NOLINT +#define INCLUDE_LIBYUV_H_ + +#include "libyuv/basic_types.h" +#include "libyuv/compare.h" +#include "libyuv/convert.h" +#include "libyuv/convert_argb.h" +#include "libyuv/convert_from.h" +#include "libyuv/convert_from_argb.h" +#include "libyuv/cpu_id.h" +#include "libyuv/format_conversion.h" +#include "libyuv/mjpeg_decoder.h" +#include "libyuv/planar_functions.h" +#include "libyuv/rotate.h" +#include "libyuv/rotate_argb.h" +#include "libyuv/row.h" +#include "libyuv/scale.h" +#include "libyuv/scale_argb.h" +#include "libyuv/scale_row.h" +#include "libyuv/version.h" +#include "libyuv/video_common.h" + +#endif // INCLUDE_LIBYUV_H_ NOLINT diff --git a/app/src/main/cpp/include/libyuv/include/libyuv/basic_types.h b/app/src/main/cpp/include/libyuv/include/libyuv/basic_types.h new file mode 100644 index 0000000..e389d14 --- /dev/null +++ b/app/src/main/cpp/include/libyuv/include/libyuv/basic_types.h @@ -0,0 +1,120 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_BASIC_TYPES_H_ // NOLINT +#define INCLUDE_LIBYUV_BASIC_TYPES_H_ + +#include <stddef.h> // for NULL, size_t + +#if defined(__ANDROID__) || (defined(_MSC_VER) && (_MSC_VER < 1600)) +#include <sys/types.h> // for uintptr_t on x86 +#else + +#include <stdint.h> // for uintptr_t + +#endif + +#ifndef GG_LONGLONG +#ifndef INT_TYPES_DEFINED +#define INT_TYPES_DEFINED +#ifdef COMPILER_MSVC +typedef unsigned __int64 uint64; +typedef __int64 int64; +#ifndef INT64_C +#define INT64_C(x) x ## I64 +#endif +#ifndef UINT64_C +#define UINT64_C(x) x ## UI64 +#endif +#define INT64_F "I64" +#else // COMPILER_MSVC +#if defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__) +typedef unsigned long uint64; // NOLINT +typedef long int64; // NOLINT +#ifndef INT64_C +#define INT64_C(x) x ## L +#endif +#ifndef UINT64_C +#define UINT64_C(x) x ## UL +#endif +#define INT64_F "l" +#else // defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__) +typedef unsigned long long uint64; // NOLINT +typedef long long int64; // NOLINT +#ifndef INT64_C +#define INT64_C(x) x ## LL +#endif +#ifndef UINT64_C +#define UINT64_C(x) x ## ULL +#endif +#define INT64_F "ll" +#endif // __LP64__ +#endif // COMPILER_MSVC +typedef unsigned int uint32; +typedef int int32; +typedef unsigned short uint16; // NOLINT +typedef short int16; // NOLINT +typedef unsigned char uint8; +typedef signed char int8; +#endif // INT_TYPES_DEFINED +#endif // GG_LONGLONG + +// Detect compiler is for x86 or x64. +#if defined(__x86_64__) || defined(_M_X64) || \ + defined(__i386__) || defined(_M_IX86) +#define CPU_X86 1 +#endif +// Detect compiler is for ARM. +#if defined(__arm__) || defined(_M_ARM) +#define CPU_ARM 1 +#endif + +#ifndef ALIGNP +#ifdef __cplusplus +#define ALIGNP(p, t) \ + (reinterpret_cast<uint8*>(((reinterpret_cast<uintptr_t>(p) + \ + ((t) - 1)) & ~((t) - 1)))) +#else +#define ALIGNP(p, t) \ + ((uint8*)((((uintptr_t)(p) + ((t) - 1)) & ~((t) - 1)))) /* NOLINT */ +#endif +#endif + +#if !defined(LIBYUV_API) +#if defined(_WIN32) || defined(__CYGWIN__) +#if defined(LIBYUV_BUILDING_SHARED_LIBRARY) +#define LIBYUV_API __declspec(dllexport) +#elif defined(LIBYUV_USING_SHARED_LIBRARY) +#define LIBYUV_API __declspec(dllimport) +#else +#define LIBYUV_API +#endif // LIBYUV_BUILDING_SHARED_LIBRARY +#elif defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__APPLE__) && \ + (defined(LIBYUV_BUILDING_SHARED_LIBRARY) || \ + defined(LIBYUV_USING_SHARED_LIBRARY)) +#define LIBYUV_API __attribute__ ((visibility ("default"))) +#else +#define LIBYUV_API +#endif // __GNUC__ +#endif // LIBYUV_API + +#define LIBYUV_BOOL int +#define LIBYUV_FALSE 0 +#define LIBYUV_TRUE 1 + +// Visual C x86 or GCC little endian. +#if defined(__x86_64__) || defined(_M_X64) || \ + defined(__i386__) || defined(_M_IX86) || \ + defined(__arm__) || defined(_M_ARM) || \ + (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) +#define LIBYUV_LITTLE_ENDIAN +#endif + +#endif // INCLUDE_LIBYUV_BASIC_TYPES_H_ NOLINT diff --git a/app/src/main/cpp/include/libyuv/include/libyuv/compare.h b/app/src/main/cpp/include/libyuv/include/libyuv/compare.h new file mode 100644 index 0000000..3e5b278 --- /dev/null +++ b/app/src/main/cpp/include/libyuv/include/libyuv/compare.h @@ -0,0 +1,78 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_COMPARE_H_ // NOLINT +#define INCLUDE_LIBYUV_COMPARE_H_ + +#include "../libyuv/basic_types.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +// Compute a hash for specified memory. Seed of 5381 recommended. +LIBYUV_API +uint32 HashDjb2(const uint8 *src, uint64 count, uint32 seed); + +// Scan an opaque argb image and return fourcc based on alpha offset. +// Returns FOURCC_ARGB, FOURCC_BGRA, or 0 if unknown. +LIBYUV_API +uint32 ARGBDetect(const uint8 *argb, int stride_argb, int width, int height); + +// Sum Square Error - used to compute Mean Square Error or PSNR. +LIBYUV_API +uint64 ComputeSumSquareError(const uint8 *src_a, + const uint8 *src_b, int count); + +LIBYUV_API +uint64 ComputeSumSquareErrorPlane(const uint8 *src_a, int stride_a, + const uint8 *src_b, int stride_b, + int width, int height); + +static const int kMaxPsnr = 128; + +LIBYUV_API +double SumSquareErrorToPsnr(uint64 sse, uint64 count); + +LIBYUV_API +double CalcFramePsnr(const uint8 *src_a, int stride_a, + const uint8 *src_b, int stride_b, + int width, int height); + +LIBYUV_API +double I420Psnr(const uint8 *src_y_a, int stride_y_a, + const uint8 *src_u_a, int stride_u_a, + const uint8 *src_v_a, int stride_v_a, + const uint8 *src_y_b, int stride_y_b, + const uint8 *src_u_b, int stride_u_b, + const uint8 *src_v_b, int stride_v_b, + int width, int height); + +LIBYUV_API +double CalcFrameSsim(const uint8 *src_a, int stride_a, + const uint8 *src_b, int stride_b, + int width, int height); + +LIBYUV_API +double I420Ssim(const uint8 *src_y_a, int stride_y_a, + const uint8 *src_u_a, int stride_u_a, + const uint8 *src_v_a, int stride_v_a, + const uint8 *src_y_b, int stride_y_b, + const uint8 *src_u_b, int stride_u_b, + const uint8 *src_v_b, int stride_v_b, + int width, int height); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_COMPARE_H_ NOLINT diff --git a/app/src/main/cpp/include/libyuv/include/libyuv/convert.h b/app/src/main/cpp/include/libyuv/include/libyuv/convert.h new file mode 100644 index 0000000..58c2805 --- /dev/null +++ b/app/src/main/cpp/include/libyuv/include/libyuv/convert.h @@ -0,0 +1,254 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_CONVERT_H_ // NOLINT +#define INCLUDE_LIBYUV_CONVERT_H_ + +#include "../libyuv/basic_types.h" +// TODO(fbarchard): Remove the following headers includes. +#include "../libyuv/convert_from.h" +#include "../libyuv/planar_functions.h" +#include "../libyuv/rotate.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +// Convert I444 to I420. +LIBYUV_API +int I444ToI420(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Convert I422 to I420. +LIBYUV_API +int I422ToI420(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Convert I411 to I420. +LIBYUV_API +int I411ToI420(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Copy I420 to I420. +#define I420ToI420 I420Copy +LIBYUV_API +int I420Copy(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Convert I400 (grey) to I420. +LIBYUV_API +int I400ToI420(const uint8 *src_y, int src_stride_y, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Convert NV12 to I420. +LIBYUV_API +int NV12ToI420(const uint8 *src_y, int src_stride_y, + const uint8 *src_uv, int src_stride_uv, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Convert NV21 to I420. +LIBYUV_API +int NV21ToI420(const uint8 *src_y, int src_stride_y, + const uint8 *src_vu, int src_stride_vu, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Convert YUY2 to I420. +LIBYUV_API +int YUY2ToI420(const uint8 *src_yuy2, int src_stride_yuy2, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Convert UYVY to I420. +LIBYUV_API +int UYVYToI420(const uint8 *src_uyvy, int src_stride_uyvy, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Convert M420 to I420. +LIBYUV_API +int M420ToI420(const uint8 *src_m420, int src_stride_m420, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Convert Q420 to I420. +LIBYUV_API +int Q420ToI420(const uint8 *src_y, int src_stride_y, + const uint8 *src_yuy2, int src_stride_yuy2, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// ARGB little endian (bgra in memory) to I420. +LIBYUV_API +int ARGBToI420(const uint8 *src_frame, int src_stride_frame, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// BGRA little endian (argb in memory) to I420. +LIBYUV_API +int BGRAToI420(const uint8 *src_frame, int src_stride_frame, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// ABGR little endian (rgba in memory) to I420. +LIBYUV_API +int ABGRToI420(const uint8 *src_frame, int src_stride_frame, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// RGBA little endian (abgr in memory) to I420. +LIBYUV_API +int RGBAToI420(const uint8 *src_frame, int src_stride_frame, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// RGB little endian (bgr in memory) to I420. +LIBYUV_API +int RGB24ToI420(const uint8 *src_frame, int src_stride_frame, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// RGB big endian (rgb in memory) to I420. +LIBYUV_API +int RAWToI420(const uint8 *src_frame, int src_stride_frame, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// RGB16 (RGBP fourcc) little endian to I420. +LIBYUV_API +int RGB565ToI420(const uint8 *src_frame, int src_stride_frame, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// RGB15 (RGBO fourcc) little endian to I420. +LIBYUV_API +int ARGB1555ToI420(const uint8 *src_frame, int src_stride_frame, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// RGB12 (R444 fourcc) little endian to I420. +LIBYUV_API +int ARGB4444ToI420(const uint8 *src_frame, int src_stride_frame, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +#ifdef HAVE_JPEG +// src_width/height provided by capture. +// dst_width/height for clipping determine final size. +LIBYUV_API +int MJPGToI420(const uint8* sample, size_t sample_size, + uint8* dst_y, int dst_stride_y, + uint8* dst_u, int dst_stride_u, + uint8* dst_v, int dst_stride_v, + int src_width, int src_height, + int dst_width, int dst_height); + +// Query size of MJPG in pixels. +LIBYUV_API +int MJPGSize(const uint8* sample, size_t sample_size, + int* width, int* height); +#endif + +// Note Bayer formats (BGGR) To I420 are in format_conversion.h + +// Convert camera sample to I420 with cropping, rotation and vertical flip. +// "src_size" is needed to parse MJPG. +// "dst_stride_y" number of bytes in a row of the dst_y plane. +// Normally this would be the same as dst_width, with recommended alignment +// to 16 bytes for better efficiency. +// If rotation of 90 or 270 is used, stride is affected. The caller should +// allocate the I420 buffer according to rotation. +// "dst_stride_u" number of bytes in a row of the dst_u plane. +// Normally this would be the same as (dst_width + 1) / 2, with +// recommended alignment to 16 bytes for better efficiency. +// If rotation of 90 or 270 is used, stride is affected. +// "crop_x" and "crop_y" are starting position for cropping. +// To center, crop_x = (src_width - dst_width) / 2 +// crop_y = (src_height - dst_height) / 2 +// "src_width" / "src_height" is size of src_frame in pixels. +// "src_height" can be negative indicating a vertically flipped image source. +// "crop_width" / "crop_height" is the size to crop the src to. +// Must be less than or equal to src_width/src_height +// Cropping parameters are pre-rotation. +// "rotation" can be 0, 90, 180 or 270. +// "format" is a fourcc. ie 'I420', 'YUY2' +// Returns 0 for successful; -1 for invalid parameter. Non-zero for failure. +LIBYUV_API +int ConvertToI420(const uint8 *src_frame, size_t src_size, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int crop_x, int crop_y, + int src_width, int src_height, + int crop_width, int crop_height, + enum RotationMode rotation, + uint32 format); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_CONVERT_H_ NOLINT diff --git a/app/src/main/cpp/include/libyuv/include/libyuv/convert_argb.h b/app/src/main/cpp/include/libyuv/include/libyuv/convert_argb.h new file mode 100644 index 0000000..a94cad4 --- /dev/null +++ b/app/src/main/cpp/include/libyuv/include/libyuv/convert_argb.h @@ -0,0 +1,241 @@ +/* + * Copyright 2012 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_CONVERT_ARGB_H_ // NOLINT +#define INCLUDE_LIBYUV_CONVERT_ARGB_H_ + +#include "../libyuv/basic_types.h" +// TODO(fbarchard): Remove the following headers includes +#include "../libyuv/convert_from.h" +#include "../libyuv/planar_functions.h" +#include "../libyuv/rotate.h" + +// TODO(fbarchard): This set of functions should exactly match convert.h +// Add missing Q420. +// TODO(fbarchard): Add tests. Create random content of right size and convert +// with C vs Opt and or to I420 and compare. +// TODO(fbarchard): Some of these functions lack parameter setting. + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +// Alias. +#define ARGBToARGB ARGBCopy + +// Copy ARGB to ARGB. +LIBYUV_API +int ARGBCopy(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Convert I420 to ARGB. +LIBYUV_API +int I420ToARGB(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Convert I422 to ARGB. +LIBYUV_API +int I422ToARGB(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Convert I444 to ARGB. +LIBYUV_API +int I444ToARGB(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Convert I411 to ARGB. +LIBYUV_API +int I411ToARGB(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Convert I400 (grey) to ARGB. +LIBYUV_API +int I400ToARGB(const uint8 *src_y, int src_stride_y, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Alias. +#define YToARGB I400ToARGB_Reference + +// Convert I400 to ARGB. Reverse of ARGBToI400. +LIBYUV_API +int I400ToARGB_Reference(const uint8 *src_y, int src_stride_y, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Convert NV12 to ARGB. +LIBYUV_API +int NV12ToARGB(const uint8 *src_y, int src_stride_y, + const uint8 *src_uv, int src_stride_uv, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Convert NV21 to ARGB. +LIBYUV_API +int NV21ToARGB(const uint8 *src_y, int src_stride_y, + const uint8 *src_vu, int src_stride_vu, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Convert M420 to ARGB. +LIBYUV_API +int M420ToARGB(const uint8 *src_m420, int src_stride_m420, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// TODO(fbarchard): Convert Q420 to ARGB. +// LIBYUV_API +// int Q420ToARGB(const uint8* src_y, int src_stride_y, +// const uint8* src_yuy2, int src_stride_yuy2, +// uint8* dst_argb, int dst_stride_argb, +// int width, int height); + +// Convert YUY2 to ARGB. +LIBYUV_API +int YUY2ToARGB(const uint8 *src_yuy2, int src_stride_yuy2, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Convert UYVY to ARGB. +LIBYUV_API +int UYVYToARGB(const uint8 *src_uyvy, int src_stride_uyvy, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Convert J420 to ARGB. +LIBYUV_API +int J420ToARGB(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Convert J422 to ARGB. +LIBYUV_API +int J422ToARGB(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// BGRA little endian (argb in memory) to ARGB. +LIBYUV_API +int BGRAToARGB(const uint8 *src_frame, int src_stride_frame, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// ABGR little endian (rgba in memory) to ARGB. +LIBYUV_API +int ABGRToARGB(const uint8 *src_frame, int src_stride_frame, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// RGBA little endian (abgr in memory) to ARGB. +LIBYUV_API +int RGBAToARGB(const uint8 *src_frame, int src_stride_frame, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Deprecated function name. +#define BG24ToARGB RGB24ToARGB + +// RGB little endian (bgr in memory) to ARGB. +LIBYUV_API +int RGB24ToARGB(const uint8 *src_frame, int src_stride_frame, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// RGB big endian (rgb in memory) to ARGB. +LIBYUV_API +int RAWToARGB(const uint8 *src_frame, int src_stride_frame, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// RGB16 (RGBP fourcc) little endian to ARGB. +LIBYUV_API +int RGB565ToARGB(const uint8 *src_frame, int src_stride_frame, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// RGB15 (RGBO fourcc) little endian to ARGB. +LIBYUV_API +int ARGB1555ToARGB(const uint8 *src_frame, int src_stride_frame, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// RGB12 (R444 fourcc) little endian to ARGB. +LIBYUV_API +int ARGB4444ToARGB(const uint8 *src_frame, int src_stride_frame, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +#ifdef HAVE_JPEG +// src_width/height provided by capture +// dst_width/height for clipping determine final size. +LIBYUV_API +int MJPGToARGB(const uint8* sample, size_t sample_size, + uint8* dst_argb, int dst_stride_argb, + int src_width, int src_height, + int dst_width, int dst_height); +#endif + +// Note Bayer formats (BGGR) to ARGB are in format_conversion.h. + +// Convert camera sample to ARGB with cropping, rotation and vertical flip. +// "src_size" is needed to parse MJPG. +// "dst_stride_argb" number of bytes in a row of the dst_argb plane. +// Normally this would be the same as dst_width, with recommended alignment +// to 16 bytes for better efficiency. +// If rotation of 90 or 270 is used, stride is affected. The caller should +// allocate the I420 buffer according to rotation. +// "dst_stride_u" number of bytes in a row of the dst_u plane. +// Normally this would be the same as (dst_width + 1) / 2, with +// recommended alignment to 16 bytes for better efficiency. +// If rotation of 90 or 270 is used, stride is affected. +// "crop_x" and "crop_y" are starting position for cropping. +// To center, crop_x = (src_width - dst_width) / 2 +// crop_y = (src_height - dst_height) / 2 +// "src_width" / "src_height" is size of src_frame in pixels. +// "src_height" can be negative indicating a vertically flipped image source. +// "crop_width" / "crop_height" is the size to crop the src to. +// Must be less than or equal to src_width/src_height +// Cropping parameters are pre-rotation. +// "rotation" can be 0, 90, 180 or 270. +// "format" is a fourcc. ie 'I420', 'YUY2' +// Returns 0 for successful; -1 for invalid parameter. Non-zero for failure. +LIBYUV_API +int ConvertToARGB(const uint8 *src_frame, size_t src_size, + uint8 *dst_argb, int dst_stride_argb, + int crop_x, int crop_y, + int src_width, int src_height, + int crop_width, int crop_height, + enum RotationMode rotation, + uint32 format); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_CONVERT_ARGB_H_ NOLINT diff --git a/app/src/main/cpp/include/libyuv/include/libyuv/convert_from.h b/app/src/main/cpp/include/libyuv/include/libyuv/convert_from.h new file mode 100644 index 0000000..8c611b4 --- /dev/null +++ b/app/src/main/cpp/include/libyuv/include/libyuv/convert_from.h @@ -0,0 +1,173 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_CONVERT_FROM_H_ // NOLINT +#define INCLUDE_LIBYUV_CONVERT_FROM_H_ + +#include "../libyuv/basic_types.h" +#include "../libyuv/rotate.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +// See Also convert.h for conversions from formats to I420. + +// I420Copy in convert to I420ToI420. + +LIBYUV_API +int I420ToI422(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +LIBYUV_API +int I420ToI444(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +LIBYUV_API +int I420ToI411(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Copy to I400. Source can be I420, I422, I444, I400, NV12 or NV21. +LIBYUV_API +int I400Copy(const uint8 *src_y, int src_stride_y, + uint8 *dst_y, int dst_stride_y, + int width, int height); + +// TODO(fbarchard): I420ToM420 +// TODO(fbarchard): I420ToQ420 + +LIBYUV_API +int I420ToNV12(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_uv, int dst_stride_uv, + int width, int height); + +LIBYUV_API +int I420ToNV21(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_vu, int dst_stride_vu, + int width, int height); + +LIBYUV_API +int I420ToYUY2(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_frame, int dst_stride_frame, + int width, int height); + +LIBYUV_API +int I420ToUYVY(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_frame, int dst_stride_frame, + int width, int height); + +LIBYUV_API +int I420ToARGB(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +LIBYUV_API +int I420ToBGRA(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +LIBYUV_API +int I420ToABGR(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +LIBYUV_API +int I420ToRGBA(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_rgba, int dst_stride_rgba, + int width, int height); + +LIBYUV_API +int I420ToRGB24(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_frame, int dst_stride_frame, + int width, int height); + +LIBYUV_API +int I420ToRAW(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_frame, int dst_stride_frame, + int width, int height); + +LIBYUV_API +int I420ToRGB565(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_frame, int dst_stride_frame, + int width, int height); + +LIBYUV_API +int I420ToARGB1555(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_frame, int dst_stride_frame, + int width, int height); + +LIBYUV_API +int I420ToARGB4444(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_frame, int dst_stride_frame, + int width, int height); + +// Note Bayer formats (BGGR) To I420 are in format_conversion.h. + +// Convert I420 to specified format. +// "dst_sample_stride" is bytes in a row for the destination. Pass 0 if the +// buffer has contiguous rows. Can be negative. A multiple of 16 is optimal. +LIBYUV_API +int ConvertFromI420(const uint8 *y, int y_stride, + const uint8 *u, int u_stride, + const uint8 *v, int v_stride, + uint8 *dst_sample, int dst_sample_stride, + int width, int height, + uint32 format); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_CONVERT_FROM_H_ NOLINT diff --git a/app/src/main/cpp/include/libyuv/include/libyuv/convert_from_argb.h b/app/src/main/cpp/include/libyuv/include/libyuv/convert_from_argb.h new file mode 100644 index 0000000..c7c65b1 --- /dev/null +++ b/app/src/main/cpp/include/libyuv/include/libyuv/convert_from_argb.h @@ -0,0 +1,174 @@ +/* + * Copyright 2012 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_CONVERT_FROM_ARGB_H_ // NOLINT +#define INCLUDE_LIBYUV_CONVERT_FROM_ARGB_H_ + +#include "../libyuv/basic_types.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +// Copy ARGB to ARGB. +#define ARGBToARGB ARGBCopy +LIBYUV_API +int ARGBCopy(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Convert ARGB To BGRA. +LIBYUV_API +int ARGBToBGRA(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_bgra, int dst_stride_bgra, + int width, int height); + +// Convert ARGB To ABGR. +LIBYUV_API +int ARGBToABGR(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_abgr, int dst_stride_abgr, + int width, int height); + +// Convert ARGB To RGBA. +LIBYUV_API +int ARGBToRGBA(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_rgba, int dst_stride_rgba, + int width, int height); + +// Convert ARGB To RGB24. +LIBYUV_API +int ARGBToRGB24(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_rgb24, int dst_stride_rgb24, + int width, int height); + +// Convert ARGB To RAW. +LIBYUV_API +int ARGBToRAW(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_rgb, int dst_stride_rgb, + int width, int height); + +// Convert ARGB To RGB565. +LIBYUV_API +int ARGBToRGB565(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_rgb565, int dst_stride_rgb565, + int width, int height); + +// Convert ARGB To ARGB1555. +LIBYUV_API +int ARGBToARGB1555(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_argb1555, int dst_stride_argb1555, + int width, int height); + +// Convert ARGB To ARGB4444. +LIBYUV_API +int ARGBToARGB4444(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_argb4444, int dst_stride_argb4444, + int width, int height); + +// Convert ARGB To I444. +LIBYUV_API +int ARGBToI444(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Convert ARGB To I422. +LIBYUV_API +int ARGBToI422(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Convert ARGB To I420. (also in convert.h) +LIBYUV_API +int ARGBToI420(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Convert ARGB to J420. (JPeg full range I420). +LIBYUV_API +int ARGBToJ420(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_yj, int dst_stride_yj, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Convert ARGB to J422. +LIBYUV_API +int ARGBToJ422(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_yj, int dst_stride_yj, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Convert ARGB To I411. +LIBYUV_API +int ARGBToI411(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Convert ARGB to J400. (JPeg full range). +LIBYUV_API +int ARGBToJ400(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_yj, int dst_stride_yj, + int width, int height); + +// Convert ARGB to I400. +LIBYUV_API +int ARGBToI400(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_y, int dst_stride_y, + int width, int height); + +// Convert ARGB To NV12. +LIBYUV_API +int ARGBToNV12(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_uv, int dst_stride_uv, + int width, int height); + +// Convert ARGB To NV21. +LIBYUV_API +int ARGBToNV21(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_vu, int dst_stride_vu, + int width, int height); + +// Convert ARGB To NV21. +LIBYUV_API +int ARGBToNV21(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_vu, int dst_stride_vu, + int width, int height); + +// Convert ARGB To YUY2. +LIBYUV_API +int ARGBToYUY2(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_yuy2, int dst_stride_yuy2, + int width, int height); + +// Convert ARGB To UYVY. +LIBYUV_API +int ARGBToUYVY(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_uyvy, int dst_stride_uyvy, + int width, int height); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_CONVERT_FROM_ARGB_H_ NOLINT diff --git a/app/src/main/cpp/include/libyuv/include/libyuv/cpu_id.h b/app/src/main/cpp/include/libyuv/include/libyuv/cpu_id.h new file mode 100644 index 0000000..05448f0 --- /dev/null +++ b/app/src/main/cpp/include/libyuv/include/libyuv/cpu_id.h @@ -0,0 +1,81 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_CPU_ID_H_ // NOLINT +#define INCLUDE_LIBYUV_CPU_ID_H_ + +#include "../libyuv/basic_types.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +// TODO(fbarchard): Consider overlapping bits for different architectures. +// Internal flag to indicate cpuid requires initialization. +#define kCpuInit 0x1 + +// These flags are only valid on ARM processors. +static const int kCpuHasARM = 0x2; +static const int kCpuHasNEON = 0x4; +// 0x8 reserved for future ARM flag. + +// These flags are only valid on x86 processors. +static const int kCpuHasX86 = 0x10; +static const int kCpuHasSSE2 = 0x20; +static const int kCpuHasSSSE3 = 0x40; +static const int kCpuHasSSE41 = 0x80; +static const int kCpuHasSSE42 = 0x100; +static const int kCpuHasAVX = 0x200; +static const int kCpuHasAVX2 = 0x400; +static const int kCpuHasERMS = 0x800; +static const int kCpuHasFMA3 = 0x1000; +// 0x2000, 0x4000, 0x8000 reserved for future X86 flags. + +// These flags are only valid on MIPS processors. +static const int kCpuHasMIPS = 0x10000; +static const int kCpuHasMIPS_DSP = 0x20000; +static const int kCpuHasMIPS_DSPR2 = 0x40000; + +// Internal function used to auto-init. +LIBYUV_API +int InitCpuFlags(void); + +// Internal function for parsing /proc/cpuinfo. +LIBYUV_API +int ArmCpuCaps(const char *cpuinfo_name); + +// Detect CPU has SSE2 etc. +// Test_flag parameter should be one of kCpuHas constants above. +// returns non-zero if instruction set is detected +static __inline int TestCpuFlag(int test_flag) { + LIBYUV_API extern int cpu_info_; + return (cpu_info_ == kCpuInit ? InitCpuFlags() : cpu_info_) & test_flag; +} + +// For testing, allow CPU flags to be disabled. +// ie MaskCpuFlags(~kCpuHasSSSE3) to disable SSSE3. +// MaskCpuFlags(-1) to enff able all cpu specific optimizations. +// MaskCpuFlags(0) to disable all cpu specific optimizations. +LIBYUV_API +void MaskCpuFlags(int enable_flags); + +// Low level cpuid for X86. Returns zeros on other CPUs. +// eax is the info type that you want. +// ecx is typically the cpu number, and should normally be zero. +LIBYUV_API +void CpuId(uint32 eax, uint32 ecx, uint32 *cpu_info); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_CPU_ID_H_ NOLINT diff --git a/app/src/main/cpp/include/libyuv/include/libyuv/format_conversion.h b/app/src/main/cpp/include/libyuv/include/libyuv/format_conversion.h new file mode 100644 index 0000000..f1695b4 --- /dev/null +++ b/app/src/main/cpp/include/libyuv/include/libyuv/format_conversion.h @@ -0,0 +1,168 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_FORMATCONVERSION_H_ // NOLINT +#define INCLUDE_LIBYUV_FORMATCONVERSION_H_ + +#include "../libyuv/basic_types.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +// Convert Bayer RGB formats to I420. +LIBYUV_API +int BayerBGGRToI420(const uint8 *src_bayer, int src_stride_bayer, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +LIBYUV_API +int BayerGBRGToI420(const uint8 *src_bayer, int src_stride_bayer, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +LIBYUV_API +int BayerGRBGToI420(const uint8 *src_bayer, int src_stride_bayer, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +LIBYUV_API +int BayerRGGBToI420(const uint8 *src_bayer, int src_stride_bayer, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Temporary API mapper. +#define BayerRGBToI420(b, bs, f, y, ys, u, us, v, vs, w, h) \ + BayerToI420(b, bs, y, ys, u, us, v, vs, w, h, f) + +LIBYUV_API +int BayerToI420(const uint8 *src_bayer, int src_stride_bayer, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height, + uint32 src_fourcc_bayer); + +// Convert I420 to Bayer RGB formats. +LIBYUV_API +int I420ToBayerBGGR(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_frame, int dst_stride_frame, + int width, int height); + +LIBYUV_API +int I420ToBayerGBRG(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_frame, int dst_stride_frame, + int width, int height); + +LIBYUV_API +int I420ToBayerGRBG(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_frame, int dst_stride_frame, + int width, int height); + +LIBYUV_API +int I420ToBayerRGGB(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_frame, int dst_stride_frame, + int width, int height); + +// Temporary API mapper. +#define I420ToBayerRGB(y, ys, u, us, v, vs, b, bs, f, w, h) \ + I420ToBayer(y, ys, u, us, v, vs, b, bs, w, h, f) + +LIBYUV_API +int I420ToBayer(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_frame, int dst_stride_frame, + int width, int height, + uint32 dst_fourcc_bayer); + +// Convert Bayer RGB formats to ARGB. +LIBYUV_API +int BayerBGGRToARGB(const uint8 *src_bayer, int src_stride_bayer, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +LIBYUV_API +int BayerGBRGToARGB(const uint8 *src_bayer, int src_stride_bayer, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +LIBYUV_API +int BayerGRBGToARGB(const uint8 *src_bayer, int src_stride_bayer, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +LIBYUV_API +int BayerRGGBToARGB(const uint8 *src_bayer, int src_stride_bayer, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Temporary API mapper. +#define BayerRGBToARGB(b, bs, f, a, as, w, h) BayerToARGB(b, bs, a, as, w, h, f) + +LIBYUV_API +int BayerToARGB(const uint8 *src_bayer, int src_stride_bayer, + uint8 *dst_argb, int dst_stride_argb, + int width, int height, + uint32 src_fourcc_bayer); + +// Converts ARGB to Bayer RGB formats. +LIBYUV_API +int ARGBToBayerBGGR(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_bayer, int dst_stride_bayer, + int width, int height); + +LIBYUV_API +int ARGBToBayerGBRG(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_bayer, int dst_stride_bayer, + int width, int height); + +LIBYUV_API +int ARGBToBayerGRBG(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_bayer, int dst_stride_bayer, + int width, int height); + +LIBYUV_API +int ARGBToBayerRGGB(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_bayer, int dst_stride_bayer, + int width, int height); + +// Temporary API mapper. +#define ARGBToBayerRGB(a, as, b, bs, f, w, h) ARGBToBayer(b, bs, a, as, w, h, f) + +LIBYUV_API +int ARGBToBayer(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_bayer, int dst_stride_bayer, + int width, int height, + uint32 dst_fourcc_bayer); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_FORMATCONVERSION_H_ NOLINT diff --git a/app/src/main/cpp/include/libyuv/include/libyuv/mjpeg_decoder.h b/app/src/main/cpp/include/libyuv/include/libyuv/mjpeg_decoder.h new file mode 100644 index 0000000..1b3a8d1 --- /dev/null +++ b/app/src/main/cpp/include/libyuv/include/libyuv/mjpeg_decoder.h @@ -0,0 +1,192 @@ +/* + * Copyright 2012 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_MJPEG_DECODER_H_ // NOLINT +#define INCLUDE_LIBYUV_MJPEG_DECODER_H_ + +#include "../libyuv/basic_types.h" + +#ifdef __cplusplus +// NOTE: For a simplified public API use convert.h MJPGToI420(). + +struct jpeg_common_struct; +struct jpeg_decompress_struct; +struct jpeg_source_mgr; + +namespace libyuv { + +#ifdef __cplusplus +extern "C" { +#endif + +LIBYUV_BOOL ValidateJpeg(const uint8* sample, size_t sample_size); + +#ifdef __cplusplus +} // extern "C" +#endif + +static const uint32 kUnknownDataSize = 0xFFFFFFFF; + +enum JpegSubsamplingType { + kJpegYuv420, + kJpegYuv422, + kJpegYuv411, + kJpegYuv444, + kJpegYuv400, + kJpegUnknown +}; + +struct Buffer { + const uint8* data; + int len; +}; + +struct BufferVector { + Buffer* buffers; + int len; + int pos; +}; + +struct SetJmpErrorMgr; + +// MJPEG ("Motion JPEG") is a pseudo-standard video codec where the frames are +// simply independent JPEG images with a fixed huffman table (which is omitted). +// It is rarely used in video transmission, but is common as a camera capture +// format, especially in Logitech devices. This class implements a decoder for +// MJPEG frames. +// +// See http://tools.ietf.org/html/rfc2435 +class LIBYUV_API MJpegDecoder { + public: + typedef void (*CallbackFunction)(void* opaque, + const uint8* const* data, + const int* strides, + int rows); + + static const int kColorSpaceUnknown; + static const int kColorSpaceGrayscale; + static const int kColorSpaceRgb; + static const int kColorSpaceYCbCr; + static const int kColorSpaceCMYK; + static const int kColorSpaceYCCK; + + MJpegDecoder(); + ~MJpegDecoder(); + + // Loads a new frame, reads its headers, and determines the uncompressed + // image format. + // Returns LIBYUV_TRUE if image looks valid and format is supported. + // If return value is LIBYUV_TRUE, then the values for all the following + // getters are populated. + // src_len is the size of the compressed mjpeg frame in bytes. + LIBYUV_BOOL LoadFrame(const uint8* src, size_t src_len); + + // Returns width of the last loaded frame in pixels. + int GetWidth(); + + // Returns height of the last loaded frame in pixels. + int GetHeight(); + + // Returns format of the last loaded frame. The return value is one of the + // kColorSpace* constants. + int GetColorSpace(); + + // Number of color components in the color space. + int GetNumComponents(); + + // Sample factors of the n-th component. + int GetHorizSampFactor(int component); + + int GetVertSampFactor(int component); + + int GetHorizSubSampFactor(int component); + + int GetVertSubSampFactor(int component); + + // Public for testability. + int GetImageScanlinesPerImcuRow(); + + // Public for testability. + int GetComponentScanlinesPerImcuRow(int component); + + // Width of a component in bytes. + int GetComponentWidth(int component); + + // Height of a component. + int GetComponentHeight(int component); + + // Width of a component in bytes with padding for DCTSIZE. Public for testing. + int GetComponentStride(int component); + + // Size of a component in bytes. + int GetComponentSize(int component); + + // Call this after LoadFrame() if you decide you don't want to decode it + // after all. + LIBYUV_BOOL UnloadFrame(); + + // Decodes the entire image into a one-buffer-per-color-component format. + // dst_width must match exactly. dst_height must be <= to image height; if + // less, the image is cropped. "planes" must have size equal to at least + // GetNumComponents() and they must point to non-overlapping buffers of size + // at least GetComponentSize(i). The pointers in planes are incremented + // to point to after the end of the written data. + // TODO(fbarchard): Add dst_x, dst_y to allow specific rect to be decoded. + LIBYUV_BOOL DecodeToBuffers(uint8** planes, int dst_width, int dst_height); + + // Decodes the entire image and passes the data via repeated calls to a + // callback function. Each call will get the data for a whole number of + // image scanlines. + // TODO(fbarchard): Add dst_x, dst_y to allow specific rect to be decoded. + LIBYUV_BOOL DecodeToCallback(CallbackFunction fn, void* opaque, + int dst_width, int dst_height); + + // The helper function which recognizes the jpeg sub-sampling type. + static JpegSubsamplingType JpegSubsamplingTypeHelper( + int* subsample_x, int* subsample_y, int number_of_components); + + private: + void AllocOutputBuffers(int num_outbufs); + void DestroyOutputBuffers(); + + LIBYUV_BOOL StartDecode(); + LIBYUV_BOOL FinishDecode(); + + void SetScanlinePointers(uint8** data); + LIBYUV_BOOL DecodeImcuRow(); + + int GetComponentScanlinePadding(int component); + + // A buffer holding the input data for a frame. + Buffer buf_; + BufferVector buf_vec_; + + jpeg_decompress_struct* decompress_struct_; + jpeg_source_mgr* source_mgr_; + SetJmpErrorMgr* error_mgr_; + + // LIBYUV_TRUE iff at least one component has scanline padding. (i.e., + // GetComponentScanlinePadding() != 0.) + LIBYUV_BOOL has_scanline_padding_; + + // Temporaries used to point to scanline outputs. + int num_outbufs_; // Outermost size of all arrays below. + uint8*** scanlines_; + int* scanlines_sizes_; + // Temporary buffer used for decoding when we can't decode directly to the + // output buffers. Large enough for just one iMCU row. + uint8** databuf_; + int* databuf_strides_; +}; + +} // namespace libyuv + +#endif // __cplusplus +#endif // INCLUDE_LIBYUV_MJPEG_DECODER_H_ NOLINT diff --git a/app/src/main/cpp/include/libyuv/include/libyuv/planar_functions.h b/app/src/main/cpp/include/libyuv/include/libyuv/planar_functions.h new file mode 100644 index 0000000..7c764d7 --- /dev/null +++ b/app/src/main/cpp/include/libyuv/include/libyuv/planar_functions.h @@ -0,0 +1,439 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_PLANAR_FUNCTIONS_H_ // NOLINT +#define INCLUDE_LIBYUV_PLANAR_FUNCTIONS_H_ + +#include "../libyuv/basic_types.h" + +// TODO(fbarchard): Remove the following headers includes. +#include "../libyuv/convert.h" +#include "../libyuv/convert_argb.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +// Copy a plane of data. +LIBYUV_API +void CopyPlane(const uint8 *src_y, int src_stride_y, + uint8 *dst_y, int dst_stride_y, + int width, int height); + +LIBYUV_API +void CopyPlane_16(const uint16 *src_y, int src_stride_y, + uint16 *dst_y, int dst_stride_y, + int width, int height); + +// Set a plane of data to a 32 bit value. +LIBYUV_API +void SetPlane(uint8 *dst_y, int dst_stride_y, + int width, int height, + uint32 value); + +// Copy I400. Supports inverting. +LIBYUV_API +int I400ToI400(const uint8 *src_y, int src_stride_y, + uint8 *dst_y, int dst_stride_y, + int width, int height); + + +// Copy I422 to I422. +#define I422ToI422 I422Copy +LIBYUV_API +int I422Copy(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Copy I444 to I444. +#define I444ToI444 I444Copy +LIBYUV_API +int I444Copy(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Convert YUY2 to I422. +LIBYUV_API +int YUY2ToI422(const uint8 *src_yuy2, int src_stride_yuy2, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Convert UYVY to I422. +LIBYUV_API +int UYVYToI422(const uint8 *src_uyvy, int src_stride_uyvy, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Convert I420 to I400. (calls CopyPlane ignoring u/v). +LIBYUV_API +int I420ToI400(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_y, int dst_stride_y, + int width, int height); + +// Alias +#define I420ToI420Mirror I420Mirror + +// I420 mirror. +LIBYUV_API +int I420Mirror(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int width, int height); + +// Alias +#define I400ToI400Mirror I400Mirror + +// I400 mirror. A single plane is mirrored horizontally. +// Pass negative height to achieve 180 degree rotation. +LIBYUV_API +int I400Mirror(const uint8 *src_y, int src_stride_y, + uint8 *dst_y, int dst_stride_y, + int width, int height); + +// Alias +#define ARGBToARGBMirror ARGBMirror + +// ARGB mirror. +LIBYUV_API +int ARGBMirror(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Convert NV12 to RGB565. +LIBYUV_API +int NV12ToRGB565(const uint8 *src_y, int src_stride_y, + const uint8 *src_uv, int src_stride_uv, + uint8 *dst_rgb565, int dst_stride_rgb565, + int width, int height); + +// Convert NV21 to RGB565. +LIBYUV_API +int NV21ToRGB565(const uint8 *src_y, int src_stride_y, + const uint8 *src_uv, int src_stride_uv, + uint8 *dst_rgb565, int dst_stride_rgb565, + int width, int height); + +// I422ToARGB is in convert_argb.h +// Convert I422 to BGRA. +LIBYUV_API +int I422ToBGRA(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_bgra, int dst_stride_bgra, + int width, int height); + +// Convert I422 to ABGR. +LIBYUV_API +int I422ToABGR(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_abgr, int dst_stride_abgr, + int width, int height); + +// Convert I422 to RGBA. +LIBYUV_API +int I422ToRGBA(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_rgba, int dst_stride_rgba, + int width, int height); + +// Draw a rectangle into I420. +LIBYUV_API +int I420Rect(uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int x, int y, int width, int height, + int value_y, int value_u, int value_v); + +// Draw a rectangle into ARGB. +LIBYUV_API +int ARGBRect(uint8 *dst_argb, int dst_stride_argb, + int x, int y, int width, int height, uint32 value); + +// Convert ARGB to gray scale ARGB. +LIBYUV_API +int ARGBGrayTo(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Make a rectangle of ARGB gray scale. +LIBYUV_API +int ARGBGray(uint8 *dst_argb, int dst_stride_argb, + int x, int y, int width, int height); + +// Make a rectangle of ARGB Sepia tone. +LIBYUV_API +int ARGBSepia(uint8 *dst_argb, int dst_stride_argb, + int x, int y, int width, int height); + +// Apply a matrix rotation to each ARGB pixel. +// matrix_argb is 4 signed ARGB values. -128 to 127 representing -2 to 2. +// The first 4 coefficients apply to B, G, R, A and produce B of the output. +// The next 4 coefficients apply to B, G, R, A and produce G of the output. +// The next 4 coefficients apply to B, G, R, A and produce R of the output. +// The last 4 coefficients apply to B, G, R, A and produce A of the output. +LIBYUV_API +int ARGBColorMatrix(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_argb, int dst_stride_argb, + const int8 *matrix_argb, + int width, int height); + +// Deprecated. Use ARGBColorMatrix instead. +// Apply a matrix rotation to each ARGB pixel. +// matrix_argb is 3 signed ARGB values. -128 to 127 representing -1 to 1. +// The first 4 coefficients apply to B, G, R, A and produce B of the output. +// The next 4 coefficients apply to B, G, R, A and produce G of the output. +// The last 4 coefficients apply to B, G, R, A and produce R of the output. +LIBYUV_API +int RGBColorMatrix(uint8 *dst_argb, int dst_stride_argb, + const int8 *matrix_rgb, + int x, int y, int width, int height); + +// Apply a color table each ARGB pixel. +// Table contains 256 ARGB values. +LIBYUV_API +int ARGBColorTable(uint8 *dst_argb, int dst_stride_argb, + const uint8 *table_argb, + int x, int y, int width, int height); + +// Apply a color table each ARGB pixel but preserve destination alpha. +// Table contains 256 ARGB values. +LIBYUV_API +int RGBColorTable(uint8 *dst_argb, int dst_stride_argb, + const uint8 *table_argb, + int x, int y, int width, int height); + +// Apply a luma/color table each ARGB pixel but preserve destination alpha. +// Table contains 32768 values indexed by [Y][C] where 7 it 7 bit luma from +// RGB (YJ style) and C is an 8 bit color component (R, G or B). +LIBYUV_API +int ARGBLumaColorTable(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_argb, int dst_stride_argb, + const uint8 *luma_rgb_table, + int width, int height); + +// Apply a 3 term polynomial to ARGB values. +// poly points to a 4x4 matrix. The first row is constants. The 2nd row is +// coefficients for b, g, r and a. The 3rd row is coefficients for b squared, +// g squared, r squared and a squared. The 4rd row is coefficients for b to +// the 3, g to the 3, r to the 3 and a to the 3. The values are summed and +// result clamped to 0 to 255. +// A polynomial approximation can be dirived using software such as 'R'. + +LIBYUV_API +int ARGBPolynomial(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_argb, int dst_stride_argb, + const float *poly, + int width, int height); + +// Quantize a rectangle of ARGB. Alpha unaffected. +// scale is a 16 bit fractional fixed point scaler between 0 and 65535. +// interval_size should be a value between 1 and 255. +// interval_offset should be a value between 0 and 255. +LIBYUV_API +int ARGBQuantize(uint8 *dst_argb, int dst_stride_argb, + int scale, int interval_size, int interval_offset, + int x, int y, int width, int height); + +// Copy ARGB to ARGB. +LIBYUV_API +int ARGBCopy(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Copy ARGB to ARGB. +LIBYUV_API +int ARGBCopyAlpha(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Copy ARGB to ARGB. +LIBYUV_API +int ARGBCopyYToAlpha(const uint8 *src_y, int src_stride_y, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +typedef void (*ARGBBlendRow)(const uint8 *src_argb0, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +// Get function to Alpha Blend ARGB pixels and store to destination. +LIBYUV_API +ARGBBlendRow GetARGBBlend(); + +// Alpha Blend ARGB images and store to destination. +// Alpha of destination is set to 255. +LIBYUV_API +int ARGBBlend(const uint8 *src_argb0, int src_stride_argb0, + const uint8 *src_argb1, int src_stride_argb1, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Multiply ARGB image by ARGB image. Shifted down by 8. Saturates to 255. +LIBYUV_API +int ARGBMultiply(const uint8 *src_argb0, int src_stride_argb0, + const uint8 *src_argb1, int src_stride_argb1, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Add ARGB image with ARGB image. Saturates to 255. +LIBYUV_API +int ARGBAdd(const uint8 *src_argb0, int src_stride_argb0, + const uint8 *src_argb1, int src_stride_argb1, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Subtract ARGB image (argb1) from ARGB image (argb0). Saturates to 0. +LIBYUV_API +int ARGBSubtract(const uint8 *src_argb0, int src_stride_argb0, + const uint8 *src_argb1, int src_stride_argb1, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Convert I422 to YUY2. +LIBYUV_API +int I422ToYUY2(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_frame, int dst_stride_frame, + int width, int height); + +// Convert I422 to UYVY. +LIBYUV_API +int I422ToUYVY(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_frame, int dst_stride_frame, + int width, int height); + +// Convert unattentuated ARGB to preattenuated ARGB. +LIBYUV_API +int ARGBAttenuate(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Convert preattentuated ARGB to unattenuated ARGB. +LIBYUV_API +int ARGBUnattenuate(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Convert MJPG to ARGB. +LIBYUV_API +int MJPGToARGB(const uint8 *sample, size_t sample_size, + uint8 *argb, int argb_stride, + int w, int h, int dw, int dh); + +// Internal function - do not call directly. +// Computes table of cumulative sum for image where the value is the sum +// of all values above and to the left of the entry. Used by ARGBBlur. +LIBYUV_API +int ARGBComputeCumulativeSum(const uint8 *src_argb, int src_stride_argb, + int32 *dst_cumsum, int dst_stride32_cumsum, + int width, int height); + +// Blur ARGB image. +// dst_cumsum table of width * (height + 1) * 16 bytes aligned to +// 16 byte boundary. +// dst_stride32_cumsum is number of ints in a row (width * 4). +// radius is number of pixels around the center. e.g. 1 = 3x3. 2=5x5. +// Blur is optimized for radius of 5 (11x11) or less. +LIBYUV_API +int ARGBBlur(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_argb, int dst_stride_argb, + int32 *dst_cumsum, int dst_stride32_cumsum, + int width, int height, int radius); + +// Multiply ARGB image by ARGB value. +LIBYUV_API +int ARGBShade(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_argb, int dst_stride_argb, + int width, int height, uint32 value); + +// Interpolate between two ARGB images using specified amount of interpolation +// (0 to 255) and store to destination. +// 'interpolation' is specified as 8 bit fraction where 0 means 100% src_argb0 +// and 255 means 1% src_argb0 and 99% src_argb1. +// Internally uses ARGBScale bilinear filtering. +// Caveat: This function will write up to 16 bytes beyond the end of dst_argb. +LIBYUV_API +int ARGBInterpolate(const uint8 *src_argb0, int src_stride_argb0, + const uint8 *src_argb1, int src_stride_argb1, + uint8 *dst_argb, int dst_stride_argb, + int width, int height, int interpolation); + +#if defined(__pnacl__) || defined(__CLR_VER) || defined(COVERAGE_ENABLED) || \ + defined(TARGET_IPHONE_SIMULATOR) +#define LIBYUV_DISABLE_X86 +#endif + +// Row functions for copying a pixels from a source with a slope to a row +// of destination. Useful for scaling, rotation, mirror, texture mapping. +LIBYUV_API +void ARGBAffineRow_C(const uint8 *src_argb, int src_argb_stride, + uint8 *dst_argb, const float *uv_dudv, int width); +// The following are available on all x86 platforms: +#if !defined(LIBYUV_DISABLE_X86) && \ + (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) +LIBYUV_API +void ARGBAffineRow_SSE2(const uint8* src_argb, int src_argb_stride, + uint8* dst_argb, const float* uv_dudv, int width); +#define HAS_ARGBAFFINEROW_SSE2 +#endif // LIBYUV_DISABLE_X86 + +// Shuffle ARGB channel order. e.g. BGRA to ARGB. +// shuffler is 16 bytes and must be aligned. +LIBYUV_API +int ARGBShuffle(const uint8 *src_bgra, int src_stride_bgra, + uint8 *dst_argb, int dst_stride_argb, + const uint8 *shuffler, int width, int height); + +// Sobel ARGB effect with planar output. +LIBYUV_API +int ARGBSobelToPlane(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_y, int dst_stride_y, + int width, int height); + +// Sobel ARGB effect. +LIBYUV_API +int ARGBSobel(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +// Sobel ARGB effect w/ Sobel X, Sobel, Sobel Y in ARGB. +LIBYUV_API +int ARGBSobelXY(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_argb, int dst_stride_argb, + int width, int height); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_PLANAR_FUNCTIONS_H_ NOLINT diff --git a/app/src/main/cpp/include/libyuv/include/libyuv/rotate.h b/app/src/main/cpp/include/libyuv/include/libyuv/rotate.h new file mode 100644 index 0000000..2f0ce38 --- /dev/null +++ b/app/src/main/cpp/include/libyuv/include/libyuv/rotate.h @@ -0,0 +1,117 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_ROTATE_H_ // NOLINT +#define INCLUDE_LIBYUV_ROTATE_H_ + +#include "../libyuv/basic_types.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +// Supported rotation. +typedef enum RotationMode { + kRotate0 = 0, // No rotation. + kRotate90 = 90, // Rotate 90 degrees clockwise. + kRotate180 = 180, // Rotate 180 degrees. + kRotate270 = 270, // Rotate 270 degrees clockwise. + + // Deprecated. + kRotateNone = 0, + kRotateClockwise = 90, + kRotateCounterClockwise = 270, +} RotationModeEnum; + +// Rotate I420 frame. +LIBYUV_API +int I420Rotate(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int src_width, int src_height, enum RotationMode mode); + +// Rotate NV12 input and store in I420. +LIBYUV_API +int NV12ToI420Rotate(const uint8 *src_y, int src_stride_y, + const uint8 *src_uv, int src_stride_uv, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int src_width, int src_height, enum RotationMode mode); + +// Rotate a plane by 0, 90, 180, or 270. +LIBYUV_API +int RotatePlane(const uint8 *src, int src_stride, + uint8 *dst, int dst_stride, + int src_width, int src_height, enum RotationMode mode); + +// Rotate planes by 90, 180, 270. Deprecated. +LIBYUV_API +void RotatePlane90(const uint8 *src, int src_stride, + uint8 *dst, int dst_stride, + int width, int height); + +LIBYUV_API +void RotatePlane180(const uint8 *src, int src_stride, + uint8 *dst, int dst_stride, + int width, int height); + +LIBYUV_API +void RotatePlane270(const uint8 *src, int src_stride, + uint8 *dst, int dst_stride, + int width, int height); + +LIBYUV_API +void RotateUV90(const uint8 *src, int src_stride, + uint8 *dst_a, int dst_stride_a, + uint8 *dst_b, int dst_stride_b, + int width, int height); + +// Rotations for when U and V are interleaved. +// These functions take one input pointer and +// split the data into two buffers while +// rotating them. Deprecated. +LIBYUV_API +void RotateUV180(const uint8 *src, int src_stride, + uint8 *dst_a, int dst_stride_a, + uint8 *dst_b, int dst_stride_b, + int width, int height); + +LIBYUV_API +void RotateUV270(const uint8 *src, int src_stride, + uint8 *dst_a, int dst_stride_a, + uint8 *dst_b, int dst_stride_b, + int width, int height); + +// The 90 and 270 functions are based on transposes. +// Doing a transpose with reversing the read/write +// order will result in a rotation by +- 90 degrees. +// Deprecated. +LIBYUV_API +void TransposePlane(const uint8 *src, int src_stride, + uint8 *dst, int dst_stride, + int width, int height); + +LIBYUV_API +void TransposeUV(const uint8 *src, int src_stride, + uint8 *dst_a, int dst_stride_a, + uint8 *dst_b, int dst_stride_b, + int width, int height); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_ROTATE_H_ NOLINT diff --git a/app/src/main/cpp/include/libyuv/include/libyuv/rotate_argb.h b/app/src/main/cpp/include/libyuv/include/libyuv/rotate_argb.h new file mode 100644 index 0000000..2d4f23a --- /dev/null +++ b/app/src/main/cpp/include/libyuv/include/libyuv/rotate_argb.h @@ -0,0 +1,33 @@ +/* + * Copyright 2012 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_ROTATE_ARGB_H_ // NOLINT +#define INCLUDE_LIBYUV_ROTATE_ARGB_H_ + +#include "../libyuv/basic_types.h" +#include "../libyuv/rotate.h" // For RotationMode. + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +// Rotate ARGB frame +LIBYUV_API +int ARGBRotate(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_argb, int dst_stride_argb, + int src_width, int src_height, enum RotationMode mode); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_ROTATE_ARGB_H_ NOLINT diff --git a/app/src/main/cpp/include/libyuv/include/libyuv/row.h b/app/src/main/cpp/include/libyuv/include/libyuv/row.h new file mode 100644 index 0000000..5ad4c28 --- /dev/null +++ b/app/src/main/cpp/include/libyuv/include/libyuv/row.h @@ -0,0 +1,2134 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_ROW_H_ // NOLINT +#define INCLUDE_LIBYUV_ROW_H_ + +#include <stdlib.h> // For malloc. + +#include "../libyuv/basic_types.h" + +#ifdef __cplusplus + namespace libyuv { +extern "C" { +#endif + +#define IS_ALIGNED(p, a) (!((uintptr_t)(p) & ((a) - 1))) + +#ifdef __cplusplus + #define align_buffer_64(var, size) \ + uint8* var##_mem = reinterpret_cast<uint8*>(malloc((size) + 63)); \ + uint8* var = reinterpret_cast<uint8*> \ + ((reinterpret_cast<intptr_t>(var##_mem) + 63) & ~63) +#else +#define align_buffer_64(var, size) \ + uint8* var##_mem = (uint8*)(malloc((size) + 63)); /* NOLINT */ \ + uint8* var = (uint8*)(((intptr_t)(var##_mem) + 63) & ~63) /* NOLINT */ +#endif + +#define free_aligned_buffer_64(var) \ + free(var##_mem); \ + var = 0 + +#if defined(__pnacl__) || defined(__CLR_VER) || defined(COVERAGE_ENABLED) || \ + defined(TARGET_IPHONE_SIMULATOR) || \ + (defined(_MSC_VER) && defined(__clang__)) +#define LIBYUV_DISABLE_X86 +#endif +// True if compiling for SSSE3 as a requirement. +#if defined(__SSSE3__) || (defined(_M_IX86_FP) && (_M_IX86_FP >= 3)) +#define LIBYUV_SSSE3_ONLY +#endif + +// clang >= 3.5.0 required for Arm64. +#if defined(__clang__) && defined(__aarch64__) && !defined(LIBYUV_DISABLE_NEON) + #if (__clang_major__ < 3) || (__clang_major__ == 3 && (__clang_minor__ < 5)) +#define LIBYUV_DISABLE_NEON +#endif // clang >= 3.5 +#endif // __clang__ + +// The following are available on all x86 platforms: +#if !defined(LIBYUV_DISABLE_X86) && \ + (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) + // Conversions: +#define HAS_ABGRTOUVROW_SSSE3 +#define HAS_ABGRTOYROW_SSSE3 +#define HAS_ARGB1555TOARGBROW_SSE2 +#define HAS_ARGB4444TOARGBROW_SSE2 +#define HAS_ARGBSHUFFLEROW_SSE2 +#define HAS_ARGBSHUFFLEROW_SSSE3 +#define HAS_ARGBTOARGB1555ROW_SSE2 +#define HAS_ARGBTOARGB4444ROW_SSE2 +#define HAS_ARGBTOBAYERGGROW_SSE2 +#define HAS_ARGBTOBAYERROW_SSSE3 +#define HAS_ARGBTORAWROW_SSSE3 +#define HAS_ARGBTORGB24ROW_SSSE3 +#define HAS_ARGBTORGB565ROW_SSE2 +#define HAS_ARGBTOUV422ROW_SSSE3 +#define HAS_ARGBTOUV444ROW_SSSE3 +#define HAS_ARGBTOUVJROW_SSSE3 +#define HAS_ARGBTOUVROW_SSSE3 +#define HAS_ARGBTOYJROW_SSSE3 +#define HAS_ARGBTOYROW_SSSE3 +#define HAS_BGRATOUVROW_SSSE3 +#define HAS_BGRATOYROW_SSSE3 +#define HAS_COPYROW_ERMS +#define HAS_COPYROW_SSE2 +#define HAS_I400TOARGBROW_SSE2 +#define HAS_I411TOARGBROW_SSSE3 +#define HAS_I422TOABGRROW_SSSE3 +#define HAS_I422TOARGB1555ROW_SSSE3 +#define HAS_I422TOARGB1555ROW_SSSE3 +#define HAS_I422TOARGB4444ROW_SSSE3 +#define HAS_I422TOARGBROW_SSSE3 +#define HAS_I422TOBGRAROW_SSSE3 +#define HAS_I422TORAWROW_SSSE3 +#define HAS_I422TORGB24ROW_SSSE3 +#define HAS_I422TORGB565ROW_SSSE3 +#define HAS_I422TORGBAROW_SSSE3 +#define HAS_I422TOUYVYROW_SSE2 +#define HAS_I422TOYUY2ROW_SSE2 +#define HAS_I444TOARGBROW_SSSE3 +// #define HAS_J422TOARGBROW_SSSE3 +#define HAS_MERGEUVROW_SSE2 +#define HAS_MIRRORROW_SSE2 +#define HAS_MIRRORROW_SSSE3 +#define HAS_MIRRORROW_UV_SSSE3 +#define HAS_MIRRORUVROW_SSSE3 +#define HAS_NV12TOARGBROW_SSSE3 +#define HAS_NV12TORGB565ROW_SSSE3 +#define HAS_NV21TOARGBROW_SSSE3 +#define HAS_NV21TORGB565ROW_SSSE3 +#define HAS_RAWTOARGBROW_SSSE3 +#define HAS_RAWTOYROW_SSSE3 +#define HAS_RGB24TOARGBROW_SSSE3 +#define HAS_RGB24TOYROW_SSSE3 +#define HAS_RGB565TOARGBROW_SSE2 +#define HAS_RGBATOUVROW_SSSE3 +#define HAS_RGBATOYROW_SSSE3 +#define HAS_SETROW_X86 +#define HAS_SETROW_ERMS +#define HAS_ARGBSETROW_X86 +#define HAS_SPLITUVROW_SSE2 +#define HAS_UYVYTOARGBROW_SSSE3 +#define HAS_UYVYTOUV422ROW_SSE2 +#define HAS_UYVYTOUVROW_SSE2 +#define HAS_UYVYTOYROW_SSE2 +#define HAS_YTOARGBROW_SSE2 +#define HAS_YUY2TOARGBROW_SSSE3 +#define HAS_YUY2TOUV422ROW_SSE2 +#define HAS_YUY2TOUVROW_SSE2 +#define HAS_YUY2TOYROW_SSE2 + +// Effects: +#define HAS_ARGBADDROW_SSE2 +#define HAS_ARGBAFFINEROW_SSE2 +#define HAS_ARGBATTENUATEROW_SSSE3 +#define HAS_ARGBBLENDROW_SSSE3 +#define HAS_ARGBCOLORMATRIXROW_SSSE3 +#define HAS_ARGBCOLORTABLEROW_X86 +#define HAS_ARGBCOPYALPHAROW_SSE2 +#define HAS_ARGBCOPYYTOALPHAROW_SSE2 +#define HAS_ARGBGRAYROW_SSSE3 +#define HAS_ARGBLUMACOLORTABLEROW_SSSE3 +#define HAS_ARGBMIRRORROW_SSE2 +#define HAS_ARGBMULTIPLYROW_SSE2 +#define HAS_ARGBPOLYNOMIALROW_SSE2 +#define HAS_ARGBQUANTIZEROW_SSE2 +#define HAS_ARGBSEPIAROW_SSSE3 +#define HAS_ARGBSHADEROW_SSE2 +#define HAS_ARGBSUBTRACTROW_SSE2 +#define HAS_ARGBUNATTENUATEROW_SSE2 +#define HAS_COMPUTECUMULATIVESUMROW_SSE2 +#define HAS_CUMULATIVESUMTOAVERAGEROW_SSE2 +#define HAS_INTERPOLATEROW_SSE2 +#define HAS_INTERPOLATEROW_SSSE3 +#define HAS_RGBCOLORTABLEROW_X86 +#define HAS_SOBELROW_SSE2 +#define HAS_SOBELTOPLANEROW_SSE2 +#define HAS_SOBELXROW_SSE2 +#define HAS_SOBELXYROW_SSE2 +#define HAS_SOBELYROW_SSE2 +#endif + +// The following are available on x64 Visual C: +#if !defined(LIBYUV_DISABLE_X86) && defined (_M_X64) +#define HAS_I422TOARGBROW_SSSE3 +#endif + +// GCC >= 4.7.0 required for AVX2. +#if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) + #if (__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 7)) +#define GCC_HAS_AVX2 1 +#endif // GNUC >= 4.7 +#endif // __GNUC__ + +// clang >= 3.4.0 required for AVX2. +#if defined(__clang__) && (defined(__x86_64__) || defined(__i386__)) + #if (__clang_major__ > 3) || (__clang_major__ == 3 && (__clang_minor__ >= 4)) +#define CLANG_HAS_AVX2 1 +#endif // clang >= 3.4 +#endif // __clang__ + +// Visual C 2012 required for AVX2. +#if defined(_M_IX86) && defined(_MSC_VER) && _MSC_VER >= 1700 +#define VISUALC_HAS_AVX2 1 +#endif // VisualStudio >= 2012 + +// The following are available on all x86 platforms, but +// require VS2012, clang 3.4 or gcc 4.7. +// The code supports NaCL but requires a new compiler and validator. +#if !defined(LIBYUV_DISABLE_X86) && (defined(VISUALC_HAS_AVX2) || \ + defined(CLANG_HAS_AVX2) || defined(GCC_HAS_AVX2)) + #define HAS_ARGBCOPYALPHAROW_AVX2 +#define HAS_ARGBCOPYYTOALPHAROW_AVX2 +#define HAS_ARGBMIRRORROW_AVX2 +#define HAS_ARGBPOLYNOMIALROW_AVX2 +#define HAS_ARGBSHUFFLEROW_AVX2 +#define HAS_ARGBTOUVROW_AVX2 +#define HAS_ARGBTOYJROW_AVX2 +#define HAS_ARGBTOYROW_AVX2 +#define HAS_COPYROW_AVX +// TODO(fbarchard): fix AVX2 versions of YUV conversion. bug=393 +//#define HAS_I422TOABGRROW_AVX2 +//#define HAS_I422TOARGBROW_AVX2 +//#define HAS_I422TOBGRAROW_AVX2 +//#define HAS_I422TORGBAROW_AVX2 +#define HAS_INTERPOLATEROW_AVX2 +#define HAS_MERGEUVROW_AVX2 +#define HAS_MIRRORROW_AVX2 +#define HAS_SPLITUVROW_AVX2 +#define HAS_UYVYTOUV422ROW_AVX2 +#define HAS_UYVYTOUVROW_AVX2 +#define HAS_UYVYTOYROW_AVX2 +#define HAS_YUY2TOUV422ROW_AVX2 +#define HAS_YUY2TOUVROW_AVX2 +#define HAS_YUY2TOYROW_AVX2 + +// Effects: +#define HAS_ARGBADDROW_AVX2 +#define HAS_ARGBATTENUATEROW_AVX2 +#define HAS_ARGBMULTIPLYROW_AVX2 +#define HAS_ARGBSUBTRACTROW_AVX2 +#define HAS_ARGBUNATTENUATEROW_AVX2 +#endif + +// The following are Yasm x86 only: +// TODO(fbarchard): Port AVX2 to inline. +#if !defined(LIBYUV_DISABLE_X86) && defined(HAVE_YASM) + (defined(_M_IX86) || defined(_M_X64) || \ + defined(__x86_64__) || defined(__i386__)) +#define HAS_MERGEUVROW_AVX2 +#define HAS_MERGEUVROW_MMX +#define HAS_SPLITUVROW_AVX2 +#define HAS_SPLITUVROW_MMX +#define HAS_UYVYTOYROW_AVX2 +#define HAS_UYVYTOYROW_MMX +#define HAS_YUY2TOYROW_AVX2 +#define HAS_YUY2TOYROW_MMX +#endif + +// The following are disabled when SSSE3 is available: +#if !defined(LIBYUV_DISABLE_X86) && \ + (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) && \ + !defined(LIBYUV_SSSE3_ONLY) + #define HAS_ARGBATTENUATEROW_SSE2 +#define HAS_ARGBBLENDROW_SSE2 +#define HAS_MIRRORROW_SSE2 +#endif + +// The following are available on Neon platforms: +#if !defined(LIBYUV_DISABLE_NEON) && \ + (defined(__aarch64__) || defined(__ARM_NEON__) || defined(LIBYUV_NEON)) + #define HAS_ABGRTOUVROW_NEON +#define HAS_ABGRTOYROW_NEON +#define HAS_ARGB1555TOARGBROW_NEON +#define HAS_ARGB1555TOUVROW_NEON +#define HAS_ARGB1555TOYROW_NEON +#define HAS_ARGB4444TOARGBROW_NEON +#define HAS_ARGB4444TOUVROW_NEON +#define HAS_ARGB4444TOYROW_NEON +#define HAS_ARGBTOARGB1555ROW_NEON +#define HAS_ARGBTOARGB4444ROW_NEON +#define HAS_ARGBTOBAYERGGROW_NEON +#define HAS_ARGBTOBAYERROW_NEON +#define HAS_ARGBTORAWROW_NEON +#define HAS_ARGBTORGB24ROW_NEON +#define HAS_ARGBTORGB565ROW_NEON +#define HAS_ARGBTOUV411ROW_NEON +#define HAS_ARGBTOUV422ROW_NEON +#define HAS_ARGBTOUV444ROW_NEON +#define HAS_ARGBTOUVJROW_NEON +#define HAS_ARGBTOUVROW_NEON +#define HAS_ARGBTOYJROW_NEON +#define HAS_ARGBTOYROW_NEON +#define HAS_BGRATOUVROW_NEON +#define HAS_BGRATOYROW_NEON +#define HAS_COPYROW_NEON +#define HAS_I400TOARGBROW_NEON +#define HAS_I411TOARGBROW_NEON +#define HAS_I422TOABGRROW_NEON +#define HAS_I422TOARGB1555ROW_NEON +#define HAS_I422TOARGB4444ROW_NEON +#define HAS_I422TOARGBROW_NEON +#define HAS_I422TOBGRAROW_NEON +#define HAS_I422TORAWROW_NEON +#define HAS_I422TORGB24ROW_NEON +#define HAS_I422TORGB565ROW_NEON +#define HAS_I422TORGBAROW_NEON +#define HAS_I422TOUYVYROW_NEON +#define HAS_I422TOYUY2ROW_NEON +#define HAS_I444TOARGBROW_NEON +#define HAS_MERGEUVROW_NEON +#define HAS_MIRRORROW_NEON +#define HAS_MIRRORUVROW_NEON +#define HAS_NV12TOARGBROW_NEON +#define HAS_NV12TORGB565ROW_NEON +#define HAS_NV21TOARGBROW_NEON +#define HAS_NV21TORGB565ROW_NEON +#define HAS_RAWTOARGBROW_NEON +#define HAS_RAWTOUVROW_NEON +#define HAS_RAWTOYROW_NEON +#define HAS_RGB24TOARGBROW_NEON +#define HAS_RGB24TOUVROW_NEON +#define HAS_RGB24TOYROW_NEON +#define HAS_RGB565TOARGBROW_NEON +#define HAS_RGB565TOUVROW_NEON +#define HAS_RGB565TOYROW_NEON +#define HAS_RGBATOUVROW_NEON +#define HAS_RGBATOYROW_NEON +#define HAS_SETROW_NEON +#define HAS_ARGBSETROW_NEON +#define HAS_SPLITUVROW_NEON +#define HAS_UYVYTOARGBROW_NEON +#define HAS_UYVYTOUV422ROW_NEON +#define HAS_UYVYTOUVROW_NEON +#define HAS_UYVYTOYROW_NEON +#define HAS_YTOARGBROW_NEON +#define HAS_YUY2TOARGBROW_NEON +#define HAS_YUY2TOUV422ROW_NEON +#define HAS_YUY2TOUVROW_NEON +#define HAS_YUY2TOYROW_NEON + +// Effects: +#define HAS_ARGBADDROW_NEON +#define HAS_ARGBATTENUATEROW_NEON +#define HAS_ARGBBLENDROW_NEON +#define HAS_ARGBGRAYROW_NEON +#define HAS_ARGBMIRRORROW_NEON +#define HAS_ARGBMULTIPLYROW_NEON +#define HAS_ARGBQUANTIZEROW_NEON +#define HAS_ARGBSEPIAROW_NEON +#define HAS_ARGBSHADEROW_NEON +#define HAS_ARGBSUBTRACTROW_NEON +#define HAS_INTERPOLATEROW_NEON +#define HAS_SOBELROW_NEON +#define HAS_SOBELTOPLANEROW_NEON +#define HAS_SOBELXROW_NEON +#define HAS_SOBELXYROW_NEON +#define HAS_SOBELYROW_NEON +#define HAS_ARGBCOLORMATRIXROW_NEON +#define HAS_ARGBSHUFFLEROW_NEON +#endif + +// The following are available on Mips platforms: +#if !defined(LIBYUV_DISABLE_MIPS) && defined(__mips__) && \ + (_MIPS_SIM == _MIPS_SIM_ABI32) && (__mips_isa_rev < 6) + #define HAS_COPYROW_MIPS +#if defined(__mips_dsp) && (__mips_dsp_rev >= 2) +#define HAS_I422TOABGRROW_MIPS_DSPR2 +#define HAS_I422TOARGBROW_MIPS_DSPR2 +#define HAS_I422TOBGRAROW_MIPS_DSPR2 +#define HAS_INTERPOLATEROWS_MIPS_DSPR2 +#define HAS_MIRRORROW_MIPS_DSPR2 +#define HAS_MIRRORUVROW_MIPS_DSPR2 +#define HAS_SPLITUVROW_MIPS_DSPR2 +#endif +#endif + +#if defined(_MSC_VER) && !defined(__CLR_VER) + #define SIMD_ALIGNED(var) __declspec(align(16)) var +typedef __declspec(align(16)) int16 vec16[8]; +typedef __declspec(align(16)) int32 vec32[4]; +typedef __declspec(align(16)) int8 vec8[16]; +typedef __declspec(align(16)) uint16 uvec16[8]; +typedef __declspec(align(16)) uint32 uvec32[4]; +typedef __declspec(align(16)) uint8 uvec8[16]; +typedef __declspec(align(32)) int16 lvec16[16]; +typedef __declspec(align(32)) int32 lvec32[8]; +typedef __declspec(align(32)) int8 lvec8[32]; +typedef __declspec(align(32)) uint16 ulvec16[16]; +typedef __declspec(align(32)) uint32 ulvec32[8]; +typedef __declspec(align(32)) uint8 ulvec8[32]; + +#elif defined(__GNUC__) + // Caveat GCC 4.2 to 4.7 have a known issue using vectors with const. +#define SIMD_ALIGNED(var) var __attribute__((aligned(16))) +typedef int16 __attribute__((vector_size(16))) vec16; +typedef int32 __attribute__((vector_size(16))) vec32; +typedef int8 __attribute__((vector_size(16))) vec8; +typedef uint16 __attribute__((vector_size(16))) uvec16; +typedef uint32 __attribute__((vector_size(16))) uvec32; +typedef uint8 __attribute__((vector_size(16))) uvec8; +typedef int16 __attribute__((vector_size(32))) lvec16; +typedef int32 __attribute__((vector_size(32))) lvec32; +typedef int8 __attribute__((vector_size(32))) lvec8; +typedef uint16 __attribute__((vector_size(32))) ulvec16; +typedef uint32 __attribute__((vector_size(32))) ulvec32; +typedef uint8 __attribute__((vector_size(32))) ulvec8; +#else +#define SIMD_ALIGNED(var) var +typedef int16 vec16[8]; +typedef int32 vec32[4]; +typedef int8 vec8[16]; +typedef uint16 uvec16[8]; +typedef uint32 uvec32[4]; +typedef uint8 uvec8[16]; +typedef int16 lvec16[16]; +typedef int32 lvec32[8]; +typedef int8 lvec8[32]; +typedef uint16 ulvec16[16]; +typedef uint32 ulvec32[8]; +typedef uint8 ulvec8[32]; +#endif + +#if defined(__APPLE__) || defined(__x86_64__) || defined(__llvm__) +#define OMITFP +#else +#define OMITFP __attribute__((optimize("omit-frame-pointer"))) +#endif + +// NaCL macros for GCC x86 and x64. +#if defined(__native_client__) +#define LABELALIGN ".p2align 5\n" +#else +#define LABELALIGN +#endif +#if defined(__native_client__) && defined(__x86_64__) + #define BUNDLELOCK ".bundle_lock\n" +#define BUNDLEUNLOCK ".bundle_unlock\n" +#define MEMACCESS(base) "%%nacl:(%%r15,%q" #base ")" +#define MEMACCESS2(offset, base) "%%nacl:" #offset "(%%r15,%q" #base ")" +#define MEMLEA(offset, base) #offset "(%q" #base ")" +#define MEMLEA3(offset, index, scale) \ + #offset "(,%q" #index "," #scale ")" +#define MEMLEA4(offset, base, index, scale) \ + #offset "(%q" #base ",%q" #index "," #scale ")" +#define MEMMOVESTRING(s, d) "%%nacl:(%q" #s "),%%nacl:(%q" #d "), %%r15" +#define MEMSTORESTRING(reg, d) "%%" #reg ",%%nacl:(%q" #d "), %%r15" +#define MEMOPREG(opcode, offset, base, index, scale, reg) \ + BUNDLELOCK \ + "lea " #offset "(%q" #base ",%q" #index "," #scale "),%%r14d\n" \ + #opcode " (%%r15,%%r14),%%" #reg "\n" \ + BUNDLEUNLOCK +#define MEMOPMEM(opcode, reg, offset, base, index, scale) \ + BUNDLELOCK \ + "lea " #offset "(%q" #base ",%q" #index "," #scale "),%%r14d\n" \ + #opcode " %%" #reg ",(%%r15,%%r14)\n" \ + BUNDLEUNLOCK +#define MEMOPARG(opcode, offset, base, index, scale, arg) \ + BUNDLELOCK \ + "lea " #offset "(%q" #base ",%q" #index "," #scale "),%%r14d\n" \ + #opcode " (%%r15,%%r14),%" #arg "\n" \ + BUNDLEUNLOCK +#define VMEMOPREG(opcode, offset, base, index, scale, reg1, reg2) \ + BUNDLELOCK \ + "lea " #offset "(%q" #base ",%q" #index "," #scale "),%%r14d\n" \ + #opcode " (%%r15,%%r14),%%" #reg1 ",%%" #reg2 "\n" \ + BUNDLEUNLOCK +#define VEXTOPMEM(op, sel, reg, offset, base, index, scale) \ + BUNDLELOCK \ + "lea " #offset "(%q" #base ",%q" #index "," #scale "),%%r14d\n" \ + #op " $" #sel ",%%" #reg ",(%%r15,%%r14)\n" \ + BUNDLEUNLOCK +#else // defined(__native_client__) && defined(__x86_64__) +#define BUNDLEALIGN +#define MEMACCESS(base) "(%" #base ")" +#define MEMACCESS2(offset, base) #offset "(%" #base ")" +#define MEMLEA(offset, base) #offset "(%" #base ")" +#define MEMLEA3(offset, index, scale) \ + #offset "(,%" #index "," #scale ")" +#define MEMLEA4(offset, base, index, scale) \ + #offset "(%" #base ",%" #index "," #scale ")" +#define MEMMOVESTRING(s, d) +#define MEMSTORESTRING(reg, d) +#define MEMOPREG(opcode, offset, base, index, scale, reg) \ + #opcode " " #offset "(%" #base ",%" #index "," #scale "),%%" #reg "\n" +#define MEMOPMEM(opcode, reg, offset, base, index, scale) \ + #opcode " %%" #reg ","#offset "(%" #base ",%" #index "," #scale ")\n" +#define MEMOPARG(opcode, offset, base, index, scale, arg) \ + #opcode " " #offset "(%" #base ",%" #index "," #scale "),%" #arg "\n" +#define VMEMOPREG(opcode, offset, base, index, scale, reg1, reg2) \ + #opcode " " #offset "(%" #base ",%" #index "," #scale "),%%" #reg1 ",%%" \ + #reg2 "\n" +#define VEXTOPMEM(op, sel, reg, offset, base, index, scale) \ + #op " $" #sel ",%%" #reg ","#offset "(%" #base ",%" #index "," #scale ")\n" +#endif // defined(__native_client__) && defined(__x86_64__) + +#if defined(__arm__) || defined(__aarch64__) + #undef MEMACCESS +#if defined(__native_client__) +#define MEMACCESS(base) ".p2align 3\nbic %" #base ", #0xc0000000\n" +#else +#define MEMACCESS(base) +#endif +#endif + +void I444ToARGBRow_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToARGBRow_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I411ToARGBRow_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToBGRARow_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_bgra, + int width); + +void I422ToABGRRow_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_abgr, + int width); + +void I422ToRGBARow_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_rgba, + int width); + +void I422ToRGB24Row_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_rgb24, + int width); + +void I422ToRAWRow_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_raw, + int width); + +void I422ToRGB565Row_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_rgb565, + int width); + +void I422ToARGB1555Row_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb1555, + int width); + +void I422ToARGB4444Row_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb4444, + int width); + +void NV12ToARGBRow_NEON(const uint8 *src_y, + const uint8 *src_uv, + uint8 *dst_argb, + int width); + +void NV21ToARGBRow_NEON(const uint8 *src_y, + const uint8 *src_vu, + uint8 *dst_argb, + int width); + +void NV12ToRGB565Row_NEON(const uint8 *src_y, + const uint8 *src_uv, + uint8 *dst_rgb565, + int width); + +void NV21ToRGB565Row_NEON(const uint8 *src_y, + const uint8 *src_vu, + uint8 *dst_rgb565, + int width); + +void YUY2ToARGBRow_NEON(const uint8 *src_yuy2, + uint8 *dst_argb, + int width); + +void UYVYToARGBRow_NEON(const uint8 *src_uyvy, + uint8 *dst_argb, + int width); + +void ARGBToYRow_AVX2(const uint8 *src_argb, uint8 *dst_y, int pix); + +void ARGBToYRow_Any_AVX2(const uint8 *src_argb, uint8 *dst_y, int pix); + +void ARGBToYRow_SSSE3(const uint8 *src_argb, uint8 *dst_y, int pix); + +void ARGBToYJRow_AVX2(const uint8 *src_argb, uint8 *dst_y, int pix); + +void ARGBToYJRow_Any_AVX2(const uint8 *src_argb, uint8 *dst_y, int pix); + +void ARGBToYJRow_SSSE3(const uint8 *src_argb, uint8 *dst_y, int pix); + +void BGRAToYRow_SSSE3(const uint8 *src_bgra, uint8 *dst_y, int pix); + +void ABGRToYRow_SSSE3(const uint8 *src_abgr, uint8 *dst_y, int pix); + +void RGBAToYRow_SSSE3(const uint8 *src_rgba, uint8 *dst_y, int pix); + +void RGB24ToYRow_SSSE3(const uint8 *src_rgb24, uint8 *dst_y, int pix); + +void RAWToYRow_SSSE3(const uint8 *src_raw, uint8 *dst_y, int pix); + +void ARGBToYRow_NEON(const uint8 *src_argb, uint8 *dst_y, int pix); + +void ARGBToYJRow_NEON(const uint8 *src_argb, uint8 *dst_y, int pix); + +void ARGBToUV444Row_NEON(const uint8 *src_argb, uint8 *dst_u, uint8 *dst_v, + int pix); + +void ARGBToUV422Row_NEON(const uint8 *src_argb, uint8 *dst_u, uint8 *dst_v, + int pix); + +void ARGBToUV411Row_NEON(const uint8 *src_argb, uint8 *dst_u, uint8 *dst_v, + int pix); + +void ARGBToUVRow_NEON(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_u, uint8 *dst_v, int pix); + +void ARGBToUVJRow_NEON(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_u, uint8 *dst_v, int pix); + +void BGRAToUVRow_NEON(const uint8 *src_bgra, int src_stride_bgra, + uint8 *dst_u, uint8 *dst_v, int pix); + +void ABGRToUVRow_NEON(const uint8 *src_abgr, int src_stride_abgr, + uint8 *dst_u, uint8 *dst_v, int pix); + +void RGBAToUVRow_NEON(const uint8 *src_rgba, int src_stride_rgba, + uint8 *dst_u, uint8 *dst_v, int pix); + +void RGB24ToUVRow_NEON(const uint8 *src_rgb24, int src_stride_rgb24, + uint8 *dst_u, uint8 *dst_v, int pix); + +void RAWToUVRow_NEON(const uint8 *src_raw, int src_stride_raw, + uint8 *dst_u, uint8 *dst_v, int pix); + +void RGB565ToUVRow_NEON(const uint8 *src_rgb565, int src_stride_rgb565, + uint8 *dst_u, uint8 *dst_v, int pix); + +void ARGB1555ToUVRow_NEON(const uint8 *src_argb1555, int src_stride_argb1555, + uint8 *dst_u, uint8 *dst_v, int pix); + +void ARGB4444ToUVRow_NEON(const uint8 *src_argb4444, int src_stride_argb4444, + uint8 *dst_u, uint8 *dst_v, int pix); + +void BGRAToYRow_NEON(const uint8 *src_bgra, uint8 *dst_y, int pix); + +void ABGRToYRow_NEON(const uint8 *src_abgr, uint8 *dst_y, int pix); + +void RGBAToYRow_NEON(const uint8 *src_rgba, uint8 *dst_y, int pix); + +void RGB24ToYRow_NEON(const uint8 *src_rgb24, uint8 *dst_y, int pix); + +void RAWToYRow_NEON(const uint8 *src_raw, uint8 *dst_y, int pix); + +void RGB565ToYRow_NEON(const uint8 *src_rgb565, uint8 *dst_y, int pix); + +void ARGB1555ToYRow_NEON(const uint8 *src_argb1555, uint8 *dst_y, int pix); + +void ARGB4444ToYRow_NEON(const uint8 *src_argb4444, uint8 *dst_y, int pix); + +void ARGBToYRow_C(const uint8 *src_argb, uint8 *dst_y, int pix); + +void ARGBToYJRow_C(const uint8 *src_argb, uint8 *dst_y, int pix); + +void BGRAToYRow_C(const uint8 *src_bgra, uint8 *dst_y, int pix); + +void ABGRToYRow_C(const uint8 *src_abgr, uint8 *dst_y, int pix); + +void RGBAToYRow_C(const uint8 *src_rgba, uint8 *dst_y, int pix); + +void RGB24ToYRow_C(const uint8 *src_rgb24, uint8 *dst_y, int pix); + +void RAWToYRow_C(const uint8 *src_raw, uint8 *dst_y, int pix); + +void RGB565ToYRow_C(const uint8 *src_rgb565, uint8 *dst_y, int pix); + +void ARGB1555ToYRow_C(const uint8 *src_argb1555, uint8 *dst_y, int pix); + +void ARGB4444ToYRow_C(const uint8 *src_argb4444, uint8 *dst_y, int pix); + +void ARGBToYRow_Any_SSSE3(const uint8 *src_argb, uint8 *dst_y, int pix); + +void ARGBToYJRow_Any_SSSE3(const uint8 *src_argb, uint8 *dst_y, int pix); + +void BGRAToYRow_Any_SSSE3(const uint8 *src_bgra, uint8 *dst_y, int pix); + +void ABGRToYRow_Any_SSSE3(const uint8 *src_abgr, uint8 *dst_y, int pix); + +void RGBAToYRow_Any_SSSE3(const uint8 *src_rgba, uint8 *dst_y, int pix); + +void RGB24ToYRow_Any_SSSE3(const uint8 *src_rgb24, uint8 *dst_y, int pix); + +void RAWToYRow_Any_SSSE3(const uint8 *src_raw, uint8 *dst_y, int pix); + +void ARGBToYRow_Any_NEON(const uint8 *src_argb, uint8 *dst_y, int pix); + +void ARGBToYJRow_Any_NEON(const uint8 *src_argb, uint8 *dst_y, int pix); + +void BGRAToYRow_Any_NEON(const uint8 *src_bgra, uint8 *dst_y, int pix); + +void ABGRToYRow_Any_NEON(const uint8 *src_abgr, uint8 *dst_y, int pix); + +void RGBAToYRow_Any_NEON(const uint8 *src_rgba, uint8 *dst_y, int pix); + +void RGB24ToYRow_Any_NEON(const uint8 *src_rgb24, uint8 *dst_y, int pix); + +void RAWToYRow_Any_NEON(const uint8 *src_raw, uint8 *dst_y, int pix); + +void RGB565ToYRow_Any_NEON(const uint8 *src_rgb565, uint8 *dst_y, int pix); + +void ARGB1555ToYRow_Any_NEON(const uint8 *src_argb1555, uint8 *dst_y, int pix); + +void ARGB4444ToYRow_Any_NEON(const uint8 *src_argb4444, uint8 *dst_y, int pix); + +void ARGBToUVRow_AVX2(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_u, uint8 *dst_v, int width); + +void ARGBToUVRow_Any_AVX2(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_u, uint8 *dst_v, int width); + +void ARGBToUVRow_SSSE3(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_u, uint8 *dst_v, int width); + +void ARGBToUVJRow_SSSE3(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_u, uint8 *dst_v, int width); + +void BGRAToUVRow_SSSE3(const uint8 *src_bgra, int src_stride_bgra, + uint8 *dst_u, uint8 *dst_v, int width); + +void ABGRToUVRow_SSSE3(const uint8 *src_abgr, int src_stride_abgr, + uint8 *dst_u, uint8 *dst_v, int width); + +void RGBAToUVRow_SSSE3(const uint8 *src_rgba, int src_stride_rgba, + uint8 *dst_u, uint8 *dst_v, int width); + +void ARGBToUVRow_Any_SSSE3(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_u, uint8 *dst_v, int width); + +void ARGBToUVJRow_Any_SSSE3(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_u, uint8 *dst_v, int width); + +void BGRAToUVRow_Any_SSSE3(const uint8 *src_bgra, int src_stride_bgra, + uint8 *dst_u, uint8 *dst_v, int width); + +void ABGRToUVRow_Any_SSSE3(const uint8 *src_abgr, int src_stride_abgr, + uint8 *dst_u, uint8 *dst_v, int width); + +void RGBAToUVRow_Any_SSSE3(const uint8 *src_rgba, int src_stride_rgba, + uint8 *dst_u, uint8 *dst_v, int width); + +void ARGBToUV444Row_Any_NEON(const uint8 *src_argb, uint8 *dst_u, uint8 *dst_v, + int pix); + +void ARGBToUV422Row_Any_NEON(const uint8 *src_argb, uint8 *dst_u, uint8 *dst_v, + int pix); + +void ARGBToUV411Row_Any_NEON(const uint8 *src_argb, uint8 *dst_u, uint8 *dst_v, + int pix); + +void ARGBToUVRow_Any_NEON(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_u, uint8 *dst_v, int pix); + +void ARGBToUVJRow_Any_NEON(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_u, uint8 *dst_v, int pix); + +void BGRAToUVRow_Any_NEON(const uint8 *src_bgra, int src_stride_bgra, + uint8 *dst_u, uint8 *dst_v, int pix); + +void ABGRToUVRow_Any_NEON(const uint8 *src_abgr, int src_stride_abgr, + uint8 *dst_u, uint8 *dst_v, int pix); + +void RGBAToUVRow_Any_NEON(const uint8 *src_rgba, int src_stride_rgba, + uint8 *dst_u, uint8 *dst_v, int pix); + +void RGB24ToUVRow_Any_NEON(const uint8 *src_rgb24, int src_stride_rgb24, + uint8 *dst_u, uint8 *dst_v, int pix); + +void RAWToUVRow_Any_NEON(const uint8 *src_raw, int src_stride_raw, + uint8 *dst_u, uint8 *dst_v, int pix); + +void RGB565ToUVRow_Any_NEON(const uint8 *src_rgb565, int src_stride_rgb565, + uint8 *dst_u, uint8 *dst_v, int pix); + +void ARGB1555ToUVRow_Any_NEON(const uint8 *src_argb1555, + int src_stride_argb1555, + uint8 *dst_u, uint8 *dst_v, int pix); + +void ARGB4444ToUVRow_Any_NEON(const uint8 *src_argb4444, + int src_stride_argb4444, + uint8 *dst_u, uint8 *dst_v, int pix); + +void ARGBToUVRow_C(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_u, uint8 *dst_v, int width); + +void ARGBToUVJRow_C(const uint8 *src_argb, int src_stride_argb, + uint8 *dst_u, uint8 *dst_v, int width); + +void BGRAToUVRow_C(const uint8 *src_bgra, int src_stride_bgra, + uint8 *dst_u, uint8 *dst_v, int width); + +void ABGRToUVRow_C(const uint8 *src_abgr, int src_stride_abgr, + uint8 *dst_u, uint8 *dst_v, int width); + +void RGBAToUVRow_C(const uint8 *src_rgba, int src_stride_rgba, + uint8 *dst_u, uint8 *dst_v, int width); + +void RGB24ToUVRow_C(const uint8 *src_rgb24, int src_stride_rgb24, + uint8 *dst_u, uint8 *dst_v, int width); + +void RAWToUVRow_C(const uint8 *src_raw, int src_stride_raw, + uint8 *dst_u, uint8 *dst_v, int width); + +void RGB565ToUVRow_C(const uint8 *src_rgb565, int src_stride_rgb565, + uint8 *dst_u, uint8 *dst_v, int width); + +void ARGB1555ToUVRow_C(const uint8 *src_argb1555, int src_stride_argb1555, + uint8 *dst_u, uint8 *dst_v, int width); + +void ARGB4444ToUVRow_C(const uint8 *src_argb4444, int src_stride_argb4444, + uint8 *dst_u, uint8 *dst_v, int width); + +void ARGBToUV444Row_SSSE3(const uint8 *src_argb, + uint8 *dst_u, uint8 *dst_v, int width); + +void ARGBToUV444Row_Any_SSSE3(const uint8 *src_argb, + uint8 *dst_u, uint8 *dst_v, int width); + +void ARGBToUV422Row_SSSE3(const uint8 *src_argb, + uint8 *dst_u, uint8 *dst_v, int width); + +void ARGBToUV422Row_Any_SSSE3(const uint8 *src_argb, + uint8 *dst_u, uint8 *dst_v, int width); + +void ARGBToUV444Row_C(const uint8 *src_argb, + uint8 *dst_u, uint8 *dst_v, int width); + +void ARGBToUV422Row_C(const uint8 *src_argb, + uint8 *dst_u, uint8 *dst_v, int width); + +void ARGBToUV411Row_C(const uint8 *src_argb, + uint8 *dst_u, uint8 *dst_v, int width); + +void ARGBToUVJ422Row_C(const uint8 *src_argb, + uint8 *dst_u, uint8 *dst_v, int width); + +void MirrorRow_AVX2(const uint8 *src, uint8 *dst, int width); + +void MirrorRow_SSSE3(const uint8 *src, uint8 *dst, int width); + +void MirrorRow_SSE2(const uint8 *src, uint8 *dst, int width); + +void MirrorRow_NEON(const uint8 *src, uint8 *dst, int width); + +void MirrorRow_MIPS_DSPR2(const uint8 *src, uint8 *dst, int width); + +void MirrorRow_C(const uint8 *src, uint8 *dst, int width); + +void MirrorRow_Any_AVX2(const uint8 *src, uint8 *dst, int width); + +void MirrorRow_Any_SSSE3(const uint8 *src, uint8 *dst, int width); + +void MirrorRow_Any_SSE2(const uint8 *src, uint8 *dst, int width); + +void MirrorRow_Any_NEON(const uint8 *src, uint8 *dst, int width); + +void MirrorUVRow_SSSE3(const uint8 *src_uv, uint8 *dst_u, uint8 *dst_v, + int width); + +void MirrorUVRow_NEON(const uint8 *src_uv, uint8 *dst_u, uint8 *dst_v, + int width); + +void MirrorUVRow_MIPS_DSPR2(const uint8 *src_uv, uint8 *dst_u, uint8 *dst_v, + int width); + +void MirrorUVRow_C(const uint8 *src_uv, uint8 *dst_u, uint8 *dst_v, + int width); + +void ARGBMirrorRow_AVX2(const uint8 *src, uint8 *dst, int width); + +void ARGBMirrorRow_SSE2(const uint8 *src, uint8 *dst, int width); + +void ARGBMirrorRow_NEON(const uint8 *src, uint8 *dst, int width); + +void ARGBMirrorRow_C(const uint8 *src, uint8 *dst, int width); + +void ARGBMirrorRow_Any_AVX2(const uint8 *src, uint8 *dst, int width); + +void ARGBMirrorRow_Any_SSE2(const uint8 *src, uint8 *dst, int width); + +void ARGBMirrorRow_Any_NEON(const uint8 *src, uint8 *dst, int width); + +void SplitUVRow_C(const uint8 *src_uv, uint8 *dst_u, uint8 *dst_v, int pix); + +void SplitUVRow_SSE2(const uint8 *src_uv, uint8 *dst_u, uint8 *dst_v, int pix); + +void SplitUVRow_AVX2(const uint8 *src_uv, uint8 *dst_u, uint8 *dst_v, int pix); + +void SplitUVRow_NEON(const uint8 *src_uv, uint8 *dst_u, uint8 *dst_v, int pix); + +void SplitUVRow_MIPS_DSPR2(const uint8 *src_uv, uint8 *dst_u, uint8 *dst_v, + int pix); + +void SplitUVRow_Any_SSE2(const uint8 *src_uv, uint8 *dst_u, uint8 *dst_v, + int pix); + +void SplitUVRow_Any_AVX2(const uint8 *src_uv, uint8 *dst_u, uint8 *dst_v, + int pix); + +void SplitUVRow_Any_NEON(const uint8 *src_uv, uint8 *dst_u, uint8 *dst_v, + int pix); + +void SplitUVRow_Any_MIPS_DSPR2(const uint8 *src_uv, uint8 *dst_u, uint8 *dst_v, + int pix); + +void MergeUVRow_C(const uint8 *src_u, const uint8 *src_v, uint8 *dst_uv, + int width); + +void MergeUVRow_SSE2(const uint8 *src_u, const uint8 *src_v, uint8 *dst_uv, + int width); + +void MergeUVRow_AVX2(const uint8 *src_u, const uint8 *src_v, uint8 *dst_uv, + int width); + +void MergeUVRow_NEON(const uint8 *src_u, const uint8 *src_v, uint8 *dst_uv, + int width); + +void MergeUVRow_Any_SSE2(const uint8 *src_u, const uint8 *src_v, uint8 *dst_uv, + int width); + +void MergeUVRow_Any_AVX2(const uint8 *src_u, const uint8 *src_v, uint8 *dst_uv, + int width); + +void MergeUVRow_Any_NEON(const uint8 *src_u, const uint8 *src_v, uint8 *dst_uv, + int width); + +void CopyRow_SSE2(const uint8 *src, uint8 *dst, int count); + +void CopyRow_AVX(const uint8 *src, uint8 *dst, int count); + +void CopyRow_ERMS(const uint8 *src, uint8 *dst, int count); + +void CopyRow_NEON(const uint8 *src, uint8 *dst, int count); + +void CopyRow_MIPS(const uint8 *src, uint8 *dst, int count); + +void CopyRow_C(const uint8 *src, uint8 *dst, int count); + +void CopyRow_Any_SSE2(const uint8 *src, uint8 *dst, int count); + +void CopyRow_Any_AVX(const uint8 *src, uint8 *dst, int count); + +void CopyRow_Any_NEON(const uint8 *src, uint8 *dst, int count); + +void CopyRow_16_C(const uint16 *src, uint16 *dst, int count); + +void ARGBCopyAlphaRow_C(const uint8 *src_argb, uint8 *dst_argb, int width); + +void ARGBCopyAlphaRow_SSE2(const uint8 *src_argb, uint8 *dst_argb, int width); + +void ARGBCopyAlphaRow_AVX2(const uint8 *src_argb, uint8 *dst_argb, int width); + +void ARGBCopyYToAlphaRow_C(const uint8 *src_y, uint8 *dst_argb, int width); + +void ARGBCopyYToAlphaRow_SSE2(const uint8 *src_y, uint8 *dst_argb, int width); + +void ARGBCopyYToAlphaRow_AVX2(const uint8 *src_y, uint8 *dst_argb, int width); + +void SetRow_C(uint8 *dst, uint8 v8, int count); + +void SetRow_X86(uint8 *dst, uint8 v8, int count); + +void SetRow_ERMS(uint8 *dst, uint8 v8, int count); + +void SetRow_NEON(uint8 *dst, uint8 v8, int count); + +void SetRow_Any_X86(uint8 *dst, uint8 v8, int count); + +void SetRow_Any_NEON(uint8 *dst, uint8 v8, int count); + +void ARGBSetRow_C(uint8 *dst_argb, uint32 v32, int count); + +void ARGBSetRow_X86(uint8 *dst_argb, uint32 v32, int count); + +void ARGBSetRow_NEON(uint8 *dst_argb, uint32 v32, int count); + +void ARGBSetRow_Any_NEON(uint8 *dst_argb, uint32 v32, int count); + +// ARGBShufflers for BGRAToARGB etc. +void ARGBShuffleRow_C(const uint8 *src_argb, uint8 *dst_argb, + const uint8 *shuffler, int pix); + +void ARGBShuffleRow_SSE2(const uint8 *src_argb, uint8 *dst_argb, + const uint8 *shuffler, int pix); + +void ARGBShuffleRow_SSSE3(const uint8 *src_argb, uint8 *dst_argb, + const uint8 *shuffler, int pix); + +void ARGBShuffleRow_AVX2(const uint8 *src_argb, uint8 *dst_argb, + const uint8 *shuffler, int pix); + +void ARGBShuffleRow_NEON(const uint8 *src_argb, uint8 *dst_argb, + const uint8 *shuffler, int pix); + +void ARGBShuffleRow_Any_SSE2(const uint8 *src_argb, uint8 *dst_argb, + const uint8 *shuffler, int pix); + +void ARGBShuffleRow_Any_SSSE3(const uint8 *src_argb, uint8 *dst_argb, + const uint8 *shuffler, int pix); + +void ARGBShuffleRow_Any_AVX2(const uint8 *src_argb, uint8 *dst_argb, + const uint8 *shuffler, int pix); + +void ARGBShuffleRow_Any_NEON(const uint8 *src_argb, uint8 *dst_argb, + const uint8 *shuffler, int pix); + +void RGB24ToARGBRow_SSSE3(const uint8 *src_rgb24, uint8 *dst_argb, int pix); + +void RAWToARGBRow_SSSE3(const uint8 *src_raw, uint8 *dst_argb, int pix); + +void RGB565ToARGBRow_SSE2(const uint8 *src_rgb565, uint8 *dst_argb, int pix); + +void ARGB1555ToARGBRow_SSE2(const uint8 *src_argb1555, uint8 *dst_argb, + int pix); + +void ARGB4444ToARGBRow_SSE2(const uint8 *src_argb4444, uint8 *dst_argb, + int pix); + +void RGB24ToARGBRow_NEON(const uint8 *src_rgb24, uint8 *dst_argb, int pix); + +void RAWToARGBRow_NEON(const uint8 *src_raw, uint8 *dst_argb, int pix); + +void RGB565ToARGBRow_NEON(const uint8 *src_rgb565, uint8 *dst_argb, int pix); + +void ARGB1555ToARGBRow_NEON(const uint8 *src_argb1555, uint8 *dst_argb, + int pix); + +void ARGB4444ToARGBRow_NEON(const uint8 *src_argb4444, uint8 *dst_argb, + int pix); + +void RGB24ToARGBRow_C(const uint8 *src_rgb24, uint8 *dst_argb, int pix); + +void RAWToARGBRow_C(const uint8 *src_raw, uint8 *dst_argb, int pix); + +void RGB565ToARGBRow_C(const uint8 *src_rgb, uint8 *dst_argb, int pix); + +void ARGB1555ToARGBRow_C(const uint8 *src_argb, uint8 *dst_argb, int pix); + +void ARGB4444ToARGBRow_C(const uint8 *src_argb, uint8 *dst_argb, int pix); + +void RGB24ToARGBRow_Any_SSSE3(const uint8 *src_rgb24, uint8 *dst_argb, int pix); + +void RAWToARGBRow_Any_SSSE3(const uint8 *src_raw, uint8 *dst_argb, int pix); + +void RGB565ToARGBRow_Any_SSE2(const uint8 *src_rgb565, uint8 *dst_argb, + int pix); + +void ARGB1555ToARGBRow_Any_SSE2(const uint8 *src_argb1555, uint8 *dst_argb, + int pix); + +void ARGB4444ToARGBRow_Any_SSE2(const uint8 *src_argb4444, uint8 *dst_argb, + int pix); + +void RGB24ToARGBRow_Any_NEON(const uint8 *src_rgb24, uint8 *dst_argb, int pix); + +void RAWToARGBRow_Any_NEON(const uint8 *src_raw, uint8 *dst_argb, int pix); + +void RGB565ToARGBRow_Any_NEON(const uint8 *src_rgb565, uint8 *dst_argb, + int pix); + +void ARGB1555ToARGBRow_Any_NEON(const uint8 *src_argb1555, uint8 *dst_argb, + int pix); + +void ARGB4444ToARGBRow_Any_NEON(const uint8 *src_argb4444, uint8 *dst_argb, + int pix); + +void ARGBToRGB24Row_SSSE3(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToRAWRow_SSSE3(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToRGB565Row_SSE2(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToARGB1555Row_SSE2(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToARGB4444Row_SSE2(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToRGB24Row_NEON(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToRAWRow_NEON(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToRGB565Row_NEON(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToARGB1555Row_NEON(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToARGB4444Row_NEON(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToRGBARow_C(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToRGB24Row_C(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToRAWRow_C(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToRGB565Row_C(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToARGB1555Row_C(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToARGB4444Row_C(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void I400ToARGBRow_SSE2(const uint8 *src_y, uint8 *dst_argb, int pix); + +void I400ToARGBRow_NEON(const uint8 *src_y, uint8 *dst_argb, int pix); + +void I400ToARGBRow_C(const uint8 *src_y, uint8 *dst_argb, int pix); + +void I400ToARGBRow_Any_SSE2(const uint8 *src_y, uint8 *dst_argb, int pix); + +void I400ToARGBRow_Any_NEON(const uint8 *src_y, uint8 *dst_argb, int pix); + +void I444ToARGBRow_C(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToARGBRow_C(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I411ToARGBRow_C(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void NV12ToARGBRow_C(const uint8 *src_y, + const uint8 *src_uv, + uint8 *dst_argb, + int width); + +void NV21ToRGB565Row_C(const uint8 *src_y, + const uint8 *src_vu, + uint8 *dst_argb, + int width); + +void NV12ToRGB565Row_C(const uint8 *src_y, + const uint8 *src_uv, + uint8 *dst_argb, + int width); + +void NV21ToARGBRow_C(const uint8 *src_y, + const uint8 *src_vu, + uint8 *dst_argb, + int width); + +void YUY2ToARGBRow_C(const uint8 *src_yuy2, + uint8 *dst_argb, + int width); + +void UYVYToARGBRow_C(const uint8 *src_uyvy, + uint8 *dst_argb, + int width); + +void J422ToARGBRow_C(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToBGRARow_C(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_bgra, + int width); + +void I422ToABGRRow_C(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_abgr, + int width); + +void I422ToRGBARow_C(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_rgba, + int width); + +void I422ToRGB24Row_C(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_rgb24, + int width); + +void I422ToRAWRow_C(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_raw, + int width); + +void I422ToARGB4444Row_C(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb4444, + int width); + +void I422ToARGB1555Row_C(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb4444, + int width); + +void I422ToRGB565Row_C(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_rgb565, + int width); + +void YToARGBRow_C(const uint8 *src_y, + uint8 *dst_argb, + int width); + +void I422ToARGBRow_AVX2(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToBGRARow_AVX2(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToRGBARow_AVX2(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToABGRRow_AVX2(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I444ToARGBRow_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToARGBRow_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I411ToARGBRow_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void NV12ToARGBRow_SSSE3(const uint8 *src_y, + const uint8 *src_uv, + uint8 *dst_argb, + int width); + +void NV21ToARGBRow_SSSE3(const uint8 *src_y, + const uint8 *src_vu, + uint8 *dst_argb, + int width); + +void NV12ToRGB565Row_SSSE3(const uint8 *src_y, + const uint8 *src_uv, + uint8 *dst_argb, + int width); + +void NV21ToRGB565Row_SSSE3(const uint8 *src_y, + const uint8 *src_vu, + uint8 *dst_argb, + int width); + +void YUY2ToARGBRow_SSSE3(const uint8 *src_yuy2, + uint8 *dst_argb, + int width); + +void UYVYToARGBRow_SSSE3(const uint8 *src_uyvy, + uint8 *dst_argb, + int width); + +void J422ToARGBRow_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToBGRARow_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_bgra, + int width); + +void I422ToABGRRow_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_abgr, + int width); + +void I422ToRGBARow_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_rgba, + int width); + +void I422ToARGB4444Row_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToARGB1555Row_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToRGB565Row_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToRGB24Row_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_rgb24, + int width); + +void I422ToRAWRow_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_raw, + int width); + +void I422ToARGBRow_Any_AVX2(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToBGRARow_Any_AVX2(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToRGBARow_Any_AVX2(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToABGRRow_Any_AVX2(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I444ToARGBRow_Any_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToARGBRow_Any_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I411ToARGBRow_Any_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void NV12ToARGBRow_Any_SSSE3(const uint8 *src_y, + const uint8 *src_uv, + uint8 *dst_argb, + int width); + +void NV21ToARGBRow_Any_SSSE3(const uint8 *src_y, + const uint8 *src_vu, + uint8 *dst_argb, + int width); + +void NV12ToRGB565Row_Any_SSSE3(const uint8 *src_y, + const uint8 *src_uv, + uint8 *dst_argb, + int width); + +void NV21ToRGB565Row_Any_SSSE3(const uint8 *src_y, + const uint8 *src_vu, + uint8 *dst_argb, + int width); + +void YUY2ToARGBRow_Any_SSSE3(const uint8 *src_yuy2, + uint8 *dst_argb, + int width); + +void UYVYToARGBRow_Any_SSSE3(const uint8 *src_uyvy, + uint8 *dst_argb, + int width); + +void I422ToBGRARow_Any_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_bgra, + int width); + +void I422ToABGRRow_Any_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_abgr, + int width); + +void I422ToRGBARow_Any_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_rgba, + int width); + +void I422ToARGB4444Row_Any_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_rgba, + int width); + +void I422ToARGB1555Row_Any_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_rgba, + int width); + +void I422ToRGB565Row_Any_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_rgba, + int width); + +void I422ToRGB24Row_Any_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToRAWRow_Any_SSSE3(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void YToARGBRow_SSE2(const uint8 *src_y, + uint8 *dst_argb, + int width); + +void YToARGBRow_NEON(const uint8 *src_y, + uint8 *dst_argb, + int width); + +void YToARGBRow_Any_SSE2(const uint8 *src_y, + uint8 *dst_argb, + int width); + +void YToARGBRow_Any_NEON(const uint8 *src_y, + uint8 *dst_argb, + int width); + +// ARGB preattenuated alpha blend. +void ARGBBlendRow_SSSE3(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBBlendRow_SSE2(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBBlendRow_NEON(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBBlendRow_C(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +// ARGB multiply images. Same API as Blend, but these require +// pointer and width alignment for SSE2. +void ARGBMultiplyRow_C(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBMultiplyRow_SSE2(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBMultiplyRow_Any_SSE2(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBMultiplyRow_AVX2(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBMultiplyRow_Any_AVX2(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBMultiplyRow_NEON(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBMultiplyRow_Any_NEON(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +// ARGB add images. +void ARGBAddRow_C(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBAddRow_SSE2(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBAddRow_Any_SSE2(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBAddRow_AVX2(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBAddRow_Any_AVX2(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBAddRow_NEON(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBAddRow_Any_NEON(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +// ARGB subtract images. Same API as Blend, but these require +// pointer and width alignment for SSE2. +void ARGBSubtractRow_C(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBSubtractRow_SSE2(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBSubtractRow_Any_SSE2(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBSubtractRow_AVX2(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBSubtractRow_Any_AVX2(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBSubtractRow_NEON(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBSubtractRow_Any_NEON(const uint8 *src_argb, const uint8 *src_argb1, + uint8 *dst_argb, int width); + +void ARGBToRGB24Row_Any_SSSE3(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToRAWRow_Any_SSSE3(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToRGB565Row_Any_SSE2(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToARGB1555Row_Any_SSE2(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToARGB4444Row_Any_SSE2(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToRGB24Row_Any_NEON(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToRAWRow_Any_NEON(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToRGB565Row_Any_NEON(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToARGB1555Row_Any_NEON(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void ARGBToARGB4444Row_Any_NEON(const uint8 *src_argb, uint8 *dst_rgb, int pix); + +void I444ToARGBRow_Any_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToARGBRow_Any_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I411ToARGBRow_Any_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToBGRARow_Any_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToABGRRow_Any_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToRGBARow_Any_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToRGB24Row_Any_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToRAWRow_Any_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToARGB4444Row_Any_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToARGB1555Row_Any_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToRGB565Row_Any_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void NV12ToARGBRow_Any_NEON(const uint8 *src_y, + const uint8 *src_uv, + uint8 *dst_argb, + int width); + +void NV21ToARGBRow_Any_NEON(const uint8 *src_y, + const uint8 *src_uv, + uint8 *dst_argb, + int width); + +void NV12ToRGB565Row_Any_NEON(const uint8 *src_y, + const uint8 *src_uv, + uint8 *dst_argb, + int width); + +void NV21ToRGB565Row_Any_NEON(const uint8 *src_y, + const uint8 *src_uv, + uint8 *dst_argb, + int width); + +void YUY2ToARGBRow_Any_NEON(const uint8 *src_yuy2, + uint8 *dst_argb, + int width); + +void UYVYToARGBRow_Any_NEON(const uint8 *src_uyvy, + uint8 *dst_argb, + int width); + +void I422ToARGBRow_MIPS_DSPR2(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToBGRARow_MIPS_DSPR2(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToABGRRow_MIPS_DSPR2(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToARGBRow_MIPS_DSPR2(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToBGRARow_MIPS_DSPR2(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void I422ToABGRRow_MIPS_DSPR2(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_argb, + int width); + +void YUY2ToYRow_AVX2(const uint8 *src_yuy2, uint8 *dst_y, int pix); + +void YUY2ToUVRow_AVX2(const uint8 *src_yuy2, int stride_yuy2, + uint8 *dst_u, uint8 *dst_v, int pix); + +void YUY2ToUV422Row_AVX2(const uint8 *src_yuy2, + uint8 *dst_u, uint8 *dst_v, int pix); + +void YUY2ToYRow_SSE2(const uint8 *src_yuy2, uint8 *dst_y, int pix); + +void YUY2ToUVRow_SSE2(const uint8 *src_yuy2, int stride_yuy2, + uint8 *dst_u, uint8 *dst_v, int pix); + +void YUY2ToUV422Row_SSE2(const uint8 *src_yuy2, + uint8 *dst_u, uint8 *dst_v, int pix); + +void YUY2ToYRow_NEON(const uint8 *src_yuy2, uint8 *dst_y, int pix); + +void YUY2ToUVRow_NEON(const uint8 *src_yuy2, int stride_yuy2, + uint8 *dst_u, uint8 *dst_v, int pix); + +void YUY2ToUV422Row_NEON(const uint8 *src_yuy2, + uint8 *dst_u, uint8 *dst_v, int pix); + +void YUY2ToYRow_C(const uint8 *src_yuy2, uint8 *dst_y, int pix); + +void YUY2ToUVRow_C(const uint8 *src_yuy2, int stride_yuy2, + uint8 *dst_u, uint8 *dst_v, int pix); + +void YUY2ToUV422Row_C(const uint8 *src_yuy2, + uint8 *dst_u, uint8 *dst_v, int pix); + +void YUY2ToYRow_Any_AVX2(const uint8 *src_yuy2, uint8 *dst_y, int pix); + +void YUY2ToUVRow_Any_AVX2(const uint8 *src_yuy2, int stride_yuy2, + uint8 *dst_u, uint8 *dst_v, int pix); + +void YUY2ToUV422Row_Any_AVX2(const uint8 *src_yuy2, + uint8 *dst_u, uint8 *dst_v, int pix); + +void YUY2ToYRow_Any_SSE2(const uint8 *src_yuy2, uint8 *dst_y, int pix); + +void YUY2ToUVRow_Any_SSE2(const uint8 *src_yuy2, int stride_yuy2, + uint8 *dst_u, uint8 *dst_v, int pix); + +void YUY2ToUV422Row_Any_SSE2(const uint8 *src_yuy2, + uint8 *dst_u, uint8 *dst_v, int pix); + +void YUY2ToYRow_Any_NEON(const uint8 *src_yuy2, uint8 *dst_y, int pix); + +void YUY2ToUVRow_Any_NEON(const uint8 *src_yuy2, int stride_yuy2, + uint8 *dst_u, uint8 *dst_v, int pix); + +void YUY2ToUV422Row_Any_NEON(const uint8 *src_yuy2, + uint8 *dst_u, uint8 *dst_v, int pix); + +void UYVYToYRow_AVX2(const uint8 *src_uyvy, uint8 *dst_y, int pix); + +void UYVYToUVRow_AVX2(const uint8 *src_uyvy, int stride_uyvy, + uint8 *dst_u, uint8 *dst_v, int pix); + +void UYVYToUV422Row_AVX2(const uint8 *src_uyvy, + uint8 *dst_u, uint8 *dst_v, int pix); + +void UYVYToYRow_SSE2(const uint8 *src_uyvy, uint8 *dst_y, int pix); + +void UYVYToUVRow_SSE2(const uint8 *src_uyvy, int stride_uyvy, + uint8 *dst_u, uint8 *dst_v, int pix); + +void UYVYToUV422Row_SSE2(const uint8 *src_uyvy, + uint8 *dst_u, uint8 *dst_v, int pix); + +void UYVYToYRow_AVX2(const uint8 *src_uyvy, uint8 *dst_y, int pix); + +void UYVYToUVRow_AVX2(const uint8 *src_uyvy, int stride_uyvy, + uint8 *dst_u, uint8 *dst_v, int pix); + +void UYVYToUV422Row_AVX2(const uint8 *src_uyvy, + uint8 *dst_u, uint8 *dst_v, int pix); + +void UYVYToYRow_NEON(const uint8 *src_uyvy, uint8 *dst_y, int pix); + +void UYVYToUVRow_NEON(const uint8 *src_uyvy, int stride_uyvy, + uint8 *dst_u, uint8 *dst_v, int pix); + +void UYVYToUV422Row_NEON(const uint8 *src_uyvy, + uint8 *dst_u, uint8 *dst_v, int pix); + +void UYVYToYRow_C(const uint8 *src_uyvy, uint8 *dst_y, int pix); + +void UYVYToUVRow_C(const uint8 *src_uyvy, int stride_uyvy, + uint8 *dst_u, uint8 *dst_v, int pix); + +void UYVYToUV422Row_C(const uint8 *src_uyvy, + uint8 *dst_u, uint8 *dst_v, int pix); + +void UYVYToYRow_Any_AVX2(const uint8 *src_uyvy, uint8 *dst_y, int pix); + +void UYVYToUVRow_Any_AVX2(const uint8 *src_uyvy, int stride_uyvy, + uint8 *dst_u, uint8 *dst_v, int pix); + +void UYVYToUV422Row_Any_AVX2(const uint8 *src_uyvy, + uint8 *dst_u, uint8 *dst_v, int pix); + +void UYVYToYRow_Any_SSE2(const uint8 *src_uyvy, uint8 *dst_y, int pix); + +void UYVYToUVRow_Any_SSE2(const uint8 *src_uyvy, int stride_uyvy, + uint8 *dst_u, uint8 *dst_v, int pix); + +void UYVYToUV422Row_Any_SSE2(const uint8 *src_uyvy, + uint8 *dst_u, uint8 *dst_v, int pix); + +void UYVYToYRow_Any_NEON(const uint8 *src_uyvy, uint8 *dst_y, int pix); + +void UYVYToUVRow_Any_NEON(const uint8 *src_uyvy, int stride_uyvy, + uint8 *dst_u, uint8 *dst_v, int pix); + +void UYVYToUV422Row_Any_NEON(const uint8 *src_uyvy, + uint8 *dst_u, uint8 *dst_v, int pix); + +void ARGBToBayerRow_C(const uint8 *src_argb, uint8 *dst_bayer, + uint32 selector, int pix); + +void ARGBToBayerRow_SSSE3(const uint8 *src_argb, uint8 *dst_bayer, + uint32 selector, int pix); + +void ARGBToBayerRow_NEON(const uint8 *src_argb, uint8 *dst_bayer, + uint32 selector, int pix); + +void ARGBToBayerRow_Any_SSSE3(const uint8 *src_argb, uint8 *dst_bayer, + uint32 selector, int pix); + +void ARGBToBayerRow_Any_NEON(const uint8 *src_argb, uint8 *dst_bayer, + uint32 selector, int pix); + +void ARGBToBayerGGRow_C(const uint8 *src_argb, uint8 *dst_bayer, + uint32 /* selector */, int pix); + +void ARGBToBayerGGRow_SSE2(const uint8 *src_argb, uint8 *dst_bayer, + uint32 /* selector */, int pix); + +void ARGBToBayerGGRow_NEON(const uint8 *src_argb, uint8 *dst_bayer, + uint32 /* selector */, int pix); + +void ARGBToBayerGGRow_Any_SSE2(const uint8 *src_argb, uint8 *dst_bayer, + uint32 /* selector */, int pix); + +void ARGBToBayerGGRow_Any_NEON(const uint8 *src_argb, uint8 *dst_bayer, + uint32 /* selector */, int pix); + +void I422ToYUY2Row_C(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_yuy2, int width); + +void I422ToUYVYRow_C(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_uyvy, int width); + +void I422ToYUY2Row_SSE2(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_yuy2, int width); + +void I422ToUYVYRow_SSE2(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_uyvy, int width); + +void I422ToYUY2Row_Any_SSE2(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_yuy2, int width); + +void I422ToUYVYRow_Any_SSE2(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_uyvy, int width); + +void I422ToYUY2Row_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_yuy2, int width); + +void I422ToUYVYRow_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_uyvy, int width); + +void I422ToYUY2Row_Any_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_yuy2, int width); + +void I422ToUYVYRow_Any_NEON(const uint8 *src_y, + const uint8 *src_u, + const uint8 *src_v, + uint8 *dst_uyvy, int width); + +// Effects related row functions. +void ARGBAttenuateRow_C(const uint8 *src_argb, uint8 *dst_argb, int width); + +void ARGBAttenuateRow_SSE2(const uint8 *src_argb, uint8 *dst_argb, int width); + +void ARGBAttenuateRow_SSSE3(const uint8 *src_argb, uint8 *dst_argb, int width); + +void ARGBAttenuateRow_AVX2(const uint8 *src_argb, uint8 *dst_argb, int width); + +void ARGBAttenuateRow_NEON(const uint8 *src_argb, uint8 *dst_argb, int width); + +void ARGBAttenuateRow_Any_SSE2(const uint8 *src_argb, uint8 *dst_argb, + int width); + +void ARGBAttenuateRow_Any_SSSE3(const uint8 *src_argb, uint8 *dst_argb, + int width); + +void ARGBAttenuateRow_Any_AVX2(const uint8 *src_argb, uint8 *dst_argb, + int width); + +void ARGBAttenuateRow_Any_NEON(const uint8 *src_argb, uint8 *dst_argb, + int width); + +// Inverse table for unattenuate, shared by C and SSE2. +extern const uint32 fixed_invtbl8[256]; + +void ARGBUnattenuateRow_C(const uint8 *src_argb, uint8 *dst_argb, int width); + +void ARGBUnattenuateRow_SSE2(const uint8 *src_argb, uint8 *dst_argb, int width); + +void ARGBUnattenuateRow_AVX2(const uint8 *src_argb, uint8 *dst_argb, int width); + +void ARGBUnattenuateRow_Any_SSE2(const uint8 *src_argb, uint8 *dst_argb, + int width); + +void ARGBUnattenuateRow_Any_AVX2(const uint8 *src_argb, uint8 *dst_argb, + int width); + +void ARGBGrayRow_C(const uint8 *src_argb, uint8 *dst_argb, int width); + +void ARGBGrayRow_SSSE3(const uint8 *src_argb, uint8 *dst_argb, int width); + +void ARGBGrayRow_NEON(const uint8 *src_argb, uint8 *dst_argb, int width); + +void ARGBSepiaRow_C(uint8 *dst_argb, int width); + +void ARGBSepiaRow_SSSE3(uint8 *dst_argb, int width); + +void ARGBSepiaRow_NEON(uint8 *dst_argb, int width); + +void ARGBColorMatrixRow_C(const uint8 *src_argb, uint8 *dst_argb, + const int8 *matrix_argb, int width); + +void ARGBColorMatrixRow_SSSE3(const uint8 *src_argb, uint8 *dst_argb, + const int8 *matrix_argb, int width); + +void ARGBColorMatrixRow_NEON(const uint8 *src_argb, uint8 *dst_argb, + const int8 *matrix_argb, int width); + +void ARGBColorTableRow_C(uint8 *dst_argb, const uint8 *table_argb, int width); + +void ARGBColorTableRow_X86(uint8 *dst_argb, const uint8 *table_argb, int width); + +void RGBColorTableRow_C(uint8 *dst_argb, const uint8 *table_argb, int width); + +void RGBColorTableRow_X86(uint8 *dst_argb, const uint8 *table_argb, int width); + +void ARGBQuantizeRow_C(uint8 *dst_argb, int scale, int interval_size, + int interval_offset, int width); + +void ARGBQuantizeRow_SSE2(uint8 *dst_argb, int scale, int interval_size, + int interval_offset, int width); + +void ARGBQuantizeRow_NEON(uint8 *dst_argb, int scale, int interval_size, + int interval_offset, int width); + +void ARGBShadeRow_C(const uint8 *src_argb, uint8 *dst_argb, int width, + uint32 value); + +void ARGBShadeRow_SSE2(const uint8 *src_argb, uint8 *dst_argb, int width, + uint32 value); + +void ARGBShadeRow_NEON(const uint8 *src_argb, uint8 *dst_argb, int width, + uint32 value); + +// Used for blur. +void CumulativeSumToAverageRow_SSE2(const int32 *topleft, const int32 *botleft, + int width, int area, uint8 *dst, int count); + +void ComputeCumulativeSumRow_SSE2(const uint8 *row, int32 *cumsum, + const int32 *previous_cumsum, int width); + +void CumulativeSumToAverageRow_C(const int32 *topleft, const int32 *botleft, + int width, int area, uint8 *dst, int count); + +void ComputeCumulativeSumRow_C(const uint8 *row, int32 *cumsum, + const int32 *previous_cumsum, int width); + +LIBYUV_API +void ARGBAffineRow_C(const uint8 *src_argb, int src_argb_stride, + uint8 *dst_argb, const float *uv_dudv, int width); + +LIBYUV_API +void ARGBAffineRow_SSE2(const uint8 *src_argb, int src_argb_stride, + uint8 *dst_argb, const float *uv_dudv, int width); + +// Used for I420Scale, ARGBScale, and ARGBInterpolate. +void InterpolateRow_C(uint8 *dst_ptr, const uint8 *src_ptr, + ptrdiff_t src_stride_ptr, + int width, int source_y_fraction); + +void InterpolateRow_SSE2(uint8 *dst_ptr, const uint8 *src_ptr, + ptrdiff_t src_stride_ptr, int width, + int source_y_fraction); + +void InterpolateRow_SSSE3(uint8 *dst_ptr, const uint8 *src_ptr, + ptrdiff_t src_stride_ptr, int width, + int source_y_fraction); + +void InterpolateRow_AVX2(uint8 *dst_ptr, const uint8 *src_ptr, + ptrdiff_t src_stride_ptr, int width, + int source_y_fraction); + +void InterpolateRow_NEON(uint8 *dst_ptr, const uint8 *src_ptr, + ptrdiff_t src_stride_ptr, int width, + int source_y_fraction); + +void InterpolateRows_MIPS_DSPR2(uint8 *dst_ptr, const uint8 *src_ptr, + ptrdiff_t src_stride_ptr, int width, + int source_y_fraction); + +void InterpolateRow_Any_NEON(uint8 *dst_ptr, const uint8 *src_ptr, + ptrdiff_t src_stride_ptr, int width, + int source_y_fraction); + +void InterpolateRow_Any_SSE2(uint8 *dst_ptr, const uint8 *src_ptr, + ptrdiff_t src_stride_ptr, int width, + int source_y_fraction); + +void InterpolateRow_Any_SSSE3(uint8 *dst_ptr, const uint8 *src_ptr, + ptrdiff_t src_stride_ptr, int width, + int source_y_fraction); + +void InterpolateRow_Any_AVX2(uint8 *dst_ptr, const uint8 *src_ptr, + ptrdiff_t src_stride_ptr, int width, + int source_y_fraction); + +void InterpolateRows_Any_MIPS_DSPR2(uint8 *dst_ptr, const uint8 *src_ptr, + ptrdiff_t src_stride_ptr, int width, + int source_y_fraction); + +void InterpolateRow_16_C(uint16 *dst_ptr, const uint16 *src_ptr, + ptrdiff_t src_stride_ptr, + int width, int source_y_fraction); + +// Sobel images. +void SobelXRow_C(const uint8 *src_y0, const uint8 *src_y1, const uint8 *src_y2, + uint8 *dst_sobelx, int width); + +void SobelXRow_SSE2(const uint8 *src_y0, const uint8 *src_y1, + const uint8 *src_y2, uint8 *dst_sobelx, int width); + +void SobelXRow_NEON(const uint8 *src_y0, const uint8 *src_y1, + const uint8 *src_y2, uint8 *dst_sobelx, int width); + +void SobelYRow_C(const uint8 *src_y0, const uint8 *src_y1, + uint8 *dst_sobely, int width); + +void SobelYRow_SSE2(const uint8 *src_y0, const uint8 *src_y1, + uint8 *dst_sobely, int width); + +void SobelYRow_NEON(const uint8 *src_y0, const uint8 *src_y1, + uint8 *dst_sobely, int width); + +void SobelRow_C(const uint8 *src_sobelx, const uint8 *src_sobely, + uint8 *dst_argb, int width); + +void SobelRow_SSE2(const uint8 *src_sobelx, const uint8 *src_sobely, + uint8 *dst_argb, int width); + +void SobelRow_NEON(const uint8 *src_sobelx, const uint8 *src_sobely, + uint8 *dst_argb, int width); + +void SobelToPlaneRow_C(const uint8 *src_sobelx, const uint8 *src_sobely, + uint8 *dst_y, int width); + +void SobelToPlaneRow_SSE2(const uint8 *src_sobelx, const uint8 *src_sobely, + uint8 *dst_y, int width); + +void SobelToPlaneRow_NEON(const uint8 *src_sobelx, const uint8 *src_sobely, + uint8 *dst_y, int width); + +void SobelXYRow_C(const uint8 *src_sobelx, const uint8 *src_sobely, + uint8 *dst_argb, int width); + +void SobelXYRow_SSE2(const uint8 *src_sobelx, const uint8 *src_sobely, + uint8 *dst_argb, int width); + +void SobelXYRow_NEON(const uint8 *src_sobelx, const uint8 *src_sobely, + uint8 *dst_argb, int width); + +void ARGBPolynomialRow_C(const uint8 *src_argb, + uint8 *dst_argb, const float *poly, + int width); + +void ARGBPolynomialRow_SSE2(const uint8 *src_argb, + uint8 *dst_argb, const float *poly, + int width); + +void ARGBPolynomialRow_AVX2(const uint8 *src_argb, + uint8 *dst_argb, const float *poly, + int width); + +void ARGBLumaColorTableRow_C(const uint8 *src_argb, uint8 *dst_argb, int width, + const uint8 *luma, uint32 lumacoeff); + +void ARGBLumaColorTableRow_SSSE3(const uint8 *src_argb, uint8 *dst_argb, + int width, + const uint8 *luma, uint32 lumacoeff); + +#ifdef __cplusplus + } // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_ROW_H_ NOLINT diff --git a/app/src/main/cpp/include/libyuv/include/libyuv/scale.h b/app/src/main/cpp/include/libyuv/include/libyuv/scale.h new file mode 100644 index 0000000..2abeada --- /dev/null +++ b/app/src/main/cpp/include/libyuv/include/libyuv/scale.h @@ -0,0 +1,104 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_SCALE_H_ // NOLINT +#define INCLUDE_LIBYUV_SCALE_H_ + + +#include "../libyuv/basic_types.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +// Supported filtering. +typedef enum FilterMode { + kFilterNone = 0, // Point sample; Fastest. + kFilterLinear = 1, // Filter horizontally only. + kFilterBilinear = 2, // Faster than box, but lower quality scaling down. + kFilterBox = 3 // Highest quality. +} FilterModeEnum; + +// Scale a YUV plane. +LIBYUV_API +void ScalePlane(const uint8 *src, int src_stride, + int src_width, int src_height, + uint8 *dst, int dst_stride, + int dst_width, int dst_height, + enum FilterMode filtering); + +LIBYUV_API +void ScalePlane_16(const uint16 *src, int src_stride, + int src_width, int src_height, + uint16 *dst, int dst_stride, + int dst_width, int dst_height, + enum FilterMode filtering); + +// Scales a YUV 4:2:0 image from the src width and height to the +// dst width and height. +// If filtering is kFilterNone, a simple nearest-neighbor algorithm is +// used. This produces basic (blocky) quality at the fastest speed. +// If filtering is kFilterBilinear, interpolation is used to produce a better +// quality image, at the expense of speed. +// If filtering is kFilterBox, averaging is used to produce ever better +// quality image, at further expense of speed. +// Returns 0 if successful. + +LIBYUV_API +int I420Scale(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + int src_width, int src_height, + uint8 *dst_y, int dst_stride_y, + uint8 *dst_u, int dst_stride_u, + uint8 *dst_v, int dst_stride_v, + int dst_width, int dst_height, + enum FilterMode filtering); + +LIBYUV_API +int I420Scale_16(const uint16 *src_y, int src_stride_y, + const uint16 *src_u, int src_stride_u, + const uint16 *src_v, int src_stride_v, + int src_width, int src_height, + uint16 *dst_y, int dst_stride_y, + uint16 *dst_u, int dst_stride_u, + uint16 *dst_v, int dst_stride_v, + int dst_width, int dst_height, + enum FilterMode filtering); + +#ifdef __cplusplus +// Legacy API. Deprecated. +LIBYUV_API +int Scale(const uint8* src_y, const uint8* src_u, const uint8* src_v, + int src_stride_y, int src_stride_u, int src_stride_v, + int src_width, int src_height, + uint8* dst_y, uint8* dst_u, uint8* dst_v, + int dst_stride_y, int dst_stride_u, int dst_stride_v, + int dst_width, int dst_height, + LIBYUV_BOOL interpolate); + +// Legacy API. Deprecated. +LIBYUV_API +int ScaleOffset(const uint8* src_i420, int src_width, int src_height, + uint8* dst_i420, int dst_width, int dst_height, int dst_yoffset, + LIBYUV_BOOL interpolate); + +// For testing, allow disabling of specialized scalers. +LIBYUV_API +void SetUseReferenceImpl(LIBYUV_BOOL use); +#endif // __cplusplus + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_SCALE_H_ NOLINT diff --git a/app/src/main/cpp/include/libyuv/include/libyuv/scale_argb.h b/app/src/main/cpp/include/libyuv/include/libyuv/scale_argb.h new file mode 100644 index 0000000..b225f1d --- /dev/null +++ b/app/src/main/cpp/include/libyuv/include/libyuv/scale_argb.h @@ -0,0 +1,57 @@ +/* + * Copyright 2012 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_SCALE_ARGB_H_ // NOLINT +#define INCLUDE_LIBYUV_SCALE_ARGB_H_ + +#include "../libyuv/basic_types.h" +#include "../libyuv/scale.h" // For FilterMode + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +LIBYUV_API +int ARGBScale(const uint8 *src_argb, int src_stride_argb, + int src_width, int src_height, + uint8 *dst_argb, int dst_stride_argb, + int dst_width, int dst_height, + enum FilterMode filtering); + +// Clipped scale takes destination rectangle coordinates for clip values. +LIBYUV_API +int ARGBScaleClip(const uint8 *src_argb, int src_stride_argb, + int src_width, int src_height, + uint8 *dst_argb, int dst_stride_argb, + int dst_width, int dst_height, + int clip_x, int clip_y, int clip_width, int clip_height, + enum FilterMode filtering); + +// TODO(fbarchard): Implement this. +// Scale with YUV conversion to ARGB and clipping. +LIBYUV_API +int YUVToARGBScaleClip(const uint8 *src_y, int src_stride_y, + const uint8 *src_u, int src_stride_u, + const uint8 *src_v, int src_stride_v, + uint32 src_fourcc, + int src_width, int src_height, + uint8 *dst_argb, int dst_stride_argb, + uint32 dst_fourcc, + int dst_width, int dst_height, + int clip_x, int clip_y, int clip_width, int clip_height, + enum FilterMode filtering); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_SCALE_ARGB_H_ NOLINT diff --git a/app/src/main/cpp/include/libyuv/include/libyuv/scale_row.h b/app/src/main/cpp/include/libyuv/include/libyuv/scale_row.h new file mode 100644 index 0000000..69b2999 --- /dev/null +++ b/app/src/main/cpp/include/libyuv/include/libyuv/scale_row.h @@ -0,0 +1,416 @@ +/* + * Copyright 2013 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_SCALE_ROW_H_ // NOLINT +#define INCLUDE_LIBYUV_SCALE_ROW_H_ + +#include "../libyuv/basic_types.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +#if defined(__pnacl__) || defined(__CLR_VER) || defined(COVERAGE_ENABLED) || \ + defined(TARGET_IPHONE_SIMULATOR) +#define LIBYUV_DISABLE_X86 +#endif + +// The following are available on all x86 platforms: +#if !defined(LIBYUV_DISABLE_X86) && \ + (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) +#define HAS_SCALEROWDOWN2_SSE2 +#define HAS_SCALEROWDOWN4_SSE2 +#define HAS_SCALEROWDOWN34_SSSE3 +#define HAS_SCALEROWDOWN38_SSSE3 +#define HAS_SCALEADDROWS_SSE2 +#define HAS_SCALEFILTERCOLS_SSSE3 +#define HAS_SCALECOLSUP2_SSE2 +#define HAS_SCALEARGBROWDOWN2_SSE2 +#define HAS_SCALEARGBROWDOWNEVEN_SSE2 +#define HAS_SCALEARGBCOLS_SSE2 +#define HAS_SCALEARGBFILTERCOLS_SSSE3 +#define HAS_SCALEARGBCOLSUP2_SSE2 +#define HAS_FIXEDDIV_X86 +#define HAS_FIXEDDIV1_X86 +#endif + +// The following are available on Neon platforms: +#if !defined(LIBYUV_DISABLE_NEON) && !defined(__native_client__) && \ + (defined(__ARM_NEON__) || defined(LIBYUV_NEON) || defined(__aarch64__)) +#define HAS_SCALEROWDOWN2_NEON +#define HAS_SCALEROWDOWN4_NEON +#define HAS_SCALEROWDOWN34_NEON +#define HAS_SCALEROWDOWN38_NEON +#define HAS_SCALEARGBROWDOWNEVEN_NEON +#define HAS_SCALEARGBROWDOWN2_NEON +#endif + +// The following are available on Mips platforms: +#if !defined(LIBYUV_DISABLE_MIPS) && !defined(__native_client__) && \ + defined(__mips__) && defined(__mips_dsp) && (__mips_dsp_rev >= 2) +#define HAS_SCALEROWDOWN2_MIPS_DSPR2 +#define HAS_SCALEROWDOWN4_MIPS_DSPR2 +#define HAS_SCALEROWDOWN34_MIPS_DSPR2 +#define HAS_SCALEROWDOWN38_MIPS_DSPR2 +#endif + +// Scale ARGB vertically with bilinear interpolation. +void ScalePlaneVertical(int src_height, + int dst_width, int dst_height, + int src_stride, int dst_stride, + const uint8 *src_argb, uint8 *dst_argb, + int x, int y, int dy, + int bpp, enum FilterMode filtering); + +void ScalePlaneVertical_16(int src_height, + int dst_width, int dst_height, + int src_stride, int dst_stride, + const uint16 *src_argb, uint16 *dst_argb, + int x, int y, int dy, + int wpp, enum FilterMode filtering); + +// Simplify the filtering based on scale factors. +enum FilterMode ScaleFilterReduce(int src_width, int src_height, + int dst_width, int dst_height, + enum FilterMode filtering); + +// Divide num by div and return as 16.16 fixed point result. +int FixedDiv_C(int num, int div); + +int FixedDiv_X86(int num, int div); + +// Divide num - 1 by div - 1 and return as 16.16 fixed point result. +int FixedDiv1_C(int num, int div); + +int FixedDiv1_X86(int num, int div); + +#ifdef HAS_FIXEDDIV_X86 +#define FixedDiv FixedDiv_X86 +#define FixedDiv1 FixedDiv1_X86 +#else +#define FixedDiv FixedDiv_C +#define FixedDiv1 FixedDiv1_C +#endif + +// Compute slope values for stepping. +void ScaleSlope(int src_width, int src_height, + int dst_width, int dst_height, + enum FilterMode filtering, + int *x, int *y, int *dx, int *dy); + +void ScaleRowDown2_C(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst, int dst_width); + +void ScaleRowDown2_16_C(const uint16 *src_ptr, ptrdiff_t src_stride, + uint16 *dst, int dst_width); + +void ScaleRowDown2Linear_C(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst, int dst_width); + +void ScaleRowDown2Linear_16_C(const uint16 *src_ptr, ptrdiff_t src_stride, + uint16 *dst, int dst_width); + +void ScaleRowDown2Box_C(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst, int dst_width); + +void ScaleRowDown2Box_16_C(const uint16 *src_ptr, ptrdiff_t src_stride, + uint16 *dst, int dst_width); + +void ScaleRowDown4_C(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst, int dst_width); + +void ScaleRowDown4_16_C(const uint16 *src_ptr, ptrdiff_t src_stride, + uint16 *dst, int dst_width); + +void ScaleRowDown4Box_C(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst, int dst_width); + +void ScaleRowDown4Box_16_C(const uint16 *src_ptr, ptrdiff_t src_stride, + uint16 *dst, int dst_width); + +void ScaleRowDown34_C(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst, int dst_width); + +void ScaleRowDown34_16_C(const uint16 *src_ptr, ptrdiff_t src_stride, + uint16 *dst, int dst_width); + +void ScaleRowDown34_0_Box_C(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *d, int dst_width); + +void ScaleRowDown34_0_Box_16_C(const uint16 *src_ptr, ptrdiff_t src_stride, + uint16 *d, int dst_width); + +void ScaleRowDown34_1_Box_C(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *d, int dst_width); + +void ScaleRowDown34_1_Box_16_C(const uint16 *src_ptr, ptrdiff_t src_stride, + uint16 *d, int dst_width); + +void ScaleCols_C(uint8 *dst_ptr, const uint8 *src_ptr, + int dst_width, int x, int dx); + +void ScaleCols_16_C(uint16 *dst_ptr, const uint16 *src_ptr, + int dst_width, int x, int dx); + +void ScaleColsUp2_C(uint8 *dst_ptr, const uint8 *src_ptr, + int dst_width, int, int); + +void ScaleColsUp2_16_C(uint16 *dst_ptr, const uint16 *src_ptr, + int dst_width, int, int); + +void ScaleFilterCols_C(uint8 *dst_ptr, const uint8 *src_ptr, + int dst_width, int x, int dx); + +void ScaleFilterCols_16_C(uint16 *dst_ptr, const uint16 *src_ptr, + int dst_width, int x, int dx); + +void ScaleFilterCols64_C(uint8 *dst_ptr, const uint8 *src_ptr, + int dst_width, int x, int dx); + +void ScaleFilterCols64_16_C(uint16 *dst_ptr, const uint16 *src_ptr, + int dst_width, int x, int dx); + +void ScaleRowDown38_C(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst, int dst_width); + +void ScaleRowDown38_16_C(const uint16 *src_ptr, ptrdiff_t src_stride, + uint16 *dst, int dst_width); + +void ScaleRowDown38_3_Box_C(const uint8 *src_ptr, + ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +void ScaleRowDown38_3_Box_16_C(const uint16 *src_ptr, + ptrdiff_t src_stride, + uint16 *dst_ptr, int dst_width); + +void ScaleRowDown38_2_Box_C(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +void ScaleRowDown38_2_Box_16_C(const uint16 *src_ptr, ptrdiff_t src_stride, + uint16 *dst_ptr, int dst_width); + +void ScaleAddRows_C(const uint8 *src_ptr, ptrdiff_t src_stride, + uint16 *dst_ptr, int src_width, int src_height); + +void ScaleAddRows_16_C(const uint16 *src_ptr, ptrdiff_t src_stride, + uint32 *dst_ptr, int src_width, int src_height); + +void ScaleARGBRowDown2_C(const uint8 *src_argb, + ptrdiff_t src_stride, + uint8 *dst_argb, int dst_width); + +void ScaleARGBRowDown2Linear_C(const uint8 *src_argb, + ptrdiff_t src_stride, + uint8 *dst_argb, int dst_width); + +void ScaleARGBRowDown2Box_C(const uint8 *src_argb, ptrdiff_t src_stride, + uint8 *dst_argb, int dst_width); + +void ScaleARGBRowDownEven_C(const uint8 *src_argb, ptrdiff_t src_stride, + int src_stepx, + uint8 *dst_argb, int dst_width); + +void ScaleARGBRowDownEvenBox_C(const uint8 *src_argb, + ptrdiff_t src_stride, + int src_stepx, + uint8 *dst_argb, int dst_width); + +void ScaleARGBCols_C(uint8 *dst_argb, const uint8 *src_argb, + int dst_width, int x, int dx); + +void ScaleARGBCols64_C(uint8 *dst_argb, const uint8 *src_argb, + int dst_width, int x, int dx); + +void ScaleARGBColsUp2_C(uint8 *dst_argb, const uint8 *src_argb, + int dst_width, int, int); + +void ScaleARGBFilterCols_C(uint8 *dst_argb, const uint8 *src_argb, + int dst_width, int x, int dx); + +void ScaleARGBFilterCols64_C(uint8 *dst_argb, const uint8 *src_argb, + int dst_width, int x, int dx); + +void ScaleRowDown2_SSE2(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +void ScaleRowDown2Linear_SSE2(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +void ScaleRowDown2Box_SSE2(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +void ScaleRowDown4_SSE2(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +void ScaleRowDown4Box_SSE2(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +void ScaleRowDown34_SSSE3(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +void ScaleRowDown34_1_Box_SSSE3(const uint8 *src_ptr, + ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +void ScaleRowDown34_0_Box_SSSE3(const uint8 *src_ptr, + ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +void ScaleRowDown38_SSSE3(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +void ScaleRowDown38_3_Box_SSSE3(const uint8 *src_ptr, + ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +void ScaleRowDown38_2_Box_SSSE3(const uint8 *src_ptr, + ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +void ScaleAddRows_SSE2(const uint8 *src_ptr, ptrdiff_t src_stride, + uint16 *dst_ptr, int src_width, + int src_height); + +void ScaleFilterCols_SSSE3(uint8 *dst_ptr, const uint8 *src_ptr, + int dst_width, int x, int dx); + +void ScaleColsUp2_SSE2(uint8 *dst_ptr, const uint8 *src_ptr, + int dst_width, int x, int dx); + +void ScaleARGBRowDown2_SSE2(const uint8 *src_argb, + ptrdiff_t src_stride, + uint8 *dst_argb, int dst_width); + +void ScaleARGBRowDown2Linear_SSE2(const uint8 *src_argb, + ptrdiff_t src_stride, + uint8 *dst_argb, int dst_width); + +void ScaleARGBRowDown2Box_SSE2(const uint8 *src_argb, + ptrdiff_t src_stride, + uint8 *dst_argb, int dst_width); + +void ScaleARGBRowDownEven_SSE2(const uint8 *src_argb, ptrdiff_t src_stride, + int src_stepx, + uint8 *dst_argb, int dst_width); + +void ScaleARGBRowDownEvenBox_SSE2(const uint8 *src_argb, + ptrdiff_t src_stride, + int src_stepx, + uint8 *dst_argb, int dst_width); + +void ScaleARGBCols_SSE2(uint8 *dst_argb, const uint8 *src_argb, + int dst_width, int x, int dx); + +void ScaleARGBFilterCols_SSSE3(uint8 *dst_argb, const uint8 *src_argb, + int dst_width, int x, int dx); + +void ScaleARGBColsUp2_SSE2(uint8 *dst_argb, const uint8 *src_argb, + int dst_width, int x, int dx); + +// Row functions. +void ScaleARGBRowDownEven_NEON(const uint8 *src_argb, ptrdiff_t src_stride, + int src_stepx, + uint8 *dst_argb, int dst_width); + +void ScaleARGBRowDownEvenBox_NEON(const uint8 *src_argb, ptrdiff_t src_stride, + int src_stepx, + uint8 *dst_argb, int dst_width); + +void ScaleARGBRowDown2_NEON(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst, int dst_width); + +void ScaleARGBRowDown2Box_NEON(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst, int dst_width); + +// ScaleRowDown2Box also used by planar functions +// NEON downscalers with interpolation. + +// Note - not static due to reuse in convert for 444 to 420. +void ScaleRowDown2_NEON(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst, int dst_width); + +void ScaleRowDown2Box_NEON(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst, int dst_width); + +void ScaleRowDown4_NEON(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +void ScaleRowDown4Box_NEON(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +// Down scale from 4 to 3 pixels. Use the neon multilane read/write +// to load up the every 4th pixel into a 4 different registers. +// Point samples 32 pixels to 24 pixels. +void ScaleRowDown34_NEON(const uint8 *src_ptr, + ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +void ScaleRowDown34_0_Box_NEON(const uint8 *src_ptr, + ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +void ScaleRowDown34_1_Box_NEON(const uint8 *src_ptr, + ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +// 32 -> 12 +void ScaleRowDown38_NEON(const uint8 *src_ptr, + ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +// 32x3 -> 12x1 +void ScaleRowDown38_3_Box_NEON(const uint8 *src_ptr, + ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +// 32x2 -> 12x1 +void ScaleRowDown38_2_Box_NEON(const uint8 *src_ptr, + ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +void ScaleRowDown2_MIPS_DSPR2(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst, int dst_width); + +void ScaleRowDown2Box_MIPS_DSPR2(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst, int dst_width); + +void ScaleRowDown4_MIPS_DSPR2(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst, int dst_width); + +void ScaleRowDown4Box_MIPS_DSPR2(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst, int dst_width); + +void ScaleRowDown34_MIPS_DSPR2(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst, int dst_width); + +void ScaleRowDown34_0_Box_MIPS_DSPR2(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *d, int dst_width); + +void ScaleRowDown34_1_Box_MIPS_DSPR2(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *d, int dst_width); + +void ScaleRowDown38_MIPS_DSPR2(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst, int dst_width); + +void ScaleRowDown38_2_Box_MIPS_DSPR2(const uint8 *src_ptr, ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +void ScaleRowDown38_3_Box_MIPS_DSPR2(const uint8 *src_ptr, + ptrdiff_t src_stride, + uint8 *dst_ptr, int dst_width); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_SCALE_ROW_H_ NOLINT diff --git a/app/src/main/cpp/include/libyuv/include/libyuv/version.h b/app/src/main/cpp/include/libyuv/include/libyuv/version.h new file mode 100644 index 0000000..14a1bbc --- /dev/null +++ b/app/src/main/cpp/include/libyuv/include/libyuv/version.h @@ -0,0 +1,16 @@ +/* + * Copyright 2012 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT +#define INCLUDE_LIBYUV_VERSION_H_ + +#define LIBYUV_VERSION 1256 + +#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT diff --git a/app/src/main/cpp/include/libyuv/include/libyuv/video_common.h b/app/src/main/cpp/include/libyuv/include/libyuv/video_common.h new file mode 100644 index 0000000..f9af6c6 --- /dev/null +++ b/app/src/main/cpp/include/libyuv/include/libyuv/video_common.h @@ -0,0 +1,182 @@ +/* + * Copyright 2011 The LibYuv Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +// Common definitions for video, including fourcc and VideoFormat. + +#ifndef INCLUDE_LIBYUV_VIDEO_COMMON_H_ // NOLINT +#define INCLUDE_LIBYUV_VIDEO_COMMON_H_ + +#include "../libyuv/basic_types.h" + +#ifdef __cplusplus +namespace libyuv { +extern "C" { +#endif + +////////////////////////////////////////////////////////////////////////////// +// Definition of FourCC codes +////////////////////////////////////////////////////////////////////////////// + +// Convert four characters to a FourCC code. +// Needs to be a macro otherwise the OS X compiler complains when the kFormat* +// constants are used in a switch. +#ifdef __cplusplus +#define FOURCC(a, b, c, d) ( \ + (static_cast<uint32>(a)) | (static_cast<uint32>(b) << 8) | \ + (static_cast<uint32>(c) << 16) | (static_cast<uint32>(d) << 24)) +#else +#define FOURCC(a, b, c, d) ( \ + ((uint32)(a)) | ((uint32)(b) << 8) | /* NOLINT */ \ + ((uint32)(c) << 16) | ((uint32)(d) << 24)) /* NOLINT */ +#endif + +// Some pages discussing FourCC codes: +// http://www.fourcc.org/yuv.php +// http://v4l2spec.bytesex.org/spec/book1.htm +// http://developer.apple.com/quicktime/icefloe/dispatch020.html +// http://msdn.microsoft.com/library/windows/desktop/dd206750.aspx#nv12 +// http://people.xiph.org/~xiphmont/containers/nut/nut4cc.txt + +// FourCC codes grouped according to implementation efficiency. +// Primary formats should convert in 1 efficient step. +// Secondary formats are converted in 2 steps. +// Auxilliary formats call primary converters. +enum FourCC { + // 9 Primary YUV formats: 5 planar, 2 biplanar, 2 packed. + FOURCC_I420 = FOURCC('I', '4', '2', '0'), + FOURCC_I422 = FOURCC('I', '4', '2', '2'), + FOURCC_I444 = FOURCC('I', '4', '4', '4'), + FOURCC_I411 = FOURCC('I', '4', '1', '1'), + FOURCC_I400 = FOURCC('I', '4', '0', '0'), + FOURCC_NV21 = FOURCC('N', 'V', '2', '1'), + FOURCC_NV12 = FOURCC('N', 'V', '1', '2'), + FOURCC_YUY2 = FOURCC('Y', 'U', 'Y', '2'), + FOURCC_UYVY = FOURCC('U', 'Y', 'V', 'Y'), + + // 2 Secondary YUV formats: row biplanar. + FOURCC_M420 = FOURCC('M', '4', '2', '0'), + FOURCC_Q420 = FOURCC('Q', '4', '2', '0'), + + // 9 Primary RGB formats: 4 32 bpp, 2 24 bpp, 3 16 bpp. + FOURCC_ARGB = FOURCC('A', 'R', 'G', 'B'), + FOURCC_BGRA = FOURCC('B', 'G', 'R', 'A'), + FOURCC_ABGR = FOURCC('A', 'B', 'G', 'R'), + FOURCC_24BG = FOURCC('2', '4', 'B', 'G'), + FOURCC_RAW = FOURCC('r', 'a', 'w', ' '), + FOURCC_RGBA = FOURCC('R', 'G', 'B', 'A'), + FOURCC_RGBP = FOURCC('R', 'G', 'B', 'P'), // rgb565 LE. + FOURCC_RGBO = FOURCC('R', 'G', 'B', 'O'), // argb1555 LE. + FOURCC_R444 = FOURCC('R', '4', '4', '4'), // argb4444 LE. + + // 4 Secondary RGB formats: 4 Bayer Patterns. + FOURCC_RGGB = FOURCC('R', 'G', 'G', 'B'), + FOURCC_BGGR = FOURCC('B', 'G', 'G', 'R'), + FOURCC_GRBG = FOURCC('G', 'R', 'B', 'G'), + FOURCC_GBRG = FOURCC('G', 'B', 'R', 'G'), + + // 1 Primary Compressed YUV format. + FOURCC_MJPG = FOURCC('M', 'J', 'P', 'G'), + + // 5 Auxiliary YUV variations: 3 with U and V planes are swapped, 1 Alias. + FOURCC_YV12 = FOURCC('Y', 'V', '1', '2'), + FOURCC_YV16 = FOURCC('Y', 'V', '1', '6'), + FOURCC_YV24 = FOURCC('Y', 'V', '2', '4'), + FOURCC_YU12 = FOURCC('Y', 'U', '1', '2'), // Linux version of I420. + FOURCC_J420 = FOURCC('J', '4', '2', '0'), + FOURCC_J400 = FOURCC('J', '4', '0', '0'), + + // 14 Auxiliary aliases. CanonicalFourCC() maps these to canonical fourcc. + FOURCC_IYUV = FOURCC('I', 'Y', 'U', 'V'), // Alias for I420. + FOURCC_YU16 = FOURCC('Y', 'U', '1', '6'), // Alias for I422. + FOURCC_YU24 = FOURCC('Y', 'U', '2', '4'), // Alias for I444. + FOURCC_YUYV = FOURCC('Y', 'U', 'Y', 'V'), // Alias for YUY2. + FOURCC_YUVS = FOURCC('y', 'u', 'v', 's'), // Alias for YUY2 on Mac. + FOURCC_HDYC = FOURCC('H', 'D', 'Y', 'C'), // Alias for UYVY. + FOURCC_2VUY = FOURCC('2', 'v', 'u', 'y'), // Alias for UYVY on Mac. + FOURCC_JPEG = FOURCC('J', 'P', 'E', 'G'), // Alias for MJPG. + FOURCC_DMB1 = FOURCC('d', 'm', 'b', '1'), // Alias for MJPG on Mac. + FOURCC_BA81 = FOURCC('B', 'A', '8', '1'), // Alias for BGGR. + FOURCC_RGB3 = FOURCC('R', 'G', 'B', '3'), // Alias for RAW. + FOURCC_BGR3 = FOURCC('B', 'G', 'R', '3'), // Alias for 24BG. + FOURCC_CM32 = FOURCC(0, 0, 0, 32), // Alias for BGRA kCMPixelFormat_32ARGB + FOURCC_CM24 = FOURCC(0, 0, 0, 24), // Alias for RAW kCMPixelFormat_24RGB + FOURCC_L555 = FOURCC('L', '5', '5', '5'), // Alias for RGBO. + FOURCC_L565 = FOURCC('L', '5', '6', '5'), // Alias for RGBP. + FOURCC_5551 = FOURCC('5', '5', '5', '1'), // Alias for RGBO. + + // 1 Auxiliary compressed YUV format set aside for capturer. + FOURCC_H264 = FOURCC('H', '2', '6', '4'), + + // Match any fourcc. + FOURCC_ANY = -1, +}; + +enum FourCCBpp { + // Canonical fourcc codes used in our code. + FOURCC_BPP_I420 = 12, + FOURCC_BPP_I422 = 16, + FOURCC_BPP_I444 = 24, + FOURCC_BPP_I411 = 12, + FOURCC_BPP_I400 = 8, + FOURCC_BPP_NV21 = 12, + FOURCC_BPP_NV12 = 12, + FOURCC_BPP_YUY2 = 16, + FOURCC_BPP_UYVY = 16, + FOURCC_BPP_M420 = 12, + FOURCC_BPP_Q420 = 12, + FOURCC_BPP_ARGB = 32, + FOURCC_BPP_BGRA = 32, + FOURCC_BPP_ABGR = 32, + FOURCC_BPP_RGBA = 32, + FOURCC_BPP_24BG = 24, + FOURCC_BPP_RAW = 24, + FOURCC_BPP_RGBP = 16, + FOURCC_BPP_RGBO = 16, + FOURCC_BPP_R444 = 16, + FOURCC_BPP_RGGB = 8, + FOURCC_BPP_BGGR = 8, + FOURCC_BPP_GRBG = 8, + FOURCC_BPP_GBRG = 8, + FOURCC_BPP_YV12 = 12, + FOURCC_BPP_YV16 = 16, + FOURCC_BPP_YV24 = 24, + FOURCC_BPP_YU12 = 12, + FOURCC_BPP_J420 = 12, + FOURCC_BPP_J400 = 8, + FOURCC_BPP_MJPG = 0, // 0 means unknown. + FOURCC_BPP_H264 = 0, + FOURCC_BPP_IYUV = 12, + FOURCC_BPP_YU16 = 16, + FOURCC_BPP_YU24 = 24, + FOURCC_BPP_YUYV = 16, + FOURCC_BPP_YUVS = 16, + FOURCC_BPP_HDYC = 16, + FOURCC_BPP_2VUY = 16, + FOURCC_BPP_JPEG = 1, + FOURCC_BPP_DMB1 = 1, + FOURCC_BPP_BA81 = 8, + FOURCC_BPP_RGB3 = 24, + FOURCC_BPP_BGR3 = 24, + FOURCC_BPP_CM32 = 32, + FOURCC_BPP_CM24 = 24, + + // Match any fourcc. + FOURCC_BPP_ANY = 0, // 0 means unknown. +}; + +// Converts fourcc aliases into canonical ones. +LIBYUV_API uint32 CanonicalFourCC(uint32 fourcc); + +#ifdef __cplusplus +} // extern "C" +} // namespace libyuv +#endif + +#endif // INCLUDE_LIBYUV_VIDEO_COMMON_H_ NOLINT diff --git a/app/src/main/cpp/include/vo-aacenc/cmnMemory.h b/app/src/main/cpp/include/vo-aacenc/cmnMemory.h new file mode 100644 index 0000000..c05dd3a --- /dev/null +++ b/app/src/main/cpp/include/vo-aacenc/cmnMemory.h @@ -0,0 +1,106 @@ +/* + ** Copyright 2003-2010, VisualOn, Inc. + ** + ** Licensed under the Apache License, Version 2.0 (the "License"); + ** you may not use this file except in compliance with the License. + ** You may obtain a copy of the License at + ** + ** http://www.apache.org/licenses/LICENSE-2.0 + ** + ** Unless required by applicable law or agreed to in writing, software + ** distributed under the License is distributed on an "AS IS" BASIS, + ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ** See the License for the specific language governing permissions and + ** limitations under the License. + */ +/******************************************************************************* + File: cmnMemory.h + + Content: memory operator implementation header file + +*******************************************************************************/ + +#ifndef __cmnMemory_H__ +#define __cmnMemory_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "voMem.h" + +//extern VO_MEM_OPERATOR g_memOP; + +/** + * Allocate memory + * \param uID [in] module ID + * \param uSize [in] size of memory + * \return value is the allocated memory address. NULL is failed. + */ +VO_U32 cmnMemAlloc(VO_S32 uID, VO_MEM_INFO *pMemInfo); + +/** + * Free up memory + * \param uID [in] module ID + * \param pMem [in] address of memory + * \return value 0, if succeeded. + */ +VO_U32 cmnMemFree(VO_S32 uID, VO_PTR pBuffer); + +/** + * memory set function + * \param uID [in] module ID + * \param pBuff [in/out] address of memory + * \param uValue [in] the value to be set + * \param uSize [in] the size to be set + * \return value 0, if succeeded. + */ +VO_U32 cmnMemSet(VO_S32 uID, VO_PTR pBuff, VO_U8 uValue, VO_U32 uSize); + +/** + * memory copy function + * \param uID [in] module ID + * \param pDest [in/out] address of destination memory + * \param pSource [in] address of source memory + * \param uSize [in] the size to be copied + * \return value 0, if succeeded. + */ +VO_U32 cmnMemCopy(VO_S32 uID, VO_PTR pDest, VO_PTR pSource, VO_U32 uSize); + +/** + * memory check function + * \param uID [in] module ID + * \param pBuff [in] address of buffer to be checked + * \param uSize [in] the size to be checked + * \return value 0, if succeeded. + */ +VO_U32 cmnMemCheck(VO_S32 uID, VO_PTR pBuffer, VO_U32 uSize); + +/** + * memory compare function + * \param uID [in] module ID + * \param pBuffer1 [in] address of buffer 1 to be compared + * \param pBuffer2 [in] address of buffer 2 to be compared + * \param uSize [in] the size to be compared + * \return value: same as standard C run-time memcmp() function. + */ +VO_S32 cmnMemCompare(VO_S32 uID, VO_PTR pBuffer1, VO_PTR pBuffer2, VO_U32 uSize); + +/** + * memory move function + * \param uID [in] module ID + * \param pDest [in/out] address of destination memory + * \param pSource [in] address of source memory + * \param uSize [in] the size to be moved + * \return value 0, if succeeded. + */ +VO_U32 cmnMemMove(VO_S32 uID, VO_PTR pDest, VO_PTR pSource, VO_U32 uSize); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif // __cmnMemory_H__ + + diff --git a/app/src/main/cpp/include/vo-aacenc/voAAC.h b/app/src/main/cpp/include/vo-aacenc/voAAC.h new file mode 100644 index 0000000..2d967e0 --- /dev/null +++ b/app/src/main/cpp/include/vo-aacenc/voAAC.h @@ -0,0 +1,74 @@ +/* + ** Copyright 2003-2010, VisualOn, Inc. + ** + ** Licensed under the Apache License, Version 2.0 (the "License"); + ** you may not use this file except in compliance with the License. + ** You may obtain a copy of the License at + ** + ** http://www.apache.org/licenses/LICENSE-2.0 + ** + ** Unless required by applicable law or agreed to in writing, software + ** distributed under the License is distributed on an "AS IS" BASIS, + ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ** See the License for the specific language governing permissions and + ** limitations under the License. + */ +/******************************************************************************* + File: voAAC.h + + Content: AAC codec APIs & data types + +*******************************************************************************/ + +#ifndef __voAAC_H__ +#define __voAAC_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "voAudio.h" + +/*! + * the frame type that the decoder supports + */ +typedef enum { + VOAAC_RAWDATA = 0, /*!<contains only raw aac data in a frame*/ + VOAAC_ADTS = 1, /*!<contains ADTS header + raw AAC data in a frame*/ + VOAAC_FT_MAX = VO_MAX_ENUM_VALUE +} VOAACFRAMETYPE; + +/*! + * the structure for AAC encoder input parameter + */ +typedef struct { + int sampleRate; /*! audio file sample rate */ + int bitRate; /*! encoder bit rate in bits/sec */ + short nChannels; /*! number of channels on input (1,2) */ + short adtsUsed; /*! whether write adts header */ +} AACENC_PARAM; + +/* AAC Param ID */ +#define VO_PID_AAC_Mdoule 0x42211000 +#define VO_PID_AAC_ENCPARAM VO_PID_AAC_Mdoule | 0x0040 /*!< get/set AAC encoder parameter, the parameter is a pointer to AACENC_PARAM */ + +/* AAC decoder error ID */ +#define VO_ERR_AAC_Mdoule 0x82210000 +#define VO_ERR_AAC_UNSFILEFORMAT (VO_ERR_AAC_Mdoule | 0xF001) +#define VO_ERR_AAC_UNSPROFILE (VO_ERR_AAC_Mdoule | 0xF002) + +/** + * Get audio encoder API interface + * \param pEncHandle [out] Return the AAC Encoder handle. + * \retval VO_ERR_OK Succeeded. + */ +VO_S32 VO_API voGetAACEncAPI(VO_AUDIO_CODECAPI *pEncHandle); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif // __voAAC_H__ + + + diff --git a/app/src/main/cpp/include/vo-aacenc/voAMRWB.h b/app/src/main/cpp/include/vo-aacenc/voAMRWB.h new file mode 100644 index 0000000..a82ad21 --- /dev/null +++ b/app/src/main/cpp/include/vo-aacenc/voAMRWB.h @@ -0,0 +1,88 @@ +/* + ** Copyright 2003-2010, VisualOn, Inc. + ** + ** Licensed under the Apache License, Version 2.0 (the "License"); + ** you may not use this file except in compliance with the License. + ** You may obtain a copy of the License at + ** + ** http://www.apache.org/licenses/LICENSE-2.0 + ** + ** Unless required by applicable law or agreed to in writing, software + ** distributed under the License is distributed on an "AS IS" BASIS, + ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ** See the License for the specific language governing permissions and + ** limitations under the License. + */ +/******************************************************************************* + File: voAMRWB.h + + Content: AMR-WB codec APIs & data types + +*******************************************************************************/ +#ifndef __VOAMRWB_H__ +#define __VOAMRWB_H__ + +#include "voAudio.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +#pragma pack(push, 4) + +/*!* the bit rate the codec supports*/ +typedef enum { + VOAMRWB_MDNONE = -1, /*!< Invalid mode */ + VOAMRWB_MD66 = 0, /*!< 6.60kbps */ + VOAMRWB_MD885 = 1, /*!< 8.85kbps */ + VOAMRWB_MD1265 = 2, /*!< 12.65kbps */ + VOAMRWB_MD1425 = 3, /*!< 14.25kbps */ + VOAMRWB_MD1585 = 4, /*!< 15.85bps */ + VOAMRWB_MD1825 = 5, /*!< 18.25bps */ + VOAMRWB_MD1985 = 6, /*!< 19.85kbps */ + VOAMRWB_MD2305 = 7, /*!< 23.05kbps */ + VOAMRWB_MD2385 = 8, /*!< 23.85kbps> */ + VOAMRWB_N_MODES = 9, /*!< Invalid mode */ + VOAMRWB_MODE_MAX = VO_MAX_ENUM_VALUE + +} VOAMRWBMODE; + +/*!* the frame format the codec supports*/ +typedef enum { + VOAMRWB_DEFAULT = 0, /*!< the frame type is the header (defined in RFC3267) + rawdata*/ + /*One word (2-byte) for sync word (0x6b21)*/ + /*One word (2-byte) for frame length N.*/ + /*N words (2-byte) containing N bits (bit 0 = 0x007f, bit 1 = 0x0081).*/ + VOAMRWB_ITU = 1, + /*One word (2-byte) for sync word (0x6b21).*/ + /*One word (2-byte) to indicate the frame type.*/ + /*One word (2-byte) to indicate the mode.*/ + /*N words (2-byte) containing N bits (bit 0 = 0xff81, bit 1 = 0x007f).*/ + VOAMRWB_RFC3267 = 2, /* see RFC 3267 */ + VOAMRWB_TMAX = VO_MAX_ENUM_VALUE +} VOAMRWBFRAMETYPE; + + +#define VO_PID_AMRWB_Module 0x42261000 +#define VO_PID_AMRWB_FORMAT (VO_PID_AMRWB_Module | 0x0002) +#define VO_PID_AMRWB_CHANNELS (VO_PID_AMRWB_Module | 0x0003) +#define VO_PID_AMRWB_SAMPLERATE (VO_PID_AMRWB_Module | 0x0004) +#define VO_PID_AMRWB_FRAMETYPE (VO_PID_AMRWB_Module | 0x0005) +#define VO_PID_AMRWB_MODE (VO_PID_AMRWB_Module | 0x0006) +#define VO_PID_AMRWB_DTX (VO_PID_AMRWB_Module | 0x0007) + +/** + * Get audio codec API interface + * \param pEncHandle [out] Return the AMRWB Encoder handle. + * \retval VO_ERR_OK Succeeded. + */ +VO_S32 VO_API voGetAMRWBEncAPI(VO_AUDIO_CODECAPI *pEncHandle); + + +#pragma pack(pop) +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + + +#endif //__VOAMRWB_H__ + diff --git a/app/src/main/cpp/include/vo-aacenc/voAudio.h b/app/src/main/cpp/include/vo-aacenc/voAudio.h new file mode 100644 index 0000000..b388c31 --- /dev/null +++ b/app/src/main/cpp/include/vo-aacenc/voAudio.h @@ -0,0 +1,172 @@ +/* + ** Copyright 2003-2010, VisualOn, Inc. + ** + ** Licensed under the Apache License, Version 2.0 (the "License"); + ** you may not use this file except in compliance with the License. + ** You may obtain a copy of the License at + ** + ** http://www.apache.org/licenses/LICENSE-2.0 + ** + ** Unless required by applicable law or agreed to in writing, software + ** distributed under the License is distributed on an "AS IS" BASIS, + ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ** See the License for the specific language governing permissions and + ** limitations under the License. + */ +/******************************************************************************* + File: voAudio.h + + Content: Audio types and functions + +*******************************************************************************/ + +#ifndef __voAudio_H__ +#define __voAudio_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "voIndex.h" +#include "voMem.h" + +#define VO_PID_AUDIO_BASE 0x42000000 /*!< The base param ID for AUDIO codec */ +#define VO_PID_AUDIO_FORMAT (VO_PID_AUDIO_BASE | 0X0001) /*!< The format data of audio in track */ +#define VO_PID_AUDIO_SAMPLEREATE (VO_PID_AUDIO_BASE | 0X0002) /*!< The sample rate of audio */ +#define VO_PID_AUDIO_CHANNELS (VO_PID_AUDIO_BASE | 0X0003) /*!< The channel of audio */ +#define VO_PID_AUDIO_BITRATE (VO_PID_AUDIO_BASE | 0X0004) /*!< The bit rate of audio */ +#define VO_PID_AUDIO_CHANNELMODE (VO_PID_AUDIO_BASE | 0X0005) /*!< The channel mode of audio */ + +#define VO_ERR_AUDIO_BASE 0x82000000 +#define VO_ERR_AUDIO_UNSCHANNEL VO_ERR_AUDIO_BASE | 0x0001 +#define VO_ERR_AUDIO_UNSSAMPLERATE VO_ERR_AUDIO_BASE | 0x0002 +#define VO_ERR_AUDIO_UNSFEATURE VO_ERR_AUDIO_BASE | 0x0003 + + +/** + *Enumeration used to define the possible audio coding formats. + */ +typedef enum VO_AUDIO_CODINGTYPE { + VO_AUDIO_CodingUnused = 0, /**< Placeholder value when coding is N/A */ + VO_AUDIO_CodingPCM, /**< Any variant of PCM coding */ + VO_AUDIO_CodingADPCM, /**< Any variant of ADPCM encoded data */ + VO_AUDIO_CodingAMRNB, /**< Any variant of AMR encoded data */ + VO_AUDIO_CodingAMRWB, /**< Any variant of AMR encoded data */ + VO_AUDIO_CodingAMRWBP, /**< Any variant of AMR encoded data */ + VO_AUDIO_CodingQCELP13, /**< Any variant of QCELP 13kbps encoded data */ + VO_AUDIO_CodingEVRC, /**< Any variant of EVRC encoded data */ + VO_AUDIO_CodingAAC, /**< Any variant of AAC encoded data, 0xA106 - ISO/MPEG-4 AAC, 0xFF - AAC */ + VO_AUDIO_CodingAC3, /**< Any variant of AC3 encoded data */ + VO_AUDIO_CodingFLAC, /**< Any variant of FLAC encoded data */ + VO_AUDIO_CodingMP1, /**< Any variant of MP1 encoded data */ + VO_AUDIO_CodingMP3, /**< Any variant of MP3 encoded data */ + VO_AUDIO_CodingOGG, /**< Any variant of OGG encoded data */ + VO_AUDIO_CodingWMA, /**< Any variant of WMA encoded data */ + VO_AUDIO_CodingRA, /**< Any variant of RA encoded data */ + VO_AUDIO_CodingMIDI, /**< Any variant of MIDI encoded data */ + VO_AUDIO_CodingDRA, /**< Any variant of dra encoded data */ + VO_AUDIO_CodingG729, /**< Any variant of dra encoded data */ + VO_AUDIO_Coding_MAX = VO_MAX_ENUM_VALUE +} VO_AUDIO_CODINGTYPE; + +/*! +* the channel type value +*/ +typedef enum { + VO_CHANNEL_CENTER = 1, /*!<center channel*/ + VO_CHANNEL_FRONT_LEFT = 1 << 1, /*!<front left channel*/ + VO_CHANNEL_FRONT_RIGHT = 1 << 2, /*!<front right channel*/ + VO_CHANNEL_SIDE_LEFT = 1 << 3, /*!<side left channel*/ + VO_CHANNEL_SIDE_RIGHT = 1 << 4, /*!<side right channel*/ + VO_CHANNEL_BACK_LEFT = 1 << 5, /*!<back left channel*/ + VO_CHANNEL_BACK_RIGHT = 1 << 6, /*!<back right channel*/ + VO_CHANNEL_BACK_CENTER = 1 << 7, /*!<back center channel*/ + VO_CHANNEL_LFE_BASS = 1 << 8, /*!<low-frequency effects bass channel*/ + VO_CHANNEL_ALL = 0xffff,/*!<[default] include all channels */ + VO_CHANNEL_MAX = VO_MAX_ENUM_VALUE +} VO_AUDIO_CHANNELTYPE; + +/** + * General audio format info + */ +typedef struct { + VO_S32 SampleRate; /*!< Sample rate */ + VO_S32 Channels; /*!< Channel count */ + VO_S32 SampleBits; /*!< Bits per sample */ +} VO_AUDIO_FORMAT; + +/** + * General audio output info + */ +typedef struct { + VO_AUDIO_FORMAT Format; /*!< Sample rate */ + VO_U32 InputUsed; /*!< Channel count */ + VO_U32 Resever; /*!< Resevered */ +} VO_AUDIO_OUTPUTINFO; + +/** + * General audio codec function set + */ +typedef struct VO_AUDIO_CODECAPI { + /** + * Init the audio codec module and return codec handle + * \param phCodec [OUT] Return the video codec handle + * \param vType [IN] The codec type if the module support multi codec. + * \param pUserData [IN] The init param. It is either a memory operator or an allocated memory + * \retval VO_ERR_NONE Succeeded. + */ + VO_U32 (VO_API *Init)(VO_HANDLE *phCodec, VO_AUDIO_CODINGTYPE vType, + VO_CODEC_INIT_USERDATA *pUserData); + + /** + * Set input audio data. + * \param hCodec [IN]] The codec handle which was created by Init function. + * \param pInput [IN] The input buffer param. + * \retval VO_ERR_NONE Succeeded. + */ + VO_U32 (VO_API *SetInputData)(VO_HANDLE hCodec, VO_CODECBUFFER *pInput); + + /** + * Get the outut audio data + * \param hCodec [IN]] The codec handle which was created by Init function. + * \param pOutBuffer [OUT] The output audio data + * \param pOutInfo [OUT] The codec fills audio format and the input data size used in current call. + * pOutInfo->InputUsed is total used input data size in byte. + * \retval VO_ERR_NONE Succeeded. + * VO_ERR_INPUT_BUFFER_SMALL. The input was finished or the input data was not enought. Continue to input + * data before next call. + */ + VO_U32 (VO_API *GetOutputData)(VO_HANDLE hCodec, VO_CODECBUFFER *pOutBuffer, + VO_AUDIO_OUTPUTINFO *pOutInfo); + + /** + * Set the parameter for the specified param ID. + * \param hCodec [IN]] The codec handle which was created by Init function. + * \param uParamID [IN] The param ID. + * \param pData [IN] The param value. + * \retval VO_ERR_NONE Succeeded. + */ + VO_U32 (VO_API *SetParam)(VO_HANDLE hCodec, VO_S32 uParamID, VO_PTR pData); + + /** + * Get the parameter for the specified param ID. + * \param hCodec [IN]] The codec handle which was created by Init function. + * \param uParamID [IN] The param ID. + * \param pData [IN] The param value. + * \retval VO_ERR_NONE Succeeded. + */ + VO_U32 (VO_API *GetParam)(VO_HANDLE hCodec, VO_S32 uParamID, VO_PTR pData); + + /** + * Uninit the Codec. + * \param hCodec [IN]] The codec handle which was created by Init function. + * \retval VO_ERR_NONE Succeeded. + */ + VO_U32 (VO_API *Uninit)(VO_HANDLE hCodec); +} VO_AUDIO_CODECAPI; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif // __voAudio_H__ diff --git a/app/src/main/cpp/include/vo-aacenc/voIndex.h b/app/src/main/cpp/include/vo-aacenc/voIndex.h new file mode 100644 index 0000000..138b76d --- /dev/null +++ b/app/src/main/cpp/include/vo-aacenc/voIndex.h @@ -0,0 +1,192 @@ +/* + ** Copyright 2003-2010, VisualOn, Inc. + ** + ** Licensed under the Apache License, Version 2.0 (the "License"); + ** you may not use this file except in compliance with the License. + ** You may obtain a copy of the License at + ** + ** http://www.apache.org/licenses/LICENSE-2.0 + ** + ** Unless required by applicable law or agreed to in writing, software + ** distributed under the License is distributed on an "AS IS" BASIS, + ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ** See the License for the specific language governing permissions and + ** limitations under the License. + */ +/******************************************************************************* + File: voIndex.h + + Content: module and ID definition + +*******************************************************************************/ + +#ifndef __voIndex_H__ +#define __voIndex_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "voType.h" + +/* Define the module ID */ +#define _MAKE_SOURCE_ID(id, name) \ +VO_INDEX_SRC_##name = _VO_INDEX_SOURCE | id, + +#define _MAKE_CODEC_ID(id, name) \ +VO_INDEX_DEC_##name = _VO_INDEX_DEC | id, \ +VO_INDEX_ENC_##name = _VO_INDEX_ENC | id, + +#define _MAKE_EFFECT_ID(id, name) \ +VO_INDEX_EFT_##name = _VO_INDEX_EFFECT | id, + +#define _MAKE_SINK_ID(id, name) \ +VO_INDEX_SNK_##name = _VO_INDEX_SINK | id, + +#define _MAKE_FILTER_ID(id, name) \ +VO_INDEX_FLT_##name = _VO_INDEX_FILTER | id, + +#define _MAKE_OMX_ID(id, name) \ +VO_INDEX_OMX_##name = _VO_INDEX_OMX | id, + +#define _MAKE_MFW_ID(id, name) \ +VO_INDEX_MFW_##name = _VO_INDEX_MFW | id, + +enum { + _VO_INDEX_SOURCE = 0x01000000, + _VO_INDEX_DEC = 0x02000000, + _VO_INDEX_ENC = 0x03000000, + _VO_INDEX_EFFECT = 0x04000000, + _VO_INDEX_SINK = 0x05000000, + _VO_INDEX_FILTER = 0x06000000, + _VO_INDEX_OMX = 0x07000000, + _VO_INDEX_MFW = 0x08000000, + + // define file parser modules + _MAKE_SOURCE_ID (0x010000, MP4) + _MAKE_SOURCE_ID (0x020000, AVI) + _MAKE_SOURCE_ID (0x030000, ASF) + _MAKE_SOURCE_ID (0x040000, REAL) + _MAKE_SOURCE_ID (0x050000, AUDIO) + _MAKE_SOURCE_ID (0x060000, FLASH) + _MAKE_SOURCE_ID (0x070000, OGG) + _MAKE_SOURCE_ID (0x080000, MKV) + + // define network source modules + _MAKE_SOURCE_ID (0x110000, RTSP) + _MAKE_SOURCE_ID (0x120000, HTTP) + + // define CMMB source modules + _MAKE_SOURCE_ID (0x200000, CMMB) + _MAKE_SOURCE_ID (0x210000, CMMB_INNO) + _MAKE_SOURCE_ID (0x220000, CMMB_TELE) + _MAKE_SOURCE_ID (0x230000, CMMB_SIANO) + + // define DVBT source modules + _MAKE_SOURCE_ID (0x300000, DVBT) + _MAKE_SOURCE_ID (0x310000, DVBT_DIBCOM) + + // define other source modules + _MAKE_SOURCE_ID (0x400000, ID3) + + // define video codec modules + _MAKE_CODEC_ID (0x010000, H264) + _MAKE_CODEC_ID (0x020000, MPEG4) + _MAKE_CODEC_ID (0x030000, H263) + _MAKE_CODEC_ID (0x040000, S263) + _MAKE_CODEC_ID (0x050000, RV) + _MAKE_CODEC_ID (0x060000, WMV) + _MAKE_CODEC_ID (0x070000, DIVX3) + _MAKE_CODEC_ID (0x080000, MJPEG) + _MAKE_CODEC_ID (0x090000, MPEG2) + _MAKE_CODEC_ID (0x0A0000, VP6) + + // define audio codec modules + _MAKE_CODEC_ID (0x210000, AAC) + _MAKE_CODEC_ID (0x220000, MP3) + _MAKE_CODEC_ID (0x230000, WMA) + _MAKE_CODEC_ID (0x240000, RA) + _MAKE_CODEC_ID (0x250000, AMRNB) + _MAKE_CODEC_ID (0x260000, AMRWB) + _MAKE_CODEC_ID (0x270000, AMRWBP) + _MAKE_CODEC_ID (0x280000, QCELP) + _MAKE_CODEC_ID (0x290000, EVRC) + _MAKE_CODEC_ID (0x2A0000, ADPCM) + _MAKE_CODEC_ID (0x2B0000, MIDI) + _MAKE_CODEC_ID (0x2C0000, AC3) + _MAKE_CODEC_ID (0x2D0000, FLAC) + _MAKE_CODEC_ID (0x2E0000, DRA) + _MAKE_CODEC_ID (0x2F0000, OGG) + _MAKE_CODEC_ID (0x300000, G729) + + // define image codec modules + _MAKE_CODEC_ID (0x410000, JPEG) + _MAKE_CODEC_ID (0x420000, GIF) + _MAKE_CODEC_ID (0x430000, PNG) + _MAKE_CODEC_ID (0x440000, TIF) + + // define effect modules + _MAKE_EFFECT_ID (0x010000, EQ) + + // define sink modules + _MAKE_SINK_ID (0x010000, VIDEO) + _MAKE_SINK_ID (0x020000, AUDIO) + _MAKE_SINK_ID (0x030000, CCRRR) + _MAKE_SINK_ID (0x040000, CCRRV) + + _MAKE_SINK_ID (0x110000, MP4) + _MAKE_SINK_ID (0x120000, AVI) + _MAKE_SINK_ID (0x130000, AFW) + + // define media frame module ID + _MAKE_MFW_ID (0x010000, VOMMPLAY) + _MAKE_MFW_ID (0x020000, VOMMREC) + _MAKE_MFW_ID (0x030000, VOME) +}; + + +/* define the error ID */ +#define VO_ERR_NONE 0x00000000 +#define VO_ERR_FINISH 0x00000001 +#define VO_ERR_BASE 0X80000000 +#define VO_ERR_FAILED 0x80000001 +#define VO_ERR_OUTOF_MEMORY 0x80000002 +#define VO_ERR_NOT_IMPLEMENT 0x80000003 +#define VO_ERR_INVALID_ARG 0x80000004 +#define VO_ERR_INPUT_BUFFER_SMALL 0x80000005 +#define VO_ERR_OUTPUT_BUFFER_SMALL 0x80000006 +#define VO_ERR_WRONG_STATUS 0x80000007 +#define VO_ERR_WRONG_PARAM_ID 0x80000008 +#define VO_ERR_LICENSE_ERROR 0x80000009 + +/* xxx is the module ID +#define VO_ERR_FAILED 0x8xxx0001 +#define VO_ERR_OUTOF_MEMORY 0x8xxx0002 +#define VO_ERR_NOT_IMPLEMENT 0x8xxx0003 +#define VO_ERR_INVALID_ARG 0x8xxx0004 +#define VO_ERR_INPUT_BUFFER_SMALL 0x8xxx0005 +#define VO_ERR_OUTPUT_BUFFER_SMALL 0x8xxx0006 +#define VO_ERR_WRONG_STATUS 0x8xxx0007 +#define VO_ERR_WRONG_PARAM_ID 0x8xxx0008 +#define VO_ERR_LICENSE_ERROR 0x8xxx0009 +// Module own error ID +#define VO_ERR_Module 0x8xxx0X00 +*/ + +#define VO_PID_COMMON_BASE 0x40000000 /*!< The base of common param ID */ +#define VO_PID_COMMON_QUERYMEM (VO_PID_COMMON_BASE | 0X0001) /*!< Query the memory needed; Reserved. */ +#define VO_PID_COMMON_INPUTTYPE (VO_PID_COMMON_BASE | 0X0002) /*!< Set or get the input buffer type. VO_INPUT_TYPE */ +#define VO_PID_COMMON_HASRESOURCE (VO_PID_COMMON_BASE | 0X0003) /*!< Query it has resource to be used. VO_U32 *, 1 have, 0 No */ +#define VO_PID_COMMON_HEADDATA (VO_PID_COMMON_BASE | 0X0004) /*!< Decoder track header data. VO_CODECBUFFER * */ +#define VO_PID_COMMON_FLUSH (VO_PID_COMMON_BASE | 0X0005) /*!< Flush the codec buffer. VO_U32 *, 1 Flush, 0 No * */ + +/* +// Module Param ID +#define VO_ID_Mdoule 0x0xxx1000 +*/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif // __voIndex_H__ diff --git a/app/src/main/cpp/include/vo-aacenc/voMem.h b/app/src/main/cpp/include/vo-aacenc/voMem.h new file mode 100644 index 0000000..30dd331 --- /dev/null +++ b/app/src/main/cpp/include/vo-aacenc/voMem.h @@ -0,0 +1,69 @@ +/* + ** Copyright 2003-2010, VisualOn, Inc. + ** + ** Licensed under the Apache License, Version 2.0 (the "License"); + ** you may not use this file except in compliance with the License. + ** You may obtain a copy of the License at + ** + ** http://www.apache.org/licenses/LICENSE-2.0 + ** + ** Unless required by applicable law or agreed to in writing, software + ** distributed under the License is distributed on an "AS IS" BASIS, + ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ** See the License for the specific language governing permissions and + ** limitations under the License. + */ +/******************************************************************************* + File: voMem.h + + Content: memory functions & data structures + +*******************************************************************************/ + +#ifndef __voMem_H__ +#define __voMem_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "voIndex.h" + +typedef struct { + VO_S32 Size; /*!< Buffer stride */ + VO_S32 Flag; + VO_PTR VBuffer; /*!< user data pointer */ + VO_PTR PBuffer; /*!< user data pointer */ +} + VO_MEM_INFO; + +typedef struct VO_MEM_OPERATOR { + VO_U32 (VO_API *Alloc)(VO_S32 uID, VO_MEM_INFO *pMemInfo); + + VO_U32 (VO_API *Free)(VO_S32 uID, VO_PTR pBuff); + + VO_U32 (VO_API *Set)(VO_S32 uID, VO_PTR pBuff, VO_U8 uValue, VO_U32 uSize); + + VO_U32 (VO_API *Copy)(VO_S32 uID, VO_PTR pDest, VO_PTR pSource, VO_U32 uSize); + + VO_U32 (VO_API *Check)(VO_S32 uID, VO_PTR pBuffer, VO_U32 uSize); + + VO_S32 (VO_API *Compare)(VO_S32 uID, VO_PTR pBuffer1, VO_PTR pBuffer2, VO_U32 uSize); + + VO_U32 (VO_API *Move)(VO_S32 uID, VO_PTR pDest, VO_PTR pSource, VO_U32 uSize); +} VO_MEM_OPERATOR; + +#define voMemAlloc(pBuff, pMemOP, ID, nSize) \ +{ \ + VO_MEM_INFO voMemInfo; \ + voMemInfo.Size=nSize; \ + pMemOP->Alloc(ID, &voMemInfo); \ + pBuff=(VO_PBYTE)voMemInfo.VBuffer; \ +} + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif // __voMem_H__ diff --git a/app/src/main/cpp/include/vo-aacenc/voType.h b/app/src/main/cpp/include/vo-aacenc/voType.h new file mode 100644 index 0000000..ece8843 --- /dev/null +++ b/app/src/main/cpp/include/vo-aacenc/voType.h @@ -0,0 +1,221 @@ +/* + ** Copyright 2003-2010, VisualOn, Inc. + ** + ** Licensed under the Apache License, Version 2.0 (the "License"); + ** you may not use this file except in compliance with the License. + ** You may obtain a copy of the License at + ** + ** http://www.apache.org/licenses/LICENSE-2.0 + ** + ** Unless required by applicable law or agreed to in writing, software + ** distributed under the License is distributed on an "AS IS" BASIS, + ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ** See the License for the specific language governing permissions and + ** limitations under the License. + */ +/******************************************************************************* + File: voType.h + + Content: data type definition + +*******************************************************************************/ +#ifndef __voType_H__ +#define __voType_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifdef _WIN32 +# define VO_API __cdecl +# define VO_CBI __stdcall +#else +# define VO_API +# define VO_CBI +#endif //_WIN32 + +/** VO_IN is used to identify inputs to an VO function. This designation + will also be used in the case of a pointer that points to a parameter + that is used as an output. */ +#ifndef VO_IN +#define VO_IN +#endif + +/** VO_OUT is used to identify outputs from an VO function. This + designation will also be used in the case of a pointer that points + to a parameter that is used as an input. */ +#ifndef VO_OUT +#define VO_OUT +#endif + +/** VO_INOUT is used to identify parameters that may be either inputs or + outputs from an VO function at the same time. This designation will + also be used in the case of a pointer that points to a parameter that + is used both as an input and an output. */ +#ifndef VO_INOUT +#define VO_INOUT +#endif + +#define VO_MAX_ENUM_VALUE 0X7FFFFFFF + +/** VO_VOID */ +typedef void VO_VOID; + +/** VO_U8 is an 8 bit unsigned quantity that is byte aligned */ +typedef unsigned char VO_U8; + +/** VO_BYTE is an 8 bit unsigned quantity that is byte aligned */ +typedef unsigned char VO_BYTE; + +/** VO_S8 is an 8 bit signed quantity that is byte aligned */ +typedef signed char VO_S8; + +/** VO_CHAR is an 8 bit signed quantity that is byte aligned */ +typedef char VO_CHAR; + +/** VO_U16 is a 16 bit unsigned quantity that is 16 bit word aligned */ +typedef unsigned short VO_U16; + +/** VO_WCHAR is a 16 bit unsigned quantity that is 16 bit word aligned */ +#if defined _WIN32 +typedef unsigned short VO_WCHAR; +typedef unsigned short* VO_PWCHAR; +#elif defined LINUX +typedef unsigned char VO_WCHAR; +typedef unsigned char* VO_PWCHAR; +#endif + +/** VO_S16 is a 16 bit signed quantity that is 16 bit word aligned */ +typedef signed short VO_S16; + +/** VO_U32 is a 32 bit unsigned quantity that is 32 bit word aligned */ +typedef unsigned long VO_U32; + +/** VO_S32 is a 32 bit signed quantity that is 32 bit word aligned */ +typedef signed long VO_S32; + +/* Users with compilers that cannot accept the "long long" designation should + define the VO_SKIP64BIT macro. It should be noted that this may cause + some components to fail to compile if the component was written to require + 64 bit integral types. However, these components would NOT compile anyway + since the compiler does not support the way the component was written. +*/ +#ifndef VO_SKIP64BIT +#ifdef _MSC_VER +/** VO_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */ +typedef unsigned __int64 VO_U64; +/** VO_S64 is a 64 bit signed quantity that is 64 bit word aligned */ +typedef signed __int64 VO_S64; +#else // WIN32 +/** VO_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */ +typedef unsigned long long VO_U64; +/** VO_S64 is a 64 bit signed quantity that is 64 bit word aligned */ +typedef signed long long VO_S64; +#endif // WIN32 +#endif // VO_SKIP64BIT + +/** The VO_BOOL type is intended to be used to represent a true or a false + value when passing parameters to and from the VO core and components. The + VO_BOOL is a 32 bit quantity and is aligned on a 32 bit word boundary. + */ +typedef enum VO_BOOL { + VO_FALSE = 0, + VO_TRUE = !VO_FALSE, + VO_BOOL_MAX = VO_MAX_ENUM_VALUE +} VO_BOOL; + +/** The VO_PTR type is intended to be used to pass pointers between the VO + applications and the VO Core and components. This is a 32 bit pointer and + is aligned on a 32 bit boundary. + */ +typedef void *VO_PTR; + +/** The VO_HANDLE type is intended to be used to pass pointers between the VO + applications and the VO Core and components. This is a 32 bit pointer and + is aligned on a 32 bit boundary. + */ +typedef void *VO_HANDLE; + +/** The VO_STRING type is intended to be used to pass "C" type strings between + the application and the core and component. The VO_STRING type is a 32 + bit pointer to a zero terminated string. The pointer is word aligned and + the string is byte aligned. + */ +typedef char *VO_PCHAR; + +/** The VO_PBYTE type is intended to be used to pass arrays of bytes such as + buffers between the application and the component and core. The VO_PBYTE + type is a 32 bit pointer to a zero terminated string. The pointer is word + aligned and the string is byte aligned. + */ +typedef unsigned char *VO_PBYTE; + +/** The VO_PTCHAR type is intended to be used to pass arrays of wchar such as + unicode char between the application and the component and core. The VO_PTCHAR + type is a 32 bit pointer to a zero terminated string. The pointer is word + aligned and the string is byte aligned. + */ +/* +#if !defined LINUX +typedef unsigned short* VO_PTCHAR; +typedef unsigned short* VO_TCHAR; +#else +typedef char* VO_PTCHAR; +typedef char VO_TCHAR; +#endif +*/ + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +/** + * Input stream format, Frame or Stream.. + */ +typedef enum { + VO_INPUT_FRAME = 1, /*!< Input contains completely frame(s) data. */ + VO_INPUT_STREAM, /*!< Input is stream data. */ + VO_INPUT_STREAM_MAX = VO_MAX_ENUM_VALUE +} VO_INPUT_TYPE; + + +/** + * General data buffer, used as input or output. + */ +typedef struct { + VO_PBYTE Buffer; /*!< Buffer pointer */ + VO_U32 Length; /*!< Buffer size in byte */ + VO_S64 Time; /*!< The time of the buffer */ +} VO_CODECBUFFER; + + +/** + * The init memdata flag. + */ +typedef enum { + VO_IMF_USERMEMOPERATOR = 0, /*!< memData is the pointer of memoperator function*/ + VO_IMF_PREALLOCATEDBUFFER = 1, /*!< memData is preallocated memory*/ + VO_IMF_MAX = VO_MAX_ENUM_VALUE +} VO_INIT_MEM_FlAG; + + +/** + * The init memory structure.. + */ +typedef struct { + VO_INIT_MEM_FlAG memflag; /*!<memory flag */ + VO_PTR memData; /*!<a pointer to VO_MEM_OPERATOR or a preallocated buffer */ + VO_U32 reserved1; /*!<reserved */ + VO_U32 reserved2; /*!<reserved */ +} VO_CODEC_INIT_USERDATA; + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif // __voType_H__ diff --git a/app/src/main/cpp/include/vo-amrwbenc/enc_if.h b/app/src/main/cpp/include/vo-amrwbenc/enc_if.h new file mode 100644 index 0000000..ca192d7 --- /dev/null +++ b/app/src/main/cpp/include/vo-amrwbenc/enc_if.h @@ -0,0 +1,36 @@ +/* ------------------------------------------------------------------ + * Copyright (C) 2010 Martin Storsjo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. + * See the License for the specific language governing permissions + * and limitations under the License. + * ------------------------------------------------------------------- + */ + +#ifndef VO_AMRWBENC_ENC_IF_H +#define VO_AMRWBENC_ENC_IF_H + +#ifdef __cplusplus +extern "C" { +#endif + +void *E_IF_init(void); + +int E_IF_encode(void *state, int mode, const short *speech, unsigned char *out, int dtx); + +void E_IF_exit(void *state); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/app/src/main/cpp/lib/Android.mk b/app/src/main/cpp/lib/Android.mk new file mode 100644 index 0000000..2c41614 --- /dev/null +++ b/app/src/main/cpp/lib/Android.mk @@ -0,0 +1,106 @@ +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +#FFMPEG_LIB=$(LOCAL_PATH) +FFMPEG_INCLUDE=../../include/ffmpeg + +include $(CLEAR_VARS) +LOCAL_MODULE:= libavcodec +LOCAL_SRC_FILES:= $(TARGET_ARCH_ABI)/libavcodec.a +LOCAL_EXPORT_C_INCLUDES := $(FFMPEG_INCLUDE) +include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE:= libavformat +LOCAL_SRC_FILES:= $(TARGET_ARCH_ABI)/libavformat.a +LOCAL_EXPORT_C_INCLUDES := $(FFMPEG_INCLUDE) +include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE:= libavutil +LOCAL_SRC_FILES:= $(TARGET_ARCH_ABI)/libavutil.a +LOCAL_EXPORT_C_INCLUDES := $(FFMPEG_INCLUDE) +include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE:= libvo-aacenc +LOCAL_SRC_FILES:=$(TARGET_ARCH_ABI)/libvo-aacenc.a +LOCAL_EXPORT_C_INCLUDES := $(FFMPEG_INCLUDE) +include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE:= libvo-amrwbenc +LOCAL_SRC_FILES:=$(TARGET_ARCH_ABI)/libvo-amrwbenc.a +LOCAL_EXPORT_C_INCLUDES := $(FFMPEG_INCLUDE) +include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE:= libavfilter +LOCAL_SRC_FILES:=$(TARGET_ARCH_ABI)/libavfilter.a +LOCAL_EXPORT_C_INCLUDES := $(FFMPEG_INCLUDE) +include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE:= libavresample +LOCAL_SRC_FILES:= $(TARGET_ARCH_ABI)/libavresample.a +LOCAL_EXPORT_C_INCLUDES := $(FFMPEG_INCLUDE) +include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE:= libswresample +LOCAL_SRC_FILES:=$(TARGET_ARCH_ABI)/libswresample.a +LOCAL_EXPORT_C_INCLUDES := $(FFMPEG_INCLUDE) +include $(PREBUILT_STATIC_LIBRARY) + +#include $(CLEAR_VARS) +#LOCAL_MODULE:= libpostproc +#LOCAL_SRC_FILES:=$(TARGET_ARCH_ABI)/libpostproc.a +#LOCAL_EXPORT_C_INCLUDES := $(FFMPEG_INCLUDE) +#include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE:= libswscale +LOCAL_SRC_FILES:= $(TARGET_ARCH_ABI)/libswscale.a +LOCAL_EXPORT_C_INCLUDES := $(FFMPEG_INCLUDE) +include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE:= libass +LOCAL_SRC_FILES:=$(TARGET_ARCH_ABI)/libass.a +LOCAL_EXPORT_C_INCLUDES := $(FFMPEG_INCLUDE) +include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE:= libfreetype +LOCAL_SRC_FILES:=$(TARGET_ARCH_ABI)/libfreetype.a +LOCAL_EXPORT_C_INCLUDES := $(FFMPEG_INCLUDE) +include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE:= libfribidi +LOCAL_SRC_FILES:=$(TARGET_ARCH_ABI)/libfribidi.a +LOCAL_EXPORT_C_INCLUDES := $(FFMPEG_INCLUDE) +include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE := libffmpeg +LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libffmpeg.so +LOCAL_EXPORT_C_INCLUDES := $(FFMPEG_INCLUDE) +include $(PREBUILT_SHARED_LIBRARY) + + + + +ifeq ($(TARGET_ARCH) ,x86) + include $(CLEAR_VARS) + LOCAL_MODULE := libyuv2 + LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libyuv2.so + LOCAL_EXPORT_C_INCLUDES := $(FFMPEG_INCLUDE) + include $(PREBUILT_SHARED_LIBRARY) +else + include $(CLEAR_VARS) + LOCAL_MODULE := libyuv2 + LOCAL_SRC_FILES :=$(TARGET_ARCH_ABI)/libyuv2.so + LOCAL_EXPORT_C_INCLUDES := $(FFMPEG_INCLUDE) + include $(PREBUILT_SHARED_LIBRARY) +endif diff --git a/app/src/main/cpp/lib/arm64-v8a/libass.a b/app/src/main/cpp/lib/arm64-v8a/libass.a new file mode 100644 index 0000000..5bd6659 Binary files /dev/null and b/app/src/main/cpp/lib/arm64-v8a/libass.a differ diff --git a/app/src/main/cpp/lib/arm64-v8a/libavcodec.a b/app/src/main/cpp/lib/arm64-v8a/libavcodec.a new file mode 100644 index 0000000..9c31e06 Binary files /dev/null and b/app/src/main/cpp/lib/arm64-v8a/libavcodec.a differ diff --git a/app/src/main/cpp/lib/arm64-v8a/libavdevice.a b/app/src/main/cpp/lib/arm64-v8a/libavdevice.a new file mode 100644 index 0000000..7bf5efd Binary files /dev/null and b/app/src/main/cpp/lib/arm64-v8a/libavdevice.a differ diff --git a/app/src/main/cpp/lib/arm64-v8a/libavfilter.a b/app/src/main/cpp/lib/arm64-v8a/libavfilter.a new file mode 100644 index 0000000..e4018e4 Binary files /dev/null and b/app/src/main/cpp/lib/arm64-v8a/libavfilter.a differ diff --git a/app/src/main/cpp/lib/arm64-v8a/libavformat.a b/app/src/main/cpp/lib/arm64-v8a/libavformat.a new file mode 100644 index 0000000..2c6b57a Binary files /dev/null and b/app/src/main/cpp/lib/arm64-v8a/libavformat.a differ diff --git a/app/src/main/cpp/lib/arm64-v8a/libavresample.a b/app/src/main/cpp/lib/arm64-v8a/libavresample.a new file mode 100644 index 0000000..3f3972c Binary files /dev/null and b/app/src/main/cpp/lib/arm64-v8a/libavresample.a differ diff --git a/app/src/main/cpp/lib/arm64-v8a/libavutil.a b/app/src/main/cpp/lib/arm64-v8a/libavutil.a new file mode 100644 index 0000000..5d42b00 Binary files /dev/null and b/app/src/main/cpp/lib/arm64-v8a/libavutil.a differ diff --git a/app/src/main/cpp/lib/arm64-v8a/libffmpeg.so b/app/src/main/cpp/lib/arm64-v8a/libffmpeg.so new file mode 100755 index 0000000..189ff1f Binary files /dev/null and b/app/src/main/cpp/lib/arm64-v8a/libffmpeg.so differ diff --git a/app/src/main/cpp/lib/arm64-v8a/libfreetype.a b/app/src/main/cpp/lib/arm64-v8a/libfreetype.a new file mode 100644 index 0000000..378ab69 Binary files /dev/null and b/app/src/main/cpp/lib/arm64-v8a/libfreetype.a differ diff --git a/app/src/main/cpp/lib/arm64-v8a/libfribidi.a b/app/src/main/cpp/lib/arm64-v8a/libfribidi.a new file mode 100644 index 0000000..4374275 Binary files /dev/null and b/app/src/main/cpp/lib/arm64-v8a/libfribidi.a differ diff --git a/app/src/main/cpp/lib/arm64-v8a/libswresample.a b/app/src/main/cpp/lib/arm64-v8a/libswresample.a new file mode 100644 index 0000000..5aa5bc2 Binary files /dev/null and b/app/src/main/cpp/lib/arm64-v8a/libswresample.a differ diff --git a/app/src/main/cpp/lib/arm64-v8a/libswscale.a b/app/src/main/cpp/lib/arm64-v8a/libswscale.a new file mode 100644 index 0000000..4aa97f2 Binary files /dev/null and b/app/src/main/cpp/lib/arm64-v8a/libswscale.a differ diff --git a/app/src/main/cpp/lib/arm64-v8a/libvo-aacenc.a b/app/src/main/cpp/lib/arm64-v8a/libvo-aacenc.a new file mode 100644 index 0000000..762f02a Binary files /dev/null and b/app/src/main/cpp/lib/arm64-v8a/libvo-aacenc.a differ diff --git a/app/src/main/cpp/lib/arm64-v8a/libvo-amrwbenc.a b/app/src/main/cpp/lib/arm64-v8a/libvo-amrwbenc.a new file mode 100644 index 0000000..68a6888 Binary files /dev/null and b/app/src/main/cpp/lib/arm64-v8a/libvo-amrwbenc.a differ diff --git a/app/src/main/cpp/lib/arm64-v8a/libyuv2.so b/app/src/main/cpp/lib/arm64-v8a/libyuv2.so new file mode 100755 index 0000000..1aca941 Binary files /dev/null and b/app/src/main/cpp/lib/arm64-v8a/libyuv2.so differ diff --git a/app/src/main/cpp/lib/armeabi-v7a/libass.a b/app/src/main/cpp/lib/armeabi-v7a/libass.a new file mode 100644 index 0000000..8dc002c Binary files /dev/null and b/app/src/main/cpp/lib/armeabi-v7a/libass.a differ diff --git a/app/src/main/cpp/lib/armeabi-v7a/libavcodec.a b/app/src/main/cpp/lib/armeabi-v7a/libavcodec.a new file mode 100644 index 0000000..fb7bdfb Binary files /dev/null and b/app/src/main/cpp/lib/armeabi-v7a/libavcodec.a differ diff --git a/app/src/main/cpp/lib/armeabi-v7a/libavdevice.a b/app/src/main/cpp/lib/armeabi-v7a/libavdevice.a new file mode 100644 index 0000000..4223341 Binary files /dev/null and b/app/src/main/cpp/lib/armeabi-v7a/libavdevice.a differ diff --git a/app/src/main/cpp/lib/armeabi-v7a/libavfilter.a b/app/src/main/cpp/lib/armeabi-v7a/libavfilter.a new file mode 100644 index 0000000..6046b55 Binary files /dev/null and b/app/src/main/cpp/lib/armeabi-v7a/libavfilter.a differ diff --git a/app/src/main/cpp/lib/armeabi-v7a/libavformat.a b/app/src/main/cpp/lib/armeabi-v7a/libavformat.a new file mode 100644 index 0000000..75bc1c8 Binary files /dev/null and b/app/src/main/cpp/lib/armeabi-v7a/libavformat.a differ diff --git a/app/src/main/cpp/lib/armeabi-v7a/libavresample.a b/app/src/main/cpp/lib/armeabi-v7a/libavresample.a new file mode 100644 index 0000000..c0698ef Binary files /dev/null and b/app/src/main/cpp/lib/armeabi-v7a/libavresample.a differ diff --git a/app/src/main/cpp/lib/armeabi-v7a/libavutil.a b/app/src/main/cpp/lib/armeabi-v7a/libavutil.a new file mode 100644 index 0000000..07f2a04 Binary files /dev/null and b/app/src/main/cpp/lib/armeabi-v7a/libavutil.a differ diff --git a/app/src/main/cpp/lib/armeabi-v7a/libffmpeg.so b/app/src/main/cpp/lib/armeabi-v7a/libffmpeg.so new file mode 100755 index 0000000..b7772a6 Binary files /dev/null and b/app/src/main/cpp/lib/armeabi-v7a/libffmpeg.so differ diff --git a/app/src/main/cpp/lib/armeabi-v7a/libfreetype.a b/app/src/main/cpp/lib/armeabi-v7a/libfreetype.a new file mode 100644 index 0000000..9849567 Binary files /dev/null and b/app/src/main/cpp/lib/armeabi-v7a/libfreetype.a differ diff --git a/app/src/main/cpp/lib/armeabi-v7a/libfribidi.a b/app/src/main/cpp/lib/armeabi-v7a/libfribidi.a new file mode 100644 index 0000000..4718946 Binary files /dev/null and b/app/src/main/cpp/lib/armeabi-v7a/libfribidi.a differ diff --git a/app/src/main/cpp/lib/armeabi-v7a/libswresample.a b/app/src/main/cpp/lib/armeabi-v7a/libswresample.a new file mode 100644 index 0000000..e8bda2b Binary files /dev/null and b/app/src/main/cpp/lib/armeabi-v7a/libswresample.a differ diff --git a/app/src/main/cpp/lib/armeabi-v7a/libswscale.a b/app/src/main/cpp/lib/armeabi-v7a/libswscale.a new file mode 100644 index 0000000..172d3b2 Binary files /dev/null and b/app/src/main/cpp/lib/armeabi-v7a/libswscale.a differ diff --git a/app/src/main/cpp/lib/armeabi-v7a/libvo-aacenc.a b/app/src/main/cpp/lib/armeabi-v7a/libvo-aacenc.a new file mode 100644 index 0000000..9e24a14 Binary files /dev/null and b/app/src/main/cpp/lib/armeabi-v7a/libvo-aacenc.a differ diff --git a/app/src/main/cpp/lib/armeabi-v7a/libvo-amrwbenc.a b/app/src/main/cpp/lib/armeabi-v7a/libvo-amrwbenc.a new file mode 100644 index 0000000..4c14a6f Binary files /dev/null and b/app/src/main/cpp/lib/armeabi-v7a/libvo-amrwbenc.a differ diff --git a/app/src/main/cpp/lib/armeabi-v7a/libyuv2.so b/app/src/main/cpp/lib/armeabi-v7a/libyuv2.so new file mode 100755 index 0000000..07c019f Binary files /dev/null and b/app/src/main/cpp/lib/armeabi-v7a/libyuv2.so differ diff --git a/app/src/main/cpp/lib/x86/libass.a b/app/src/main/cpp/lib/x86/libass.a new file mode 100644 index 0000000..be04d54 Binary files /dev/null and b/app/src/main/cpp/lib/x86/libass.a differ diff --git a/app/src/main/cpp/lib/x86/libavcodec.a b/app/src/main/cpp/lib/x86/libavcodec.a new file mode 100644 index 0000000..71bf83e Binary files /dev/null and b/app/src/main/cpp/lib/x86/libavcodec.a differ diff --git a/app/src/main/cpp/lib/x86/libavdevice.a b/app/src/main/cpp/lib/x86/libavdevice.a new file mode 100644 index 0000000..b8ce921 Binary files /dev/null and b/app/src/main/cpp/lib/x86/libavdevice.a differ diff --git a/app/src/main/cpp/lib/x86/libavfilter.a b/app/src/main/cpp/lib/x86/libavfilter.a new file mode 100644 index 0000000..2803bdf Binary files /dev/null and b/app/src/main/cpp/lib/x86/libavfilter.a differ diff --git a/app/src/main/cpp/lib/x86/libavformat.a b/app/src/main/cpp/lib/x86/libavformat.a new file mode 100644 index 0000000..a96fa95 Binary files /dev/null and b/app/src/main/cpp/lib/x86/libavformat.a differ diff --git a/app/src/main/cpp/lib/x86/libavresample.a b/app/src/main/cpp/lib/x86/libavresample.a new file mode 100644 index 0000000..72e4c3c Binary files /dev/null and b/app/src/main/cpp/lib/x86/libavresample.a differ diff --git a/app/src/main/cpp/lib/x86/libavutil.a b/app/src/main/cpp/lib/x86/libavutil.a new file mode 100644 index 0000000..5393f03 Binary files /dev/null and b/app/src/main/cpp/lib/x86/libavutil.a differ diff --git a/app/src/main/cpp/lib/x86/libffmpeg.so b/app/src/main/cpp/lib/x86/libffmpeg.so new file mode 100755 index 0000000..29996c4 Binary files /dev/null and b/app/src/main/cpp/lib/x86/libffmpeg.so differ diff --git a/app/src/main/cpp/lib/x86/libfreetype.a b/app/src/main/cpp/lib/x86/libfreetype.a new file mode 100644 index 0000000..8fa3264 Binary files /dev/null and b/app/src/main/cpp/lib/x86/libfreetype.a differ diff --git a/app/src/main/cpp/lib/x86/libfribidi.a b/app/src/main/cpp/lib/x86/libfribidi.a new file mode 100644 index 0000000..7f0ecb9 Binary files /dev/null and b/app/src/main/cpp/lib/x86/libfribidi.a differ diff --git a/app/src/main/cpp/lib/x86/libswresample.a b/app/src/main/cpp/lib/x86/libswresample.a new file mode 100644 index 0000000..4b9680e Binary files /dev/null and b/app/src/main/cpp/lib/x86/libswresample.a differ diff --git a/app/src/main/cpp/lib/x86/libswscale.a b/app/src/main/cpp/lib/x86/libswscale.a new file mode 100644 index 0000000..640f5f4 Binary files /dev/null and b/app/src/main/cpp/lib/x86/libswscale.a differ diff --git a/app/src/main/cpp/lib/x86/libvo-aacenc.a b/app/src/main/cpp/lib/x86/libvo-aacenc.a new file mode 100644 index 0000000..43609b2 Binary files /dev/null and b/app/src/main/cpp/lib/x86/libvo-aacenc.a differ diff --git a/app/src/main/cpp/lib/x86/libvo-amrwbenc.a b/app/src/main/cpp/lib/x86/libvo-amrwbenc.a new file mode 100644 index 0000000..e2704fc Binary files /dev/null and b/app/src/main/cpp/lib/x86/libvo-amrwbenc.a differ diff --git a/app/src/main/cpp/lib/x86/libyuv2.so b/app/src/main/cpp/lib/x86/libyuv2.so new file mode 100755 index 0000000..758c303 Binary files /dev/null and b/app/src/main/cpp/lib/x86/libyuv2.so differ diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png new file mode 100644 index 0000000..854f72c Binary files /dev/null and b/app/src/main/ic_launcher-web.png differ diff --git a/app/src/main/java/com/MAVLink/MAVLinkPacket.java b/app/src/main/java/com/MAVLink/MAVLinkPacket.java new file mode 100644 index 0000000..e763283 --- /dev/null +++ b/app/src/main/java/com/MAVLink/MAVLinkPacket.java @@ -0,0 +1,820 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink; + +import java.io.Serializable; + +import com.MAVLink.Messages.MAVLinkPayload; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.ardupilotmega.CRC; + +import com.MAVLink.ardupilotmega.*; +import com.MAVLink.common.*; +import com.MAVLink.uAvionix.*; + +/** + * Common interface for all MAVLink Messages + * Packet Anatomy + * This is the anatomy of one packet. It is inspired by the CAN and SAE AS-4 standards. + * <p> + * Byte Index Content Value Explanation + * 0 Packet start sign v1.0: 0xFE Indicates the start of a new packet. (v0.9: 0x55) + * 1 Payload length 0 - 255 Indicates length of the following payload. + * 2 Packet sequence 0 - 255 Each component counts up his send sequence. Allows to detect packet loss + * 3 System ID 1 - 255 ID of the SENDING system. Allows to differentiate different MAVs on the same network. + * 4 Component ID 0 - 255 ID of the SENDING component. Allows to differentiate different components of the same system, e.g. the IMU and the autopilot. + * 5 Message ID 0 - 255 ID of the message - the id defines what the payload means and how it should be correctly decoded. + * 6 to (n+6) Payload 0 - 255 Data of the message, depends on the message id. + * (n+7)to(n+8) Checksum (low byte, high byte) ITU X.25/SAE AS-4 hash, excluding packet start sign, so bytes 1..(n+6) Note: The checksum also includes MAVLINK_CRC_EXTRA (Number computed from message fields. Protects the packet from decoding a different version of the same packet but with different variables). + * <p> + * The checksum is the same as used in ITU X.25 and SAE AS-4 standards (CRC-16-CCITT), documented in SAE AS5669A. Please see the MAVLink source code for a documented C-implementation of it. LINK TO CHECKSUM + * The minimum packet length is 8 bytes for acknowledgement packets without payload + * The maximum packet length is 263 bytes for full payload + */ +public class MAVLinkPacket implements Serializable { + private static final long serialVersionUID = 2095947771227815314L; + + public static final int MAVLINK_STX = 254; + + /** + * Message length. NOT counting STX, LENGTH, SEQ, SYSID, COMPID, MSGID, CRC1 and CRC2 + */ + public final int len; + + /** + * Message sequence + */ + public int seq; + + /** + * ID of the SENDING system. Allows to differentiate different MAVs on the + * same network. + */ + public int sysid; + + /** + * ID of the SENDING component. Allows to differentiate different components + * of the same system, e.g. the IMU and the autopilot. + */ + public int compid; + + /** + * ID of the message - the id defines what the payload means and how it + * should be correctly decoded. + */ + public int msgid; + + /** + * Data of the message, depends on the message id. + */ + public MAVLinkPayload payload; + + /** + * ITU X.25/SAE AS-4 hash, excluding packet start sign, so bytes 1..(n+6) + * Note: The checksum also includes MAVLINK_CRC_EXTRA (Number computed from + * message fields. Protects the packet from decoding a different version of + * the same packet but with different variables). + */ + public CRC crc; + + public MAVLinkPacket(int payloadLength) { + len = payloadLength; + payload = new MAVLinkPayload(payloadLength); + } + + /** + * Check if the size of the Payload is equal to the "len" byte + */ + public boolean payloadIsFilled() { + return payload.size() >= len; + } + + /** + * Update CRC for this packet. + */ + public void generateCRC() { + if (crc == null) { + crc = new CRC(); + } else { + crc.start_checksum(); + } + + crc.update_checksum(len); + crc.update_checksum(seq); + crc.update_checksum(sysid); + crc.update_checksum(compid); + crc.update_checksum(msgid); + + payload.resetIndex(); + + final int payloadSize = payload.size(); + for (int i = 0; i < payloadSize; i++) { + crc.update_checksum(payload.getByte()); + } + crc.finish_checksum(msgid); + } + + /** + * Encode this packet for transmission. + * + * @return Array with bytes to be transmitted + */ + public byte[] encodePacket() { + byte[] buffer = new byte[6 + len + 2]; + + int i = 0; + buffer[i++] = (byte) MAVLINK_STX; + buffer[i++] = (byte) len; + buffer[i++] = (byte) seq; + buffer[i++] = (byte) sysid; + buffer[i++] = (byte) compid; + buffer[i++] = (byte) msgid; + + final int payloadSize = payload.size(); + for (int j = 0; j < payloadSize; j++) { + buffer[i++] = payload.payload.get(j); + } + + generateCRC(); + buffer[i++] = (byte) (crc.getLSB()); + buffer[i++] = (byte) (crc.getMSB()); + return buffer; + } + + /** + * Unpack the data in this packet and return a MAVLink message + * + * @return MAVLink message decoded from this packet + */ + public MAVLinkMessage unpack() { + switch (msgid) { + + case msg_sensor_offsets.MAVLINK_MSG_ID_SENSOR_OFFSETS: + return new msg_sensor_offsets(this); + + case msg_set_mag_offsets.MAVLINK_MSG_ID_SET_MAG_OFFSETS: + return new msg_set_mag_offsets(this); + + case msg_meminfo.MAVLINK_MSG_ID_MEMINFO: + return new msg_meminfo(this); + + case msg_ap_adc.MAVLINK_MSG_ID_AP_ADC: + return new msg_ap_adc(this); + + case msg_digicam_configure.MAVLINK_MSG_ID_DIGICAM_CONFIGURE: + return new msg_digicam_configure(this); + + case msg_digicam_control.MAVLINK_MSG_ID_DIGICAM_CONTROL: + return new msg_digicam_control(this); + + case msg_mount_configure.MAVLINK_MSG_ID_MOUNT_CONFIGURE: + return new msg_mount_configure(this); + + case msg_mount_control.MAVLINK_MSG_ID_MOUNT_CONTROL: + return new msg_mount_control(this); + + case msg_mount_status.MAVLINK_MSG_ID_MOUNT_STATUS: + return new msg_mount_status(this); + + case msg_fence_point.MAVLINK_MSG_ID_FENCE_POINT: + return new msg_fence_point(this); + + case msg_fence_fetch_point.MAVLINK_MSG_ID_FENCE_FETCH_POINT: + return new msg_fence_fetch_point(this); + + case msg_fence_status.MAVLINK_MSG_ID_FENCE_STATUS: + return new msg_fence_status(this); + + case msg_ahrs.MAVLINK_MSG_ID_AHRS: + return new msg_ahrs(this); + + case msg_simstate.MAVLINK_MSG_ID_SIMSTATE: + return new msg_simstate(this); + + case msg_hwstatus.MAVLINK_MSG_ID_HWSTATUS: + return new msg_hwstatus(this); + + case msg_radio.MAVLINK_MSG_ID_RADIO: + return new msg_radio(this); + + case msg_limits_status.MAVLINK_MSG_ID_LIMITS_STATUS: + return new msg_limits_status(this); + + case msg_wind.MAVLINK_MSG_ID_WIND: + return new msg_wind(this); + + case msg_data16.MAVLINK_MSG_ID_DATA16: + return new msg_data16(this); + + case msg_data32.MAVLINK_MSG_ID_DATA32: + return new msg_data32(this); + + case msg_data64.MAVLINK_MSG_ID_DATA64: + return new msg_data64(this); + + case msg_data96.MAVLINK_MSG_ID_DATA96: + return new msg_data96(this); + + case msg_rangefinder.MAVLINK_MSG_ID_RANGEFINDER: + return new msg_rangefinder(this); + + case msg_airspeed_autocal.MAVLINK_MSG_ID_AIRSPEED_AUTOCAL: + return new msg_airspeed_autocal(this); + + case msg_rally_point.MAVLINK_MSG_ID_RALLY_POINT: + return new msg_rally_point(this); + + case msg_rally_fetch_point.MAVLINK_MSG_ID_RALLY_FETCH_POINT: + return new msg_rally_fetch_point(this); + + case msg_compassmot_status.MAVLINK_MSG_ID_COMPASSMOT_STATUS: + return new msg_compassmot_status(this); + + case msg_ahrs2.MAVLINK_MSG_ID_AHRS2: + return new msg_ahrs2(this); + + case msg_camera_status.MAVLINK_MSG_ID_CAMERA_STATUS: + return new msg_camera_status(this); + + case msg_camera_feedback.MAVLINK_MSG_ID_CAMERA_FEEDBACK: + return new msg_camera_feedback(this); + + case msg_battery2.MAVLINK_MSG_ID_BATTERY2: + return new msg_battery2(this); + + case msg_ahrs3.MAVLINK_MSG_ID_AHRS3: + return new msg_ahrs3(this); + + case msg_autopilot_version_request.MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST: + return new msg_autopilot_version_request(this); + + case msg_remote_log_data_block.MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK: + return new msg_remote_log_data_block(this); + + case msg_remote_log_block_status.MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS: + return new msg_remote_log_block_status(this); + + case msg_led_control.MAVLINK_MSG_ID_LED_CONTROL: + return new msg_led_control(this); + + case msg_mag_cal_progress.MAVLINK_MSG_ID_MAG_CAL_PROGRESS: + return new msg_mag_cal_progress(this); + + case msg_mag_cal_report.MAVLINK_MSG_ID_MAG_CAL_REPORT: + return new msg_mag_cal_report(this); + + case msg_ekf_status_report.MAVLINK_MSG_ID_EKF_STATUS_REPORT: + return new msg_ekf_status_report(this); + + case msg_pid_tuning.MAVLINK_MSG_ID_PID_TUNING: + return new msg_pid_tuning(this); + + case msg_gimbal_report.MAVLINK_MSG_ID_GIMBAL_REPORT: + return new msg_gimbal_report(this); + + case msg_gimbal_control.MAVLINK_MSG_ID_GIMBAL_CONTROL: + return new msg_gimbal_control(this); + + case msg_gimbal_torque_cmd_report.MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT: + return new msg_gimbal_torque_cmd_report(this); + + case msg_gopro_heartbeat.MAVLINK_MSG_ID_GOPRO_HEARTBEAT: + return new msg_gopro_heartbeat(this); + + case msg_gopro_get_request.MAVLINK_MSG_ID_GOPRO_GET_REQUEST: + return new msg_gopro_get_request(this); + + case msg_gopro_get_response.MAVLINK_MSG_ID_GOPRO_GET_RESPONSE: + return new msg_gopro_get_response(this); + + case msg_gopro_set_request.MAVLINK_MSG_ID_GOPRO_SET_REQUEST: + return new msg_gopro_set_request(this); + + case msg_gopro_set_response.MAVLINK_MSG_ID_GOPRO_SET_RESPONSE: + return new msg_gopro_set_response(this); + + case msg_rpm.MAVLINK_MSG_ID_RPM: + return new msg_rpm(this); + + case msg_device_op_read.MAVLINK_MSG_ID_DEVICE_OP_READ: + return new msg_device_op_read(this); + + case msg_device_op_read_reply.MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY: + return new msg_device_op_read_reply(this); + + case msg_device_op_write.MAVLINK_MSG_ID_DEVICE_OP_WRITE: + return new msg_device_op_write(this); + + case msg_device_op_write_reply.MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY: + return new msg_device_op_write_reply(this); + + case msg_adap_tuning.MAVLINK_MSG_ID_ADAP_TUNING: + return new msg_adap_tuning(this); + + case msg_vision_position_delta.MAVLINK_MSG_ID_VISION_POSITION_DELTA: + return new msg_vision_position_delta(this); + + + case msg_heartbeat.MAVLINK_MSG_ID_HEARTBEAT: + return new msg_heartbeat(this); + + case msg_sys_status.MAVLINK_MSG_ID_SYS_STATUS: + return new msg_sys_status(this); + + case msg_system_time.MAVLINK_MSG_ID_SYSTEM_TIME: + return new msg_system_time(this); + + case msg_ping.MAVLINK_MSG_ID_PING: + return new msg_ping(this); + + case msg_change_operator_control.MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL: + return new msg_change_operator_control(this); + + case msg_change_operator_control_ack.MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK: + return new msg_change_operator_control_ack(this); + + case msg_auth_key.MAVLINK_MSG_ID_AUTH_KEY: + return new msg_auth_key(this); + + case msg_set_mode.MAVLINK_MSG_ID_SET_MODE: + return new msg_set_mode(this); + + case msg_param_request_read.MAVLINK_MSG_ID_PARAM_REQUEST_READ: + return new msg_param_request_read(this); + + case msg_param_request_list.MAVLINK_MSG_ID_PARAM_REQUEST_LIST: + return new msg_param_request_list(this); + + case msg_param_value.MAVLINK_MSG_ID_PARAM_VALUE: + return new msg_param_value(this); + + case msg_param_set.MAVLINK_MSG_ID_PARAM_SET: + return new msg_param_set(this); + + case msg_gps_raw_int.MAVLINK_MSG_ID_GPS_RAW_INT: + return new msg_gps_raw_int(this); + + case msg_gps_status.MAVLINK_MSG_ID_GPS_STATUS: + return new msg_gps_status(this); + + case msg_scaled_imu.MAVLINK_MSG_ID_SCALED_IMU: + return new msg_scaled_imu(this); + + case msg_raw_imu.MAVLINK_MSG_ID_RAW_IMU: + return new msg_raw_imu(this); + + case msg_raw_pressure.MAVLINK_MSG_ID_RAW_PRESSURE: + return new msg_raw_pressure(this); + + case msg_scaled_pressure.MAVLINK_MSG_ID_SCALED_PRESSURE: + return new msg_scaled_pressure(this); + + case msg_attitude.MAVLINK_MSG_ID_ATTITUDE: + return new msg_attitude(this); + + case msg_attitude_quaternion.MAVLINK_MSG_ID_ATTITUDE_QUATERNION: + return new msg_attitude_quaternion(this); + + case msg_local_position_ned.MAVLINK_MSG_ID_LOCAL_POSITION_NED: + return new msg_local_position_ned(this); + + case msg_global_position_int.MAVLINK_MSG_ID_GLOBAL_POSITION_INT: + return new msg_global_position_int(this); + + case msg_rc_channels_scaled.MAVLINK_MSG_ID_RC_CHANNELS_SCALED: + return new msg_rc_channels_scaled(this); + + case msg_rc_channels_raw.MAVLINK_MSG_ID_RC_CHANNELS_RAW: + return new msg_rc_channels_raw(this); + + case msg_servo_output_raw.MAVLINK_MSG_ID_SERVO_OUTPUT_RAW: + return new msg_servo_output_raw(this); + + case msg_mission_request_partial_list.MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST: + return new msg_mission_request_partial_list(this); + + case msg_mission_write_partial_list.MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST: + return new msg_mission_write_partial_list(this); + + case msg_mission_item.MAVLINK_MSG_ID_MISSION_ITEM: + return new msg_mission_item(this); + + case msg_mission_request.MAVLINK_MSG_ID_MISSION_REQUEST: + return new msg_mission_request(this); + + case msg_mission_set_current.MAVLINK_MSG_ID_MISSION_SET_CURRENT: + return new msg_mission_set_current(this); + + case msg_mission_current.MAVLINK_MSG_ID_MISSION_CURRENT: + return new msg_mission_current(this); + + case msg_mission_request_list.MAVLINK_MSG_ID_MISSION_REQUEST_LIST: + return new msg_mission_request_list(this); + + case msg_mission_count.MAVLINK_MSG_ID_MISSION_COUNT: + return new msg_mission_count(this); + + case msg_mission_clear_all.MAVLINK_MSG_ID_MISSION_CLEAR_ALL: + return new msg_mission_clear_all(this); + + case msg_mission_item_reached.MAVLINK_MSG_ID_MISSION_ITEM_REACHED: + return new msg_mission_item_reached(this); + + case msg_mission_ack.MAVLINK_MSG_ID_MISSION_ACK: + return new msg_mission_ack(this); + + case msg_set_gps_global_origin.MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN: + return new msg_set_gps_global_origin(this); + + case msg_gps_global_origin.MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN: + return new msg_gps_global_origin(this); + + case msg_param_map_rc.MAVLINK_MSG_ID_PARAM_MAP_RC: + return new msg_param_map_rc(this); + + case msg_mission_request_int.MAVLINK_MSG_ID_MISSION_REQUEST_INT: + return new msg_mission_request_int(this); + + case msg_safety_set_allowed_area.MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA: + return new msg_safety_set_allowed_area(this); + + case msg_safety_allowed_area.MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA: + return new msg_safety_allowed_area(this); + + case msg_attitude_quaternion_cov.MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV: + return new msg_attitude_quaternion_cov(this); + + case msg_nav_controller_output.MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT: + return new msg_nav_controller_output(this); + + case msg_global_position_int_cov.MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV: + return new msg_global_position_int_cov(this); + + case msg_local_position_ned_cov.MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV: + return new msg_local_position_ned_cov(this); + + case msg_rc_channels.MAVLINK_MSG_ID_RC_CHANNELS: + return new msg_rc_channels(this); + + case msg_request_data_stream.MAVLINK_MSG_ID_REQUEST_DATA_STREAM: + return new msg_request_data_stream(this); + + case msg_data_stream.MAVLINK_MSG_ID_DATA_STREAM: + return new msg_data_stream(this); + + case msg_manual_control.MAVLINK_MSG_ID_MANUAL_CONTROL: + return new msg_manual_control(this); + + case msg_rc_channels_override.MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE: + return new msg_rc_channels_override(this); + + case msg_mission_item_int.MAVLINK_MSG_ID_MISSION_ITEM_INT: + return new msg_mission_item_int(this); + + case msg_vfr_hud.MAVLINK_MSG_ID_VFR_HUD: + return new msg_vfr_hud(this); + + case msg_command_int.MAVLINK_MSG_ID_COMMAND_INT: + return new msg_command_int(this); + + case msg_command_long.MAVLINK_MSG_ID_COMMAND_LONG: + return new msg_command_long(this); + + case msg_command_ack.MAVLINK_MSG_ID_COMMAND_ACK: + return new msg_command_ack(this); + + case msg_manual_setpoint.MAVLINK_MSG_ID_MANUAL_SETPOINT: + return new msg_manual_setpoint(this); + + case msg_set_attitude_target.MAVLINK_MSG_ID_SET_ATTITUDE_TARGET: + return new msg_set_attitude_target(this); + + case msg_attitude_target.MAVLINK_MSG_ID_ATTITUDE_TARGET: + return new msg_attitude_target(this); + + case msg_set_position_target_local_ned.MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED: + return new msg_set_position_target_local_ned(this); + + case msg_position_target_local_ned.MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED: + return new msg_position_target_local_ned(this); + + case msg_set_position_target_global_int.MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT: + return new msg_set_position_target_global_int(this); + + case msg_position_target_global_int.MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT: + return new msg_position_target_global_int(this); + + case msg_local_position_ned_system_global_offset.MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET: + return new msg_local_position_ned_system_global_offset(this); + + case msg_hil_state.MAVLINK_MSG_ID_HIL_STATE: + return new msg_hil_state(this); + + case msg_hil_controls.MAVLINK_MSG_ID_HIL_CONTROLS: + return new msg_hil_controls(this); + + case msg_hil_rc_inputs_raw.MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW: + return new msg_hil_rc_inputs_raw(this); + + case msg_hil_actuator_controls.MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS: + return new msg_hil_actuator_controls(this); + + case msg_optical_flow.MAVLINK_MSG_ID_OPTICAL_FLOW: + return new msg_optical_flow(this); + + case msg_global_vision_position_estimate.MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE: + return new msg_global_vision_position_estimate(this); + + case msg_vision_position_estimate.MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE: + return new msg_vision_position_estimate(this); + + case msg_vision_speed_estimate.MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE: + return new msg_vision_speed_estimate(this); + + case msg_vicon_position_estimate.MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE: + return new msg_vicon_position_estimate(this); + + case msg_highres_imu.MAVLINK_MSG_ID_HIGHRES_IMU: + return new msg_highres_imu(this); + + case msg_optical_flow_rad.MAVLINK_MSG_ID_OPTICAL_FLOW_RAD: + return new msg_optical_flow_rad(this); + + case msg_hil_sensor.MAVLINK_MSG_ID_HIL_SENSOR: + return new msg_hil_sensor(this); + + case msg_sim_state.MAVLINK_MSG_ID_SIM_STATE: + return new msg_sim_state(this); + + case msg_radio_status.MAVLINK_MSG_ID_RADIO_STATUS: + return new msg_radio_status(this); + + case msg_file_transfer_protocol.MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL: + return new msg_file_transfer_protocol(this); + + case msg_timesync.MAVLINK_MSG_ID_TIMESYNC: + return new msg_timesync(this); + + case msg_camera_trigger.MAVLINK_MSG_ID_CAMERA_TRIGGER: + return new msg_camera_trigger(this); + + case msg_hil_gps.MAVLINK_MSG_ID_HIL_GPS: + return new msg_hil_gps(this); + + case msg_hil_optical_flow.MAVLINK_MSG_ID_HIL_OPTICAL_FLOW: + return new msg_hil_optical_flow(this); + + case msg_hil_state_quaternion.MAVLINK_MSG_ID_HIL_STATE_QUATERNION: + return new msg_hil_state_quaternion(this); + + case msg_scaled_imu2.MAVLINK_MSG_ID_SCALED_IMU2: + return new msg_scaled_imu2(this); + + case msg_log_request_list.MAVLINK_MSG_ID_LOG_REQUEST_LIST: + return new msg_log_request_list(this); + + case msg_log_entry.MAVLINK_MSG_ID_LOG_ENTRY: + return new msg_log_entry(this); + + case msg_log_request_data.MAVLINK_MSG_ID_LOG_REQUEST_DATA: + return new msg_log_request_data(this); + + case msg_log_data.MAVLINK_MSG_ID_LOG_DATA: + return new msg_log_data(this); + + case msg_log_erase.MAVLINK_MSG_ID_LOG_ERASE: + return new msg_log_erase(this); + + case msg_log_request_end.MAVLINK_MSG_ID_LOG_REQUEST_END: + return new msg_log_request_end(this); + + case msg_gps_inject_data.MAVLINK_MSG_ID_GPS_INJECT_DATA: + return new msg_gps_inject_data(this); + + case msg_gps2_raw.MAVLINK_MSG_ID_GPS2_RAW: + return new msg_gps2_raw(this); + + case msg_power_status.MAVLINK_MSG_ID_POWER_STATUS: + return new msg_power_status(this); + + case msg_serial_control.MAVLINK_MSG_ID_SERIAL_CONTROL: + return new msg_serial_control(this); + + case msg_gps_rtk.MAVLINK_MSG_ID_GPS_RTK: + return new msg_gps_rtk(this); + + case msg_gps2_rtk.MAVLINK_MSG_ID_GPS2_RTK: + return new msg_gps2_rtk(this); + + case msg_scaled_imu3.MAVLINK_MSG_ID_SCALED_IMU3: + return new msg_scaled_imu3(this); + + case msg_data_transmission_handshake.MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE: + return new msg_data_transmission_handshake(this); + + case msg_encapsulated_data.MAVLINK_MSG_ID_ENCAPSULATED_DATA: + return new msg_encapsulated_data(this); + + case msg_distance_sensor.MAVLINK_MSG_ID_DISTANCE_SENSOR: + return new msg_distance_sensor(this); + + case msg_terrain_request.MAVLINK_MSG_ID_TERRAIN_REQUEST: + return new msg_terrain_request(this); + + case msg_terrain_data.MAVLINK_MSG_ID_TERRAIN_DATA: + return new msg_terrain_data(this); + + case msg_terrain_check.MAVLINK_MSG_ID_TERRAIN_CHECK: + return new msg_terrain_check(this); + + case msg_terrain_report.MAVLINK_MSG_ID_TERRAIN_REPORT: + return new msg_terrain_report(this); + + case msg_scaled_pressure2.MAVLINK_MSG_ID_SCALED_PRESSURE2: + return new msg_scaled_pressure2(this); + + case msg_att_pos_mocap.MAVLINK_MSG_ID_ATT_POS_MOCAP: + return new msg_att_pos_mocap(this); + + case msg_set_actuator_control_target.MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET: + return new msg_set_actuator_control_target(this); + + case msg_actuator_control_target.MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET: + return new msg_actuator_control_target(this); + + case msg_altitude.MAVLINK_MSG_ID_ALTITUDE: + return new msg_altitude(this); + + case msg_resource_request.MAVLINK_MSG_ID_RESOURCE_REQUEST: + return new msg_resource_request(this); + + case msg_scaled_pressure3.MAVLINK_MSG_ID_SCALED_PRESSURE3: + return new msg_scaled_pressure3(this); + + case msg_follow_target.MAVLINK_MSG_ID_FOLLOW_TARGET: + return new msg_follow_target(this); + + case msg_control_system_state.MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE: + return new msg_control_system_state(this); + + case msg_battery_status.MAVLINK_MSG_ID_BATTERY_STATUS: + return new msg_battery_status(this); + + case msg_autopilot_version.MAVLINK_MSG_ID_AUTOPILOT_VERSION: + return new msg_autopilot_version(this); + + case msg_landing_target.MAVLINK_MSG_ID_LANDING_TARGET: + return new msg_landing_target(this); + + case msg_estimator_status.MAVLINK_MSG_ID_ESTIMATOR_STATUS: + return new msg_estimator_status(this); + + case msg_wind_cov.MAVLINK_MSG_ID_WIND_COV: + return new msg_wind_cov(this); + + case msg_gps_input.MAVLINK_MSG_ID_GPS_INPUT: + return new msg_gps_input(this); + + case msg_gps_rtcm_data.MAVLINK_MSG_ID_GPS_RTCM_DATA: + return new msg_gps_rtcm_data(this); + + case msg_high_latency.MAVLINK_MSG_ID_HIGH_LATENCY: + return new msg_high_latency(this); + + case msg_vibration.MAVLINK_MSG_ID_VIBRATION: + return new msg_vibration(this); + + case msg_home_position.MAVLINK_MSG_ID_HOME_POSITION: + return new msg_home_position(this); + + case msg_set_home_position.MAVLINK_MSG_ID_SET_HOME_POSITION: + return new msg_set_home_position(this); + + case msg_message_interval.MAVLINK_MSG_ID_MESSAGE_INTERVAL: + return new msg_message_interval(this); + + case msg_extended_sys_state.MAVLINK_MSG_ID_EXTENDED_SYS_STATE: + return new msg_extended_sys_state(this); + + case msg_adsb_vehicle.MAVLINK_MSG_ID_ADSB_VEHICLE: + return new msg_adsb_vehicle(this); + + case msg_collision.MAVLINK_MSG_ID_COLLISION: + return new msg_collision(this); + + case msg_v2_extension.MAVLINK_MSG_ID_V2_EXTENSION: + return new msg_v2_extension(this); + + case msg_memory_vect.MAVLINK_MSG_ID_MEMORY_VECT: + return new msg_memory_vect(this); + + case msg_debug_vect.MAVLINK_MSG_ID_DEBUG_VECT: + return new msg_debug_vect(this); + + case msg_named_value_float.MAVLINK_MSG_ID_NAMED_VALUE_FLOAT: + return new msg_named_value_float(this); + + case msg_named_value_int.MAVLINK_MSG_ID_NAMED_VALUE_INT: + return new msg_named_value_int(this); + + case msg_statustext.MAVLINK_MSG_ID_STATUSTEXT: + return new msg_statustext(this); + + case msg_debug.MAVLINK_MSG_ID_DEBUG: + return new msg_debug(this); + + case msg_setup_signing.MAVLINK_MSG_ID_SETUP_SIGNING: + return new msg_setup_signing(this); + + case msg_button_change.MAVLINK_MSG_ID_BUTTON_CHANGE: + return new msg_button_change(this); + + case msg_play_tune.MAVLINK_MSG_ID_PLAY_TUNE: + return new msg_play_tune(this); + + case msg_camera_information.MAVLINK_MSG_ID_CAMERA_INFORMATION: + return new msg_camera_information(this); + + case msg_camera_settings.MAVLINK_MSG_ID_CAMERA_SETTINGS: + return new msg_camera_settings(this); + + case msg_storage_information.MAVLINK_MSG_ID_STORAGE_INFORMATION: + return new msg_storage_information(this); + + case msg_camera_capture_status.MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS: + return new msg_camera_capture_status(this); + + case msg_camera_image_captured.MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED: + return new msg_camera_image_captured(this); + + case msg_flight_information.MAVLINK_MSG_ID_FLIGHT_INFORMATION: + return new msg_flight_information(this); + + case msg_mount_orientation.MAVLINK_MSG_ID_MOUNT_ORIENTATION: + return new msg_mount_orientation(this); + + case msg_logging_data.MAVLINK_MSG_ID_LOGGING_DATA: + return new msg_logging_data(this); + + case msg_logging_data_acked.MAVLINK_MSG_ID_LOGGING_DATA_ACKED: + return new msg_logging_data_acked(this); + + case msg_logging_ack.MAVLINK_MSG_ID_LOGGING_ACK: + return new msg_logging_ack(this); + + case msg_video_stream_information.MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION: + return new msg_video_stream_information(this); + + case msg_set_video_stream_settings.MAVLINK_MSG_ID_SET_VIDEO_STREAM_SETTINGS: + return new msg_set_video_stream_settings(this); + + case msg_wifi_config_ap.MAVLINK_MSG_ID_WIFI_CONFIG_AP: + return new msg_wifi_config_ap(this); + + case msg_protocol_version.MAVLINK_MSG_ID_PROTOCOL_VERSION: + return new msg_protocol_version(this); + + case msg_uavcan_node_status.MAVLINK_MSG_ID_UAVCAN_NODE_STATUS: + return new msg_uavcan_node_status(this); + + case msg_uavcan_node_info.MAVLINK_MSG_ID_UAVCAN_NODE_INFO: + return new msg_uavcan_node_info(this); + + case msg_param_ext_request_read.MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ: + return new msg_param_ext_request_read(this); + + case msg_param_ext_request_list.MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST: + return new msg_param_ext_request_list(this); + + case msg_param_ext_value.MAVLINK_MSG_ID_PARAM_EXT_VALUE: + return new msg_param_ext_value(this); + + case msg_param_ext_set.MAVLINK_MSG_ID_PARAM_EXT_SET: + return new msg_param_ext_set(this); + + case msg_param_ext_ack.MAVLINK_MSG_ID_PARAM_EXT_ACK: + return new msg_param_ext_ack(this); + + + case msg_uavionix_adsb_out_cfg.MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG: + return new msg_uavionix_adsb_out_cfg(this); + + case msg_uavionix_adsb_out_dynamic.MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC: + return new msg_uavionix_adsb_out_dynamic(this); + + case msg_uavionix_adsb_transceiver_health_report.MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT: + return new msg_uavionix_adsb_transceiver_health_report(this); + + + default: + return null; + } + } + +} + + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/Messages/MAVLinkMessage.java b/app/src/main/java/com/MAVLink/Messages/MAVLinkMessage.java new file mode 100644 index 0000000..bb8b8ec --- /dev/null +++ b/app/src/main/java/com/MAVLink/Messages/MAVLinkMessage.java @@ -0,0 +1,29 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.Messages; + +import java.io.Serializable; + +import com.MAVLink.MAVLinkPacket; + +public abstract class MAVLinkMessage implements Serializable { + private static final long serialVersionUID = -7754622750478538539L; + // The MAVLink message classes have been changed to implement Serializable, + // this way is possible to pass a mavlink message trought the Service-Acctivity interface + + /** + * Simply a common interface for all MAVLink Messages + */ + + public int sysid; + public int compid; + public int msgid; + + public abstract MAVLinkPacket pack(); + + public abstract void unpack(MAVLinkPayload payload); +} diff --git a/app/src/main/java/com/MAVLink/Messages/MAVLinkPayload.java b/app/src/main/java/com/MAVLink/Messages/MAVLinkPayload.java new file mode 100644 index 0000000..dedc07d --- /dev/null +++ b/app/src/main/java/com/MAVLink/Messages/MAVLinkPayload.java @@ -0,0 +1,202 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.Messages; + +import java.nio.ByteBuffer; + +public class MAVLinkPayload { + + private static final byte UNSIGNED_BYTE_MIN_VALUE = 0; + private static final short UNSIGNED_BYTE_MAX_VALUE = Byte.MAX_VALUE - Byte.MIN_VALUE; + + private static final short UNSIGNED_SHORT_MIN_VALUE = 0; + private static final int UNSIGNED_SHORT_MAX_VALUE = Short.MAX_VALUE - Short.MIN_VALUE; + + private static final int UNSIGNED_INT_MIN_VALUE = 0; + private static final long UNSIGNED_INT_MAX_VALUE = (long) Integer.MAX_VALUE - Integer.MIN_VALUE; + + private static final long UNSIGNED_LONG_MIN_VALUE = 0; + + public static final int MAX_PAYLOAD_SIZE = 255; + + public final ByteBuffer payload; + public int index; + + public MAVLinkPayload(int payloadSize) { + if (payloadSize > MAX_PAYLOAD_SIZE) { + payload = ByteBuffer.allocate(MAX_PAYLOAD_SIZE); + } else { + payload = ByteBuffer.allocate(payloadSize); + } + } + + public ByteBuffer getData() { + return payload; + } + + public int size() { + return payload.position(); + } + + public void add(byte c) { + payload.put(c); + } + + public void resetIndex() { + index = 0; + } + + public byte getByte() { + byte result = 0; + result |= (payload.get(index + 0) & 0xFF); + index += 1; + return result; + } + + public short getUnsignedByte() { + short result = 0; + result |= payload.get(index + 0) & 0xFF; + index += 1; + return result; + } + + public short getShort() { + short result = 0; + result |= (payload.get(index + 1) & 0xFF) << 8; + result |= (payload.get(index + 0) & 0xFF); + index += 2; + return result; + } + + public int getUnsignedShort() { + int result = 0; + result |= (payload.get(index + 1) & 0xFF) << 8; + result |= (payload.get(index + 0) & 0xFF); + index += 2; + return result; + } + + public int getInt() { + int result = 0; + result |= (payload.get(index + 3) & 0xFF) << 24; + result |= (payload.get(index + 2) & 0xFF) << 16; + result |= (payload.get(index + 1) & 0xFF) << 8; + result |= (payload.get(index + 0) & 0xFF); + index += 4; + return result; + } + + public long getUnsignedInt() { + long result = 0; + result |= (payload.get(index + 3) & 0xFFL) << 24; + result |= (payload.get(index + 2) & 0xFFL) << 16; + result |= (payload.get(index + 1) & 0xFFL) << 8; + result |= (payload.get(index + 0) & 0xFFL); + index += 4; + return result; + } + + public long getLong() { + long result = 0; + result |= (payload.get(index + 7) & 0xFFL) << 56; + result |= (payload.get(index + 6) & 0xFFL) << 48; + result |= (payload.get(index + 5) & 0xFFL) << 40; + result |= (payload.get(index + 4) & 0xFFL) << 32; + result |= (payload.get(index + 3) & 0xFFL) << 24; + result |= (payload.get(index + 2) & 0xFFL) << 16; + result |= (payload.get(index + 1) & 0xFFL) << 8; + result |= (payload.get(index + 0) & 0xFFL); + index += 8; + return result; + } + + public long getUnsignedLong() { + return getLong(); + } + + public long getLongReverse() { + long result = 0; + result |= (payload.get(index + 0) & 0xFFL) << 56; + result |= (payload.get(index + 1) & 0xFFL) << 48; + result |= (payload.get(index + 2) & 0xFFL) << 40; + result |= (payload.get(index + 3) & 0xFFL) << 32; + result |= (payload.get(index + 4) & 0xFFL) << 24; + result |= (payload.get(index + 5) & 0xFFL) << 16; + result |= (payload.get(index + 6) & 0xFFL) << 8; + result |= (payload.get(index + 7) & 0xFFL); + index += 8; + return result; + } + + public float getFloat() { + return Float.intBitsToFloat(getInt()); + } + + public void putByte(byte data) { + add(data); + } + + public void putUnsignedByte(short data) { + if (data < UNSIGNED_BYTE_MIN_VALUE || data > UNSIGNED_BYTE_MAX_VALUE) { + throw new IllegalArgumentException("Value is outside of the range of an unsigned byte: " + data); + } + + putByte((byte) data); + } + + public void putShort(short data) { + add((byte) (data >> 0)); + add((byte) (data >> 8)); + } + + public void putUnsignedShort(int data) { + if (data < UNSIGNED_SHORT_MIN_VALUE || data > UNSIGNED_SHORT_MAX_VALUE) { + throw new IllegalArgumentException("Value is outside of the range of an unsigned short: " + data); + } + + putShort((short) data); + } + + public void putInt(int data) { + add((byte) (data >> 0)); + add((byte) (data >> 8)); + add((byte) (data >> 16)); + add((byte) (data >> 24)); + } + + public void putUnsignedInt(long data) { + if (data < UNSIGNED_INT_MIN_VALUE || data > UNSIGNED_INT_MAX_VALUE) { + throw new IllegalArgumentException("Value is outside of the range of an unsigned int: " + data); + } + + putInt((int) data); + } + + public void putLong(long data) { + add((byte) (data >> 0)); + add((byte) (data >> 8)); + add((byte) (data >> 16)); + add((byte) (data >> 24)); + add((byte) (data >> 32)); + add((byte) (data >> 40)); + add((byte) (data >> 48)); + add((byte) (data >> 56)); + } + + public void putUnsignedLong(long data) { + if (data < UNSIGNED_LONG_MIN_VALUE) { + throw new IllegalArgumentException("Value is outside of the range of an unsigned long: " + data); + } + + putLong(data); + } + + public void putFloat(float data) { + putInt(Float.floatToIntBits(data)); + } + +} diff --git a/app/src/main/java/com/MAVLink/Messages/MAVLinkStats.java b/app/src/main/java/com/MAVLink/Messages/MAVLinkStats.java new file mode 100644 index 0000000..b84aa62 --- /dev/null +++ b/app/src/main/java/com/MAVLink/Messages/MAVLinkStats.java @@ -0,0 +1,149 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.Messages; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.common.msg_radio_status; + +/** + * Storage for MAVLink Packet and Error statistics + */ +public class MAVLinkStats /* implements Serializable */ { + + public int receivedPacketCount; // total recieved packet count for all sources + + public int crcErrorCount; + + public int lostPacketCount; // total lost packet count for all sources + + public boolean ignoreRadioPackets; + + // stats are nil for a system id until a packet has been received from a system + public SystemStat[] systemStats; // stats for each system that is known + + public MAVLinkStats() { + this(false); + } + + public MAVLinkStats(boolean ignoreRadioPackets) { + this.ignoreRadioPackets = ignoreRadioPackets; + resetStats(); + } + + /** + * Check the new received packet to see if has lost someone between this and + * the last packet + * + * @param packet Packet that should be checked + */ + public void newPacket(MAVLinkPacket packet) { + if (ignoreRadioPackets && packet.msgid == msg_radio_status.MAVLINK_MSG_ID_RADIO_STATUS) { + return; + } + + if (systemStats[packet.sysid] == null) { + // only allocate stats for systems that exsist on the network + systemStats[packet.sysid] = new SystemStat(); + } + lostPacketCount += systemStats[packet.sysid].newPacket(packet); + receivedPacketCount++; + } + + /** + * Called when a CRC error happens on the parser + */ + public void crcError() { + crcErrorCount++; + } + + public void resetStats() { + crcErrorCount = 0; + lostPacketCount = 0; + receivedPacketCount = 0; + systemStats = new SystemStat[256]; + } + + // stat structure for every system id + public static class SystemStat { + public int lostPacketCount; // the lost count for this source + public int receivedPacketCount; + + // stats are nil for a component id until a packet has been received from a system + public ComponentStat[] componentStats; // stats for each component that is known + + public SystemStat() { + resetStats(); + } + + public int newPacket(MAVLinkPacket packet) { + int newLostPackets = 0; + if (componentStats[packet.compid] == null) { + // only allocate stats for systems that exsist on the network + componentStats[packet.compid] = new ComponentStat(); + } + newLostPackets = componentStats[packet.compid].newPacket(packet); + lostPacketCount += newLostPackets; + receivedPacketCount++; + return newLostPackets; + } + + public void resetStats() { + lostPacketCount = 0; + receivedPacketCount = 0; + componentStats = new ComponentStat[256]; + } + } + + // stat structure for every system id + public static class ComponentStat { + public int lastPacketSeq; + public int lostPacketCount; // the lost count for this source + public int receivedPacketCount; + + public ComponentStat() { + resetStats(); + } + + public int newPacket(MAVLinkPacket packet) { + int newLostPackets = 0; + if (hasLostPackets(packet)) { + newLostPackets = updateLostPacketCount(packet); + } + lastPacketSeq = packet.seq; + advanceLastPacketSequence(packet.seq); + receivedPacketCount++; + return newLostPackets; + } + + public void resetStats() { + lastPacketSeq = -1; + lostPacketCount = 0; + receivedPacketCount = 0; + } + + private int updateLostPacketCount(MAVLinkPacket packet) { + int lostPackets; + if (packet.seq - lastPacketSeq < 0) { + lostPackets = (packet.seq - lastPacketSeq) + 255; + } else { + lostPackets = (packet.seq - lastPacketSeq); + } + lostPacketCount += lostPackets; + return lostPackets; + } + + private void advanceLastPacketSequence(int lastSeq) { + // wrap from 255 to 0 if necessary + lastPacketSeq = (lastSeq + 1) & 0xFF; + } + + private boolean hasLostPackets(MAVLinkPacket packet) { + return lastPacketSeq >= 0 && packet.seq != lastPacketSeq; + } + } + +} diff --git a/app/src/main/java/com/MAVLink/Parser.java b/app/src/main/java/com/MAVLink/Parser.java new file mode 100644 index 0000000..6212cb1 --- /dev/null +++ b/app/src/main/java/com/MAVLink/Parser.java @@ -0,0 +1,124 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkStats; + +public class Parser { + + /** + * States from the parsing state machine + */ + enum MAV_states { + MAVLINK_PARSE_STATE_UNINIT, MAVLINK_PARSE_STATE_IDLE, MAVLINK_PARSE_STATE_GOT_STX, MAVLINK_PARSE_STATE_GOT_LENGTH, MAVLINK_PARSE_STATE_GOT_SEQ, MAVLINK_PARSE_STATE_GOT_SYSID, MAVLINK_PARSE_STATE_GOT_COMPID, MAVLINK_PARSE_STATE_GOT_MSGID, MAVLINK_PARSE_STATE_GOT_CRC1, MAVLINK_PARSE_STATE_GOT_PAYLOAD + } + + MAV_states state = MAV_states.MAVLINK_PARSE_STATE_UNINIT; + + public MAVLinkStats stats; + private MAVLinkPacket m; + + public Parser() { + this(false); + } + + public Parser(boolean ignoreRadioPacketStats) { + stats = new MAVLinkStats(ignoreRadioPacketStats); + } + + /** + * This is a convenience function which handles the complete MAVLink + * parsing. the function will parse one byte at a time and return the + * complete packet once it could be successfully decoded. Checksum and other + * failures will be silently ignored. + * + * @param c The char to parse + */ + public MAVLinkPacket mavlink_parse_char(int c) { + + switch (state) { + case MAVLINK_PARSE_STATE_UNINIT: + case MAVLINK_PARSE_STATE_IDLE: + + if (c == MAVLinkPacket.MAVLINK_STX) { + state = MAV_states.MAVLINK_PARSE_STATE_GOT_STX; + } + break; + + case MAVLINK_PARSE_STATE_GOT_STX: + m = new MAVLinkPacket(c); + state = MAV_states.MAVLINK_PARSE_STATE_GOT_LENGTH; + break; + + case MAVLINK_PARSE_STATE_GOT_LENGTH: + m.seq = c; + state = MAV_states.MAVLINK_PARSE_STATE_GOT_SEQ; + break; + + case MAVLINK_PARSE_STATE_GOT_SEQ: + m.sysid = c; + state = MAV_states.MAVLINK_PARSE_STATE_GOT_SYSID; + break; + + case MAVLINK_PARSE_STATE_GOT_SYSID: + m.compid = c; + state = MAV_states.MAVLINK_PARSE_STATE_GOT_COMPID; + break; + + case MAVLINK_PARSE_STATE_GOT_COMPID: + m.msgid = c; + if (m.len == 0) { + state = MAV_states.MAVLINK_PARSE_STATE_GOT_PAYLOAD; + } else { + state = MAV_states.MAVLINK_PARSE_STATE_GOT_MSGID; + } + break; + + case MAVLINK_PARSE_STATE_GOT_MSGID: + m.payload.add((byte) c); + if (m.payloadIsFilled()) { + state = MAV_states.MAVLINK_PARSE_STATE_GOT_PAYLOAD; + } + break; + + case MAVLINK_PARSE_STATE_GOT_PAYLOAD: + m.generateCRC(); + // Check first checksum byte + if (c != m.crc.getLSB()) { + state = MAV_states.MAVLINK_PARSE_STATE_IDLE; + if (c == MAVLinkPacket.MAVLINK_STX) { + state = MAV_states.MAVLINK_PARSE_STATE_GOT_STX; + m.crc.start_checksum(); + } + stats.crcError(); + } else { + state = MAV_states.MAVLINK_PARSE_STATE_GOT_CRC1; + } + break; + + case MAVLINK_PARSE_STATE_GOT_CRC1: + // Check second checksum byte + if (c != m.crc.getMSB()) { + state = MAV_states.MAVLINK_PARSE_STATE_IDLE; + if (c == MAVLinkPacket.MAVLINK_STX) { + state = MAV_states.MAVLINK_PARSE_STATE_GOT_STX; + m.crc.start_checksum(); + } + stats.crcError(); + } else { // Successfully received the message + stats.newPacket(m); + state = MAV_states.MAVLINK_PARSE_STATE_IDLE; + return m; + } + + break; + + } + return null; + } +} diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/CRC.java b/app/src/main/java/com/MAVLink/ardupilotmega/CRC.java new file mode 100644 index 0000000..8444f49 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/CRC.java @@ -0,0 +1,64 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.ardupilotmega; + +/** + * X.25 CRC calculation for MAVlink messages. The checksum must be initialized, + * updated with witch field of the message, and then finished with the message + * id. + */ +public class CRC { + private static final int[] MAVLINK_MESSAGE_CRCS = {50, 124, 137, 0, 237, 217, 104, 119, 0, 0, 0, 89, 0, 0, 0, 0, 0, 0, 0, 0, 214, 159, 220, 168, 24, 23, 170, 144, 67, 115, 39, 246, 185, 104, 237, 244, 222, 212, 9, 254, 230, 28, 28, 132, 221, 232, 11, 153, 41, 39, 78, 196, 0, 0, 15, 3, 0, 0, 0, 0, 0, 167, 183, 119, 191, 118, 148, 21, 0, 243, 124, 0, 0, 38, 20, 158, 152, 143, 0, 0, 0, 106, 49, 22, 143, 140, 5, 150, 0, 231, 183, 63, 54, 47, 0, 0, 0, 0, 0, 0, 175, 102, 158, 208, 56, 93, 138, 108, 32, 185, 84, 34, 174, 124, 237, 4, 76, 128, 56, 116, 134, 237, 203, 250, 87, 203, 220, 25, 226, 46, 29, 223, 85, 6, 229, 203, 1, 195, 109, 168, 181, 47, 72, 131, 127, 0, 103, 154, 178, 200, 134, 219, 208, 188, 84, 22, 19, 21, 134, 0, 78, 68, 189, 127, 154, 21, 21, 144, 1, 234, 73, 181, 22, 83, 167, 138, 234, 240, 47, 189, 52, 174, 229, 85, 159, 186, 72, 0, 0, 0, 0, 92, 36, 71, 98, 0, 0, 0, 0, 0, 134, 205, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 69, 101, 50, 202, 17, 162, 0, 0, 0, 0, 0, 0, 207, 0, 0, 0, 163, 105, 151, 35, 150, 0, 0, 0, 0, 0, 0, 90, 104, 85, 95, 130, 184, 81, 8, 204, 49, 170, 44, 83, 46, 0}; + private static final int CRC_INIT_VALUE = 0xffff; + private int crcValue; + + /** + * Accumulate the X.25 CRC by adding one char at a time. + * <p> + * The checksum function adds the hash of one char at a time to the 16 bit + * checksum (uint16_t). + * + * @param data new char to hash + **/ + public void update_checksum(int data) { + data = data & 0xff; //cast because we want an unsigned type + int tmp = data ^ (crcValue & 0xff); + tmp ^= (tmp << 4) & 0xff; + crcValue = ((crcValue >> 8) & 0xff) ^ (tmp << 8) ^ (tmp << 3) ^ ((tmp >> 4) & 0xf); + } + + /** + * Finish the CRC calculation of a message, by running the CRC with the + * Magic Byte. This Magic byte has been defined in MAVlink v1.0. + * + * @param msgid The message id number + */ + public void finish_checksum(int msgid) { + update_checksum(MAVLINK_MESSAGE_CRCS[msgid]); + } + + /** + * Initialize the buffer for the X.25 CRC + */ + public void start_checksum() { + crcValue = CRC_INIT_VALUE; + } + + public int getMSB() { + return ((crcValue >> 8) & 0xff); + } + + public int getLSB() { + return (crcValue & 0xff); + } + + public CRC() { + start_checksum(); + } + +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_adap_tuning.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_adap_tuning.java new file mode 100644 index 0000000..562134d --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_adap_tuning.java @@ -0,0 +1,192 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE ADAP_TUNING PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Adaptive Controller tuning information + */ +public class msg_adap_tuning extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_ADAP_TUNING = 11010; + public static final int MAVLINK_MSG_LENGTH = 49; + private static final long serialVersionUID = MAVLINK_MSG_ID_ADAP_TUNING; + + + /** + * desired rate (degrees/s) + */ + public float desired; + + /** + * achieved rate (degrees/s) + */ + public float achieved; + + /** + * error between model and vehicle + */ + public float error; + + /** + * theta estimated state predictor + */ + public float theta; + + /** + * omega estimated state predictor + */ + public float omega; + + /** + * sigma estimated state predictor + */ + public float sigma; + + /** + * theta derivative + */ + public float theta_dot; + + /** + * omega derivative + */ + public float omega_dot; + + /** + * sigma derivative + */ + public float sigma_dot; + + /** + * projection operator value + */ + public float f; + + /** + * projection operator derivative + */ + public float f_dot; + + /** + * u adaptive controlled output command + */ + public float u; + + /** + * axis + */ + public short axis; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_ADAP_TUNING; + + packet.payload.putFloat(desired); + + packet.payload.putFloat(achieved); + + packet.payload.putFloat(error); + + packet.payload.putFloat(theta); + + packet.payload.putFloat(omega); + + packet.payload.putFloat(sigma); + + packet.payload.putFloat(theta_dot); + + packet.payload.putFloat(omega_dot); + + packet.payload.putFloat(sigma_dot); + + packet.payload.putFloat(f); + + packet.payload.putFloat(f_dot); + + packet.payload.putFloat(u); + + packet.payload.putUnsignedByte(axis); + + return packet; + } + + /** + * Decode a adap_tuning message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.desired = payload.getFloat(); + + this.achieved = payload.getFloat(); + + this.error = payload.getFloat(); + + this.theta = payload.getFloat(); + + this.omega = payload.getFloat(); + + this.sigma = payload.getFloat(); + + this.theta_dot = payload.getFloat(); + + this.omega_dot = payload.getFloat(); + + this.sigma_dot = payload.getFloat(); + + this.f = payload.getFloat(); + + this.f_dot = payload.getFloat(); + + this.u = payload.getFloat(); + + this.axis = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_adap_tuning() { + msgid = MAVLINK_MSG_ID_ADAP_TUNING; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_adap_tuning(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_ADAP_TUNING; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_ADAP_TUNING - sysid:" + sysid + " compid:" + compid + " desired:" + desired + " achieved:" + achieved + " error:" + error + " theta:" + theta + " omega:" + omega + " sigma:" + sigma + " theta_dot:" + theta_dot + " omega_dot:" + omega_dot + " sigma_dot:" + sigma_dot + " f:" + f + " f_dot:" + f_dot + " u:" + u + " axis:" + axis + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_ahrs.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_ahrs.java new file mode 100644 index 0000000..27f64ba --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_ahrs.java @@ -0,0 +1,138 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE AHRS PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Status of DCM attitude estimator + */ +public class msg_ahrs extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_AHRS = 163; + public static final int MAVLINK_MSG_LENGTH = 28; + private static final long serialVersionUID = MAVLINK_MSG_ID_AHRS; + + + /** + * X gyro drift estimate rad/s + */ + public float omegaIx; + + /** + * Y gyro drift estimate rad/s + */ + public float omegaIy; + + /** + * Z gyro drift estimate rad/s + */ + public float omegaIz; + + /** + * average accel_weight + */ + public float accel_weight; + + /** + * average renormalisation value + */ + public float renorm_val; + + /** + * average error_roll_pitch value + */ + public float error_rp; + + /** + * average error_yaw value + */ + public float error_yaw; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_AHRS; + + packet.payload.putFloat(omegaIx); + + packet.payload.putFloat(omegaIy); + + packet.payload.putFloat(omegaIz); + + packet.payload.putFloat(accel_weight); + + packet.payload.putFloat(renorm_val); + + packet.payload.putFloat(error_rp); + + packet.payload.putFloat(error_yaw); + + return packet; + } + + /** + * Decode a ahrs message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.omegaIx = payload.getFloat(); + + this.omegaIy = payload.getFloat(); + + this.omegaIz = payload.getFloat(); + + this.accel_weight = payload.getFloat(); + + this.renorm_val = payload.getFloat(); + + this.error_rp = payload.getFloat(); + + this.error_yaw = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_ahrs() { + msgid = MAVLINK_MSG_ID_AHRS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_ahrs(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_AHRS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_AHRS - sysid:" + sysid + " compid:" + compid + " omegaIx:" + omegaIx + " omegaIy:" + omegaIy + " omegaIz:" + omegaIz + " accel_weight:" + accel_weight + " renorm_val:" + renorm_val + " error_rp:" + error_rp + " error_yaw:" + error_yaw + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_ahrs2.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_ahrs2.java new file mode 100644 index 0000000..8764e82 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_ahrs2.java @@ -0,0 +1,129 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE AHRS2 PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Status of secondary AHRS filter if available + */ +public class msg_ahrs2 extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_AHRS2 = 178; + public static final int MAVLINK_MSG_LENGTH = 24; + private static final long serialVersionUID = MAVLINK_MSG_ID_AHRS2; + + + /** + * Roll angle (rad) + */ + public float roll; + + /** + * Pitch angle (rad) + */ + public float pitch; + + /** + * Yaw angle (rad) + */ + public float yaw; + + /** + * Altitude (MSL) + */ + public float altitude; + + /** + * Latitude in degrees * 1E7 + */ + public int lat; + + /** + * Longitude in degrees * 1E7 + */ + public int lng; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_AHRS2; + + packet.payload.putFloat(roll); + + packet.payload.putFloat(pitch); + + packet.payload.putFloat(yaw); + + packet.payload.putFloat(altitude); + + packet.payload.putInt(lat); + + packet.payload.putInt(lng); + + return packet; + } + + /** + * Decode a ahrs2 message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.roll = payload.getFloat(); + + this.pitch = payload.getFloat(); + + this.yaw = payload.getFloat(); + + this.altitude = payload.getFloat(); + + this.lat = payload.getInt(); + + this.lng = payload.getInt(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_ahrs2() { + msgid = MAVLINK_MSG_ID_AHRS2; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_ahrs2(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_AHRS2; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_AHRS2 - sysid:" + sysid + " compid:" + compid + " roll:" + roll + " pitch:" + pitch + " yaw:" + yaw + " altitude:" + altitude + " lat:" + lat + " lng:" + lng + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_ahrs3.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_ahrs3.java new file mode 100644 index 0000000..900c1ba --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_ahrs3.java @@ -0,0 +1,165 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE AHRS3 PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Status of third AHRS filter if available. This is for ANU research group (Ali and Sean) + */ +public class msg_ahrs3 extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_AHRS3 = 182; + public static final int MAVLINK_MSG_LENGTH = 40; + private static final long serialVersionUID = MAVLINK_MSG_ID_AHRS3; + + + /** + * Roll angle (rad) + */ + public float roll; + + /** + * Pitch angle (rad) + */ + public float pitch; + + /** + * Yaw angle (rad) + */ + public float yaw; + + /** + * Altitude (MSL) + */ + public float altitude; + + /** + * Latitude in degrees * 1E7 + */ + public int lat; + + /** + * Longitude in degrees * 1E7 + */ + public int lng; + + /** + * test variable1 + */ + public float v1; + + /** + * test variable2 + */ + public float v2; + + /** + * test variable3 + */ + public float v3; + + /** + * test variable4 + */ + public float v4; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_AHRS3; + + packet.payload.putFloat(roll); + + packet.payload.putFloat(pitch); + + packet.payload.putFloat(yaw); + + packet.payload.putFloat(altitude); + + packet.payload.putInt(lat); + + packet.payload.putInt(lng); + + packet.payload.putFloat(v1); + + packet.payload.putFloat(v2); + + packet.payload.putFloat(v3); + + packet.payload.putFloat(v4); + + return packet; + } + + /** + * Decode a ahrs3 message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.roll = payload.getFloat(); + + this.pitch = payload.getFloat(); + + this.yaw = payload.getFloat(); + + this.altitude = payload.getFloat(); + + this.lat = payload.getInt(); + + this.lng = payload.getInt(); + + this.v1 = payload.getFloat(); + + this.v2 = payload.getFloat(); + + this.v3 = payload.getFloat(); + + this.v4 = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_ahrs3() { + msgid = MAVLINK_MSG_ID_AHRS3; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_ahrs3(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_AHRS3; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_AHRS3 - sysid:" + sysid + " compid:" + compid + " roll:" + roll + " pitch:" + pitch + " yaw:" + yaw + " altitude:" + altitude + " lat:" + lat + " lng:" + lng + " v1:" + v1 + " v2:" + v2 + " v3:" + v3 + " v4:" + v4 + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_airspeed_autocal.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_airspeed_autocal.java new file mode 100644 index 0000000..55070d4 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_airspeed_autocal.java @@ -0,0 +1,183 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE AIRSPEED_AUTOCAL PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Airspeed auto-calibration + */ +public class msg_airspeed_autocal extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_AIRSPEED_AUTOCAL = 174; + public static final int MAVLINK_MSG_LENGTH = 48; + private static final long serialVersionUID = MAVLINK_MSG_ID_AIRSPEED_AUTOCAL; + + + /** + * GPS velocity north m/s + */ + public float vx; + + /** + * GPS velocity east m/s + */ + public float vy; + + /** + * GPS velocity down m/s + */ + public float vz; + + /** + * Differential pressure pascals + */ + public float diff_pressure; + + /** + * Estimated to true airspeed ratio + */ + public float EAS2TAS; + + /** + * Airspeed ratio + */ + public float ratio; + + /** + * EKF state x + */ + public float state_x; + + /** + * EKF state y + */ + public float state_y; + + /** + * EKF state z + */ + public float state_z; + + /** + * EKF Pax + */ + public float Pax; + + /** + * EKF Pby + */ + public float Pby; + + /** + * EKF Pcz + */ + public float Pcz; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_AIRSPEED_AUTOCAL; + + packet.payload.putFloat(vx); + + packet.payload.putFloat(vy); + + packet.payload.putFloat(vz); + + packet.payload.putFloat(diff_pressure); + + packet.payload.putFloat(EAS2TAS); + + packet.payload.putFloat(ratio); + + packet.payload.putFloat(state_x); + + packet.payload.putFloat(state_y); + + packet.payload.putFloat(state_z); + + packet.payload.putFloat(Pax); + + packet.payload.putFloat(Pby); + + packet.payload.putFloat(Pcz); + + return packet; + } + + /** + * Decode a airspeed_autocal message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.vx = payload.getFloat(); + + this.vy = payload.getFloat(); + + this.vz = payload.getFloat(); + + this.diff_pressure = payload.getFloat(); + + this.EAS2TAS = payload.getFloat(); + + this.ratio = payload.getFloat(); + + this.state_x = payload.getFloat(); + + this.state_y = payload.getFloat(); + + this.state_z = payload.getFloat(); + + this.Pax = payload.getFloat(); + + this.Pby = payload.getFloat(); + + this.Pcz = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_airspeed_autocal() { + msgid = MAVLINK_MSG_ID_AIRSPEED_AUTOCAL; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_airspeed_autocal(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_AIRSPEED_AUTOCAL; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_AIRSPEED_AUTOCAL - sysid:" + sysid + " compid:" + compid + " vx:" + vx + " vy:" + vy + " vz:" + vz + " diff_pressure:" + diff_pressure + " EAS2TAS:" + EAS2TAS + " ratio:" + ratio + " state_x:" + state_x + " state_y:" + state_y + " state_z:" + state_z + " Pax:" + Pax + " Pby:" + Pby + " Pcz:" + Pcz + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_ap_adc.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_ap_adc.java new file mode 100644 index 0000000..7676add --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_ap_adc.java @@ -0,0 +1,129 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE AP_ADC PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * raw ADC output + */ +public class msg_ap_adc extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_AP_ADC = 153; + public static final int MAVLINK_MSG_LENGTH = 12; + private static final long serialVersionUID = MAVLINK_MSG_ID_AP_ADC; + + + /** + * ADC output 1 + */ + public int adc1; + + /** + * ADC output 2 + */ + public int adc2; + + /** + * ADC output 3 + */ + public int adc3; + + /** + * ADC output 4 + */ + public int adc4; + + /** + * ADC output 5 + */ + public int adc5; + + /** + * ADC output 6 + */ + public int adc6; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_AP_ADC; + + packet.payload.putUnsignedShort(adc1); + + packet.payload.putUnsignedShort(adc2); + + packet.payload.putUnsignedShort(adc3); + + packet.payload.putUnsignedShort(adc4); + + packet.payload.putUnsignedShort(adc5); + + packet.payload.putUnsignedShort(adc6); + + return packet; + } + + /** + * Decode a ap_adc message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.adc1 = payload.getUnsignedShort(); + + this.adc2 = payload.getUnsignedShort(); + + this.adc3 = payload.getUnsignedShort(); + + this.adc4 = payload.getUnsignedShort(); + + this.adc5 = payload.getUnsignedShort(); + + this.adc6 = payload.getUnsignedShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_ap_adc() { + msgid = MAVLINK_MSG_ID_AP_ADC; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_ap_adc(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_AP_ADC; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_AP_ADC - sysid:" + sysid + " compid:" + compid + " adc1:" + adc1 + " adc2:" + adc2 + " adc3:" + adc3 + " adc4:" + adc4 + " adc5:" + adc5 + " adc6:" + adc6 + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_autopilot_version_request.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_autopilot_version_request.java new file mode 100644 index 0000000..e21a8a8 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_autopilot_version_request.java @@ -0,0 +1,93 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE AUTOPILOT_VERSION_REQUEST PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Request the autopilot version from the system/component. + */ +public class msg_autopilot_version_request extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST = 183; + public static final int MAVLINK_MSG_LENGTH = 2; + private static final long serialVersionUID = MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST; + + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST; + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + return packet; + } + + /** + * Decode a autopilot_version_request message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_autopilot_version_request() { + msgid = MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_autopilot_version_request(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_AUTOPILOT_VERSION_REQUEST - sysid:" + sysid + " compid:" + compid + " target_system:" + target_system + " target_component:" + target_component + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_battery2.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_battery2.java new file mode 100644 index 0000000..47ef2f0 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_battery2.java @@ -0,0 +1,93 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE BATTERY2 PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * 2nd Battery status + */ +public class msg_battery2 extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_BATTERY2 = 181; + public static final int MAVLINK_MSG_LENGTH = 4; + private static final long serialVersionUID = MAVLINK_MSG_ID_BATTERY2; + + + /** + * voltage in millivolts + */ + public int voltage; + + /** + * Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current + */ + public short current_battery; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_BATTERY2; + + packet.payload.putUnsignedShort(voltage); + + packet.payload.putShort(current_battery); + + return packet; + } + + /** + * Decode a battery2 message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.voltage = payload.getUnsignedShort(); + + this.current_battery = payload.getShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_battery2() { + msgid = MAVLINK_MSG_ID_BATTERY2; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_battery2(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_BATTERY2; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_BATTERY2 - sysid:" + sysid + " compid:" + compid + " voltage:" + voltage + " current_battery:" + current_battery + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_camera_feedback.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_camera_feedback.java new file mode 100644 index 0000000..456c5fd --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_camera_feedback.java @@ -0,0 +1,192 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE CAMERA_FEEDBACK PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Camera Capture Feedback + */ +public class msg_camera_feedback extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_CAMERA_FEEDBACK = 180; + public static final int MAVLINK_MSG_LENGTH = 45; + private static final long serialVersionUID = MAVLINK_MSG_ID_CAMERA_FEEDBACK; + + + /** + * Image timestamp (microseconds since UNIX epoch), as passed in by CAMERA_STATUS message (or autopilot if no CCB) + */ + public long time_usec; + + /** + * Latitude in (deg * 1E7) + */ + public int lat; + + /** + * Longitude in (deg * 1E7) + */ + public int lng; + + /** + * Altitude Absolute (meters AMSL) + */ + public float alt_msl; + + /** + * Altitude Relative (meters above HOME location) + */ + public float alt_rel; + + /** + * Camera Roll angle (earth frame, degrees, +-180) + */ + public float roll; + + /** + * Camera Pitch angle (earth frame, degrees, +-180) + */ + public float pitch; + + /** + * Camera Yaw (earth frame, degrees, 0-360, true) + */ + public float yaw; + + /** + * Focal Length (mm) + */ + public float foc_len; + + /** + * Image index + */ + public int img_idx; + + /** + * System ID + */ + public short target_system; + + /** + * Camera ID + */ + public short cam_idx; + + /** + * See CAMERA_FEEDBACK_FLAGS enum for definition of the bitmask + */ + public short flags; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_CAMERA_FEEDBACK; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putInt(lat); + + packet.payload.putInt(lng); + + packet.payload.putFloat(alt_msl); + + packet.payload.putFloat(alt_rel); + + packet.payload.putFloat(roll); + + packet.payload.putFloat(pitch); + + packet.payload.putFloat(yaw); + + packet.payload.putFloat(foc_len); + + packet.payload.putUnsignedShort(img_idx); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(cam_idx); + + packet.payload.putUnsignedByte(flags); + + return packet; + } + + /** + * Decode a camera_feedback message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.lat = payload.getInt(); + + this.lng = payload.getInt(); + + this.alt_msl = payload.getFloat(); + + this.alt_rel = payload.getFloat(); + + this.roll = payload.getFloat(); + + this.pitch = payload.getFloat(); + + this.yaw = payload.getFloat(); + + this.foc_len = payload.getFloat(); + + this.img_idx = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.cam_idx = payload.getUnsignedByte(); + + this.flags = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_camera_feedback() { + msgid = MAVLINK_MSG_ID_CAMERA_FEEDBACK; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_camera_feedback(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_CAMERA_FEEDBACK; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_CAMERA_FEEDBACK - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " lat:" + lat + " lng:" + lng + " alt_msl:" + alt_msl + " alt_rel:" + alt_rel + " roll:" + roll + " pitch:" + pitch + " yaw:" + yaw + " foc_len:" + foc_len + " img_idx:" + img_idx + " target_system:" + target_system + " cam_idx:" + cam_idx + " flags:" + flags + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_camera_status.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_camera_status.java new file mode 100644 index 0000000..1cff849 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_camera_status.java @@ -0,0 +1,156 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE CAMERA_STATUS PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Camera Event + */ +public class msg_camera_status extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_CAMERA_STATUS = 179; + public static final int MAVLINK_MSG_LENGTH = 29; + private static final long serialVersionUID = MAVLINK_MSG_ID_CAMERA_STATUS; + + + /** + * Image timestamp (microseconds since UNIX epoch, according to camera clock) + */ + public long time_usec; + + /** + * Parameter 1 (meaning depends on event, see CAMERA_STATUS_TYPES enum) + */ + public float p1; + + /** + * Parameter 2 (meaning depends on event, see CAMERA_STATUS_TYPES enum) + */ + public float p2; + + /** + * Parameter 3 (meaning depends on event, see CAMERA_STATUS_TYPES enum) + */ + public float p3; + + /** + * Parameter 4 (meaning depends on event, see CAMERA_STATUS_TYPES enum) + */ + public float p4; + + /** + * Image index + */ + public int img_idx; + + /** + * System ID + */ + public short target_system; + + /** + * Camera ID + */ + public short cam_idx; + + /** + * See CAMERA_STATUS_TYPES enum for definition of the bitmask + */ + public short event_id; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_CAMERA_STATUS; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putFloat(p1); + + packet.payload.putFloat(p2); + + packet.payload.putFloat(p3); + + packet.payload.putFloat(p4); + + packet.payload.putUnsignedShort(img_idx); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(cam_idx); + + packet.payload.putUnsignedByte(event_id); + + return packet; + } + + /** + * Decode a camera_status message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.p1 = payload.getFloat(); + + this.p2 = payload.getFloat(); + + this.p3 = payload.getFloat(); + + this.p4 = payload.getFloat(); + + this.img_idx = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.cam_idx = payload.getUnsignedByte(); + + this.event_id = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_camera_status() { + msgid = MAVLINK_MSG_ID_CAMERA_STATUS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_camera_status(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_CAMERA_STATUS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_CAMERA_STATUS - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " p1:" + p1 + " p2:" + p2 + " p3:" + p3 + " p4:" + p4 + " img_idx:" + img_idx + " target_system:" + target_system + " cam_idx:" + cam_idx + " event_id:" + event_id + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_compassmot_status.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_compassmot_status.java new file mode 100644 index 0000000..d28aaa4 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_compassmot_status.java @@ -0,0 +1,129 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE COMPASSMOT_STATUS PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Status of compassmot calibration + */ +public class msg_compassmot_status extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_COMPASSMOT_STATUS = 177; + public static final int MAVLINK_MSG_LENGTH = 20; + private static final long serialVersionUID = MAVLINK_MSG_ID_COMPASSMOT_STATUS; + + + /** + * current (Ampere) + */ + public float current; + + /** + * Motor Compensation X + */ + public float CompensationX; + + /** + * Motor Compensation Y + */ + public float CompensationY; + + /** + * Motor Compensation Z + */ + public float CompensationZ; + + /** + * throttle (percent*10) + */ + public int throttle; + + /** + * interference (percent) + */ + public int interference; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_COMPASSMOT_STATUS; + + packet.payload.putFloat(current); + + packet.payload.putFloat(CompensationX); + + packet.payload.putFloat(CompensationY); + + packet.payload.putFloat(CompensationZ); + + packet.payload.putUnsignedShort(throttle); + + packet.payload.putUnsignedShort(interference); + + return packet; + } + + /** + * Decode a compassmot_status message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.current = payload.getFloat(); + + this.CompensationX = payload.getFloat(); + + this.CompensationY = payload.getFloat(); + + this.CompensationZ = payload.getFloat(); + + this.throttle = payload.getUnsignedShort(); + + this.interference = payload.getUnsignedShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_compassmot_status() { + msgid = MAVLINK_MSG_ID_COMPASSMOT_STATUS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_compassmot_status(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_COMPASSMOT_STATUS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_COMPASSMOT_STATUS - sysid:" + sysid + " compid:" + compid + " current:" + current + " CompensationX:" + CompensationX + " CompensationY:" + CompensationY + " CompensationZ:" + CompensationZ + " throttle:" + throttle + " interference:" + interference + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_data16.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_data16.java new file mode 100644 index 0000000..af9cd5c --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_data16.java @@ -0,0 +1,110 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE DATA16 PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Data packet, size 16 + */ +public class msg_data16 extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_DATA16 = 169; + public static final int MAVLINK_MSG_LENGTH = 18; + private static final long serialVersionUID = MAVLINK_MSG_ID_DATA16; + + + /** + * data type + */ + public short type; + + /** + * data length + */ + public short len; + + /** + * raw data + */ + public short data[] = new short[16]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_DATA16; + + packet.payload.putUnsignedByte(type); + + packet.payload.putUnsignedByte(len); + + + for (int i = 0; i < data.length; i++) { + packet.payload.putUnsignedByte(data[i]); + } + + + return packet; + } + + /** + * Decode a data16 message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.type = payload.getUnsignedByte(); + + this.len = payload.getUnsignedByte(); + + + for (int i = 0; i < this.data.length; i++) { + this.data[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_data16() { + msgid = MAVLINK_MSG_ID_DATA16; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_data16(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_DATA16; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_DATA16 - sysid:" + sysid + " compid:" + compid + " type:" + type + " len:" + len + " data:" + data + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_data32.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_data32.java new file mode 100644 index 0000000..63b6df0 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_data32.java @@ -0,0 +1,110 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE DATA32 PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Data packet, size 32 + */ +public class msg_data32 extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_DATA32 = 170; + public static final int MAVLINK_MSG_LENGTH = 34; + private static final long serialVersionUID = MAVLINK_MSG_ID_DATA32; + + + /** + * data type + */ + public short type; + + /** + * data length + */ + public short len; + + /** + * raw data + */ + public short data[] = new short[32]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_DATA32; + + packet.payload.putUnsignedByte(type); + + packet.payload.putUnsignedByte(len); + + + for (int i = 0; i < data.length; i++) { + packet.payload.putUnsignedByte(data[i]); + } + + + return packet; + } + + /** + * Decode a data32 message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.type = payload.getUnsignedByte(); + + this.len = payload.getUnsignedByte(); + + + for (int i = 0; i < this.data.length; i++) { + this.data[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_data32() { + msgid = MAVLINK_MSG_ID_DATA32; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_data32(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_DATA32; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_DATA32 - sysid:" + sysid + " compid:" + compid + " type:" + type + " len:" + len + " data:" + data + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_data64.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_data64.java new file mode 100644 index 0000000..9ab4b96 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_data64.java @@ -0,0 +1,110 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE DATA64 PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Data packet, size 64 + */ +public class msg_data64 extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_DATA64 = 171; + public static final int MAVLINK_MSG_LENGTH = 66; + private static final long serialVersionUID = MAVLINK_MSG_ID_DATA64; + + + /** + * data type + */ + public short type; + + /** + * data length + */ + public short len; + + /** + * raw data + */ + public short data[] = new short[64]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_DATA64; + + packet.payload.putUnsignedByte(type); + + packet.payload.putUnsignedByte(len); + + + for (int i = 0; i < data.length; i++) { + packet.payload.putUnsignedByte(data[i]); + } + + + return packet; + } + + /** + * Decode a data64 message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.type = payload.getUnsignedByte(); + + this.len = payload.getUnsignedByte(); + + + for (int i = 0; i < this.data.length; i++) { + this.data[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_data64() { + msgid = MAVLINK_MSG_ID_DATA64; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_data64(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_DATA64; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_DATA64 - sysid:" + sysid + " compid:" + compid + " type:" + type + " len:" + len + " data:" + data + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_data96.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_data96.java new file mode 100644 index 0000000..ef4daf5 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_data96.java @@ -0,0 +1,110 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE DATA96 PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Data packet, size 96 + */ +public class msg_data96 extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_DATA96 = 172; + public static final int MAVLINK_MSG_LENGTH = 98; + private static final long serialVersionUID = MAVLINK_MSG_ID_DATA96; + + + /** + * data type + */ + public short type; + + /** + * data length + */ + public short len; + + /** + * raw data + */ + public short data[] = new short[96]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_DATA96; + + packet.payload.putUnsignedByte(type); + + packet.payload.putUnsignedByte(len); + + + for (int i = 0; i < data.length; i++) { + packet.payload.putUnsignedByte(data[i]); + } + + + return packet; + } + + /** + * Decode a data96 message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.type = payload.getUnsignedByte(); + + this.len = payload.getUnsignedByte(); + + + for (int i = 0; i < this.data.length; i++) { + this.data[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_data96() { + msgid = MAVLINK_MSG_ID_DATA96; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_data96(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_DATA96; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_DATA96 - sysid:" + sysid + " compid:" + compid + " type:" + type + " len:" + len + " data:" + data + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_device_op_read.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_device_op_read.java new file mode 100644 index 0000000..4c84d97 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_device_op_read.java @@ -0,0 +1,193 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE DEVICE_OP_READ PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Read registers for a device + */ +public class msg_device_op_read extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_DEVICE_OP_READ = 11000; + public static final int MAVLINK_MSG_LENGTH = 51; + private static final long serialVersionUID = MAVLINK_MSG_ID_DEVICE_OP_READ; + + + /** + * request ID - copied to reply + */ + public long request_id; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * The bus type + */ + public short bustype; + + /** + * Bus number + */ + public short bus; + + /** + * Bus address + */ + public short address; + + /** + * Name of device on bus (for SPI) + */ + public byte busname[] = new byte[40]; + + /** + * First register to read + */ + public short regstart; + + /** + * count of registers to read + */ + public short count; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_DEVICE_OP_READ; + + packet.payload.putUnsignedInt(request_id); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(bustype); + + packet.payload.putUnsignedByte(bus); + + packet.payload.putUnsignedByte(address); + + + for (int i = 0; i < busname.length; i++) { + packet.payload.putByte(busname[i]); + } + + + packet.payload.putUnsignedByte(regstart); + + packet.payload.putUnsignedByte(count); + + return packet; + } + + /** + * Decode a device_op_read message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.request_id = payload.getUnsignedInt(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.bustype = payload.getUnsignedByte(); + + this.bus = payload.getUnsignedByte(); + + this.address = payload.getUnsignedByte(); + + + for (int i = 0; i < this.busname.length; i++) { + this.busname[i] = payload.getByte(); + } + + + this.regstart = payload.getUnsignedByte(); + + this.count = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_device_op_read() { + msgid = MAVLINK_MSG_ID_DEVICE_OP_READ; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_device_op_read(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_DEVICE_OP_READ; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setBusname(String str) { + int len = Math.min(str.length(), 40); + for (int i = 0; i < len; i++) { + busname[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 40; i++) { // padding for the rest of the buffer + busname[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getBusname() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 40; i++) { + if (busname[i] != 0) + buf.append((char) busname[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_DEVICE_OP_READ - sysid:" + sysid + " compid:" + compid + " request_id:" + request_id + " target_system:" + target_system + " target_component:" + target_component + " bustype:" + bustype + " bus:" + bus + " address:" + address + " busname:" + busname + " regstart:" + regstart + " count:" + count + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_device_op_read_reply.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_device_op_read_reply.java new file mode 100644 index 0000000..18e5670 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_device_op_read_reply.java @@ -0,0 +1,128 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE DEVICE_OP_READ_REPLY PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Read registers reply + */ +public class msg_device_op_read_reply extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY = 11001; + public static final int MAVLINK_MSG_LENGTH = 135; + private static final long serialVersionUID = MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY; + + + /** + * request ID - copied from request + */ + public long request_id; + + /** + * 0 for success, anything else is failure code + */ + public short result; + + /** + * starting register + */ + public short regstart; + + /** + * count of bytes read + */ + public short count; + + /** + * reply data + */ + public short data[] = new short[128]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY; + + packet.payload.putUnsignedInt(request_id); + + packet.payload.putUnsignedByte(result); + + packet.payload.putUnsignedByte(regstart); + + packet.payload.putUnsignedByte(count); + + + for (int i = 0; i < data.length; i++) { + packet.payload.putUnsignedByte(data[i]); + } + + + return packet; + } + + /** + * Decode a device_op_read_reply message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.request_id = payload.getUnsignedInt(); + + this.result = payload.getUnsignedByte(); + + this.regstart = payload.getUnsignedByte(); + + this.count = payload.getUnsignedByte(); + + + for (int i = 0; i < this.data.length; i++) { + this.data[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_device_op_read_reply() { + msgid = MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_device_op_read_reply(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_DEVICE_OP_READ_REPLY - sysid:" + sysid + " compid:" + compid + " request_id:" + request_id + " result:" + result + " regstart:" + regstart + " count:" + count + " data:" + data + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_device_op_write.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_device_op_write.java new file mode 100644 index 0000000..b6ede96 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_device_op_write.java @@ -0,0 +1,210 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE DEVICE_OP_WRITE PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Write registers for a device + */ +public class msg_device_op_write extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_DEVICE_OP_WRITE = 11002; + public static final int MAVLINK_MSG_LENGTH = 179; + private static final long serialVersionUID = MAVLINK_MSG_ID_DEVICE_OP_WRITE; + + + /** + * request ID - copied to reply + */ + public long request_id; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * The bus type + */ + public short bustype; + + /** + * Bus number + */ + public short bus; + + /** + * Bus address + */ + public short address; + + /** + * Name of device on bus (for SPI) + */ + public byte busname[] = new byte[40]; + + /** + * First register to write + */ + public short regstart; + + /** + * count of registers to write + */ + public short count; + + /** + * write data + */ + public short data[] = new short[128]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_DEVICE_OP_WRITE; + + packet.payload.putUnsignedInt(request_id); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(bustype); + + packet.payload.putUnsignedByte(bus); + + packet.payload.putUnsignedByte(address); + + + for (int i = 0; i < busname.length; i++) { + packet.payload.putByte(busname[i]); + } + + + packet.payload.putUnsignedByte(regstart); + + packet.payload.putUnsignedByte(count); + + + for (int i = 0; i < data.length; i++) { + packet.payload.putUnsignedByte(data[i]); + } + + + return packet; + } + + /** + * Decode a device_op_write message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.request_id = payload.getUnsignedInt(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.bustype = payload.getUnsignedByte(); + + this.bus = payload.getUnsignedByte(); + + this.address = payload.getUnsignedByte(); + + + for (int i = 0; i < this.busname.length; i++) { + this.busname[i] = payload.getByte(); + } + + + this.regstart = payload.getUnsignedByte(); + + this.count = payload.getUnsignedByte(); + + + for (int i = 0; i < this.data.length; i++) { + this.data[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_device_op_write() { + msgid = MAVLINK_MSG_ID_DEVICE_OP_WRITE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_device_op_write(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_DEVICE_OP_WRITE; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setBusname(String str) { + int len = Math.min(str.length(), 40); + for (int i = 0; i < len; i++) { + busname[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 40; i++) { // padding for the rest of the buffer + busname[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getBusname() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 40; i++) { + if (busname[i] != 0) + buf.append((char) busname[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_DEVICE_OP_WRITE - sysid:" + sysid + " compid:" + compid + " request_id:" + request_id + " target_system:" + target_system + " target_component:" + target_component + " bustype:" + bustype + " bus:" + bus + " address:" + address + " busname:" + busname + " regstart:" + regstart + " count:" + count + " data:" + data + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_device_op_write_reply.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_device_op_write_reply.java new file mode 100644 index 0000000..39af69b --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_device_op_write_reply.java @@ -0,0 +1,93 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE DEVICE_OP_WRITE_REPLY PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Write registers reply + */ +public class msg_device_op_write_reply extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY = 11003; + public static final int MAVLINK_MSG_LENGTH = 5; + private static final long serialVersionUID = MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY; + + + /** + * request ID - copied from request + */ + public long request_id; + + /** + * 0 for success, anything else is failure code + */ + public short result; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY; + + packet.payload.putUnsignedInt(request_id); + + packet.payload.putUnsignedByte(result); + + return packet; + } + + /** + * Decode a device_op_write_reply message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.request_id = payload.getUnsignedInt(); + + this.result = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_device_op_write_reply() { + msgid = MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_device_op_write_reply(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_DEVICE_OP_WRITE_REPLY - sysid:" + sysid + " compid:" + compid + " request_id:" + request_id + " result:" + result + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_digicam_configure.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_digicam_configure.java new file mode 100644 index 0000000..ebb8e4a --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_digicam_configure.java @@ -0,0 +1,174 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE DIGICAM_CONFIGURE PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Configure on-board Camera Control System. + */ +public class msg_digicam_configure extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_DIGICAM_CONFIGURE = 154; + public static final int MAVLINK_MSG_LENGTH = 15; + private static final long serialVersionUID = MAVLINK_MSG_ID_DIGICAM_CONFIGURE; + + + /** + * Correspondent value to given extra_param + */ + public float extra_value; + + /** + * Divisor number //e.g. 1000 means 1/1000 (0 means ignore) + */ + public int shutter_speed; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * Mode enumeration from 1 to N //P, TV, AV, M, Etc (0 means ignore) + */ + public short mode; + + /** + * F stop number x 10 //e.g. 28 means 2.8 (0 means ignore) + */ + public short aperture; + + /** + * ISO enumeration from 1 to N //e.g. 80, 100, 200, Etc (0 means ignore) + */ + public short iso; + + /** + * Exposure type enumeration from 1 to N (0 means ignore) + */ + public short exposure_type; + + /** + * Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once + */ + public short command_id; + + /** + * Main engine cut-off time before camera trigger in seconds/10 (0 means no cut-off) + */ + public short engine_cut_off; + + /** + * Extra parameters enumeration (0 means ignore) + */ + public short extra_param; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_DIGICAM_CONFIGURE; + + packet.payload.putFloat(extra_value); + + packet.payload.putUnsignedShort(shutter_speed); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(mode); + + packet.payload.putUnsignedByte(aperture); + + packet.payload.putUnsignedByte(iso); + + packet.payload.putUnsignedByte(exposure_type); + + packet.payload.putUnsignedByte(command_id); + + packet.payload.putUnsignedByte(engine_cut_off); + + packet.payload.putUnsignedByte(extra_param); + + return packet; + } + + /** + * Decode a digicam_configure message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.extra_value = payload.getFloat(); + + this.shutter_speed = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.mode = payload.getUnsignedByte(); + + this.aperture = payload.getUnsignedByte(); + + this.iso = payload.getUnsignedByte(); + + this.exposure_type = payload.getUnsignedByte(); + + this.command_id = payload.getUnsignedByte(); + + this.engine_cut_off = payload.getUnsignedByte(); + + this.extra_param = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_digicam_configure() { + msgid = MAVLINK_MSG_ID_DIGICAM_CONFIGURE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_digicam_configure(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_DIGICAM_CONFIGURE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_DIGICAM_CONFIGURE - sysid:" + sysid + " compid:" + compid + " extra_value:" + extra_value + " shutter_speed:" + shutter_speed + " target_system:" + target_system + " target_component:" + target_component + " mode:" + mode + " aperture:" + aperture + " iso:" + iso + " exposure_type:" + exposure_type + " command_id:" + command_id + " engine_cut_off:" + engine_cut_off + " extra_param:" + extra_param + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_digicam_control.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_digicam_control.java new file mode 100644 index 0000000..f8634b5 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_digicam_control.java @@ -0,0 +1,165 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE DIGICAM_CONTROL PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Control on-board Camera Control System to take shots. + */ +public class msg_digicam_control extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_DIGICAM_CONTROL = 155; + public static final int MAVLINK_MSG_LENGTH = 13; + private static final long serialVersionUID = MAVLINK_MSG_ID_DIGICAM_CONTROL; + + + /** + * Correspondent value to given extra_param + */ + public float extra_value; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * 0: stop, 1: start or keep it up //Session control e.g. show/hide lens + */ + public short session; + + /** + * 1 to N //Zoom's absolute position (0 means ignore) + */ + public short zoom_pos; + + /** + * -100 to 100 //Zooming step value to offset zoom from the current position + */ + public byte zoom_step; + + /** + * 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus + */ + public short focus_lock; + + /** + * 0: ignore, 1: shot or start filming + */ + public short shot; + + /** + * Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once + */ + public short command_id; + + /** + * Extra parameters enumeration (0 means ignore) + */ + public short extra_param; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_DIGICAM_CONTROL; + + packet.payload.putFloat(extra_value); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(session); + + packet.payload.putUnsignedByte(zoom_pos); + + packet.payload.putByte(zoom_step); + + packet.payload.putUnsignedByte(focus_lock); + + packet.payload.putUnsignedByte(shot); + + packet.payload.putUnsignedByte(command_id); + + packet.payload.putUnsignedByte(extra_param); + + return packet; + } + + /** + * Decode a digicam_control message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.extra_value = payload.getFloat(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.session = payload.getUnsignedByte(); + + this.zoom_pos = payload.getUnsignedByte(); + + this.zoom_step = payload.getByte(); + + this.focus_lock = payload.getUnsignedByte(); + + this.shot = payload.getUnsignedByte(); + + this.command_id = payload.getUnsignedByte(); + + this.extra_param = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_digicam_control() { + msgid = MAVLINK_MSG_ID_DIGICAM_CONTROL; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_digicam_control(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_DIGICAM_CONTROL; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_DIGICAM_CONTROL - sysid:" + sysid + " compid:" + compid + " extra_value:" + extra_value + " target_system:" + target_system + " target_component:" + target_component + " session:" + session + " zoom_pos:" + zoom_pos + " zoom_step:" + zoom_step + " focus_lock:" + focus_lock + " shot:" + shot + " command_id:" + command_id + " extra_param:" + extra_param + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_ekf_status_report.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_ekf_status_report.java new file mode 100644 index 0000000..35285b0 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_ekf_status_report.java @@ -0,0 +1,129 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE EKF_STATUS_REPORT PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * EKF Status message including flags and variances + */ +public class msg_ekf_status_report extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_EKF_STATUS_REPORT = 193; + public static final int MAVLINK_MSG_LENGTH = 22; + private static final long serialVersionUID = MAVLINK_MSG_ID_EKF_STATUS_REPORT; + + + /** + * Velocity variance + */ + public float velocity_variance; + + /** + * Horizontal Position variance + */ + public float pos_horiz_variance; + + /** + * Vertical Position variance + */ + public float pos_vert_variance; + + /** + * Compass variance + */ + public float compass_variance; + + /** + * Terrain Altitude variance + */ + public float terrain_alt_variance; + + /** + * Flags + */ + public int flags; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_EKF_STATUS_REPORT; + + packet.payload.putFloat(velocity_variance); + + packet.payload.putFloat(pos_horiz_variance); + + packet.payload.putFloat(pos_vert_variance); + + packet.payload.putFloat(compass_variance); + + packet.payload.putFloat(terrain_alt_variance); + + packet.payload.putUnsignedShort(flags); + + return packet; + } + + /** + * Decode a ekf_status_report message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.velocity_variance = payload.getFloat(); + + this.pos_horiz_variance = payload.getFloat(); + + this.pos_vert_variance = payload.getFloat(); + + this.compass_variance = payload.getFloat(); + + this.terrain_alt_variance = payload.getFloat(); + + this.flags = payload.getUnsignedShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_ekf_status_report() { + msgid = MAVLINK_MSG_ID_EKF_STATUS_REPORT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_ekf_status_report(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_EKF_STATUS_REPORT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_EKF_STATUS_REPORT - sysid:" + sysid + " compid:" + compid + " velocity_variance:" + velocity_variance + " pos_horiz_variance:" + pos_horiz_variance + " pos_vert_variance:" + pos_vert_variance + " compass_variance:" + compass_variance + " terrain_alt_variance:" + terrain_alt_variance + " flags:" + flags + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_fence_fetch_point.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_fence_fetch_point.java new file mode 100644 index 0000000..0fbca42 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_fence_fetch_point.java @@ -0,0 +1,102 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE FENCE_FETCH_POINT PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Request a current fence point from MAV + */ +public class msg_fence_fetch_point extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_FENCE_FETCH_POINT = 161; + public static final int MAVLINK_MSG_LENGTH = 3; + private static final long serialVersionUID = MAVLINK_MSG_ID_FENCE_FETCH_POINT; + + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * point index (first point is 1, 0 is for return point) + */ + public short idx; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_FENCE_FETCH_POINT; + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(idx); + + return packet; + } + + /** + * Decode a fence_fetch_point message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.idx = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_fence_fetch_point() { + msgid = MAVLINK_MSG_ID_FENCE_FETCH_POINT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_fence_fetch_point(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_FENCE_FETCH_POINT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_FENCE_FETCH_POINT - sysid:" + sysid + " compid:" + compid + " target_system:" + target_system + " target_component:" + target_component + " idx:" + idx + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_fence_point.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_fence_point.java new file mode 100644 index 0000000..0f3d67b --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_fence_point.java @@ -0,0 +1,129 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE FENCE_POINT PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * A fence point. Used to set a point when from GCS -> MAV. Also used to return a point from MAV -> GCS + */ +public class msg_fence_point extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_FENCE_POINT = 160; + public static final int MAVLINK_MSG_LENGTH = 12; + private static final long serialVersionUID = MAVLINK_MSG_ID_FENCE_POINT; + + + /** + * Latitude of point + */ + public float lat; + + /** + * Longitude of point + */ + public float lng; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * point index (first point is 1, 0 is for return point) + */ + public short idx; + + /** + * total number of points (for sanity checking) + */ + public short count; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_FENCE_POINT; + + packet.payload.putFloat(lat); + + packet.payload.putFloat(lng); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(idx); + + packet.payload.putUnsignedByte(count); + + return packet; + } + + /** + * Decode a fence_point message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.lat = payload.getFloat(); + + this.lng = payload.getFloat(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.idx = payload.getUnsignedByte(); + + this.count = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_fence_point() { + msgid = MAVLINK_MSG_ID_FENCE_POINT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_fence_point(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_FENCE_POINT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_FENCE_POINT - sysid:" + sysid + " compid:" + compid + " lat:" + lat + " lng:" + lng + " target_system:" + target_system + " target_component:" + target_component + " idx:" + idx + " count:" + count + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_fence_status.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_fence_status.java new file mode 100644 index 0000000..6cdeed0 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_fence_status.java @@ -0,0 +1,111 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE FENCE_STATUS PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Status of geo-fencing. Sent in extended status stream when fencing enabled + */ +public class msg_fence_status extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_FENCE_STATUS = 162; + public static final int MAVLINK_MSG_LENGTH = 8; + private static final long serialVersionUID = MAVLINK_MSG_ID_FENCE_STATUS; + + + /** + * time of last breach in milliseconds since boot + */ + public long breach_time; + + /** + * number of fence breaches + */ + public int breach_count; + + /** + * 0 if currently inside fence, 1 if outside + */ + public short breach_status; + + /** + * last breach type (see FENCE_BREACH_* enum) + */ + public short breach_type; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_FENCE_STATUS; + + packet.payload.putUnsignedInt(breach_time); + + packet.payload.putUnsignedShort(breach_count); + + packet.payload.putUnsignedByte(breach_status); + + packet.payload.putUnsignedByte(breach_type); + + return packet; + } + + /** + * Decode a fence_status message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.breach_time = payload.getUnsignedInt(); + + this.breach_count = payload.getUnsignedShort(); + + this.breach_status = payload.getUnsignedByte(); + + this.breach_type = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_fence_status() { + msgid = MAVLINK_MSG_ID_FENCE_STATUS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_fence_status(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_FENCE_STATUS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_FENCE_STATUS - sysid:" + sysid + " compid:" + compid + " breach_time:" + breach_time + " breach_count:" + breach_count + " breach_status:" + breach_status + " breach_type:" + breach_type + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_gimbal_control.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_gimbal_control.java new file mode 100644 index 0000000..82fc68a --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_gimbal_control.java @@ -0,0 +1,120 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE GIMBAL_CONTROL PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Control message for rate gimbal + */ +public class msg_gimbal_control extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_GIMBAL_CONTROL = 201; + public static final int MAVLINK_MSG_LENGTH = 14; + private static final long serialVersionUID = MAVLINK_MSG_ID_GIMBAL_CONTROL; + + + /** + * Demanded angular rate X (rad/s) + */ + public float demanded_rate_x; + + /** + * Demanded angular rate Y (rad/s) + */ + public float demanded_rate_y; + + /** + * Demanded angular rate Z (rad/s) + */ + public float demanded_rate_z; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_GIMBAL_CONTROL; + + packet.payload.putFloat(demanded_rate_x); + + packet.payload.putFloat(demanded_rate_y); + + packet.payload.putFloat(demanded_rate_z); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + return packet; + } + + /** + * Decode a gimbal_control message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.demanded_rate_x = payload.getFloat(); + + this.demanded_rate_y = payload.getFloat(); + + this.demanded_rate_z = payload.getFloat(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_gimbal_control() { + msgid = MAVLINK_MSG_ID_GIMBAL_CONTROL; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_gimbal_control(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_GIMBAL_CONTROL; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_GIMBAL_CONTROL - sysid:" + sysid + " compid:" + compid + " demanded_rate_x:" + demanded_rate_x + " demanded_rate_y:" + demanded_rate_y + " demanded_rate_z:" + demanded_rate_z + " target_system:" + target_system + " target_component:" + target_component + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_gimbal_report.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_gimbal_report.java new file mode 100644 index 0000000..0f8d4f0 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_gimbal_report.java @@ -0,0 +1,183 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE GIMBAL_REPORT PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * 3 axis gimbal mesuraments + */ +public class msg_gimbal_report extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_GIMBAL_REPORT = 200; + public static final int MAVLINK_MSG_LENGTH = 42; + private static final long serialVersionUID = MAVLINK_MSG_ID_GIMBAL_REPORT; + + + /** + * Time since last update (seconds) + */ + public float delta_time; + + /** + * Delta angle X (radians) + */ + public float delta_angle_x; + + /** + * Delta angle Y (radians) + */ + public float delta_angle_y; + + /** + * Delta angle X (radians) + */ + public float delta_angle_z; + + /** + * Delta velocity X (m/s) + */ + public float delta_velocity_x; + + /** + * Delta velocity Y (m/s) + */ + public float delta_velocity_y; + + /** + * Delta velocity Z (m/s) + */ + public float delta_velocity_z; + + /** + * Joint ROLL (radians) + */ + public float joint_roll; + + /** + * Joint EL (radians) + */ + public float joint_el; + + /** + * Joint AZ (radians) + */ + public float joint_az; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_GIMBAL_REPORT; + + packet.payload.putFloat(delta_time); + + packet.payload.putFloat(delta_angle_x); + + packet.payload.putFloat(delta_angle_y); + + packet.payload.putFloat(delta_angle_z); + + packet.payload.putFloat(delta_velocity_x); + + packet.payload.putFloat(delta_velocity_y); + + packet.payload.putFloat(delta_velocity_z); + + packet.payload.putFloat(joint_roll); + + packet.payload.putFloat(joint_el); + + packet.payload.putFloat(joint_az); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + return packet; + } + + /** + * Decode a gimbal_report message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.delta_time = payload.getFloat(); + + this.delta_angle_x = payload.getFloat(); + + this.delta_angle_y = payload.getFloat(); + + this.delta_angle_z = payload.getFloat(); + + this.delta_velocity_x = payload.getFloat(); + + this.delta_velocity_y = payload.getFloat(); + + this.delta_velocity_z = payload.getFloat(); + + this.joint_roll = payload.getFloat(); + + this.joint_el = payload.getFloat(); + + this.joint_az = payload.getFloat(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_gimbal_report() { + msgid = MAVLINK_MSG_ID_GIMBAL_REPORT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_gimbal_report(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_GIMBAL_REPORT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_GIMBAL_REPORT - sysid:" + sysid + " compid:" + compid + " delta_time:" + delta_time + " delta_angle_x:" + delta_angle_x + " delta_angle_y:" + delta_angle_y + " delta_angle_z:" + delta_angle_z + " delta_velocity_x:" + delta_velocity_x + " delta_velocity_y:" + delta_velocity_y + " delta_velocity_z:" + delta_velocity_z + " joint_roll:" + joint_roll + " joint_el:" + joint_el + " joint_az:" + joint_az + " target_system:" + target_system + " target_component:" + target_component + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_gimbal_torque_cmd_report.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_gimbal_torque_cmd_report.java new file mode 100644 index 0000000..1db96c4 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_gimbal_torque_cmd_report.java @@ -0,0 +1,120 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE GIMBAL_TORQUE_CMD_REPORT PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * 100 Hz gimbal torque command telemetry + */ +public class msg_gimbal_torque_cmd_report extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT = 214; + public static final int MAVLINK_MSG_LENGTH = 8; + private static final long serialVersionUID = MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT; + + + /** + * Roll Torque Command + */ + public short rl_torque_cmd; + + /** + * Elevation Torque Command + */ + public short el_torque_cmd; + + /** + * Azimuth Torque Command + */ + public short az_torque_cmd; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT; + + packet.payload.putShort(rl_torque_cmd); + + packet.payload.putShort(el_torque_cmd); + + packet.payload.putShort(az_torque_cmd); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + return packet; + } + + /** + * Decode a gimbal_torque_cmd_report message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.rl_torque_cmd = payload.getShort(); + + this.el_torque_cmd = payload.getShort(); + + this.az_torque_cmd = payload.getShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_gimbal_torque_cmd_report() { + msgid = MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_gimbal_torque_cmd_report(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT - sysid:" + sysid + " compid:" + compid + " rl_torque_cmd:" + rl_torque_cmd + " el_torque_cmd:" + el_torque_cmd + " az_torque_cmd:" + az_torque_cmd + " target_system:" + target_system + " target_component:" + target_component + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_gopro_get_request.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_gopro_get_request.java new file mode 100644 index 0000000..75b623d --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_gopro_get_request.java @@ -0,0 +1,102 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE GOPRO_GET_REQUEST PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Request a GOPRO_COMMAND response from the GoPro + */ +public class msg_gopro_get_request extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_GOPRO_GET_REQUEST = 216; + public static final int MAVLINK_MSG_LENGTH = 3; + private static final long serialVersionUID = MAVLINK_MSG_ID_GOPRO_GET_REQUEST; + + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * Command ID + */ + public short cmd_id; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_GOPRO_GET_REQUEST; + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(cmd_id); + + return packet; + } + + /** + * Decode a gopro_get_request message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.cmd_id = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_gopro_get_request() { + msgid = MAVLINK_MSG_ID_GOPRO_GET_REQUEST; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_gopro_get_request(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_GOPRO_GET_REQUEST; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_GOPRO_GET_REQUEST - sysid:" + sysid + " compid:" + compid + " target_system:" + target_system + " target_component:" + target_component + " cmd_id:" + cmd_id + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_gopro_get_response.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_gopro_get_response.java new file mode 100644 index 0000000..e28a2d6 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_gopro_get_response.java @@ -0,0 +1,110 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE GOPRO_GET_RESPONSE PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Response from a GOPRO_COMMAND get request + */ +public class msg_gopro_get_response extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_GOPRO_GET_RESPONSE = 217; + public static final int MAVLINK_MSG_LENGTH = 6; + private static final long serialVersionUID = MAVLINK_MSG_ID_GOPRO_GET_RESPONSE; + + + /** + * Command ID + */ + public short cmd_id; + + /** + * Status + */ + public short status; + + /** + * Value + */ + public short value[] = new short[4]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_GOPRO_GET_RESPONSE; + + packet.payload.putUnsignedByte(cmd_id); + + packet.payload.putUnsignedByte(status); + + + for (int i = 0; i < value.length; i++) { + packet.payload.putUnsignedByte(value[i]); + } + + + return packet; + } + + /** + * Decode a gopro_get_response message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.cmd_id = payload.getUnsignedByte(); + + this.status = payload.getUnsignedByte(); + + + for (int i = 0; i < this.value.length; i++) { + this.value[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_gopro_get_response() { + msgid = MAVLINK_MSG_ID_GOPRO_GET_RESPONSE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_gopro_get_response(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_GOPRO_GET_RESPONSE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_GOPRO_GET_RESPONSE - sysid:" + sysid + " compid:" + compid + " cmd_id:" + cmd_id + " status:" + status + " value:" + value + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_gopro_heartbeat.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_gopro_heartbeat.java new file mode 100644 index 0000000..70a0abb --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_gopro_heartbeat.java @@ -0,0 +1,102 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE GOPRO_HEARTBEAT PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Heartbeat from a HeroBus attached GoPro + */ +public class msg_gopro_heartbeat extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_GOPRO_HEARTBEAT = 215; + public static final int MAVLINK_MSG_LENGTH = 3; + private static final long serialVersionUID = MAVLINK_MSG_ID_GOPRO_HEARTBEAT; + + + /** + * Status + */ + public short status; + + /** + * Current capture mode + */ + public short capture_mode; + + /** + * additional status bits + */ + public short flags; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_GOPRO_HEARTBEAT; + + packet.payload.putUnsignedByte(status); + + packet.payload.putUnsignedByte(capture_mode); + + packet.payload.putUnsignedByte(flags); + + return packet; + } + + /** + * Decode a gopro_heartbeat message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.status = payload.getUnsignedByte(); + + this.capture_mode = payload.getUnsignedByte(); + + this.flags = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_gopro_heartbeat() { + msgid = MAVLINK_MSG_ID_GOPRO_HEARTBEAT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_gopro_heartbeat(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_GOPRO_HEARTBEAT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_GOPRO_HEARTBEAT - sysid:" + sysid + " compid:" + compid + " status:" + status + " capture_mode:" + capture_mode + " flags:" + flags + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_gopro_set_request.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_gopro_set_request.java new file mode 100644 index 0000000..4fd43d4 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_gopro_set_request.java @@ -0,0 +1,119 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE GOPRO_SET_REQUEST PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Request to set a GOPRO_COMMAND with a desired + */ +public class msg_gopro_set_request extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_GOPRO_SET_REQUEST = 218; + public static final int MAVLINK_MSG_LENGTH = 7; + private static final long serialVersionUID = MAVLINK_MSG_ID_GOPRO_SET_REQUEST; + + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * Command ID + */ + public short cmd_id; + + /** + * Value + */ + public short value[] = new short[4]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_GOPRO_SET_REQUEST; + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(cmd_id); + + + for (int i = 0; i < value.length; i++) { + packet.payload.putUnsignedByte(value[i]); + } + + + return packet; + } + + /** + * Decode a gopro_set_request message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.cmd_id = payload.getUnsignedByte(); + + + for (int i = 0; i < this.value.length; i++) { + this.value[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_gopro_set_request() { + msgid = MAVLINK_MSG_ID_GOPRO_SET_REQUEST; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_gopro_set_request(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_GOPRO_SET_REQUEST; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_GOPRO_SET_REQUEST - sysid:" + sysid + " compid:" + compid + " target_system:" + target_system + " target_component:" + target_component + " cmd_id:" + cmd_id + " value:" + value + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_gopro_set_response.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_gopro_set_response.java new file mode 100644 index 0000000..0c67820 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_gopro_set_response.java @@ -0,0 +1,93 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE GOPRO_SET_RESPONSE PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Response from a GOPRO_COMMAND set request + */ +public class msg_gopro_set_response extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_GOPRO_SET_RESPONSE = 219; + public static final int MAVLINK_MSG_LENGTH = 2; + private static final long serialVersionUID = MAVLINK_MSG_ID_GOPRO_SET_RESPONSE; + + + /** + * Command ID + */ + public short cmd_id; + + /** + * Status + */ + public short status; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_GOPRO_SET_RESPONSE; + + packet.payload.putUnsignedByte(cmd_id); + + packet.payload.putUnsignedByte(status); + + return packet; + } + + /** + * Decode a gopro_set_response message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.cmd_id = payload.getUnsignedByte(); + + this.status = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_gopro_set_response() { + msgid = MAVLINK_MSG_ID_GOPRO_SET_RESPONSE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_gopro_set_response(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_GOPRO_SET_RESPONSE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_GOPRO_SET_RESPONSE - sysid:" + sysid + " compid:" + compid + " cmd_id:" + cmd_id + " status:" + status + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_hwstatus.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_hwstatus.java new file mode 100644 index 0000000..8a2a28f --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_hwstatus.java @@ -0,0 +1,93 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE HWSTATUS PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Status of key hardware + */ +public class msg_hwstatus extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_HWSTATUS = 165; + public static final int MAVLINK_MSG_LENGTH = 3; + private static final long serialVersionUID = MAVLINK_MSG_ID_HWSTATUS; + + + /** + * board voltage (mV) + */ + public int Vcc; + + /** + * I2C error count + */ + public short I2Cerr; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_HWSTATUS; + + packet.payload.putUnsignedShort(Vcc); + + packet.payload.putUnsignedByte(I2Cerr); + + return packet; + } + + /** + * Decode a hwstatus message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.Vcc = payload.getUnsignedShort(); + + this.I2Cerr = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_hwstatus() { + msgid = MAVLINK_MSG_ID_HWSTATUS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_hwstatus(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_HWSTATUS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_HWSTATUS - sysid:" + sysid + " compid:" + compid + " Vcc:" + Vcc + " I2Cerr:" + I2Cerr + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_led_control.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_led_control.java new file mode 100644 index 0000000..fcf4aa4 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_led_control.java @@ -0,0 +1,137 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE LED_CONTROL PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Control vehicle LEDs + */ +public class msg_led_control extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_LED_CONTROL = 186; + public static final int MAVLINK_MSG_LENGTH = 29; + private static final long serialVersionUID = MAVLINK_MSG_ID_LED_CONTROL; + + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * Instance (LED instance to control or 255 for all LEDs) + */ + public short instance; + + /** + * Pattern (see LED_PATTERN_ENUM) + */ + public short pattern; + + /** + * Custom Byte Length + */ + public short custom_len; + + /** + * Custom Bytes + */ + public short custom_bytes[] = new short[24]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_LED_CONTROL; + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(instance); + + packet.payload.putUnsignedByte(pattern); + + packet.payload.putUnsignedByte(custom_len); + + + for (int i = 0; i < custom_bytes.length; i++) { + packet.payload.putUnsignedByte(custom_bytes[i]); + } + + + return packet; + } + + /** + * Decode a led_control message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.instance = payload.getUnsignedByte(); + + this.pattern = payload.getUnsignedByte(); + + this.custom_len = payload.getUnsignedByte(); + + + for (int i = 0; i < this.custom_bytes.length; i++) { + this.custom_bytes[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_led_control() { + msgid = MAVLINK_MSG_ID_LED_CONTROL; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_led_control(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_LED_CONTROL; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_LED_CONTROL - sysid:" + sysid + " compid:" + compid + " target_system:" + target_system + " target_component:" + target_component + " instance:" + instance + " pattern:" + pattern + " custom_len:" + custom_len + " custom_bytes:" + custom_bytes + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_limits_status.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_limits_status.java new file mode 100644 index 0000000..ef8dade --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_limits_status.java @@ -0,0 +1,156 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE LIMITS_STATUS PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Status of AP_Limits. Sent in extended status stream when AP_Limits is enabled + */ +public class msg_limits_status extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_LIMITS_STATUS = 167; + public static final int MAVLINK_MSG_LENGTH = 22; + private static final long serialVersionUID = MAVLINK_MSG_ID_LIMITS_STATUS; + + + /** + * time of last breach in milliseconds since boot + */ + public long last_trigger; + + /** + * time of last recovery action in milliseconds since boot + */ + public long last_action; + + /** + * time of last successful recovery in milliseconds since boot + */ + public long last_recovery; + + /** + * time of last all-clear in milliseconds since boot + */ + public long last_clear; + + /** + * number of fence breaches + */ + public int breach_count; + + /** + * state of AP_Limits, (see enum LimitState, LIMITS_STATE) + */ + public short limits_state; + + /** + * AP_Limit_Module bitfield of enabled modules, (see enum moduleid or LIMIT_MODULE) + */ + public short mods_enabled; + + /** + * AP_Limit_Module bitfield of required modules, (see enum moduleid or LIMIT_MODULE) + */ + public short mods_required; + + /** + * AP_Limit_Module bitfield of triggered modules, (see enum moduleid or LIMIT_MODULE) + */ + public short mods_triggered; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_LIMITS_STATUS; + + packet.payload.putUnsignedInt(last_trigger); + + packet.payload.putUnsignedInt(last_action); + + packet.payload.putUnsignedInt(last_recovery); + + packet.payload.putUnsignedInt(last_clear); + + packet.payload.putUnsignedShort(breach_count); + + packet.payload.putUnsignedByte(limits_state); + + packet.payload.putUnsignedByte(mods_enabled); + + packet.payload.putUnsignedByte(mods_required); + + packet.payload.putUnsignedByte(mods_triggered); + + return packet; + } + + /** + * Decode a limits_status message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.last_trigger = payload.getUnsignedInt(); + + this.last_action = payload.getUnsignedInt(); + + this.last_recovery = payload.getUnsignedInt(); + + this.last_clear = payload.getUnsignedInt(); + + this.breach_count = payload.getUnsignedShort(); + + this.limits_state = payload.getUnsignedByte(); + + this.mods_enabled = payload.getUnsignedByte(); + + this.mods_required = payload.getUnsignedByte(); + + this.mods_triggered = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_limits_status() { + msgid = MAVLINK_MSG_ID_LIMITS_STATUS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_limits_status(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_LIMITS_STATUS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_LIMITS_STATUS - sysid:" + sysid + " compid:" + compid + " last_trigger:" + last_trigger + " last_action:" + last_action + " last_recovery:" + last_recovery + " last_clear:" + last_clear + " breach_count:" + breach_count + " limits_state:" + limits_state + " mods_enabled:" + mods_enabled + " mods_required:" + mods_required + " mods_triggered:" + mods_triggered + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_mag_cal_progress.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_mag_cal_progress.java new file mode 100644 index 0000000..3adfe09 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_mag_cal_progress.java @@ -0,0 +1,164 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MAG_CAL_PROGRESS PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Reports progress of compass calibration. + */ +public class msg_mag_cal_progress extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MAG_CAL_PROGRESS = 191; + public static final int MAVLINK_MSG_LENGTH = 27; + private static final long serialVersionUID = MAVLINK_MSG_ID_MAG_CAL_PROGRESS; + + + /** + * Body frame direction vector for display + */ + public float direction_x; + + /** + * Body frame direction vector for display + */ + public float direction_y; + + /** + * Body frame direction vector for display + */ + public float direction_z; + + /** + * Compass being calibrated + */ + public short compass_id; + + /** + * Bitmask of compasses being calibrated + */ + public short cal_mask; + + /** + * Status (see MAG_CAL_STATUS enum) + */ + public short cal_status; + + /** + * Attempt number + */ + public short attempt; + + /** + * Completion percentage + */ + public short completion_pct; + + /** + * Bitmask of sphere sections (see http://en.wikipedia.org/wiki/Geodesic_grid) + */ + public short completion_mask[] = new short[10]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MAG_CAL_PROGRESS; + + packet.payload.putFloat(direction_x); + + packet.payload.putFloat(direction_y); + + packet.payload.putFloat(direction_z); + + packet.payload.putUnsignedByte(compass_id); + + packet.payload.putUnsignedByte(cal_mask); + + packet.payload.putUnsignedByte(cal_status); + + packet.payload.putUnsignedByte(attempt); + + packet.payload.putUnsignedByte(completion_pct); + + + for (int i = 0; i < completion_mask.length; i++) { + packet.payload.putUnsignedByte(completion_mask[i]); + } + + + return packet; + } + + /** + * Decode a mag_cal_progress message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.direction_x = payload.getFloat(); + + this.direction_y = payload.getFloat(); + + this.direction_z = payload.getFloat(); + + this.compass_id = payload.getUnsignedByte(); + + this.cal_mask = payload.getUnsignedByte(); + + this.cal_status = payload.getUnsignedByte(); + + this.attempt = payload.getUnsignedByte(); + + this.completion_pct = payload.getUnsignedByte(); + + + for (int i = 0; i < this.completion_mask.length; i++) { + this.completion_mask[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_mag_cal_progress() { + msgid = MAVLINK_MSG_ID_MAG_CAL_PROGRESS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_mag_cal_progress(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MAG_CAL_PROGRESS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MAG_CAL_PROGRESS - sysid:" + sysid + " compid:" + compid + " direction_x:" + direction_x + " direction_y:" + direction_y + " direction_z:" + direction_z + " compass_id:" + compass_id + " cal_mask:" + cal_mask + " cal_status:" + cal_status + " attempt:" + attempt + " completion_pct:" + completion_pct + " completion_mask:" + completion_mask + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_mag_cal_report.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_mag_cal_report.java new file mode 100644 index 0000000..7127334 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_mag_cal_report.java @@ -0,0 +1,201 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MAG_CAL_REPORT PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Reports results of completed compass calibration. Sent until MAG_CAL_ACK received. + */ +public class msg_mag_cal_report extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MAG_CAL_REPORT = 192; + public static final int MAVLINK_MSG_LENGTH = 44; + private static final long serialVersionUID = MAVLINK_MSG_ID_MAG_CAL_REPORT; + + + /** + * RMS milligauss residuals + */ + public float fitness; + + /** + * X offset + */ + public float ofs_x; + + /** + * Y offset + */ + public float ofs_y; + + /** + * Z offset + */ + public float ofs_z; + + /** + * X diagonal (matrix 11) + */ + public float diag_x; + + /** + * Y diagonal (matrix 22) + */ + public float diag_y; + + /** + * Z diagonal (matrix 33) + */ + public float diag_z; + + /** + * X off-diagonal (matrix 12 and 21) + */ + public float offdiag_x; + + /** + * Y off-diagonal (matrix 13 and 31) + */ + public float offdiag_y; + + /** + * Z off-diagonal (matrix 32 and 23) + */ + public float offdiag_z; + + /** + * Compass being calibrated + */ + public short compass_id; + + /** + * Bitmask of compasses being calibrated + */ + public short cal_mask; + + /** + * Status (see MAG_CAL_STATUS enum) + */ + public short cal_status; + + /** + * 0=requires a MAV_CMD_DO_ACCEPT_MAG_CAL, 1=saved to parameters + */ + public short autosaved; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MAG_CAL_REPORT; + + packet.payload.putFloat(fitness); + + packet.payload.putFloat(ofs_x); + + packet.payload.putFloat(ofs_y); + + packet.payload.putFloat(ofs_z); + + packet.payload.putFloat(diag_x); + + packet.payload.putFloat(diag_y); + + packet.payload.putFloat(diag_z); + + packet.payload.putFloat(offdiag_x); + + packet.payload.putFloat(offdiag_y); + + packet.payload.putFloat(offdiag_z); + + packet.payload.putUnsignedByte(compass_id); + + packet.payload.putUnsignedByte(cal_mask); + + packet.payload.putUnsignedByte(cal_status); + + packet.payload.putUnsignedByte(autosaved); + + return packet; + } + + /** + * Decode a mag_cal_report message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.fitness = payload.getFloat(); + + this.ofs_x = payload.getFloat(); + + this.ofs_y = payload.getFloat(); + + this.ofs_z = payload.getFloat(); + + this.diag_x = payload.getFloat(); + + this.diag_y = payload.getFloat(); + + this.diag_z = payload.getFloat(); + + this.offdiag_x = payload.getFloat(); + + this.offdiag_y = payload.getFloat(); + + this.offdiag_z = payload.getFloat(); + + this.compass_id = payload.getUnsignedByte(); + + this.cal_mask = payload.getUnsignedByte(); + + this.cal_status = payload.getUnsignedByte(); + + this.autosaved = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_mag_cal_report() { + msgid = MAVLINK_MSG_ID_MAG_CAL_REPORT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_mag_cal_report(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MAG_CAL_REPORT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MAG_CAL_REPORT - sysid:" + sysid + " compid:" + compid + " fitness:" + fitness + " ofs_x:" + ofs_x + " ofs_y:" + ofs_y + " ofs_z:" + ofs_z + " diag_x:" + diag_x + " diag_y:" + diag_y + " diag_z:" + diag_z + " offdiag_x:" + offdiag_x + " offdiag_y:" + offdiag_y + " offdiag_z:" + offdiag_z + " compass_id:" + compass_id + " cal_mask:" + cal_mask + " cal_status:" + cal_status + " autosaved:" + autosaved + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_meminfo.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_meminfo.java new file mode 100644 index 0000000..b588780 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_meminfo.java @@ -0,0 +1,102 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MEMINFO PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * state of APM memory + */ +public class msg_meminfo extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MEMINFO = 152; + public static final int MAVLINK_MSG_LENGTH = 8; + private static final long serialVersionUID = MAVLINK_MSG_ID_MEMINFO; + + + /** + * heap top + */ + public int brkval; + + /** + * free memory + */ + public int freemem; + + /** + * free memory (32 bit) + */ + public long freemem32; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MEMINFO; + + packet.payload.putUnsignedShort(brkval); + + packet.payload.putUnsignedShort(freemem); + + packet.payload.putUnsignedInt(freemem32); + + return packet; + } + + /** + * Decode a meminfo message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.brkval = payload.getUnsignedShort(); + + this.freemem = payload.getUnsignedShort(); + + this.freemem32 = payload.getUnsignedInt(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_meminfo() { + msgid = MAVLINK_MSG_ID_MEMINFO; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_meminfo(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MEMINFO; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MEMINFO - sysid:" + sysid + " compid:" + compid + " brkval:" + brkval + " freemem:" + freemem + " freemem32:" + freemem32 + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_mount_configure.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_mount_configure.java new file mode 100644 index 0000000..4d28dc9 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_mount_configure.java @@ -0,0 +1,129 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MOUNT_CONFIGURE PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Message to configure a camera mount, directional antenna, etc. + */ +public class msg_mount_configure extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MOUNT_CONFIGURE = 156; + public static final int MAVLINK_MSG_LENGTH = 6; + private static final long serialVersionUID = MAVLINK_MSG_ID_MOUNT_CONFIGURE; + + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * mount operating mode (see MAV_MOUNT_MODE enum) + */ + public short mount_mode; + + /** + * (1 = yes, 0 = no) + */ + public short stab_roll; + + /** + * (1 = yes, 0 = no) + */ + public short stab_pitch; + + /** + * (1 = yes, 0 = no) + */ + public short stab_yaw; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MOUNT_CONFIGURE; + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(mount_mode); + + packet.payload.putUnsignedByte(stab_roll); + + packet.payload.putUnsignedByte(stab_pitch); + + packet.payload.putUnsignedByte(stab_yaw); + + return packet; + } + + /** + * Decode a mount_configure message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.mount_mode = payload.getUnsignedByte(); + + this.stab_roll = payload.getUnsignedByte(); + + this.stab_pitch = payload.getUnsignedByte(); + + this.stab_yaw = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_mount_configure() { + msgid = MAVLINK_MSG_ID_MOUNT_CONFIGURE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_mount_configure(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MOUNT_CONFIGURE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MOUNT_CONFIGURE - sysid:" + sysid + " compid:" + compid + " target_system:" + target_system + " target_component:" + target_component + " mount_mode:" + mount_mode + " stab_roll:" + stab_roll + " stab_pitch:" + stab_pitch + " stab_yaw:" + stab_yaw + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_mount_control.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_mount_control.java new file mode 100644 index 0000000..600f177 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_mount_control.java @@ -0,0 +1,129 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MOUNT_CONTROL PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Message to control a camera mount, directional antenna, etc. + */ +public class msg_mount_control extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MOUNT_CONTROL = 157; + public static final int MAVLINK_MSG_LENGTH = 15; + private static final long serialVersionUID = MAVLINK_MSG_ID_MOUNT_CONTROL; + + + /** + * pitch(deg*100) or lat, depending on mount mode + */ + public int input_a; + + /** + * roll(deg*100) or lon depending on mount mode + */ + public int input_b; + + /** + * yaw(deg*100) or alt (in cm) depending on mount mode + */ + public int input_c; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING) + */ + public short save_position; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MOUNT_CONTROL; + + packet.payload.putInt(input_a); + + packet.payload.putInt(input_b); + + packet.payload.putInt(input_c); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(save_position); + + return packet; + } + + /** + * Decode a mount_control message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.input_a = payload.getInt(); + + this.input_b = payload.getInt(); + + this.input_c = payload.getInt(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.save_position = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_mount_control() { + msgid = MAVLINK_MSG_ID_MOUNT_CONTROL; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_mount_control(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MOUNT_CONTROL; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MOUNT_CONTROL - sysid:" + sysid + " compid:" + compid + " input_a:" + input_a + " input_b:" + input_b + " input_c:" + input_c + " target_system:" + target_system + " target_component:" + target_component + " save_position:" + save_position + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_mount_status.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_mount_status.java new file mode 100644 index 0000000..6dfa3c0 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_mount_status.java @@ -0,0 +1,120 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MOUNT_STATUS PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Message with some status from APM to GCS about camera or antenna mount + */ +public class msg_mount_status extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MOUNT_STATUS = 158; + public static final int MAVLINK_MSG_LENGTH = 14; + private static final long serialVersionUID = MAVLINK_MSG_ID_MOUNT_STATUS; + + + /** + * pitch(deg*100) + */ + public int pointing_a; + + /** + * roll(deg*100) + */ + public int pointing_b; + + /** + * yaw(deg*100) + */ + public int pointing_c; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MOUNT_STATUS; + + packet.payload.putInt(pointing_a); + + packet.payload.putInt(pointing_b); + + packet.payload.putInt(pointing_c); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + return packet; + } + + /** + * Decode a mount_status message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.pointing_a = payload.getInt(); + + this.pointing_b = payload.getInt(); + + this.pointing_c = payload.getInt(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_mount_status() { + msgid = MAVLINK_MSG_ID_MOUNT_STATUS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_mount_status(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MOUNT_STATUS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MOUNT_STATUS - sysid:" + sysid + " compid:" + compid + " pointing_a:" + pointing_a + " pointing_b:" + pointing_b + " pointing_c:" + pointing_c + " target_system:" + target_system + " target_component:" + target_component + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_pid_tuning.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_pid_tuning.java new file mode 100644 index 0000000..6dede7f --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_pid_tuning.java @@ -0,0 +1,138 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE PID_TUNING PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * PID tuning information + */ +public class msg_pid_tuning extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_PID_TUNING = 194; + public static final int MAVLINK_MSG_LENGTH = 25; + private static final long serialVersionUID = MAVLINK_MSG_ID_PID_TUNING; + + + /** + * desired rate (degrees/s) + */ + public float desired; + + /** + * achieved rate (degrees/s) + */ + public float achieved; + + /** + * FF component + */ + public float FF; + + /** + * P component + */ + public float P; + + /** + * I component + */ + public float I; + + /** + * D component + */ + public float D; + + /** + * axis + */ + public short axis; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_PID_TUNING; + + packet.payload.putFloat(desired); + + packet.payload.putFloat(achieved); + + packet.payload.putFloat(FF); + + packet.payload.putFloat(P); + + packet.payload.putFloat(I); + + packet.payload.putFloat(D); + + packet.payload.putUnsignedByte(axis); + + return packet; + } + + /** + * Decode a pid_tuning message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.desired = payload.getFloat(); + + this.achieved = payload.getFloat(); + + this.FF = payload.getFloat(); + + this.P = payload.getFloat(); + + this.I = payload.getFloat(); + + this.D = payload.getFloat(); + + this.axis = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_pid_tuning() { + msgid = MAVLINK_MSG_ID_PID_TUNING; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_pid_tuning(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_PID_TUNING; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_PID_TUNING - sysid:" + sysid + " compid:" + compid + " desired:" + desired + " achieved:" + achieved + " FF:" + FF + " P:" + P + " I:" + I + " D:" + D + " axis:" + axis + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_radio.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_radio.java new file mode 100644 index 0000000..9011bee --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_radio.java @@ -0,0 +1,138 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE RADIO PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Status generated by radio + */ +public class msg_radio extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_RADIO = 166; + public static final int MAVLINK_MSG_LENGTH = 9; + private static final long serialVersionUID = MAVLINK_MSG_ID_RADIO; + + + /** + * receive errors + */ + public int rxerrors; + + /** + * count of error corrected packets + */ + public int fixed; + + /** + * local signal strength + */ + public short rssi; + + /** + * remote signal strength + */ + public short remrssi; + + /** + * how full the tx buffer is as a percentage + */ + public short txbuf; + + /** + * background noise level + */ + public short noise; + + /** + * remote background noise level + */ + public short remnoise; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_RADIO; + + packet.payload.putUnsignedShort(rxerrors); + + packet.payload.putUnsignedShort(fixed); + + packet.payload.putUnsignedByte(rssi); + + packet.payload.putUnsignedByte(remrssi); + + packet.payload.putUnsignedByte(txbuf); + + packet.payload.putUnsignedByte(noise); + + packet.payload.putUnsignedByte(remnoise); + + return packet; + } + + /** + * Decode a radio message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.rxerrors = payload.getUnsignedShort(); + + this.fixed = payload.getUnsignedShort(); + + this.rssi = payload.getUnsignedByte(); + + this.remrssi = payload.getUnsignedByte(); + + this.txbuf = payload.getUnsignedByte(); + + this.noise = payload.getUnsignedByte(); + + this.remnoise = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_radio() { + msgid = MAVLINK_MSG_ID_RADIO; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_radio(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_RADIO; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_RADIO - sysid:" + sysid + " compid:" + compid + " rxerrors:" + rxerrors + " fixed:" + fixed + " rssi:" + rssi + " remrssi:" + remrssi + " txbuf:" + txbuf + " noise:" + noise + " remnoise:" + remnoise + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_rally_fetch_point.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_rally_fetch_point.java new file mode 100644 index 0000000..275d20e --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_rally_fetch_point.java @@ -0,0 +1,102 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE RALLY_FETCH_POINT PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Request a current rally point from MAV. MAV should respond with a RALLY_POINT message. MAV should not respond if the request is invalid. + */ +public class msg_rally_fetch_point extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_RALLY_FETCH_POINT = 176; + public static final int MAVLINK_MSG_LENGTH = 3; + private static final long serialVersionUID = MAVLINK_MSG_ID_RALLY_FETCH_POINT; + + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * point index (first point is 0) + */ + public short idx; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_RALLY_FETCH_POINT; + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(idx); + + return packet; + } + + /** + * Decode a rally_fetch_point message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.idx = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_rally_fetch_point() { + msgid = MAVLINK_MSG_ID_RALLY_FETCH_POINT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_rally_fetch_point(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_RALLY_FETCH_POINT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_RALLY_FETCH_POINT - sysid:" + sysid + " compid:" + compid + " target_system:" + target_system + " target_component:" + target_component + " idx:" + idx + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_rally_point.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_rally_point.java new file mode 100644 index 0000000..6f1de46 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_rally_point.java @@ -0,0 +1,165 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE RALLY_POINT PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * A rally point. Used to set a point when from GCS -> MAV. Also used to return a point from MAV -> GCS + */ +public class msg_rally_point extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_RALLY_POINT = 175; + public static final int MAVLINK_MSG_LENGTH = 19; + private static final long serialVersionUID = MAVLINK_MSG_ID_RALLY_POINT; + + + /** + * Latitude of point in degrees * 1E7 + */ + public int lat; + + /** + * Longitude of point in degrees * 1E7 + */ + public int lng; + + /** + * Transit / loiter altitude in meters relative to home + */ + public short alt; + + /** + * Break altitude in meters relative to home + */ + public short break_alt; + + /** + * Heading to aim for when landing. In centi-degrees. + */ + public int land_dir; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * point index (first point is 0) + */ + public short idx; + + /** + * total number of points (for sanity checking) + */ + public short count; + + /** + * See RALLY_FLAGS enum for definition of the bitmask. + */ + public short flags; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_RALLY_POINT; + + packet.payload.putInt(lat); + + packet.payload.putInt(lng); + + packet.payload.putShort(alt); + + packet.payload.putShort(break_alt); + + packet.payload.putUnsignedShort(land_dir); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(idx); + + packet.payload.putUnsignedByte(count); + + packet.payload.putUnsignedByte(flags); + + return packet; + } + + /** + * Decode a rally_point message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.lat = payload.getInt(); + + this.lng = payload.getInt(); + + this.alt = payload.getShort(); + + this.break_alt = payload.getShort(); + + this.land_dir = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.idx = payload.getUnsignedByte(); + + this.count = payload.getUnsignedByte(); + + this.flags = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_rally_point() { + msgid = MAVLINK_MSG_ID_RALLY_POINT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_rally_point(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_RALLY_POINT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_RALLY_POINT - sysid:" + sysid + " compid:" + compid + " lat:" + lat + " lng:" + lng + " alt:" + alt + " break_alt:" + break_alt + " land_dir:" + land_dir + " target_system:" + target_system + " target_component:" + target_component + " idx:" + idx + " count:" + count + " flags:" + flags + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_rangefinder.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_rangefinder.java new file mode 100644 index 0000000..ab88b56 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_rangefinder.java @@ -0,0 +1,93 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE RANGEFINDER PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Rangefinder reporting + */ +public class msg_rangefinder extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_RANGEFINDER = 173; + public static final int MAVLINK_MSG_LENGTH = 8; + private static final long serialVersionUID = MAVLINK_MSG_ID_RANGEFINDER; + + + /** + * distance in meters + */ + public float distance; + + /** + * raw voltage if available, zero otherwise + */ + public float voltage; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_RANGEFINDER; + + packet.payload.putFloat(distance); + + packet.payload.putFloat(voltage); + + return packet; + } + + /** + * Decode a rangefinder message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.distance = payload.getFloat(); + + this.voltage = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_rangefinder() { + msgid = MAVLINK_MSG_ID_RANGEFINDER; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_rangefinder(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_RANGEFINDER; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_RANGEFINDER - sysid:" + sysid + " compid:" + compid + " distance:" + distance + " voltage:" + voltage + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_remote_log_block_status.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_remote_log_block_status.java new file mode 100644 index 0000000..b7fb1b7 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_remote_log_block_status.java @@ -0,0 +1,111 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE REMOTE_LOG_BLOCK_STATUS PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Send Status of each log block that autopilot board might have sent + */ +public class msg_remote_log_block_status extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS = 185; + public static final int MAVLINK_MSG_LENGTH = 7; + private static final long serialVersionUID = MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS; + + + /** + * log data block sequence number + */ + public long seqno; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * log data block status + */ + public short status; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS; + + packet.payload.putUnsignedInt(seqno); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(status); + + return packet; + } + + /** + * Decode a remote_log_block_status message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.seqno = payload.getUnsignedInt(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.status = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_remote_log_block_status() { + msgid = MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_remote_log_block_status(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_REMOTE_LOG_BLOCK_STATUS - sysid:" + sysid + " compid:" + compid + " seqno:" + seqno + " target_system:" + target_system + " target_component:" + target_component + " status:" + status + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_remote_log_data_block.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_remote_log_data_block.java new file mode 100644 index 0000000..5efa98c --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_remote_log_data_block.java @@ -0,0 +1,119 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE REMOTE_LOG_DATA_BLOCK PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Send a block of log data to remote location + */ +public class msg_remote_log_data_block extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK = 184; + public static final int MAVLINK_MSG_LENGTH = 206; + private static final long serialVersionUID = MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK; + + + /** + * log data block sequence number + */ + public long seqno; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * log data block + */ + public short data[] = new short[200]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK; + + packet.payload.putUnsignedInt(seqno); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + + for (int i = 0; i < data.length; i++) { + packet.payload.putUnsignedByte(data[i]); + } + + + return packet; + } + + /** + * Decode a remote_log_data_block message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.seqno = payload.getUnsignedInt(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + + for (int i = 0; i < this.data.length; i++) { + this.data[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_remote_log_data_block() { + msgid = MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_remote_log_data_block(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_REMOTE_LOG_DATA_BLOCK - sysid:" + sysid + " compid:" + compid + " seqno:" + seqno + " target_system:" + target_system + " target_component:" + target_component + " data:" + data + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_rpm.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_rpm.java new file mode 100644 index 0000000..791439c --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_rpm.java @@ -0,0 +1,93 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE RPM PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * RPM sensor output + */ +public class msg_rpm extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_RPM = 226; + public static final int MAVLINK_MSG_LENGTH = 8; + private static final long serialVersionUID = MAVLINK_MSG_ID_RPM; + + + /** + * RPM Sensor1 + */ + public float rpm1; + + /** + * RPM Sensor2 + */ + public float rpm2; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_RPM; + + packet.payload.putFloat(rpm1); + + packet.payload.putFloat(rpm2); + + return packet; + } + + /** + * Decode a rpm message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.rpm1 = payload.getFloat(); + + this.rpm2 = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_rpm() { + msgid = MAVLINK_MSG_ID_RPM; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_rpm(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_RPM; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_RPM - sysid:" + sysid + " compid:" + compid + " rpm1:" + rpm1 + " rpm2:" + rpm2 + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_sensor_offsets.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_sensor_offsets.java new file mode 100644 index 0000000..5fd5084 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_sensor_offsets.java @@ -0,0 +1,183 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SENSOR_OFFSETS PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Offsets and calibrations values for hardware sensors. This makes it easier to debug the calibration process. + */ +public class msg_sensor_offsets extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SENSOR_OFFSETS = 150; + public static final int MAVLINK_MSG_LENGTH = 42; + private static final long serialVersionUID = MAVLINK_MSG_ID_SENSOR_OFFSETS; + + + /** + * magnetic declination (radians) + */ + public float mag_declination; + + /** + * raw pressure from barometer + */ + public int raw_press; + + /** + * raw temperature from barometer + */ + public int raw_temp; + + /** + * gyro X calibration + */ + public float gyro_cal_x; + + /** + * gyro Y calibration + */ + public float gyro_cal_y; + + /** + * gyro Z calibration + */ + public float gyro_cal_z; + + /** + * accel X calibration + */ + public float accel_cal_x; + + /** + * accel Y calibration + */ + public float accel_cal_y; + + /** + * accel Z calibration + */ + public float accel_cal_z; + + /** + * magnetometer X offset + */ + public short mag_ofs_x; + + /** + * magnetometer Y offset + */ + public short mag_ofs_y; + + /** + * magnetometer Z offset + */ + public short mag_ofs_z; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SENSOR_OFFSETS; + + packet.payload.putFloat(mag_declination); + + packet.payload.putInt(raw_press); + + packet.payload.putInt(raw_temp); + + packet.payload.putFloat(gyro_cal_x); + + packet.payload.putFloat(gyro_cal_y); + + packet.payload.putFloat(gyro_cal_z); + + packet.payload.putFloat(accel_cal_x); + + packet.payload.putFloat(accel_cal_y); + + packet.payload.putFloat(accel_cal_z); + + packet.payload.putShort(mag_ofs_x); + + packet.payload.putShort(mag_ofs_y); + + packet.payload.putShort(mag_ofs_z); + + return packet; + } + + /** + * Decode a sensor_offsets message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.mag_declination = payload.getFloat(); + + this.raw_press = payload.getInt(); + + this.raw_temp = payload.getInt(); + + this.gyro_cal_x = payload.getFloat(); + + this.gyro_cal_y = payload.getFloat(); + + this.gyro_cal_z = payload.getFloat(); + + this.accel_cal_x = payload.getFloat(); + + this.accel_cal_y = payload.getFloat(); + + this.accel_cal_z = payload.getFloat(); + + this.mag_ofs_x = payload.getShort(); + + this.mag_ofs_y = payload.getShort(); + + this.mag_ofs_z = payload.getShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_sensor_offsets() { + msgid = MAVLINK_MSG_ID_SENSOR_OFFSETS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_sensor_offsets(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SENSOR_OFFSETS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SENSOR_OFFSETS - sysid:" + sysid + " compid:" + compid + " mag_declination:" + mag_declination + " raw_press:" + raw_press + " raw_temp:" + raw_temp + " gyro_cal_x:" + gyro_cal_x + " gyro_cal_y:" + gyro_cal_y + " gyro_cal_z:" + gyro_cal_z + " accel_cal_x:" + accel_cal_x + " accel_cal_y:" + accel_cal_y + " accel_cal_z:" + accel_cal_z + " mag_ofs_x:" + mag_ofs_x + " mag_ofs_y:" + mag_ofs_y + " mag_ofs_z:" + mag_ofs_z + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_set_mag_offsets.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_set_mag_offsets.java new file mode 100644 index 0000000..d250e9f --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_set_mag_offsets.java @@ -0,0 +1,120 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SET_MAG_OFFSETS PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Deprecated. Use MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS instead. Set the magnetometer offsets + */ +public class msg_set_mag_offsets extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SET_MAG_OFFSETS = 151; + public static final int MAVLINK_MSG_LENGTH = 8; + private static final long serialVersionUID = MAVLINK_MSG_ID_SET_MAG_OFFSETS; + + + /** + * magnetometer X offset + */ + public short mag_ofs_x; + + /** + * magnetometer Y offset + */ + public short mag_ofs_y; + + /** + * magnetometer Z offset + */ + public short mag_ofs_z; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SET_MAG_OFFSETS; + + packet.payload.putShort(mag_ofs_x); + + packet.payload.putShort(mag_ofs_y); + + packet.payload.putShort(mag_ofs_z); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + return packet; + } + + /** + * Decode a set_mag_offsets message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.mag_ofs_x = payload.getShort(); + + this.mag_ofs_y = payload.getShort(); + + this.mag_ofs_z = payload.getShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_set_mag_offsets() { + msgid = MAVLINK_MSG_ID_SET_MAG_OFFSETS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_set_mag_offsets(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SET_MAG_OFFSETS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SET_MAG_OFFSETS - sysid:" + sysid + " compid:" + compid + " mag_ofs_x:" + mag_ofs_x + " mag_ofs_y:" + mag_ofs_y + " mag_ofs_z:" + mag_ofs_z + " target_system:" + target_system + " target_component:" + target_component + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_simstate.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_simstate.java new file mode 100644 index 0000000..c33ee72 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_simstate.java @@ -0,0 +1,174 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SIMSTATE PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Status of simulation environment, if used + */ +public class msg_simstate extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SIMSTATE = 164; + public static final int MAVLINK_MSG_LENGTH = 44; + private static final long serialVersionUID = MAVLINK_MSG_ID_SIMSTATE; + + + /** + * Roll angle (rad) + */ + public float roll; + + /** + * Pitch angle (rad) + */ + public float pitch; + + /** + * Yaw angle (rad) + */ + public float yaw; + + /** + * X acceleration m/s/s + */ + public float xacc; + + /** + * Y acceleration m/s/s + */ + public float yacc; + + /** + * Z acceleration m/s/s + */ + public float zacc; + + /** + * Angular speed around X axis rad/s + */ + public float xgyro; + + /** + * Angular speed around Y axis rad/s + */ + public float ygyro; + + /** + * Angular speed around Z axis rad/s + */ + public float zgyro; + + /** + * Latitude in degrees * 1E7 + */ + public int lat; + + /** + * Longitude in degrees * 1E7 + */ + public int lng; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SIMSTATE; + + packet.payload.putFloat(roll); + + packet.payload.putFloat(pitch); + + packet.payload.putFloat(yaw); + + packet.payload.putFloat(xacc); + + packet.payload.putFloat(yacc); + + packet.payload.putFloat(zacc); + + packet.payload.putFloat(xgyro); + + packet.payload.putFloat(ygyro); + + packet.payload.putFloat(zgyro); + + packet.payload.putInt(lat); + + packet.payload.putInt(lng); + + return packet; + } + + /** + * Decode a simstate message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.roll = payload.getFloat(); + + this.pitch = payload.getFloat(); + + this.yaw = payload.getFloat(); + + this.xacc = payload.getFloat(); + + this.yacc = payload.getFloat(); + + this.zacc = payload.getFloat(); + + this.xgyro = payload.getFloat(); + + this.ygyro = payload.getFloat(); + + this.zgyro = payload.getFloat(); + + this.lat = payload.getInt(); + + this.lng = payload.getInt(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_simstate() { + msgid = MAVLINK_MSG_ID_SIMSTATE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_simstate(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SIMSTATE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SIMSTATE - sysid:" + sysid + " compid:" + compid + " roll:" + roll + " pitch:" + pitch + " yaw:" + yaw + " xacc:" + xacc + " yacc:" + yacc + " zacc:" + zacc + " xgyro:" + xgyro + " ygyro:" + ygyro + " zgyro:" + zgyro + " lat:" + lat + " lng:" + lng + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_vision_position_delta.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_vision_position_delta.java new file mode 100644 index 0000000..7b36574 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_vision_position_delta.java @@ -0,0 +1,134 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE VISION_POSITION_DELTA PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * camera vision based attitude and position deltas + */ +public class msg_vision_position_delta extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_VISION_POSITION_DELTA = 11011; + public static final int MAVLINK_MSG_LENGTH = 44; + private static final long serialVersionUID = MAVLINK_MSG_ID_VISION_POSITION_DELTA; + + + /** + * Timestamp (microseconds, synced to UNIX time or since system boot) + */ + public long time_usec; + + /** + * Time in microseconds since the last reported camera frame + */ + public long time_delta_usec; + + /** + * Defines a rotation vector in body frame that rotates the vehicle from the previous to the current orientation + */ + public float angle_delta[] = new float[3]; + + /** + * Change in position in meters from previous to current frame rotated into body frame (0=forward, 1=right, 2=down) + */ + public float position_delta[] = new float[3]; + + /** + * normalised confidence value from 0 to 100 + */ + public float confidence; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_VISION_POSITION_DELTA; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putUnsignedLong(time_delta_usec); + + + for (int i = 0; i < angle_delta.length; i++) { + packet.payload.putFloat(angle_delta[i]); + } + + + for (int i = 0; i < position_delta.length; i++) { + packet.payload.putFloat(position_delta[i]); + } + + + packet.payload.putFloat(confidence); + + return packet; + } + + /** + * Decode a vision_position_delta message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.time_delta_usec = payload.getUnsignedLong(); + + + for (int i = 0; i < this.angle_delta.length; i++) { + this.angle_delta[i] = payload.getFloat(); + } + + + for (int i = 0; i < this.position_delta.length; i++) { + this.position_delta[i] = payload.getFloat(); + } + + + this.confidence = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_vision_position_delta() { + msgid = MAVLINK_MSG_ID_VISION_POSITION_DELTA; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_vision_position_delta(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_VISION_POSITION_DELTA; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_VISION_POSITION_DELTA - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " time_delta_usec:" + time_delta_usec + " angle_delta:" + angle_delta + " position_delta:" + position_delta + " confidence:" + confidence + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/ardupilotmega/msg_wind.java b/app/src/main/java/com/MAVLink/ardupilotmega/msg_wind.java new file mode 100644 index 0000000..aca41a0 --- /dev/null +++ b/app/src/main/java/com/MAVLink/ardupilotmega/msg_wind.java @@ -0,0 +1,102 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE WIND PACKING +package com.MAVLink.ardupilotmega; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Wind estimation + */ +public class msg_wind extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_WIND = 168; + public static final int MAVLINK_MSG_LENGTH = 12; + private static final long serialVersionUID = MAVLINK_MSG_ID_WIND; + + + /** + * wind direction that wind is coming from (degrees) + */ + public float direction; + + /** + * wind speed in ground plane (m/s) + */ + public float speed; + + /** + * vertical wind speed (m/s) + */ + public float speed_z; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_WIND; + + packet.payload.putFloat(direction); + + packet.payload.putFloat(speed); + + packet.payload.putFloat(speed_z); + + return packet; + } + + /** + * Decode a wind message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.direction = payload.getFloat(); + + this.speed = payload.getFloat(); + + this.speed_z = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_wind() { + msgid = MAVLINK_MSG_ID_WIND; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_wind(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_WIND; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_WIND - sysid:" + sysid + " compid:" + compid + " direction:" + direction + " speed:" + speed + " speed_z:" + speed_z + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/CRC.java b/app/src/main/java/com/MAVLink/common/CRC.java new file mode 100644 index 0000000..12da77a --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/CRC.java @@ -0,0 +1,64 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.common; + +/** + * X.25 CRC calculation for MAVlink messages. The checksum must be initialized, + * updated with witch field of the message, and then finished with the message + * id. + */ +public class CRC { + private static final int[] MAVLINK_MESSAGE_CRCS = {50, 124, 137, 0, 237, 217, 104, 119, 0, 0, 0, 89, 0, 0, 0, 0, 0, 0, 0, 0, 214, 159, 220, 168, 24, 23, 170, 144, 67, 115, 39, 246, 185, 104, 237, 244, 222, 212, 9, 254, 230, 28, 28, 132, 221, 232, 11, 153, 41, 39, 78, 196, 0, 0, 15, 3, 0, 0, 0, 0, 0, 167, 183, 119, 191, 118, 148, 21, 0, 243, 124, 0, 0, 38, 20, 158, 152, 143, 0, 0, 0, 106, 49, 22, 143, 140, 5, 150, 0, 231, 183, 63, 54, 47, 0, 0, 0, 0, 0, 0, 175, 102, 158, 208, 56, 93, 138, 108, 32, 185, 84, 34, 174, 124, 237, 4, 76, 128, 56, 116, 134, 237, 203, 250, 87, 203, 220, 25, 226, 46, 29, 223, 85, 6, 229, 203, 1, 195, 109, 168, 181, 47, 72, 131, 127, 0, 103, 154, 178, 200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 163, 105, 151, 35, 150, 0, 0, 0, 0, 0, 0, 90, 104, 85, 95, 130, 184, 81, 8, 204, 49, 170, 44, 83, 46, 0}; + private static final int CRC_INIT_VALUE = 0xffff; + private int crcValue; + + /** + * Accumulate the X.25 CRC by adding one char at a time. + * <p> + * The checksum function adds the hash of one char at a time to the 16 bit + * checksum (uint16_t). + * + * @param data new char to hash + **/ + public void update_checksum(int data) { + data = data & 0xff; //cast because we want an unsigned type + int tmp = data ^ (crcValue & 0xff); + tmp ^= (tmp << 4) & 0xff; + crcValue = ((crcValue >> 8) & 0xff) ^ (tmp << 8) ^ (tmp << 3) ^ ((tmp >> 4) & 0xf); + } + + /** + * Finish the CRC calculation of a message, by running the CRC with the + * Magic Byte. This Magic byte has been defined in MAVlink v1.0. + * + * @param msgid The message id number + */ + public void finish_checksum(int msgid) { + update_checksum(MAVLINK_MESSAGE_CRCS[msgid]); + } + + /** + * Initialize the buffer for the X.25 CRC + */ + public void start_checksum() { + crcValue = CRC_INIT_VALUE; + } + + public int getMSB() { + return ((crcValue >> 8) & 0xff); + } + + public int getLSB() { + return (crcValue & 0xff); + } + + public CRC() { + start_checksum(); + } + +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_actuator_control_target.java b/app/src/main/java/com/MAVLink/common/msg_actuator_control_target.java new file mode 100644 index 0000000..0059612 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_actuator_control_target.java @@ -0,0 +1,110 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE ACTUATOR_CONTROL_TARGET PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Set the vehicle attitude and body angular rates. + */ +public class msg_actuator_control_target extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET = 140; + public static final int MAVLINK_MSG_LENGTH = 41; + private static final long serialVersionUID = MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET; + + + /** + * Timestamp (micros since boot or Unix epoch) + */ + public long time_usec; + + /** + * Actuator controls. Normed to -1..+1 where 0 is neutral position. Throttle for single rotation direction motors is 0..1, negative range for reverse direction. Standard mapping for attitude controls (group 0): (index 0-7): roll, pitch, yaw, throttle, flaps, spoilers, airbrakes, landing gear. Load a pass-through mixer to repurpose them as generic outputs. + */ + public float controls[] = new float[8]; + + /** + * Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances. + */ + public short group_mlx; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET; + + packet.payload.putUnsignedLong(time_usec); + + + for (int i = 0; i < controls.length; i++) { + packet.payload.putFloat(controls[i]); + } + + + packet.payload.putUnsignedByte(group_mlx); + + return packet; + } + + /** + * Decode a actuator_control_target message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + + for (int i = 0; i < this.controls.length; i++) { + this.controls[i] = payload.getFloat(); + } + + + this.group_mlx = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_actuator_control_target() { + msgid = MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_actuator_control_target(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " controls:" + controls + " group_mlx:" + group_mlx + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_adsb_vehicle.java b/app/src/main/java/com/MAVLink/common/msg_adsb_vehicle.java new file mode 100644 index 0000000..955b2ed --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_adsb_vehicle.java @@ -0,0 +1,229 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE ADSB_VEHICLE PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The location and information of an ADSB vehicle + */ +public class msg_adsb_vehicle extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_ADSB_VEHICLE = 246; + public static final int MAVLINK_MSG_LENGTH = 38; + private static final long serialVersionUID = MAVLINK_MSG_ID_ADSB_VEHICLE; + + + /** + * ICAO address + */ + public long ICAO_address; + + /** + * Latitude, expressed as degrees * 1E7 + */ + public int lat; + + /** + * Longitude, expressed as degrees * 1E7 + */ + public int lon; + + /** + * Altitude(ASL) in millimeters + */ + public int altitude; + + /** + * Course over ground in centidegrees + */ + public int heading; + + /** + * The horizontal velocity in centimeters/second + */ + public int hor_velocity; + + /** + * The vertical velocity in centimeters/second, positive is up + */ + public short ver_velocity; + + /** + * Flags to indicate various statuses including valid data fields + */ + public int flags; + + /** + * Squawk code + */ + public int squawk; + + /** + * Type from ADSB_ALTITUDE_TYPE enum + */ + public short altitude_type; + + /** + * The callsign, 8+null + */ + public byte callsign[] = new byte[9]; + + /** + * Type from ADSB_EMITTER_TYPE enum + */ + public short emitter_type; + + /** + * Time since last communication in seconds + */ + public short tslc; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_ADSB_VEHICLE; + + packet.payload.putUnsignedInt(ICAO_address); + + packet.payload.putInt(lat); + + packet.payload.putInt(lon); + + packet.payload.putInt(altitude); + + packet.payload.putUnsignedShort(heading); + + packet.payload.putUnsignedShort(hor_velocity); + + packet.payload.putShort(ver_velocity); + + packet.payload.putUnsignedShort(flags); + + packet.payload.putUnsignedShort(squawk); + + packet.payload.putUnsignedByte(altitude_type); + + + for (int i = 0; i < callsign.length; i++) { + packet.payload.putByte(callsign[i]); + } + + + packet.payload.putUnsignedByte(emitter_type); + + packet.payload.putUnsignedByte(tslc); + + return packet; + } + + /** + * Decode a adsb_vehicle message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.ICAO_address = payload.getUnsignedInt(); + + this.lat = payload.getInt(); + + this.lon = payload.getInt(); + + this.altitude = payload.getInt(); + + this.heading = payload.getUnsignedShort(); + + this.hor_velocity = payload.getUnsignedShort(); + + this.ver_velocity = payload.getShort(); + + this.flags = payload.getUnsignedShort(); + + this.squawk = payload.getUnsignedShort(); + + this.altitude_type = payload.getUnsignedByte(); + + + for (int i = 0; i < this.callsign.length; i++) { + this.callsign[i] = payload.getByte(); + } + + + this.emitter_type = payload.getUnsignedByte(); + + this.tslc = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_adsb_vehicle() { + msgid = MAVLINK_MSG_ID_ADSB_VEHICLE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_adsb_vehicle(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_ADSB_VEHICLE; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setCallsign(String str) { + int len = Math.min(str.length(), 9); + for (int i = 0; i < len; i++) { + callsign[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 9; i++) { // padding for the rest of the buffer + callsign[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getCallsign() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 9; i++) { + if (callsign[i] != 0) + buf.append((char) callsign[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_ADSB_VEHICLE - sysid:" + sysid + " compid:" + compid + " ICAO_address:" + ICAO_address + " lat:" + lat + " lon:" + lon + " altitude:" + altitude + " heading:" + heading + " hor_velocity:" + hor_velocity + " ver_velocity:" + ver_velocity + " flags:" + flags + " squawk:" + squawk + " altitude_type:" + altitude_type + " callsign:" + callsign + " emitter_type:" + emitter_type + " tslc:" + tslc + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_altitude.java b/app/src/main/java/com/MAVLink/common/msg_altitude.java new file mode 100644 index 0000000..154c1d5 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_altitude.java @@ -0,0 +1,138 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE ALTITUDE PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The current system altitude. + */ +public class msg_altitude extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_ALTITUDE = 141; + public static final int MAVLINK_MSG_LENGTH = 32; + private static final long serialVersionUID = MAVLINK_MSG_ID_ALTITUDE; + + + /** + * Timestamp (micros since boot or Unix epoch) + */ + public long time_usec; + + /** + * This altitude measure is initialized on system boot and monotonic (it is never reset, but represents the local altitude change). The only guarantee on this field is that it will never be reset and is consistent within a flight. The recommended value for this field is the uncorrected barometric altitude at boot time. This altitude will also drift and vary between flights. + */ + public float altitude_monotonic; + + /** + * This altitude measure is strictly above mean sea level and might be non-monotonic (it might reset on events like GPS lock or when a new QNH value is set). It should be the altitude to which global altitude waypoints are compared to. Note that it is *not* the GPS altitude, however, most GPS modules already output AMSL by default and not the WGS84 altitude. + */ + public float altitude_amsl; + + /** + * This is the local altitude in the local coordinate frame. It is not the altitude above home, but in reference to the coordinate origin (0, 0, 0). It is up-positive. + */ + public float altitude_local; + + /** + * This is the altitude above the home position. It resets on each change of the current home position. + */ + public float altitude_relative; + + /** + * This is the altitude above terrain. It might be fed by a terrain database or an altimeter. Values smaller than -1000 should be interpreted as unknown. + */ + public float altitude_terrain; + + /** + * This is not the altitude, but the clear space below the system according to the fused clearance estimate. It generally should max out at the maximum range of e.g. the laser altimeter. It is generally a moving target. A negative value indicates no measurement available. + */ + public float bottom_clearance; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_ALTITUDE; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putFloat(altitude_monotonic); + + packet.payload.putFloat(altitude_amsl); + + packet.payload.putFloat(altitude_local); + + packet.payload.putFloat(altitude_relative); + + packet.payload.putFloat(altitude_terrain); + + packet.payload.putFloat(bottom_clearance); + + return packet; + } + + /** + * Decode a altitude message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.altitude_monotonic = payload.getFloat(); + + this.altitude_amsl = payload.getFloat(); + + this.altitude_local = payload.getFloat(); + + this.altitude_relative = payload.getFloat(); + + this.altitude_terrain = payload.getFloat(); + + this.bottom_clearance = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_altitude() { + msgid = MAVLINK_MSG_ID_ALTITUDE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_altitude(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_ALTITUDE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_ALTITUDE - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " altitude_monotonic:" + altitude_monotonic + " altitude_amsl:" + altitude_amsl + " altitude_local:" + altitude_local + " altitude_relative:" + altitude_relative + " altitude_terrain:" + altitude_terrain + " bottom_clearance:" + bottom_clearance + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_att_pos_mocap.java b/app/src/main/java/com/MAVLink/common/msg_att_pos_mocap.java new file mode 100644 index 0000000..84f6974 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_att_pos_mocap.java @@ -0,0 +1,128 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE ATT_POS_MOCAP PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Motion capture attitude and position + */ +public class msg_att_pos_mocap extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_ATT_POS_MOCAP = 138; + public static final int MAVLINK_MSG_LENGTH = 36; + private static final long serialVersionUID = MAVLINK_MSG_ID_ATT_POS_MOCAP; + + + /** + * Timestamp (micros since boot or Unix epoch) + */ + public long time_usec; + + /** + * Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + */ + public float q[] = new float[4]; + + /** + * X position in meters (NED) + */ + public float x; + + /** + * Y position in meters (NED) + */ + public float y; + + /** + * Z position in meters (NED) + */ + public float z; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_ATT_POS_MOCAP; + + packet.payload.putUnsignedLong(time_usec); + + + for (int i = 0; i < q.length; i++) { + packet.payload.putFloat(q[i]); + } + + + packet.payload.putFloat(x); + + packet.payload.putFloat(y); + + packet.payload.putFloat(z); + + return packet; + } + + /** + * Decode a att_pos_mocap message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + + for (int i = 0; i < this.q.length; i++) { + this.q[i] = payload.getFloat(); + } + + + this.x = payload.getFloat(); + + this.y = payload.getFloat(); + + this.z = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_att_pos_mocap() { + msgid = MAVLINK_MSG_ID_ATT_POS_MOCAP; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_att_pos_mocap(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_ATT_POS_MOCAP; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_ATT_POS_MOCAP - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " q:" + q + " x:" + x + " y:" + y + " z:" + z + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_attitude.java b/app/src/main/java/com/MAVLink/common/msg_attitude.java new file mode 100644 index 0000000..e1495e7 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_attitude.java @@ -0,0 +1,138 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE ATTITUDE PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The attitude in the aeronautical frame (right-handed, Z-down, X-front, Y-right). + */ +public class msg_attitude extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_ATTITUDE = 30; + public static final int MAVLINK_MSG_LENGTH = 28; + private static final long serialVersionUID = MAVLINK_MSG_ID_ATTITUDE; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * Roll angle (rad, -pi..+pi) + */ + public float roll; + + /** + * Pitch angle (rad, -pi..+pi) + */ + public float pitch; + + /** + * Yaw angle (rad, -pi..+pi) + */ + public float yaw; + + /** + * Roll angular speed (rad/s) + */ + public float rollspeed; + + /** + * Pitch angular speed (rad/s) + */ + public float pitchspeed; + + /** + * Yaw angular speed (rad/s) + */ + public float yawspeed; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_ATTITUDE; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putFloat(roll); + + packet.payload.putFloat(pitch); + + packet.payload.putFloat(yaw); + + packet.payload.putFloat(rollspeed); + + packet.payload.putFloat(pitchspeed); + + packet.payload.putFloat(yawspeed); + + return packet; + } + + /** + * Decode a attitude message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.roll = payload.getFloat(); + + this.pitch = payload.getFloat(); + + this.yaw = payload.getFloat(); + + this.rollspeed = payload.getFloat(); + + this.pitchspeed = payload.getFloat(); + + this.yawspeed = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_attitude() { + msgid = MAVLINK_MSG_ID_ATTITUDE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_attitude(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_ATTITUDE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_ATTITUDE - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " roll:" + roll + " pitch:" + pitch + " yaw:" + yaw + " rollspeed:" + rollspeed + " pitchspeed:" + pitchspeed + " yawspeed:" + yawspeed + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_attitude_quaternion.java b/app/src/main/java/com/MAVLink/common/msg_attitude_quaternion.java new file mode 100644 index 0000000..93e8592 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_attitude_quaternion.java @@ -0,0 +1,147 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE ATTITUDE_QUATERNION PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The attitude in the aeronautical frame (right-handed, Z-down, X-front, Y-right), expressed as quaternion. Quaternion order is w, x, y, z and a zero rotation would be expressed as (1 0 0 0). + */ +public class msg_attitude_quaternion extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_ATTITUDE_QUATERNION = 31; + public static final int MAVLINK_MSG_LENGTH = 32; + private static final long serialVersionUID = MAVLINK_MSG_ID_ATTITUDE_QUATERNION; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * Quaternion component 1, w (1 in null-rotation) + */ + public float q1; + + /** + * Quaternion component 2, x (0 in null-rotation) + */ + public float q2; + + /** + * Quaternion component 3, y (0 in null-rotation) + */ + public float q3; + + /** + * Quaternion component 4, z (0 in null-rotation) + */ + public float q4; + + /** + * Roll angular speed (rad/s) + */ + public float rollspeed; + + /** + * Pitch angular speed (rad/s) + */ + public float pitchspeed; + + /** + * Yaw angular speed (rad/s) + */ + public float yawspeed; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_ATTITUDE_QUATERNION; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putFloat(q1); + + packet.payload.putFloat(q2); + + packet.payload.putFloat(q3); + + packet.payload.putFloat(q4); + + packet.payload.putFloat(rollspeed); + + packet.payload.putFloat(pitchspeed); + + packet.payload.putFloat(yawspeed); + + return packet; + } + + /** + * Decode a attitude_quaternion message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.q1 = payload.getFloat(); + + this.q2 = payload.getFloat(); + + this.q3 = payload.getFloat(); + + this.q4 = payload.getFloat(); + + this.rollspeed = payload.getFloat(); + + this.pitchspeed = payload.getFloat(); + + this.yawspeed = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_attitude_quaternion() { + msgid = MAVLINK_MSG_ID_ATTITUDE_QUATERNION; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_attitude_quaternion(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_ATTITUDE_QUATERNION; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_ATTITUDE_QUATERNION - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " q1:" + q1 + " q2:" + q2 + " q3:" + q3 + " q4:" + q4 + " rollspeed:" + rollspeed + " pitchspeed:" + pitchspeed + " yawspeed:" + yawspeed + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_attitude_quaternion_cov.java b/app/src/main/java/com/MAVLink/common/msg_attitude_quaternion_cov.java new file mode 100644 index 0000000..c9eb4b2 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_attitude_quaternion_cov.java @@ -0,0 +1,145 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE ATTITUDE_QUATERNION_COV PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The attitude in the aeronautical frame (right-handed, Z-down, X-front, Y-right), expressed as quaternion. Quaternion order is w, x, y, z and a zero rotation would be expressed as (1 0 0 0). + */ +public class msg_attitude_quaternion_cov extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV = 61; + public static final int MAVLINK_MSG_LENGTH = 72; + private static final long serialVersionUID = MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV; + + + /** + * Timestamp (microseconds since system boot or since UNIX epoch) + */ + public long time_usec; + + /** + * Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation) + */ + public float q[] = new float[4]; + + /** + * Roll angular speed (rad/s) + */ + public float rollspeed; + + /** + * Pitch angular speed (rad/s) + */ + public float pitchspeed; + + /** + * Yaw angular speed (rad/s) + */ + public float yawspeed; + + /** + * Attitude covariance + */ + public float covariance[] = new float[9]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV; + + packet.payload.putUnsignedLong(time_usec); + + + for (int i = 0; i < q.length; i++) { + packet.payload.putFloat(q[i]); + } + + + packet.payload.putFloat(rollspeed); + + packet.payload.putFloat(pitchspeed); + + packet.payload.putFloat(yawspeed); + + + for (int i = 0; i < covariance.length; i++) { + packet.payload.putFloat(covariance[i]); + } + + + return packet; + } + + /** + * Decode a attitude_quaternion_cov message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + + for (int i = 0; i < this.q.length; i++) { + this.q[i] = payload.getFloat(); + } + + + this.rollspeed = payload.getFloat(); + + this.pitchspeed = payload.getFloat(); + + this.yawspeed = payload.getFloat(); + + + for (int i = 0; i < this.covariance.length; i++) { + this.covariance[i] = payload.getFloat(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_attitude_quaternion_cov() { + msgid = MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_attitude_quaternion_cov(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " q:" + q + " rollspeed:" + rollspeed + " pitchspeed:" + pitchspeed + " yawspeed:" + yawspeed + " covariance:" + covariance + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_attitude_target.java b/app/src/main/java/com/MAVLink/common/msg_attitude_target.java new file mode 100644 index 0000000..391be6b --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_attitude_target.java @@ -0,0 +1,146 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE ATTITUDE_TARGET PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Reports the current commanded attitude of the vehicle as specified by the autopilot. This should match the commands sent in a SET_ATTITUDE_TARGET message if the vehicle is being controlled this way. + */ +public class msg_attitude_target extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_ATTITUDE_TARGET = 83; + public static final int MAVLINK_MSG_LENGTH = 37; + private static final long serialVersionUID = MAVLINK_MSG_ID_ATTITUDE_TARGET; + + + /** + * Timestamp in milliseconds since system boot + */ + public long time_boot_ms; + + /** + * Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + */ + public float q[] = new float[4]; + + /** + * Body roll rate in radians per second + */ + public float body_roll_rate; + + /** + * Body pitch rate in radians per second + */ + public float body_pitch_rate; + + /** + * Body yaw rate in radians per second + */ + public float body_yaw_rate; + + /** + * Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust) + */ + public float thrust; + + /** + * Mappings: If any of these bits are set, the corresponding input should be ignored: bit 1: body roll rate, bit 2: body pitch rate, bit 3: body yaw rate. bit 4-bit 7: reserved, bit 8: attitude + */ + public short type_mask; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_ATTITUDE_TARGET; + + packet.payload.putUnsignedInt(time_boot_ms); + + + for (int i = 0; i < q.length; i++) { + packet.payload.putFloat(q[i]); + } + + + packet.payload.putFloat(body_roll_rate); + + packet.payload.putFloat(body_pitch_rate); + + packet.payload.putFloat(body_yaw_rate); + + packet.payload.putFloat(thrust); + + packet.payload.putUnsignedByte(type_mask); + + return packet; + } + + /** + * Decode a attitude_target message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + + for (int i = 0; i < this.q.length; i++) { + this.q[i] = payload.getFloat(); + } + + + this.body_roll_rate = payload.getFloat(); + + this.body_pitch_rate = payload.getFloat(); + + this.body_yaw_rate = payload.getFloat(); + + this.thrust = payload.getFloat(); + + this.type_mask = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_attitude_target() { + msgid = MAVLINK_MSG_ID_ATTITUDE_TARGET; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_attitude_target(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_ATTITUDE_TARGET; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_ATTITUDE_TARGET - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " q:" + q + " body_roll_rate:" + body_roll_rate + " body_pitch_rate:" + body_pitch_rate + " body_yaw_rate:" + body_yaw_rate + " thrust:" + thrust + " type_mask:" + type_mask + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_auth_key.java b/app/src/main/java/com/MAVLink/common/msg_auth_key.java new file mode 100644 index 0000000..2f8582a --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_auth_key.java @@ -0,0 +1,121 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE AUTH_KEY PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Emit an encrypted signature / key identifying this system. PLEASE NOTE: This protocol has been kept simple, so transmitting the key requires an encrypted channel for true safety. + */ +public class msg_auth_key extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_AUTH_KEY = 7; + public static final int MAVLINK_MSG_LENGTH = 32; + private static final long serialVersionUID = MAVLINK_MSG_ID_AUTH_KEY; + + + /** + * key + */ + public byte key[] = new byte[32]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_AUTH_KEY; + + + for (int i = 0; i < key.length; i++) { + packet.payload.putByte(key[i]); + } + + + return packet; + } + + /** + * Decode a auth_key message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + + for (int i = 0; i < this.key.length; i++) { + this.key[i] = payload.getByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_auth_key() { + msgid = MAVLINK_MSG_ID_AUTH_KEY; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_auth_key(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_AUTH_KEY; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setKey(String str) { + int len = Math.min(str.length(), 32); + for (int i = 0; i < len; i++) { + key[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 32; i++) { // padding for the rest of the buffer + key[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getKey() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 32; i++) { + if (key[i] != 0) + buf.append((char) key[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_AUTH_KEY - sysid:" + sysid + " compid:" + compid + " key:" + key + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_autopilot_version.java b/app/src/main/java/com/MAVLink/common/msg_autopilot_version.java new file mode 100644 index 0000000..2637237 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_autopilot_version.java @@ -0,0 +1,194 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE AUTOPILOT_VERSION PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Version and capability of autopilot software + */ +public class msg_autopilot_version extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_AUTOPILOT_VERSION = 148; + public static final int MAVLINK_MSG_LENGTH = 60; + private static final long serialVersionUID = MAVLINK_MSG_ID_AUTOPILOT_VERSION; + + + /** + * bitmask of capabilities (see MAV_PROTOCOL_CAPABILITY enum) + */ + public long capabilities; + + /** + * UID if provided by hardware + */ + public long uid; + + /** + * Firmware version number + */ + public long flight_sw_version; + + /** + * Middleware version number + */ + public long middleware_sw_version; + + /** + * Operating system version number + */ + public long os_sw_version; + + /** + * HW / board version (last 8 bytes should be silicon ID, if any) + */ + public long board_version; + + /** + * ID of the board vendor + */ + public int vendor_id; + + /** + * ID of the product + */ + public int product_id; + + /** + * Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + */ + public short flight_custom_version[] = new short[8]; + + /** + * Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + */ + public short middleware_custom_version[] = new short[8]; + + /** + * Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases. + */ + public short os_custom_version[] = new short[8]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_AUTOPILOT_VERSION; + + packet.payload.putUnsignedLong(capabilities); + + packet.payload.putUnsignedLong(uid); + + packet.payload.putUnsignedInt(flight_sw_version); + + packet.payload.putUnsignedInt(middleware_sw_version); + + packet.payload.putUnsignedInt(os_sw_version); + + packet.payload.putUnsignedInt(board_version); + + packet.payload.putUnsignedShort(vendor_id); + + packet.payload.putUnsignedShort(product_id); + + + for (int i = 0; i < flight_custom_version.length; i++) { + packet.payload.putUnsignedByte(flight_custom_version[i]); + } + + + for (int i = 0; i < middleware_custom_version.length; i++) { + packet.payload.putUnsignedByte(middleware_custom_version[i]); + } + + + for (int i = 0; i < os_custom_version.length; i++) { + packet.payload.putUnsignedByte(os_custom_version[i]); + } + + + return packet; + } + + /** + * Decode a autopilot_version message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.capabilities = payload.getUnsignedLong(); + + this.uid = payload.getUnsignedLong(); + + this.flight_sw_version = payload.getUnsignedInt(); + + this.middleware_sw_version = payload.getUnsignedInt(); + + this.os_sw_version = payload.getUnsignedInt(); + + this.board_version = payload.getUnsignedInt(); + + this.vendor_id = payload.getUnsignedShort(); + + this.product_id = payload.getUnsignedShort(); + + + for (int i = 0; i < this.flight_custom_version.length; i++) { + this.flight_custom_version[i] = payload.getUnsignedByte(); + } + + + for (int i = 0; i < this.middleware_custom_version.length; i++) { + this.middleware_custom_version[i] = payload.getUnsignedByte(); + } + + + for (int i = 0; i < this.os_custom_version.length; i++) { + this.os_custom_version[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_autopilot_version() { + msgid = MAVLINK_MSG_ID_AUTOPILOT_VERSION; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_autopilot_version(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_AUTOPILOT_VERSION; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_AUTOPILOT_VERSION - sysid:" + sysid + " compid:" + compid + " capabilities:" + capabilities + " uid:" + uid + " flight_sw_version:" + flight_sw_version + " middleware_sw_version:" + middleware_sw_version + " os_sw_version:" + os_sw_version + " board_version:" + board_version + " vendor_id:" + vendor_id + " product_id:" + product_id + " flight_custom_version:" + flight_custom_version + " middleware_custom_version:" + middleware_custom_version + " os_custom_version:" + os_custom_version + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_battery_status.java b/app/src/main/java/com/MAVLink/common/msg_battery_status.java new file mode 100644 index 0000000..49d63e2 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_battery_status.java @@ -0,0 +1,164 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE BATTERY_STATUS PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Battery information + */ +public class msg_battery_status extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_BATTERY_STATUS = 147; + public static final int MAVLINK_MSG_LENGTH = 36; + private static final long serialVersionUID = MAVLINK_MSG_ID_BATTERY_STATUS; + + + /** + * Consumed charge, in milliampere hours (1 = 1 mAh), -1: autopilot does not provide mAh consumption estimate + */ + public int current_consumed; + + /** + * Consumed energy, in HectoJoules (intergrated U*I*dt) (1 = 100 Joule), -1: autopilot does not provide energy consumption estimate + */ + public int energy_consumed; + + /** + * Temperature of the battery in centi-degrees celsius. INT16_MAX for unknown temperature. + */ + public short temperature; + + /** + * Battery voltage of cells, in millivolts (1 = 1 millivolt). Cells above the valid cell count for this battery should have the UINT16_MAX value. + */ + public int voltages[] = new int[10]; + + /** + * Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current + */ + public short current_battery; + + /** + * Battery ID + */ + public short id; + + /** + * Function of the battery + */ + public short battery_function; + + /** + * Type (chemistry) of the battery + */ + public short type; + + /** + * Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot does not estimate the remaining battery + */ + public byte battery_remaining; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_BATTERY_STATUS; + + packet.payload.putInt(current_consumed); + + packet.payload.putInt(energy_consumed); + + packet.payload.putShort(temperature); + + + for (int i = 0; i < voltages.length; i++) { + packet.payload.putUnsignedShort(voltages[i]); + } + + + packet.payload.putShort(current_battery); + + packet.payload.putUnsignedByte(id); + + packet.payload.putUnsignedByte(battery_function); + + packet.payload.putUnsignedByte(type); + + packet.payload.putByte(battery_remaining); + + return packet; + } + + /** + * Decode a battery_status message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.current_consumed = payload.getInt(); + + this.energy_consumed = payload.getInt(); + + this.temperature = payload.getShort(); + + + for (int i = 0; i < this.voltages.length; i++) { + this.voltages[i] = payload.getUnsignedShort(); + } + + + this.current_battery = payload.getShort(); + + this.id = payload.getUnsignedByte(); + + this.battery_function = payload.getUnsignedByte(); + + this.type = payload.getUnsignedByte(); + + this.battery_remaining = payload.getByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_battery_status() { + msgid = MAVLINK_MSG_ID_BATTERY_STATUS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_battery_status(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_BATTERY_STATUS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_BATTERY_STATUS - sysid:" + sysid + " compid:" + compid + " current_consumed:" + current_consumed + " energy_consumed:" + energy_consumed + " temperature:" + temperature + " voltages:" + voltages + " current_battery:" + current_battery + " id:" + id + " battery_function:" + battery_function + " type:" + type + " battery_remaining:" + battery_remaining + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_button_change.java b/app/src/main/java/com/MAVLink/common/msg_button_change.java new file mode 100644 index 0000000..0fdd2d5 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_button_change.java @@ -0,0 +1,102 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE BUTTON_CHANGE PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Report button state change + */ +public class msg_button_change extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_BUTTON_CHANGE = 257; + public static final int MAVLINK_MSG_LENGTH = 9; + private static final long serialVersionUID = MAVLINK_MSG_ID_BUTTON_CHANGE; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * Time of last change of button state + */ + public long last_change_ms; + + /** + * Bitmap state of buttons + */ + public short state; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_BUTTON_CHANGE; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putUnsignedInt(last_change_ms); + + packet.payload.putUnsignedByte(state); + + return packet; + } + + /** + * Decode a button_change message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.last_change_ms = payload.getUnsignedInt(); + + this.state = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_button_change() { + msgid = MAVLINK_MSG_ID_BUTTON_CHANGE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_button_change(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_BUTTON_CHANGE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_BUTTON_CHANGE - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " last_change_ms:" + last_change_ms + " state:" + state + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_camera_capture_status.java b/app/src/main/java/com/MAVLink/common/msg_camera_capture_status.java new file mode 100644 index 0000000..b791fb9 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_camera_capture_status.java @@ -0,0 +1,129 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE CAMERA_CAPTURE_STATUS PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * WIP: Information about the status of a capture + */ +public class msg_camera_capture_status extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS = 262; + public static final int MAVLINK_MSG_LENGTH = 18; + private static final long serialVersionUID = MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * Image capture interval in seconds + */ + public float image_interval; + + /** + * Time in milliseconds since recording started + */ + public long recording_time_ms; + + /** + * Available storage capacity in MiB + */ + public float available_capacity; + + /** + * Current status of image capturing (0: idle, 1: capture in progress, 2: interval set but idle, 3: interval set and capture in progress) + */ + public short image_status; + + /** + * Current status of video capturing (0: idle, 1: capture in progress) + */ + public short video_status; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putFloat(image_interval); + + packet.payload.putUnsignedInt(recording_time_ms); + + packet.payload.putFloat(available_capacity); + + packet.payload.putUnsignedByte(image_status); + + packet.payload.putUnsignedByte(video_status); + + return packet; + } + + /** + * Decode a camera_capture_status message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.image_interval = payload.getFloat(); + + this.recording_time_ms = payload.getUnsignedInt(); + + this.available_capacity = payload.getFloat(); + + this.image_status = payload.getUnsignedByte(); + + this.video_status = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_camera_capture_status() { + msgid = MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_camera_capture_status(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " image_interval:" + image_interval + " recording_time_ms:" + recording_time_ms + " available_capacity:" + available_capacity + " image_status:" + image_status + " video_status:" + video_status + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_camera_image_captured.java b/app/src/main/java/com/MAVLink/common/msg_camera_image_captured.java new file mode 100644 index 0000000..d10dc74 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_camera_image_captured.java @@ -0,0 +1,219 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE CAMERA_IMAGE_CAPTURED PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Information about a captured image + */ +public class msg_camera_image_captured extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED = 263; + public static final int MAVLINK_MSG_LENGTH = 255; + private static final long serialVersionUID = MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED; + + + /** + * Timestamp (microseconds since UNIX epoch) in UTC. 0 for unknown. + */ + public long time_utc; + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * Latitude, expressed as degrees * 1E7 where image was taken + */ + public int lat; + + /** + * Longitude, expressed as degrees * 1E7 where capture was taken + */ + public int lon; + + /** + * Altitude in meters, expressed as * 1E3 (AMSL, not WGS84) where image was taken + */ + public int alt; + + /** + * Altitude above ground in meters, expressed as * 1E3 where image was taken + */ + public int relative_alt; + + /** + * Quaternion of camera orientation (w, x, y, z order, zero-rotation is 0, 0, 0, 0) + */ + public float q[] = new float[4]; + + /** + * Zero based index of this image (image count since armed -1) + */ + public int image_index; + + /** + * Camera ID (1 for first, 2 for second, etc.) + */ + public short camera_id; + + /** + * Boolean indicating success (1) or failure (0) while capturing this image. + */ + public byte capture_result; + + /** + * URL of image taken. Either local storage or http://foo.jpg if camera provides an HTTP interface. + */ + public byte file_url[] = new byte[205]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED; + + packet.payload.putUnsignedLong(time_utc); + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putInt(lat); + + packet.payload.putInt(lon); + + packet.payload.putInt(alt); + + packet.payload.putInt(relative_alt); + + + for (int i = 0; i < q.length; i++) { + packet.payload.putFloat(q[i]); + } + + + packet.payload.putInt(image_index); + + packet.payload.putUnsignedByte(camera_id); + + packet.payload.putByte(capture_result); + + + for (int i = 0; i < file_url.length; i++) { + packet.payload.putByte(file_url[i]); + } + + + return packet; + } + + /** + * Decode a camera_image_captured message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_utc = payload.getUnsignedLong(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.lat = payload.getInt(); + + this.lon = payload.getInt(); + + this.alt = payload.getInt(); + + this.relative_alt = payload.getInt(); + + + for (int i = 0; i < this.q.length; i++) { + this.q[i] = payload.getFloat(); + } + + + this.image_index = payload.getInt(); + + this.camera_id = payload.getUnsignedByte(); + + this.capture_result = payload.getByte(); + + + for (int i = 0; i < this.file_url.length; i++) { + this.file_url[i] = payload.getByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_camera_image_captured() { + msgid = MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_camera_image_captured(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setFile_Url(String str) { + int len = Math.min(str.length(), 205); + for (int i = 0; i < len; i++) { + file_url[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 205; i++) { // padding for the rest of the buffer + file_url[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getFile_Url() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 205; i++) { + if (file_url[i] != 0) + buf.append((char) file_url[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED - sysid:" + sysid + " compid:" + compid + " time_utc:" + time_utc + " time_boot_ms:" + time_boot_ms + " lat:" + lat + " lon:" + lon + " alt:" + alt + " relative_alt:" + relative_alt + " q:" + q + " image_index:" + image_index + " camera_id:" + camera_id + " capture_result:" + capture_result + " file_url:" + file_url + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_camera_information.java b/app/src/main/java/com/MAVLink/common/msg_camera_information.java new file mode 100644 index 0000000..ce7edfe --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_camera_information.java @@ -0,0 +1,243 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE CAMERA_INFORMATION PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * WIP: Information about a camera + */ +public class msg_camera_information extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_CAMERA_INFORMATION = 259; + public static final int MAVLINK_MSG_LENGTH = 235; + private static final long serialVersionUID = MAVLINK_MSG_ID_CAMERA_INFORMATION; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * Version of the camera firmware (v << 24 & 0xff = Dev, v << 16 & 0xff = Patch, v << 8 & 0xff = Minor, v & 0xff = Major) + */ + public long firmware_version; + + /** + * Focal length in mm + */ + public float focal_length; + + /** + * Image sensor size horizontal in mm + */ + public float sensor_size_h; + + /** + * Image sensor size vertical in mm + */ + public float sensor_size_v; + + /** + * CAMERA_CAP_FLAGS enum flags (bitmap) describing camera capabilities. + */ + public long flags; + + /** + * Image resolution in pixels horizontal + */ + public int resolution_h; + + /** + * Image resolution in pixels vertical + */ + public int resolution_v; + + /** + * Camera definition version (iteration) + */ + public int cam_definition_version; + + /** + * Name of the camera vendor + */ + public short vendor_name[] = new short[32]; + + /** + * Name of the camera model + */ + public short model_name[] = new short[32]; + + /** + * Reserved for a lens ID + */ + public short lens_id; + + /** + * Camera definition URI (if any, otherwise only basic functions will be available). + */ + public byte cam_definition_uri[] = new byte[140]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_CAMERA_INFORMATION; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putUnsignedInt(firmware_version); + + packet.payload.putFloat(focal_length); + + packet.payload.putFloat(sensor_size_h); + + packet.payload.putFloat(sensor_size_v); + + packet.payload.putUnsignedInt(flags); + + packet.payload.putUnsignedShort(resolution_h); + + packet.payload.putUnsignedShort(resolution_v); + + packet.payload.putUnsignedShort(cam_definition_version); + + + for (int i = 0; i < vendor_name.length; i++) { + packet.payload.putUnsignedByte(vendor_name[i]); + } + + + for (int i = 0; i < model_name.length; i++) { + packet.payload.putUnsignedByte(model_name[i]); + } + + + packet.payload.putUnsignedByte(lens_id); + + + for (int i = 0; i < cam_definition_uri.length; i++) { + packet.payload.putByte(cam_definition_uri[i]); + } + + + return packet; + } + + /** + * Decode a camera_information message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.firmware_version = payload.getUnsignedInt(); + + this.focal_length = payload.getFloat(); + + this.sensor_size_h = payload.getFloat(); + + this.sensor_size_v = payload.getFloat(); + + this.flags = payload.getUnsignedInt(); + + this.resolution_h = payload.getUnsignedShort(); + + this.resolution_v = payload.getUnsignedShort(); + + this.cam_definition_version = payload.getUnsignedShort(); + + + for (int i = 0; i < this.vendor_name.length; i++) { + this.vendor_name[i] = payload.getUnsignedByte(); + } + + + for (int i = 0; i < this.model_name.length; i++) { + this.model_name[i] = payload.getUnsignedByte(); + } + + + this.lens_id = payload.getUnsignedByte(); + + + for (int i = 0; i < this.cam_definition_uri.length; i++) { + this.cam_definition_uri[i] = payload.getByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_camera_information() { + msgid = MAVLINK_MSG_ID_CAMERA_INFORMATION; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_camera_information(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_CAMERA_INFORMATION; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setCam_Definition_Uri(String str) { + int len = Math.min(str.length(), 140); + for (int i = 0; i < len; i++) { + cam_definition_uri[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 140; i++) { // padding for the rest of the buffer + cam_definition_uri[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getCam_Definition_Uri() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 140; i++) { + if (cam_definition_uri[i] != 0) + buf.append((char) cam_definition_uri[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_CAMERA_INFORMATION - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " firmware_version:" + firmware_version + " focal_length:" + focal_length + " sensor_size_h:" + sensor_size_h + " sensor_size_v:" + sensor_size_v + " flags:" + flags + " resolution_h:" + resolution_h + " resolution_v:" + resolution_v + " cam_definition_version:" + cam_definition_version + " vendor_name:" + vendor_name + " model_name:" + model_name + " lens_id:" + lens_id + " cam_definition_uri:" + cam_definition_uri + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_camera_settings.java b/app/src/main/java/com/MAVLink/common/msg_camera_settings.java new file mode 100644 index 0000000..faddae1 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_camera_settings.java @@ -0,0 +1,93 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE CAMERA_SETTINGS PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * WIP: Settings of a camera, can be requested using MAV_CMD_REQUEST_CAMERA_SETTINGS. + */ +public class msg_camera_settings extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_CAMERA_SETTINGS = 260; + public static final int MAVLINK_MSG_LENGTH = 5; + private static final long serialVersionUID = MAVLINK_MSG_ID_CAMERA_SETTINGS; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * Camera mode (CAMERA_MODE) + */ + public short mode_id; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_CAMERA_SETTINGS; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putUnsignedByte(mode_id); + + return packet; + } + + /** + * Decode a camera_settings message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.mode_id = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_camera_settings() { + msgid = MAVLINK_MSG_ID_CAMERA_SETTINGS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_camera_settings(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_CAMERA_SETTINGS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_CAMERA_SETTINGS - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " mode_id:" + mode_id + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_camera_trigger.java b/app/src/main/java/com/MAVLink/common/msg_camera_trigger.java new file mode 100644 index 0000000..357e31f --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_camera_trigger.java @@ -0,0 +1,93 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE CAMERA_TRIGGER PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Camera-IMU triggering and synchronisation message. + */ +public class msg_camera_trigger extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_CAMERA_TRIGGER = 112; + public static final int MAVLINK_MSG_LENGTH = 12; + private static final long serialVersionUID = MAVLINK_MSG_ID_CAMERA_TRIGGER; + + + /** + * Timestamp for the image frame in microseconds + */ + public long time_usec; + + /** + * Image frame sequence + */ + public long seq; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_CAMERA_TRIGGER; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putUnsignedInt(seq); + + return packet; + } + + /** + * Decode a camera_trigger message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.seq = payload.getUnsignedInt(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_camera_trigger() { + msgid = MAVLINK_MSG_ID_CAMERA_TRIGGER; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_camera_trigger(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_CAMERA_TRIGGER; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_CAMERA_TRIGGER - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " seq:" + seq + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_change_operator_control.java b/app/src/main/java/com/MAVLink/common/msg_change_operator_control.java new file mode 100644 index 0000000..12bda3e --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_change_operator_control.java @@ -0,0 +1,148 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE CHANGE_OPERATOR_CONTROL PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Request to control this MAV + */ +public class msg_change_operator_control extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL = 5; + public static final int MAVLINK_MSG_LENGTH = 28; + private static final long serialVersionUID = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL; + + + /** + * System the GCS requests control for + */ + public short target_system; + + /** + * 0: request control of this MAV, 1: Release control of this MAV + */ + public short control_request; + + /** + * 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch. + */ + public short version; + + /** + * Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-" + */ + public byte passkey[] = new byte[25]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL; + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(control_request); + + packet.payload.putUnsignedByte(version); + + + for (int i = 0; i < passkey.length; i++) { + packet.payload.putByte(passkey[i]); + } + + + return packet; + } + + /** + * Decode a change_operator_control message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.target_system = payload.getUnsignedByte(); + + this.control_request = payload.getUnsignedByte(); + + this.version = payload.getUnsignedByte(); + + + for (int i = 0; i < this.passkey.length; i++) { + this.passkey[i] = payload.getByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_change_operator_control() { + msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_change_operator_control(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setPasskey(String str) { + int len = Math.min(str.length(), 25); + for (int i = 0; i < len; i++) { + passkey[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 25; i++) { // padding for the rest of the buffer + passkey[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getPasskey() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 25; i++) { + if (passkey[i] != 0) + buf.append((char) passkey[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL - sysid:" + sysid + " compid:" + compid + " target_system:" + target_system + " control_request:" + control_request + " version:" + version + " passkey:" + passkey + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_change_operator_control_ack.java b/app/src/main/java/com/MAVLink/common/msg_change_operator_control_ack.java new file mode 100644 index 0000000..0e93396 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_change_operator_control_ack.java @@ -0,0 +1,102 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE CHANGE_OPERATOR_CONTROL_ACK PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Accept / deny control of this MAV + */ +public class msg_change_operator_control_ack extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK = 6; + public static final int MAVLINK_MSG_LENGTH = 3; + private static final long serialVersionUID = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK; + + + /** + * ID of the GCS this message + */ + public short gcs_system_id; + + /** + * 0: request control of this MAV, 1: Release control of this MAV + */ + public short control_request; + + /** + * 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control + */ + public short ack; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK; + + packet.payload.putUnsignedByte(gcs_system_id); + + packet.payload.putUnsignedByte(control_request); + + packet.payload.putUnsignedByte(ack); + + return packet; + } + + /** + * Decode a change_operator_control_ack message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.gcs_system_id = payload.getUnsignedByte(); + + this.control_request = payload.getUnsignedByte(); + + this.ack = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_change_operator_control_ack() { + msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_change_operator_control_ack(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK - sysid:" + sysid + " compid:" + compid + " gcs_system_id:" + gcs_system_id + " control_request:" + control_request + " ack:" + ack + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_collision.java b/app/src/main/java/com/MAVLink/common/msg_collision.java new file mode 100644 index 0000000..7eeecef --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_collision.java @@ -0,0 +1,138 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE COLLISION PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Information about a potential collision + */ +public class msg_collision extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_COLLISION = 247; + public static final int MAVLINK_MSG_LENGTH = 19; + private static final long serialVersionUID = MAVLINK_MSG_ID_COLLISION; + + + /** + * Unique identifier, domain based on src field + */ + public long id; + + /** + * Estimated time until collision occurs (seconds) + */ + public float time_to_minimum_delta; + + /** + * Closest vertical distance in meters between vehicle and object + */ + public float altitude_minimum_delta; + + /** + * Closest horizontal distance in meteres between vehicle and object + */ + public float horizontal_minimum_delta; + + /** + * Collision data source + */ + public short src; + + /** + * Action that is being taken to avoid this collision + */ + public short action; + + /** + * How concerned the aircraft is about this collision + */ + public short threat_level; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_COLLISION; + + packet.payload.putUnsignedInt(id); + + packet.payload.putFloat(time_to_minimum_delta); + + packet.payload.putFloat(altitude_minimum_delta); + + packet.payload.putFloat(horizontal_minimum_delta); + + packet.payload.putUnsignedByte(src); + + packet.payload.putUnsignedByte(action); + + packet.payload.putUnsignedByte(threat_level); + + return packet; + } + + /** + * Decode a collision message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.id = payload.getUnsignedInt(); + + this.time_to_minimum_delta = payload.getFloat(); + + this.altitude_minimum_delta = payload.getFloat(); + + this.horizontal_minimum_delta = payload.getFloat(); + + this.src = payload.getUnsignedByte(); + + this.action = payload.getUnsignedByte(); + + this.threat_level = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_collision() { + msgid = MAVLINK_MSG_ID_COLLISION; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_collision(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_COLLISION; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_COLLISION - sysid:" + sysid + " compid:" + compid + " id:" + id + " time_to_minimum_delta:" + time_to_minimum_delta + " altitude_minimum_delta:" + altitude_minimum_delta + " horizontal_minimum_delta:" + horizontal_minimum_delta + " src:" + src + " action:" + action + " threat_level:" + threat_level + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_command_ack.java b/app/src/main/java/com/MAVLink/common/msg_command_ack.java new file mode 100644 index 0000000..1cbd29c --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_command_ack.java @@ -0,0 +1,129 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE COMMAND_ACK PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Report status of a command. Includes feedback whether the command was executed. + */ +public class msg_command_ack extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_COMMAND_ACK = 77; + public static final int MAVLINK_MSG_LENGTH = 10; + private static final long serialVersionUID = MAVLINK_MSG_ID_COMMAND_ACK; + + + /** + * Command ID, as defined by MAV_CMD enum. + */ + public int command; + + /** + * See MAV_RESULT enum + */ + public short result; + + /** + * WIP: Also used as result_param1, it can be set with a enum containing the errors reasons of why the command was denied or the progress percentage or 255 if unknown the progress when result is MAV_RESULT_IN_PROGRESS. + */ + public short progress; + + /** + * WIP: Additional parameter of the result, example: which parameter of MAV_CMD_NAV_WAYPOINT caused it to be denied. + */ + public int result_param2; + + /** + * WIP: System which requested the command to be executed + */ + public short target_system; + + /** + * WIP: Component which requested the command to be executed + */ + public short target_component; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_COMMAND_ACK; + + packet.payload.putUnsignedShort(command); + + packet.payload.putUnsignedByte(result); + + packet.payload.putUnsignedByte(progress); + + packet.payload.putInt(result_param2); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + return packet; + } + + /** + * Decode a command_ack message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.command = payload.getUnsignedShort(); + + this.result = payload.getUnsignedByte(); + + this.progress = payload.getUnsignedByte(); + + this.result_param2 = payload.getInt(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_command_ack() { + msgid = MAVLINK_MSG_ID_COMMAND_ACK; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_command_ack(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_COMMAND_ACK; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_COMMAND_ACK - sysid:" + sysid + " compid:" + compid + " command:" + command + " result:" + result + " progress:" + progress + " result_param2:" + result_param2 + " target_system:" + target_system + " target_component:" + target_component + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_command_int.java b/app/src/main/java/com/MAVLink/common/msg_command_int.java new file mode 100644 index 0000000..c8820c4 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_command_int.java @@ -0,0 +1,192 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE COMMAND_INT PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Message encoding a command with parameters as scaled integers. Scaling depends on the actual command value. + */ +public class msg_command_int extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_COMMAND_INT = 75; + public static final int MAVLINK_MSG_LENGTH = 35; + private static final long serialVersionUID = MAVLINK_MSG_ID_COMMAND_INT; + + + /** + * PARAM1, see MAV_CMD enum + */ + public float param1; + + /** + * PARAM2, see MAV_CMD enum + */ + public float param2; + + /** + * PARAM3, see MAV_CMD enum + */ + public float param3; + + /** + * PARAM4, see MAV_CMD enum + */ + public float param4; + + /** + * PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7 + */ + public int x; + + /** + * PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7 + */ + public int y; + + /** + * PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame. + */ + public float z; + + /** + * The scheduled action for the mission item. see MAV_CMD in common.xml MAVLink specs + */ + public int command; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * The coordinate system of the COMMAND. see MAV_FRAME in mavlink_types.h + */ + public short frame; + + /** + * false:0, true:1 + */ + public short current; + + /** + * autocontinue to next wp + */ + public short autocontinue; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_COMMAND_INT; + + packet.payload.putFloat(param1); + + packet.payload.putFloat(param2); + + packet.payload.putFloat(param3); + + packet.payload.putFloat(param4); + + packet.payload.putInt(x); + + packet.payload.putInt(y); + + packet.payload.putFloat(z); + + packet.payload.putUnsignedShort(command); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(frame); + + packet.payload.putUnsignedByte(current); + + packet.payload.putUnsignedByte(autocontinue); + + return packet; + } + + /** + * Decode a command_int message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.param1 = payload.getFloat(); + + this.param2 = payload.getFloat(); + + this.param3 = payload.getFloat(); + + this.param4 = payload.getFloat(); + + this.x = payload.getInt(); + + this.y = payload.getInt(); + + this.z = payload.getFloat(); + + this.command = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.frame = payload.getUnsignedByte(); + + this.current = payload.getUnsignedByte(); + + this.autocontinue = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_command_int() { + msgid = MAVLINK_MSG_ID_COMMAND_INT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_command_int(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_COMMAND_INT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_COMMAND_INT - sysid:" + sysid + " compid:" + compid + " param1:" + param1 + " param2:" + param2 + " param3:" + param3 + " param4:" + param4 + " x:" + x + " y:" + y + " z:" + z + " command:" + command + " target_system:" + target_system + " target_component:" + target_component + " frame:" + frame + " current:" + current + " autocontinue:" + autocontinue + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_command_long.java b/app/src/main/java/com/MAVLink/common/msg_command_long.java new file mode 100644 index 0000000..fa0d406 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_command_long.java @@ -0,0 +1,174 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE COMMAND_LONG PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Send a command with up to seven parameters to the MAV + */ +public class msg_command_long extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_COMMAND_LONG = 76; + public static final int MAVLINK_MSG_LENGTH = 33; + private static final long serialVersionUID = MAVLINK_MSG_ID_COMMAND_LONG; + + + /** + * Parameter 1, as defined by MAV_CMD enum. + */ + public float param1; + + /** + * Parameter 2, as defined by MAV_CMD enum. + */ + public float param2; + + /** + * Parameter 3, as defined by MAV_CMD enum. + */ + public float param3; + + /** + * Parameter 4, as defined by MAV_CMD enum. + */ + public float param4; + + /** + * Parameter 5, as defined by MAV_CMD enum. + */ + public float param5; + + /** + * Parameter 6, as defined by MAV_CMD enum. + */ + public float param6; + + /** + * Parameter 7, as defined by MAV_CMD enum. + */ + public float param7; + + /** + * Command ID, as defined by MAV_CMD enum. + */ + public int command; + + /** + * System which should execute the command + */ + public short target_system; + + /** + * Component which should execute the command, 0 for all components + */ + public short target_component; + + /** + * 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command) + */ + public short confirmation; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_COMMAND_LONG; + + packet.payload.putFloat(param1); + + packet.payload.putFloat(param2); + + packet.payload.putFloat(param3); + + packet.payload.putFloat(param4); + + packet.payload.putFloat(param5); + + packet.payload.putFloat(param6); + + packet.payload.putFloat(param7); + + packet.payload.putUnsignedShort(command); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(confirmation); + + return packet; + } + + /** + * Decode a command_long message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.param1 = payload.getFloat(); + + this.param2 = payload.getFloat(); + + this.param3 = payload.getFloat(); + + this.param4 = payload.getFloat(); + + this.param5 = payload.getFloat(); + + this.param6 = payload.getFloat(); + + this.param7 = payload.getFloat(); + + this.command = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.confirmation = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_command_long() { + msgid = MAVLINK_MSG_ID_COMMAND_LONG; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_command_long(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_COMMAND_LONG; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_COMMAND_LONG - sysid:" + sysid + " compid:" + compid + " param1:" + param1 + " param2:" + param2 + " param3:" + param3 + " param4:" + param4 + " param5:" + param5 + " param6:" + param6 + " param7:" + param7 + " command:" + command + " target_system:" + target_system + " target_component:" + target_component + " confirmation:" + confirmation + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_control_system_state.java b/app/src/main/java/com/MAVLink/common/msg_control_system_state.java new file mode 100644 index 0000000..1fd3ece --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_control_system_state.java @@ -0,0 +1,248 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE CONTROL_SYSTEM_STATE PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The smoothed, monotonic system state used to feed the control loops of the system. + */ +public class msg_control_system_state extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE = 146; + public static final int MAVLINK_MSG_LENGTH = 100; + private static final long serialVersionUID = MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE; + + + /** + * Timestamp (micros since boot or Unix epoch) + */ + public long time_usec; + + /** + * X acceleration in body frame + */ + public float x_acc; + + /** + * Y acceleration in body frame + */ + public float y_acc; + + /** + * Z acceleration in body frame + */ + public float z_acc; + + /** + * X velocity in body frame + */ + public float x_vel; + + /** + * Y velocity in body frame + */ + public float y_vel; + + /** + * Z velocity in body frame + */ + public float z_vel; + + /** + * X position in local frame + */ + public float x_pos; + + /** + * Y position in local frame + */ + public float y_pos; + + /** + * Z position in local frame + */ + public float z_pos; + + /** + * Airspeed, set to -1 if unknown + */ + public float airspeed; + + /** + * Variance of body velocity estimate + */ + public float vel_variance[] = new float[3]; + + /** + * Variance in local position + */ + public float pos_variance[] = new float[3]; + + /** + * The attitude, represented as Quaternion + */ + public float q[] = new float[4]; + + /** + * Angular rate in roll axis + */ + public float roll_rate; + + /** + * Angular rate in pitch axis + */ + public float pitch_rate; + + /** + * Angular rate in yaw axis + */ + public float yaw_rate; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putFloat(x_acc); + + packet.payload.putFloat(y_acc); + + packet.payload.putFloat(z_acc); + + packet.payload.putFloat(x_vel); + + packet.payload.putFloat(y_vel); + + packet.payload.putFloat(z_vel); + + packet.payload.putFloat(x_pos); + + packet.payload.putFloat(y_pos); + + packet.payload.putFloat(z_pos); + + packet.payload.putFloat(airspeed); + + + for (int i = 0; i < vel_variance.length; i++) { + packet.payload.putFloat(vel_variance[i]); + } + + + for (int i = 0; i < pos_variance.length; i++) { + packet.payload.putFloat(pos_variance[i]); + } + + + for (int i = 0; i < q.length; i++) { + packet.payload.putFloat(q[i]); + } + + + packet.payload.putFloat(roll_rate); + + packet.payload.putFloat(pitch_rate); + + packet.payload.putFloat(yaw_rate); + + return packet; + } + + /** + * Decode a control_system_state message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.x_acc = payload.getFloat(); + + this.y_acc = payload.getFloat(); + + this.z_acc = payload.getFloat(); + + this.x_vel = payload.getFloat(); + + this.y_vel = payload.getFloat(); + + this.z_vel = payload.getFloat(); + + this.x_pos = payload.getFloat(); + + this.y_pos = payload.getFloat(); + + this.z_pos = payload.getFloat(); + + this.airspeed = payload.getFloat(); + + + for (int i = 0; i < this.vel_variance.length; i++) { + this.vel_variance[i] = payload.getFloat(); + } + + + for (int i = 0; i < this.pos_variance.length; i++) { + this.pos_variance[i] = payload.getFloat(); + } + + + for (int i = 0; i < this.q.length; i++) { + this.q[i] = payload.getFloat(); + } + + + this.roll_rate = payload.getFloat(); + + this.pitch_rate = payload.getFloat(); + + this.yaw_rate = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_control_system_state() { + msgid = MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_control_system_state(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " x_acc:" + x_acc + " y_acc:" + y_acc + " z_acc:" + z_acc + " x_vel:" + x_vel + " y_vel:" + y_vel + " z_vel:" + z_vel + " x_pos:" + x_pos + " y_pos:" + y_pos + " z_pos:" + z_pos + " airspeed:" + airspeed + " vel_variance:" + vel_variance + " pos_variance:" + pos_variance + " q:" + q + " roll_rate:" + roll_rate + " pitch_rate:" + pitch_rate + " yaw_rate:" + yaw_rate + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_data_stream.java b/app/src/main/java/com/MAVLink/common/msg_data_stream.java new file mode 100644 index 0000000..04489da --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_data_stream.java @@ -0,0 +1,102 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE DATA_STREAM PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * THIS INTERFACE IS DEPRECATED. USE MESSAGE_INTERVAL INSTEAD. + */ +public class msg_data_stream extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_DATA_STREAM = 67; + public static final int MAVLINK_MSG_LENGTH = 4; + private static final long serialVersionUID = MAVLINK_MSG_ID_DATA_STREAM; + + + /** + * The message rate + */ + public int message_rate; + + /** + * The ID of the requested data stream + */ + public short stream_id; + + /** + * 1 stream is enabled, 0 stream is stopped. + */ + public short on_off; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_DATA_STREAM; + + packet.payload.putUnsignedShort(message_rate); + + packet.payload.putUnsignedByte(stream_id); + + packet.payload.putUnsignedByte(on_off); + + return packet; + } + + /** + * Decode a data_stream message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.message_rate = payload.getUnsignedShort(); + + this.stream_id = payload.getUnsignedByte(); + + this.on_off = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_data_stream() { + msgid = MAVLINK_MSG_ID_DATA_STREAM; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_data_stream(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_DATA_STREAM; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_DATA_STREAM - sysid:" + sysid + " compid:" + compid + " message_rate:" + message_rate + " stream_id:" + stream_id + " on_off:" + on_off + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_data_transmission_handshake.java b/app/src/main/java/com/MAVLink/common/msg_data_transmission_handshake.java new file mode 100644 index 0000000..e54c694 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_data_transmission_handshake.java @@ -0,0 +1,138 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE DATA_TRANSMISSION_HANDSHAKE PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * + */ +public class msg_data_transmission_handshake extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE = 130; + public static final int MAVLINK_MSG_LENGTH = 13; + private static final long serialVersionUID = MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE; + + + /** + * total data size in bytes (set on ACK only) + */ + public long size; + + /** + * Width of a matrix or image + */ + public int width; + + /** + * Height of a matrix or image + */ + public int height; + + /** + * number of packets beeing sent (set on ACK only) + */ + public int packets; + + /** + * type of requested/acknowledged data (as defined in ENUM DATA_TYPES in mavlink/include/mavlink_types.h) + */ + public short type; + + /** + * payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only) + */ + public short payload; + + /** + * JPEG quality out of [1,100] + */ + public short jpg_quality; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE; + + packet.payload.putUnsignedInt(size); + + packet.payload.putUnsignedShort(width); + + packet.payload.putUnsignedShort(height); + + packet.payload.putUnsignedShort(packets); + + packet.payload.putUnsignedByte(type); + + packet.payload.putUnsignedByte(payload); + + packet.payload.putUnsignedByte(jpg_quality); + + return packet; + } + + /** + * Decode a data_transmission_handshake message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.size = payload.getUnsignedInt(); + + this.width = payload.getUnsignedShort(); + + this.height = payload.getUnsignedShort(); + + this.packets = payload.getUnsignedShort(); + + this.type = payload.getUnsignedByte(); + + this.payload = payload.getUnsignedByte(); + + this.jpg_quality = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_data_transmission_handshake() { + msgid = MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_data_transmission_handshake(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE - sysid:" + sysid + " compid:" + compid + " size:" + size + " width:" + width + " height:" + height + " packets:" + packets + " type:" + type + " payload:" + payload + " jpg_quality:" + jpg_quality + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_debug.java b/app/src/main/java/com/MAVLink/common/msg_debug.java new file mode 100644 index 0000000..38b6e7b --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_debug.java @@ -0,0 +1,102 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE DEBUG PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Send a debug value. The index is used to discriminate between values. These values show up in the plot of QGroundControl as DEBUG N. + */ +public class msg_debug extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_DEBUG = 254; + public static final int MAVLINK_MSG_LENGTH = 9; + private static final long serialVersionUID = MAVLINK_MSG_ID_DEBUG; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * DEBUG value + */ + public float value; + + /** + * index of debug variable + */ + public short ind; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_DEBUG; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putFloat(value); + + packet.payload.putUnsignedByte(ind); + + return packet; + } + + /** + * Decode a debug message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.value = payload.getFloat(); + + this.ind = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_debug() { + msgid = MAVLINK_MSG_ID_DEBUG; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_debug(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_DEBUG; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_DEBUG - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " value:" + value + " ind:" + ind + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_debug_vect.java b/app/src/main/java/com/MAVLink/common/msg_debug_vect.java new file mode 100644 index 0000000..0d737bb --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_debug_vect.java @@ -0,0 +1,157 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE DEBUG_VECT PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * + */ +public class msg_debug_vect extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_DEBUG_VECT = 250; + public static final int MAVLINK_MSG_LENGTH = 30; + private static final long serialVersionUID = MAVLINK_MSG_ID_DEBUG_VECT; + + + /** + * Timestamp + */ + public long time_usec; + + /** + * x + */ + public float x; + + /** + * y + */ + public float y; + + /** + * z + */ + public float z; + + /** + * Name + */ + public byte name[] = new byte[10]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_DEBUG_VECT; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putFloat(x); + + packet.payload.putFloat(y); + + packet.payload.putFloat(z); + + + for (int i = 0; i < name.length; i++) { + packet.payload.putByte(name[i]); + } + + + return packet; + } + + /** + * Decode a debug_vect message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.x = payload.getFloat(); + + this.y = payload.getFloat(); + + this.z = payload.getFloat(); + + + for (int i = 0; i < this.name.length; i++) { + this.name[i] = payload.getByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_debug_vect() { + msgid = MAVLINK_MSG_ID_DEBUG_VECT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_debug_vect(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_DEBUG_VECT; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setName(String str) { + int len = Math.min(str.length(), 10); + for (int i = 0; i < len; i++) { + name[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 10; i++) { // padding for the rest of the buffer + name[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getName() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 10; i++) { + if (name[i] != 0) + buf.append((char) name[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_DEBUG_VECT - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " x:" + x + " y:" + y + " z:" + z + " name:" + name + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_distance_sensor.java b/app/src/main/java/com/MAVLink/common/msg_distance_sensor.java new file mode 100644 index 0000000..7972796 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_distance_sensor.java @@ -0,0 +1,147 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE DISTANCE_SENSOR PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * + */ +public class msg_distance_sensor extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_DISTANCE_SENSOR = 132; + public static final int MAVLINK_MSG_LENGTH = 14; + private static final long serialVersionUID = MAVLINK_MSG_ID_DISTANCE_SENSOR; + + + /** + * Time since system boot + */ + public long time_boot_ms; + + /** + * Minimum distance the sensor can measure in centimeters + */ + public int min_distance; + + /** + * Maximum distance the sensor can measure in centimeters + */ + public int max_distance; + + /** + * Current distance reading + */ + public int current_distance; + + /** + * Type from MAV_DISTANCE_SENSOR enum. + */ + public short type; + + /** + * Onboard ID of the sensor + */ + public short id; + + /** + * Direction the sensor faces from MAV_SENSOR_ORIENTATION enum. downward-facing: ROTATION_PITCH_270, upward-facing: ROTATION_PITCH_90, backward-facing: ROTATION_PITCH_180, forward-facing: ROTATION_NONE, left-facing: ROTATION_YAW_90, right-facing: ROTATION_YAW_270 + */ + public short orientation; + + /** + * Measurement covariance in centimeters, 0 for unknown / invalid readings + */ + public short covariance; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_DISTANCE_SENSOR; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putUnsignedShort(min_distance); + + packet.payload.putUnsignedShort(max_distance); + + packet.payload.putUnsignedShort(current_distance); + + packet.payload.putUnsignedByte(type); + + packet.payload.putUnsignedByte(id); + + packet.payload.putUnsignedByte(orientation); + + packet.payload.putUnsignedByte(covariance); + + return packet; + } + + /** + * Decode a distance_sensor message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.min_distance = payload.getUnsignedShort(); + + this.max_distance = payload.getUnsignedShort(); + + this.current_distance = payload.getUnsignedShort(); + + this.type = payload.getUnsignedByte(); + + this.id = payload.getUnsignedByte(); + + this.orientation = payload.getUnsignedByte(); + + this.covariance = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_distance_sensor() { + msgid = MAVLINK_MSG_ID_DISTANCE_SENSOR; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_distance_sensor(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_DISTANCE_SENSOR; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_DISTANCE_SENSOR - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " min_distance:" + min_distance + " max_distance:" + max_distance + " current_distance:" + current_distance + " type:" + type + " id:" + id + " orientation:" + orientation + " covariance:" + covariance + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_encapsulated_data.java b/app/src/main/java/com/MAVLink/common/msg_encapsulated_data.java new file mode 100644 index 0000000..a4751e1 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_encapsulated_data.java @@ -0,0 +1,101 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE ENCAPSULATED_DATA PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * + */ +public class msg_encapsulated_data extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_ENCAPSULATED_DATA = 131; + public static final int MAVLINK_MSG_LENGTH = 255; + private static final long serialVersionUID = MAVLINK_MSG_ID_ENCAPSULATED_DATA; + + + /** + * sequence number (starting with 0 on every transmission) + */ + public int seqnr; + + /** + * image data bytes + */ + public short data[] = new short[253]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_ENCAPSULATED_DATA; + + packet.payload.putUnsignedShort(seqnr); + + + for (int i = 0; i < data.length; i++) { + packet.payload.putUnsignedByte(data[i]); + } + + + return packet; + } + + /** + * Decode a encapsulated_data message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.seqnr = payload.getUnsignedShort(); + + + for (int i = 0; i < this.data.length; i++) { + this.data[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_encapsulated_data() { + msgid = MAVLINK_MSG_ID_ENCAPSULATED_DATA; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_encapsulated_data(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_ENCAPSULATED_DATA; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_ENCAPSULATED_DATA - sysid:" + sysid + " compid:" + compid + " seqnr:" + seqnr + " data:" + data + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_estimator_status.java b/app/src/main/java/com/MAVLink/common/msg_estimator_status.java new file mode 100644 index 0000000..511e6b7 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_estimator_status.java @@ -0,0 +1,165 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE ESTIMATOR_STATUS PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Estimator status message including flags, innovation test ratios and estimated accuracies. The flags message is an integer bitmask containing information on which EKF outputs are valid. See the ESTIMATOR_STATUS_FLAGS enum definition for further information. The innovaton test ratios show the magnitude of the sensor innovation divided by the innovation check threshold. Under normal operation the innovaton test ratios should be below 0.5 with occasional values up to 1.0. Values greater than 1.0 should be rare under normal operation and indicate that a measurement has been rejected by the filter. The user should be notified if an innovation test ratio greater than 1.0 is recorded. Notifications for values in the range between 0.5 and 1.0 should be optional and controllable by the user. + */ +public class msg_estimator_status extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_ESTIMATOR_STATUS = 230; + public static final int MAVLINK_MSG_LENGTH = 42; + private static final long serialVersionUID = MAVLINK_MSG_ID_ESTIMATOR_STATUS; + + + /** + * Timestamp (micros since boot or Unix epoch) + */ + public long time_usec; + + /** + * Velocity innovation test ratio + */ + public float vel_ratio; + + /** + * Horizontal position innovation test ratio + */ + public float pos_horiz_ratio; + + /** + * Vertical position innovation test ratio + */ + public float pos_vert_ratio; + + /** + * Magnetometer innovation test ratio + */ + public float mag_ratio; + + /** + * Height above terrain innovation test ratio + */ + public float hagl_ratio; + + /** + * True airspeed innovation test ratio + */ + public float tas_ratio; + + /** + * Horizontal position 1-STD accuracy relative to the EKF local origin (m) + */ + public float pos_horiz_accuracy; + + /** + * Vertical position 1-STD accuracy relative to the EKF local origin (m) + */ + public float pos_vert_accuracy; + + /** + * Integer bitmask indicating which EKF outputs are valid. See definition for ESTIMATOR_STATUS_FLAGS. + */ + public int flags; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_ESTIMATOR_STATUS; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putFloat(vel_ratio); + + packet.payload.putFloat(pos_horiz_ratio); + + packet.payload.putFloat(pos_vert_ratio); + + packet.payload.putFloat(mag_ratio); + + packet.payload.putFloat(hagl_ratio); + + packet.payload.putFloat(tas_ratio); + + packet.payload.putFloat(pos_horiz_accuracy); + + packet.payload.putFloat(pos_vert_accuracy); + + packet.payload.putUnsignedShort(flags); + + return packet; + } + + /** + * Decode a estimator_status message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.vel_ratio = payload.getFloat(); + + this.pos_horiz_ratio = payload.getFloat(); + + this.pos_vert_ratio = payload.getFloat(); + + this.mag_ratio = payload.getFloat(); + + this.hagl_ratio = payload.getFloat(); + + this.tas_ratio = payload.getFloat(); + + this.pos_horiz_accuracy = payload.getFloat(); + + this.pos_vert_accuracy = payload.getFloat(); + + this.flags = payload.getUnsignedShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_estimator_status() { + msgid = MAVLINK_MSG_ID_ESTIMATOR_STATUS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_estimator_status(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_ESTIMATOR_STATUS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_ESTIMATOR_STATUS - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " vel_ratio:" + vel_ratio + " pos_horiz_ratio:" + pos_horiz_ratio + " pos_vert_ratio:" + pos_vert_ratio + " mag_ratio:" + mag_ratio + " hagl_ratio:" + hagl_ratio + " tas_ratio:" + tas_ratio + " pos_horiz_accuracy:" + pos_horiz_accuracy + " pos_vert_accuracy:" + pos_vert_accuracy + " flags:" + flags + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_extended_sys_state.java b/app/src/main/java/com/MAVLink/common/msg_extended_sys_state.java new file mode 100644 index 0000000..4a8d025 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_extended_sys_state.java @@ -0,0 +1,93 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE EXTENDED_SYS_STATE PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Provides state for additional features + */ +public class msg_extended_sys_state extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_EXTENDED_SYS_STATE = 245; + public static final int MAVLINK_MSG_LENGTH = 2; + private static final long serialVersionUID = MAVLINK_MSG_ID_EXTENDED_SYS_STATE; + + + /** + * The VTOL state if applicable. Is set to MAV_VTOL_STATE_UNDEFINED if UAV is not in VTOL configuration. + */ + public short vtol_state; + + /** + * The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown. + */ + public short landed_state; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_EXTENDED_SYS_STATE; + + packet.payload.putUnsignedByte(vtol_state); + + packet.payload.putUnsignedByte(landed_state); + + return packet; + } + + /** + * Decode a extended_sys_state message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.vtol_state = payload.getUnsignedByte(); + + this.landed_state = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_extended_sys_state() { + msgid = MAVLINK_MSG_ID_EXTENDED_SYS_STATE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_extended_sys_state(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_EXTENDED_SYS_STATE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_EXTENDED_SYS_STATE - sysid:" + sysid + " compid:" + compid + " vtol_state:" + vtol_state + " landed_state:" + landed_state + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_file_transfer_protocol.java b/app/src/main/java/com/MAVLink/common/msg_file_transfer_protocol.java new file mode 100644 index 0000000..3ea637b --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_file_transfer_protocol.java @@ -0,0 +1,119 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE FILE_TRANSFER_PROTOCOL PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * File transfer message + */ +public class msg_file_transfer_protocol extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL = 110; + public static final int MAVLINK_MSG_LENGTH = 254; + private static final long serialVersionUID = MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL; + + + /** + * Network ID (0 for broadcast) + */ + public short target_network; + + /** + * System ID (0 for broadcast) + */ + public short target_system; + + /** + * Component ID (0 for broadcast) + */ + public short target_component; + + /** + * Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The entire content of this block is opaque unless you understand any the encoding message_type. The particular encoding used can be extension specific and might not always be documented as part of the mavlink specification. + */ + public short payload[] = new short[251]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL; + + packet.payload.putUnsignedByte(target_network); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + + for (int i = 0; i < payload.length; i++) { + packet.payload.putUnsignedByte(payload[i]); + } + + + return packet; + } + + /** + * Decode a file_transfer_protocol message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.target_network = payload.getUnsignedByte(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + + for (int i = 0; i < this.payload.length; i++) { + this.payload[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_file_transfer_protocol() { + msgid = MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_file_transfer_protocol(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL - sysid:" + sysid + " compid:" + compid + " target_network:" + target_network + " target_system:" + target_system + " target_component:" + target_component + " payload:" + payload + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_flight_information.java b/app/src/main/java/com/MAVLink/common/msg_flight_information.java new file mode 100644 index 0000000..e1653ae --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_flight_information.java @@ -0,0 +1,111 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE FLIGHT_INFORMATION PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * WIP: Information about flight since last arming + */ +public class msg_flight_information extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_FLIGHT_INFORMATION = 264; + public static final int MAVLINK_MSG_LENGTH = 28; + private static final long serialVersionUID = MAVLINK_MSG_ID_FLIGHT_INFORMATION; + + + /** + * Timestamp at arming (microseconds since UNIX epoch) in UTC, 0 for unknown + */ + public long arming_time_utc; + + /** + * Timestamp at takeoff (microseconds since UNIX epoch) in UTC, 0 for unknown + */ + public long takeoff_time_utc; + + /** + * Universally unique identifier (UUID) of flight, should correspond to name of logfiles + */ + public long flight_uuid; + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_FLIGHT_INFORMATION; + + packet.payload.putUnsignedLong(arming_time_utc); + + packet.payload.putUnsignedLong(takeoff_time_utc); + + packet.payload.putUnsignedLong(flight_uuid); + + packet.payload.putUnsignedInt(time_boot_ms); + + return packet; + } + + /** + * Decode a flight_information message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.arming_time_utc = payload.getUnsignedLong(); + + this.takeoff_time_utc = payload.getUnsignedLong(); + + this.flight_uuid = payload.getUnsignedLong(); + + this.time_boot_ms = payload.getUnsignedInt(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_flight_information() { + msgid = MAVLINK_MSG_ID_FLIGHT_INFORMATION; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_flight_information(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_FLIGHT_INFORMATION; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_FLIGHT_INFORMATION - sysid:" + sysid + " compid:" + compid + " arming_time_utc:" + arming_time_utc + " takeoff_time_utc:" + takeoff_time_utc + " flight_uuid:" + flight_uuid + " time_boot_ms:" + time_boot_ms + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_follow_target.java b/app/src/main/java/com/MAVLink/common/msg_follow_target.java new file mode 100644 index 0000000..2a3f68e --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_follow_target.java @@ -0,0 +1,206 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE FOLLOW_TARGET PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * current motion information from a designated system + */ +public class msg_follow_target extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_FOLLOW_TARGET = 144; + public static final int MAVLINK_MSG_LENGTH = 93; + private static final long serialVersionUID = MAVLINK_MSG_ID_FOLLOW_TARGET; + + + /** + * Timestamp in milliseconds since system boot + */ + public long timestamp; + + /** + * button states or switches of a tracker device + */ + public long custom_state; + + /** + * Latitude (WGS84), in degrees * 1E7 + */ + public int lat; + + /** + * Longitude (WGS84), in degrees * 1E7 + */ + public int lon; + + /** + * AMSL, in meters + */ + public float alt; + + /** + * target velocity (0,0,0) for unknown + */ + public float vel[] = new float[3]; + + /** + * linear target acceleration (0,0,0) for unknown + */ + public float acc[] = new float[3]; + + /** + * (1 0 0 0 for unknown) + */ + public float attitude_q[] = new float[4]; + + /** + * (0 0 0 for unknown) + */ + public float rates[] = new float[3]; + + /** + * eph epv + */ + public float position_cov[] = new float[3]; + + /** + * bit positions for tracker reporting capabilities (POS = 0, VEL = 1, ACCEL = 2, ATT + RATES = 3) + */ + public short est_capabilities; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_FOLLOW_TARGET; + + packet.payload.putUnsignedLong(timestamp); + + packet.payload.putUnsignedLong(custom_state); + + packet.payload.putInt(lat); + + packet.payload.putInt(lon); + + packet.payload.putFloat(alt); + + + for (int i = 0; i < vel.length; i++) { + packet.payload.putFloat(vel[i]); + } + + + for (int i = 0; i < acc.length; i++) { + packet.payload.putFloat(acc[i]); + } + + + for (int i = 0; i < attitude_q.length; i++) { + packet.payload.putFloat(attitude_q[i]); + } + + + for (int i = 0; i < rates.length; i++) { + packet.payload.putFloat(rates[i]); + } + + + for (int i = 0; i < position_cov.length; i++) { + packet.payload.putFloat(position_cov[i]); + } + + + packet.payload.putUnsignedByte(est_capabilities); + + return packet; + } + + /** + * Decode a follow_target message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.timestamp = payload.getUnsignedLong(); + + this.custom_state = payload.getUnsignedLong(); + + this.lat = payload.getInt(); + + this.lon = payload.getInt(); + + this.alt = payload.getFloat(); + + + for (int i = 0; i < this.vel.length; i++) { + this.vel[i] = payload.getFloat(); + } + + + for (int i = 0; i < this.acc.length; i++) { + this.acc[i] = payload.getFloat(); + } + + + for (int i = 0; i < this.attitude_q.length; i++) { + this.attitude_q[i] = payload.getFloat(); + } + + + for (int i = 0; i < this.rates.length; i++) { + this.rates[i] = payload.getFloat(); + } + + + for (int i = 0; i < this.position_cov.length; i++) { + this.position_cov[i] = payload.getFloat(); + } + + + this.est_capabilities = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_follow_target() { + msgid = MAVLINK_MSG_ID_FOLLOW_TARGET; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_follow_target(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_FOLLOW_TARGET; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_FOLLOW_TARGET - sysid:" + sysid + " compid:" + compid + " timestamp:" + timestamp + " custom_state:" + custom_state + " lat:" + lat + " lon:" + lon + " alt:" + alt + " vel:" + vel + " acc:" + acc + " attitude_q:" + attitude_q + " rates:" + rates + " position_cov:" + position_cov + " est_capabilities:" + est_capabilities + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_global_position_int.java b/app/src/main/java/com/MAVLink/common/msg_global_position_int.java new file mode 100644 index 0000000..9546c24 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_global_position_int.java @@ -0,0 +1,157 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE GLOBAL_POSITION_INT PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The filtered global position (e.g. fused GPS and accelerometers). The position is in GPS-frame (right-handed, Z-up). It + * is designed as scaled integer message since the resolution of float is not sufficient. + */ +public class msg_global_position_int extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_GLOBAL_POSITION_INT = 33; + public static final int MAVLINK_MSG_LENGTH = 28; + private static final long serialVersionUID = MAVLINK_MSG_ID_GLOBAL_POSITION_INT; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * Latitude, expressed as degrees * 1E7 + */ + public int lat; + + /** + * Longitude, expressed as degrees * 1E7 + */ + public int lon; + + /** + * Altitude in meters, expressed as * 1000 (millimeters), AMSL (not WGS84 - note that virtually all GPS modules provide the AMSL as well) + */ + public int alt; + + /** + * Altitude above ground in meters, expressed as * 1000 (millimeters) + */ + public int relative_alt; + + /** + * Ground X Speed (Latitude, positive north), expressed as m/s * 100 + */ + public short vx; + + /** + * Ground Y Speed (Longitude, positive east), expressed as m/s * 100 + */ + public short vy; + + /** + * Ground Z Speed (Altitude, positive down), expressed as m/s * 100 + */ + public short vz; + + /** + * Vehicle heading (yaw angle) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX + */ + public int hdg; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putInt(lat); + + packet.payload.putInt(lon); + + packet.payload.putInt(alt); + + packet.payload.putInt(relative_alt); + + packet.payload.putShort(vx); + + packet.payload.putShort(vy); + + packet.payload.putShort(vz); + + packet.payload.putUnsignedShort(hdg); + + return packet; + } + + /** + * Decode a global_position_int message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.lat = payload.getInt(); + + this.lon = payload.getInt(); + + this.alt = payload.getInt(); + + this.relative_alt = payload.getInt(); + + this.vx = payload.getShort(); + + this.vy = payload.getShort(); + + this.vz = payload.getShort(); + + this.hdg = payload.getUnsignedShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_global_position_int() { + msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_global_position_int(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_GLOBAL_POSITION_INT - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " lat:" + lat + " lon:" + lon + " alt:" + alt + " relative_alt:" + relative_alt + " vx:" + vx + " vy:" + vy + " vz:" + vz + " hdg:" + hdg + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_global_position_int_cov.java b/app/src/main/java/com/MAVLink/common/msg_global_position_int_cov.java new file mode 100644 index 0000000..49fd9e7 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_global_position_int_cov.java @@ -0,0 +1,173 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE GLOBAL_POSITION_INT_COV PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The filtered global position (e.g. fused GPS and accelerometers). The position is in GPS-frame (right-handed, Z-up). It is designed as scaled integer message since the resolution of float is not sufficient. NOTE: This message is intended for onboard networks / companion computers and higher-bandwidth links and optimized for accuracy and completeness. Please use the GLOBAL_POSITION_INT message for a minimal subset. + */ +public class msg_global_position_int_cov extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV = 63; + public static final int MAVLINK_MSG_LENGTH = 181; + private static final long serialVersionUID = MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV; + + + /** + * Timestamp (microseconds since system boot or since UNIX epoch) + */ + public long time_usec; + + /** + * Latitude, expressed as degrees * 1E7 + */ + public int lat; + + /** + * Longitude, expressed as degrees * 1E7 + */ + public int lon; + + /** + * Altitude in meters, expressed as * 1000 (millimeters), above MSL + */ + public int alt; + + /** + * Altitude above ground in meters, expressed as * 1000 (millimeters) + */ + public int relative_alt; + + /** + * Ground X Speed (Latitude), expressed as m/s + */ + public float vx; + + /** + * Ground Y Speed (Longitude), expressed as m/s + */ + public float vy; + + /** + * Ground Z Speed (Altitude), expressed as m/s + */ + public float vz; + + /** + * Covariance matrix (first six entries are the first ROW, next six entries are the second row, etc.) + */ + public float covariance[] = new float[36]; + + /** + * Class id of the estimator this estimate originated from. + */ + public short estimator_type; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putInt(lat); + + packet.payload.putInt(lon); + + packet.payload.putInt(alt); + + packet.payload.putInt(relative_alt); + + packet.payload.putFloat(vx); + + packet.payload.putFloat(vy); + + packet.payload.putFloat(vz); + + + for (int i = 0; i < covariance.length; i++) { + packet.payload.putFloat(covariance[i]); + } + + + packet.payload.putUnsignedByte(estimator_type); + + return packet; + } + + /** + * Decode a global_position_int_cov message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.lat = payload.getInt(); + + this.lon = payload.getInt(); + + this.alt = payload.getInt(); + + this.relative_alt = payload.getInt(); + + this.vx = payload.getFloat(); + + this.vy = payload.getFloat(); + + this.vz = payload.getFloat(); + + + for (int i = 0; i < this.covariance.length; i++) { + this.covariance[i] = payload.getFloat(); + } + + + this.estimator_type = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_global_position_int_cov() { + msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_global_position_int_cov(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " lat:" + lat + " lon:" + lon + " alt:" + alt + " relative_alt:" + relative_alt + " vx:" + vx + " vy:" + vy + " vz:" + vz + " covariance:" + covariance + " estimator_type:" + estimator_type + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_global_vision_position_estimate.java b/app/src/main/java/com/MAVLink/common/msg_global_vision_position_estimate.java new file mode 100644 index 0000000..1571498 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_global_vision_position_estimate.java @@ -0,0 +1,138 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE GLOBAL_VISION_POSITION_ESTIMATE PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * + */ +public class msg_global_vision_position_estimate extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE = 101; + public static final int MAVLINK_MSG_LENGTH = 32; + private static final long serialVersionUID = MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE; + + + /** + * Timestamp (microseconds, synced to UNIX time or since system boot) + */ + public long usec; + + /** + * Global X position + */ + public float x; + + /** + * Global Y position + */ + public float y; + + /** + * Global Z position + */ + public float z; + + /** + * Roll angle in rad + */ + public float roll; + + /** + * Pitch angle in rad + */ + public float pitch; + + /** + * Yaw angle in rad + */ + public float yaw; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE; + + packet.payload.putUnsignedLong(usec); + + packet.payload.putFloat(x); + + packet.payload.putFloat(y); + + packet.payload.putFloat(z); + + packet.payload.putFloat(roll); + + packet.payload.putFloat(pitch); + + packet.payload.putFloat(yaw); + + return packet; + } + + /** + * Decode a global_vision_position_estimate message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.usec = payload.getUnsignedLong(); + + this.x = payload.getFloat(); + + this.y = payload.getFloat(); + + this.z = payload.getFloat(); + + this.roll = payload.getFloat(); + + this.pitch = payload.getFloat(); + + this.yaw = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_global_vision_position_estimate() { + msgid = MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_global_vision_position_estimate(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE - sysid:" + sysid + " compid:" + compid + " usec:" + usec + " x:" + x + " y:" + y + " z:" + z + " roll:" + roll + " pitch:" + pitch + " yaw:" + yaw + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_gps2_raw.java b/app/src/main/java/com/MAVLink/common/msg_gps2_raw.java new file mode 100644 index 0000000..dac255e --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_gps2_raw.java @@ -0,0 +1,183 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE GPS2_RAW PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Second GPS data. Coordinate frame is right-handed, Z-axis up (GPS frame). + */ +public class msg_gps2_raw extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_GPS2_RAW = 124; + public static final int MAVLINK_MSG_LENGTH = 35; + private static final long serialVersionUID = MAVLINK_MSG_ID_GPS2_RAW; + + + /** + * Timestamp (microseconds since UNIX epoch or microseconds since system boot) + */ + public long time_usec; + + /** + * Latitude (WGS84), in degrees * 1E7 + */ + public int lat; + + /** + * Longitude (WGS84), in degrees * 1E7 + */ + public int lon; + + /** + * Altitude (AMSL, not WGS84), in meters * 1000 (positive for up) + */ + public int alt; + + /** + * Age of DGPS info + */ + public long dgps_age; + + /** + * GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: UINT16_MAX + */ + public int eph; + + /** + * GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: UINT16_MAX + */ + public int epv; + + /** + * GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX + */ + public int vel; + + /** + * Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX + */ + public int cog; + + /** + * See the GPS_FIX_TYPE enum. + */ + public short fix_type; + + /** + * Number of satellites visible. If unknown, set to 255 + */ + public short satellites_visible; + + /** + * Number of DGPS satellites + */ + public short dgps_numch; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_GPS2_RAW; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putInt(lat); + + packet.payload.putInt(lon); + + packet.payload.putInt(alt); + + packet.payload.putUnsignedInt(dgps_age); + + packet.payload.putUnsignedShort(eph); + + packet.payload.putUnsignedShort(epv); + + packet.payload.putUnsignedShort(vel); + + packet.payload.putUnsignedShort(cog); + + packet.payload.putUnsignedByte(fix_type); + + packet.payload.putUnsignedByte(satellites_visible); + + packet.payload.putUnsignedByte(dgps_numch); + + return packet; + } + + /** + * Decode a gps2_raw message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.lat = payload.getInt(); + + this.lon = payload.getInt(); + + this.alt = payload.getInt(); + + this.dgps_age = payload.getUnsignedInt(); + + this.eph = payload.getUnsignedShort(); + + this.epv = payload.getUnsignedShort(); + + this.vel = payload.getUnsignedShort(); + + this.cog = payload.getUnsignedShort(); + + this.fix_type = payload.getUnsignedByte(); + + this.satellites_visible = payload.getUnsignedByte(); + + this.dgps_numch = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_gps2_raw() { + msgid = MAVLINK_MSG_ID_GPS2_RAW; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_gps2_raw(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_GPS2_RAW; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_GPS2_RAW - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " lat:" + lat + " lon:" + lon + " alt:" + alt + " dgps_age:" + dgps_age + " eph:" + eph + " epv:" + epv + " vel:" + vel + " cog:" + cog + " fix_type:" + fix_type + " satellites_visible:" + satellites_visible + " dgps_numch:" + dgps_numch + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_gps2_rtk.java b/app/src/main/java/com/MAVLink/common/msg_gps2_rtk.java new file mode 100644 index 0000000..ccdc45b --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_gps2_rtk.java @@ -0,0 +1,192 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE GPS2_RTK PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * RTK GPS data. Gives information on the relative baseline calculation the GPS is reporting + */ +public class msg_gps2_rtk extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_GPS2_RTK = 128; + public static final int MAVLINK_MSG_LENGTH = 35; + private static final long serialVersionUID = MAVLINK_MSG_ID_GPS2_RTK; + + + /** + * Time since boot of last baseline message received in ms. + */ + public long time_last_baseline_ms; + + /** + * GPS Time of Week of last baseline + */ + public long tow; + + /** + * Current baseline in ECEF x or NED north component in mm. + */ + public int baseline_a_mm; + + /** + * Current baseline in ECEF y or NED east component in mm. + */ + public int baseline_b_mm; + + /** + * Current baseline in ECEF z or NED down component in mm. + */ + public int baseline_c_mm; + + /** + * Current estimate of baseline accuracy. + */ + public long accuracy; + + /** + * Current number of integer ambiguity hypotheses. + */ + public int iar_num_hypotheses; + + /** + * GPS Week Number of last baseline + */ + public int wn; + + /** + * Identification of connected RTK receiver. + */ + public short rtk_receiver_id; + + /** + * GPS-specific health report for RTK data. + */ + public short rtk_health; + + /** + * Rate of baseline messages being received by GPS, in HZ + */ + public short rtk_rate; + + /** + * Current number of sats used for RTK calculation. + */ + public short nsats; + + /** + * Coordinate system of baseline. 0 == ECEF, 1 == NED + */ + public short baseline_coords_type; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_GPS2_RTK; + + packet.payload.putUnsignedInt(time_last_baseline_ms); + + packet.payload.putUnsignedInt(tow); + + packet.payload.putInt(baseline_a_mm); + + packet.payload.putInt(baseline_b_mm); + + packet.payload.putInt(baseline_c_mm); + + packet.payload.putUnsignedInt(accuracy); + + packet.payload.putInt(iar_num_hypotheses); + + packet.payload.putUnsignedShort(wn); + + packet.payload.putUnsignedByte(rtk_receiver_id); + + packet.payload.putUnsignedByte(rtk_health); + + packet.payload.putUnsignedByte(rtk_rate); + + packet.payload.putUnsignedByte(nsats); + + packet.payload.putUnsignedByte(baseline_coords_type); + + return packet; + } + + /** + * Decode a gps2_rtk message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_last_baseline_ms = payload.getUnsignedInt(); + + this.tow = payload.getUnsignedInt(); + + this.baseline_a_mm = payload.getInt(); + + this.baseline_b_mm = payload.getInt(); + + this.baseline_c_mm = payload.getInt(); + + this.accuracy = payload.getUnsignedInt(); + + this.iar_num_hypotheses = payload.getInt(); + + this.wn = payload.getUnsignedShort(); + + this.rtk_receiver_id = payload.getUnsignedByte(); + + this.rtk_health = payload.getUnsignedByte(); + + this.rtk_rate = payload.getUnsignedByte(); + + this.nsats = payload.getUnsignedByte(); + + this.baseline_coords_type = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_gps2_rtk() { + msgid = MAVLINK_MSG_ID_GPS2_RTK; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_gps2_rtk(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_GPS2_RTK; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_GPS2_RTK - sysid:" + sysid + " compid:" + compid + " time_last_baseline_ms:" + time_last_baseline_ms + " tow:" + tow + " baseline_a_mm:" + baseline_a_mm + " baseline_b_mm:" + baseline_b_mm + " baseline_c_mm:" + baseline_c_mm + " accuracy:" + accuracy + " iar_num_hypotheses:" + iar_num_hypotheses + " wn:" + wn + " rtk_receiver_id:" + rtk_receiver_id + " rtk_health:" + rtk_health + " rtk_rate:" + rtk_rate + " nsats:" + nsats + " baseline_coords_type:" + baseline_coords_type + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_gps_global_origin.java b/app/src/main/java/com/MAVLink/common/msg_gps_global_origin.java new file mode 100644 index 0000000..6f6fe4e --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_gps_global_origin.java @@ -0,0 +1,111 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE GPS_GLOBAL_ORIGIN PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Once the MAV sets a new GPS-Local correspondence, this message announces the origin (0,0,0) position + */ +public class msg_gps_global_origin extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN = 49; + public static final int MAVLINK_MSG_LENGTH = 20; + private static final long serialVersionUID = MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN; + + + /** + * Latitude (WGS84), in degrees * 1E7 + */ + public int latitude; + + /** + * Longitude (WGS84), in degrees * 1E7 + */ + public int longitude; + + /** + * Altitude (AMSL), in meters * 1000 (positive for up) + */ + public int altitude; + + /** + * Timestamp (microseconds since UNIX epoch or microseconds since system boot) + */ + public long time_usec; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN; + + packet.payload.putInt(latitude); + + packet.payload.putInt(longitude); + + packet.payload.putInt(altitude); + + packet.payload.putUnsignedLong(time_usec); + + return packet; + } + + /** + * Decode a gps_global_origin message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.latitude = payload.getInt(); + + this.longitude = payload.getInt(); + + this.altitude = payload.getInt(); + + this.time_usec = payload.getUnsignedLong(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_gps_global_origin() { + msgid = MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_gps_global_origin(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN - sysid:" + sysid + " compid:" + compid + " latitude:" + latitude + " longitude:" + longitude + " altitude:" + altitude + " time_usec:" + time_usec + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_gps_inject_data.java b/app/src/main/java/com/MAVLink/common/msg_gps_inject_data.java new file mode 100644 index 0000000..83c8afc --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_gps_inject_data.java @@ -0,0 +1,119 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE GPS_INJECT_DATA PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * data for injecting into the onboard GPS (used for DGPS) + */ +public class msg_gps_inject_data extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_GPS_INJECT_DATA = 123; + public static final int MAVLINK_MSG_LENGTH = 113; + private static final long serialVersionUID = MAVLINK_MSG_ID_GPS_INJECT_DATA; + + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * data length + */ + public short len; + + /** + * raw data (110 is enough for 12 satellites of RTCMv2) + */ + public short data[] = new short[110]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_GPS_INJECT_DATA; + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(len); + + + for (int i = 0; i < data.length; i++) { + packet.payload.putUnsignedByte(data[i]); + } + + + return packet; + } + + /** + * Decode a gps_inject_data message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.len = payload.getUnsignedByte(); + + + for (int i = 0; i < this.data.length; i++) { + this.data[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_gps_inject_data() { + msgid = MAVLINK_MSG_ID_GPS_INJECT_DATA; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_gps_inject_data(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_GPS_INJECT_DATA; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_GPS_INJECT_DATA - sysid:" + sysid + " compid:" + compid + " target_system:" + target_system + " target_component:" + target_component + " len:" + len + " data:" + data + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_gps_input.java b/app/src/main/java/com/MAVLink/common/msg_gps_input.java new file mode 100644 index 0000000..301245e --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_gps_input.java @@ -0,0 +1,237 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE GPS_INPUT PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * GPS sensor input message. This is a raw sensor value sent by the GPS. This is NOT the global position estimate of the sytem. + */ +public class msg_gps_input extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_GPS_INPUT = 232; + public static final int MAVLINK_MSG_LENGTH = 63; + private static final long serialVersionUID = MAVLINK_MSG_ID_GPS_INPUT; + + + /** + * Timestamp (micros since boot or Unix epoch) + */ + public long time_usec; + + /** + * GPS time (milliseconds from start of GPS week) + */ + public long time_week_ms; + + /** + * Latitude (WGS84), in degrees * 1E7 + */ + public int lat; + + /** + * Longitude (WGS84), in degrees * 1E7 + */ + public int lon; + + /** + * Altitude (AMSL, not WGS84), in m (positive for up) + */ + public float alt; + + /** + * GPS HDOP horizontal dilution of position in m + */ + public float hdop; + + /** + * GPS VDOP vertical dilution of position in m + */ + public float vdop; + + /** + * GPS velocity in m/s in NORTH direction in earth-fixed NED frame + */ + public float vn; + + /** + * GPS velocity in m/s in EAST direction in earth-fixed NED frame + */ + public float ve; + + /** + * GPS velocity in m/s in DOWN direction in earth-fixed NED frame + */ + public float vd; + + /** + * GPS speed accuracy in m/s + */ + public float speed_accuracy; + + /** + * GPS horizontal accuracy in m + */ + public float horiz_accuracy; + + /** + * GPS vertical accuracy in m + */ + public float vert_accuracy; + + /** + * Flags indicating which fields to ignore (see GPS_INPUT_IGNORE_FLAGS enum). All other fields must be provided. + */ + public int ignore_flags; + + /** + * GPS week number + */ + public int time_week; + + /** + * ID of the GPS for multiple GPS inputs + */ + public short gps_id; + + /** + * 0-1: no fix, 2: 2D fix, 3: 3D fix. 4: 3D with DGPS. 5: 3D with RTK + */ + public short fix_type; + + /** + * Number of satellites visible. + */ + public short satellites_visible; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_GPS_INPUT; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putUnsignedInt(time_week_ms); + + packet.payload.putInt(lat); + + packet.payload.putInt(lon); + + packet.payload.putFloat(alt); + + packet.payload.putFloat(hdop); + + packet.payload.putFloat(vdop); + + packet.payload.putFloat(vn); + + packet.payload.putFloat(ve); + + packet.payload.putFloat(vd); + + packet.payload.putFloat(speed_accuracy); + + packet.payload.putFloat(horiz_accuracy); + + packet.payload.putFloat(vert_accuracy); + + packet.payload.putUnsignedShort(ignore_flags); + + packet.payload.putUnsignedShort(time_week); + + packet.payload.putUnsignedByte(gps_id); + + packet.payload.putUnsignedByte(fix_type); + + packet.payload.putUnsignedByte(satellites_visible); + + return packet; + } + + /** + * Decode a gps_input message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.time_week_ms = payload.getUnsignedInt(); + + this.lat = payload.getInt(); + + this.lon = payload.getInt(); + + this.alt = payload.getFloat(); + + this.hdop = payload.getFloat(); + + this.vdop = payload.getFloat(); + + this.vn = payload.getFloat(); + + this.ve = payload.getFloat(); + + this.vd = payload.getFloat(); + + this.speed_accuracy = payload.getFloat(); + + this.horiz_accuracy = payload.getFloat(); + + this.vert_accuracy = payload.getFloat(); + + this.ignore_flags = payload.getUnsignedShort(); + + this.time_week = payload.getUnsignedShort(); + + this.gps_id = payload.getUnsignedByte(); + + this.fix_type = payload.getUnsignedByte(); + + this.satellites_visible = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_gps_input() { + msgid = MAVLINK_MSG_ID_GPS_INPUT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_gps_input(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_GPS_INPUT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_GPS_INPUT - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " time_week_ms:" + time_week_ms + " lat:" + lat + " lon:" + lon + " alt:" + alt + " hdop:" + hdop + " vdop:" + vdop + " vn:" + vn + " ve:" + ve + " vd:" + vd + " speed_accuracy:" + speed_accuracy + " horiz_accuracy:" + horiz_accuracy + " vert_accuracy:" + vert_accuracy + " ignore_flags:" + ignore_flags + " time_week:" + time_week + " gps_id:" + gps_id + " fix_type:" + fix_type + " satellites_visible:" + satellites_visible + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_gps_raw_int.java b/app/src/main/java/com/MAVLink/common/msg_gps_raw_int.java new file mode 100644 index 0000000..c1fc692 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_gps_raw_int.java @@ -0,0 +1,211 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE GPS_RAW_INT PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The global position, as returned by the Global Positioning System (GPS). This is + * NOT the global position estimate of the system, but rather a RAW sensor value. See message GLOBAL_POSITION for the global position estimate. Coordinate frame is right-handed, Z-axis up (GPS frame). + */ +public class msg_gps_raw_int extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_GPS_RAW_INT = 24; + public static final int MAVLINK_MSG_LENGTH = 50; + private static final long serialVersionUID = MAVLINK_MSG_ID_GPS_RAW_INT; + + + /** + * Timestamp (microseconds since UNIX epoch or microseconds since system boot) + */ + public long time_usec; + + /** + * Latitude (WGS84, EGM96 ellipsoid), in degrees * 1E7 + */ + public int lat; + + /** + * Longitude (WGS84, EGM96 ellipsoid), in degrees * 1E7 + */ + public int lon; + + /** + * Altitude (AMSL, NOT WGS84), in meters * 1000 (positive for up). Note that virtually all GPS modules provide the AMSL altitude in addition to the WGS84 altitude. + */ + public int alt; + + /** + * GPS HDOP horizontal dilution of position (unitless). If unknown, set to: UINT16_MAX + */ + public int eph; + + /** + * GPS VDOP vertical dilution of position (unitless). If unknown, set to: UINT16_MAX + */ + public int epv; + + /** + * GPS ground speed (m/s * 100). If unknown, set to: UINT16_MAX + */ + public int vel; + + /** + * Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: UINT16_MAX + */ + public int cog; + + /** + * See the GPS_FIX_TYPE enum. + */ + public short fix_type; + + /** + * Number of satellites visible. If unknown, set to 255 + */ + public short satellites_visible; + + /** + * Altitude (above WGS84, EGM96 ellipsoid), in meters * 1000 (positive for up). + */ + public int alt_ellipsoid; + + /** + * Position uncertainty in meters * 1000 (positive for up). + */ + public long h_acc; + + /** + * Altitude uncertainty in meters * 1000 (positive for up). + */ + public long v_acc; + + /** + * Speed uncertainty in meters * 1000 (positive for up). + */ + public long vel_acc; + + /** + * Heading / track uncertainty in degrees * 1e5. + */ + public long hdg_acc; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_GPS_RAW_INT; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putInt(lat); + + packet.payload.putInt(lon); + + packet.payload.putInt(alt); + + packet.payload.putUnsignedShort(eph); + + packet.payload.putUnsignedShort(epv); + + packet.payload.putUnsignedShort(vel); + + packet.payload.putUnsignedShort(cog); + + packet.payload.putUnsignedByte(fix_type); + + packet.payload.putUnsignedByte(satellites_visible); + + packet.payload.putInt(alt_ellipsoid); + + packet.payload.putUnsignedInt(h_acc); + + packet.payload.putUnsignedInt(v_acc); + + packet.payload.putUnsignedInt(vel_acc); + + packet.payload.putUnsignedInt(hdg_acc); + + return packet; + } + + /** + * Decode a gps_raw_int message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.lat = payload.getInt(); + + this.lon = payload.getInt(); + + this.alt = payload.getInt(); + + this.eph = payload.getUnsignedShort(); + + this.epv = payload.getUnsignedShort(); + + this.vel = payload.getUnsignedShort(); + + this.cog = payload.getUnsignedShort(); + + this.fix_type = payload.getUnsignedByte(); + + this.satellites_visible = payload.getUnsignedByte(); + + this.alt_ellipsoid = payload.getInt(); + + this.h_acc = payload.getUnsignedInt(); + + this.v_acc = payload.getUnsignedInt(); + + this.vel_acc = payload.getUnsignedInt(); + + this.hdg_acc = payload.getUnsignedInt(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_gps_raw_int() { + msgid = MAVLINK_MSG_ID_GPS_RAW_INT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_gps_raw_int(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_GPS_RAW_INT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_GPS_RAW_INT - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " lat:" + lat + " lon:" + lon + " alt:" + alt + " eph:" + eph + " epv:" + epv + " vel:" + vel + " cog:" + cog + " fix_type:" + fix_type + " satellites_visible:" + satellites_visible + " alt_ellipsoid:" + alt_ellipsoid + " h_acc:" + h_acc + " v_acc:" + v_acc + " vel_acc:" + vel_acc + " hdg_acc:" + hdg_acc + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_gps_rtcm_data.java b/app/src/main/java/com/MAVLink/common/msg_gps_rtcm_data.java new file mode 100644 index 0000000..9745f0e --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_gps_rtcm_data.java @@ -0,0 +1,110 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE GPS_RTCM_DATA PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * RTCM message for injecting into the onboard GPS (used for DGPS) + */ +public class msg_gps_rtcm_data extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_GPS_RTCM_DATA = 233; + public static final int MAVLINK_MSG_LENGTH = 182; + private static final long serialVersionUID = MAVLINK_MSG_ID_GPS_RTCM_DATA; + + + /** + * LSB: 1 means message is fragmented, next 2 bits are the fragment ID, the remaining 5 bits are used for the sequence ID. Messages are only to be flushed to the GPS when the entire message has been reconstructed on the autopilot. The fragment ID specifies which order the fragments should be assembled into a buffer, while the sequence ID is used to detect a mismatch between different buffers. The buffer is considered fully reconstructed when either all 4 fragments are present, or all the fragments before the first fragment with a non full payload is received. This management is used to ensure that normal GPS operation doesn't corrupt RTCM data, and to recover from a unreliable transport delivery order. + */ + public short flags; + + /** + * data length + */ + public short len; + + /** + * RTCM message (may be fragmented) + */ + public short data[] = new short[180]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_GPS_RTCM_DATA; + + packet.payload.putUnsignedByte(flags); + + packet.payload.putUnsignedByte(len); + + + for (int i = 0; i < data.length; i++) { + packet.payload.putUnsignedByte(data[i]); + } + + + return packet; + } + + /** + * Decode a gps_rtcm_data message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.flags = payload.getUnsignedByte(); + + this.len = payload.getUnsignedByte(); + + + for (int i = 0; i < this.data.length; i++) { + this.data[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_gps_rtcm_data() { + msgid = MAVLINK_MSG_ID_GPS_RTCM_DATA; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_gps_rtcm_data(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_GPS_RTCM_DATA; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_GPS_RTCM_DATA - sysid:" + sysid + " compid:" + compid + " flags:" + flags + " len:" + len + " data:" + data + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_gps_rtk.java b/app/src/main/java/com/MAVLink/common/msg_gps_rtk.java new file mode 100644 index 0000000..0465f98 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_gps_rtk.java @@ -0,0 +1,192 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE GPS_RTK PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * RTK GPS data. Gives information on the relative baseline calculation the GPS is reporting + */ +public class msg_gps_rtk extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_GPS_RTK = 127; + public static final int MAVLINK_MSG_LENGTH = 35; + private static final long serialVersionUID = MAVLINK_MSG_ID_GPS_RTK; + + + /** + * Time since boot of last baseline message received in ms. + */ + public long time_last_baseline_ms; + + /** + * GPS Time of Week of last baseline + */ + public long tow; + + /** + * Current baseline in ECEF x or NED north component in mm. + */ + public int baseline_a_mm; + + /** + * Current baseline in ECEF y or NED east component in mm. + */ + public int baseline_b_mm; + + /** + * Current baseline in ECEF z or NED down component in mm. + */ + public int baseline_c_mm; + + /** + * Current estimate of baseline accuracy. + */ + public long accuracy; + + /** + * Current number of integer ambiguity hypotheses. + */ + public int iar_num_hypotheses; + + /** + * GPS Week Number of last baseline + */ + public int wn; + + /** + * Identification of connected RTK receiver. + */ + public short rtk_receiver_id; + + /** + * GPS-specific health report for RTK data. + */ + public short rtk_health; + + /** + * Rate of baseline messages being received by GPS, in HZ + */ + public short rtk_rate; + + /** + * Current number of sats used for RTK calculation. + */ + public short nsats; + + /** + * Coordinate system of baseline. 0 == ECEF, 1 == NED + */ + public short baseline_coords_type; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_GPS_RTK; + + packet.payload.putUnsignedInt(time_last_baseline_ms); + + packet.payload.putUnsignedInt(tow); + + packet.payload.putInt(baseline_a_mm); + + packet.payload.putInt(baseline_b_mm); + + packet.payload.putInt(baseline_c_mm); + + packet.payload.putUnsignedInt(accuracy); + + packet.payload.putInt(iar_num_hypotheses); + + packet.payload.putUnsignedShort(wn); + + packet.payload.putUnsignedByte(rtk_receiver_id); + + packet.payload.putUnsignedByte(rtk_health); + + packet.payload.putUnsignedByte(rtk_rate); + + packet.payload.putUnsignedByte(nsats); + + packet.payload.putUnsignedByte(baseline_coords_type); + + return packet; + } + + /** + * Decode a gps_rtk message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_last_baseline_ms = payload.getUnsignedInt(); + + this.tow = payload.getUnsignedInt(); + + this.baseline_a_mm = payload.getInt(); + + this.baseline_b_mm = payload.getInt(); + + this.baseline_c_mm = payload.getInt(); + + this.accuracy = payload.getUnsignedInt(); + + this.iar_num_hypotheses = payload.getInt(); + + this.wn = payload.getUnsignedShort(); + + this.rtk_receiver_id = payload.getUnsignedByte(); + + this.rtk_health = payload.getUnsignedByte(); + + this.rtk_rate = payload.getUnsignedByte(); + + this.nsats = payload.getUnsignedByte(); + + this.baseline_coords_type = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_gps_rtk() { + msgid = MAVLINK_MSG_ID_GPS_RTK; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_gps_rtk(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_GPS_RTK; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_GPS_RTK - sysid:" + sysid + " compid:" + compid + " time_last_baseline_ms:" + time_last_baseline_ms + " tow:" + tow + " baseline_a_mm:" + baseline_a_mm + " baseline_b_mm:" + baseline_b_mm + " baseline_c_mm:" + baseline_c_mm + " accuracy:" + accuracy + " iar_num_hypotheses:" + iar_num_hypotheses + " wn:" + wn + " rtk_receiver_id:" + rtk_receiver_id + " rtk_health:" + rtk_health + " rtk_rate:" + rtk_rate + " nsats:" + nsats + " baseline_coords_type:" + baseline_coords_type + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_gps_status.java b/app/src/main/java/com/MAVLink/common/msg_gps_status.java new file mode 100644 index 0000000..457be47 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_gps_status.java @@ -0,0 +1,161 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE GPS_STATUS PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The positioning status, as reported by GPS. This message is intended to display status information about each satellite visible to the receiver. See message GLOBAL_POSITION for the global position estimate. This message can contain information for up to 20 satellites. + */ +public class msg_gps_status extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_GPS_STATUS = 25; + public static final int MAVLINK_MSG_LENGTH = 101; + private static final long serialVersionUID = MAVLINK_MSG_ID_GPS_STATUS; + + + /** + * Number of satellites visible + */ + public short satellites_visible; + + /** + * Global satellite ID + */ + public short satellite_prn[] = new short[20]; + + /** + * 0: Satellite not used, 1: used for localization + */ + public short satellite_used[] = new short[20]; + + /** + * Elevation (0: right on top of receiver, 90: on the horizon) of satellite + */ + public short satellite_elevation[] = new short[20]; + + /** + * Direction of satellite, 0: 0 deg, 255: 360 deg. + */ + public short satellite_azimuth[] = new short[20]; + + /** + * Signal to noise ratio of satellite + */ + public short satellite_snr[] = new short[20]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_GPS_STATUS; + + packet.payload.putUnsignedByte(satellites_visible); + + + for (int i = 0; i < satellite_prn.length; i++) { + packet.payload.putUnsignedByte(satellite_prn[i]); + } + + + for (int i = 0; i < satellite_used.length; i++) { + packet.payload.putUnsignedByte(satellite_used[i]); + } + + + for (int i = 0; i < satellite_elevation.length; i++) { + packet.payload.putUnsignedByte(satellite_elevation[i]); + } + + + for (int i = 0; i < satellite_azimuth.length; i++) { + packet.payload.putUnsignedByte(satellite_azimuth[i]); + } + + + for (int i = 0; i < satellite_snr.length; i++) { + packet.payload.putUnsignedByte(satellite_snr[i]); + } + + + return packet; + } + + /** + * Decode a gps_status message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.satellites_visible = payload.getUnsignedByte(); + + + for (int i = 0; i < this.satellite_prn.length; i++) { + this.satellite_prn[i] = payload.getUnsignedByte(); + } + + + for (int i = 0; i < this.satellite_used.length; i++) { + this.satellite_used[i] = payload.getUnsignedByte(); + } + + + for (int i = 0; i < this.satellite_elevation.length; i++) { + this.satellite_elevation[i] = payload.getUnsignedByte(); + } + + + for (int i = 0; i < this.satellite_azimuth.length; i++) { + this.satellite_azimuth[i] = payload.getUnsignedByte(); + } + + + for (int i = 0; i < this.satellite_snr.length; i++) { + this.satellite_snr[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_gps_status() { + msgid = MAVLINK_MSG_ID_GPS_STATUS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_gps_status(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_GPS_STATUS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_GPS_STATUS - sysid:" + sysid + " compid:" + compid + " satellites_visible:" + satellites_visible + " satellite_prn:" + satellite_prn + " satellite_used:" + satellite_used + " satellite_elevation:" + satellite_elevation + " satellite_azimuth:" + satellite_azimuth + " satellite_snr:" + satellite_snr + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_heartbeat.java b/app/src/main/java/com/MAVLink/common/msg_heartbeat.java new file mode 100644 index 0000000..4b8baea --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_heartbeat.java @@ -0,0 +1,129 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE HEARTBEAT PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The heartbeat message shows that a system is present and responding. The type of the MAV and Autopilot hardware allow the receiving system to treat further messages from this system appropriate (e.g. by laying out the user interface based on the autopilot). + */ +public class msg_heartbeat extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_HEARTBEAT = 0; + public static final int MAVLINK_MSG_LENGTH = 9; + private static final long serialVersionUID = MAVLINK_MSG_ID_HEARTBEAT; + + + /** + * A bitfield for use for autopilot-specific flags. + */ + public long custom_mode; + + /** + * Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM) + */ + public short type; + + /** + * Autopilot type / class. defined in MAV_AUTOPILOT ENUM + */ + public short autopilot; + + /** + * System mode bitfield, see MAV_MODE_FLAG ENUM in mavlink/include/mavlink_types.h + */ + public short base_mode; + + /** + * System status flag, see MAV_STATE ENUM + */ + public short system_status; + + /** + * MAVLink version, not writable by user, gets added by protocol because of magic data type: uint8_t_mavlink_version + */ + public short mavlink_version; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_HEARTBEAT; + + packet.payload.putUnsignedInt(custom_mode); + + packet.payload.putUnsignedByte(type); + + packet.payload.putUnsignedByte(autopilot); + + packet.payload.putUnsignedByte(base_mode); + + packet.payload.putUnsignedByte(system_status); + + packet.payload.putUnsignedByte(mavlink_version); + + return packet; + } + + /** + * Decode a heartbeat message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.custom_mode = payload.getUnsignedInt(); + + this.type = payload.getUnsignedByte(); + + this.autopilot = payload.getUnsignedByte(); + + this.base_mode = payload.getUnsignedByte(); + + this.system_status = payload.getUnsignedByte(); + + this.mavlink_version = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_heartbeat() { + msgid = MAVLINK_MSG_ID_HEARTBEAT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_heartbeat(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_HEARTBEAT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_HEARTBEAT - sysid:" + sysid + " compid:" + compid + " custom_mode:" + custom_mode + " type:" + type + " autopilot:" + autopilot + " base_mode:" + base_mode + " system_status:" + system_status + " mavlink_version:" + mavlink_version + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_high_latency.java b/app/src/main/java/com/MAVLink/common/msg_high_latency.java new file mode 100644 index 0000000..50b384a --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_high_latency.java @@ -0,0 +1,291 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE HIGH_LATENCY PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Message appropriate for high latency connections like Iridium + */ +public class msg_high_latency extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_HIGH_LATENCY = 234; + public static final int MAVLINK_MSG_LENGTH = 40; + private static final long serialVersionUID = MAVLINK_MSG_ID_HIGH_LATENCY; + + + /** + * A bitfield for use for autopilot-specific flags. + */ + public long custom_mode; + + /** + * Latitude, expressed as degrees * 1E7 + */ + public int latitude; + + /** + * Longitude, expressed as degrees * 1E7 + */ + public int longitude; + + /** + * roll (centidegrees) + */ + public short roll; + + /** + * pitch (centidegrees) + */ + public short pitch; + + /** + * heading (centidegrees) + */ + public int heading; + + /** + * heading setpoint (centidegrees) + */ + public short heading_sp; + + /** + * Altitude above mean sea level (meters) + */ + public short altitude_amsl; + + /** + * Altitude setpoint relative to the home position (meters) + */ + public short altitude_sp; + + /** + * distance to target (meters) + */ + public int wp_distance; + + /** + * System mode bitfield, see MAV_MODE_FLAG ENUM in mavlink/include/mavlink_types.h + */ + public short base_mode; + + /** + * The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown. + */ + public short landed_state; + + /** + * throttle (percentage) + */ + public byte throttle; + + /** + * airspeed (m/s) + */ + public short airspeed; + + /** + * airspeed setpoint (m/s) + */ + public short airspeed_sp; + + /** + * groundspeed (m/s) + */ + public short groundspeed; + + /** + * climb rate (m/s) + */ + public byte climb_rate; + + /** + * Number of satellites visible. If unknown, set to 255 + */ + public short gps_nsat; + + /** + * See the GPS_FIX_TYPE enum. + */ + public short gps_fix_type; + + /** + * Remaining battery (percentage) + */ + public short battery_remaining; + + /** + * Autopilot temperature (degrees C) + */ + public byte temperature; + + /** + * Air temperature (degrees C) from airspeed sensor + */ + public byte temperature_air; + + /** + * failsafe (each bit represents a failsafe where 0=ok, 1=failsafe active (bit0:RC, bit1:batt, bit2:GPS, bit3:GCS, bit4:fence) + */ + public short failsafe; + + /** + * current waypoint number + */ + public short wp_num; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_HIGH_LATENCY; + + packet.payload.putUnsignedInt(custom_mode); + + packet.payload.putInt(latitude); + + packet.payload.putInt(longitude); + + packet.payload.putShort(roll); + + packet.payload.putShort(pitch); + + packet.payload.putUnsignedShort(heading); + + packet.payload.putShort(heading_sp); + + packet.payload.putShort(altitude_amsl); + + packet.payload.putShort(altitude_sp); + + packet.payload.putUnsignedShort(wp_distance); + + packet.payload.putUnsignedByte(base_mode); + + packet.payload.putUnsignedByte(landed_state); + + packet.payload.putByte(throttle); + + packet.payload.putUnsignedByte(airspeed); + + packet.payload.putUnsignedByte(airspeed_sp); + + packet.payload.putUnsignedByte(groundspeed); + + packet.payload.putByte(climb_rate); + + packet.payload.putUnsignedByte(gps_nsat); + + packet.payload.putUnsignedByte(gps_fix_type); + + packet.payload.putUnsignedByte(battery_remaining); + + packet.payload.putByte(temperature); + + packet.payload.putByte(temperature_air); + + packet.payload.putUnsignedByte(failsafe); + + packet.payload.putUnsignedByte(wp_num); + + return packet; + } + + /** + * Decode a high_latency message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.custom_mode = payload.getUnsignedInt(); + + this.latitude = payload.getInt(); + + this.longitude = payload.getInt(); + + this.roll = payload.getShort(); + + this.pitch = payload.getShort(); + + this.heading = payload.getUnsignedShort(); + + this.heading_sp = payload.getShort(); + + this.altitude_amsl = payload.getShort(); + + this.altitude_sp = payload.getShort(); + + this.wp_distance = payload.getUnsignedShort(); + + this.base_mode = payload.getUnsignedByte(); + + this.landed_state = payload.getUnsignedByte(); + + this.throttle = payload.getByte(); + + this.airspeed = payload.getUnsignedByte(); + + this.airspeed_sp = payload.getUnsignedByte(); + + this.groundspeed = payload.getUnsignedByte(); + + this.climb_rate = payload.getByte(); + + this.gps_nsat = payload.getUnsignedByte(); + + this.gps_fix_type = payload.getUnsignedByte(); + + this.battery_remaining = payload.getUnsignedByte(); + + this.temperature = payload.getByte(); + + this.temperature_air = payload.getByte(); + + this.failsafe = payload.getUnsignedByte(); + + this.wp_num = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_high_latency() { + msgid = MAVLINK_MSG_ID_HIGH_LATENCY; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_high_latency(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_HIGH_LATENCY; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_HIGH_LATENCY - sysid:" + sysid + " compid:" + compid + " custom_mode:" + custom_mode + " latitude:" + latitude + " longitude:" + longitude + " roll:" + roll + " pitch:" + pitch + " heading:" + heading + " heading_sp:" + heading_sp + " altitude_amsl:" + altitude_amsl + " altitude_sp:" + altitude_sp + " wp_distance:" + wp_distance + " base_mode:" + base_mode + " landed_state:" + landed_state + " throttle:" + throttle + " airspeed:" + airspeed + " airspeed_sp:" + airspeed_sp + " groundspeed:" + groundspeed + " climb_rate:" + climb_rate + " gps_nsat:" + gps_nsat + " gps_fix_type:" + gps_fix_type + " battery_remaining:" + battery_remaining + " temperature:" + temperature + " temperature_air:" + temperature_air + " failsafe:" + failsafe + " wp_num:" + wp_num + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_highres_imu.java b/app/src/main/java/com/MAVLink/common/msg_highres_imu.java new file mode 100644 index 0000000..e57e89c --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_highres_imu.java @@ -0,0 +1,210 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE HIGHRES_IMU PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The IMU readings in SI units in NED body frame + */ +public class msg_highres_imu extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_HIGHRES_IMU = 105; + public static final int MAVLINK_MSG_LENGTH = 62; + private static final long serialVersionUID = MAVLINK_MSG_ID_HIGHRES_IMU; + + + /** + * Timestamp (microseconds, synced to UNIX time or since system boot) + */ + public long time_usec; + + /** + * X acceleration (m/s^2) + */ + public float xacc; + + /** + * Y acceleration (m/s^2) + */ + public float yacc; + + /** + * Z acceleration (m/s^2) + */ + public float zacc; + + /** + * Angular speed around X axis (rad / sec) + */ + public float xgyro; + + /** + * Angular speed around Y axis (rad / sec) + */ + public float ygyro; + + /** + * Angular speed around Z axis (rad / sec) + */ + public float zgyro; + + /** + * X Magnetic field (Gauss) + */ + public float xmag; + + /** + * Y Magnetic field (Gauss) + */ + public float ymag; + + /** + * Z Magnetic field (Gauss) + */ + public float zmag; + + /** + * Absolute pressure in millibar + */ + public float abs_pressure; + + /** + * Differential pressure in millibar + */ + public float diff_pressure; + + /** + * Altitude calculated from pressure + */ + public float pressure_alt; + + /** + * Temperature in degrees celsius + */ + public float temperature; + + /** + * Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature + */ + public int fields_updated; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_HIGHRES_IMU; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putFloat(xacc); + + packet.payload.putFloat(yacc); + + packet.payload.putFloat(zacc); + + packet.payload.putFloat(xgyro); + + packet.payload.putFloat(ygyro); + + packet.payload.putFloat(zgyro); + + packet.payload.putFloat(xmag); + + packet.payload.putFloat(ymag); + + packet.payload.putFloat(zmag); + + packet.payload.putFloat(abs_pressure); + + packet.payload.putFloat(diff_pressure); + + packet.payload.putFloat(pressure_alt); + + packet.payload.putFloat(temperature); + + packet.payload.putUnsignedShort(fields_updated); + + return packet; + } + + /** + * Decode a highres_imu message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.xacc = payload.getFloat(); + + this.yacc = payload.getFloat(); + + this.zacc = payload.getFloat(); + + this.xgyro = payload.getFloat(); + + this.ygyro = payload.getFloat(); + + this.zgyro = payload.getFloat(); + + this.xmag = payload.getFloat(); + + this.ymag = payload.getFloat(); + + this.zmag = payload.getFloat(); + + this.abs_pressure = payload.getFloat(); + + this.diff_pressure = payload.getFloat(); + + this.pressure_alt = payload.getFloat(); + + this.temperature = payload.getFloat(); + + this.fields_updated = payload.getUnsignedShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_highres_imu() { + msgid = MAVLINK_MSG_ID_HIGHRES_IMU; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_highres_imu(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_HIGHRES_IMU; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_HIGHRES_IMU - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " xacc:" + xacc + " yacc:" + yacc + " zacc:" + zacc + " xgyro:" + xgyro + " ygyro:" + ygyro + " zgyro:" + zgyro + " xmag:" + xmag + " ymag:" + ymag + " zmag:" + zmag + " abs_pressure:" + abs_pressure + " diff_pressure:" + diff_pressure + " pressure_alt:" + pressure_alt + " temperature:" + temperature + " fields_updated:" + fields_updated + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_hil_actuator_controls.java b/app/src/main/java/com/MAVLink/common/msg_hil_actuator_controls.java new file mode 100644 index 0000000..a158b7c --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_hil_actuator_controls.java @@ -0,0 +1,119 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE HIL_ACTUATOR_CONTROLS PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Sent from autopilot to simulation. Hardware in the loop control outputs (replacement for HIL_CONTROLS) + */ +public class msg_hil_actuator_controls extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS = 93; + public static final int MAVLINK_MSG_LENGTH = 81; + private static final long serialVersionUID = MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS; + + + /** + * Timestamp (microseconds since UNIX epoch or microseconds since system boot) + */ + public long time_usec; + + /** + * Flags as bitfield, reserved for future use. + */ + public long flags; + + /** + * Control outputs -1 .. 1. Channel assignment depends on the simulated hardware. + */ + public float controls[] = new float[16]; + + /** + * System mode (MAV_MODE), includes arming state. + */ + public short mode; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putUnsignedLong(flags); + + + for (int i = 0; i < controls.length; i++) { + packet.payload.putFloat(controls[i]); + } + + + packet.payload.putUnsignedByte(mode); + + return packet; + } + + /** + * Decode a hil_actuator_controls message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.flags = payload.getUnsignedLong(); + + + for (int i = 0; i < this.controls.length; i++) { + this.controls[i] = payload.getFloat(); + } + + + this.mode = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_hil_actuator_controls() { + msgid = MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_hil_actuator_controls(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " flags:" + flags + " controls:" + controls + " mode:" + mode + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_hil_controls.java b/app/src/main/java/com/MAVLink/common/msg_hil_controls.java new file mode 100644 index 0000000..6bccc23 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_hil_controls.java @@ -0,0 +1,174 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE HIL_CONTROLS PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Sent from autopilot to simulation. Hardware in the loop control outputs + */ +public class msg_hil_controls extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_HIL_CONTROLS = 91; + public static final int MAVLINK_MSG_LENGTH = 42; + private static final long serialVersionUID = MAVLINK_MSG_ID_HIL_CONTROLS; + + + /** + * Timestamp (microseconds since UNIX epoch or microseconds since system boot) + */ + public long time_usec; + + /** + * Control output -1 .. 1 + */ + public float roll_ailerons; + + /** + * Control output -1 .. 1 + */ + public float pitch_elevator; + + /** + * Control output -1 .. 1 + */ + public float yaw_rudder; + + /** + * Throttle 0 .. 1 + */ + public float throttle; + + /** + * Aux 1, -1 .. 1 + */ + public float aux1; + + /** + * Aux 2, -1 .. 1 + */ + public float aux2; + + /** + * Aux 3, -1 .. 1 + */ + public float aux3; + + /** + * Aux 4, -1 .. 1 + */ + public float aux4; + + /** + * System mode (MAV_MODE) + */ + public short mode; + + /** + * Navigation mode (MAV_NAV_MODE) + */ + public short nav_mode; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_HIL_CONTROLS; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putFloat(roll_ailerons); + + packet.payload.putFloat(pitch_elevator); + + packet.payload.putFloat(yaw_rudder); + + packet.payload.putFloat(throttle); + + packet.payload.putFloat(aux1); + + packet.payload.putFloat(aux2); + + packet.payload.putFloat(aux3); + + packet.payload.putFloat(aux4); + + packet.payload.putUnsignedByte(mode); + + packet.payload.putUnsignedByte(nav_mode); + + return packet; + } + + /** + * Decode a hil_controls message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.roll_ailerons = payload.getFloat(); + + this.pitch_elevator = payload.getFloat(); + + this.yaw_rudder = payload.getFloat(); + + this.throttle = payload.getFloat(); + + this.aux1 = payload.getFloat(); + + this.aux2 = payload.getFloat(); + + this.aux3 = payload.getFloat(); + + this.aux4 = payload.getFloat(); + + this.mode = payload.getUnsignedByte(); + + this.nav_mode = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_hil_controls() { + msgid = MAVLINK_MSG_ID_HIL_CONTROLS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_hil_controls(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_HIL_CONTROLS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_HIL_CONTROLS - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " roll_ailerons:" + roll_ailerons + " pitch_elevator:" + pitch_elevator + " yaw_rudder:" + yaw_rudder + " throttle:" + throttle + " aux1:" + aux1 + " aux2:" + aux2 + " aux3:" + aux3 + " aux4:" + aux4 + " mode:" + mode + " nav_mode:" + nav_mode + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_hil_gps.java b/app/src/main/java/com/MAVLink/common/msg_hil_gps.java new file mode 100644 index 0000000..d5701f3 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_hil_gps.java @@ -0,0 +1,193 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE HIL_GPS PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The global position, as returned by the Global Positioning System (GPS). This is + * NOT the global position estimate of the sytem, but rather a RAW sensor value. See message GLOBAL_POSITION for the global position estimate. Coordinate frame is right-handed, Z-axis up (GPS frame). + */ +public class msg_hil_gps extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_HIL_GPS = 113; + public static final int MAVLINK_MSG_LENGTH = 36; + private static final long serialVersionUID = MAVLINK_MSG_ID_HIL_GPS; + + + /** + * Timestamp (microseconds since UNIX epoch or microseconds since system boot) + */ + public long time_usec; + + /** + * Latitude (WGS84), in degrees * 1E7 + */ + public int lat; + + /** + * Longitude (WGS84), in degrees * 1E7 + */ + public int lon; + + /** + * Altitude (AMSL, not WGS84), in meters * 1000 (positive for up) + */ + public int alt; + + /** + * GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535 + */ + public int eph; + + /** + * GPS VDOP vertical dilution of position in cm (m*100). If unknown, set to: 65535 + */ + public int epv; + + /** + * GPS ground speed in cm/s. If unknown, set to: 65535 + */ + public int vel; + + /** + * GPS velocity in cm/s in NORTH direction in earth-fixed NED frame + */ + public short vn; + + /** + * GPS velocity in cm/s in EAST direction in earth-fixed NED frame + */ + public short ve; + + /** + * GPS velocity in cm/s in DOWN direction in earth-fixed NED frame + */ + public short vd; + + /** + * Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535 + */ + public int cog; + + /** + * 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix. + */ + public short fix_type; + + /** + * Number of satellites visible. If unknown, set to 255 + */ + public short satellites_visible; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_HIL_GPS; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putInt(lat); + + packet.payload.putInt(lon); + + packet.payload.putInt(alt); + + packet.payload.putUnsignedShort(eph); + + packet.payload.putUnsignedShort(epv); + + packet.payload.putUnsignedShort(vel); + + packet.payload.putShort(vn); + + packet.payload.putShort(ve); + + packet.payload.putShort(vd); + + packet.payload.putUnsignedShort(cog); + + packet.payload.putUnsignedByte(fix_type); + + packet.payload.putUnsignedByte(satellites_visible); + + return packet; + } + + /** + * Decode a hil_gps message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.lat = payload.getInt(); + + this.lon = payload.getInt(); + + this.alt = payload.getInt(); + + this.eph = payload.getUnsignedShort(); + + this.epv = payload.getUnsignedShort(); + + this.vel = payload.getUnsignedShort(); + + this.vn = payload.getShort(); + + this.ve = payload.getShort(); + + this.vd = payload.getShort(); + + this.cog = payload.getUnsignedShort(); + + this.fix_type = payload.getUnsignedByte(); + + this.satellites_visible = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_hil_gps() { + msgid = MAVLINK_MSG_ID_HIL_GPS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_hil_gps(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_HIL_GPS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_HIL_GPS - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " lat:" + lat + " lon:" + lon + " alt:" + alt + " eph:" + eph + " epv:" + epv + " vel:" + vel + " vn:" + vn + " ve:" + ve + " vd:" + vd + " cog:" + cog + " fix_type:" + fix_type + " satellites_visible:" + satellites_visible + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_hil_optical_flow.java b/app/src/main/java/com/MAVLink/common/msg_hil_optical_flow.java new file mode 100644 index 0000000..3d7e267 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_hil_optical_flow.java @@ -0,0 +1,183 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE HIL_OPTICAL_FLOW PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Simulated optical flow from a flow sensor (e.g. PX4FLOW or optical mouse sensor) + */ +public class msg_hil_optical_flow extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_HIL_OPTICAL_FLOW = 114; + public static final int MAVLINK_MSG_LENGTH = 44; + private static final long serialVersionUID = MAVLINK_MSG_ID_HIL_OPTICAL_FLOW; + + + /** + * Timestamp (microseconds, synced to UNIX time or since system boot) + */ + public long time_usec; + + /** + * Integration time in microseconds. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the. + */ + public long integration_time_us; + + /** + * Flow in radians around X axis (Sensor RH rotation about the X axis induces a positive flow. Sensor linear motion along the positive Y axis induces a negative flow.) + */ + public float integrated_x; + + /** + * Flow in radians around Y axis (Sensor RH rotation about the Y axis induces a positive flow. Sensor linear motion along the positive X axis induces a positive flow.) + */ + public float integrated_y; + + /** + * RH rotation around X axis (rad) + */ + public float integrated_xgyro; + + /** + * RH rotation around Y axis (rad) + */ + public float integrated_ygyro; + + /** + * RH rotation around Z axis (rad) + */ + public float integrated_zgyro; + + /** + * Time in microseconds since the distance was sampled. + */ + public long time_delta_distance_us; + + /** + * Distance to the center of the flow field in meters. Positive value (including zero): distance known. Negative value: Unknown distance. + */ + public float distance; + + /** + * Temperature * 100 in centi-degrees Celsius + */ + public short temperature; + + /** + * Sensor ID + */ + public short sensor_id; + + /** + * Optical flow quality / confidence. 0: no valid flow, 255: maximum quality + */ + public short quality; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_HIL_OPTICAL_FLOW; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putUnsignedInt(integration_time_us); + + packet.payload.putFloat(integrated_x); + + packet.payload.putFloat(integrated_y); + + packet.payload.putFloat(integrated_xgyro); + + packet.payload.putFloat(integrated_ygyro); + + packet.payload.putFloat(integrated_zgyro); + + packet.payload.putUnsignedInt(time_delta_distance_us); + + packet.payload.putFloat(distance); + + packet.payload.putShort(temperature); + + packet.payload.putUnsignedByte(sensor_id); + + packet.payload.putUnsignedByte(quality); + + return packet; + } + + /** + * Decode a hil_optical_flow message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.integration_time_us = payload.getUnsignedInt(); + + this.integrated_x = payload.getFloat(); + + this.integrated_y = payload.getFloat(); + + this.integrated_xgyro = payload.getFloat(); + + this.integrated_ygyro = payload.getFloat(); + + this.integrated_zgyro = payload.getFloat(); + + this.time_delta_distance_us = payload.getUnsignedInt(); + + this.distance = payload.getFloat(); + + this.temperature = payload.getShort(); + + this.sensor_id = payload.getUnsignedByte(); + + this.quality = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_hil_optical_flow() { + msgid = MAVLINK_MSG_ID_HIL_OPTICAL_FLOW; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_hil_optical_flow(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_HIL_OPTICAL_FLOW; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_HIL_OPTICAL_FLOW - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " integration_time_us:" + integration_time_us + " integrated_x:" + integrated_x + " integrated_y:" + integrated_y + " integrated_xgyro:" + integrated_xgyro + " integrated_ygyro:" + integrated_ygyro + " integrated_zgyro:" + integrated_zgyro + " time_delta_distance_us:" + time_delta_distance_us + " distance:" + distance + " temperature:" + temperature + " sensor_id:" + sensor_id + " quality:" + quality + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_hil_rc_inputs_raw.java b/app/src/main/java/com/MAVLink/common/msg_hil_rc_inputs_raw.java new file mode 100644 index 0000000..7f1c06b --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_hil_rc_inputs_raw.java @@ -0,0 +1,201 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE HIL_RC_INPUTS_RAW PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Sent from simulation to autopilot. The RAW values of the RC channels received. The standard PPM modulation is as follows: 1000 microseconds: 0%, 2000 microseconds: 100%. Individual receivers/transmitters might violate this specification. + */ +public class msg_hil_rc_inputs_raw extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW = 92; + public static final int MAVLINK_MSG_LENGTH = 33; + private static final long serialVersionUID = MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW; + + + /** + * Timestamp (microseconds since UNIX epoch or microseconds since system boot) + */ + public long time_usec; + + /** + * RC channel 1 value, in microseconds + */ + public int chan1_raw; + + /** + * RC channel 2 value, in microseconds + */ + public int chan2_raw; + + /** + * RC channel 3 value, in microseconds + */ + public int chan3_raw; + + /** + * RC channel 4 value, in microseconds + */ + public int chan4_raw; + + /** + * RC channel 5 value, in microseconds + */ + public int chan5_raw; + + /** + * RC channel 6 value, in microseconds + */ + public int chan6_raw; + + /** + * RC channel 7 value, in microseconds + */ + public int chan7_raw; + + /** + * RC channel 8 value, in microseconds + */ + public int chan8_raw; + + /** + * RC channel 9 value, in microseconds + */ + public int chan9_raw; + + /** + * RC channel 10 value, in microseconds + */ + public int chan10_raw; + + /** + * RC channel 11 value, in microseconds + */ + public int chan11_raw; + + /** + * RC channel 12 value, in microseconds + */ + public int chan12_raw; + + /** + * Receive signal strength indicator, 0: 0%, 255: 100% + */ + public short rssi; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putUnsignedShort(chan1_raw); + + packet.payload.putUnsignedShort(chan2_raw); + + packet.payload.putUnsignedShort(chan3_raw); + + packet.payload.putUnsignedShort(chan4_raw); + + packet.payload.putUnsignedShort(chan5_raw); + + packet.payload.putUnsignedShort(chan6_raw); + + packet.payload.putUnsignedShort(chan7_raw); + + packet.payload.putUnsignedShort(chan8_raw); + + packet.payload.putUnsignedShort(chan9_raw); + + packet.payload.putUnsignedShort(chan10_raw); + + packet.payload.putUnsignedShort(chan11_raw); + + packet.payload.putUnsignedShort(chan12_raw); + + packet.payload.putUnsignedByte(rssi); + + return packet; + } + + /** + * Decode a hil_rc_inputs_raw message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.chan1_raw = payload.getUnsignedShort(); + + this.chan2_raw = payload.getUnsignedShort(); + + this.chan3_raw = payload.getUnsignedShort(); + + this.chan4_raw = payload.getUnsignedShort(); + + this.chan5_raw = payload.getUnsignedShort(); + + this.chan6_raw = payload.getUnsignedShort(); + + this.chan7_raw = payload.getUnsignedShort(); + + this.chan8_raw = payload.getUnsignedShort(); + + this.chan9_raw = payload.getUnsignedShort(); + + this.chan10_raw = payload.getUnsignedShort(); + + this.chan11_raw = payload.getUnsignedShort(); + + this.chan12_raw = payload.getUnsignedShort(); + + this.rssi = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_hil_rc_inputs_raw() { + msgid = MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_hil_rc_inputs_raw(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " chan1_raw:" + chan1_raw + " chan2_raw:" + chan2_raw + " chan3_raw:" + chan3_raw + " chan4_raw:" + chan4_raw + " chan5_raw:" + chan5_raw + " chan6_raw:" + chan6_raw + " chan7_raw:" + chan7_raw + " chan8_raw:" + chan8_raw + " chan9_raw:" + chan9_raw + " chan10_raw:" + chan10_raw + " chan11_raw:" + chan11_raw + " chan12_raw:" + chan12_raw + " rssi:" + rssi + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_hil_sensor.java b/app/src/main/java/com/MAVLink/common/msg_hil_sensor.java new file mode 100644 index 0000000..35149f9 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_hil_sensor.java @@ -0,0 +1,210 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE HIL_SENSOR PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The IMU readings in SI units in NED body frame + */ +public class msg_hil_sensor extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_HIL_SENSOR = 107; + public static final int MAVLINK_MSG_LENGTH = 64; + private static final long serialVersionUID = MAVLINK_MSG_ID_HIL_SENSOR; + + + /** + * Timestamp (microseconds, synced to UNIX time or since system boot) + */ + public long time_usec; + + /** + * X acceleration (m/s^2) + */ + public float xacc; + + /** + * Y acceleration (m/s^2) + */ + public float yacc; + + /** + * Z acceleration (m/s^2) + */ + public float zacc; + + /** + * Angular speed around X axis in body frame (rad / sec) + */ + public float xgyro; + + /** + * Angular speed around Y axis in body frame (rad / sec) + */ + public float ygyro; + + /** + * Angular speed around Z axis in body frame (rad / sec) + */ + public float zgyro; + + /** + * X Magnetic field (Gauss) + */ + public float xmag; + + /** + * Y Magnetic field (Gauss) + */ + public float ymag; + + /** + * Z Magnetic field (Gauss) + */ + public float zmag; + + /** + * Absolute pressure in millibar + */ + public float abs_pressure; + + /** + * Differential pressure (airspeed) in millibar + */ + public float diff_pressure; + + /** + * Altitude calculated from pressure + */ + public float pressure_alt; + + /** + * Temperature in degrees celsius + */ + public float temperature; + + /** + * Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature, bit 31: full reset of attitude/position/velocities/etc was performed in sim. + */ + public long fields_updated; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_HIL_SENSOR; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putFloat(xacc); + + packet.payload.putFloat(yacc); + + packet.payload.putFloat(zacc); + + packet.payload.putFloat(xgyro); + + packet.payload.putFloat(ygyro); + + packet.payload.putFloat(zgyro); + + packet.payload.putFloat(xmag); + + packet.payload.putFloat(ymag); + + packet.payload.putFloat(zmag); + + packet.payload.putFloat(abs_pressure); + + packet.payload.putFloat(diff_pressure); + + packet.payload.putFloat(pressure_alt); + + packet.payload.putFloat(temperature); + + packet.payload.putUnsignedInt(fields_updated); + + return packet; + } + + /** + * Decode a hil_sensor message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.xacc = payload.getFloat(); + + this.yacc = payload.getFloat(); + + this.zacc = payload.getFloat(); + + this.xgyro = payload.getFloat(); + + this.ygyro = payload.getFloat(); + + this.zgyro = payload.getFloat(); + + this.xmag = payload.getFloat(); + + this.ymag = payload.getFloat(); + + this.zmag = payload.getFloat(); + + this.abs_pressure = payload.getFloat(); + + this.diff_pressure = payload.getFloat(); + + this.pressure_alt = payload.getFloat(); + + this.temperature = payload.getFloat(); + + this.fields_updated = payload.getUnsignedInt(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_hil_sensor() { + msgid = MAVLINK_MSG_ID_HIL_SENSOR; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_hil_sensor(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_HIL_SENSOR; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_HIL_SENSOR - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " xacc:" + xacc + " yacc:" + yacc + " zacc:" + zacc + " xgyro:" + xgyro + " ygyro:" + ygyro + " zgyro:" + zgyro + " xmag:" + xmag + " ymag:" + ymag + " zmag:" + zmag + " abs_pressure:" + abs_pressure + " diff_pressure:" + diff_pressure + " pressure_alt:" + pressure_alt + " temperature:" + temperature + " fields_updated:" + fields_updated + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_hil_state.java b/app/src/main/java/com/MAVLink/common/msg_hil_state.java new file mode 100644 index 0000000..c7e840c --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_hil_state.java @@ -0,0 +1,219 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE HIL_STATE PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * DEPRECATED PACKET! Suffers from missing airspeed fields and singularities due to Euler angles. Please use HIL_STATE_QUATERNION instead. Sent from simulation to autopilot. This packet is useful for high throughput applications such as hardware in the loop simulations. + */ +public class msg_hil_state extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_HIL_STATE = 90; + public static final int MAVLINK_MSG_LENGTH = 56; + private static final long serialVersionUID = MAVLINK_MSG_ID_HIL_STATE; + + + /** + * Timestamp (microseconds since UNIX epoch or microseconds since system boot) + */ + public long time_usec; + + /** + * Roll angle (rad) + */ + public float roll; + + /** + * Pitch angle (rad) + */ + public float pitch; + + /** + * Yaw angle (rad) + */ + public float yaw; + + /** + * Body frame roll / phi angular speed (rad/s) + */ + public float rollspeed; + + /** + * Body frame pitch / theta angular speed (rad/s) + */ + public float pitchspeed; + + /** + * Body frame yaw / psi angular speed (rad/s) + */ + public float yawspeed; + + /** + * Latitude, expressed as * 1E7 + */ + public int lat; + + /** + * Longitude, expressed as * 1E7 + */ + public int lon; + + /** + * Altitude in meters, expressed as * 1000 (millimeters) + */ + public int alt; + + /** + * Ground X Speed (Latitude), expressed as m/s * 100 + */ + public short vx; + + /** + * Ground Y Speed (Longitude), expressed as m/s * 100 + */ + public short vy; + + /** + * Ground Z Speed (Altitude), expressed as m/s * 100 + */ + public short vz; + + /** + * X acceleration (mg) + */ + public short xacc; + + /** + * Y acceleration (mg) + */ + public short yacc; + + /** + * Z acceleration (mg) + */ + public short zacc; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_HIL_STATE; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putFloat(roll); + + packet.payload.putFloat(pitch); + + packet.payload.putFloat(yaw); + + packet.payload.putFloat(rollspeed); + + packet.payload.putFloat(pitchspeed); + + packet.payload.putFloat(yawspeed); + + packet.payload.putInt(lat); + + packet.payload.putInt(lon); + + packet.payload.putInt(alt); + + packet.payload.putShort(vx); + + packet.payload.putShort(vy); + + packet.payload.putShort(vz); + + packet.payload.putShort(xacc); + + packet.payload.putShort(yacc); + + packet.payload.putShort(zacc); + + return packet; + } + + /** + * Decode a hil_state message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.roll = payload.getFloat(); + + this.pitch = payload.getFloat(); + + this.yaw = payload.getFloat(); + + this.rollspeed = payload.getFloat(); + + this.pitchspeed = payload.getFloat(); + + this.yawspeed = payload.getFloat(); + + this.lat = payload.getInt(); + + this.lon = payload.getInt(); + + this.alt = payload.getInt(); + + this.vx = payload.getShort(); + + this.vy = payload.getShort(); + + this.vz = payload.getShort(); + + this.xacc = payload.getShort(); + + this.yacc = payload.getShort(); + + this.zacc = payload.getShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_hil_state() { + msgid = MAVLINK_MSG_ID_HIL_STATE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_hil_state(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_HIL_STATE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_HIL_STATE - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " roll:" + roll + " pitch:" + pitch + " yaw:" + yaw + " rollspeed:" + rollspeed + " pitchspeed:" + pitchspeed + " yawspeed:" + yawspeed + " lat:" + lat + " lon:" + lon + " alt:" + alt + " vx:" + vx + " vy:" + vy + " vz:" + vz + " xacc:" + xacc + " yacc:" + yacc + " zacc:" + zacc + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_hil_state_quaternion.java b/app/src/main/java/com/MAVLink/common/msg_hil_state_quaternion.java new file mode 100644 index 0000000..58b657b --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_hil_state_quaternion.java @@ -0,0 +1,227 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE HIL_STATE_QUATERNION PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Sent from simulation to autopilot, avoids in contrast to HIL_STATE singularities. This packet is useful for high throughput applications such as hardware in the loop simulations. + */ +public class msg_hil_state_quaternion extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_HIL_STATE_QUATERNION = 115; + public static final int MAVLINK_MSG_LENGTH = 64; + private static final long serialVersionUID = MAVLINK_MSG_ID_HIL_STATE_QUATERNION; + + + /** + * Timestamp (microseconds since UNIX epoch or microseconds since system boot) + */ + public long time_usec; + + /** + * Vehicle attitude expressed as normalized quaternion in w, x, y, z order (with 1 0 0 0 being the null-rotation) + */ + public float attitude_quaternion[] = new float[4]; + + /** + * Body frame roll / phi angular speed (rad/s) + */ + public float rollspeed; + + /** + * Body frame pitch / theta angular speed (rad/s) + */ + public float pitchspeed; + + /** + * Body frame yaw / psi angular speed (rad/s) + */ + public float yawspeed; + + /** + * Latitude, expressed as * 1E7 + */ + public int lat; + + /** + * Longitude, expressed as * 1E7 + */ + public int lon; + + /** + * Altitude in meters, expressed as * 1000 (millimeters) + */ + public int alt; + + /** + * Ground X Speed (Latitude), expressed as cm/s + */ + public short vx; + + /** + * Ground Y Speed (Longitude), expressed as cm/s + */ + public short vy; + + /** + * Ground Z Speed (Altitude), expressed as cm/s + */ + public short vz; + + /** + * Indicated airspeed, expressed as cm/s + */ + public int ind_airspeed; + + /** + * True airspeed, expressed as cm/s + */ + public int true_airspeed; + + /** + * X acceleration (mg) + */ + public short xacc; + + /** + * Y acceleration (mg) + */ + public short yacc; + + /** + * Z acceleration (mg) + */ + public short zacc; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_HIL_STATE_QUATERNION; + + packet.payload.putUnsignedLong(time_usec); + + + for (int i = 0; i < attitude_quaternion.length; i++) { + packet.payload.putFloat(attitude_quaternion[i]); + } + + + packet.payload.putFloat(rollspeed); + + packet.payload.putFloat(pitchspeed); + + packet.payload.putFloat(yawspeed); + + packet.payload.putInt(lat); + + packet.payload.putInt(lon); + + packet.payload.putInt(alt); + + packet.payload.putShort(vx); + + packet.payload.putShort(vy); + + packet.payload.putShort(vz); + + packet.payload.putUnsignedShort(ind_airspeed); + + packet.payload.putUnsignedShort(true_airspeed); + + packet.payload.putShort(xacc); + + packet.payload.putShort(yacc); + + packet.payload.putShort(zacc); + + return packet; + } + + /** + * Decode a hil_state_quaternion message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + + for (int i = 0; i < this.attitude_quaternion.length; i++) { + this.attitude_quaternion[i] = payload.getFloat(); + } + + + this.rollspeed = payload.getFloat(); + + this.pitchspeed = payload.getFloat(); + + this.yawspeed = payload.getFloat(); + + this.lat = payload.getInt(); + + this.lon = payload.getInt(); + + this.alt = payload.getInt(); + + this.vx = payload.getShort(); + + this.vy = payload.getShort(); + + this.vz = payload.getShort(); + + this.ind_airspeed = payload.getUnsignedShort(); + + this.true_airspeed = payload.getUnsignedShort(); + + this.xacc = payload.getShort(); + + this.yacc = payload.getShort(); + + this.zacc = payload.getShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_hil_state_quaternion() { + msgid = MAVLINK_MSG_ID_HIL_STATE_QUATERNION; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_hil_state_quaternion(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_HIL_STATE_QUATERNION; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_HIL_STATE_QUATERNION - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " attitude_quaternion:" + attitude_quaternion + " rollspeed:" + rollspeed + " pitchspeed:" + pitchspeed + " yawspeed:" + yawspeed + " lat:" + lat + " lon:" + lon + " alt:" + alt + " vx:" + vx + " vy:" + vy + " vz:" + vz + " ind_airspeed:" + ind_airspeed + " true_airspeed:" + true_airspeed + " xacc:" + xacc + " yacc:" + yacc + " zacc:" + zacc + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_home_position.java b/app/src/main/java/com/MAVLink/common/msg_home_position.java new file mode 100644 index 0000000..3a90719 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_home_position.java @@ -0,0 +1,182 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE HOME_POSITION PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * This message can be requested by sending the MAV_CMD_GET_HOME_POSITION command. The position the system will return to and land on. The position is set automatically by the system during the takeoff in case it was not explicitely set by the operator before or after. The position the system will return to and land on. The global and local positions encode the position in the respective coordinate frames, while the q parameter encodes the orientation of the surface. Under normal conditions it describes the heading and terrain slope, which can be used by the aircraft to adjust the approach. The approach 3D vector describes the point to which the system should fly in normal flight mode and then perform a landing sequence along the vector. + */ +public class msg_home_position extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_HOME_POSITION = 242; + public static final int MAVLINK_MSG_LENGTH = 60; + private static final long serialVersionUID = MAVLINK_MSG_ID_HOME_POSITION; + + + /** + * Latitude (WGS84), in degrees * 1E7 + */ + public int latitude; + + /** + * Longitude (WGS84, in degrees * 1E7 + */ + public int longitude; + + /** + * Altitude (AMSL), in meters * 1000 (positive for up) + */ + public int altitude; + + /** + * Local X position of this position in the local coordinate frame + */ + public float x; + + /** + * Local Y position of this position in the local coordinate frame + */ + public float y; + + /** + * Local Z position of this position in the local coordinate frame + */ + public float z; + + /** + * World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground + */ + public float q[] = new float[4]; + + /** + * Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. + */ + public float approach_x; + + /** + * Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. + */ + public float approach_y; + + /** + * Local Z position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. + */ + public float approach_z; + + /** + * Timestamp (microseconds since UNIX epoch or microseconds since system boot) + */ + public long time_usec; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_HOME_POSITION; + + packet.payload.putInt(latitude); + + packet.payload.putInt(longitude); + + packet.payload.putInt(altitude); + + packet.payload.putFloat(x); + + packet.payload.putFloat(y); + + packet.payload.putFloat(z); + + + for (int i = 0; i < q.length; i++) { + packet.payload.putFloat(q[i]); + } + + + packet.payload.putFloat(approach_x); + + packet.payload.putFloat(approach_y); + + packet.payload.putFloat(approach_z); + + packet.payload.putUnsignedLong(time_usec); + + return packet; + } + + /** + * Decode a home_position message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.latitude = payload.getInt(); + + this.longitude = payload.getInt(); + + this.altitude = payload.getInt(); + + this.x = payload.getFloat(); + + this.y = payload.getFloat(); + + this.z = payload.getFloat(); + + + for (int i = 0; i < this.q.length; i++) { + this.q[i] = payload.getFloat(); + } + + + this.approach_x = payload.getFloat(); + + this.approach_y = payload.getFloat(); + + this.approach_z = payload.getFloat(); + + this.time_usec = payload.getUnsignedLong(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_home_position() { + msgid = MAVLINK_MSG_ID_HOME_POSITION; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_home_position(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_HOME_POSITION; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_HOME_POSITION - sysid:" + sysid + " compid:" + compid + " latitude:" + latitude + " longitude:" + longitude + " altitude:" + altitude + " x:" + x + " y:" + y + " z:" + z + " q:" + q + " approach_x:" + approach_x + " approach_y:" + approach_y + " approach_z:" + approach_z + " time_usec:" + time_usec + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_landing_target.java b/app/src/main/java/com/MAVLink/common/msg_landing_target.java new file mode 100644 index 0000000..7ba7c9e --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_landing_target.java @@ -0,0 +1,209 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE LANDING_TARGET PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The location of a landing area captured from a downward facing camera + */ +public class msg_landing_target extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_LANDING_TARGET = 149; + public static final int MAVLINK_MSG_LENGTH = 60; + private static final long serialVersionUID = MAVLINK_MSG_ID_LANDING_TARGET; + + + /** + * Timestamp (micros since boot or Unix epoch) + */ + public long time_usec; + + /** + * X-axis angular offset (in radians) of the target from the center of the image + */ + public float angle_x; + + /** + * Y-axis angular offset (in radians) of the target from the center of the image + */ + public float angle_y; + + /** + * Distance to the target from the vehicle in meters + */ + public float distance; + + /** + * Size in radians of target along x-axis + */ + public float size_x; + + /** + * Size in radians of target along y-axis + */ + public float size_y; + + /** + * The ID of the target if multiple targets are present + */ + public short target_num; + + /** + * MAV_FRAME enum specifying the whether the following feilds are earth-frame, body-frame, etc. + */ + public short frame; + + /** + * X Position of the landing target on MAV_FRAME + */ + public float x; + + /** + * Y Position of the landing target on MAV_FRAME + */ + public float y; + + /** + * Z Position of the landing target on MAV_FRAME + */ + public float z; + + /** + * Quaternion of landing target orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + */ + public float q[] = new float[4]; + + /** + * LANDING_TARGET_TYPE enum specifying the type of landing target + */ + public short type; + + /** + * Boolean indicating known position (1) or default unkown position (0), for validation of positioning of the landing target + */ + public short position_valid; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_LANDING_TARGET; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putFloat(angle_x); + + packet.payload.putFloat(angle_y); + + packet.payload.putFloat(distance); + + packet.payload.putFloat(size_x); + + packet.payload.putFloat(size_y); + + packet.payload.putUnsignedByte(target_num); + + packet.payload.putUnsignedByte(frame); + + packet.payload.putFloat(x); + + packet.payload.putFloat(y); + + packet.payload.putFloat(z); + + + for (int i = 0; i < q.length; i++) { + packet.payload.putFloat(q[i]); + } + + + packet.payload.putUnsignedByte(type); + + packet.payload.putUnsignedByte(position_valid); + + return packet; + } + + /** + * Decode a landing_target message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.angle_x = payload.getFloat(); + + this.angle_y = payload.getFloat(); + + this.distance = payload.getFloat(); + + this.size_x = payload.getFloat(); + + this.size_y = payload.getFloat(); + + this.target_num = payload.getUnsignedByte(); + + this.frame = payload.getUnsignedByte(); + + this.x = payload.getFloat(); + + this.y = payload.getFloat(); + + this.z = payload.getFloat(); + + + for (int i = 0; i < this.q.length; i++) { + this.q[i] = payload.getFloat(); + } + + + this.type = payload.getUnsignedByte(); + + this.position_valid = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_landing_target() { + msgid = MAVLINK_MSG_ID_LANDING_TARGET; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_landing_target(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_LANDING_TARGET; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_LANDING_TARGET - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " angle_x:" + angle_x + " angle_y:" + angle_y + " distance:" + distance + " size_x:" + size_x + " size_y:" + size_y + " target_num:" + target_num + " frame:" + frame + " x:" + x + " y:" + y + " z:" + z + " q:" + q + " type:" + type + " position_valid:" + position_valid + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_local_position_ned.java b/app/src/main/java/com/MAVLink/common/msg_local_position_ned.java new file mode 100644 index 0000000..bf9e7ee --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_local_position_ned.java @@ -0,0 +1,138 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE LOCAL_POSITION_NED PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The filtered local position (e.g. fused computer vision and accelerometers). Coordinate frame is right-handed, Z-axis down (aeronautical frame, NED / north-east-down convention) + */ +public class msg_local_position_ned extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_LOCAL_POSITION_NED = 32; + public static final int MAVLINK_MSG_LENGTH = 28; + private static final long serialVersionUID = MAVLINK_MSG_ID_LOCAL_POSITION_NED; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * X Position + */ + public float x; + + /** + * Y Position + */ + public float y; + + /** + * Z Position + */ + public float z; + + /** + * X Speed + */ + public float vx; + + /** + * Y Speed + */ + public float vy; + + /** + * Z Speed + */ + public float vz; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_LOCAL_POSITION_NED; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putFloat(x); + + packet.payload.putFloat(y); + + packet.payload.putFloat(z); + + packet.payload.putFloat(vx); + + packet.payload.putFloat(vy); + + packet.payload.putFloat(vz); + + return packet; + } + + /** + * Decode a local_position_ned message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.x = payload.getFloat(); + + this.y = payload.getFloat(); + + this.z = payload.getFloat(); + + this.vx = payload.getFloat(); + + this.vy = payload.getFloat(); + + this.vz = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_local_position_ned() { + msgid = MAVLINK_MSG_ID_LOCAL_POSITION_NED; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_local_position_ned(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_LOCAL_POSITION_NED; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_LOCAL_POSITION_NED - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " x:" + x + " y:" + y + " z:" + z + " vx:" + vx + " vy:" + vy + " vz:" + vz + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_local_position_ned_cov.java b/app/src/main/java/com/MAVLink/common/msg_local_position_ned_cov.java new file mode 100644 index 0000000..68d829d --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_local_position_ned_cov.java @@ -0,0 +1,191 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE LOCAL_POSITION_NED_COV PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The filtered local position (e.g. fused computer vision and accelerometers). Coordinate frame is right-handed, Z-axis down (aeronautical frame, NED / north-east-down convention) + */ +public class msg_local_position_ned_cov extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV = 64; + public static final int MAVLINK_MSG_LENGTH = 225; + private static final long serialVersionUID = MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV; + + + /** + * Timestamp (microseconds since system boot or since UNIX epoch) + */ + public long time_usec; + + /** + * X Position + */ + public float x; + + /** + * Y Position + */ + public float y; + + /** + * Z Position + */ + public float z; + + /** + * X Speed (m/s) + */ + public float vx; + + /** + * Y Speed (m/s) + */ + public float vy; + + /** + * Z Speed (m/s) + */ + public float vz; + + /** + * X Acceleration (m/s^2) + */ + public float ax; + + /** + * Y Acceleration (m/s^2) + */ + public float ay; + + /** + * Z Acceleration (m/s^2) + */ + public float az; + + /** + * Covariance matrix upper right triangular (first nine entries are the first ROW, next eight entries are the second row, etc.) + */ + public float covariance[] = new float[45]; + + /** + * Class id of the estimator this estimate originated from. + */ + public short estimator_type; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putFloat(x); + + packet.payload.putFloat(y); + + packet.payload.putFloat(z); + + packet.payload.putFloat(vx); + + packet.payload.putFloat(vy); + + packet.payload.putFloat(vz); + + packet.payload.putFloat(ax); + + packet.payload.putFloat(ay); + + packet.payload.putFloat(az); + + + for (int i = 0; i < covariance.length; i++) { + packet.payload.putFloat(covariance[i]); + } + + + packet.payload.putUnsignedByte(estimator_type); + + return packet; + } + + /** + * Decode a local_position_ned_cov message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.x = payload.getFloat(); + + this.y = payload.getFloat(); + + this.z = payload.getFloat(); + + this.vx = payload.getFloat(); + + this.vy = payload.getFloat(); + + this.vz = payload.getFloat(); + + this.ax = payload.getFloat(); + + this.ay = payload.getFloat(); + + this.az = payload.getFloat(); + + + for (int i = 0; i < this.covariance.length; i++) { + this.covariance[i] = payload.getFloat(); + } + + + this.estimator_type = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_local_position_ned_cov() { + msgid = MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_local_position_ned_cov(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " x:" + x + " y:" + y + " z:" + z + " vx:" + vx + " vy:" + vy + " vz:" + vz + " ax:" + ax + " ay:" + ay + " az:" + az + " covariance:" + covariance + " estimator_type:" + estimator_type + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_local_position_ned_system_global_offset.java b/app/src/main/java/com/MAVLink/common/msg_local_position_ned_system_global_offset.java new file mode 100644 index 0000000..436f60b --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_local_position_ned_system_global_offset.java @@ -0,0 +1,138 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The offset in X, Y, Z and yaw between the LOCAL_POSITION_NED messages of MAV X and the global coordinate frame in NED coordinates. Coordinate frame is right-handed, Z-axis down (aeronautical frame, NED / north-east-down convention) + */ +public class msg_local_position_ned_system_global_offset extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET = 89; + public static final int MAVLINK_MSG_LENGTH = 28; + private static final long serialVersionUID = MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * X Position + */ + public float x; + + /** + * Y Position + */ + public float y; + + /** + * Z Position + */ + public float z; + + /** + * Roll + */ + public float roll; + + /** + * Pitch + */ + public float pitch; + + /** + * Yaw + */ + public float yaw; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putFloat(x); + + packet.payload.putFloat(y); + + packet.payload.putFloat(z); + + packet.payload.putFloat(roll); + + packet.payload.putFloat(pitch); + + packet.payload.putFloat(yaw); + + return packet; + } + + /** + * Decode a local_position_ned_system_global_offset message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.x = payload.getFloat(); + + this.y = payload.getFloat(); + + this.z = payload.getFloat(); + + this.roll = payload.getFloat(); + + this.pitch = payload.getFloat(); + + this.yaw = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_local_position_ned_system_global_offset() { + msgid = MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_local_position_ned_system_global_offset(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " x:" + x + " y:" + y + " z:" + z + " roll:" + roll + " pitch:" + pitch + " yaw:" + yaw + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_log_data.java b/app/src/main/java/com/MAVLink/common/msg_log_data.java new file mode 100644 index 0000000..97eb68e --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_log_data.java @@ -0,0 +1,119 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE LOG_DATA PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Reply to LOG_REQUEST_DATA + */ +public class msg_log_data extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_LOG_DATA = 120; + public static final int MAVLINK_MSG_LENGTH = 97; + private static final long serialVersionUID = MAVLINK_MSG_ID_LOG_DATA; + + + /** + * Offset into the log + */ + public long ofs; + + /** + * Log id (from LOG_ENTRY reply) + */ + public int id; + + /** + * Number of bytes (zero for end of log) + */ + public short count; + + /** + * log data + */ + public short data[] = new short[90]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_LOG_DATA; + + packet.payload.putUnsignedInt(ofs); + + packet.payload.putUnsignedShort(id); + + packet.payload.putUnsignedByte(count); + + + for (int i = 0; i < data.length; i++) { + packet.payload.putUnsignedByte(data[i]); + } + + + return packet; + } + + /** + * Decode a log_data message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.ofs = payload.getUnsignedInt(); + + this.id = payload.getUnsignedShort(); + + this.count = payload.getUnsignedByte(); + + + for (int i = 0; i < this.data.length; i++) { + this.data[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_log_data() { + msgid = MAVLINK_MSG_ID_LOG_DATA; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_log_data(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_LOG_DATA; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_LOG_DATA - sysid:" + sysid + " compid:" + compid + " ofs:" + ofs + " id:" + id + " count:" + count + " data:" + data + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_log_entry.java b/app/src/main/java/com/MAVLink/common/msg_log_entry.java new file mode 100644 index 0000000..dfaf5f7 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_log_entry.java @@ -0,0 +1,120 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE LOG_ENTRY PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Reply to LOG_REQUEST_LIST + */ +public class msg_log_entry extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_LOG_ENTRY = 118; + public static final int MAVLINK_MSG_LENGTH = 14; + private static final long serialVersionUID = MAVLINK_MSG_ID_LOG_ENTRY; + + + /** + * UTC timestamp of log in seconds since 1970, or 0 if not available + */ + public long time_utc; + + /** + * Size of the log (may be approximate) in bytes + */ + public long size; + + /** + * Log id + */ + public int id; + + /** + * Total number of logs + */ + public int num_logs; + + /** + * High log number + */ + public int last_log_num; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_LOG_ENTRY; + + packet.payload.putUnsignedInt(time_utc); + + packet.payload.putUnsignedInt(size); + + packet.payload.putUnsignedShort(id); + + packet.payload.putUnsignedShort(num_logs); + + packet.payload.putUnsignedShort(last_log_num); + + return packet; + } + + /** + * Decode a log_entry message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_utc = payload.getUnsignedInt(); + + this.size = payload.getUnsignedInt(); + + this.id = payload.getUnsignedShort(); + + this.num_logs = payload.getUnsignedShort(); + + this.last_log_num = payload.getUnsignedShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_log_entry() { + msgid = MAVLINK_MSG_ID_LOG_ENTRY; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_log_entry(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_LOG_ENTRY; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_LOG_ENTRY - sysid:" + sysid + " compid:" + compid + " time_utc:" + time_utc + " size:" + size + " id:" + id + " num_logs:" + num_logs + " last_log_num:" + last_log_num + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_log_erase.java b/app/src/main/java/com/MAVLink/common/msg_log_erase.java new file mode 100644 index 0000000..fcd6217 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_log_erase.java @@ -0,0 +1,93 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE LOG_ERASE PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Erase all logs + */ +public class msg_log_erase extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_LOG_ERASE = 121; + public static final int MAVLINK_MSG_LENGTH = 2; + private static final long serialVersionUID = MAVLINK_MSG_ID_LOG_ERASE; + + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_LOG_ERASE; + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + return packet; + } + + /** + * Decode a log_erase message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_log_erase() { + msgid = MAVLINK_MSG_ID_LOG_ERASE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_log_erase(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_LOG_ERASE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_LOG_ERASE - sysid:" + sysid + " compid:" + compid + " target_system:" + target_system + " target_component:" + target_component + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_log_request_data.java b/app/src/main/java/com/MAVLink/common/msg_log_request_data.java new file mode 100644 index 0000000..c0fdac6 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_log_request_data.java @@ -0,0 +1,120 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE LOG_REQUEST_DATA PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Request a chunk of a log + */ +public class msg_log_request_data extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_LOG_REQUEST_DATA = 119; + public static final int MAVLINK_MSG_LENGTH = 12; + private static final long serialVersionUID = MAVLINK_MSG_ID_LOG_REQUEST_DATA; + + + /** + * Offset into the log + */ + public long ofs; + + /** + * Number of bytes + */ + public long count; + + /** + * Log id (from LOG_ENTRY reply) + */ + public int id; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_LOG_REQUEST_DATA; + + packet.payload.putUnsignedInt(ofs); + + packet.payload.putUnsignedInt(count); + + packet.payload.putUnsignedShort(id); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + return packet; + } + + /** + * Decode a log_request_data message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.ofs = payload.getUnsignedInt(); + + this.count = payload.getUnsignedInt(); + + this.id = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_log_request_data() { + msgid = MAVLINK_MSG_ID_LOG_REQUEST_DATA; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_log_request_data(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_LOG_REQUEST_DATA; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_LOG_REQUEST_DATA - sysid:" + sysid + " compid:" + compid + " ofs:" + ofs + " count:" + count + " id:" + id + " target_system:" + target_system + " target_component:" + target_component + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_log_request_end.java b/app/src/main/java/com/MAVLink/common/msg_log_request_end.java new file mode 100644 index 0000000..6f585b0 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_log_request_end.java @@ -0,0 +1,93 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE LOG_REQUEST_END PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Stop log transfer and resume normal logging + */ +public class msg_log_request_end extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_LOG_REQUEST_END = 122; + public static final int MAVLINK_MSG_LENGTH = 2; + private static final long serialVersionUID = MAVLINK_MSG_ID_LOG_REQUEST_END; + + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_LOG_REQUEST_END; + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + return packet; + } + + /** + * Decode a log_request_end message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_log_request_end() { + msgid = MAVLINK_MSG_ID_LOG_REQUEST_END; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_log_request_end(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_LOG_REQUEST_END; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_LOG_REQUEST_END - sysid:" + sysid + " compid:" + compid + " target_system:" + target_system + " target_component:" + target_component + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_log_request_list.java b/app/src/main/java/com/MAVLink/common/msg_log_request_list.java new file mode 100644 index 0000000..1ac9544 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_log_request_list.java @@ -0,0 +1,111 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE LOG_REQUEST_LIST PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Request a list of available logs. On some systems calling this may stop on-board logging until LOG_REQUEST_END is called. + */ +public class msg_log_request_list extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_LOG_REQUEST_LIST = 117; + public static final int MAVLINK_MSG_LENGTH = 6; + private static final long serialVersionUID = MAVLINK_MSG_ID_LOG_REQUEST_LIST; + + + /** + * First log id (0 for first available) + */ + public int start; + + /** + * Last log id (0xffff for last available) + */ + public int end; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_LOG_REQUEST_LIST; + + packet.payload.putUnsignedShort(start); + + packet.payload.putUnsignedShort(end); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + return packet; + } + + /** + * Decode a log_request_list message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.start = payload.getUnsignedShort(); + + this.end = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_log_request_list() { + msgid = MAVLINK_MSG_ID_LOG_REQUEST_LIST; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_log_request_list(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_LOG_REQUEST_LIST; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_LOG_REQUEST_LIST - sysid:" + sysid + " compid:" + compid + " start:" + start + " end:" + end + " target_system:" + target_system + " target_component:" + target_component + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_logging_ack.java b/app/src/main/java/com/MAVLink/common/msg_logging_ack.java new file mode 100644 index 0000000..4aa2671 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_logging_ack.java @@ -0,0 +1,102 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE LOGGING_ACK PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * An ack for a LOGGING_DATA_ACKED message + */ +public class msg_logging_ack extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_LOGGING_ACK = 268; + public static final int MAVLINK_MSG_LENGTH = 4; + private static final long serialVersionUID = MAVLINK_MSG_ID_LOGGING_ACK; + + + /** + * sequence number (must match the one in LOGGING_DATA_ACKED) + */ + public int sequence; + + /** + * system ID of the target + */ + public short target_system; + + /** + * component ID of the target + */ + public short target_component; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_LOGGING_ACK; + + packet.payload.putUnsignedShort(sequence); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + return packet; + } + + /** + * Decode a logging_ack message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.sequence = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_logging_ack() { + msgid = MAVLINK_MSG_ID_LOGGING_ACK; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_logging_ack(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_LOGGING_ACK; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_LOGGING_ACK - sysid:" + sysid + " compid:" + compid + " sequence:" + sequence + " target_system:" + target_system + " target_component:" + target_component + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_logging_data.java b/app/src/main/java/com/MAVLink/common/msg_logging_data.java new file mode 100644 index 0000000..a999fdc --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_logging_data.java @@ -0,0 +1,137 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE LOGGING_DATA PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * A message containing logged data (see also MAV_CMD_LOGGING_START) + */ +public class msg_logging_data extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_LOGGING_DATA = 266; + public static final int MAVLINK_MSG_LENGTH = 255; + private static final long serialVersionUID = MAVLINK_MSG_ID_LOGGING_DATA; + + + /** + * sequence number (can wrap) + */ + public int sequence; + + /** + * system ID of the target + */ + public short target_system; + + /** + * component ID of the target + */ + public short target_component; + + /** + * data length + */ + public short length; + + /** + * offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to 255 if no start exists). + */ + public short first_message_offset; + + /** + * logged data + */ + public short data[] = new short[249]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_LOGGING_DATA; + + packet.payload.putUnsignedShort(sequence); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(length); + + packet.payload.putUnsignedByte(first_message_offset); + + + for (int i = 0; i < data.length; i++) { + packet.payload.putUnsignedByte(data[i]); + } + + + return packet; + } + + /** + * Decode a logging_data message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.sequence = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.length = payload.getUnsignedByte(); + + this.first_message_offset = payload.getUnsignedByte(); + + + for (int i = 0; i < this.data.length; i++) { + this.data[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_logging_data() { + msgid = MAVLINK_MSG_ID_LOGGING_DATA; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_logging_data(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_LOGGING_DATA; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_LOGGING_DATA - sysid:" + sysid + " compid:" + compid + " sequence:" + sequence + " target_system:" + target_system + " target_component:" + target_component + " length:" + length + " first_message_offset:" + first_message_offset + " data:" + data + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_logging_data_acked.java b/app/src/main/java/com/MAVLink/common/msg_logging_data_acked.java new file mode 100644 index 0000000..9a71bd4 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_logging_data_acked.java @@ -0,0 +1,137 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE LOGGING_DATA_ACKED PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * A message containing logged data which requires a LOGGING_ACK to be sent back + */ +public class msg_logging_data_acked extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_LOGGING_DATA_ACKED = 267; + public static final int MAVLINK_MSG_LENGTH = 255; + private static final long serialVersionUID = MAVLINK_MSG_ID_LOGGING_DATA_ACKED; + + + /** + * sequence number (can wrap) + */ + public int sequence; + + /** + * system ID of the target + */ + public short target_system; + + /** + * component ID of the target + */ + public short target_component; + + /** + * data length + */ + public short length; + + /** + * offset into data where first message starts. This can be used for recovery, when a previous message got lost (set to 255 if no start exists). + */ + public short first_message_offset; + + /** + * logged data + */ + public short data[] = new short[249]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_LOGGING_DATA_ACKED; + + packet.payload.putUnsignedShort(sequence); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(length); + + packet.payload.putUnsignedByte(first_message_offset); + + + for (int i = 0; i < data.length; i++) { + packet.payload.putUnsignedByte(data[i]); + } + + + return packet; + } + + /** + * Decode a logging_data_acked message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.sequence = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.length = payload.getUnsignedByte(); + + this.first_message_offset = payload.getUnsignedByte(); + + + for (int i = 0; i < this.data.length; i++) { + this.data[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_logging_data_acked() { + msgid = MAVLINK_MSG_ID_LOGGING_DATA_ACKED; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_logging_data_acked(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_LOGGING_DATA_ACKED; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_LOGGING_DATA_ACKED - sysid:" + sysid + " compid:" + compid + " sequence:" + sequence + " target_system:" + target_system + " target_component:" + target_component + " length:" + length + " first_message_offset:" + first_message_offset + " data:" + data + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_manual_control.java b/app/src/main/java/com/MAVLink/common/msg_manual_control.java new file mode 100644 index 0000000..40a22db --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_manual_control.java @@ -0,0 +1,129 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MANUAL_CONTROL PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * This message provides an API for manually controlling the vehicle using standard joystick axes nomenclature, along with a joystick-like input device. Unused axes can be disabled an buttons are also transmit as boolean values of their + */ +public class msg_manual_control extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MANUAL_CONTROL = 69; + public static final int MAVLINK_MSG_LENGTH = 11; + private static final long serialVersionUID = MAVLINK_MSG_ID_MANUAL_CONTROL; + + + /** + * X-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to forward(1000)-backward(-1000) movement on a joystick and the pitch of a vehicle. + */ + public short x; + + /** + * Y-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to left(-1000)-right(1000) movement on a joystick and the roll of a vehicle. + */ + public short y; + + /** + * Z-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a separate slider movement with maximum being 1000 and minimum being -1000 on a joystick and the thrust of a vehicle. Positive values are positive thrust, negative values are negative thrust. + */ + public short z; + + /** + * R-axis, normalized to the range [-1000,1000]. A value of INT16_MAX indicates that this axis is invalid. Generally corresponds to a twisting of the joystick, with counter-clockwise being 1000 and clockwise being -1000, and the yaw of a vehicle. + */ + public short r; + + /** + * A bitfield corresponding to the joystick buttons' current state, 1 for pressed, 0 for released. The lowest bit corresponds to Button 1. + */ + public int buttons; + + /** + * The system to be controlled. + */ + public short target; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MANUAL_CONTROL; + + packet.payload.putShort(x); + + packet.payload.putShort(y); + + packet.payload.putShort(z); + + packet.payload.putShort(r); + + packet.payload.putUnsignedShort(buttons); + + packet.payload.putUnsignedByte(target); + + return packet; + } + + /** + * Decode a manual_control message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.x = payload.getShort(); + + this.y = payload.getShort(); + + this.z = payload.getShort(); + + this.r = payload.getShort(); + + this.buttons = payload.getUnsignedShort(); + + this.target = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_manual_control() { + msgid = MAVLINK_MSG_ID_MANUAL_CONTROL; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_manual_control(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MANUAL_CONTROL; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MANUAL_CONTROL - sysid:" + sysid + " compid:" + compid + " x:" + x + " y:" + y + " z:" + z + " r:" + r + " buttons:" + buttons + " target:" + target + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_manual_setpoint.java b/app/src/main/java/com/MAVLink/common/msg_manual_setpoint.java new file mode 100644 index 0000000..da19d9e --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_manual_setpoint.java @@ -0,0 +1,138 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MANUAL_SETPOINT PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Setpoint in roll, pitch, yaw and thrust from the operator + */ +public class msg_manual_setpoint extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MANUAL_SETPOINT = 81; + public static final int MAVLINK_MSG_LENGTH = 22; + private static final long serialVersionUID = MAVLINK_MSG_ID_MANUAL_SETPOINT; + + + /** + * Timestamp in milliseconds since system boot + */ + public long time_boot_ms; + + /** + * Desired roll rate in radians per second + */ + public float roll; + + /** + * Desired pitch rate in radians per second + */ + public float pitch; + + /** + * Desired yaw rate in radians per second + */ + public float yaw; + + /** + * Collective thrust, normalized to 0 .. 1 + */ + public float thrust; + + /** + * Flight mode switch position, 0.. 255 + */ + public short mode_switch; + + /** + * Override mode switch position, 0.. 255 + */ + public short manual_override_switch; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MANUAL_SETPOINT; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putFloat(roll); + + packet.payload.putFloat(pitch); + + packet.payload.putFloat(yaw); + + packet.payload.putFloat(thrust); + + packet.payload.putUnsignedByte(mode_switch); + + packet.payload.putUnsignedByte(manual_override_switch); + + return packet; + } + + /** + * Decode a manual_setpoint message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.roll = payload.getFloat(); + + this.pitch = payload.getFloat(); + + this.yaw = payload.getFloat(); + + this.thrust = payload.getFloat(); + + this.mode_switch = payload.getUnsignedByte(); + + this.manual_override_switch = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_manual_setpoint() { + msgid = MAVLINK_MSG_ID_MANUAL_SETPOINT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_manual_setpoint(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MANUAL_SETPOINT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MANUAL_SETPOINT - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " roll:" + roll + " pitch:" + pitch + " yaw:" + yaw + " thrust:" + thrust + " mode_switch:" + mode_switch + " manual_override_switch:" + manual_override_switch + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_memory_vect.java b/app/src/main/java/com/MAVLink/common/msg_memory_vect.java new file mode 100644 index 0000000..c5bc3e1 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_memory_vect.java @@ -0,0 +1,119 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MEMORY_VECT PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Send raw controller memory. The use of this message is discouraged for normal packets, but a quite efficient way for testing new messages and getting experimental debug output. + */ +public class msg_memory_vect extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MEMORY_VECT = 249; + public static final int MAVLINK_MSG_LENGTH = 36; + private static final long serialVersionUID = MAVLINK_MSG_ID_MEMORY_VECT; + + + /** + * Starting address of the debug variables + */ + public int address; + + /** + * Version code of the type variable. 0=unknown, type ignored and assumed int16_t. 1=as below + */ + public short ver; + + /** + * Type code of the memory variables. for ver = 1: 0=16 x int16_t, 1=16 x uint16_t, 2=16 x Q15, 3=16 x 1Q14 + */ + public short type; + + /** + * Memory contents at specified address + */ + public byte value[] = new byte[32]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MEMORY_VECT; + + packet.payload.putUnsignedShort(address); + + packet.payload.putUnsignedByte(ver); + + packet.payload.putUnsignedByte(type); + + + for (int i = 0; i < value.length; i++) { + packet.payload.putByte(value[i]); + } + + + return packet; + } + + /** + * Decode a memory_vect message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.address = payload.getUnsignedShort(); + + this.ver = payload.getUnsignedByte(); + + this.type = payload.getUnsignedByte(); + + + for (int i = 0; i < this.value.length; i++) { + this.value[i] = payload.getByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_memory_vect() { + msgid = MAVLINK_MSG_ID_MEMORY_VECT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_memory_vect(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MEMORY_VECT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MEMORY_VECT - sysid:" + sysid + " compid:" + compid + " address:" + address + " ver:" + ver + " type:" + type + " value:" + value + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_message_interval.java b/app/src/main/java/com/MAVLink/common/msg_message_interval.java new file mode 100644 index 0000000..768553d --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_message_interval.java @@ -0,0 +1,93 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MESSAGE_INTERVAL PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * This interface replaces DATA_STREAM + */ +public class msg_message_interval extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MESSAGE_INTERVAL = 244; + public static final int MAVLINK_MSG_LENGTH = 6; + private static final long serialVersionUID = MAVLINK_MSG_ID_MESSAGE_INTERVAL; + + + /** + * The interval between two messages, in microseconds. A value of -1 indicates this stream is disabled, 0 indicates it is not available, > 0 indicates the interval at which it is sent. + */ + public int interval_us; + + /** + * The ID of the requested MAVLink message. v1.0 is limited to 254 messages. + */ + public int message_id; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MESSAGE_INTERVAL; + + packet.payload.putInt(interval_us); + + packet.payload.putUnsignedShort(message_id); + + return packet; + } + + /** + * Decode a message_interval message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.interval_us = payload.getInt(); + + this.message_id = payload.getUnsignedShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_message_interval() { + msgid = MAVLINK_MSG_ID_MESSAGE_INTERVAL; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_message_interval(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MESSAGE_INTERVAL; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MESSAGE_INTERVAL - sysid:" + sysid + " compid:" + compid + " interval_us:" + interval_us + " message_id:" + message_id + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_mission_ack.java b/app/src/main/java/com/MAVLink/common/msg_mission_ack.java new file mode 100644 index 0000000..df34793 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_mission_ack.java @@ -0,0 +1,113 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MISSION_ACK PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; +import com.MAVLink.enums.MAV_MISSION_TYPE; + +/** + * Ack message during MISSION handling. The type field states if this message is a positive ack (type=0) or if an error happened (type=non-zero). + */ +public class msg_mission_ack extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MISSION_ACK = 47; + public static final int MAVLINK_MSG_LENGTH = 4; + private static final long serialVersionUID = MAVLINK_MSG_ID_MISSION_ACK; + + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * See MAV_MISSION_RESULT enum + */ + public short type; + + /** + * Mission type, see MAV_MISSION_TYPE + */ + public short mission_type; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MISSION_ACK; + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(type); + + packet.payload.putUnsignedByte(mission_type); + + return packet; + } + + /** + * Decode a mission_ack message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.type = payload.getUnsignedByte(); + + //this.mission_type = payload.getUnsignedByte(); + this.mission_type = MAV_MISSION_TYPE.MAV_MISSION_TYPE_MISSION; + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_mission_ack() { + msgid = MAVLINK_MSG_ID_MISSION_ACK; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_mission_ack(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MISSION_ACK; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MISSION_ACK - sysid:" + sysid + " compid:" + compid + " target_system:" + target_system + " target_component:" + target_component + " type:" + type + " mission_type:" + mission_type + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_mission_clear_all.java b/app/src/main/java/com/MAVLink/common/msg_mission_clear_all.java new file mode 100644 index 0000000..8b6cc00 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_mission_clear_all.java @@ -0,0 +1,102 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MISSION_CLEAR_ALL PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Delete all mission items at once. + */ +public class msg_mission_clear_all extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MISSION_CLEAR_ALL = 45; + public static final int MAVLINK_MSG_LENGTH = 3; + private static final long serialVersionUID = MAVLINK_MSG_ID_MISSION_CLEAR_ALL; + + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * Mission type, see MAV_MISSION_TYPE + */ + public short mission_type; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MISSION_CLEAR_ALL; + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(mission_type); + + return packet; + } + + /** + * Decode a mission_clear_all message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.mission_type = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_mission_clear_all() { + msgid = MAVLINK_MSG_ID_MISSION_CLEAR_ALL; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_mission_clear_all(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MISSION_CLEAR_ALL; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MISSION_CLEAR_ALL - sysid:" + sysid + " compid:" + compid + " target_system:" + target_system + " target_component:" + target_component + " mission_type:" + mission_type + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_mission_count.java b/app/src/main/java/com/MAVLink/common/msg_mission_count.java new file mode 100644 index 0000000..1bac98d --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_mission_count.java @@ -0,0 +1,112 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MISSION_COUNT PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; +import com.MAVLink.enums.MAV_MISSION_TYPE; + +/** + * This message is emitted as response to MISSION_REQUEST_LIST by the MAV and to initiate a write transaction. The GCS can then request the individual mission item based on the knowledge of the total number of MISSIONs. + */ +public class msg_mission_count extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MISSION_COUNT = 44; + public static final int MAVLINK_MSG_LENGTH = 5; + private static final long serialVersionUID = MAVLINK_MSG_ID_MISSION_COUNT; + + + /** + * Number of mission items in the sequence + */ + public int count; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * Mission type, see MAV_MISSION_TYPE + */ + public short mission_type; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MISSION_COUNT; + + packet.payload.putUnsignedShort(count); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(mission_type); + + return packet; + } + + /** + * Decode a mission_count message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.count = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + //this.mission_type = payload.getUnsignedByte(); + this.mission_type = MAV_MISSION_TYPE.MAV_MISSION_TYPE_MISSION; + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_mission_count() { + msgid = MAVLINK_MSG_ID_MISSION_COUNT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_mission_count(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MISSION_COUNT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MISSION_COUNT - sysid:" + sysid + " compid:" + compid + " count:" + count + " target_system:" + target_system + " target_component:" + target_component + " mission_type:" + mission_type + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_mission_current.java b/app/src/main/java/com/MAVLink/common/msg_mission_current.java new file mode 100644 index 0000000..3bf2c9e --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_mission_current.java @@ -0,0 +1,84 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MISSION_CURRENT PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Message that announces the sequence number of the current active mission item. The MAV will fly towards this mission item. + */ +public class msg_mission_current extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MISSION_CURRENT = 42; + public static final int MAVLINK_MSG_LENGTH = 2; + private static final long serialVersionUID = MAVLINK_MSG_ID_MISSION_CURRENT; + + + /** + * Sequence + */ + public int seq; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MISSION_CURRENT; + + packet.payload.putUnsignedShort(seq); + + return packet; + } + + /** + * Decode a mission_current message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.seq = payload.getUnsignedShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_mission_current() { + msgid = MAVLINK_MSG_ID_MISSION_CURRENT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_mission_current(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MISSION_CURRENT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MISSION_CURRENT - sysid:" + sysid + " compid:" + compid + " seq:" + seq + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_mission_item.java b/app/src/main/java/com/MAVLink/common/msg_mission_item.java new file mode 100644 index 0000000..91a9539 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_mission_item.java @@ -0,0 +1,213 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MISSION_ITEM PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; +import com.MAVLink.enums.MAV_MISSION_TYPE; + +/** + * Message encoding a mission item. This message is emitted to announce + * the presence of a mission item and to set a mission item on the system. The mission item can be either in x, y, z meters (type: LOCAL) or x:lat, y:lon, z:altitude. Local frame is Z-down, right handed (NED), global frame is Z-up, right handed (ENU). See also http://qgroundcontrol.org/mavlink/waypoint_protocol. + */ +public class msg_mission_item extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MISSION_ITEM = 39; + public static final int MAVLINK_MSG_LENGTH = 38; + private static final long serialVersionUID = MAVLINK_MSG_ID_MISSION_ITEM; + + + /** + * PARAM1, see MAV_CMD enum + */ + public float param1; + + /** + * PARAM2, see MAV_CMD enum + */ + public float param2; + + /** + * PARAM3, see MAV_CMD enum + */ + public float param3; + + /** + * PARAM4, see MAV_CMD enum + */ + public float param4; + + /** + * PARAM5 / local: x position, global: latitude + */ + public float x; + + /** + * PARAM6 / y position: global: longitude + */ + public float y; + + /** + * PARAM7 / z position: global: altitude (relative or absolute, depending on frame. + */ + public float z; + + /** + * Sequence + */ + public int seq; + + /** + * The scheduled action for the MISSION. see MAV_CMD in common.xml MAVLink specs + */ + public int command; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * The coordinate system of the MISSION. see MAV_FRAME in mavlink_types.h + */ + public short frame; + + /** + * false:0, true:1 + */ + public short current; + + /** + * autocontinue to next wp + */ + public short autocontinue; + + /** + * Mission type, see MAV_MISSION_TYPE + */ + public short mission_type; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MISSION_ITEM; + + packet.payload.putFloat(param1); + + packet.payload.putFloat(param2); + + packet.payload.putFloat(param3); + + packet.payload.putFloat(param4); + + packet.payload.putFloat(x); + + packet.payload.putFloat(y); + + packet.payload.putFloat(z); + + packet.payload.putUnsignedShort(seq); + + packet.payload.putUnsignedShort(command); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(frame); + + packet.payload.putUnsignedByte(current); + + packet.payload.putUnsignedByte(autocontinue); + + packet.payload.putUnsignedByte(mission_type); + + return packet; + } + + /** + * Decode a mission_item message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.param1 = payload.getFloat(); + + this.param2 = payload.getFloat(); + + this.param3 = payload.getFloat(); + + this.param4 = payload.getFloat(); + + this.x = payload.getFloat(); + + this.y = payload.getFloat(); + + this.z = payload.getFloat(); + + this.seq = payload.getUnsignedShort(); + + this.command = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.frame = payload.getUnsignedByte(); + + this.current = payload.getUnsignedByte(); + + this.autocontinue = payload.getUnsignedByte(); + + //this.mission_type = payload.getUnsignedByte(); + this.mission_type = MAV_MISSION_TYPE.MAV_MISSION_TYPE_MISSION; + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_mission_item() { + msgid = MAVLINK_MSG_ID_MISSION_ITEM; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_mission_item(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MISSION_ITEM; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MISSION_ITEM - sysid:" + sysid + " compid:" + compid + " param1:" + param1 + " param2:" + param2 + " param3:" + param3 + " param4:" + param4 + " x:" + x + " y:" + y + " z:" + z + " seq:" + seq + " command:" + command + " target_system:" + target_system + " target_component:" + target_component + " frame:" + frame + " current:" + current + " autocontinue:" + autocontinue + " mission_type:" + mission_type + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_mission_item_int.java b/app/src/main/java/com/MAVLink/common/msg_mission_item_int.java new file mode 100644 index 0000000..432dd23 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_mission_item_int.java @@ -0,0 +1,211 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MISSION_ITEM_INT PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Message encoding a mission item. This message is emitted to announce + * the presence of a mission item and to set a mission item on the system. The mission item can be either in x, y, z meters (type: LOCAL) or x:lat, y:lon, z:altitude. Local frame is Z-down, right handed (NED), global frame is Z-up, right handed (ENU). See alsohttp://qgroundcontrol.org/mavlink/waypoint_protocol. + */ +public class msg_mission_item_int extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MISSION_ITEM_INT = 73; + public static final int MAVLINK_MSG_LENGTH = 38; + private static final long serialVersionUID = MAVLINK_MSG_ID_MISSION_ITEM_INT; + + + /** + * PARAM1, see MAV_CMD enum + */ + public float param1; + + /** + * PARAM2, see MAV_CMD enum + */ + public float param2; + + /** + * PARAM3, see MAV_CMD enum + */ + public float param3; + + /** + * PARAM4, see MAV_CMD enum + */ + public float param4; + + /** + * PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7 + */ + public int x; + + /** + * PARAM6 / y position: local: x position in meters * 1e4, global: longitude in degrees *10^7 + */ + public int y; + + /** + * PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame. + */ + public float z; + + /** + * Waypoint ID (sequence number). Starts at zero. Increases monotonically for each waypoint, no gaps in the sequence (0,1,2,3,4). + */ + public int seq; + + /** + * The scheduled action for the MISSION. see MAV_CMD in common.xml MAVLink specs + */ + public int command; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * The coordinate system of the MISSION. see MAV_FRAME in mavlink_types.h + */ + public short frame; + + /** + * false:0, true:1 + */ + public short current; + + /** + * autocontinue to next wp + */ + public short autocontinue; + + /** + * Mission type, see MAV_MISSION_TYPE + */ + public short mission_type; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MISSION_ITEM_INT; + + packet.payload.putFloat(param1); + + packet.payload.putFloat(param2); + + packet.payload.putFloat(param3); + + packet.payload.putFloat(param4); + + packet.payload.putInt(x); + + packet.payload.putInt(y); + + packet.payload.putFloat(z); + + packet.payload.putUnsignedShort(seq); + + packet.payload.putUnsignedShort(command); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(frame); + + packet.payload.putUnsignedByte(current); + + packet.payload.putUnsignedByte(autocontinue); + + packet.payload.putUnsignedByte(mission_type); + + return packet; + } + + /** + * Decode a mission_item_int message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.param1 = payload.getFloat(); + + this.param2 = payload.getFloat(); + + this.param3 = payload.getFloat(); + + this.param4 = payload.getFloat(); + + this.x = payload.getInt(); + + this.y = payload.getInt(); + + this.z = payload.getFloat(); + + this.seq = payload.getUnsignedShort(); + + this.command = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.frame = payload.getUnsignedByte(); + + this.current = payload.getUnsignedByte(); + + this.autocontinue = payload.getUnsignedByte(); + + this.mission_type = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_mission_item_int() { + msgid = MAVLINK_MSG_ID_MISSION_ITEM_INT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_mission_item_int(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MISSION_ITEM_INT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MISSION_ITEM_INT - sysid:" + sysid + " compid:" + compid + " param1:" + param1 + " param2:" + param2 + " param3:" + param3 + " param4:" + param4 + " x:" + x + " y:" + y + " z:" + z + " seq:" + seq + " command:" + command + " target_system:" + target_system + " target_component:" + target_component + " frame:" + frame + " current:" + current + " autocontinue:" + autocontinue + " mission_type:" + mission_type + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_mission_item_reached.java b/app/src/main/java/com/MAVLink/common/msg_mission_item_reached.java new file mode 100644 index 0000000..20c7ab9 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_mission_item_reached.java @@ -0,0 +1,84 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MISSION_ITEM_REACHED PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * A certain mission item has been reached. The system will either hold this position (or circle on the orbit) or (if the autocontinue on the WP was set) continue to the next MISSION. + */ +public class msg_mission_item_reached extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MISSION_ITEM_REACHED = 46; + public static final int MAVLINK_MSG_LENGTH = 2; + private static final long serialVersionUID = MAVLINK_MSG_ID_MISSION_ITEM_REACHED; + + + /** + * Sequence + */ + public int seq; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MISSION_ITEM_REACHED; + + packet.payload.putUnsignedShort(seq); + + return packet; + } + + /** + * Decode a mission_item_reached message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.seq = payload.getUnsignedShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_mission_item_reached() { + msgid = MAVLINK_MSG_ID_MISSION_ITEM_REACHED; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_mission_item_reached(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MISSION_ITEM_REACHED; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MISSION_ITEM_REACHED - sysid:" + sysid + " compid:" + compid + " seq:" + seq + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_mission_request.java b/app/src/main/java/com/MAVLink/common/msg_mission_request.java new file mode 100644 index 0000000..ce43322 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_mission_request.java @@ -0,0 +1,111 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MISSION_REQUEST PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Request the information of the mission item with the sequence number seq. The response of the system to this message should be a MISSION_ITEM message. http://qgroundcontrol.org/mavlink/waypoint_protocol + */ +public class msg_mission_request extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MISSION_REQUEST = 40; + public static final int MAVLINK_MSG_LENGTH = 5; + private static final long serialVersionUID = MAVLINK_MSG_ID_MISSION_REQUEST; + + + /** + * Sequence + */ + public int seq; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * Mission type, see MAV_MISSION_TYPE + */ + public short mission_type; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MISSION_REQUEST; + + packet.payload.putUnsignedShort(seq); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(mission_type); + + return packet; + } + + /** + * Decode a mission_request message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.seq = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.mission_type = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_mission_request() { + msgid = MAVLINK_MSG_ID_MISSION_REQUEST; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_mission_request(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MISSION_REQUEST; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MISSION_REQUEST - sysid:" + sysid + " compid:" + compid + " seq:" + seq + " target_system:" + target_system + " target_component:" + target_component + " mission_type:" + mission_type + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_mission_request_int.java b/app/src/main/java/com/MAVLink/common/msg_mission_request_int.java new file mode 100644 index 0000000..b21b7ba --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_mission_request_int.java @@ -0,0 +1,111 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MISSION_REQUEST_INT PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Request the information of the mission item with the sequence number seq. The response of the system to this message should be a MISSION_ITEM_INT message. http://qgroundcontrol.org/mavlink/waypoint_protocol + */ +public class msg_mission_request_int extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MISSION_REQUEST_INT = 51; + public static final int MAVLINK_MSG_LENGTH = 5; + private static final long serialVersionUID = MAVLINK_MSG_ID_MISSION_REQUEST_INT; + + + /** + * Sequence + */ + public int seq; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * Mission type, see MAV_MISSION_TYPE + */ + public short mission_type; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MISSION_REQUEST_INT; + + packet.payload.putUnsignedShort(seq); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(mission_type); + + return packet; + } + + /** + * Decode a mission_request_int message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.seq = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.mission_type = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_mission_request_int() { + msgid = MAVLINK_MSG_ID_MISSION_REQUEST_INT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_mission_request_int(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MISSION_REQUEST_INT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MISSION_REQUEST_INT - sysid:" + sysid + " compid:" + compid + " seq:" + seq + " target_system:" + target_system + " target_component:" + target_component + " mission_type:" + mission_type + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_mission_request_list.java b/app/src/main/java/com/MAVLink/common/msg_mission_request_list.java new file mode 100644 index 0000000..b8c5c0a --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_mission_request_list.java @@ -0,0 +1,104 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MISSION_REQUEST_LIST PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; +import com.MAVLink.enums.MAV_MISSION_TYPE; + +/** + * Request the overall list of mission items from the system/component. + */ +public class msg_mission_request_list extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MISSION_REQUEST_LIST = 43; + public static final int MAVLINK_MSG_LENGTH = 3; + private static final long serialVersionUID = MAVLINK_MSG_ID_MISSION_REQUEST_LIST; + + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * Mission type, see MAV_MISSION_TYPE + */ + public short mission_type; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MISSION_REQUEST_LIST; + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(mission_type); + + return packet; + } + + /** + * Decode a mission_request_list message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + //this.mission_type = payload.getUnsignedByte(); + this.mission_type = MAV_MISSION_TYPE.MAV_MISSION_TYPE_MISSION; + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_mission_request_list() { + msgid = MAVLINK_MSG_ID_MISSION_REQUEST_LIST; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_mission_request_list(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MISSION_REQUEST_LIST; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MISSION_REQUEST_LIST - sysid:" + sysid + " compid:" + compid + " target_system:" + target_system + " target_component:" + target_component + " mission_type:" + mission_type + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_mission_request_partial_list.java b/app/src/main/java/com/MAVLink/common/msg_mission_request_partial_list.java new file mode 100644 index 0000000..0018672 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_mission_request_partial_list.java @@ -0,0 +1,120 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MISSION_REQUEST_PARTIAL_LIST PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Request a partial list of mission items from the system/component. http://qgroundcontrol.org/mavlink/waypoint_protocol. If start and end index are the same, just send one waypoint. + */ +public class msg_mission_request_partial_list extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST = 37; + public static final int MAVLINK_MSG_LENGTH = 7; + private static final long serialVersionUID = MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST; + + + /** + * Start index, 0 by default + */ + public short start_index; + + /** + * End index, -1 by default (-1: send list to end). Else a valid index of the list + */ + public short end_index; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * Mission type, see MAV_MISSION_TYPE + */ + public short mission_type; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST; + + packet.payload.putShort(start_index); + + packet.payload.putShort(end_index); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(mission_type); + + return packet; + } + + /** + * Decode a mission_request_partial_list message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.start_index = payload.getShort(); + + this.end_index = payload.getShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.mission_type = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_mission_request_partial_list() { + msgid = MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_mission_request_partial_list(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST - sysid:" + sysid + " compid:" + compid + " start_index:" + start_index + " end_index:" + end_index + " target_system:" + target_system + " target_component:" + target_component + " mission_type:" + mission_type + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_mission_set_current.java b/app/src/main/java/com/MAVLink/common/msg_mission_set_current.java new file mode 100644 index 0000000..5f98526 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_mission_set_current.java @@ -0,0 +1,102 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MISSION_SET_CURRENT PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Set the mission item with sequence number seq as current item. This means that the MAV will continue to this mission item on the shortest path (not following the mission items in-between). + */ +public class msg_mission_set_current extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MISSION_SET_CURRENT = 41; + public static final int MAVLINK_MSG_LENGTH = 4; + private static final long serialVersionUID = MAVLINK_MSG_ID_MISSION_SET_CURRENT; + + + /** + * Sequence + */ + public int seq; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MISSION_SET_CURRENT; + + packet.payload.putUnsignedShort(seq); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + return packet; + } + + /** + * Decode a mission_set_current message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.seq = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_mission_set_current() { + msgid = MAVLINK_MSG_ID_MISSION_SET_CURRENT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_mission_set_current(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MISSION_SET_CURRENT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MISSION_SET_CURRENT - sysid:" + sysid + " compid:" + compid + " seq:" + seq + " target_system:" + target_system + " target_component:" + target_component + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_mission_write_partial_list.java b/app/src/main/java/com/MAVLink/common/msg_mission_write_partial_list.java new file mode 100644 index 0000000..47a9171 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_mission_write_partial_list.java @@ -0,0 +1,120 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MISSION_WRITE_PARTIAL_LIST PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * This message is sent to the MAV to write a partial list. If start index == end index, only one item will be transmitted / updated. If the start index is NOT 0 and above the current list size, this request should be REJECTED! + */ +public class msg_mission_write_partial_list extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST = 38; + public static final int MAVLINK_MSG_LENGTH = 7; + private static final long serialVersionUID = MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST; + + + /** + * Start index, 0 by default and smaller / equal to the largest index of the current onboard list. + */ + public short start_index; + + /** + * End index, equal or greater than start index. + */ + public short end_index; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * Mission type, see MAV_MISSION_TYPE + */ + public short mission_type; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST; + + packet.payload.putShort(start_index); + + packet.payload.putShort(end_index); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(mission_type); + + return packet; + } + + /** + * Decode a mission_write_partial_list message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.start_index = payload.getShort(); + + this.end_index = payload.getShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.mission_type = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_mission_write_partial_list() { + msgid = MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_mission_write_partial_list(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST - sysid:" + sysid + " compid:" + compid + " start_index:" + start_index + " end_index:" + end_index + " target_system:" + target_system + " target_component:" + target_component + " mission_type:" + mission_type + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_mount_orientation.java b/app/src/main/java/com/MAVLink/common/msg_mount_orientation.java new file mode 100644 index 0000000..f03bb4c --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_mount_orientation.java @@ -0,0 +1,111 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE MOUNT_ORIENTATION PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * WIP: Orientation of a mount + */ +public class msg_mount_orientation extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_MOUNT_ORIENTATION = 265; + public static final int MAVLINK_MSG_LENGTH = 16; + private static final long serialVersionUID = MAVLINK_MSG_ID_MOUNT_ORIENTATION; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * Roll in degrees + */ + public float roll; + + /** + * Pitch in degrees + */ + public float pitch; + + /** + * Yaw in degrees + */ + public float yaw; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_MOUNT_ORIENTATION; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putFloat(roll); + + packet.payload.putFloat(pitch); + + packet.payload.putFloat(yaw); + + return packet; + } + + /** + * Decode a mount_orientation message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.roll = payload.getFloat(); + + this.pitch = payload.getFloat(); + + this.yaw = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_mount_orientation() { + msgid = MAVLINK_MSG_ID_MOUNT_ORIENTATION; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_mount_orientation(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_MOUNT_ORIENTATION; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_MOUNT_ORIENTATION - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " roll:" + roll + " pitch:" + pitch + " yaw:" + yaw + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_named_value_float.java b/app/src/main/java/com/MAVLink/common/msg_named_value_float.java new file mode 100644 index 0000000..5d1668f --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_named_value_float.java @@ -0,0 +1,139 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE NAMED_VALUE_FLOAT PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Send a key-value pair as float. The use of this message is discouraged for normal packets, but a quite efficient way for testing new messages and getting experimental debug output. + */ +public class msg_named_value_float extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_NAMED_VALUE_FLOAT = 251; + public static final int MAVLINK_MSG_LENGTH = 18; + private static final long serialVersionUID = MAVLINK_MSG_ID_NAMED_VALUE_FLOAT; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * Floating point value + */ + public float value; + + /** + * Name of the debug variable + */ + public byte name[] = new byte[10]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_NAMED_VALUE_FLOAT; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putFloat(value); + + + for (int i = 0; i < name.length; i++) { + packet.payload.putByte(name[i]); + } + + + return packet; + } + + /** + * Decode a named_value_float message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.value = payload.getFloat(); + + + for (int i = 0; i < this.name.length; i++) { + this.name[i] = payload.getByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_named_value_float() { + msgid = MAVLINK_MSG_ID_NAMED_VALUE_FLOAT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_named_value_float(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_NAMED_VALUE_FLOAT; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setName(String str) { + int len = Math.min(str.length(), 10); + for (int i = 0; i < len; i++) { + name[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 10; i++) { // padding for the rest of the buffer + name[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getName() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 10; i++) { + if (name[i] != 0) + buf.append((char) name[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_NAMED_VALUE_FLOAT - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " value:" + value + " name:" + name + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_named_value_int.java b/app/src/main/java/com/MAVLink/common/msg_named_value_int.java new file mode 100644 index 0000000..7c46fa9 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_named_value_int.java @@ -0,0 +1,139 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE NAMED_VALUE_INT PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Send a key-value pair as integer. The use of this message is discouraged for normal packets, but a quite efficient way for testing new messages and getting experimental debug output. + */ +public class msg_named_value_int extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_NAMED_VALUE_INT = 252; + public static final int MAVLINK_MSG_LENGTH = 18; + private static final long serialVersionUID = MAVLINK_MSG_ID_NAMED_VALUE_INT; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * Signed integer value + */ + public int value; + + /** + * Name of the debug variable + */ + public byte name[] = new byte[10]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_NAMED_VALUE_INT; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putInt(value); + + + for (int i = 0; i < name.length; i++) { + packet.payload.putByte(name[i]); + } + + + return packet; + } + + /** + * Decode a named_value_int message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.value = payload.getInt(); + + + for (int i = 0; i < this.name.length; i++) { + this.name[i] = payload.getByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_named_value_int() { + msgid = MAVLINK_MSG_ID_NAMED_VALUE_INT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_named_value_int(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_NAMED_VALUE_INT; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setName(String str) { + int len = Math.min(str.length(), 10); + for (int i = 0; i < len; i++) { + name[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 10; i++) { // padding for the rest of the buffer + name[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getName() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 10; i++) { + if (name[i] != 0) + buf.append((char) name[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_NAMED_VALUE_INT - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " value:" + value + " name:" + name + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_nav_controller_output.java b/app/src/main/java/com/MAVLink/common/msg_nav_controller_output.java new file mode 100644 index 0000000..484926c --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_nav_controller_output.java @@ -0,0 +1,147 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE NAV_CONTROLLER_OUTPUT PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The state of the fixed wing navigation and position controller. + */ +public class msg_nav_controller_output extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT = 62; + public static final int MAVLINK_MSG_LENGTH = 26; + private static final long serialVersionUID = MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT; + + + /** + * Current desired roll in degrees + */ + public float nav_roll; + + /** + * Current desired pitch in degrees + */ + public float nav_pitch; + + /** + * Current altitude error in meters + */ + public float alt_error; + + /** + * Current airspeed error in meters/second + */ + public float aspd_error; + + /** + * Current crosstrack error on x-y plane in meters + */ + public float xtrack_error; + + /** + * Current desired heading in degrees + */ + public short nav_bearing; + + /** + * Bearing to current MISSION/target in degrees + */ + public short target_bearing; + + /** + * Distance to active MISSION in meters + */ + public int wp_dist; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT; + + packet.payload.putFloat(nav_roll); + + packet.payload.putFloat(nav_pitch); + + packet.payload.putFloat(alt_error); + + packet.payload.putFloat(aspd_error); + + packet.payload.putFloat(xtrack_error); + + packet.payload.putShort(nav_bearing); + + packet.payload.putShort(target_bearing); + + packet.payload.putUnsignedShort(wp_dist); + + return packet; + } + + /** + * Decode a nav_controller_output message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.nav_roll = payload.getFloat(); + + this.nav_pitch = payload.getFloat(); + + this.alt_error = payload.getFloat(); + + this.aspd_error = payload.getFloat(); + + this.xtrack_error = payload.getFloat(); + + this.nav_bearing = payload.getShort(); + + this.target_bearing = payload.getShort(); + + this.wp_dist = payload.getUnsignedShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_nav_controller_output() { + msgid = MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_nav_controller_output(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT - sysid:" + sysid + " compid:" + compid + " nav_roll:" + nav_roll + " nav_pitch:" + nav_pitch + " alt_error:" + alt_error + " aspd_error:" + aspd_error + " xtrack_error:" + xtrack_error + " nav_bearing:" + nav_bearing + " target_bearing:" + target_bearing + " wp_dist:" + wp_dist + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_optical_flow.java b/app/src/main/java/com/MAVLink/common/msg_optical_flow.java new file mode 100644 index 0000000..379cb32 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_optical_flow.java @@ -0,0 +1,165 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE OPTICAL_FLOW PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Optical flow from a flow sensor (e.g. optical mouse sensor) + */ +public class msg_optical_flow extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_OPTICAL_FLOW = 100; + public static final int MAVLINK_MSG_LENGTH = 34; + private static final long serialVersionUID = MAVLINK_MSG_ID_OPTICAL_FLOW; + + + /** + * Timestamp (UNIX) + */ + public long time_usec; + + /** + * Flow in meters in x-sensor direction, angular-speed compensated + */ + public float flow_comp_m_x; + + /** + * Flow in meters in y-sensor direction, angular-speed compensated + */ + public float flow_comp_m_y; + + /** + * Ground distance in meters. Positive value: distance known. Negative value: Unknown distance + */ + public float ground_distance; + + /** + * Flow in pixels * 10 in x-sensor direction (dezi-pixels) + */ + public short flow_x; + + /** + * Flow in pixels * 10 in y-sensor direction (dezi-pixels) + */ + public short flow_y; + + /** + * Sensor ID + */ + public short sensor_id; + + /** + * Optical flow quality / confidence. 0: bad, 255: maximum quality + */ + public short quality; + + /** + * Flow rate in radians/second about X axis + */ + public float flow_rate_x; + + /** + * Flow rate in radians/second about Y axis + */ + public float flow_rate_y; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_OPTICAL_FLOW; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putFloat(flow_comp_m_x); + + packet.payload.putFloat(flow_comp_m_y); + + packet.payload.putFloat(ground_distance); + + packet.payload.putShort(flow_x); + + packet.payload.putShort(flow_y); + + packet.payload.putUnsignedByte(sensor_id); + + packet.payload.putUnsignedByte(quality); + + packet.payload.putFloat(flow_rate_x); + + packet.payload.putFloat(flow_rate_y); + + return packet; + } + + /** + * Decode a optical_flow message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.flow_comp_m_x = payload.getFloat(); + + this.flow_comp_m_y = payload.getFloat(); + + this.ground_distance = payload.getFloat(); + + this.flow_x = payload.getShort(); + + this.flow_y = payload.getShort(); + + this.sensor_id = payload.getUnsignedByte(); + + this.quality = payload.getUnsignedByte(); + + this.flow_rate_x = payload.getFloat(); + + this.flow_rate_y = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_optical_flow() { + msgid = MAVLINK_MSG_ID_OPTICAL_FLOW; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_optical_flow(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_OPTICAL_FLOW; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_OPTICAL_FLOW - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " flow_comp_m_x:" + flow_comp_m_x + " flow_comp_m_y:" + flow_comp_m_y + " ground_distance:" + ground_distance + " flow_x:" + flow_x + " flow_y:" + flow_y + " sensor_id:" + sensor_id + " quality:" + quality + " flow_rate_x:" + flow_rate_x + " flow_rate_y:" + flow_rate_y + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_optical_flow_rad.java b/app/src/main/java/com/MAVLink/common/msg_optical_flow_rad.java new file mode 100644 index 0000000..40c8735 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_optical_flow_rad.java @@ -0,0 +1,183 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE OPTICAL_FLOW_RAD PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Optical flow from an angular rate flow sensor (e.g. PX4FLOW or mouse sensor) + */ +public class msg_optical_flow_rad extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_OPTICAL_FLOW_RAD = 106; + public static final int MAVLINK_MSG_LENGTH = 44; + private static final long serialVersionUID = MAVLINK_MSG_ID_OPTICAL_FLOW_RAD; + + + /** + * Timestamp (microseconds, synced to UNIX time or since system boot) + */ + public long time_usec; + + /** + * Integration time in microseconds. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the. + */ + public long integration_time_us; + + /** + * Flow in radians around X axis (Sensor RH rotation about the X axis induces a positive flow. Sensor linear motion along the positive Y axis induces a negative flow.) + */ + public float integrated_x; + + /** + * Flow in radians around Y axis (Sensor RH rotation about the Y axis induces a positive flow. Sensor linear motion along the positive X axis induces a positive flow.) + */ + public float integrated_y; + + /** + * RH rotation around X axis (rad) + */ + public float integrated_xgyro; + + /** + * RH rotation around Y axis (rad) + */ + public float integrated_ygyro; + + /** + * RH rotation around Z axis (rad) + */ + public float integrated_zgyro; + + /** + * Time in microseconds since the distance was sampled. + */ + public long time_delta_distance_us; + + /** + * Distance to the center of the flow field in meters. Positive value (including zero): distance known. Negative value: Unknown distance. + */ + public float distance; + + /** + * Temperature * 100 in centi-degrees Celsius + */ + public short temperature; + + /** + * Sensor ID + */ + public short sensor_id; + + /** + * Optical flow quality / confidence. 0: no valid flow, 255: maximum quality + */ + public short quality; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_OPTICAL_FLOW_RAD; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putUnsignedInt(integration_time_us); + + packet.payload.putFloat(integrated_x); + + packet.payload.putFloat(integrated_y); + + packet.payload.putFloat(integrated_xgyro); + + packet.payload.putFloat(integrated_ygyro); + + packet.payload.putFloat(integrated_zgyro); + + packet.payload.putUnsignedInt(time_delta_distance_us); + + packet.payload.putFloat(distance); + + packet.payload.putShort(temperature); + + packet.payload.putUnsignedByte(sensor_id); + + packet.payload.putUnsignedByte(quality); + + return packet; + } + + /** + * Decode a optical_flow_rad message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.integration_time_us = payload.getUnsignedInt(); + + this.integrated_x = payload.getFloat(); + + this.integrated_y = payload.getFloat(); + + this.integrated_xgyro = payload.getFloat(); + + this.integrated_ygyro = payload.getFloat(); + + this.integrated_zgyro = payload.getFloat(); + + this.time_delta_distance_us = payload.getUnsignedInt(); + + this.distance = payload.getFloat(); + + this.temperature = payload.getShort(); + + this.sensor_id = payload.getUnsignedByte(); + + this.quality = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_optical_flow_rad() { + msgid = MAVLINK_MSG_ID_OPTICAL_FLOW_RAD; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_optical_flow_rad(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_OPTICAL_FLOW_RAD; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_OPTICAL_FLOW_RAD - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " integration_time_us:" + integration_time_us + " integrated_x:" + integrated_x + " integrated_y:" + integrated_y + " integrated_xgyro:" + integrated_xgyro + " integrated_ygyro:" + integrated_ygyro + " integrated_zgyro:" + integrated_zgyro + " time_delta_distance_us:" + time_delta_distance_us + " distance:" + distance + " temperature:" + temperature + " sensor_id:" + sensor_id + " quality:" + quality + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_param_ext_ack.java b/app/src/main/java/com/MAVLink/common/msg_param_ext_ack.java new file mode 100644 index 0000000..0eaa3ee --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_param_ext_ack.java @@ -0,0 +1,183 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE PARAM_EXT_ACK PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Response from a PARAM_EXT_SET message. + */ +public class msg_param_ext_ack extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_PARAM_EXT_ACK = 324; + public static final int MAVLINK_MSG_LENGTH = 146; + private static final long serialVersionUID = MAVLINK_MSG_ID_PARAM_EXT_ACK; + + + /** + * Parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + */ + public byte param_id[] = new byte[16]; + + /** + * Parameter value (new value if PARAM_ACK_ACCEPTED, current value otherwise) + */ + public byte param_value[] = new byte[128]; + + /** + * Parameter type: see the MAV_PARAM_TYPE enum for supported data types. + */ + public short param_type; + + /** + * Result code: see the PARAM_ACK enum for possible codes. + */ + public short param_result; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_PARAM_EXT_ACK; + + + for (int i = 0; i < param_id.length; i++) { + packet.payload.putByte(param_id[i]); + } + + + for (int i = 0; i < param_value.length; i++) { + packet.payload.putByte(param_value[i]); + } + + + packet.payload.putUnsignedByte(param_type); + + packet.payload.putUnsignedByte(param_result); + + return packet; + } + + /** + * Decode a param_ext_ack message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + + for (int i = 0; i < this.param_id.length; i++) { + this.param_id[i] = payload.getByte(); + } + + + for (int i = 0; i < this.param_value.length; i++) { + this.param_value[i] = payload.getByte(); + } + + + this.param_type = payload.getUnsignedByte(); + + this.param_result = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_param_ext_ack() { + msgid = MAVLINK_MSG_ID_PARAM_EXT_ACK; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_param_ext_ack(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_PARAM_EXT_ACK; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setParam_Id(String str) { + int len = Math.min(str.length(), 16); + for (int i = 0; i < len; i++) { + param_id[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 16; i++) { // padding for the rest of the buffer + param_id[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getParam_Id() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 16; i++) { + if (param_id[i] != 0) + buf.append((char) param_id[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setParam_Value(String str) { + int len = Math.min(str.length(), 128); + for (int i = 0; i < len; i++) { + param_value[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 128; i++) { // padding for the rest of the buffer + param_value[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getParam_Value() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 128; i++) { + if (param_value[i] != 0) + buf.append((char) param_value[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_PARAM_EXT_ACK - sysid:" + sysid + " compid:" + compid + " param_id:" + param_id + " param_value:" + param_value + " param_type:" + param_type + " param_result:" + param_result + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_param_ext_request_list.java b/app/src/main/java/com/MAVLink/common/msg_param_ext_request_list.java new file mode 100644 index 0000000..fad577a --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_param_ext_request_list.java @@ -0,0 +1,93 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE PARAM_EXT_REQUEST_LIST PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Request all parameters of this component. After this request, all parameters are emitted. + */ +public class msg_param_ext_request_list extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST = 321; + public static final int MAVLINK_MSG_LENGTH = 2; + private static final long serialVersionUID = MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST; + + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST; + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + return packet; + } + + /** + * Decode a param_ext_request_list message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_param_ext_request_list() { + msgid = MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_param_ext_request_list(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_PARAM_EXT_REQUEST_LIST - sysid:" + sysid + " compid:" + compid + " target_system:" + target_system + " target_component:" + target_component + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_param_ext_request_read.java b/app/src/main/java/com/MAVLink/common/msg_param_ext_request_read.java new file mode 100644 index 0000000..cb143a7 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_param_ext_request_read.java @@ -0,0 +1,148 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE PARAM_EXT_REQUEST_READ PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Request to read the value of a parameter with the either the param_id string id or param_index. + */ +public class msg_param_ext_request_read extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ = 320; + public static final int MAVLINK_MSG_LENGTH = 20; + private static final long serialVersionUID = MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ; + + + /** + * Parameter index. Set to -1 to use the Parameter ID field as identifier (else param_id will be ignored) + */ + public short param_index; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * Parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + */ + public byte param_id[] = new byte[16]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ; + + packet.payload.putShort(param_index); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + + for (int i = 0; i < param_id.length; i++) { + packet.payload.putByte(param_id[i]); + } + + + return packet; + } + + /** + * Decode a param_ext_request_read message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.param_index = payload.getShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + + for (int i = 0; i < this.param_id.length; i++) { + this.param_id[i] = payload.getByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_param_ext_request_read() { + msgid = MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_param_ext_request_read(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setParam_Id(String str) { + int len = Math.min(str.length(), 16); + for (int i = 0; i < len; i++) { + param_id[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 16; i++) { // padding for the rest of the buffer + param_id[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getParam_Id() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 16; i++) { + if (param_id[i] != 0) + buf.append((char) param_id[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_PARAM_EXT_REQUEST_READ - sysid:" + sysid + " compid:" + compid + " param_index:" + param_index + " target_system:" + target_system + " target_component:" + target_component + " param_id:" + param_id + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_param_ext_set.java b/app/src/main/java/com/MAVLink/common/msg_param_ext_set.java new file mode 100644 index 0000000..c18e1bb --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_param_ext_set.java @@ -0,0 +1,192 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE PARAM_EXT_SET PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Set a parameter value. In order to deal with message loss (and retransmission of PARAM_EXT_SET), when setting a parameter value and the new value is the same as the current value, you will immediately get a PARAM_ACK_ACCEPTED response. If the current state is PARAM_ACK_IN_PROGRESS, you will accordingly receive a PARAM_ACK_IN_PROGRESS in response. + */ +public class msg_param_ext_set extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_PARAM_EXT_SET = 323; + public static final int MAVLINK_MSG_LENGTH = 147; + private static final long serialVersionUID = MAVLINK_MSG_ID_PARAM_EXT_SET; + + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * Parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + */ + public byte param_id[] = new byte[16]; + + /** + * Parameter value + */ + public byte param_value[] = new byte[128]; + + /** + * Parameter type: see the MAV_PARAM_TYPE enum for supported data types. + */ + public short param_type; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_PARAM_EXT_SET; + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + + for (int i = 0; i < param_id.length; i++) { + packet.payload.putByte(param_id[i]); + } + + + for (int i = 0; i < param_value.length; i++) { + packet.payload.putByte(param_value[i]); + } + + + packet.payload.putUnsignedByte(param_type); + + return packet; + } + + /** + * Decode a param_ext_set message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + + for (int i = 0; i < this.param_id.length; i++) { + this.param_id[i] = payload.getByte(); + } + + + for (int i = 0; i < this.param_value.length; i++) { + this.param_value[i] = payload.getByte(); + } + + + this.param_type = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_param_ext_set() { + msgid = MAVLINK_MSG_ID_PARAM_EXT_SET; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_param_ext_set(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_PARAM_EXT_SET; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setParam_Id(String str) { + int len = Math.min(str.length(), 16); + for (int i = 0; i < len; i++) { + param_id[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 16; i++) { // padding for the rest of the buffer + param_id[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getParam_Id() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 16; i++) { + if (param_id[i] != 0) + buf.append((char) param_id[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setParam_Value(String str) { + int len = Math.min(str.length(), 128); + for (int i = 0; i < len; i++) { + param_value[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 128; i++) { // padding for the rest of the buffer + param_value[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getParam_Value() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 128; i++) { + if (param_value[i] != 0) + buf.append((char) param_value[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_PARAM_EXT_SET - sysid:" + sysid + " compid:" + compid + " target_system:" + target_system + " target_component:" + target_component + " param_id:" + param_id + " param_value:" + param_value + " param_type:" + param_type + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_param_ext_value.java b/app/src/main/java/com/MAVLink/common/msg_param_ext_value.java new file mode 100644 index 0000000..4010d2d --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_param_ext_value.java @@ -0,0 +1,192 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE PARAM_EXT_VALUE PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Emit the value of a parameter. The inclusion of param_count and param_index in the message allows the recipient to keep track of received parameters and allows them to re-request missing parameters after a loss or timeout. + */ +public class msg_param_ext_value extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_PARAM_EXT_VALUE = 322; + public static final int MAVLINK_MSG_LENGTH = 149; + private static final long serialVersionUID = MAVLINK_MSG_ID_PARAM_EXT_VALUE; + + + /** + * Total number of parameters + */ + public int param_count; + + /** + * Index of this parameter + */ + public int param_index; + + /** + * Parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + */ + public byte param_id[] = new byte[16]; + + /** + * Parameter value + */ + public byte param_value[] = new byte[128]; + + /** + * Parameter type: see the MAV_PARAM_TYPE enum for supported data types. + */ + public short param_type; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_PARAM_EXT_VALUE; + + packet.payload.putUnsignedShort(param_count); + + packet.payload.putUnsignedShort(param_index); + + + for (int i = 0; i < param_id.length; i++) { + packet.payload.putByte(param_id[i]); + } + + + for (int i = 0; i < param_value.length; i++) { + packet.payload.putByte(param_value[i]); + } + + + packet.payload.putUnsignedByte(param_type); + + return packet; + } + + /** + * Decode a param_ext_value message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.param_count = payload.getUnsignedShort(); + + this.param_index = payload.getUnsignedShort(); + + + for (int i = 0; i < this.param_id.length; i++) { + this.param_id[i] = payload.getByte(); + } + + + for (int i = 0; i < this.param_value.length; i++) { + this.param_value[i] = payload.getByte(); + } + + + this.param_type = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_param_ext_value() { + msgid = MAVLINK_MSG_ID_PARAM_EXT_VALUE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_param_ext_value(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_PARAM_EXT_VALUE; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setParam_Id(String str) { + int len = Math.min(str.length(), 16); + for (int i = 0; i < len; i++) { + param_id[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 16; i++) { // padding for the rest of the buffer + param_id[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getParam_Id() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 16; i++) { + if (param_id[i] != 0) + buf.append((char) param_id[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setParam_Value(String str) { + int len = Math.min(str.length(), 128); + for (int i = 0; i < len; i++) { + param_value[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 128; i++) { // padding for the rest of the buffer + param_value[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getParam_Value() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 128; i++) { + if (param_value[i] != 0) + buf.append((char) param_value[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_PARAM_EXT_VALUE - sysid:" + sysid + " compid:" + compid + " param_count:" + param_count + " param_index:" + param_index + " param_id:" + param_id + " param_value:" + param_value + " param_type:" + param_type + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_param_map_rc.java b/app/src/main/java/com/MAVLink/common/msg_param_map_rc.java new file mode 100644 index 0000000..5b66915 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_param_map_rc.java @@ -0,0 +1,193 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE PARAM_MAP_RC PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Bind a RC channel to a parameter. The parameter should change accoding to the RC channel value. + */ +public class msg_param_map_rc extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_PARAM_MAP_RC = 50; + public static final int MAVLINK_MSG_LENGTH = 37; + private static final long serialVersionUID = MAVLINK_MSG_ID_PARAM_MAP_RC; + + + /** + * Initial parameter value + */ + public float param_value0; + + /** + * Scale, maps the RC range [-1, 1] to a parameter value + */ + public float scale; + + /** + * Minimum param value. The protocol does not define if this overwrites an onboard minimum value. (Depends on implementation) + */ + public float param_value_min; + + /** + * Maximum param value. The protocol does not define if this overwrites an onboard maximum value. (Depends on implementation) + */ + public float param_value_max; + + /** + * Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored), send -2 to disable any existing map for this rc_channel_index. + */ + public short param_index; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + */ + public byte param_id[] = new byte[16]; + + /** + * Index of parameter RC channel. Not equal to the RC channel id. Typically correpsonds to a potentiometer-knob on the RC. + */ + public short parameter_rc_channel_index; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_PARAM_MAP_RC; + + packet.payload.putFloat(param_value0); + + packet.payload.putFloat(scale); + + packet.payload.putFloat(param_value_min); + + packet.payload.putFloat(param_value_max); + + packet.payload.putShort(param_index); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + + for (int i = 0; i < param_id.length; i++) { + packet.payload.putByte(param_id[i]); + } + + + packet.payload.putUnsignedByte(parameter_rc_channel_index); + + return packet; + } + + /** + * Decode a param_map_rc message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.param_value0 = payload.getFloat(); + + this.scale = payload.getFloat(); + + this.param_value_min = payload.getFloat(); + + this.param_value_max = payload.getFloat(); + + this.param_index = payload.getShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + + for (int i = 0; i < this.param_id.length; i++) { + this.param_id[i] = payload.getByte(); + } + + + this.parameter_rc_channel_index = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_param_map_rc() { + msgid = MAVLINK_MSG_ID_PARAM_MAP_RC; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_param_map_rc(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_PARAM_MAP_RC; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setParam_Id(String str) { + int len = Math.min(str.length(), 16); + for (int i = 0; i < len; i++) { + param_id[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 16; i++) { // padding for the rest of the buffer + param_id[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getParam_Id() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 16; i++) { + if (param_id[i] != 0) + buf.append((char) param_id[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_PARAM_MAP_RC - sysid:" + sysid + " compid:" + compid + " param_value0:" + param_value0 + " scale:" + scale + " param_value_min:" + param_value_min + " param_value_max:" + param_value_max + " param_index:" + param_index + " target_system:" + target_system + " target_component:" + target_component + " param_id:" + param_id + " parameter_rc_channel_index:" + parameter_rc_channel_index + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_param_request_list.java b/app/src/main/java/com/MAVLink/common/msg_param_request_list.java new file mode 100644 index 0000000..48cf84e --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_param_request_list.java @@ -0,0 +1,93 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE PARAM_REQUEST_LIST PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Request all parameters of this component. After this request, all parameters are emitted. + */ +public class msg_param_request_list extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_PARAM_REQUEST_LIST = 21; + public static final int MAVLINK_MSG_LENGTH = 2; + private static final long serialVersionUID = MAVLINK_MSG_ID_PARAM_REQUEST_LIST; + + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_PARAM_REQUEST_LIST; + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + return packet; + } + + /** + * Decode a param_request_list message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_param_request_list() { + msgid = MAVLINK_MSG_ID_PARAM_REQUEST_LIST; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_param_request_list(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_PARAM_REQUEST_LIST; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_PARAM_REQUEST_LIST - sysid:" + sysid + " compid:" + compid + " target_system:" + target_system + " target_component:" + target_component + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_param_request_read.java b/app/src/main/java/com/MAVLink/common/msg_param_request_read.java new file mode 100644 index 0000000..a4f8f26 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_param_request_read.java @@ -0,0 +1,148 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE PARAM_REQUEST_READ PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Request to read the onboard parameter with the param_id string id. Onboard parameters are stored as key[const char*] -> value[float]. This allows to send a parameter to any other component (such as the GCS) without the need of previous knowledge of possible parameter names. Thus the same GCS can store different parameters for different autopilots. See also http://qgroundcontrol.org/parameter_interface for a full documentation of QGroundControl and IMU code. + */ +public class msg_param_request_read extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_PARAM_REQUEST_READ = 20; + public static final int MAVLINK_MSG_LENGTH = 20; + private static final long serialVersionUID = MAVLINK_MSG_ID_PARAM_REQUEST_READ; + + + /** + * Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored) + */ + public short param_index; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + */ + public byte param_id[] = new byte[16]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_PARAM_REQUEST_READ; + + packet.payload.putShort(param_index); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + + for (int i = 0; i < param_id.length; i++) { + packet.payload.putByte(param_id[i]); + } + + + return packet; + } + + /** + * Decode a param_request_read message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.param_index = payload.getShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + + for (int i = 0; i < this.param_id.length; i++) { + this.param_id[i] = payload.getByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_param_request_read() { + msgid = MAVLINK_MSG_ID_PARAM_REQUEST_READ; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_param_request_read(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_PARAM_REQUEST_READ; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setParam_Id(String str) { + int len = Math.min(str.length(), 16); + for (int i = 0; i < len; i++) { + param_id[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 16; i++) { // padding for the rest of the buffer + param_id[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getParam_Id() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 16; i++) { + if (param_id[i] != 0) + buf.append((char) param_id[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_PARAM_REQUEST_READ - sysid:" + sysid + " compid:" + compid + " param_index:" + param_index + " target_system:" + target_system + " target_component:" + target_component + " param_id:" + param_id + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_param_set.java b/app/src/main/java/com/MAVLink/common/msg_param_set.java new file mode 100644 index 0000000..2e8e5e7 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_param_set.java @@ -0,0 +1,157 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE PARAM_SET PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Set a parameter value TEMPORARILY to RAM. It will be reset to default on system reboot. Send the ACTION MAV_ACTION_STORAGE_WRITE to PERMANENTLY write the RAM contents to EEPROM. IMPORTANT: The receiving component should acknowledge the new parameter value by sending a param_value message to all communication partners. This will also ensure that multiple GCS all have an up-to-date list of all parameters. If the sending GCS did not receive a PARAM_VALUE message within its timeout time, it should re-send the PARAM_SET message. + */ +public class msg_param_set extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_PARAM_SET = 23; + public static final int MAVLINK_MSG_LENGTH = 23; + private static final long serialVersionUID = MAVLINK_MSG_ID_PARAM_SET; + + + /** + * Onboard parameter value + */ + public float param_value; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + */ + public byte param_id[] = new byte[16]; + + /** + * Onboard parameter type: see the MAV_PARAM_TYPE enum for supported data types. + */ + public short param_type; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_PARAM_SET; + + packet.payload.putFloat(param_value); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + + for (int i = 0; i < param_id.length; i++) { + packet.payload.putByte(param_id[i]); + } + + + packet.payload.putUnsignedByte(param_type); + + return packet; + } + + /** + * Decode a param_set message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.param_value = payload.getFloat(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + + for (int i = 0; i < this.param_id.length; i++) { + this.param_id[i] = payload.getByte(); + } + + + this.param_type = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_param_set() { + msgid = MAVLINK_MSG_ID_PARAM_SET; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_param_set(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_PARAM_SET; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setParam_Id(String str) { + int len = Math.min(str.length(), 16); + for (int i = 0; i < len; i++) { + param_id[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 16; i++) { // padding for the rest of the buffer + param_id[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getParam_Id() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 16; i++) { + if (param_id[i] != 0) + buf.append((char) param_id[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_PARAM_SET - sysid:" + sysid + " compid:" + compid + " param_value:" + param_value + " target_system:" + target_system + " target_component:" + target_component + " param_id:" + param_id + " param_type:" + param_type + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_param_value.java b/app/src/main/java/com/MAVLink/common/msg_param_value.java new file mode 100644 index 0000000..f970281 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_param_value.java @@ -0,0 +1,157 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE PARAM_VALUE PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Emit the value of a onboard parameter. The inclusion of param_count and param_index in the message allows the recipient to keep track of received parameters and allows him to re-request missing parameters after a loss or timeout. + */ +public class msg_param_value extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_PARAM_VALUE = 22; + public static final int MAVLINK_MSG_LENGTH = 25; + private static final long serialVersionUID = MAVLINK_MSG_ID_PARAM_VALUE; + + + /** + * Onboard parameter value + */ + public float param_value; + + /** + * Total number of onboard parameters + */ + public int param_count; + + /** + * Index of this onboard parameter + */ + public int param_index; + + /** + * Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string + */ + public byte param_id[] = new byte[16]; + + /** + * Onboard parameter type: see the MAV_PARAM_TYPE enum for supported data types. + */ + public short param_type; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_PARAM_VALUE; + + packet.payload.putFloat(param_value); + + packet.payload.putUnsignedShort(param_count); + + packet.payload.putUnsignedShort(param_index); + + + for (int i = 0; i < param_id.length; i++) { + packet.payload.putByte(param_id[i]); + } + + + packet.payload.putUnsignedByte(param_type); + + return packet; + } + + /** + * Decode a param_value message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.param_value = payload.getFloat(); + + this.param_count = payload.getUnsignedShort(); + + this.param_index = payload.getUnsignedShort(); + + + for (int i = 0; i < this.param_id.length; i++) { + this.param_id[i] = payload.getByte(); + } + + + this.param_type = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_param_value() { + msgid = MAVLINK_MSG_ID_PARAM_VALUE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_param_value(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_PARAM_VALUE; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setParam_Id(String str) { + int len = Math.min(str.length(), 16); + for (int i = 0; i < len; i++) { + param_id[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 16; i++) { // padding for the rest of the buffer + param_id[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getParam_Id() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 16; i++) { + if (param_id[i] != 0) + buf.append((char) param_id[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_PARAM_VALUE - sysid:" + sysid + " compid:" + compid + " param_value:" + param_value + " param_count:" + param_count + " param_index:" + param_index + " param_id:" + param_id + " param_type:" + param_type + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_ping.java b/app/src/main/java/com/MAVLink/common/msg_ping.java new file mode 100644 index 0000000..0ab20f2 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_ping.java @@ -0,0 +1,111 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE PING PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * A ping message either requesting or responding to a ping. This allows to measure the system latencies, including serial port, radio modem and UDP connections. + */ +public class msg_ping extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_PING = 4; + public static final int MAVLINK_MSG_LENGTH = 14; + private static final long serialVersionUID = MAVLINK_MSG_ID_PING; + + + /** + * Unix timestamp in microseconds or since system boot if smaller than MAVLink epoch (1.1.2009) + */ + public long time_usec; + + /** + * PING sequence + */ + public long seq; + + /** + * 0: request ping from all receiving systems, if greater than 0: message is a ping response and number is the system id of the requesting system + */ + public short target_system; + + /** + * 0: request ping from all receiving components, if greater than 0: message is a ping response and number is the system id of the requesting system + */ + public short target_component; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_PING; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putUnsignedInt(seq); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + return packet; + } + + /** + * Decode a ping message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.seq = payload.getUnsignedInt(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_ping() { + msgid = MAVLINK_MSG_ID_PING; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_ping(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_PING; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_PING - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " seq:" + seq + " target_system:" + target_system + " target_component:" + target_component + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_play_tune.java b/app/src/main/java/com/MAVLink/common/msg_play_tune.java new file mode 100644 index 0000000..9e359bd --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_play_tune.java @@ -0,0 +1,139 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE PLAY_TUNE PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Control vehicle tone generation (buzzer) + */ +public class msg_play_tune extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_PLAY_TUNE = 258; + public static final int MAVLINK_MSG_LENGTH = 32; + private static final long serialVersionUID = MAVLINK_MSG_ID_PLAY_TUNE; + + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * tune in board specific format + */ + public byte tune[] = new byte[30]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_PLAY_TUNE; + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + + for (int i = 0; i < tune.length; i++) { + packet.payload.putByte(tune[i]); + } + + + return packet; + } + + /** + * Decode a play_tune message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + + for (int i = 0; i < this.tune.length; i++) { + this.tune[i] = payload.getByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_play_tune() { + msgid = MAVLINK_MSG_ID_PLAY_TUNE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_play_tune(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_PLAY_TUNE; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setTune(String str) { + int len = Math.min(str.length(), 30); + for (int i = 0; i < len; i++) { + tune[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 30; i++) { // padding for the rest of the buffer + tune[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getTune() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 30; i++) { + if (tune[i] != 0) + buf.append((char) tune[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_PLAY_TUNE - sysid:" + sysid + " compid:" + compid + " target_system:" + target_system + " target_component:" + target_component + " tune:" + tune + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_position_target_global_int.java b/app/src/main/java/com/MAVLink/common/msg_position_target_global_int.java new file mode 100644 index 0000000..b31928d --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_position_target_global_int.java @@ -0,0 +1,201 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE POSITION_TARGET_GLOBAL_INT PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Reports the current commanded vehicle position, velocity, and acceleration as specified by the autopilot. This should match the commands sent in SET_POSITION_TARGET_GLOBAL_INT if the vehicle is being controlled this way. + */ +public class msg_position_target_global_int extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT = 87; + public static final int MAVLINK_MSG_LENGTH = 51; + private static final long serialVersionUID = MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT; + + + /** + * Timestamp in milliseconds since system boot. The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency. + */ + public long time_boot_ms; + + /** + * X Position in WGS84 frame in 1e7 * meters + */ + public int lat_int; + + /** + * Y Position in WGS84 frame in 1e7 * meters + */ + public int lon_int; + + /** + * Altitude in meters in AMSL altitude, not WGS84 if absolute or relative, above terrain if GLOBAL_TERRAIN_ALT_INT + */ + public float alt; + + /** + * X velocity in NED frame in meter / s + */ + public float vx; + + /** + * Y velocity in NED frame in meter / s + */ + public float vy; + + /** + * Z velocity in NED frame in meter / s + */ + public float vz; + + /** + * X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + */ + public float afx; + + /** + * Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + */ + public float afy; + + /** + * Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + */ + public float afz; + + /** + * yaw setpoint in rad + */ + public float yaw; + + /** + * yaw rate setpoint in rad/s + */ + public float yaw_rate; + + /** + * Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate + */ + public int type_mask; + + /** + * Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 + */ + public short coordinate_frame; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putInt(lat_int); + + packet.payload.putInt(lon_int); + + packet.payload.putFloat(alt); + + packet.payload.putFloat(vx); + + packet.payload.putFloat(vy); + + packet.payload.putFloat(vz); + + packet.payload.putFloat(afx); + + packet.payload.putFloat(afy); + + packet.payload.putFloat(afz); + + packet.payload.putFloat(yaw); + + packet.payload.putFloat(yaw_rate); + + packet.payload.putUnsignedShort(type_mask); + + packet.payload.putUnsignedByte(coordinate_frame); + + return packet; + } + + /** + * Decode a position_target_global_int message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.lat_int = payload.getInt(); + + this.lon_int = payload.getInt(); + + this.alt = payload.getFloat(); + + this.vx = payload.getFloat(); + + this.vy = payload.getFloat(); + + this.vz = payload.getFloat(); + + this.afx = payload.getFloat(); + + this.afy = payload.getFloat(); + + this.afz = payload.getFloat(); + + this.yaw = payload.getFloat(); + + this.yaw_rate = payload.getFloat(); + + this.type_mask = payload.getUnsignedShort(); + + this.coordinate_frame = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_position_target_global_int() { + msgid = MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_position_target_global_int(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " lat_int:" + lat_int + " lon_int:" + lon_int + " alt:" + alt + " vx:" + vx + " vy:" + vy + " vz:" + vz + " afx:" + afx + " afy:" + afy + " afz:" + afz + " yaw:" + yaw + " yaw_rate:" + yaw_rate + " type_mask:" + type_mask + " coordinate_frame:" + coordinate_frame + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_position_target_local_ned.java b/app/src/main/java/com/MAVLink/common/msg_position_target_local_ned.java new file mode 100644 index 0000000..dd96dce --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_position_target_local_ned.java @@ -0,0 +1,201 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE POSITION_TARGET_LOCAL_NED PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Reports the current commanded vehicle position, velocity, and acceleration as specified by the autopilot. This should match the commands sent in SET_POSITION_TARGET_LOCAL_NED if the vehicle is being controlled this way. + */ +public class msg_position_target_local_ned extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED = 85; + public static final int MAVLINK_MSG_LENGTH = 51; + private static final long serialVersionUID = MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED; + + + /** + * Timestamp in milliseconds since system boot + */ + public long time_boot_ms; + + /** + * X Position in NED frame in meters + */ + public float x; + + /** + * Y Position in NED frame in meters + */ + public float y; + + /** + * Z Position in NED frame in meters (note, altitude is negative in NED) + */ + public float z; + + /** + * X velocity in NED frame in meter / s + */ + public float vx; + + /** + * Y velocity in NED frame in meter / s + */ + public float vy; + + /** + * Z velocity in NED frame in meter / s + */ + public float vz; + + /** + * X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + */ + public float afx; + + /** + * Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + */ + public float afy; + + /** + * Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + */ + public float afz; + + /** + * yaw setpoint in rad + */ + public float yaw; + + /** + * yaw rate setpoint in rad/s + */ + public float yaw_rate; + + /** + * Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate + */ + public int type_mask; + + /** + * Valid options are: MAV_FRAME_LOCAL_NED = 1, MAV_FRAME_LOCAL_OFFSET_NED = 7, MAV_FRAME_BODY_NED = 8, MAV_FRAME_BODY_OFFSET_NED = 9 + */ + public short coordinate_frame; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putFloat(x); + + packet.payload.putFloat(y); + + packet.payload.putFloat(z); + + packet.payload.putFloat(vx); + + packet.payload.putFloat(vy); + + packet.payload.putFloat(vz); + + packet.payload.putFloat(afx); + + packet.payload.putFloat(afy); + + packet.payload.putFloat(afz); + + packet.payload.putFloat(yaw); + + packet.payload.putFloat(yaw_rate); + + packet.payload.putUnsignedShort(type_mask); + + packet.payload.putUnsignedByte(coordinate_frame); + + return packet; + } + + /** + * Decode a position_target_local_ned message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.x = payload.getFloat(); + + this.y = payload.getFloat(); + + this.z = payload.getFloat(); + + this.vx = payload.getFloat(); + + this.vy = payload.getFloat(); + + this.vz = payload.getFloat(); + + this.afx = payload.getFloat(); + + this.afy = payload.getFloat(); + + this.afz = payload.getFloat(); + + this.yaw = payload.getFloat(); + + this.yaw_rate = payload.getFloat(); + + this.type_mask = payload.getUnsignedShort(); + + this.coordinate_frame = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_position_target_local_ned() { + msgid = MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_position_target_local_ned(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " x:" + x + " y:" + y + " z:" + z + " vx:" + vx + " vy:" + vy + " vz:" + vz + " afx:" + afx + " afy:" + afy + " afz:" + afz + " yaw:" + yaw + " yaw_rate:" + yaw_rate + " type_mask:" + type_mask + " coordinate_frame:" + coordinate_frame + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_power_status.java b/app/src/main/java/com/MAVLink/common/msg_power_status.java new file mode 100644 index 0000000..1c69428 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_power_status.java @@ -0,0 +1,102 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE POWER_STATUS PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Power supply status + */ +public class msg_power_status extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_POWER_STATUS = 125; + public static final int MAVLINK_MSG_LENGTH = 6; + private static final long serialVersionUID = MAVLINK_MSG_ID_POWER_STATUS; + + + /** + * 5V rail voltage in millivolts + */ + public int Vcc; + + /** + * servo rail voltage in millivolts + */ + public int Vservo; + + /** + * power supply status flags (see MAV_POWER_STATUS enum) + */ + public int flags; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_POWER_STATUS; + + packet.payload.putUnsignedShort(Vcc); + + packet.payload.putUnsignedShort(Vservo); + + packet.payload.putUnsignedShort(flags); + + return packet; + } + + /** + * Decode a power_status message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.Vcc = payload.getUnsignedShort(); + + this.Vservo = payload.getUnsignedShort(); + + this.flags = payload.getUnsignedShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_power_status() { + msgid = MAVLINK_MSG_ID_POWER_STATUS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_power_status(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_POWER_STATUS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_POWER_STATUS - sysid:" + sysid + " compid:" + compid + " Vcc:" + Vcc + " Vservo:" + Vservo + " flags:" + flags + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_protocol_version.java b/app/src/main/java/com/MAVLink/common/msg_protocol_version.java new file mode 100644 index 0000000..8600da5 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_protocol_version.java @@ -0,0 +1,134 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE PROTOCOL_VERSION PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * WIP: Version and capability of protocol version. This message is the response to REQUEST_PROTOCOL_VERSION and is used as part of the handshaking to establish which MAVLink version should be used on the network. Every node should respond to REQUEST_PROTOCOL_VERSION to enable the handshaking. Library implementers should consider adding this into the default decoding state machine to allow the protocol core to respond directly. + */ +public class msg_protocol_version extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_PROTOCOL_VERSION = 300; + public static final int MAVLINK_MSG_LENGTH = 22; + private static final long serialVersionUID = MAVLINK_MSG_ID_PROTOCOL_VERSION; + + + /** + * Currently active MAVLink version number * 100: v1.0 is 100, v2.0 is 200, etc. + */ + public int version; + + /** + * Minimum MAVLink version supported + */ + public int min_version; + + /** + * Maximum MAVLink version supported (set to the same value as version by default) + */ + public int max_version; + + /** + * The first 8 bytes (not characters printed in hex!) of the git hash. + */ + public short spec_version_hash[] = new short[8]; + + /** + * The first 8 bytes (not characters printed in hex!) of the git hash. + */ + public short library_version_hash[] = new short[8]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_PROTOCOL_VERSION; + + packet.payload.putUnsignedShort(version); + + packet.payload.putUnsignedShort(min_version); + + packet.payload.putUnsignedShort(max_version); + + + for (int i = 0; i < spec_version_hash.length; i++) { + packet.payload.putUnsignedByte(spec_version_hash[i]); + } + + + for (int i = 0; i < library_version_hash.length; i++) { + packet.payload.putUnsignedByte(library_version_hash[i]); + } + + + return packet; + } + + /** + * Decode a protocol_version message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.version = payload.getUnsignedShort(); + + this.min_version = payload.getUnsignedShort(); + + this.max_version = payload.getUnsignedShort(); + + + for (int i = 0; i < this.spec_version_hash.length; i++) { + this.spec_version_hash[i] = payload.getUnsignedByte(); + } + + + for (int i = 0; i < this.library_version_hash.length; i++) { + this.library_version_hash[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_protocol_version() { + msgid = MAVLINK_MSG_ID_PROTOCOL_VERSION; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_protocol_version(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_PROTOCOL_VERSION; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_PROTOCOL_VERSION - sysid:" + sysid + " compid:" + compid + " version:" + version + " min_version:" + min_version + " max_version:" + max_version + " spec_version_hash:" + spec_version_hash + " library_version_hash:" + library_version_hash + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_radio_status.java b/app/src/main/java/com/MAVLink/common/msg_radio_status.java new file mode 100644 index 0000000..fdd32d6 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_radio_status.java @@ -0,0 +1,138 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE RADIO_STATUS PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Status generated by radio and injected into MAVLink stream. + */ +public class msg_radio_status extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_RADIO_STATUS = 109; + public static final int MAVLINK_MSG_LENGTH = 9; + private static final long serialVersionUID = MAVLINK_MSG_ID_RADIO_STATUS; + + + /** + * Receive errors + */ + public int rxerrors; + + /** + * Count of error corrected packets + */ + public int fixed; + + /** + * Local signal strength + */ + public short rssi; + + /** + * Remote signal strength + */ + public short remrssi; + + /** + * Remaining free buffer space in percent. + */ + public short txbuf; + + /** + * Background noise level + */ + public short noise; + + /** + * Remote background noise level + */ + public short remnoise; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_RADIO_STATUS; + + packet.payload.putUnsignedShort(rxerrors); + + packet.payload.putUnsignedShort(fixed); + + packet.payload.putUnsignedByte(rssi); + + packet.payload.putUnsignedByte(remrssi); + + packet.payload.putUnsignedByte(txbuf); + + packet.payload.putUnsignedByte(noise); + + packet.payload.putUnsignedByte(remnoise); + + return packet; + } + + /** + * Decode a radio_status message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.rxerrors = payload.getUnsignedShort(); + + this.fixed = payload.getUnsignedShort(); + + this.rssi = payload.getUnsignedByte(); + + this.remrssi = payload.getUnsignedByte(); + + this.txbuf = payload.getUnsignedByte(); + + this.noise = payload.getUnsignedByte(); + + this.remnoise = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_radio_status() { + msgid = MAVLINK_MSG_ID_RADIO_STATUS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_radio_status(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_RADIO_STATUS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_RADIO_STATUS - sysid:" + sysid + " compid:" + compid + " rxerrors:" + rxerrors + " fixed:" + fixed + " rssi:" + rssi + " remrssi:" + remrssi + " txbuf:" + txbuf + " noise:" + noise + " remnoise:" + remnoise + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_raw_imu.java b/app/src/main/java/com/MAVLink/common/msg_raw_imu.java new file mode 100644 index 0000000..085193d --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_raw_imu.java @@ -0,0 +1,165 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE RAW_IMU PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The RAW IMU readings for the usual 9DOF sensor setup. This message should always contain the true raw values without any scaling to allow data capture and system debugging. + */ +public class msg_raw_imu extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_RAW_IMU = 27; + public static final int MAVLINK_MSG_LENGTH = 26; + private static final long serialVersionUID = MAVLINK_MSG_ID_RAW_IMU; + + + /** + * Timestamp (microseconds since UNIX epoch or microseconds since system boot) + */ + public long time_usec; + + /** + * X acceleration (raw) + */ + public short xacc; + + /** + * Y acceleration (raw) + */ + public short yacc; + + /** + * Z acceleration (raw) + */ + public short zacc; + + /** + * Angular speed around X axis (raw) + */ + public short xgyro; + + /** + * Angular speed around Y axis (raw) + */ + public short ygyro; + + /** + * Angular speed around Z axis (raw) + */ + public short zgyro; + + /** + * X Magnetic field (raw) + */ + public short xmag; + + /** + * Y Magnetic field (raw) + */ + public short ymag; + + /** + * Z Magnetic field (raw) + */ + public short zmag; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_RAW_IMU; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putShort(xacc); + + packet.payload.putShort(yacc); + + packet.payload.putShort(zacc); + + packet.payload.putShort(xgyro); + + packet.payload.putShort(ygyro); + + packet.payload.putShort(zgyro); + + packet.payload.putShort(xmag); + + packet.payload.putShort(ymag); + + packet.payload.putShort(zmag); + + return packet; + } + + /** + * Decode a raw_imu message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.xacc = payload.getShort(); + + this.yacc = payload.getShort(); + + this.zacc = payload.getShort(); + + this.xgyro = payload.getShort(); + + this.ygyro = payload.getShort(); + + this.zgyro = payload.getShort(); + + this.xmag = payload.getShort(); + + this.ymag = payload.getShort(); + + this.zmag = payload.getShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_raw_imu() { + msgid = MAVLINK_MSG_ID_RAW_IMU; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_raw_imu(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_RAW_IMU; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_RAW_IMU - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " xacc:" + xacc + " yacc:" + yacc + " zacc:" + zacc + " xgyro:" + xgyro + " ygyro:" + ygyro + " zgyro:" + zgyro + " xmag:" + xmag + " ymag:" + ymag + " zmag:" + zmag + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_raw_pressure.java b/app/src/main/java/com/MAVLink/common/msg_raw_pressure.java new file mode 100644 index 0000000..6b6f3ce --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_raw_pressure.java @@ -0,0 +1,120 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE RAW_PRESSURE PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The RAW pressure readings for the typical setup of one absolute pressure and one differential pressure sensor. The sensor values should be the raw, UNSCALED ADC values. + */ +public class msg_raw_pressure extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_RAW_PRESSURE = 28; + public static final int MAVLINK_MSG_LENGTH = 16; + private static final long serialVersionUID = MAVLINK_MSG_ID_RAW_PRESSURE; + + + /** + * Timestamp (microseconds since UNIX epoch or microseconds since system boot) + */ + public long time_usec; + + /** + * Absolute pressure (raw) + */ + public short press_abs; + + /** + * Differential pressure 1 (raw, 0 if nonexistant) + */ + public short press_diff1; + + /** + * Differential pressure 2 (raw, 0 if nonexistant) + */ + public short press_diff2; + + /** + * Raw Temperature measurement (raw) + */ + public short temperature; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_RAW_PRESSURE; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putShort(press_abs); + + packet.payload.putShort(press_diff1); + + packet.payload.putShort(press_diff2); + + packet.payload.putShort(temperature); + + return packet; + } + + /** + * Decode a raw_pressure message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.press_abs = payload.getShort(); + + this.press_diff1 = payload.getShort(); + + this.press_diff2 = payload.getShort(); + + this.temperature = payload.getShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_raw_pressure() { + msgid = MAVLINK_MSG_ID_RAW_PRESSURE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_raw_pressure(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_RAW_PRESSURE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_RAW_PRESSURE - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " press_abs:" + press_abs + " press_diff1:" + press_diff1 + " press_diff2:" + press_diff2 + " temperature:" + temperature + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_rc_channels.java b/app/src/main/java/com/MAVLink/common/msg_rc_channels.java new file mode 100644 index 0000000..68b7697 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_rc_channels.java @@ -0,0 +1,264 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE RC_CHANNELS PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The PPM values of the RC channels received. The standard PPM modulation is as follows: 1000 microseconds: 0%, 2000 microseconds: 100%. Individual receivers/transmitters might violate this specification. + */ +public class msg_rc_channels extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_RC_CHANNELS = 65; + public static final int MAVLINK_MSG_LENGTH = 42; + private static final long serialVersionUID = MAVLINK_MSG_ID_RC_CHANNELS; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan1_raw; + + /** + * RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan2_raw; + + /** + * RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan3_raw; + + /** + * RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan4_raw; + + /** + * RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan5_raw; + + /** + * RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan6_raw; + + /** + * RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan7_raw; + + /** + * RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan8_raw; + + /** + * RC channel 9 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan9_raw; + + /** + * RC channel 10 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan10_raw; + + /** + * RC channel 11 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan11_raw; + + /** + * RC channel 12 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan12_raw; + + /** + * RC channel 13 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan13_raw; + + /** + * RC channel 14 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan14_raw; + + /** + * RC channel 15 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan15_raw; + + /** + * RC channel 16 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan16_raw; + + /** + * RC channel 17 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan17_raw; + + /** + * RC channel 18 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan18_raw; + + /** + * Total number of RC channels being received. This can be larger than 18, indicating that more channels are available but not given in this message. This value should be 0 when no RC channels are available. + */ + public short chancount; + + /** + * Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown. + */ + public short rssi; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_RC_CHANNELS; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putUnsignedShort(chan1_raw); + + packet.payload.putUnsignedShort(chan2_raw); + + packet.payload.putUnsignedShort(chan3_raw); + + packet.payload.putUnsignedShort(chan4_raw); + + packet.payload.putUnsignedShort(chan5_raw); + + packet.payload.putUnsignedShort(chan6_raw); + + packet.payload.putUnsignedShort(chan7_raw); + + packet.payload.putUnsignedShort(chan8_raw); + + packet.payload.putUnsignedShort(chan9_raw); + + packet.payload.putUnsignedShort(chan10_raw); + + packet.payload.putUnsignedShort(chan11_raw); + + packet.payload.putUnsignedShort(chan12_raw); + + packet.payload.putUnsignedShort(chan13_raw); + + packet.payload.putUnsignedShort(chan14_raw); + + packet.payload.putUnsignedShort(chan15_raw); + + packet.payload.putUnsignedShort(chan16_raw); + + packet.payload.putUnsignedShort(chan17_raw); + + packet.payload.putUnsignedShort(chan18_raw); + + packet.payload.putUnsignedByte(chancount); + + packet.payload.putUnsignedByte(rssi); + + return packet; + } + + /** + * Decode a rc_channels message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.chan1_raw = payload.getUnsignedShort(); + + this.chan2_raw = payload.getUnsignedShort(); + + this.chan3_raw = payload.getUnsignedShort(); + + this.chan4_raw = payload.getUnsignedShort(); + + this.chan5_raw = payload.getUnsignedShort(); + + this.chan6_raw = payload.getUnsignedShort(); + + this.chan7_raw = payload.getUnsignedShort(); + + this.chan8_raw = payload.getUnsignedShort(); + + this.chan9_raw = payload.getUnsignedShort(); + + this.chan10_raw = payload.getUnsignedShort(); + + this.chan11_raw = payload.getUnsignedShort(); + + this.chan12_raw = payload.getUnsignedShort(); + + this.chan13_raw = payload.getUnsignedShort(); + + this.chan14_raw = payload.getUnsignedShort(); + + this.chan15_raw = payload.getUnsignedShort(); + + this.chan16_raw = payload.getUnsignedShort(); + + this.chan17_raw = payload.getUnsignedShort(); + + this.chan18_raw = payload.getUnsignedShort(); + + this.chancount = payload.getUnsignedByte(); + + this.rssi = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_rc_channels() { + msgid = MAVLINK_MSG_ID_RC_CHANNELS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_rc_channels(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_RC_CHANNELS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_RC_CHANNELS - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " chan1_raw:" + chan1_raw + " chan2_raw:" + chan2_raw + " chan3_raw:" + chan3_raw + " chan4_raw:" + chan4_raw + " chan5_raw:" + chan5_raw + " chan6_raw:" + chan6_raw + " chan7_raw:" + chan7_raw + " chan8_raw:" + chan8_raw + " chan9_raw:" + chan9_raw + " chan10_raw:" + chan10_raw + " chan11_raw:" + chan11_raw + " chan12_raw:" + chan12_raw + " chan13_raw:" + chan13_raw + " chan14_raw:" + chan14_raw + " chan15_raw:" + chan15_raw + " chan16_raw:" + chan16_raw + " chan17_raw:" + chan17_raw + " chan18_raw:" + chan18_raw + " chancount:" + chancount + " rssi:" + rssi + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_rc_channels_override.java b/app/src/main/java/com/MAVLink/common/msg_rc_channels_override.java new file mode 100644 index 0000000..601ed65 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_rc_channels_override.java @@ -0,0 +1,165 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE RC_CHANNELS_OVERRIDE PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The RAW values of the RC channels sent to the MAV to override info received from the RC radio. A value of UINT16_MAX means no change to that channel. A value of 0 means control of that channel should be released back to the RC radio. The standard PPM modulation is as follows: 1000 microseconds: 0%, 2000 microseconds: 100%. Individual receivers/transmitters might violate this specification. + */ +public class msg_rc_channels_override extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE = 70; + public static final int MAVLINK_MSG_LENGTH = 18; + private static final long serialVersionUID = MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE; + + + /** + * RC channel 1 value, in microseconds. A value of UINT16_MAX means to ignore this field. + */ + public int chan1_raw; + + /** + * RC channel 2 value, in microseconds. A value of UINT16_MAX means to ignore this field. + */ + public int chan2_raw; + + /** + * RC channel 3 value, in microseconds. A value of UINT16_MAX means to ignore this field. + */ + public int chan3_raw; + + /** + * RC channel 4 value, in microseconds. A value of UINT16_MAX means to ignore this field. + */ + public int chan4_raw; + + /** + * RC channel 5 value, in microseconds. A value of UINT16_MAX means to ignore this field. + */ + public int chan5_raw; + + /** + * RC channel 6 value, in microseconds. A value of UINT16_MAX means to ignore this field. + */ + public int chan6_raw; + + /** + * RC channel 7 value, in microseconds. A value of UINT16_MAX means to ignore this field. + */ + public int chan7_raw; + + /** + * RC channel 8 value, in microseconds. A value of UINT16_MAX means to ignore this field. + */ + public int chan8_raw; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE; + + packet.payload.putUnsignedShort(chan1_raw); + + packet.payload.putUnsignedShort(chan2_raw); + + packet.payload.putUnsignedShort(chan3_raw); + + packet.payload.putUnsignedShort(chan4_raw); + + packet.payload.putUnsignedShort(chan5_raw); + + packet.payload.putUnsignedShort(chan6_raw); + + packet.payload.putUnsignedShort(chan7_raw); + + packet.payload.putUnsignedShort(chan8_raw); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + return packet; + } + + /** + * Decode a rc_channels_override message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.chan1_raw = payload.getUnsignedShort(); + + this.chan2_raw = payload.getUnsignedShort(); + + this.chan3_raw = payload.getUnsignedShort(); + + this.chan4_raw = payload.getUnsignedShort(); + + this.chan5_raw = payload.getUnsignedShort(); + + this.chan6_raw = payload.getUnsignedShort(); + + this.chan7_raw = payload.getUnsignedShort(); + + this.chan8_raw = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_rc_channels_override() { + msgid = MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_rc_channels_override(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE - sysid:" + sysid + " compid:" + compid + " chan1_raw:" + chan1_raw + " chan2_raw:" + chan2_raw + " chan3_raw:" + chan3_raw + " chan4_raw:" + chan4_raw + " chan5_raw:" + chan5_raw + " chan6_raw:" + chan6_raw + " chan7_raw:" + chan7_raw + " chan8_raw:" + chan8_raw + " target_system:" + target_system + " target_component:" + target_component + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_rc_channels_raw.java b/app/src/main/java/com/MAVLink/common/msg_rc_channels_raw.java new file mode 100644 index 0000000..c6bae7c --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_rc_channels_raw.java @@ -0,0 +1,174 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE RC_CHANNELS_RAW PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The RAW values of the RC channels received. The standard PPM modulation is as follows: 1000 microseconds: 0%, 2000 microseconds: 100%. Individual receivers/transmitters might violate this specification. + */ +public class msg_rc_channels_raw extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_RC_CHANNELS_RAW = 35; + public static final int MAVLINK_MSG_LENGTH = 22; + private static final long serialVersionUID = MAVLINK_MSG_ID_RC_CHANNELS_RAW; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan1_raw; + + /** + * RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan2_raw; + + /** + * RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan3_raw; + + /** + * RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan4_raw; + + /** + * RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan5_raw; + + /** + * RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan6_raw; + + /** + * RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan7_raw; + + /** + * RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused. + */ + public int chan8_raw; + + /** + * Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows for more than 8 servos. + */ + public short port; + + /** + * Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown. + */ + public short rssi; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_RC_CHANNELS_RAW; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putUnsignedShort(chan1_raw); + + packet.payload.putUnsignedShort(chan2_raw); + + packet.payload.putUnsignedShort(chan3_raw); + + packet.payload.putUnsignedShort(chan4_raw); + + packet.payload.putUnsignedShort(chan5_raw); + + packet.payload.putUnsignedShort(chan6_raw); + + packet.payload.putUnsignedShort(chan7_raw); + + packet.payload.putUnsignedShort(chan8_raw); + + packet.payload.putUnsignedByte(port); + + packet.payload.putUnsignedByte(rssi); + + return packet; + } + + /** + * Decode a rc_channels_raw message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.chan1_raw = payload.getUnsignedShort(); + + this.chan2_raw = payload.getUnsignedShort(); + + this.chan3_raw = payload.getUnsignedShort(); + + this.chan4_raw = payload.getUnsignedShort(); + + this.chan5_raw = payload.getUnsignedShort(); + + this.chan6_raw = payload.getUnsignedShort(); + + this.chan7_raw = payload.getUnsignedShort(); + + this.chan8_raw = payload.getUnsignedShort(); + + this.port = payload.getUnsignedByte(); + + this.rssi = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_rc_channels_raw() { + msgid = MAVLINK_MSG_ID_RC_CHANNELS_RAW; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_rc_channels_raw(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_RC_CHANNELS_RAW; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_RC_CHANNELS_RAW - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " chan1_raw:" + chan1_raw + " chan2_raw:" + chan2_raw + " chan3_raw:" + chan3_raw + " chan4_raw:" + chan4_raw + " chan5_raw:" + chan5_raw + " chan6_raw:" + chan6_raw + " chan7_raw:" + chan7_raw + " chan8_raw:" + chan8_raw + " port:" + port + " rssi:" + rssi + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_rc_channels_scaled.java b/app/src/main/java/com/MAVLink/common/msg_rc_channels_scaled.java new file mode 100644 index 0000000..8bc8b87 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_rc_channels_scaled.java @@ -0,0 +1,174 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE RC_CHANNELS_SCALED PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The scaled values of the RC channels received. (-100%) -10000, (0%) 0, (100%) 10000. Channels that are inactive should be set to UINT16_MAX. + */ +public class msg_rc_channels_scaled extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_RC_CHANNELS_SCALED = 34; + public static final int MAVLINK_MSG_LENGTH = 22; + private static final long serialVersionUID = MAVLINK_MSG_ID_RC_CHANNELS_SCALED; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * RC channel 1 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. + */ + public short chan1_scaled; + + /** + * RC channel 2 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. + */ + public short chan2_scaled; + + /** + * RC channel 3 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. + */ + public short chan3_scaled; + + /** + * RC channel 4 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. + */ + public short chan4_scaled; + + /** + * RC channel 5 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. + */ + public short chan5_scaled; + + /** + * RC channel 6 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. + */ + public short chan6_scaled; + + /** + * RC channel 7 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. + */ + public short chan7_scaled; + + /** + * RC channel 8 value scaled, (-100%) -10000, (0%) 0, (100%) 10000, (invalid) INT16_MAX. + */ + public short chan8_scaled; + + /** + * Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows for more than 8 servos. + */ + public short port; + + /** + * Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown. + */ + public short rssi; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_RC_CHANNELS_SCALED; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putShort(chan1_scaled); + + packet.payload.putShort(chan2_scaled); + + packet.payload.putShort(chan3_scaled); + + packet.payload.putShort(chan4_scaled); + + packet.payload.putShort(chan5_scaled); + + packet.payload.putShort(chan6_scaled); + + packet.payload.putShort(chan7_scaled); + + packet.payload.putShort(chan8_scaled); + + packet.payload.putUnsignedByte(port); + + packet.payload.putUnsignedByte(rssi); + + return packet; + } + + /** + * Decode a rc_channels_scaled message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.chan1_scaled = payload.getShort(); + + this.chan2_scaled = payload.getShort(); + + this.chan3_scaled = payload.getShort(); + + this.chan4_scaled = payload.getShort(); + + this.chan5_scaled = payload.getShort(); + + this.chan6_scaled = payload.getShort(); + + this.chan7_scaled = payload.getShort(); + + this.chan8_scaled = payload.getShort(); + + this.port = payload.getUnsignedByte(); + + this.rssi = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_rc_channels_scaled() { + msgid = MAVLINK_MSG_ID_RC_CHANNELS_SCALED; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_rc_channels_scaled(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_RC_CHANNELS_SCALED; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_RC_CHANNELS_SCALED - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " chan1_scaled:" + chan1_scaled + " chan2_scaled:" + chan2_scaled + " chan3_scaled:" + chan3_scaled + " chan4_scaled:" + chan4_scaled + " chan5_scaled:" + chan5_scaled + " chan6_scaled:" + chan6_scaled + " chan7_scaled:" + chan7_scaled + " chan8_scaled:" + chan8_scaled + " port:" + port + " rssi:" + rssi + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_request_data_stream.java b/app/src/main/java/com/MAVLink/common/msg_request_data_stream.java new file mode 100644 index 0000000..78b17c9 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_request_data_stream.java @@ -0,0 +1,120 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE REQUEST_DATA_STREAM PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * THIS INTERFACE IS DEPRECATED. USE SET_MESSAGE_INTERVAL INSTEAD. + */ +public class msg_request_data_stream extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_REQUEST_DATA_STREAM = 66; + public static final int MAVLINK_MSG_LENGTH = 6; + private static final long serialVersionUID = MAVLINK_MSG_ID_REQUEST_DATA_STREAM; + + + /** + * The requested message rate + */ + public int req_message_rate; + + /** + * The target requested to send the message stream. + */ + public short target_system; + + /** + * The target requested to send the message stream. + */ + public short target_component; + + /** + * The ID of the requested data stream + */ + public short req_stream_id; + + /** + * 1 to start sending, 0 to stop sending. + */ + public short start_stop; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_REQUEST_DATA_STREAM; + + packet.payload.putUnsignedShort(req_message_rate); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(req_stream_id); + + packet.payload.putUnsignedByte(start_stop); + + return packet; + } + + /** + * Decode a request_data_stream message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.req_message_rate = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.req_stream_id = payload.getUnsignedByte(); + + this.start_stop = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_request_data_stream() { + msgid = MAVLINK_MSG_ID_REQUEST_DATA_STREAM; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_request_data_stream(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_REQUEST_DATA_STREAM; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_REQUEST_DATA_STREAM - sysid:" + sysid + " compid:" + compid + " req_message_rate:" + req_message_rate + " target_system:" + target_system + " target_component:" + target_component + " req_stream_id:" + req_stream_id + " start_stop:" + start_stop + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_resource_request.java b/app/src/main/java/com/MAVLink/common/msg_resource_request.java new file mode 100644 index 0000000..4da3273 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_resource_request.java @@ -0,0 +1,136 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE RESOURCE_REQUEST PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The autopilot is requesting a resource (file, binary, other type of data) + */ +public class msg_resource_request extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_RESOURCE_REQUEST = 142; + public static final int MAVLINK_MSG_LENGTH = 243; + private static final long serialVersionUID = MAVLINK_MSG_ID_RESOURCE_REQUEST; + + + /** + * Request ID. This ID should be re-used when sending back URI contents + */ + public short request_id; + + /** + * The type of requested URI. 0 = a file via URL. 1 = a UAVCAN binary + */ + public short uri_type; + + /** + * The requested unique resource identifier (URI). It is not necessarily a straight domain name (depends on the URI type enum) + */ + public short uri[] = new short[120]; + + /** + * The way the autopilot wants to receive the URI. 0 = MAVLink FTP. 1 = binary stream. + */ + public short transfer_type; + + /** + * The storage path the autopilot wants the URI to be stored in. Will only be valid if the transfer_type has a storage associated (e.g. MAVLink FTP). + */ + public short storage[] = new short[120]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_RESOURCE_REQUEST; + + packet.payload.putUnsignedByte(request_id); + + packet.payload.putUnsignedByte(uri_type); + + + for (int i = 0; i < uri.length; i++) { + packet.payload.putUnsignedByte(uri[i]); + } + + + packet.payload.putUnsignedByte(transfer_type); + + + for (int i = 0; i < storage.length; i++) { + packet.payload.putUnsignedByte(storage[i]); + } + + + return packet; + } + + /** + * Decode a resource_request message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.request_id = payload.getUnsignedByte(); + + this.uri_type = payload.getUnsignedByte(); + + + for (int i = 0; i < this.uri.length; i++) { + this.uri[i] = payload.getUnsignedByte(); + } + + + this.transfer_type = payload.getUnsignedByte(); + + + for (int i = 0; i < this.storage.length; i++) { + this.storage[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_resource_request() { + msgid = MAVLINK_MSG_ID_RESOURCE_REQUEST; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_resource_request(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_RESOURCE_REQUEST; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_RESOURCE_REQUEST - sysid:" + sysid + " compid:" + compid + " request_id:" + request_id + " uri_type:" + uri_type + " uri:" + uri + " transfer_type:" + transfer_type + " storage:" + storage + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_safety_allowed_area.java b/app/src/main/java/com/MAVLink/common/msg_safety_allowed_area.java new file mode 100644 index 0000000..77a4fba --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_safety_allowed_area.java @@ -0,0 +1,138 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SAFETY_ALLOWED_AREA PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Read out the safety zone the MAV currently assumes. + */ +public class msg_safety_allowed_area extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA = 55; + public static final int MAVLINK_MSG_LENGTH = 25; + private static final long serialVersionUID = MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA; + + + /** + * x position 1 / Latitude 1 + */ + public float p1x; + + /** + * y position 1 / Longitude 1 + */ + public float p1y; + + /** + * z position 1 / Altitude 1 + */ + public float p1z; + + /** + * x position 2 / Latitude 2 + */ + public float p2x; + + /** + * y position 2 / Longitude 2 + */ + public float p2y; + + /** + * z position 2 / Altitude 2 + */ + public float p2z; + + /** + * Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. + */ + public short frame; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA; + + packet.payload.putFloat(p1x); + + packet.payload.putFloat(p1y); + + packet.payload.putFloat(p1z); + + packet.payload.putFloat(p2x); + + packet.payload.putFloat(p2y); + + packet.payload.putFloat(p2z); + + packet.payload.putUnsignedByte(frame); + + return packet; + } + + /** + * Decode a safety_allowed_area message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.p1x = payload.getFloat(); + + this.p1y = payload.getFloat(); + + this.p1z = payload.getFloat(); + + this.p2x = payload.getFloat(); + + this.p2y = payload.getFloat(); + + this.p2z = payload.getFloat(); + + this.frame = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_safety_allowed_area() { + msgid = MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_safety_allowed_area(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA - sysid:" + sysid + " compid:" + compid + " p1x:" + p1x + " p1y:" + p1y + " p1z:" + p1z + " p2x:" + p2x + " p2y:" + p2y + " p2z:" + p2z + " frame:" + frame + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_safety_set_allowed_area.java b/app/src/main/java/com/MAVLink/common/msg_safety_set_allowed_area.java new file mode 100644 index 0000000..9a7048a --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_safety_set_allowed_area.java @@ -0,0 +1,156 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SAFETY_SET_ALLOWED_AREA PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Set a safety zone (volume), which is defined by two corners of a cube. This message can be used to tell the MAV which setpoints/MISSIONs to accept and which to reject. Safety areas are often enforced by national or competition regulations. + */ +public class msg_safety_set_allowed_area extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA = 54; + public static final int MAVLINK_MSG_LENGTH = 27; + private static final long serialVersionUID = MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA; + + + /** + * x position 1 / Latitude 1 + */ + public float p1x; + + /** + * y position 1 / Longitude 1 + */ + public float p1y; + + /** + * z position 1 / Altitude 1 + */ + public float p1z; + + /** + * x position 2 / Latitude 2 + */ + public float p2x; + + /** + * y position 2 / Longitude 2 + */ + public float p2y; + + /** + * z position 2 / Altitude 2 + */ + public float p2z; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down. + */ + public short frame; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA; + + packet.payload.putFloat(p1x); + + packet.payload.putFloat(p1y); + + packet.payload.putFloat(p1z); + + packet.payload.putFloat(p2x); + + packet.payload.putFloat(p2y); + + packet.payload.putFloat(p2z); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(frame); + + return packet; + } + + /** + * Decode a safety_set_allowed_area message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.p1x = payload.getFloat(); + + this.p1y = payload.getFloat(); + + this.p1z = payload.getFloat(); + + this.p2x = payload.getFloat(); + + this.p2y = payload.getFloat(); + + this.p2z = payload.getFloat(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.frame = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_safety_set_allowed_area() { + msgid = MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_safety_set_allowed_area(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA - sysid:" + sysid + " compid:" + compid + " p1x:" + p1x + " p1y:" + p1y + " p1z:" + p1z + " p2x:" + p2x + " p2y:" + p2y + " p2z:" + p2z + " target_system:" + target_system + " target_component:" + target_component + " frame:" + frame + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_scaled_imu.java b/app/src/main/java/com/MAVLink/common/msg_scaled_imu.java new file mode 100644 index 0000000..741f00c --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_scaled_imu.java @@ -0,0 +1,165 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SCALED_IMU PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The RAW IMU readings for the usual 9DOF sensor setup. This message should contain the scaled values to the described units + */ +public class msg_scaled_imu extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SCALED_IMU = 26; + public static final int MAVLINK_MSG_LENGTH = 22; + private static final long serialVersionUID = MAVLINK_MSG_ID_SCALED_IMU; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * X acceleration (mg) + */ + public short xacc; + + /** + * Y acceleration (mg) + */ + public short yacc; + + /** + * Z acceleration (mg) + */ + public short zacc; + + /** + * Angular speed around X axis (millirad /sec) + */ + public short xgyro; + + /** + * Angular speed around Y axis (millirad /sec) + */ + public short ygyro; + + /** + * Angular speed around Z axis (millirad /sec) + */ + public short zgyro; + + /** + * X Magnetic field (milli tesla) + */ + public short xmag; + + /** + * Y Magnetic field (milli tesla) + */ + public short ymag; + + /** + * Z Magnetic field (milli tesla) + */ + public short zmag; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SCALED_IMU; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putShort(xacc); + + packet.payload.putShort(yacc); + + packet.payload.putShort(zacc); + + packet.payload.putShort(xgyro); + + packet.payload.putShort(ygyro); + + packet.payload.putShort(zgyro); + + packet.payload.putShort(xmag); + + packet.payload.putShort(ymag); + + packet.payload.putShort(zmag); + + return packet; + } + + /** + * Decode a scaled_imu message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.xacc = payload.getShort(); + + this.yacc = payload.getShort(); + + this.zacc = payload.getShort(); + + this.xgyro = payload.getShort(); + + this.ygyro = payload.getShort(); + + this.zgyro = payload.getShort(); + + this.xmag = payload.getShort(); + + this.ymag = payload.getShort(); + + this.zmag = payload.getShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_scaled_imu() { + msgid = MAVLINK_MSG_ID_SCALED_IMU; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_scaled_imu(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SCALED_IMU; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SCALED_IMU - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " xacc:" + xacc + " yacc:" + yacc + " zacc:" + zacc + " xgyro:" + xgyro + " ygyro:" + ygyro + " zgyro:" + zgyro + " xmag:" + xmag + " ymag:" + ymag + " zmag:" + zmag + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_scaled_imu2.java b/app/src/main/java/com/MAVLink/common/msg_scaled_imu2.java new file mode 100644 index 0000000..d2c272a --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_scaled_imu2.java @@ -0,0 +1,165 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SCALED_IMU2 PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The RAW IMU readings for secondary 9DOF sensor setup. This message should contain the scaled values to the described units + */ +public class msg_scaled_imu2 extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SCALED_IMU2 = 116; + public static final int MAVLINK_MSG_LENGTH = 22; + private static final long serialVersionUID = MAVLINK_MSG_ID_SCALED_IMU2; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * X acceleration (mg) + */ + public short xacc; + + /** + * Y acceleration (mg) + */ + public short yacc; + + /** + * Z acceleration (mg) + */ + public short zacc; + + /** + * Angular speed around X axis (millirad /sec) + */ + public short xgyro; + + /** + * Angular speed around Y axis (millirad /sec) + */ + public short ygyro; + + /** + * Angular speed around Z axis (millirad /sec) + */ + public short zgyro; + + /** + * X Magnetic field (milli tesla) + */ + public short xmag; + + /** + * Y Magnetic field (milli tesla) + */ + public short ymag; + + /** + * Z Magnetic field (milli tesla) + */ + public short zmag; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SCALED_IMU2; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putShort(xacc); + + packet.payload.putShort(yacc); + + packet.payload.putShort(zacc); + + packet.payload.putShort(xgyro); + + packet.payload.putShort(ygyro); + + packet.payload.putShort(zgyro); + + packet.payload.putShort(xmag); + + packet.payload.putShort(ymag); + + packet.payload.putShort(zmag); + + return packet; + } + + /** + * Decode a scaled_imu2 message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.xacc = payload.getShort(); + + this.yacc = payload.getShort(); + + this.zacc = payload.getShort(); + + this.xgyro = payload.getShort(); + + this.ygyro = payload.getShort(); + + this.zgyro = payload.getShort(); + + this.xmag = payload.getShort(); + + this.ymag = payload.getShort(); + + this.zmag = payload.getShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_scaled_imu2() { + msgid = MAVLINK_MSG_ID_SCALED_IMU2; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_scaled_imu2(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SCALED_IMU2; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SCALED_IMU2 - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " xacc:" + xacc + " yacc:" + yacc + " zacc:" + zacc + " xgyro:" + xgyro + " ygyro:" + ygyro + " zgyro:" + zgyro + " xmag:" + xmag + " ymag:" + ymag + " zmag:" + zmag + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_scaled_imu3.java b/app/src/main/java/com/MAVLink/common/msg_scaled_imu3.java new file mode 100644 index 0000000..6e4fd04 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_scaled_imu3.java @@ -0,0 +1,165 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SCALED_IMU3 PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The RAW IMU readings for 3rd 9DOF sensor setup. This message should contain the scaled values to the described units + */ +public class msg_scaled_imu3 extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SCALED_IMU3 = 129; + public static final int MAVLINK_MSG_LENGTH = 22; + private static final long serialVersionUID = MAVLINK_MSG_ID_SCALED_IMU3; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * X acceleration (mg) + */ + public short xacc; + + /** + * Y acceleration (mg) + */ + public short yacc; + + /** + * Z acceleration (mg) + */ + public short zacc; + + /** + * Angular speed around X axis (millirad /sec) + */ + public short xgyro; + + /** + * Angular speed around Y axis (millirad /sec) + */ + public short ygyro; + + /** + * Angular speed around Z axis (millirad /sec) + */ + public short zgyro; + + /** + * X Magnetic field (milli tesla) + */ + public short xmag; + + /** + * Y Magnetic field (milli tesla) + */ + public short ymag; + + /** + * Z Magnetic field (milli tesla) + */ + public short zmag; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SCALED_IMU3; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putShort(xacc); + + packet.payload.putShort(yacc); + + packet.payload.putShort(zacc); + + packet.payload.putShort(xgyro); + + packet.payload.putShort(ygyro); + + packet.payload.putShort(zgyro); + + packet.payload.putShort(xmag); + + packet.payload.putShort(ymag); + + packet.payload.putShort(zmag); + + return packet; + } + + /** + * Decode a scaled_imu3 message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.xacc = payload.getShort(); + + this.yacc = payload.getShort(); + + this.zacc = payload.getShort(); + + this.xgyro = payload.getShort(); + + this.ygyro = payload.getShort(); + + this.zgyro = payload.getShort(); + + this.xmag = payload.getShort(); + + this.ymag = payload.getShort(); + + this.zmag = payload.getShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_scaled_imu3() { + msgid = MAVLINK_MSG_ID_SCALED_IMU3; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_scaled_imu3(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SCALED_IMU3; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SCALED_IMU3 - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " xacc:" + xacc + " yacc:" + yacc + " zacc:" + zacc + " xgyro:" + xgyro + " ygyro:" + ygyro + " zgyro:" + zgyro + " xmag:" + xmag + " ymag:" + ymag + " zmag:" + zmag + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_scaled_pressure.java b/app/src/main/java/com/MAVLink/common/msg_scaled_pressure.java new file mode 100644 index 0000000..0668583 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_scaled_pressure.java @@ -0,0 +1,111 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SCALED_PRESSURE PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The pressure readings for the typical setup of one absolute and differential pressure sensor. The units are as specified in each field. + */ +public class msg_scaled_pressure extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SCALED_PRESSURE = 29; + public static final int MAVLINK_MSG_LENGTH = 14; + private static final long serialVersionUID = MAVLINK_MSG_ID_SCALED_PRESSURE; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * Absolute pressure (hectopascal) + */ + public float press_abs; + + /** + * Differential pressure 1 (hectopascal) + */ + public float press_diff; + + /** + * Temperature measurement (0.01 degrees celsius) + */ + public short temperature; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SCALED_PRESSURE; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putFloat(press_abs); + + packet.payload.putFloat(press_diff); + + packet.payload.putShort(temperature); + + return packet; + } + + /** + * Decode a scaled_pressure message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.press_abs = payload.getFloat(); + + this.press_diff = payload.getFloat(); + + this.temperature = payload.getShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_scaled_pressure() { + msgid = MAVLINK_MSG_ID_SCALED_PRESSURE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_scaled_pressure(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SCALED_PRESSURE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SCALED_PRESSURE - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " press_abs:" + press_abs + " press_diff:" + press_diff + " temperature:" + temperature + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_scaled_pressure2.java b/app/src/main/java/com/MAVLink/common/msg_scaled_pressure2.java new file mode 100644 index 0000000..3655c2d --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_scaled_pressure2.java @@ -0,0 +1,111 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SCALED_PRESSURE2 PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Barometer readings for 2nd barometer + */ +public class msg_scaled_pressure2 extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SCALED_PRESSURE2 = 137; + public static final int MAVLINK_MSG_LENGTH = 14; + private static final long serialVersionUID = MAVLINK_MSG_ID_SCALED_PRESSURE2; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * Absolute pressure (hectopascal) + */ + public float press_abs; + + /** + * Differential pressure 1 (hectopascal) + */ + public float press_diff; + + /** + * Temperature measurement (0.01 degrees celsius) + */ + public short temperature; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SCALED_PRESSURE2; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putFloat(press_abs); + + packet.payload.putFloat(press_diff); + + packet.payload.putShort(temperature); + + return packet; + } + + /** + * Decode a scaled_pressure2 message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.press_abs = payload.getFloat(); + + this.press_diff = payload.getFloat(); + + this.temperature = payload.getShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_scaled_pressure2() { + msgid = MAVLINK_MSG_ID_SCALED_PRESSURE2; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_scaled_pressure2(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SCALED_PRESSURE2; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SCALED_PRESSURE2 - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " press_abs:" + press_abs + " press_diff:" + press_diff + " temperature:" + temperature + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_scaled_pressure3.java b/app/src/main/java/com/MAVLink/common/msg_scaled_pressure3.java new file mode 100644 index 0000000..5d0855c --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_scaled_pressure3.java @@ -0,0 +1,111 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SCALED_PRESSURE3 PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Barometer readings for 3rd barometer + */ +public class msg_scaled_pressure3 extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SCALED_PRESSURE3 = 143; + public static final int MAVLINK_MSG_LENGTH = 14; + private static final long serialVersionUID = MAVLINK_MSG_ID_SCALED_PRESSURE3; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * Absolute pressure (hectopascal) + */ + public float press_abs; + + /** + * Differential pressure 1 (hectopascal) + */ + public float press_diff; + + /** + * Temperature measurement (0.01 degrees celsius) + */ + public short temperature; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SCALED_PRESSURE3; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putFloat(press_abs); + + packet.payload.putFloat(press_diff); + + packet.payload.putShort(temperature); + + return packet; + } + + /** + * Decode a scaled_pressure3 message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.press_abs = payload.getFloat(); + + this.press_diff = payload.getFloat(); + + this.temperature = payload.getShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_scaled_pressure3() { + msgid = MAVLINK_MSG_ID_SCALED_PRESSURE3; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_scaled_pressure3(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SCALED_PRESSURE3; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SCALED_PRESSURE3 - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " press_abs:" + press_abs + " press_diff:" + press_diff + " temperature:" + temperature + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_serial_control.java b/app/src/main/java/com/MAVLink/common/msg_serial_control.java new file mode 100644 index 0000000..db498c3 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_serial_control.java @@ -0,0 +1,137 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SERIAL_CONTROL PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Control a serial port. This can be used for raw access to an onboard serial peripheral such as a GPS or telemetry radio. It is designed to make it possible to update the devices firmware via MAVLink messages or change the devices settings. A message with zero bytes can be used to change just the baudrate. + */ +public class msg_serial_control extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SERIAL_CONTROL = 126; + public static final int MAVLINK_MSG_LENGTH = 79; + private static final long serialVersionUID = MAVLINK_MSG_ID_SERIAL_CONTROL; + + + /** + * Baudrate of transfer. Zero means no change. + */ + public long baudrate; + + /** + * Timeout for reply data in milliseconds + */ + public int timeout; + + /** + * See SERIAL_CONTROL_DEV enum + */ + public short device; + + /** + * See SERIAL_CONTROL_FLAG enum + */ + public short flags; + + /** + * how many bytes in this transfer + */ + public short count; + + /** + * serial data + */ + public short data[] = new short[70]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SERIAL_CONTROL; + + packet.payload.putUnsignedInt(baudrate); + + packet.payload.putUnsignedShort(timeout); + + packet.payload.putUnsignedByte(device); + + packet.payload.putUnsignedByte(flags); + + packet.payload.putUnsignedByte(count); + + + for (int i = 0; i < data.length; i++) { + packet.payload.putUnsignedByte(data[i]); + } + + + return packet; + } + + /** + * Decode a serial_control message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.baudrate = payload.getUnsignedInt(); + + this.timeout = payload.getUnsignedShort(); + + this.device = payload.getUnsignedByte(); + + this.flags = payload.getUnsignedByte(); + + this.count = payload.getUnsignedByte(); + + + for (int i = 0; i < this.data.length; i++) { + this.data[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_serial_control() { + msgid = MAVLINK_MSG_ID_SERIAL_CONTROL; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_serial_control(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SERIAL_CONTROL; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SERIAL_CONTROL - sysid:" + sysid + " compid:" + compid + " baudrate:" + baudrate + " timeout:" + timeout + " device:" + device + " flags:" + flags + " count:" + count + " data:" + data + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_servo_output_raw.java b/app/src/main/java/com/MAVLink/common/msg_servo_output_raw.java new file mode 100644 index 0000000..c26a9c6 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_servo_output_raw.java @@ -0,0 +1,237 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SERVO_OUTPUT_RAW PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The RAW values of the servo outputs (for RC input from the remote, use the RC_CHANNELS messages). The standard PPM modulation is as follows: 1000 microseconds: 0%, 2000 microseconds: 100%. + */ +public class msg_servo_output_raw extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SERVO_OUTPUT_RAW = 36; + public static final int MAVLINK_MSG_LENGTH = 37; + private static final long serialVersionUID = MAVLINK_MSG_ID_SERVO_OUTPUT_RAW; + + + /** + * Timestamp (microseconds since system boot) + */ + public long time_usec; + + /** + * Servo output 1 value, in microseconds + */ + public int servo1_raw; + + /** + * Servo output 2 value, in microseconds + */ + public int servo2_raw; + + /** + * Servo output 3 value, in microseconds + */ + public int servo3_raw; + + /** + * Servo output 4 value, in microseconds + */ + public int servo4_raw; + + /** + * Servo output 5 value, in microseconds + */ + public int servo5_raw; + + /** + * Servo output 6 value, in microseconds + */ + public int servo6_raw; + + /** + * Servo output 7 value, in microseconds + */ + public int servo7_raw; + + /** + * Servo output 8 value, in microseconds + */ + public int servo8_raw; + + /** + * Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows to encode more than 8 servos. + */ + public short port; + + /** + * Servo output 9 value, in microseconds + */ + public int servo9_raw; + + /** + * Servo output 10 value, in microseconds + */ + public int servo10_raw; + + /** + * Servo output 11 value, in microseconds + */ + public int servo11_raw; + + /** + * Servo output 12 value, in microseconds + */ + public int servo12_raw; + + /** + * Servo output 13 value, in microseconds + */ + public int servo13_raw; + + /** + * Servo output 14 value, in microseconds + */ + public int servo14_raw; + + /** + * Servo output 15 value, in microseconds + */ + public int servo15_raw; + + /** + * Servo output 16 value, in microseconds + */ + public int servo16_raw; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SERVO_OUTPUT_RAW; + + packet.payload.putUnsignedInt(time_usec); + + packet.payload.putUnsignedShort(servo1_raw); + + packet.payload.putUnsignedShort(servo2_raw); + + packet.payload.putUnsignedShort(servo3_raw); + + packet.payload.putUnsignedShort(servo4_raw); + + packet.payload.putUnsignedShort(servo5_raw); + + packet.payload.putUnsignedShort(servo6_raw); + + packet.payload.putUnsignedShort(servo7_raw); + + packet.payload.putUnsignedShort(servo8_raw); + + packet.payload.putUnsignedByte(port); + + packet.payload.putUnsignedShort(servo9_raw); + + packet.payload.putUnsignedShort(servo10_raw); + + packet.payload.putUnsignedShort(servo11_raw); + + packet.payload.putUnsignedShort(servo12_raw); + + packet.payload.putUnsignedShort(servo13_raw); + + packet.payload.putUnsignedShort(servo14_raw); + + packet.payload.putUnsignedShort(servo15_raw); + + packet.payload.putUnsignedShort(servo16_raw); + + return packet; + } + + /** + * Decode a servo_output_raw message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedInt(); + + this.servo1_raw = payload.getUnsignedShort(); + + this.servo2_raw = payload.getUnsignedShort(); + + this.servo3_raw = payload.getUnsignedShort(); + + this.servo4_raw = payload.getUnsignedShort(); + + this.servo5_raw = payload.getUnsignedShort(); + + this.servo6_raw = payload.getUnsignedShort(); + + this.servo7_raw = payload.getUnsignedShort(); + + this.servo8_raw = payload.getUnsignedShort(); + + this.port = payload.getUnsignedByte(); + + this.servo9_raw = payload.getUnsignedShort(); + + this.servo10_raw = payload.getUnsignedShort(); + + this.servo11_raw = payload.getUnsignedShort(); + + this.servo12_raw = payload.getUnsignedShort(); + + this.servo13_raw = payload.getUnsignedShort(); + + this.servo14_raw = payload.getUnsignedShort(); + + this.servo15_raw = payload.getUnsignedShort(); + + this.servo16_raw = payload.getUnsignedShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_servo_output_raw() { + msgid = MAVLINK_MSG_ID_SERVO_OUTPUT_RAW; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_servo_output_raw(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SERVO_OUTPUT_RAW; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SERVO_OUTPUT_RAW - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " servo1_raw:" + servo1_raw + " servo2_raw:" + servo2_raw + " servo3_raw:" + servo3_raw + " servo4_raw:" + servo4_raw + " servo5_raw:" + servo5_raw + " servo6_raw:" + servo6_raw + " servo7_raw:" + servo7_raw + " servo8_raw:" + servo8_raw + " port:" + port + " servo9_raw:" + servo9_raw + " servo10_raw:" + servo10_raw + " servo11_raw:" + servo11_raw + " servo12_raw:" + servo12_raw + " servo13_raw:" + servo13_raw + " servo14_raw:" + servo14_raw + " servo15_raw:" + servo15_raw + " servo16_raw:" + servo16_raw + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_set_actuator_control_target.java b/app/src/main/java/com/MAVLink/common/msg_set_actuator_control_target.java new file mode 100644 index 0000000..899d1ab --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_set_actuator_control_target.java @@ -0,0 +1,128 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SET_ACTUATOR_CONTROL_TARGET PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Set the vehicle attitude and body angular rates. + */ +public class msg_set_actuator_control_target extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET = 139; + public static final int MAVLINK_MSG_LENGTH = 43; + private static final long serialVersionUID = MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET; + + + /** + * Timestamp (micros since boot or Unix epoch) + */ + public long time_usec; + + /** + * Actuator controls. Normed to -1..+1 where 0 is neutral position. Throttle for single rotation direction motors is 0..1, negative range for reverse direction. Standard mapping for attitude controls (group 0): (index 0-7): roll, pitch, yaw, throttle, flaps, spoilers, airbrakes, landing gear. Load a pass-through mixer to repurpose them as generic outputs. + */ + public float controls[] = new float[8]; + + /** + * Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances. + */ + public short group_mlx; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET; + + packet.payload.putUnsignedLong(time_usec); + + + for (int i = 0; i < controls.length; i++) { + packet.payload.putFloat(controls[i]); + } + + + packet.payload.putUnsignedByte(group_mlx); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + return packet; + } + + /** + * Decode a set_actuator_control_target message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + + for (int i = 0; i < this.controls.length; i++) { + this.controls[i] = payload.getFloat(); + } + + + this.group_mlx = payload.getUnsignedByte(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_set_actuator_control_target() { + msgid = MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_set_actuator_control_target(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " controls:" + controls + " group_mlx:" + group_mlx + " target_system:" + target_system + " target_component:" + target_component + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_set_attitude_target.java b/app/src/main/java/com/MAVLink/common/msg_set_attitude_target.java new file mode 100644 index 0000000..1606b16 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_set_attitude_target.java @@ -0,0 +1,164 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SET_ATTITUDE_TARGET PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Sets a desired vehicle attitude. Used by an external controller to command the vehicle (manual controller or other system). + */ +public class msg_set_attitude_target extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SET_ATTITUDE_TARGET = 82; + public static final int MAVLINK_MSG_LENGTH = 39; + private static final long serialVersionUID = MAVLINK_MSG_ID_SET_ATTITUDE_TARGET; + + + /** + * Timestamp in milliseconds since system boot + */ + public long time_boot_ms; + + /** + * Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) + */ + public float q[] = new float[4]; + + /** + * Body roll rate in radians per second + */ + public float body_roll_rate; + + /** + * Body roll rate in radians per second + */ + public float body_pitch_rate; + + /** + * Body roll rate in radians per second + */ + public float body_yaw_rate; + + /** + * Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust) + */ + public float thrust; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * Mappings: If any of these bits are set, the corresponding input should be ignored: bit 1: body roll rate, bit 2: body pitch rate, bit 3: body yaw rate. bit 4-bit 6: reserved, bit 7: throttle, bit 8: attitude + */ + public short type_mask; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SET_ATTITUDE_TARGET; + + packet.payload.putUnsignedInt(time_boot_ms); + + + for (int i = 0; i < q.length; i++) { + packet.payload.putFloat(q[i]); + } + + + packet.payload.putFloat(body_roll_rate); + + packet.payload.putFloat(body_pitch_rate); + + packet.payload.putFloat(body_yaw_rate); + + packet.payload.putFloat(thrust); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(type_mask); + + return packet; + } + + /** + * Decode a set_attitude_target message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + + for (int i = 0; i < this.q.length; i++) { + this.q[i] = payload.getFloat(); + } + + + this.body_roll_rate = payload.getFloat(); + + this.body_pitch_rate = payload.getFloat(); + + this.body_yaw_rate = payload.getFloat(); + + this.thrust = payload.getFloat(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.type_mask = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_set_attitude_target() { + msgid = MAVLINK_MSG_ID_SET_ATTITUDE_TARGET; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_set_attitude_target(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SET_ATTITUDE_TARGET; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SET_ATTITUDE_TARGET - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " q:" + q + " body_roll_rate:" + body_roll_rate + " body_pitch_rate:" + body_pitch_rate + " body_yaw_rate:" + body_yaw_rate + " thrust:" + thrust + " target_system:" + target_system + " target_component:" + target_component + " type_mask:" + type_mask + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_set_gps_global_origin.java b/app/src/main/java/com/MAVLink/common/msg_set_gps_global_origin.java new file mode 100644 index 0000000..1bb0369 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_set_gps_global_origin.java @@ -0,0 +1,120 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SET_GPS_GLOBAL_ORIGIN PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * As local waypoints exist, the global MISSION reference allows to transform between the local coordinate frame and the global (GPS) coordinate frame. This can be necessary when e.g. in- and outdoor settings are connected and the MAV should move from in- to outdoor. + */ +public class msg_set_gps_global_origin extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN = 48; + public static final int MAVLINK_MSG_LENGTH = 21; + private static final long serialVersionUID = MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN; + + + /** + * Latitude (WGS84), in degrees * 1E7 + */ + public int latitude; + + /** + * Longitude (WGS84, in degrees * 1E7 + */ + public int longitude; + + /** + * Altitude (AMSL), in meters * 1000 (positive for up) + */ + public int altitude; + + /** + * System ID + */ + public short target_system; + + /** + * Timestamp (microseconds since UNIX epoch or microseconds since system boot) + */ + public long time_usec; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN; + + packet.payload.putInt(latitude); + + packet.payload.putInt(longitude); + + packet.payload.putInt(altitude); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedLong(time_usec); + + return packet; + } + + /** + * Decode a set_gps_global_origin message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.latitude = payload.getInt(); + + this.longitude = payload.getInt(); + + this.altitude = payload.getInt(); + + this.target_system = payload.getUnsignedByte(); + + this.time_usec = payload.getUnsignedLong(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_set_gps_global_origin() { + msgid = MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_set_gps_global_origin(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN - sysid:" + sysid + " compid:" + compid + " latitude:" + latitude + " longitude:" + longitude + " altitude:" + altitude + " target_system:" + target_system + " time_usec:" + time_usec + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_set_home_position.java b/app/src/main/java/com/MAVLink/common/msg_set_home_position.java new file mode 100644 index 0000000..4346b5a --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_set_home_position.java @@ -0,0 +1,191 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SET_HOME_POSITION PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The position the system will return to and land on. The position is set automatically by the system during the takeoff in case it was not explicitely set by the operator before or after. The global and local positions encode the position in the respective coordinate frames, while the q parameter encodes the orientation of the surface. Under normal conditions it describes the heading and terrain slope, which can be used by the aircraft to adjust the approach. The approach 3D vector describes the point to which the system should fly in normal flight mode and then perform a landing sequence along the vector. + */ +public class msg_set_home_position extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SET_HOME_POSITION = 243; + public static final int MAVLINK_MSG_LENGTH = 61; + private static final long serialVersionUID = MAVLINK_MSG_ID_SET_HOME_POSITION; + + + /** + * Latitude (WGS84), in degrees * 1E7 + */ + public int latitude; + + /** + * Longitude (WGS84, in degrees * 1E7 + */ + public int longitude; + + /** + * Altitude (AMSL), in meters * 1000 (positive for up) + */ + public int altitude; + + /** + * Local X position of this position in the local coordinate frame + */ + public float x; + + /** + * Local Y position of this position in the local coordinate frame + */ + public float y; + + /** + * Local Z position of this position in the local coordinate frame + */ + public float z; + + /** + * World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground + */ + public float q[] = new float[4]; + + /** + * Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. + */ + public float approach_x; + + /** + * Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. + */ + public float approach_y; + + /** + * Local Z position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone. + */ + public float approach_z; + + /** + * System ID. + */ + public short target_system; + + /** + * Timestamp (microseconds since UNIX epoch or microseconds since system boot) + */ + public long time_usec; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SET_HOME_POSITION; + + packet.payload.putInt(latitude); + + packet.payload.putInt(longitude); + + packet.payload.putInt(altitude); + + packet.payload.putFloat(x); + + packet.payload.putFloat(y); + + packet.payload.putFloat(z); + + + for (int i = 0; i < q.length; i++) { + packet.payload.putFloat(q[i]); + } + + + packet.payload.putFloat(approach_x); + + packet.payload.putFloat(approach_y); + + packet.payload.putFloat(approach_z); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedLong(time_usec); + + return packet; + } + + /** + * Decode a set_home_position message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.latitude = payload.getInt(); + + this.longitude = payload.getInt(); + + this.altitude = payload.getInt(); + + this.x = payload.getFloat(); + + this.y = payload.getFloat(); + + this.z = payload.getFloat(); + + + for (int i = 0; i < this.q.length; i++) { + this.q[i] = payload.getFloat(); + } + + + this.approach_x = payload.getFloat(); + + this.approach_y = payload.getFloat(); + + this.approach_z = payload.getFloat(); + + this.target_system = payload.getUnsignedByte(); + + this.time_usec = payload.getUnsignedLong(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_set_home_position() { + msgid = MAVLINK_MSG_ID_SET_HOME_POSITION; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_set_home_position(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SET_HOME_POSITION; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SET_HOME_POSITION - sysid:" + sysid + " compid:" + compid + " latitude:" + latitude + " longitude:" + longitude + " altitude:" + altitude + " x:" + x + " y:" + y + " z:" + z + " q:" + q + " approach_x:" + approach_x + " approach_y:" + approach_y + " approach_z:" + approach_z + " target_system:" + target_system + " time_usec:" + time_usec + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_set_mode.java b/app/src/main/java/com/MAVLink/common/msg_set_mode.java new file mode 100644 index 0000000..baa9ec8 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_set_mode.java @@ -0,0 +1,102 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SET_MODE PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * THIS INTERFACE IS DEPRECATED. USE COMMAND_LONG with MAV_CMD_DO_SET_MODE INSTEAD. Set the system mode, as defined by enum MAV_MODE. There is no target component id as the mode is by definition for the overall aircraft, not only for one component. + */ +public class msg_set_mode extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SET_MODE = 11; + public static final int MAVLINK_MSG_LENGTH = 6; + private static final long serialVersionUID = MAVLINK_MSG_ID_SET_MODE; + + + /** + * The new autopilot-specific mode. This field can be ignored by an autopilot. + */ + public long custom_mode; + + /** + * The system setting the mode + */ + public short target_system; + + /** + * The new base mode + */ + public short base_mode; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SET_MODE; + + packet.payload.putUnsignedInt(custom_mode); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(base_mode); + + return packet; + } + + /** + * Decode a set_mode message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.custom_mode = payload.getUnsignedInt(); + + this.target_system = payload.getUnsignedByte(); + + this.base_mode = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_set_mode() { + msgid = MAVLINK_MSG_ID_SET_MODE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_set_mode(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SET_MODE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SET_MODE - sysid:" + sysid + " compid:" + compid + " custom_mode:" + custom_mode + " target_system:" + target_system + " base_mode:" + base_mode + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_set_position_target_global_int.java b/app/src/main/java/com/MAVLink/common/msg_set_position_target_global_int.java new file mode 100644 index 0000000..5670805 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_set_position_target_global_int.java @@ -0,0 +1,219 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SET_POSITION_TARGET_GLOBAL_INT PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Sets a desired vehicle position, velocity, and/or acceleration in a global coordinate system (WGS84). Used by an external controller to command the vehicle (manual controller or other system). + */ +public class msg_set_position_target_global_int extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT = 86; + public static final int MAVLINK_MSG_LENGTH = 53; + private static final long serialVersionUID = MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT; + + + /** + * Timestamp in milliseconds since system boot. The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency. + */ + public long time_boot_ms; + + /** + * X Position in WGS84 frame in 1e7 * meters + */ + public int lat_int; + + /** + * Y Position in WGS84 frame in 1e7 * meters + */ + public int lon_int; + + /** + * Altitude in meters in AMSL altitude, not WGS84 if absolute or relative, above terrain if GLOBAL_TERRAIN_ALT_INT + */ + public float alt; + + /** + * X velocity in NED frame in meter / s + */ + public float vx; + + /** + * Y velocity in NED frame in meter / s + */ + public float vy; + + /** + * Z velocity in NED frame in meter / s + */ + public float vz; + + /** + * X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + */ + public float afx; + + /** + * Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + */ + public float afy; + + /** + * Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + */ + public float afz; + + /** + * yaw setpoint in rad + */ + public float yaw; + + /** + * yaw rate setpoint in rad/s + */ + public float yaw_rate; + + /** + * Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate + */ + public int type_mask; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11 + */ + public short coordinate_frame; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putInt(lat_int); + + packet.payload.putInt(lon_int); + + packet.payload.putFloat(alt); + + packet.payload.putFloat(vx); + + packet.payload.putFloat(vy); + + packet.payload.putFloat(vz); + + packet.payload.putFloat(afx); + + packet.payload.putFloat(afy); + + packet.payload.putFloat(afz); + + packet.payload.putFloat(yaw); + + packet.payload.putFloat(yaw_rate); + + packet.payload.putUnsignedShort(type_mask); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(coordinate_frame); + + return packet; + } + + /** + * Decode a set_position_target_global_int message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.lat_int = payload.getInt(); + + this.lon_int = payload.getInt(); + + this.alt = payload.getFloat(); + + this.vx = payload.getFloat(); + + this.vy = payload.getFloat(); + + this.vz = payload.getFloat(); + + this.afx = payload.getFloat(); + + this.afy = payload.getFloat(); + + this.afz = payload.getFloat(); + + this.yaw = payload.getFloat(); + + this.yaw_rate = payload.getFloat(); + + this.type_mask = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.coordinate_frame = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_set_position_target_global_int() { + msgid = MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_set_position_target_global_int(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " lat_int:" + lat_int + " lon_int:" + lon_int + " alt:" + alt + " vx:" + vx + " vy:" + vy + " vz:" + vz + " afx:" + afx + " afy:" + afy + " afz:" + afz + " yaw:" + yaw + " yaw_rate:" + yaw_rate + " type_mask:" + type_mask + " target_system:" + target_system + " target_component:" + target_component + " coordinate_frame:" + coordinate_frame + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_set_position_target_local_ned.java b/app/src/main/java/com/MAVLink/common/msg_set_position_target_local_ned.java new file mode 100644 index 0000000..054858f --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_set_position_target_local_ned.java @@ -0,0 +1,219 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SET_POSITION_TARGET_LOCAL_NED PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Sets a desired vehicle position in a local north-east-down coordinate frame. Used by an external controller to command the vehicle (manual controller or other system). + */ +public class msg_set_position_target_local_ned extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED = 84; + public static final int MAVLINK_MSG_LENGTH = 53; + private static final long serialVersionUID = MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED; + + + /** + * Timestamp in milliseconds since system boot + */ + public long time_boot_ms; + + /** + * X Position in NED frame in meters + */ + public float x; + + /** + * Y Position in NED frame in meters + */ + public float y; + + /** + * Z Position in NED frame in meters (note, altitude is negative in NED) + */ + public float z; + + /** + * X velocity in NED frame in meter / s + */ + public float vx; + + /** + * Y velocity in NED frame in meter / s + */ + public float vy; + + /** + * Z velocity in NED frame in meter / s + */ + public float vz; + + /** + * X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + */ + public float afx; + + /** + * Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + */ + public float afy; + + /** + * Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N + */ + public float afz; + + /** + * yaw setpoint in rad + */ + public float yaw; + + /** + * yaw rate setpoint in rad/s + */ + public float yaw_rate; + + /** + * Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate + */ + public int type_mask; + + /** + * System ID + */ + public short target_system; + + /** + * Component ID + */ + public short target_component; + + /** + * Valid options are: MAV_FRAME_LOCAL_NED = 1, MAV_FRAME_LOCAL_OFFSET_NED = 7, MAV_FRAME_BODY_NED = 8, MAV_FRAME_BODY_OFFSET_NED = 9 + */ + public short coordinate_frame; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putFloat(x); + + packet.payload.putFloat(y); + + packet.payload.putFloat(z); + + packet.payload.putFloat(vx); + + packet.payload.putFloat(vy); + + packet.payload.putFloat(vz); + + packet.payload.putFloat(afx); + + packet.payload.putFloat(afy); + + packet.payload.putFloat(afz); + + packet.payload.putFloat(yaw); + + packet.payload.putFloat(yaw_rate); + + packet.payload.putUnsignedShort(type_mask); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(coordinate_frame); + + return packet; + } + + /** + * Decode a set_position_target_local_ned message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.x = payload.getFloat(); + + this.y = payload.getFloat(); + + this.z = payload.getFloat(); + + this.vx = payload.getFloat(); + + this.vy = payload.getFloat(); + + this.vz = payload.getFloat(); + + this.afx = payload.getFloat(); + + this.afy = payload.getFloat(); + + this.afz = payload.getFloat(); + + this.yaw = payload.getFloat(); + + this.yaw_rate = payload.getFloat(); + + this.type_mask = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.coordinate_frame = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_set_position_target_local_ned() { + msgid = MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_set_position_target_local_ned(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " x:" + x + " y:" + y + " z:" + z + " vx:" + vx + " vy:" + vy + " vz:" + vz + " afx:" + afx + " afy:" + afy + " afz:" + afz + " yaw:" + yaw + " yaw_rate:" + yaw_rate + " type_mask:" + type_mask + " target_system:" + target_system + " target_component:" + target_component + " coordinate_frame:" + coordinate_frame + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_set_video_stream_settings.java b/app/src/main/java/com/MAVLink/common/msg_set_video_stream_settings.java new file mode 100644 index 0000000..f1c8321 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_set_video_stream_settings.java @@ -0,0 +1,193 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SET_VIDEO_STREAM_SETTINGS PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * WIP: Message that sets video stream settings + */ +public class msg_set_video_stream_settings extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SET_VIDEO_STREAM_SETTINGS = 270; + public static final int MAVLINK_MSG_LENGTH = 247; + private static final long serialVersionUID = MAVLINK_MSG_ID_SET_VIDEO_STREAM_SETTINGS; + + + /** + * Frames per second (set to -1 for highest framerate possible) + */ + public float framerate; + + /** + * Bit rate in bits per second (set to -1 for auto) + */ + public long bitrate; + + /** + * Resolution horizontal in pixels (set to -1 for highest resolution possible) + */ + public int resolution_h; + + /** + * Resolution vertical in pixels (set to -1 for highest resolution possible) + */ + public int resolution_v; + + /** + * Video image rotation clockwise (0-359 degrees) + */ + public int rotation; + + /** + * system ID of the target + */ + public short target_system; + + /** + * component ID of the target + */ + public short target_component; + + /** + * Camera ID (1 for first, 2 for second, etc.) + */ + public short camera_id; + + /** + * Video stream URI + */ + public byte uri[] = new byte[230]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SET_VIDEO_STREAM_SETTINGS; + + packet.payload.putFloat(framerate); + + packet.payload.putUnsignedInt(bitrate); + + packet.payload.putUnsignedShort(resolution_h); + + packet.payload.putUnsignedShort(resolution_v); + + packet.payload.putUnsignedShort(rotation); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + packet.payload.putUnsignedByte(camera_id); + + + for (int i = 0; i < uri.length; i++) { + packet.payload.putByte(uri[i]); + } + + + return packet; + } + + /** + * Decode a set_video_stream_settings message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.framerate = payload.getFloat(); + + this.bitrate = payload.getUnsignedInt(); + + this.resolution_h = payload.getUnsignedShort(); + + this.resolution_v = payload.getUnsignedShort(); + + this.rotation = payload.getUnsignedShort(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + this.camera_id = payload.getUnsignedByte(); + + + for (int i = 0; i < this.uri.length; i++) { + this.uri[i] = payload.getByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_set_video_stream_settings() { + msgid = MAVLINK_MSG_ID_SET_VIDEO_STREAM_SETTINGS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_set_video_stream_settings(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SET_VIDEO_STREAM_SETTINGS; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setUri(String str) { + int len = Math.min(str.length(), 230); + for (int i = 0; i < len; i++) { + uri[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 230; i++) { // padding for the rest of the buffer + uri[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getUri() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 230; i++) { + if (uri[i] != 0) + buf.append((char) uri[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SET_VIDEO_STREAM_SETTINGS - sysid:" + sysid + " compid:" + compid + " framerate:" + framerate + " bitrate:" + bitrate + " resolution_h:" + resolution_h + " resolution_v:" + resolution_v + " rotation:" + rotation + " target_system:" + target_system + " target_component:" + target_component + " camera_id:" + camera_id + " uri:" + uri + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_setup_signing.java b/app/src/main/java/com/MAVLink/common/msg_setup_signing.java new file mode 100644 index 0000000..049f50b --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_setup_signing.java @@ -0,0 +1,119 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SETUP_SIGNING PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Setup a MAVLink2 signing key. If called with secret_key of all zero and zero initial_timestamp will disable signing + */ +public class msg_setup_signing extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SETUP_SIGNING = 256; + public static final int MAVLINK_MSG_LENGTH = 42; + private static final long serialVersionUID = MAVLINK_MSG_ID_SETUP_SIGNING; + + + /** + * initial timestamp + */ + public long initial_timestamp; + + /** + * system id of the target + */ + public short target_system; + + /** + * component ID of the target + */ + public short target_component; + + /** + * signing key + */ + public short secret_key[] = new short[32]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SETUP_SIGNING; + + packet.payload.putUnsignedLong(initial_timestamp); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + + for (int i = 0; i < secret_key.length; i++) { + packet.payload.putUnsignedByte(secret_key[i]); + } + + + return packet; + } + + /** + * Decode a setup_signing message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.initial_timestamp = payload.getUnsignedLong(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + + for (int i = 0; i < this.secret_key.length; i++) { + this.secret_key[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_setup_signing() { + msgid = MAVLINK_MSG_ID_SETUP_SIGNING; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_setup_signing(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SETUP_SIGNING; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SETUP_SIGNING - sysid:" + sysid + " compid:" + compid + " initial_timestamp:" + initial_timestamp + " target_system:" + target_system + " target_component:" + target_component + " secret_key:" + secret_key + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_sim_state.java b/app/src/main/java/com/MAVLink/common/msg_sim_state.java new file mode 100644 index 0000000..35c1579 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_sim_state.java @@ -0,0 +1,264 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SIM_STATE PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Status of simulation environment, if used + */ +public class msg_sim_state extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SIM_STATE = 108; + public static final int MAVLINK_MSG_LENGTH = 84; + private static final long serialVersionUID = MAVLINK_MSG_ID_SIM_STATE; + + + /** + * True attitude quaternion component 1, w (1 in null-rotation) + */ + public float q1; + + /** + * True attitude quaternion component 2, x (0 in null-rotation) + */ + public float q2; + + /** + * True attitude quaternion component 3, y (0 in null-rotation) + */ + public float q3; + + /** + * True attitude quaternion component 4, z (0 in null-rotation) + */ + public float q4; + + /** + * Attitude roll expressed as Euler angles, not recommended except for human-readable outputs + */ + public float roll; + + /** + * Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs + */ + public float pitch; + + /** + * Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs + */ + public float yaw; + + /** + * X acceleration m/s/s + */ + public float xacc; + + /** + * Y acceleration m/s/s + */ + public float yacc; + + /** + * Z acceleration m/s/s + */ + public float zacc; + + /** + * Angular speed around X axis rad/s + */ + public float xgyro; + + /** + * Angular speed around Y axis rad/s + */ + public float ygyro; + + /** + * Angular speed around Z axis rad/s + */ + public float zgyro; + + /** + * Latitude in degrees + */ + public float lat; + + /** + * Longitude in degrees + */ + public float lon; + + /** + * Altitude in meters + */ + public float alt; + + /** + * Horizontal position standard deviation + */ + public float std_dev_horz; + + /** + * Vertical position standard deviation + */ + public float std_dev_vert; + + /** + * True velocity in m/s in NORTH direction in earth-fixed NED frame + */ + public float vn; + + /** + * True velocity in m/s in EAST direction in earth-fixed NED frame + */ + public float ve; + + /** + * True velocity in m/s in DOWN direction in earth-fixed NED frame + */ + public float vd; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SIM_STATE; + + packet.payload.putFloat(q1); + + packet.payload.putFloat(q2); + + packet.payload.putFloat(q3); + + packet.payload.putFloat(q4); + + packet.payload.putFloat(roll); + + packet.payload.putFloat(pitch); + + packet.payload.putFloat(yaw); + + packet.payload.putFloat(xacc); + + packet.payload.putFloat(yacc); + + packet.payload.putFloat(zacc); + + packet.payload.putFloat(xgyro); + + packet.payload.putFloat(ygyro); + + packet.payload.putFloat(zgyro); + + packet.payload.putFloat(lat); + + packet.payload.putFloat(lon); + + packet.payload.putFloat(alt); + + packet.payload.putFloat(std_dev_horz); + + packet.payload.putFloat(std_dev_vert); + + packet.payload.putFloat(vn); + + packet.payload.putFloat(ve); + + packet.payload.putFloat(vd); + + return packet; + } + + /** + * Decode a sim_state message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.q1 = payload.getFloat(); + + this.q2 = payload.getFloat(); + + this.q3 = payload.getFloat(); + + this.q4 = payload.getFloat(); + + this.roll = payload.getFloat(); + + this.pitch = payload.getFloat(); + + this.yaw = payload.getFloat(); + + this.xacc = payload.getFloat(); + + this.yacc = payload.getFloat(); + + this.zacc = payload.getFloat(); + + this.xgyro = payload.getFloat(); + + this.ygyro = payload.getFloat(); + + this.zgyro = payload.getFloat(); + + this.lat = payload.getFloat(); + + this.lon = payload.getFloat(); + + this.alt = payload.getFloat(); + + this.std_dev_horz = payload.getFloat(); + + this.std_dev_vert = payload.getFloat(); + + this.vn = payload.getFloat(); + + this.ve = payload.getFloat(); + + this.vd = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_sim_state() { + msgid = MAVLINK_MSG_ID_SIM_STATE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_sim_state(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SIM_STATE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SIM_STATE - sysid:" + sysid + " compid:" + compid + " q1:" + q1 + " q2:" + q2 + " q3:" + q3 + " q4:" + q4 + " roll:" + roll + " pitch:" + pitch + " yaw:" + yaw + " xacc:" + xacc + " yacc:" + yacc + " zacc:" + zacc + " xgyro:" + xgyro + " ygyro:" + ygyro + " zgyro:" + zgyro + " lat:" + lat + " lon:" + lon + " alt:" + alt + " std_dev_horz:" + std_dev_horz + " std_dev_vert:" + std_dev_vert + " vn:" + vn + " ve:" + ve + " vd:" + vd + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_statustext.java b/app/src/main/java/com/MAVLink/common/msg_statustext.java new file mode 100644 index 0000000..bc42c55 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_statustext.java @@ -0,0 +1,130 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE STATUSTEXT PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Status text message. These messages are printed in yellow in the COMM console of QGroundControl. WARNING: They consume quite some bandwidth, so use only for important status and error messages. If implemented wisely, these messages are buffered on the MCU and sent only at a limited rate (e.g. 10 Hz). + */ +public class msg_statustext extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_STATUSTEXT = 253; + public static final int MAVLINK_MSG_LENGTH = 51; + private static final long serialVersionUID = MAVLINK_MSG_ID_STATUSTEXT; + + + /** + * Severity of status. Relies on the definitions within RFC-5424. See enum MAV_SEVERITY. + */ + public short severity; + + /** + * Status text message, without null termination character + */ + public byte text[] = new byte[50]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_STATUSTEXT; + + packet.payload.putUnsignedByte(severity); + + + for (int i = 0; i < text.length; i++) { + packet.payload.putByte(text[i]); + } + + + return packet; + } + + /** + * Decode a statustext message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.severity = payload.getUnsignedByte(); + + + for (int i = 0; i < this.text.length; i++) { + this.text[i] = payload.getByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_statustext() { + msgid = MAVLINK_MSG_ID_STATUSTEXT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_statustext(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_STATUSTEXT; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setText(String str) { + int len = Math.min(str.length(), 50); + for (int i = 0; i < len; i++) { + text[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 50; i++) { // padding for the rest of the buffer + text[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getText() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 50; i++) { + if (text[i] != 0) + buf.append((char) text[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_STATUSTEXT - sysid:" + sysid + " compid:" + compid + " severity:" + severity + " text:" + text + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_storage_information.java b/app/src/main/java/com/MAVLink/common/msg_storage_information.java new file mode 100644 index 0000000..903da30 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_storage_information.java @@ -0,0 +1,156 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE STORAGE_INFORMATION PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * WIP: Information about a storage medium. + */ +public class msg_storage_information extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_STORAGE_INFORMATION = 261; + public static final int MAVLINK_MSG_LENGTH = 27; + private static final long serialVersionUID = MAVLINK_MSG_ID_STORAGE_INFORMATION; + + + /** + * Timestamp (milliseconds since system boot) + */ + public long time_boot_ms; + + /** + * Total capacity in MiB + */ + public float total_capacity; + + /** + * Used capacity in MiB + */ + public float used_capacity; + + /** + * Available capacity in MiB + */ + public float available_capacity; + + /** + * Read speed in MiB/s + */ + public float read_speed; + + /** + * Write speed in MiB/s + */ + public float write_speed; + + /** + * Storage ID (1 for first, 2 for second, etc.) + */ + public short storage_id; + + /** + * Number of storage devices + */ + public short storage_count; + + /** + * Status of storage (0 not available, 1 unformatted, 2 formatted) + */ + public short status; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_STORAGE_INFORMATION; + + packet.payload.putUnsignedInt(time_boot_ms); + + packet.payload.putFloat(total_capacity); + + packet.payload.putFloat(used_capacity); + + packet.payload.putFloat(available_capacity); + + packet.payload.putFloat(read_speed); + + packet.payload.putFloat(write_speed); + + packet.payload.putUnsignedByte(storage_id); + + packet.payload.putUnsignedByte(storage_count); + + packet.payload.putUnsignedByte(status); + + return packet; + } + + /** + * Decode a storage_information message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_boot_ms = payload.getUnsignedInt(); + + this.total_capacity = payload.getFloat(); + + this.used_capacity = payload.getFloat(); + + this.available_capacity = payload.getFloat(); + + this.read_speed = payload.getFloat(); + + this.write_speed = payload.getFloat(); + + this.storage_id = payload.getUnsignedByte(); + + this.storage_count = payload.getUnsignedByte(); + + this.status = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_storage_information() { + msgid = MAVLINK_MSG_ID_STORAGE_INFORMATION; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_storage_information(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_STORAGE_INFORMATION; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_STORAGE_INFORMATION - sysid:" + sysid + " compid:" + compid + " time_boot_ms:" + time_boot_ms + " total_capacity:" + total_capacity + " used_capacity:" + used_capacity + " available_capacity:" + available_capacity + " read_speed:" + read_speed + " write_speed:" + write_speed + " storage_id:" + storage_id + " storage_count:" + storage_count + " status:" + status + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_sys_status.java b/app/src/main/java/com/MAVLink/common/msg_sys_status.java new file mode 100644 index 0000000..c916560 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_sys_status.java @@ -0,0 +1,192 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SYS_STATUS PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The general system state. If the system is following the MAVLink standard, the system state is mainly defined by three orthogonal states/modes: The system mode, which is either LOCKED (motors shut down and locked), MANUAL (system under RC control), GUIDED (system with autonomous position control, position setpoint controlled manually) or AUTO (system guided by path/waypoint planner). The NAV_MODE defined the current flight state: LIFTOFF (often an open-loop maneuver), LANDING, WAYPOINTS or VECTOR. This represents the internal navigation state machine. The system status shows whether the system is currently active or not and if an emergency occured. During the CRITICAL and EMERGENCY states the MAV is still considered to be active, but should start emergency procedures autonomously. After a failure occured it should first move from active to critical to allow manual intervention and then move to emergency after a certain timeout. + */ +public class msg_sys_status extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SYS_STATUS = 1; + public static final int MAVLINK_MSG_LENGTH = 31; + private static final long serialVersionUID = MAVLINK_MSG_ID_SYS_STATUS; + + + /** + * Bitmask showing which onboard controllers and sensors are present. Value of 0: not present. Value of 1: present. Indices defined by ENUM MAV_SYS_STATUS_SENSOR + */ + public long onboard_control_sensors_present; + + /** + * Bitmask showing which onboard controllers and sensors are enabled: Value of 0: not enabled. Value of 1: enabled. Indices defined by ENUM MAV_SYS_STATUS_SENSOR + */ + public long onboard_control_sensors_enabled; + + /** + * Bitmask showing which onboard controllers and sensors are operational or have an error: Value of 0: not enabled. Value of 1: enabled. Indices defined by ENUM MAV_SYS_STATUS_SENSOR + */ + public long onboard_control_sensors_health; + + /** + * Maximum usage in percent of the mainloop time, (0%: 0, 100%: 1000) should be always below 1000 + */ + public int load; + + /** + * Battery voltage, in millivolts (1 = 1 millivolt) + */ + public int voltage_battery; + + /** + * Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current + */ + public short current_battery; + + /** + * Communication drops in percent, (0%: 0, 100%: 10'000), (UART, I2C, SPI, CAN), dropped packets on all links (packets that were corrupted on reception on the MAV) + */ + public int drop_rate_comm; + + /** + * Communication errors (UART, I2C, SPI, CAN), dropped packets on all links (packets that were corrupted on reception on the MAV) + */ + public int errors_comm; + + /** + * Autopilot-specific errors + */ + public int errors_count1; + + /** + * Autopilot-specific errors + */ + public int errors_count2; + + /** + * Autopilot-specific errors + */ + public int errors_count3; + + /** + * Autopilot-specific errors + */ + public int errors_count4; + + /** + * Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot estimate the remaining battery + */ + public byte battery_remaining; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SYS_STATUS; + + packet.payload.putUnsignedInt(onboard_control_sensors_present); + + packet.payload.putUnsignedInt(onboard_control_sensors_enabled); + + packet.payload.putUnsignedInt(onboard_control_sensors_health); + + packet.payload.putUnsignedShort(load); + + packet.payload.putUnsignedShort(voltage_battery); + + packet.payload.putShort(current_battery); + + packet.payload.putUnsignedShort(drop_rate_comm); + + packet.payload.putUnsignedShort(errors_comm); + + packet.payload.putUnsignedShort(errors_count1); + + packet.payload.putUnsignedShort(errors_count2); + + packet.payload.putUnsignedShort(errors_count3); + + packet.payload.putUnsignedShort(errors_count4); + + packet.payload.putByte(battery_remaining); + + return packet; + } + + /** + * Decode a sys_status message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.onboard_control_sensors_present = payload.getUnsignedInt(); + + this.onboard_control_sensors_enabled = payload.getUnsignedInt(); + + this.onboard_control_sensors_health = payload.getUnsignedInt(); + + this.load = payload.getUnsignedShort(); + + this.voltage_battery = payload.getUnsignedShort(); + + this.current_battery = payload.getShort(); + + this.drop_rate_comm = payload.getUnsignedShort(); + + this.errors_comm = payload.getUnsignedShort(); + + this.errors_count1 = payload.getUnsignedShort(); + + this.errors_count2 = payload.getUnsignedShort(); + + this.errors_count3 = payload.getUnsignedShort(); + + this.errors_count4 = payload.getUnsignedShort(); + + this.battery_remaining = payload.getByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_sys_status() { + msgid = MAVLINK_MSG_ID_SYS_STATUS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_sys_status(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SYS_STATUS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SYS_STATUS - sysid:" + sysid + " compid:" + compid + " onboard_control_sensors_present:" + onboard_control_sensors_present + " onboard_control_sensors_enabled:" + onboard_control_sensors_enabled + " onboard_control_sensors_health:" + onboard_control_sensors_health + " load:" + load + " voltage_battery:" + voltage_battery + " current_battery:" + current_battery + " drop_rate_comm:" + drop_rate_comm + " errors_comm:" + errors_comm + " errors_count1:" + errors_count1 + " errors_count2:" + errors_count2 + " errors_count3:" + errors_count3 + " errors_count4:" + errors_count4 + " battery_remaining:" + battery_remaining + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_system_time.java b/app/src/main/java/com/MAVLink/common/msg_system_time.java new file mode 100644 index 0000000..9ba35a9 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_system_time.java @@ -0,0 +1,93 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE SYSTEM_TIME PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * The system time is the time of the master clock, typically the computer clock of the main onboard computer. + */ +public class msg_system_time extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_SYSTEM_TIME = 2; + public static final int MAVLINK_MSG_LENGTH = 12; + private static final long serialVersionUID = MAVLINK_MSG_ID_SYSTEM_TIME; + + + /** + * Timestamp of the master clock in microseconds since UNIX epoch. + */ + public long time_unix_usec; + + /** + * Timestamp of the component clock since boot time in milliseconds. + */ + public long time_boot_ms; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_SYSTEM_TIME; + + packet.payload.putUnsignedLong(time_unix_usec); + + packet.payload.putUnsignedInt(time_boot_ms); + + return packet; + } + + /** + * Decode a system_time message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_unix_usec = payload.getUnsignedLong(); + + this.time_boot_ms = payload.getUnsignedInt(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_system_time() { + msgid = MAVLINK_MSG_ID_SYSTEM_TIME; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_system_time(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_SYSTEM_TIME; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_SYSTEM_TIME - sysid:" + sysid + " compid:" + compid + " time_unix_usec:" + time_unix_usec + " time_boot_ms:" + time_boot_ms + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_terrain_check.java b/app/src/main/java/com/MAVLink/common/msg_terrain_check.java new file mode 100644 index 0000000..6e7700b --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_terrain_check.java @@ -0,0 +1,93 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE TERRAIN_CHECK PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Request that the vehicle report terrain height at the given location. Used by GCS to check if vehicle has all terrain data needed for a mission. + */ +public class msg_terrain_check extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_TERRAIN_CHECK = 135; + public static final int MAVLINK_MSG_LENGTH = 8; + private static final long serialVersionUID = MAVLINK_MSG_ID_TERRAIN_CHECK; + + + /** + * Latitude (degrees *10^7) + */ + public int lat; + + /** + * Longitude (degrees *10^7) + */ + public int lon; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_TERRAIN_CHECK; + + packet.payload.putInt(lat); + + packet.payload.putInt(lon); + + return packet; + } + + /** + * Decode a terrain_check message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.lat = payload.getInt(); + + this.lon = payload.getInt(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_terrain_check() { + msgid = MAVLINK_MSG_ID_TERRAIN_CHECK; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_terrain_check(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_TERRAIN_CHECK; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_TERRAIN_CHECK - sysid:" + sysid + " compid:" + compid + " lat:" + lat + " lon:" + lon + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_terrain_data.java b/app/src/main/java/com/MAVLink/common/msg_terrain_data.java new file mode 100644 index 0000000..27112a9 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_terrain_data.java @@ -0,0 +1,128 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE TERRAIN_DATA PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Terrain data sent from GCS. The lat/lon and grid_spacing must be the same as a lat/lon from a TERRAIN_REQUEST + */ +public class msg_terrain_data extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_TERRAIN_DATA = 134; + public static final int MAVLINK_MSG_LENGTH = 43; + private static final long serialVersionUID = MAVLINK_MSG_ID_TERRAIN_DATA; + + + /** + * Latitude of SW corner of first grid (degrees *10^7) + */ + public int lat; + + /** + * Longitude of SW corner of first grid (in degrees *10^7) + */ + public int lon; + + /** + * Grid spacing in meters + */ + public int grid_spacing; + + /** + * Terrain data in meters AMSL + */ + public short data[] = new short[16]; + + /** + * bit within the terrain request mask + */ + public short gridbit; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_TERRAIN_DATA; + + packet.payload.putInt(lat); + + packet.payload.putInt(lon); + + packet.payload.putUnsignedShort(grid_spacing); + + + for (int i = 0; i < data.length; i++) { + packet.payload.putShort(data[i]); + } + + + packet.payload.putUnsignedByte(gridbit); + + return packet; + } + + /** + * Decode a terrain_data message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.lat = payload.getInt(); + + this.lon = payload.getInt(); + + this.grid_spacing = payload.getUnsignedShort(); + + + for (int i = 0; i < this.data.length; i++) { + this.data[i] = payload.getShort(); + } + + + this.gridbit = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_terrain_data() { + msgid = MAVLINK_MSG_ID_TERRAIN_DATA; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_terrain_data(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_TERRAIN_DATA; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_TERRAIN_DATA - sysid:" + sysid + " compid:" + compid + " lat:" + lat + " lon:" + lon + " grid_spacing:" + grid_spacing + " data:" + data + " gridbit:" + gridbit + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_terrain_report.java b/app/src/main/java/com/MAVLink/common/msg_terrain_report.java new file mode 100644 index 0000000..f88fb0e --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_terrain_report.java @@ -0,0 +1,138 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE TERRAIN_REPORT PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Response from a TERRAIN_CHECK request + */ +public class msg_terrain_report extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_TERRAIN_REPORT = 136; + public static final int MAVLINK_MSG_LENGTH = 22; + private static final long serialVersionUID = MAVLINK_MSG_ID_TERRAIN_REPORT; + + + /** + * Latitude (degrees *10^7) + */ + public int lat; + + /** + * Longitude (degrees *10^7) + */ + public int lon; + + /** + * Terrain height in meters AMSL + */ + public float terrain_height; + + /** + * Current vehicle height above lat/lon terrain height (meters) + */ + public float current_height; + + /** + * grid spacing (zero if terrain at this location unavailable) + */ + public int spacing; + + /** + * Number of 4x4 terrain blocks waiting to be received or read from disk + */ + public int pending; + + /** + * Number of 4x4 terrain blocks in memory + */ + public int loaded; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_TERRAIN_REPORT; + + packet.payload.putInt(lat); + + packet.payload.putInt(lon); + + packet.payload.putFloat(terrain_height); + + packet.payload.putFloat(current_height); + + packet.payload.putUnsignedShort(spacing); + + packet.payload.putUnsignedShort(pending); + + packet.payload.putUnsignedShort(loaded); + + return packet; + } + + /** + * Decode a terrain_report message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.lat = payload.getInt(); + + this.lon = payload.getInt(); + + this.terrain_height = payload.getFloat(); + + this.current_height = payload.getFloat(); + + this.spacing = payload.getUnsignedShort(); + + this.pending = payload.getUnsignedShort(); + + this.loaded = payload.getUnsignedShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_terrain_report() { + msgid = MAVLINK_MSG_ID_TERRAIN_REPORT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_terrain_report(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_TERRAIN_REPORT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_TERRAIN_REPORT - sysid:" + sysid + " compid:" + compid + " lat:" + lat + " lon:" + lon + " terrain_height:" + terrain_height + " current_height:" + current_height + " spacing:" + spacing + " pending:" + pending + " loaded:" + loaded + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_terrain_request.java b/app/src/main/java/com/MAVLink/common/msg_terrain_request.java new file mode 100644 index 0000000..c6bc9b8 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_terrain_request.java @@ -0,0 +1,111 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE TERRAIN_REQUEST PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Request for terrain data and terrain status + */ +public class msg_terrain_request extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_TERRAIN_REQUEST = 133; + public static final int MAVLINK_MSG_LENGTH = 18; + private static final long serialVersionUID = MAVLINK_MSG_ID_TERRAIN_REQUEST; + + + /** + * Bitmask of requested 4x4 grids (row major 8x7 array of grids, 56 bits) + */ + public long mask; + + /** + * Latitude of SW corner of first grid (degrees *10^7) + */ + public int lat; + + /** + * Longitude of SW corner of first grid (in degrees *10^7) + */ + public int lon; + + /** + * Grid spacing in meters + */ + public int grid_spacing; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_TERRAIN_REQUEST; + + packet.payload.putUnsignedLong(mask); + + packet.payload.putInt(lat); + + packet.payload.putInt(lon); + + packet.payload.putUnsignedShort(grid_spacing); + + return packet; + } + + /** + * Decode a terrain_request message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.mask = payload.getUnsignedLong(); + + this.lat = payload.getInt(); + + this.lon = payload.getInt(); + + this.grid_spacing = payload.getUnsignedShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_terrain_request() { + msgid = MAVLINK_MSG_ID_TERRAIN_REQUEST; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_terrain_request(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_TERRAIN_REQUEST; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_TERRAIN_REQUEST - sysid:" + sysid + " compid:" + compid + " mask:" + mask + " lat:" + lat + " lon:" + lon + " grid_spacing:" + grid_spacing + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_timesync.java b/app/src/main/java/com/MAVLink/common/msg_timesync.java new file mode 100644 index 0000000..7bf756f --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_timesync.java @@ -0,0 +1,93 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE TIMESYNC PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Time synchronization message. + */ +public class msg_timesync extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_TIMESYNC = 111; + public static final int MAVLINK_MSG_LENGTH = 16; + private static final long serialVersionUID = MAVLINK_MSG_ID_TIMESYNC; + + + /** + * Time sync timestamp 1 + */ + public long tc1; + + /** + * Time sync timestamp 2 + */ + public long ts1; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_TIMESYNC; + + packet.payload.putLong(tc1); + + packet.payload.putLong(ts1); + + return packet; + } + + /** + * Decode a timesync message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.tc1 = payload.getLong(); + + this.ts1 = payload.getLong(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_timesync() { + msgid = MAVLINK_MSG_ID_TIMESYNC; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_timesync(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_TIMESYNC; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_TIMESYNC - sysid:" + sysid + " compid:" + compid + " tc1:" + tc1 + " ts1:" + ts1 + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_uavcan_node_info.java b/app/src/main/java/com/MAVLink/common/msg_uavcan_node_info.java new file mode 100644 index 0000000..aaf1214 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_uavcan_node_info.java @@ -0,0 +1,201 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE UAVCAN_NODE_INFO PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * General information describing a particular UAVCAN node. Please refer to the definition of the UAVCAN service "uavcan.protocol.GetNodeInfo" for the background information. This message should be emitted by the system whenever a new node appears online, or an existing node reboots. Additionally, it can be emitted upon request from the other end of the MAVLink channel (see MAV_CMD_UAVCAN_GET_NODE_INFO). It is also not prohibited to emit this message unconditionally at a low frequency. The UAVCAN specification is available at http://uavcan.org. + */ +public class msg_uavcan_node_info extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_UAVCAN_NODE_INFO = 311; + public static final int MAVLINK_MSG_LENGTH = 116; + private static final long serialVersionUID = MAVLINK_MSG_ID_UAVCAN_NODE_INFO; + + + /** + * Timestamp (microseconds since UNIX epoch or microseconds since system boot) + */ + public long time_usec; + + /** + * The number of seconds since the start-up of the node. + */ + public long uptime_sec; + + /** + * Version control system (VCS) revision identifier (e.g. git short commit hash). Zero if unknown. + */ + public long sw_vcs_commit; + + /** + * Node name string. For example, "sapog.px4.io". + */ + public byte name[] = new byte[80]; + + /** + * Hardware major version number. + */ + public short hw_version_major; + + /** + * Hardware minor version number. + */ + public short hw_version_minor; + + /** + * Hardware unique 128-bit ID. + */ + public short hw_unique_id[] = new short[16]; + + /** + * Software major version number. + */ + public short sw_version_major; + + /** + * Software minor version number. + */ + public short sw_version_minor; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_UAVCAN_NODE_INFO; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putUnsignedInt(uptime_sec); + + packet.payload.putUnsignedInt(sw_vcs_commit); + + + for (int i = 0; i < name.length; i++) { + packet.payload.putByte(name[i]); + } + + + packet.payload.putUnsignedByte(hw_version_major); + + packet.payload.putUnsignedByte(hw_version_minor); + + + for (int i = 0; i < hw_unique_id.length; i++) { + packet.payload.putUnsignedByte(hw_unique_id[i]); + } + + + packet.payload.putUnsignedByte(sw_version_major); + + packet.payload.putUnsignedByte(sw_version_minor); + + return packet; + } + + /** + * Decode a uavcan_node_info message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.uptime_sec = payload.getUnsignedInt(); + + this.sw_vcs_commit = payload.getUnsignedInt(); + + + for (int i = 0; i < this.name.length; i++) { + this.name[i] = payload.getByte(); + } + + + this.hw_version_major = payload.getUnsignedByte(); + + this.hw_version_minor = payload.getUnsignedByte(); + + + for (int i = 0; i < this.hw_unique_id.length; i++) { + this.hw_unique_id[i] = payload.getUnsignedByte(); + } + + + this.sw_version_major = payload.getUnsignedByte(); + + this.sw_version_minor = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_uavcan_node_info() { + msgid = MAVLINK_MSG_ID_UAVCAN_NODE_INFO; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_uavcan_node_info(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_UAVCAN_NODE_INFO; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setName(String str) { + int len = Math.min(str.length(), 80); + for (int i = 0; i < len; i++) { + name[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 80; i++) { // padding for the rest of the buffer + name[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getName() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 80; i++) { + if (name[i] != 0) + buf.append((char) name[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_UAVCAN_NODE_INFO - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " uptime_sec:" + uptime_sec + " sw_vcs_commit:" + sw_vcs_commit + " name:" + name + " hw_version_major:" + hw_version_major + " hw_version_minor:" + hw_version_minor + " hw_unique_id:" + hw_unique_id + " sw_version_major:" + sw_version_major + " sw_version_minor:" + sw_version_minor + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_uavcan_node_status.java b/app/src/main/java/com/MAVLink/common/msg_uavcan_node_status.java new file mode 100644 index 0000000..9b8c993 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_uavcan_node_status.java @@ -0,0 +1,129 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE UAVCAN_NODE_STATUS PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * General status information of an UAVCAN node. Please refer to the definition of the UAVCAN message "uavcan.protocol.NodeStatus" for the background information. The UAVCAN specification is available at http://uavcan.org. + */ +public class msg_uavcan_node_status extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_UAVCAN_NODE_STATUS = 310; + public static final int MAVLINK_MSG_LENGTH = 17; + private static final long serialVersionUID = MAVLINK_MSG_ID_UAVCAN_NODE_STATUS; + + + /** + * Timestamp (microseconds since UNIX epoch or microseconds since system boot) + */ + public long time_usec; + + /** + * The number of seconds since the start-up of the node. + */ + public long uptime_sec; + + /** + * Vendor-specific status information. + */ + public int vendor_specific_status_code; + + /** + * Generalized node health status. + */ + public short health; + + /** + * Generalized operating mode. + */ + public short mode; + + /** + * Not used currently. + */ + public short sub_mode; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_UAVCAN_NODE_STATUS; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putUnsignedInt(uptime_sec); + + packet.payload.putUnsignedShort(vendor_specific_status_code); + + packet.payload.putUnsignedByte(health); + + packet.payload.putUnsignedByte(mode); + + packet.payload.putUnsignedByte(sub_mode); + + return packet; + } + + /** + * Decode a uavcan_node_status message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.uptime_sec = payload.getUnsignedInt(); + + this.vendor_specific_status_code = payload.getUnsignedShort(); + + this.health = payload.getUnsignedByte(); + + this.mode = payload.getUnsignedByte(); + + this.sub_mode = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_uavcan_node_status() { + msgid = MAVLINK_MSG_ID_UAVCAN_NODE_STATUS; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_uavcan_node_status(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_UAVCAN_NODE_STATUS; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_UAVCAN_NODE_STATUS - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " uptime_sec:" + uptime_sec + " vendor_specific_status_code:" + vendor_specific_status_code + " health:" + health + " mode:" + mode + " sub_mode:" + sub_mode + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_v2_extension.java b/app/src/main/java/com/MAVLink/common/msg_v2_extension.java new file mode 100644 index 0000000..d73bb19 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_v2_extension.java @@ -0,0 +1,128 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE V2_EXTENSION PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Message implementing parts of the V2 payload specs in V1 frames for transitional support. + */ +public class msg_v2_extension extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_V2_EXTENSION = 248; + public static final int MAVLINK_MSG_LENGTH = 254; + private static final long serialVersionUID = MAVLINK_MSG_ID_V2_EXTENSION; + + + /** + * A code that identifies the software component that understands this message (analogous to usb device classes or mime type strings). If this code is less than 32768, it is considered a 'registered' protocol extension and the corresponding entry should be added to https://github.com/mavlink/mavlink/extension-message-ids.xml. Software creators can register blocks of message IDs as needed (useful for GCS specific metadata, etc...). Message_types greater than 32767 are considered local experiments and should not be checked in to any widely distributed codebase. + */ + public int message_type; + + /** + * Network ID (0 for broadcast) + */ + public short target_network; + + /** + * System ID (0 for broadcast) + */ + public short target_system; + + /** + * Component ID (0 for broadcast) + */ + public short target_component; + + /** + * Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The entire content of this block is opaque unless you understand any the encoding message_type. The particular encoding used can be extension specific and might not always be documented as part of the mavlink specification. + */ + public short payload[] = new short[249]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_V2_EXTENSION; + + packet.payload.putUnsignedShort(message_type); + + packet.payload.putUnsignedByte(target_network); + + packet.payload.putUnsignedByte(target_system); + + packet.payload.putUnsignedByte(target_component); + + + for (int i = 0; i < payload.length; i++) { + packet.payload.putUnsignedByte(payload[i]); + } + + + return packet; + } + + /** + * Decode a v2_extension message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.message_type = payload.getUnsignedShort(); + + this.target_network = payload.getUnsignedByte(); + + this.target_system = payload.getUnsignedByte(); + + this.target_component = payload.getUnsignedByte(); + + + for (int i = 0; i < this.payload.length; i++) { + this.payload[i] = payload.getUnsignedByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_v2_extension() { + msgid = MAVLINK_MSG_ID_V2_EXTENSION; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_v2_extension(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_V2_EXTENSION; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_V2_EXTENSION - sysid:" + sysid + " compid:" + compid + " message_type:" + message_type + " target_network:" + target_network + " target_system:" + target_system + " target_component:" + target_component + " payload:" + payload + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_vfr_hud.java b/app/src/main/java/com/MAVLink/common/msg_vfr_hud.java new file mode 100644 index 0000000..0090d7f --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_vfr_hud.java @@ -0,0 +1,129 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE VFR_HUD PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Metrics typically displayed on a HUD for fixed wing aircraft + */ +public class msg_vfr_hud extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_VFR_HUD = 74; + public static final int MAVLINK_MSG_LENGTH = 20; + private static final long serialVersionUID = MAVLINK_MSG_ID_VFR_HUD; + + + /** + * Current airspeed in m/s + */ + public float airspeed; + + /** + * Current ground speed in m/s + */ + public float groundspeed; + + /** + * Current altitude (MSL), in meters + */ + public float alt; + + /** + * Current climb rate in meters/second + */ + public float climb; + + /** + * Current heading in degrees, in compass units (0..360, 0=north) + */ + public short heading; + + /** + * Current throttle setting in integer percent, 0 to 100 + */ + public int throttle; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_VFR_HUD; + + packet.payload.putFloat(airspeed); + + packet.payload.putFloat(groundspeed); + + packet.payload.putFloat(alt); + + packet.payload.putFloat(climb); + + packet.payload.putShort(heading); + + packet.payload.putUnsignedShort(throttle); + + return packet; + } + + /** + * Decode a vfr_hud message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.airspeed = payload.getFloat(); + + this.groundspeed = payload.getFloat(); + + this.alt = payload.getFloat(); + + this.climb = payload.getFloat(); + + this.heading = payload.getShort(); + + this.throttle = payload.getUnsignedShort(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_vfr_hud() { + msgid = MAVLINK_MSG_ID_VFR_HUD; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_vfr_hud(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_VFR_HUD; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_VFR_HUD - sysid:" + sysid + " compid:" + compid + " airspeed:" + airspeed + " groundspeed:" + groundspeed + " alt:" + alt + " climb:" + climb + " heading:" + heading + " throttle:" + throttle + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_vibration.java b/app/src/main/java/com/MAVLink/common/msg_vibration.java new file mode 100644 index 0000000..d56d93c --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_vibration.java @@ -0,0 +1,138 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE VIBRATION PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Vibration levels and accelerometer clipping + */ +public class msg_vibration extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_VIBRATION = 241; + public static final int MAVLINK_MSG_LENGTH = 32; + private static final long serialVersionUID = MAVLINK_MSG_ID_VIBRATION; + + + /** + * Timestamp (micros since boot or Unix epoch) + */ + public long time_usec; + + /** + * Vibration levels on X-axis + */ + public float vibration_x; + + /** + * Vibration levels on Y-axis + */ + public float vibration_y; + + /** + * Vibration levels on Z-axis + */ + public float vibration_z; + + /** + * first accelerometer clipping count + */ + public long clipping_0; + + /** + * second accelerometer clipping count + */ + public long clipping_1; + + /** + * third accelerometer clipping count + */ + public long clipping_2; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_VIBRATION; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putFloat(vibration_x); + + packet.payload.putFloat(vibration_y); + + packet.payload.putFloat(vibration_z); + + packet.payload.putUnsignedInt(clipping_0); + + packet.payload.putUnsignedInt(clipping_1); + + packet.payload.putUnsignedInt(clipping_2); + + return packet; + } + + /** + * Decode a vibration message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.vibration_x = payload.getFloat(); + + this.vibration_y = payload.getFloat(); + + this.vibration_z = payload.getFloat(); + + this.clipping_0 = payload.getUnsignedInt(); + + this.clipping_1 = payload.getUnsignedInt(); + + this.clipping_2 = payload.getUnsignedInt(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_vibration() { + msgid = MAVLINK_MSG_ID_VIBRATION; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_vibration(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_VIBRATION; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_VIBRATION - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " vibration_x:" + vibration_x + " vibration_y:" + vibration_y + " vibration_z:" + vibration_z + " clipping_0:" + clipping_0 + " clipping_1:" + clipping_1 + " clipping_2:" + clipping_2 + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_vicon_position_estimate.java b/app/src/main/java/com/MAVLink/common/msg_vicon_position_estimate.java new file mode 100644 index 0000000..598d8db --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_vicon_position_estimate.java @@ -0,0 +1,138 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE VICON_POSITION_ESTIMATE PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * + */ +public class msg_vicon_position_estimate extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE = 104; + public static final int MAVLINK_MSG_LENGTH = 32; + private static final long serialVersionUID = MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE; + + + /** + * Timestamp (microseconds, synced to UNIX time or since system boot) + */ + public long usec; + + /** + * Global X position + */ + public float x; + + /** + * Global Y position + */ + public float y; + + /** + * Global Z position + */ + public float z; + + /** + * Roll angle in rad + */ + public float roll; + + /** + * Pitch angle in rad + */ + public float pitch; + + /** + * Yaw angle in rad + */ + public float yaw; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE; + + packet.payload.putUnsignedLong(usec); + + packet.payload.putFloat(x); + + packet.payload.putFloat(y); + + packet.payload.putFloat(z); + + packet.payload.putFloat(roll); + + packet.payload.putFloat(pitch); + + packet.payload.putFloat(yaw); + + return packet; + } + + /** + * Decode a vicon_position_estimate message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.usec = payload.getUnsignedLong(); + + this.x = payload.getFloat(); + + this.y = payload.getFloat(); + + this.z = payload.getFloat(); + + this.roll = payload.getFloat(); + + this.pitch = payload.getFloat(); + + this.yaw = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_vicon_position_estimate() { + msgid = MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_vicon_position_estimate(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE - sysid:" + sysid + " compid:" + compid + " usec:" + usec + " x:" + x + " y:" + y + " z:" + z + " roll:" + roll + " pitch:" + pitch + " yaw:" + yaw + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_video_stream_information.java b/app/src/main/java/com/MAVLink/common/msg_video_stream_information.java new file mode 100644 index 0000000..4e98dda --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_video_stream_information.java @@ -0,0 +1,184 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE VIDEO_STREAM_INFORMATION PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * WIP: Information about video stream + */ +public class msg_video_stream_information extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION = 269; + public static final int MAVLINK_MSG_LENGTH = 246; + private static final long serialVersionUID = MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION; + + + /** + * Frames per second + */ + public float framerate; + + /** + * Bit rate in bits per second + */ + public long bitrate; + + /** + * Resolution horizontal in pixels + */ + public int resolution_h; + + /** + * Resolution vertical in pixels + */ + public int resolution_v; + + /** + * Video image rotation clockwise + */ + public int rotation; + + /** + * Camera ID (1 for first, 2 for second, etc.) + */ + public short camera_id; + + /** + * Current status of video streaming (0: not running, 1: in progress) + */ + public short status; + + /** + * Video stream URI + */ + public byte uri[] = new byte[230]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION; + + packet.payload.putFloat(framerate); + + packet.payload.putUnsignedInt(bitrate); + + packet.payload.putUnsignedShort(resolution_h); + + packet.payload.putUnsignedShort(resolution_v); + + packet.payload.putUnsignedShort(rotation); + + packet.payload.putUnsignedByte(camera_id); + + packet.payload.putUnsignedByte(status); + + + for (int i = 0; i < uri.length; i++) { + packet.payload.putByte(uri[i]); + } + + + return packet; + } + + /** + * Decode a video_stream_information message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.framerate = payload.getFloat(); + + this.bitrate = payload.getUnsignedInt(); + + this.resolution_h = payload.getUnsignedShort(); + + this.resolution_v = payload.getUnsignedShort(); + + this.rotation = payload.getUnsignedShort(); + + this.camera_id = payload.getUnsignedByte(); + + this.status = payload.getUnsignedByte(); + + + for (int i = 0; i < this.uri.length; i++) { + this.uri[i] = payload.getByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_video_stream_information() { + msgid = MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_video_stream_information(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setUri(String str) { + int len = Math.min(str.length(), 230); + for (int i = 0; i < len; i++) { + uri[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 230; i++) { // padding for the rest of the buffer + uri[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getUri() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 230; i++) { + if (uri[i] != 0) + buf.append((char) uri[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_VIDEO_STREAM_INFORMATION - sysid:" + sysid + " compid:" + compid + " framerate:" + framerate + " bitrate:" + bitrate + " resolution_h:" + resolution_h + " resolution_v:" + resolution_v + " rotation:" + rotation + " camera_id:" + camera_id + " status:" + status + " uri:" + uri + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_vision_position_estimate.java b/app/src/main/java/com/MAVLink/common/msg_vision_position_estimate.java new file mode 100644 index 0000000..83fd22f --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_vision_position_estimate.java @@ -0,0 +1,138 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE VISION_POSITION_ESTIMATE PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * + */ +public class msg_vision_position_estimate extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE = 102; + public static final int MAVLINK_MSG_LENGTH = 32; + private static final long serialVersionUID = MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE; + + + /** + * Timestamp (microseconds, synced to UNIX time or since system boot) + */ + public long usec; + + /** + * Global X position + */ + public float x; + + /** + * Global Y position + */ + public float y; + + /** + * Global Z position + */ + public float z; + + /** + * Roll angle in rad + */ + public float roll; + + /** + * Pitch angle in rad + */ + public float pitch; + + /** + * Yaw angle in rad + */ + public float yaw; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE; + + packet.payload.putUnsignedLong(usec); + + packet.payload.putFloat(x); + + packet.payload.putFloat(y); + + packet.payload.putFloat(z); + + packet.payload.putFloat(roll); + + packet.payload.putFloat(pitch); + + packet.payload.putFloat(yaw); + + return packet; + } + + /** + * Decode a vision_position_estimate message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.usec = payload.getUnsignedLong(); + + this.x = payload.getFloat(); + + this.y = payload.getFloat(); + + this.z = payload.getFloat(); + + this.roll = payload.getFloat(); + + this.pitch = payload.getFloat(); + + this.yaw = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_vision_position_estimate() { + msgid = MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_vision_position_estimate(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE - sysid:" + sysid + " compid:" + compid + " usec:" + usec + " x:" + x + " y:" + y + " z:" + z + " roll:" + roll + " pitch:" + pitch + " yaw:" + yaw + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_vision_speed_estimate.java b/app/src/main/java/com/MAVLink/common/msg_vision_speed_estimate.java new file mode 100644 index 0000000..0a7fb00 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_vision_speed_estimate.java @@ -0,0 +1,111 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE VISION_SPEED_ESTIMATE PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * + */ +public class msg_vision_speed_estimate extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE = 103; + public static final int MAVLINK_MSG_LENGTH = 20; + private static final long serialVersionUID = MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE; + + + /** + * Timestamp (microseconds, synced to UNIX time or since system boot) + */ + public long usec; + + /** + * Global X speed + */ + public float x; + + /** + * Global Y speed + */ + public float y; + + /** + * Global Z speed + */ + public float z; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE; + + packet.payload.putUnsignedLong(usec); + + packet.payload.putFloat(x); + + packet.payload.putFloat(y); + + packet.payload.putFloat(z); + + return packet; + } + + /** + * Decode a vision_speed_estimate message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.usec = payload.getUnsignedLong(); + + this.x = payload.getFloat(); + + this.y = payload.getFloat(); + + this.z = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_vision_speed_estimate() { + msgid = MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_vision_speed_estimate(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE - sysid:" + sysid + " compid:" + compid + " usec:" + usec + " x:" + x + " y:" + y + " z:" + z + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_wifi_config_ap.java b/app/src/main/java/com/MAVLink/common/msg_wifi_config_ap.java new file mode 100644 index 0000000..11a9964 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_wifi_config_ap.java @@ -0,0 +1,165 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE WIFI_CONFIG_AP PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Configure AP SSID and Password. + */ +public class msg_wifi_config_ap extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_WIFI_CONFIG_AP = 299; + public static final int MAVLINK_MSG_LENGTH = 96; + private static final long serialVersionUID = MAVLINK_MSG_ID_WIFI_CONFIG_AP; + + + /** + * Name of Wi-Fi network (SSID). Leave it blank to leave it unchanged. + */ + public byte ssid[] = new byte[32]; + + /** + * Password. Leave it blank for an open AP. + */ + public byte password[] = new byte[64]; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_WIFI_CONFIG_AP; + + + for (int i = 0; i < ssid.length; i++) { + packet.payload.putByte(ssid[i]); + } + + + for (int i = 0; i < password.length; i++) { + packet.payload.putByte(password[i]); + } + + + return packet; + } + + /** + * Decode a wifi_config_ap message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + + for (int i = 0; i < this.ssid.length; i++) { + this.ssid[i] = payload.getByte(); + } + + + for (int i = 0; i < this.password.length; i++) { + this.password[i] = payload.getByte(); + } + + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_wifi_config_ap() { + msgid = MAVLINK_MSG_ID_WIFI_CONFIG_AP; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_wifi_config_ap(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_WIFI_CONFIG_AP; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setSsid(String str) { + int len = Math.min(str.length(), 32); + for (int i = 0; i < len; i++) { + ssid[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 32; i++) { // padding for the rest of the buffer + ssid[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getSsid() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 32; i++) { + if (ssid[i] != 0) + buf.append((char) ssid[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setPassword(String str) { + int len = Math.min(str.length(), 64); + for (int i = 0; i < len; i++) { + password[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 64; i++) { // padding for the rest of the buffer + password[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getPassword() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 64; i++) { + if (password[i] != 0) + buf.append((char) password[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_WIFI_CONFIG_AP - sysid:" + sysid + " compid:" + compid + " ssid:" + ssid + " password:" + password + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/common/msg_wind_cov.java b/app/src/main/java/com/MAVLink/common/msg_wind_cov.java new file mode 100644 index 0000000..8964df3 --- /dev/null +++ b/app/src/main/java/com/MAVLink/common/msg_wind_cov.java @@ -0,0 +1,156 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE WIND_COV PACKING +package com.MAVLink.common; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * + */ +public class msg_wind_cov extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_WIND_COV = 231; + public static final int MAVLINK_MSG_LENGTH = 40; + private static final long serialVersionUID = MAVLINK_MSG_ID_WIND_COV; + + + /** + * Timestamp (micros since boot or Unix epoch) + */ + public long time_usec; + + /** + * Wind in X (NED) direction in m/s + */ + public float wind_x; + + /** + * Wind in Y (NED) direction in m/s + */ + public float wind_y; + + /** + * Wind in Z (NED) direction in m/s + */ + public float wind_z; + + /** + * Variability of the wind in XY. RMS of a 1 Hz lowpassed wind estimate. + */ + public float var_horiz; + + /** + * Variability of the wind in Z. RMS of a 1 Hz lowpassed wind estimate. + */ + public float var_vert; + + /** + * AMSL altitude (m) this measurement was taken at + */ + public float wind_alt; + + /** + * Horizontal speed 1-STD accuracy + */ + public float horiz_accuracy; + + /** + * Vertical speed 1-STD accuracy + */ + public float vert_accuracy; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_WIND_COV; + + packet.payload.putUnsignedLong(time_usec); + + packet.payload.putFloat(wind_x); + + packet.payload.putFloat(wind_y); + + packet.payload.putFloat(wind_z); + + packet.payload.putFloat(var_horiz); + + packet.payload.putFloat(var_vert); + + packet.payload.putFloat(wind_alt); + + packet.payload.putFloat(horiz_accuracy); + + packet.payload.putFloat(vert_accuracy); + + return packet; + } + + /** + * Decode a wind_cov message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.time_usec = payload.getUnsignedLong(); + + this.wind_x = payload.getFloat(); + + this.wind_y = payload.getFloat(); + + this.wind_z = payload.getFloat(); + + this.var_horiz = payload.getFloat(); + + this.var_vert = payload.getFloat(); + + this.wind_alt = payload.getFloat(); + + this.horiz_accuracy = payload.getFloat(); + + this.vert_accuracy = payload.getFloat(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_wind_cov() { + msgid = MAVLINK_MSG_ID_WIND_COV; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_wind_cov(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_WIND_COV; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_WIND_COV - sysid:" + sysid + " compid:" + compid + " time_usec:" + time_usec + " wind_x:" + wind_x + " wind_y:" + wind_y + " wind_z:" + wind_z + " var_horiz:" + var_horiz + " var_vert:" + var_vert + " wind_alt:" + wind_alt + " horiz_accuracy:" + horiz_accuracy + " vert_accuracy:" + vert_accuracy + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/ACCELCAL_VEHICLE_POS.java b/app/src/main/java/com/MAVLink/enums/ACCELCAL_VEHICLE_POS.java new file mode 100644 index 0000000..198eb39 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/ACCELCAL_VEHICLE_POS.java @@ -0,0 +1,21 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class ACCELCAL_VEHICLE_POS { + public static final int ACCELCAL_VEHICLE_POS_LEVEL = 1; /* | */ + public static final int ACCELCAL_VEHICLE_POS_LEFT = 2; /* | */ + public static final int ACCELCAL_VEHICLE_POS_RIGHT = 3; /* | */ + public static final int ACCELCAL_VEHICLE_POS_NOSEDOWN = 4; /* | */ + public static final int ACCELCAL_VEHICLE_POS_NOSEUP = 5; /* | */ + public static final int ACCELCAL_VEHICLE_POS_BACK = 6; /* | */ + public static final int ACCELCAL_VEHICLE_POS_ENUM_END = 7; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/ADSB_ALTITUDE_TYPE.java b/app/src/main/java/com/MAVLink/enums/ADSB_ALTITUDE_TYPE.java new file mode 100644 index 0000000..2a68537 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/ADSB_ALTITUDE_TYPE.java @@ -0,0 +1,17 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Enumeration of the ADSB altimeter types + */ +public class ADSB_ALTITUDE_TYPE { + public static final int ADSB_ALTITUDE_TYPE_PRESSURE_QNH = 0; /* Altitude reported from a Baro source using QNH reference | */ + public static final int ADSB_ALTITUDE_TYPE_GEOMETRIC = 1; /* Altitude reported from a GNSS source | */ + public static final int ADSB_ALTITUDE_TYPE_ENUM_END = 2; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/ADSB_EMITTER_TYPE.java b/app/src/main/java/com/MAVLink/enums/ADSB_EMITTER_TYPE.java new file mode 100644 index 0000000..b75bfb9 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/ADSB_EMITTER_TYPE.java @@ -0,0 +1,35 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * ADSB classification for the type of vehicle emitting the transponder signal + */ +public class ADSB_EMITTER_TYPE { + public static final int ADSB_EMITTER_TYPE_NO_INFO = 0; /* | */ + public static final int ADSB_EMITTER_TYPE_LIGHT = 1; /* | */ + public static final int ADSB_EMITTER_TYPE_SMALL = 2; /* | */ + public static final int ADSB_EMITTER_TYPE_LARGE = 3; /* | */ + public static final int ADSB_EMITTER_TYPE_HIGH_VORTEX_LARGE = 4; /* | */ + public static final int ADSB_EMITTER_TYPE_HEAVY = 5; /* | */ + public static final int ADSB_EMITTER_TYPE_HIGHLY_MANUV = 6; /* | */ + public static final int ADSB_EMITTER_TYPE_ROTOCRAFT = 7; /* | */ + public static final int ADSB_EMITTER_TYPE_UNASSIGNED = 8; /* | */ + public static final int ADSB_EMITTER_TYPE_GLIDER = 9; /* | */ + public static final int ADSB_EMITTER_TYPE_LIGHTER_AIR = 10; /* | */ + public static final int ADSB_EMITTER_TYPE_PARACHUTE = 11; /* | */ + public static final int ADSB_EMITTER_TYPE_ULTRA_LIGHT = 12; /* | */ + public static final int ADSB_EMITTER_TYPE_UNASSIGNED2 = 13; /* | */ + public static final int ADSB_EMITTER_TYPE_UAV = 14; /* | */ + public static final int ADSB_EMITTER_TYPE_SPACE = 15; /* | */ + public static final int ADSB_EMITTER_TYPE_UNASSGINED3 = 16; /* | */ + public static final int ADSB_EMITTER_TYPE_EMERGENCY_SURFACE = 17; /* | */ + public static final int ADSB_EMITTER_TYPE_SERVICE_SURFACE = 18; /* | */ + public static final int ADSB_EMITTER_TYPE_POINT_OBSTACLE = 19; /* | */ + public static final int ADSB_EMITTER_TYPE_ENUM_END = 20; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/ADSB_FLAGS.java b/app/src/main/java/com/MAVLink/enums/ADSB_FLAGS.java new file mode 100644 index 0000000..f459ebc --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/ADSB_FLAGS.java @@ -0,0 +1,22 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * These flags indicate status such as data validity of each data source. Set = data valid + */ +public class ADSB_FLAGS { + public static final int ADSB_FLAGS_VALID_COORDS = 1; /* | */ + public static final int ADSB_FLAGS_VALID_ALTITUDE = 2; /* | */ + public static final int ADSB_FLAGS_VALID_HEADING = 4; /* | */ + public static final int ADSB_FLAGS_VALID_VELOCITY = 8; /* | */ + public static final int ADSB_FLAGS_VALID_CALLSIGN = 16; /* | */ + public static final int ADSB_FLAGS_VALID_SQUAWK = 32; /* | */ + public static final int ADSB_FLAGS_SIMULATED = 64; /* | */ + public static final int ADSB_FLAGS_ENUM_END = 65; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/CAMERA_CAP_FLAGS.java b/app/src/main/java/com/MAVLink/enums/CAMERA_CAP_FLAGS.java new file mode 100644 index 0000000..8f6a412 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/CAMERA_CAP_FLAGS.java @@ -0,0 +1,21 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Camera capability flags (Bitmap). + */ +public class CAMERA_CAP_FLAGS { + public static final int CAMERA_CAP_FLAGS_CAPTURE_VIDEO = 1; /* Camera is able to record video. | */ + public static final int CAMERA_CAP_FLAGS_CAPTURE_IMAGE = 2; /* Camera is able to capture images. | */ + public static final int CAMERA_CAP_FLAGS_HAS_MODES = 4; /* Camera has separate Video and Image/Photo modes (MAV_CMD_SET_CAMERA_MODE) | */ + public static final int CAMERA_CAP_FLAGS_CAN_CAPTURE_IMAGE_IN_VIDEO_MODE = 8; /* Camera can capture images while in video mode | */ + public static final int CAMERA_CAP_FLAGS_CAN_CAPTURE_VIDEO_IN_IMAGE_MODE = 16; /* Camera can capture videos while in Photo/Image mode | */ + public static final int CAMERA_CAP_FLAGS_HAS_IMAGE_SURVEY_MODE = 32; /* Camera has image survey mode (MAV_CMD_SET_CAMERA_MODE) | */ + public static final int CAMERA_CAP_FLAGS_ENUM_END = 33; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/CAMERA_FEEDBACK_FLAGS.java b/app/src/main/java/com/MAVLink/enums/CAMERA_FEEDBACK_FLAGS.java new file mode 100644 index 0000000..0cf6fd3 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/CAMERA_FEEDBACK_FLAGS.java @@ -0,0 +1,20 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class CAMERA_FEEDBACK_FLAGS { + public static final int CAMERA_FEEDBACK_PHOTO = 0; /* Shooting photos, not video | */ + public static final int CAMERA_FEEDBACK_VIDEO = 1; /* Shooting video, not stills | */ + public static final int CAMERA_FEEDBACK_BADEXPOSURE = 2; /* Unable to achieve requested exposure (e.g. shutter speed too low) | */ + public static final int CAMERA_FEEDBACK_CLOSEDLOOP = 3; /* Closed loop feedback from camera, we know for sure it has successfully taken a picture | */ + public static final int CAMERA_FEEDBACK_OPENLOOP = 4; /* Open loop camera, an image trigger has been requested but we can't know for sure it has successfully taken a picture | */ + public static final int CAMERA_FEEDBACK_FLAGS_ENUM_END = 5; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/CAMERA_MODE.java b/app/src/main/java/com/MAVLink/enums/CAMERA_MODE.java new file mode 100644 index 0000000..288375b --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/CAMERA_MODE.java @@ -0,0 +1,18 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Camera Modes. + */ +public class CAMERA_MODE { + public static final int CAMERA_MODE_IMAGE = 0; /* Camera is in image/photo capture mode. | */ + public static final int CAMERA_MODE_VIDEO = 1; /* Camera is in video capture mode. | */ + public static final int CAMERA_MODE_IMAGE_SURVEY = 2; /* Camera is in image survey capture mode. It allows for camera controller to do specific settings for surveys. | */ + public static final int CAMERA_MODE_ENUM_END = 3; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/CAMERA_STATUS_TYPES.java b/app/src/main/java/com/MAVLink/enums/CAMERA_STATUS_TYPES.java new file mode 100644 index 0000000..41b6505 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/CAMERA_STATUS_TYPES.java @@ -0,0 +1,22 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class CAMERA_STATUS_TYPES { + public static final int CAMERA_STATUS_TYPE_HEARTBEAT = 0; /* Camera heartbeat, announce camera component ID at 1hz | */ + public static final int CAMERA_STATUS_TYPE_TRIGGER = 1; /* Camera image triggered | */ + public static final int CAMERA_STATUS_TYPE_DISCONNECT = 2; /* Camera connection lost | */ + public static final int CAMERA_STATUS_TYPE_ERROR = 3; /* Camera unknown error | */ + public static final int CAMERA_STATUS_TYPE_LOWBATT = 4; /* Camera battery low. Parameter p1 shows reported voltage | */ + public static final int CAMERA_STATUS_TYPE_LOWSTORE = 5; /* Camera storage low. Parameter p1 shows reported shots remaining | */ + public static final int CAMERA_STATUS_TYPE_LOWSTOREV = 6; /* Camera storage low. Parameter p1 shows reported video minutes remaining | */ + public static final int CAMERA_STATUS_TYPES_ENUM_END = 7; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/DEVICE_OP_BUSTYPE.java b/app/src/main/java/com/MAVLink/enums/DEVICE_OP_BUSTYPE.java new file mode 100644 index 0000000..a389d7f --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/DEVICE_OP_BUSTYPE.java @@ -0,0 +1,17 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Bus types for device operations + */ +public class DEVICE_OP_BUSTYPE { + public static final int DEVICE_OP_BUSTYPE_I2C = 0; /* I2C Device operation | */ + public static final int DEVICE_OP_BUSTYPE_SPI = 1; /* SPI Device operation | */ + public static final int DEVICE_OP_BUSTYPE_ENUM_END = 2; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/EKF_STATUS_FLAGS.java b/app/src/main/java/com/MAVLink/enums/EKF_STATUS_FLAGS.java new file mode 100644 index 0000000..8ccb644 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/EKF_STATUS_FLAGS.java @@ -0,0 +1,25 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Flags in EKF_STATUS message + */ +public class EKF_STATUS_FLAGS { + public static final int EKF_ATTITUDE = 1; /* set if EKF's attitude estimate is good | */ + public static final int EKF_VELOCITY_HORIZ = 2; /* set if EKF's horizontal velocity estimate is good | */ + public static final int EKF_VELOCITY_VERT = 4; /* set if EKF's vertical velocity estimate is good | */ + public static final int EKF_POS_HORIZ_REL = 8; /* set if EKF's horizontal position (relative) estimate is good | */ + public static final int EKF_POS_HORIZ_ABS = 16; /* set if EKF's horizontal position (absolute) estimate is good | */ + public static final int EKF_POS_VERT_ABS = 32; /* set if EKF's vertical position (absolute) estimate is good | */ + public static final int EKF_POS_VERT_AGL = 64; /* set if EKF's vertical position (above ground) estimate is good | */ + public static final int EKF_CONST_POS_MODE = 128; /* EKF is in constant position mode and does not know it's absolute or relative position | */ + public static final int EKF_PRED_POS_HORIZ_REL = 256; /* set if EKF's predicted horizontal position (relative) estimate is good | */ + public static final int EKF_PRED_POS_HORIZ_ABS = 512; /* set if EKF's predicted horizontal position (absolute) estimate is good | */ + public static final int EKF_STATUS_FLAGS_ENUM_END = 513; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/ESTIMATOR_STATUS_FLAGS.java b/app/src/main/java/com/MAVLink/enums/ESTIMATOR_STATUS_FLAGS.java new file mode 100644 index 0000000..76e9957 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/ESTIMATOR_STATUS_FLAGS.java @@ -0,0 +1,26 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Flags in EKF_STATUS message + */ +public class ESTIMATOR_STATUS_FLAGS { + public static final int ESTIMATOR_ATTITUDE = 1; /* True if the attitude estimate is good | */ + public static final int ESTIMATOR_VELOCITY_HORIZ = 2; /* True if the horizontal velocity estimate is good | */ + public static final int ESTIMATOR_VELOCITY_VERT = 4; /* True if the vertical velocity estimate is good | */ + public static final int ESTIMATOR_POS_HORIZ_REL = 8; /* True if the horizontal position (relative) estimate is good | */ + public static final int ESTIMATOR_POS_HORIZ_ABS = 16; /* True if the horizontal position (absolute) estimate is good | */ + public static final int ESTIMATOR_POS_VERT_ABS = 32; /* True if the vertical position (absolute) estimate is good | */ + public static final int ESTIMATOR_POS_VERT_AGL = 64; /* True if the vertical position (above ground) estimate is good | */ + public static final int ESTIMATOR_CONST_POS_MODE = 128; /* True if the EKF is in a constant position mode and is not using external measurements (eg GPS or optical flow) | */ + public static final int ESTIMATOR_PRED_POS_HORIZ_REL = 256; /* True if the EKF has sufficient data to enter a mode that will provide a (relative) position estimate | */ + public static final int ESTIMATOR_PRED_POS_HORIZ_ABS = 512; /* True if the EKF has sufficient data to enter a mode that will provide a (absolute) position estimate | */ + public static final int ESTIMATOR_GPS_GLITCH = 1024; /* True if the EKF has detected a GPS glitch | */ + public static final int ESTIMATOR_STATUS_FLAGS_ENUM_END = 1025; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/FENCE_ACTION.java b/app/src/main/java/com/MAVLink/enums/FENCE_ACTION.java new file mode 100644 index 0000000..d396c61 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/FENCE_ACTION.java @@ -0,0 +1,20 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class FENCE_ACTION { + public static final int FENCE_ACTION_NONE = 0; /* Disable fenced mode | */ + public static final int FENCE_ACTION_GUIDED = 1; /* Switched to guided mode to return point (fence point 0) | */ + public static final int FENCE_ACTION_REPORT = 2; /* Report fence breach, but don't take action | */ + public static final int FENCE_ACTION_GUIDED_THR_PASS = 3; /* Switched to guided mode to return point (fence point 0) with manual throttle control | */ + public static final int FENCE_ACTION_RTL = 4; /* Switch to RTL (return to launch) mode and head for the return point. | */ + public static final int FENCE_ACTION_ENUM_END = 5; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/FENCE_BREACH.java b/app/src/main/java/com/MAVLink/enums/FENCE_BREACH.java new file mode 100644 index 0000000..c71f30b --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/FENCE_BREACH.java @@ -0,0 +1,19 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class FENCE_BREACH { + public static final int FENCE_BREACH_NONE = 0; /* No last fence breach | */ + public static final int FENCE_BREACH_MINALT = 1; /* Breached minimum altitude | */ + public static final int FENCE_BREACH_MAXALT = 2; /* Breached maximum altitude | */ + public static final int FENCE_BREACH_BOUNDARY = 3; /* Breached fence boundary | */ + public static final int FENCE_BREACH_ENUM_END = 4; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/FIRMWARE_VERSION_TYPE.java b/app/src/main/java/com/MAVLink/enums/FIRMWARE_VERSION_TYPE.java new file mode 100644 index 0000000..f9a1e69 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/FIRMWARE_VERSION_TYPE.java @@ -0,0 +1,20 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * These values define the type of firmware release. These values indicate the first version or release of this type. For example the first alpha release would be 64, the second would be 65. + */ +public class FIRMWARE_VERSION_TYPE { + public static final int FIRMWARE_VERSION_TYPE_DEV = 0; /* development release | */ + public static final int FIRMWARE_VERSION_TYPE_ALPHA = 64; /* alpha release | */ + public static final int FIRMWARE_VERSION_TYPE_BETA = 128; /* beta release | */ + public static final int FIRMWARE_VERSION_TYPE_RC = 192; /* release candidate | */ + public static final int FIRMWARE_VERSION_TYPE_OFFICIAL = 255; /* official stable release | */ + public static final int FIRMWARE_VERSION_TYPE_ENUM_END = 256; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GIMBAL_AXIS.java b/app/src/main/java/com/MAVLink/enums/GIMBAL_AXIS.java new file mode 100644 index 0000000..3803323 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GIMBAL_AXIS.java @@ -0,0 +1,18 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GIMBAL_AXIS { + public static final int GIMBAL_AXIS_YAW = 0; /* Gimbal yaw axis | */ + public static final int GIMBAL_AXIS_PITCH = 1; /* Gimbal pitch axis | */ + public static final int GIMBAL_AXIS_ROLL = 2; /* Gimbal roll axis | */ + public static final int GIMBAL_AXIS_ENUM_END = 3; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GIMBAL_AXIS_CALIBRATION_REQUIRED.java b/app/src/main/java/com/MAVLink/enums/GIMBAL_AXIS_CALIBRATION_REQUIRED.java new file mode 100644 index 0000000..2b658c1 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GIMBAL_AXIS_CALIBRATION_REQUIRED.java @@ -0,0 +1,18 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GIMBAL_AXIS_CALIBRATION_REQUIRED { + public static final int GIMBAL_AXIS_CALIBRATION_REQUIRED_UNKNOWN = 0; /* Whether or not this axis requires calibration is unknown at this time | */ + public static final int GIMBAL_AXIS_CALIBRATION_REQUIRED_TRUE = 1; /* This axis requires calibration | */ + public static final int GIMBAL_AXIS_CALIBRATION_REQUIRED_FALSE = 2; /* This axis does not require calibration | */ + public static final int GIMBAL_AXIS_CALIBRATION_REQUIRED_ENUM_END = 3; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GIMBAL_AXIS_CALIBRATION_STATUS.java b/app/src/main/java/com/MAVLink/enums/GIMBAL_AXIS_CALIBRATION_STATUS.java new file mode 100644 index 0000000..5b155c9 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GIMBAL_AXIS_CALIBRATION_STATUS.java @@ -0,0 +1,18 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GIMBAL_AXIS_CALIBRATION_STATUS { + public static final int GIMBAL_AXIS_CALIBRATION_STATUS_IN_PROGRESS = 0; /* Axis calibration is in progress | */ + public static final int GIMBAL_AXIS_CALIBRATION_STATUS_SUCCEEDED = 1; /* Axis calibration succeeded | */ + public static final int GIMBAL_AXIS_CALIBRATION_STATUS_FAILED = 2; /* Axis calibration failed | */ + public static final int GIMBAL_AXIS_CALIBRATION_STATUS_ENUM_END = 3; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GOPRO_BURST_RATE.java b/app/src/main/java/com/MAVLink/enums/GOPRO_BURST_RATE.java new file mode 100644 index 0000000..b830c97 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GOPRO_BURST_RATE.java @@ -0,0 +1,24 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GOPRO_BURST_RATE { + public static final int GOPRO_BURST_RATE_3_IN_1_SECOND = 0; /* 3 Shots / 1 Second | */ + public static final int GOPRO_BURST_RATE_5_IN_1_SECOND = 1; /* 5 Shots / 1 Second | */ + public static final int GOPRO_BURST_RATE_10_IN_1_SECOND = 2; /* 10 Shots / 1 Second | */ + public static final int GOPRO_BURST_RATE_10_IN_2_SECOND = 3; /* 10 Shots / 2 Second | */ + public static final int GOPRO_BURST_RATE_10_IN_3_SECOND = 4; /* 10 Shots / 3 Second (Hero 4 Only) | */ + public static final int GOPRO_BURST_RATE_30_IN_1_SECOND = 5; /* 30 Shots / 1 Second | */ + public static final int GOPRO_BURST_RATE_30_IN_2_SECOND = 6; /* 30 Shots / 2 Second | */ + public static final int GOPRO_BURST_RATE_30_IN_3_SECOND = 7; /* 30 Shots / 3 Second | */ + public static final int GOPRO_BURST_RATE_30_IN_6_SECOND = 8; /* 30 Shots / 6 Second | */ + public static final int GOPRO_BURST_RATE_ENUM_END = 9; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GOPRO_CAPTURE_MODE.java b/app/src/main/java/com/MAVLink/enums/GOPRO_CAPTURE_MODE.java new file mode 100644 index 0000000..a991507 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GOPRO_CAPTURE_MODE.java @@ -0,0 +1,23 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GOPRO_CAPTURE_MODE { + public static final int GOPRO_CAPTURE_MODE_VIDEO = 0; /* Video mode | */ + public static final int GOPRO_CAPTURE_MODE_PHOTO = 1; /* Photo mode | */ + public static final int GOPRO_CAPTURE_MODE_BURST = 2; /* Burst mode, hero 3+ only | */ + public static final int GOPRO_CAPTURE_MODE_TIME_LAPSE = 3; /* Time lapse mode, hero 3+ only | */ + public static final int GOPRO_CAPTURE_MODE_MULTI_SHOT = 4; /* Multi shot mode, hero 4 only | */ + public static final int GOPRO_CAPTURE_MODE_PLAYBACK = 5; /* Playback mode, hero 4 only, silver only except when LCD or HDMI is connected to black | */ + public static final int GOPRO_CAPTURE_MODE_SETUP = 6; /* Playback mode, hero 4 only | */ + public static final int GOPRO_CAPTURE_MODE_UNKNOWN = 255; /* Mode not yet known | */ + public static final int GOPRO_CAPTURE_MODE_ENUM_END = 256; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GOPRO_CHARGING.java b/app/src/main/java/com/MAVLink/enums/GOPRO_CHARGING.java new file mode 100644 index 0000000..4b0326e --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GOPRO_CHARGING.java @@ -0,0 +1,17 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GOPRO_CHARGING { + public static final int GOPRO_CHARGING_DISABLED = 0; /* Charging disabled | */ + public static final int GOPRO_CHARGING_ENABLED = 1; /* Charging enabled | */ + public static final int GOPRO_CHARGING_ENUM_END = 2; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GOPRO_COMMAND.java b/app/src/main/java/com/MAVLink/enums/GOPRO_COMMAND.java new file mode 100644 index 0000000..eb8c2a1 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GOPRO_COMMAND.java @@ -0,0 +1,32 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GOPRO_COMMAND { + public static final int GOPRO_COMMAND_POWER = 0; /* (Get/Set) | */ + public static final int GOPRO_COMMAND_CAPTURE_MODE = 1; /* (Get/Set) | */ + public static final int GOPRO_COMMAND_SHUTTER = 2; /* (___/Set) | */ + public static final int GOPRO_COMMAND_BATTERY = 3; /* (Get/___) | */ + public static final int GOPRO_COMMAND_MODEL = 4; /* (Get/___) | */ + public static final int GOPRO_COMMAND_VIDEO_SETTINGS = 5; /* (Get/Set) | */ + public static final int GOPRO_COMMAND_LOW_LIGHT = 6; /* (Get/Set) | */ + public static final int GOPRO_COMMAND_PHOTO_RESOLUTION = 7; /* (Get/Set) | */ + public static final int GOPRO_COMMAND_PHOTO_BURST_RATE = 8; /* (Get/Set) | */ + public static final int GOPRO_COMMAND_PROTUNE = 9; /* (Get/Set) | */ + public static final int GOPRO_COMMAND_PROTUNE_WHITE_BALANCE = 10; /* (Get/Set) Hero 3+ Only | */ + public static final int GOPRO_COMMAND_PROTUNE_COLOUR = 11; /* (Get/Set) Hero 3+ Only | */ + public static final int GOPRO_COMMAND_PROTUNE_GAIN = 12; /* (Get/Set) Hero 3+ Only | */ + public static final int GOPRO_COMMAND_PROTUNE_SHARPNESS = 13; /* (Get/Set) Hero 3+ Only | */ + public static final int GOPRO_COMMAND_PROTUNE_EXPOSURE = 14; /* (Get/Set) Hero 3+ Only | */ + public static final int GOPRO_COMMAND_TIME = 15; /* (Get/Set) | */ + public static final int GOPRO_COMMAND_CHARGING = 16; /* (Get/Set) | */ + public static final int GOPRO_COMMAND_ENUM_END = 17; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GOPRO_FIELD_OF_VIEW.java b/app/src/main/java/com/MAVLink/enums/GOPRO_FIELD_OF_VIEW.java new file mode 100644 index 0000000..6720ba6 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GOPRO_FIELD_OF_VIEW.java @@ -0,0 +1,18 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GOPRO_FIELD_OF_VIEW { + public static final int GOPRO_FIELD_OF_VIEW_WIDE = 0; /* 0x00: Wide | */ + public static final int GOPRO_FIELD_OF_VIEW_MEDIUM = 1; /* 0x01: Medium | */ + public static final int GOPRO_FIELD_OF_VIEW_NARROW = 2; /* 0x02: Narrow | */ + public static final int GOPRO_FIELD_OF_VIEW_ENUM_END = 3; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GOPRO_FRAME_RATE.java b/app/src/main/java/com/MAVLink/enums/GOPRO_FRAME_RATE.java new file mode 100644 index 0000000..3c979cf --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GOPRO_FRAME_RATE.java @@ -0,0 +1,29 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GOPRO_FRAME_RATE { + public static final int GOPRO_FRAME_RATE_12 = 0; /* 12 FPS | */ + public static final int GOPRO_FRAME_RATE_15 = 1; /* 15 FPS | */ + public static final int GOPRO_FRAME_RATE_24 = 2; /* 24 FPS | */ + public static final int GOPRO_FRAME_RATE_25 = 3; /* 25 FPS | */ + public static final int GOPRO_FRAME_RATE_30 = 4; /* 30 FPS | */ + public static final int GOPRO_FRAME_RATE_48 = 5; /* 48 FPS | */ + public static final int GOPRO_FRAME_RATE_50 = 6; /* 50 FPS | */ + public static final int GOPRO_FRAME_RATE_60 = 7; /* 60 FPS | */ + public static final int GOPRO_FRAME_RATE_80 = 8; /* 80 FPS | */ + public static final int GOPRO_FRAME_RATE_90 = 9; /* 90 FPS | */ + public static final int GOPRO_FRAME_RATE_100 = 10; /* 100 FPS | */ + public static final int GOPRO_FRAME_RATE_120 = 11; /* 120 FPS | */ + public static final int GOPRO_FRAME_RATE_240 = 12; /* 240 FPS | */ + public static final int GOPRO_FRAME_RATE_12_5 = 13; /* 12.5 FPS | */ + public static final int GOPRO_FRAME_RATE_ENUM_END = 14; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GOPRO_HEARTBEAT_FLAGS.java b/app/src/main/java/com/MAVLink/enums/GOPRO_HEARTBEAT_FLAGS.java new file mode 100644 index 0000000..58bc41b --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GOPRO_HEARTBEAT_FLAGS.java @@ -0,0 +1,16 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GOPRO_HEARTBEAT_FLAGS { + public static final int GOPRO_FLAG_RECORDING = 1; /* GoPro is currently recording | */ + public static final int GOPRO_HEARTBEAT_FLAGS_ENUM_END = 2; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GOPRO_HEARTBEAT_STATUS.java b/app/src/main/java/com/MAVLink/enums/GOPRO_HEARTBEAT_STATUS.java new file mode 100644 index 0000000..3905864 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GOPRO_HEARTBEAT_STATUS.java @@ -0,0 +1,19 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GOPRO_HEARTBEAT_STATUS { + public static final int GOPRO_HEARTBEAT_STATUS_DISCONNECTED = 0; /* No GoPro connected | */ + public static final int GOPRO_HEARTBEAT_STATUS_INCOMPATIBLE = 1; /* The detected GoPro is not HeroBus compatible | */ + public static final int GOPRO_HEARTBEAT_STATUS_CONNECTED = 2; /* A HeroBus compatible GoPro is connected | */ + public static final int GOPRO_HEARTBEAT_STATUS_ERROR = 3; /* An unrecoverable error was encountered with the connected GoPro, it may require a power cycle | */ + public static final int GOPRO_HEARTBEAT_STATUS_ENUM_END = 4; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GOPRO_MODEL.java b/app/src/main/java/com/MAVLink/enums/GOPRO_MODEL.java new file mode 100644 index 0000000..14ae1d9 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GOPRO_MODEL.java @@ -0,0 +1,20 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GOPRO_MODEL { + public static final int GOPRO_MODEL_UNKNOWN = 0; /* Unknown gopro model | */ + public static final int GOPRO_MODEL_HERO_3_PLUS_SILVER = 1; /* Hero 3+ Silver (HeroBus not supported by GoPro) | */ + public static final int GOPRO_MODEL_HERO_3_PLUS_BLACK = 2; /* Hero 3+ Black | */ + public static final int GOPRO_MODEL_HERO_4_SILVER = 3; /* Hero 4 Silver | */ + public static final int GOPRO_MODEL_HERO_4_BLACK = 4; /* Hero 4 Black | */ + public static final int GOPRO_MODEL_ENUM_END = 5; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GOPRO_PHOTO_RESOLUTION.java b/app/src/main/java/com/MAVLink/enums/GOPRO_PHOTO_RESOLUTION.java new file mode 100644 index 0000000..e0a8b0a --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GOPRO_PHOTO_RESOLUTION.java @@ -0,0 +1,20 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GOPRO_PHOTO_RESOLUTION { + public static final int GOPRO_PHOTO_RESOLUTION_5MP_MEDIUM = 0; /* 5MP Medium | */ + public static final int GOPRO_PHOTO_RESOLUTION_7MP_MEDIUM = 1; /* 7MP Medium | */ + public static final int GOPRO_PHOTO_RESOLUTION_7MP_WIDE = 2; /* 7MP Wide | */ + public static final int GOPRO_PHOTO_RESOLUTION_10MP_WIDE = 3; /* 10MP Wide | */ + public static final int GOPRO_PHOTO_RESOLUTION_12MP_WIDE = 4; /* 12MP Wide | */ + public static final int GOPRO_PHOTO_RESOLUTION_ENUM_END = 5; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GOPRO_PROTUNE_COLOUR.java b/app/src/main/java/com/MAVLink/enums/GOPRO_PROTUNE_COLOUR.java new file mode 100644 index 0000000..894bedb --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GOPRO_PROTUNE_COLOUR.java @@ -0,0 +1,17 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GOPRO_PROTUNE_COLOUR { + public static final int GOPRO_PROTUNE_COLOUR_STANDARD = 0; /* Auto | */ + public static final int GOPRO_PROTUNE_COLOUR_NEUTRAL = 1; /* Neutral | */ + public static final int GOPRO_PROTUNE_COLOUR_ENUM_END = 2; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GOPRO_PROTUNE_EXPOSURE.java b/app/src/main/java/com/MAVLink/enums/GOPRO_PROTUNE_EXPOSURE.java new file mode 100644 index 0000000..688fae4 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GOPRO_PROTUNE_EXPOSURE.java @@ -0,0 +1,36 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GOPRO_PROTUNE_EXPOSURE { + public static final int GOPRO_PROTUNE_EXPOSURE_NEG_5_0 = 0; /* -5.0 EV (Hero 3+ Only) | */ + public static final int GOPRO_PROTUNE_EXPOSURE_NEG_4_5 = 1; /* -4.5 EV (Hero 3+ Only) | */ + public static final int GOPRO_PROTUNE_EXPOSURE_NEG_4_0 = 2; /* -4.0 EV (Hero 3+ Only) | */ + public static final int GOPRO_PROTUNE_EXPOSURE_NEG_3_5 = 3; /* -3.5 EV (Hero 3+ Only) | */ + public static final int GOPRO_PROTUNE_EXPOSURE_NEG_3_0 = 4; /* -3.0 EV (Hero 3+ Only) | */ + public static final int GOPRO_PROTUNE_EXPOSURE_NEG_2_5 = 5; /* -2.5 EV (Hero 3+ Only) | */ + public static final int GOPRO_PROTUNE_EXPOSURE_NEG_2_0 = 6; /* -2.0 EV | */ + public static final int GOPRO_PROTUNE_EXPOSURE_NEG_1_5 = 7; /* -1.5 EV | */ + public static final int GOPRO_PROTUNE_EXPOSURE_NEG_1_0 = 8; /* -1.0 EV | */ + public static final int GOPRO_PROTUNE_EXPOSURE_NEG_0_5 = 9; /* -0.5 EV | */ + public static final int GOPRO_PROTUNE_EXPOSURE_ZERO = 10; /* 0.0 EV | */ + public static final int GOPRO_PROTUNE_EXPOSURE_POS_0_5 = 11; /* +0.5 EV | */ + public static final int GOPRO_PROTUNE_EXPOSURE_POS_1_0 = 12; /* +1.0 EV | */ + public static final int GOPRO_PROTUNE_EXPOSURE_POS_1_5 = 13; /* +1.5 EV | */ + public static final int GOPRO_PROTUNE_EXPOSURE_POS_2_0 = 14; /* +2.0 EV | */ + public static final int GOPRO_PROTUNE_EXPOSURE_POS_2_5 = 15; /* +2.5 EV (Hero 3+ Only) | */ + public static final int GOPRO_PROTUNE_EXPOSURE_POS_3_0 = 16; /* +3.0 EV (Hero 3+ Only) | */ + public static final int GOPRO_PROTUNE_EXPOSURE_POS_3_5 = 17; /* +3.5 EV (Hero 3+ Only) | */ + public static final int GOPRO_PROTUNE_EXPOSURE_POS_4_0 = 18; /* +4.0 EV (Hero 3+ Only) | */ + public static final int GOPRO_PROTUNE_EXPOSURE_POS_4_5 = 19; /* +4.5 EV (Hero 3+ Only) | */ + public static final int GOPRO_PROTUNE_EXPOSURE_POS_5_0 = 20; /* +5.0 EV (Hero 3+ Only) | */ + public static final int GOPRO_PROTUNE_EXPOSURE_ENUM_END = 21; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GOPRO_PROTUNE_GAIN.java b/app/src/main/java/com/MAVLink/enums/GOPRO_PROTUNE_GAIN.java new file mode 100644 index 0000000..52c51a3 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GOPRO_PROTUNE_GAIN.java @@ -0,0 +1,20 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GOPRO_PROTUNE_GAIN { + public static final int GOPRO_PROTUNE_GAIN_400 = 0; /* ISO 400 | */ + public static final int GOPRO_PROTUNE_GAIN_800 = 1; /* ISO 800 (Only Hero 4) | */ + public static final int GOPRO_PROTUNE_GAIN_1600 = 2; /* ISO 1600 | */ + public static final int GOPRO_PROTUNE_GAIN_3200 = 3; /* ISO 3200 (Only Hero 4) | */ + public static final int GOPRO_PROTUNE_GAIN_6400 = 4; /* ISO 6400 | */ + public static final int GOPRO_PROTUNE_GAIN_ENUM_END = 5; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GOPRO_PROTUNE_SHARPNESS.java b/app/src/main/java/com/MAVLink/enums/GOPRO_PROTUNE_SHARPNESS.java new file mode 100644 index 0000000..1c0da7b --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GOPRO_PROTUNE_SHARPNESS.java @@ -0,0 +1,18 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GOPRO_PROTUNE_SHARPNESS { + public static final int GOPRO_PROTUNE_SHARPNESS_LOW = 0; /* Low Sharpness | */ + public static final int GOPRO_PROTUNE_SHARPNESS_MEDIUM = 1; /* Medium Sharpness | */ + public static final int GOPRO_PROTUNE_SHARPNESS_HIGH = 2; /* High Sharpness | */ + public static final int GOPRO_PROTUNE_SHARPNESS_ENUM_END = 3; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GOPRO_PROTUNE_WHITE_BALANCE.java b/app/src/main/java/com/MAVLink/enums/GOPRO_PROTUNE_WHITE_BALANCE.java new file mode 100644 index 0000000..1f81261 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GOPRO_PROTUNE_WHITE_BALANCE.java @@ -0,0 +1,20 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GOPRO_PROTUNE_WHITE_BALANCE { + public static final int GOPRO_PROTUNE_WHITE_BALANCE_AUTO = 0; /* Auto | */ + public static final int GOPRO_PROTUNE_WHITE_BALANCE_3000K = 1; /* 3000K | */ + public static final int GOPRO_PROTUNE_WHITE_BALANCE_5500K = 2; /* 5500K | */ + public static final int GOPRO_PROTUNE_WHITE_BALANCE_6500K = 3; /* 6500K | */ + public static final int GOPRO_PROTUNE_WHITE_BALANCE_RAW = 4; /* Camera Raw | */ + public static final int GOPRO_PROTUNE_WHITE_BALANCE_ENUM_END = 5; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GOPRO_REQUEST_STATUS.java b/app/src/main/java/com/MAVLink/enums/GOPRO_REQUEST_STATUS.java new file mode 100644 index 0000000..50d7cea --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GOPRO_REQUEST_STATUS.java @@ -0,0 +1,17 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GOPRO_REQUEST_STATUS { + public static final int GOPRO_REQUEST_SUCCESS = 0; /* The write message with ID indicated succeeded | */ + public static final int GOPRO_REQUEST_FAILED = 1; /* The write message with ID indicated failed | */ + public static final int GOPRO_REQUEST_STATUS_ENUM_END = 2; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GOPRO_RESOLUTION.java b/app/src/main/java/com/MAVLink/enums/GOPRO_RESOLUTION.java new file mode 100644 index 0000000..6cd5ddc --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GOPRO_RESOLUTION.java @@ -0,0 +1,29 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GOPRO_RESOLUTION { + public static final int GOPRO_RESOLUTION_480p = 0; /* 848 x 480 (480p) | */ + public static final int GOPRO_RESOLUTION_720p = 1; /* 1280 x 720 (720p) | */ + public static final int GOPRO_RESOLUTION_960p = 2; /* 1280 x 960 (960p) | */ + public static final int GOPRO_RESOLUTION_1080p = 3; /* 1920 x 1080 (1080p) | */ + public static final int GOPRO_RESOLUTION_1440p = 4; /* 1920 x 1440 (1440p) | */ + public static final int GOPRO_RESOLUTION_2_7k_17_9 = 5; /* 2704 x 1440 (2.7k-17:9) | */ + public static final int GOPRO_RESOLUTION_2_7k_16_9 = 6; /* 2704 x 1524 (2.7k-16:9) | */ + public static final int GOPRO_RESOLUTION_2_7k_4_3 = 7; /* 2704 x 2028 (2.7k-4:3) | */ + public static final int GOPRO_RESOLUTION_4k_16_9 = 8; /* 3840 x 2160 (4k-16:9) | */ + public static final int GOPRO_RESOLUTION_4k_17_9 = 9; /* 4096 x 2160 (4k-17:9) | */ + public static final int GOPRO_RESOLUTION_720p_SUPERVIEW = 10; /* 1280 x 720 (720p-SuperView) | */ + public static final int GOPRO_RESOLUTION_1080p_SUPERVIEW = 11; /* 1920 x 1080 (1080p-SuperView) | */ + public static final int GOPRO_RESOLUTION_2_7k_SUPERVIEW = 12; /* 2704 x 1520 (2.7k-SuperView) | */ + public static final int GOPRO_RESOLUTION_4k_SUPERVIEW = 13; /* 3840 x 2160 (4k-SuperView) | */ + public static final int GOPRO_RESOLUTION_ENUM_END = 14; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GOPRO_VIDEO_SETTINGS_FLAGS.java b/app/src/main/java/com/MAVLink/enums/GOPRO_VIDEO_SETTINGS_FLAGS.java new file mode 100644 index 0000000..a84c2a6 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GOPRO_VIDEO_SETTINGS_FLAGS.java @@ -0,0 +1,16 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GOPRO_VIDEO_SETTINGS_FLAGS { + public static final int GOPRO_VIDEO_SETTINGS_TV_MODE = 1; /* 0=NTSC, 1=PAL | */ + public static final int GOPRO_VIDEO_SETTINGS_FLAGS_ENUM_END = 2; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GPS_FIX_TYPE.java b/app/src/main/java/com/MAVLink/enums/GPS_FIX_TYPE.java new file mode 100644 index 0000000..01eebb2 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GPS_FIX_TYPE.java @@ -0,0 +1,24 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Type of GPS fix + */ +public class GPS_FIX_TYPE { + public static final int GPS_FIX_TYPE_NO_GPS = 0; /* No GPS connected | */ + public static final int GPS_FIX_TYPE_NO_FIX = 1; /* No position information, GPS is connected | */ + public static final int GPS_FIX_TYPE_2D_FIX = 2; /* 2D position | */ + public static final int GPS_FIX_TYPE_3D_FIX = 3; /* 3D position | */ + public static final int GPS_FIX_TYPE_DGPS = 4; /* DGPS/SBAS aided 3D position | */ + public static final int GPS_FIX_TYPE_RTK_FLOAT = 5; /* RTK float, 3D position | */ + public static final int GPS_FIX_TYPE_RTK_FIXED = 6; /* RTK Fixed, 3D position | */ + public static final int GPS_FIX_TYPE_STATIC = 7; /* Static fixed, typically used for base stations | */ + public static final int GPS_FIX_TYPE_PPP = 8; /* PPP, 3D position. | */ + public static final int GPS_FIX_TYPE_ENUM_END = 9; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GPS_INPUT_IGNORE_FLAGS.java b/app/src/main/java/com/MAVLink/enums/GPS_INPUT_IGNORE_FLAGS.java new file mode 100644 index 0000000..415744e --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GPS_INPUT_IGNORE_FLAGS.java @@ -0,0 +1,23 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class GPS_INPUT_IGNORE_FLAGS { + public static final int GPS_INPUT_IGNORE_FLAG_ALT = 1; /* ignore altitude field | */ + public static final int GPS_INPUT_IGNORE_FLAG_HDOP = 2; /* ignore hdop field | */ + public static final int GPS_INPUT_IGNORE_FLAG_VDOP = 4; /* ignore vdop field | */ + public static final int GPS_INPUT_IGNORE_FLAG_VEL_HORIZ = 8; /* ignore horizontal velocity field (vn and ve) | */ + public static final int GPS_INPUT_IGNORE_FLAG_VEL_VERT = 16; /* ignore vertical velocity field (vd) | */ + public static final int GPS_INPUT_IGNORE_FLAG_SPEED_ACCURACY = 32; /* ignore speed accuracy field | */ + public static final int GPS_INPUT_IGNORE_FLAG_HORIZONTAL_ACCURACY = 64; /* ignore horizontal accuracy field | */ + public static final int GPS_INPUT_IGNORE_FLAG_VERTICAL_ACCURACY = 128; /* ignore vertical accuracy field | */ + public static final int GPS_INPUT_IGNORE_FLAGS_ENUM_END = 129; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/GRIPPER_ACTIONS.java b/app/src/main/java/com/MAVLink/enums/GRIPPER_ACTIONS.java new file mode 100644 index 0000000..7e43cc9 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/GRIPPER_ACTIONS.java @@ -0,0 +1,17 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Gripper actions. + */ +public class GRIPPER_ACTIONS { + public static final int GRIPPER_ACTION_RELEASE = 0; /* gripper release of cargo | */ + public static final int GRIPPER_ACTION_GRAB = 1; /* gripper grabs onto cargo | */ + public static final int GRIPPER_ACTIONS_ENUM_END = 2; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/LANDING_TARGET_TYPE.java b/app/src/main/java/com/MAVLink/enums/LANDING_TARGET_TYPE.java new file mode 100644 index 0000000..f1ecfe2 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/LANDING_TARGET_TYPE.java @@ -0,0 +1,19 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Type of landing target + */ +public class LANDING_TARGET_TYPE { + public static final int LANDING_TARGET_TYPE_LIGHT_BEACON = 0; /* Landing target signaled by light beacon (ex: IR-LOCK) | */ + public static final int LANDING_TARGET_TYPE_RADIO_BEACON = 1; /* Landing target signaled by radio beacon (ex: ILS, NDB) | */ + public static final int LANDING_TARGET_TYPE_VISION_FIDUCIAL = 2; /* Landing target represented by a fiducial marker (ex: ARTag) | */ + public static final int LANDING_TARGET_TYPE_VISION_OTHER = 3; /* Landing target represented by a pre-defined visual shape/feature (ex: X-marker, H-marker, square) | */ + public static final int LANDING_TARGET_TYPE_ENUM_END = 4; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/LED_CONTROL_PATTERN.java b/app/src/main/java/com/MAVLink/enums/LED_CONTROL_PATTERN.java new file mode 100644 index 0000000..d6c6c74 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/LED_CONTROL_PATTERN.java @@ -0,0 +1,18 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class LED_CONTROL_PATTERN { + public static final int LED_CONTROL_PATTERN_OFF = 0; /* LED patterns off (return control to regular vehicle control) | */ + public static final int LED_CONTROL_PATTERN_FIRMWAREUPDATE = 1; /* LEDs show pattern during firmware update | */ + public static final int LED_CONTROL_PATTERN_CUSTOM = 255; /* Custom Pattern using custom bytes fields | */ + public static final int LED_CONTROL_PATTERN_ENUM_END = 256; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/LIMITS_STATE.java b/app/src/main/java/com/MAVLink/enums/LIMITS_STATE.java new file mode 100644 index 0000000..e1928a7 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/LIMITS_STATE.java @@ -0,0 +1,21 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class LIMITS_STATE { + public static final int LIMITS_INIT = 0; /* pre-initialization | */ + public static final int LIMITS_DISABLED = 1; /* disabled | */ + public static final int LIMITS_ENABLED = 2; /* checking limits | */ + public static final int LIMITS_TRIGGERED = 3; /* a limit has been breached | */ + public static final int LIMITS_RECOVERING = 4; /* taking action eg. RTL | */ + public static final int LIMITS_RECOVERED = 5; /* we're no longer in breach of a limit | */ + public static final int LIMITS_STATE_ENUM_END = 6; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/LIMIT_MODULE.java b/app/src/main/java/com/MAVLink/enums/LIMIT_MODULE.java new file mode 100644 index 0000000..7290189 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/LIMIT_MODULE.java @@ -0,0 +1,18 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class LIMIT_MODULE { + public static final int LIMIT_GPSLOCK = 1; /* pre-initialization | */ + public static final int LIMIT_GEOFENCE = 2; /* disabled | */ + public static final int LIMIT_ALTITUDE = 4; /* checking limits | */ + public static final int LIMIT_MODULE_ENUM_END = 5; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAG_CAL_STATUS.java b/app/src/main/java/com/MAVLink/enums/MAG_CAL_STATUS.java new file mode 100644 index 0000000..c25b393 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAG_CAL_STATUS.java @@ -0,0 +1,21 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class MAG_CAL_STATUS { + public static final int MAG_CAL_NOT_STARTED = 0; /* | */ + public static final int MAG_CAL_WAITING_TO_START = 1; /* | */ + public static final int MAG_CAL_RUNNING_STEP_ONE = 2; /* | */ + public static final int MAG_CAL_RUNNING_STEP_TWO = 3; /* | */ + public static final int MAG_CAL_SUCCESS = 4; /* | */ + public static final int MAG_CAL_FAILED = 5; /* | */ + public static final int MAG_CAL_STATUS_ENUM_END = 6; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAVLINK_DATA_STREAM_TYPE.java b/app/src/main/java/com/MAVLink/enums/MAVLINK_DATA_STREAM_TYPE.java new file mode 100644 index 0000000..f5c11fc --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAVLINK_DATA_STREAM_TYPE.java @@ -0,0 +1,21 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class MAVLINK_DATA_STREAM_TYPE { + public static final int MAVLINK_DATA_STREAM_IMG_JPEG = 1; /* | */ + public static final int MAVLINK_DATA_STREAM_IMG_BMP = 2; /* | */ + public static final int MAVLINK_DATA_STREAM_IMG_RAW8U = 3; /* | */ + public static final int MAVLINK_DATA_STREAM_IMG_RAW32U = 4; /* | */ + public static final int MAVLINK_DATA_STREAM_IMG_PGM = 5; /* | */ + public static final int MAVLINK_DATA_STREAM_IMG_PNG = 6; /* | */ + public static final int MAVLINK_DATA_STREAM_TYPE_ENUM_END = 7; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_ARM_AUTH_DENIED_REASON.java b/app/src/main/java/com/MAVLink/enums/MAV_ARM_AUTH_DENIED_REASON.java new file mode 100644 index 0000000..7df3e43 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_ARM_AUTH_DENIED_REASON.java @@ -0,0 +1,21 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class MAV_ARM_AUTH_DENIED_REASON { + public static final int MAV_ARM_AUTH_DENIED_REASON_GENERIC = 0; /* Not a specific reason | */ + public static final int MAV_ARM_AUTH_DENIED_REASON_NONE = 1; /* Authorizer will send the error as string to GCS | */ + public static final int MAV_ARM_AUTH_DENIED_REASON_INVALID_WAYPOINT = 2; /* At least one waypoint have a invalid value | */ + public static final int MAV_ARM_AUTH_DENIED_REASON_TIMEOUT = 3; /* Timeout in the authorizer process(in case it depends on network) | */ + public static final int MAV_ARM_AUTH_DENIED_REASON_AIRSPACE_IN_USE = 4; /* Airspace of the mission in use by another vehicle, second result parameter can have the waypoint id that caused it to be denied. | */ + public static final int MAV_ARM_AUTH_DENIED_REASON_BAD_WEATHER = 5; /* Weather is not good to fly | */ + public static final int MAV_ARM_AUTH_DENIED_REASON_ENUM_END = 6; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_AUTOPILOT.java b/app/src/main/java/com/MAVLink/enums/MAV_AUTOPILOT.java new file mode 100644 index 0000000..63cad99 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_AUTOPILOT.java @@ -0,0 +1,34 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Micro air vehicle / autopilot classes. This identifies the individual model. + */ +public class MAV_AUTOPILOT { + public static final int MAV_AUTOPILOT_GENERIC = 0; /* Generic autopilot, full support for everything | */ + public static final int MAV_AUTOPILOT_RESERVED = 1; /* Reserved for future use. | */ + public static final int MAV_AUTOPILOT_SLUGS = 2; /* SLUGS autopilot, http://slugsuav.soe.ucsc.edu | */ + public static final int MAV_AUTOPILOT_ARDUPILOTMEGA = 3; /* ArduPilotMega / ArduCopter, http://diydrones.com | */ + public static final int MAV_AUTOPILOT_OPENPILOT = 4; /* OpenPilot, http://openpilot.org | */ + public static final int MAV_AUTOPILOT_GENERIC_WAYPOINTS_ONLY = 5; /* Generic autopilot only supporting simple waypoints | */ + public static final int MAV_AUTOPILOT_GENERIC_WAYPOINTS_AND_SIMPLE_NAVIGATION_ONLY = 6; /* Generic autopilot supporting waypoints and other simple navigation commands | */ + public static final int MAV_AUTOPILOT_GENERIC_MISSION_FULL = 7; /* Generic autopilot supporting the full mission command set | */ + public static final int MAV_AUTOPILOT_INVALID = 8; /* No valid autopilot, e.g. a GCS or other MAVLink component | */ + public static final int MAV_AUTOPILOT_PPZ = 9; /* PPZ UAV - http://nongnu.org/paparazzi | */ + public static final int MAV_AUTOPILOT_UDB = 10; /* UAV Dev Board | */ + public static final int MAV_AUTOPILOT_FP = 11; /* FlexiPilot | */ + public static final int MAV_AUTOPILOT_PX4 = 12; /* PX4 Autopilot - http://pixhawk.ethz.ch/px4/ | */ + public static final int MAV_AUTOPILOT_SMACCMPILOT = 13; /* SMACCMPilot - http://smaccmpilot.org | */ + public static final int MAV_AUTOPILOT_AUTOQUAD = 14; /* AutoQuad -- http://autoquad.org | */ + public static final int MAV_AUTOPILOT_ARMAZILA = 15; /* Armazila -- http://armazila.com | */ + public static final int MAV_AUTOPILOT_AEROB = 16; /* Aerob -- http://aerob.ru | */ + public static final int MAV_AUTOPILOT_ASLUAV = 17; /* ASLUAV autopilot -- http://www.asl.ethz.ch | */ + public static final int MAV_AUTOPILOT_SMARTAP = 18; /* SmartAP Autopilot - http://sky-drones.com | */ + public static final int MAV_AUTOPILOT_ENUM_END = 19; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_BATTERY_FUNCTION.java b/app/src/main/java/com/MAVLink/enums/MAV_BATTERY_FUNCTION.java new file mode 100644 index 0000000..f435ece --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_BATTERY_FUNCTION.java @@ -0,0 +1,20 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Enumeration of battery functions + */ +public class MAV_BATTERY_FUNCTION { + public static final int MAV_BATTERY_FUNCTION_UNKNOWN = 0; /* Battery function is unknown | */ + public static final int MAV_BATTERY_FUNCTION_ALL = 1; /* Battery supports all flight systems | */ + public static final int MAV_BATTERY_FUNCTION_PROPULSION = 2; /* Battery for the propulsion system | */ + public static final int MAV_BATTERY_FUNCTION_AVIONICS = 3; /* Avionics battery | */ + public static final int MAV_BATTERY_TYPE_PAYLOAD = 4; /* Payload battery | */ + public static final int MAV_BATTERY_FUNCTION_ENUM_END = 5; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_BATTERY_TYPE.java b/app/src/main/java/com/MAVLink/enums/MAV_BATTERY_TYPE.java new file mode 100644 index 0000000..e3dcccc --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_BATTERY_TYPE.java @@ -0,0 +1,20 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Enumeration of battery types + */ +public class MAV_BATTERY_TYPE { + public static final int MAV_BATTERY_TYPE_UNKNOWN = 0; /* Not specified. | */ + public static final int MAV_BATTERY_TYPE_LIPO = 1; /* Lithium polymer battery | */ + public static final int MAV_BATTERY_TYPE_LIFE = 2; /* Lithium-iron-phosphate battery | */ + public static final int MAV_BATTERY_TYPE_LION = 3; /* Lithium-ION battery | */ + public static final int MAV_BATTERY_TYPE_NIMH = 4; /* Nickel metal hydride battery | */ + public static final int MAV_BATTERY_TYPE_ENUM_END = 5; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_CMD.java b/app/src/main/java/com/MAVLink/enums/MAV_CMD.java new file mode 100644 index 0000000..a0fdd0d --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_CMD.java @@ -0,0 +1,168 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Commands to be executed by the MAV. They can be executed on user request, or as part of a mission script. If the action is used in a mission, the parameter mapping to the waypoint/mission message is as follows: Param 1, Param 2, Param 3, Param 4, X: Param 5, Y:Param 6, Z:Param 7. This command list is similar what ARINC 424 is for commercial aircraft: A data format how to interpret waypoint/mission data. + */ +public class MAV_CMD { + public static final int MAV_CMD_NAV_WAYPOINT = 16; /* Navigate to MISSION. |Hold time in decimal seconds. (ignored by fixed wing, time to stay at MISSION for rotary wing)| Acceptance radius in meters (if the sphere with this radius is hit, the MISSION counts as reached)| 0 to pass through the WP, if > 0 radius in meters to pass by WP. Positive value for clockwise orbit, negative value for counter-clockwise orbit. Allows trajectory control.| Desired yaw angle at MISSION (rotary wing). NaN for unchanged.| Latitude| Longitude| Altitude| */ + public static final int MAV_CMD_NAV_LOITER_UNLIM = 17; /* Loiter around this MISSION an unlimited amount of time |Empty| Empty| Radius around MISSION, in meters. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */ + public static final int MAV_CMD_NAV_LOITER_TURNS = 18; /* Loiter around this MISSION for X turns |Turns| Empty| Radius around MISSION, in meters. If positive loiter clockwise, else counter-clockwise| Forward moving aircraft this sets exit xtrack location: 0 for center of loiter wp, 1 for exit location. Else, this is desired yaw angle| Latitude| Longitude| Altitude| */ + public static final int MAV_CMD_NAV_LOITER_TIME = 19; /* Loiter around this MISSION for X seconds |Seconds (decimal)| Empty| Radius around MISSION, in meters. If positive loiter clockwise, else counter-clockwise| Forward moving aircraft this sets exit xtrack location: 0 for center of loiter wp, 1 for exit location. Else, this is desired yaw angle| Latitude| Longitude| Altitude| */ + public static final int MAV_CMD_NAV_RETURN_TO_LAUNCH = 20; /* Return to launch location |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_NAV_LAND = 21; /* Land at location |Abort Alt| Empty| Empty| Desired yaw angle. NaN for unchanged.| Latitude| Longitude| Altitude (ground level)| */ + public static final int MAV_CMD_NAV_TAKEOFF = 22; /* Takeoff from ground / hand |Minimum pitch (if airspeed sensor present), desired pitch without sensor| Empty| Empty| Yaw angle (if magnetometer present), ignored without magnetometer. NaN for unchanged.| Latitude| Longitude| Altitude| */ + public static final int MAV_CMD_NAV_LAND_LOCAL = 23; /* Land at local position (local frame only) |Landing target number (if available)| Maximum accepted offset from desired landing position [m] - computed magnitude from spherical coordinates: d = sqrt(x^2 + y^2 + z^2), which gives the maximum accepted distance between the desired landing position and the position where the vehicle is about to land| Landing descend rate [ms^-1]| Desired yaw angle [rad]| Y-axis position [m]| X-axis position [m]| Z-axis / ground level position [m]| */ + public static final int MAV_CMD_NAV_TAKEOFF_LOCAL = 24; /* Takeoff from local position (local frame only) |Minimum pitch (if airspeed sensor present), desired pitch without sensor [rad]| Empty| Takeoff ascend rate [ms^-1]| Yaw angle [rad] (if magnetometer or another yaw estimation source present), ignored without one of these| Y-axis position [m]| X-axis position [m]| Z-axis position [m]| */ + public static final int MAV_CMD_NAV_FOLLOW = 25; /* Vehicle following, i.e. this waypoint represents the position of a moving vehicle |Following logic to use (e.g. loitering or sinusoidal following) - depends on specific autopilot implementation| Ground speed of vehicle to be followed| Radius around MISSION, in meters. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */ + public static final int MAV_CMD_NAV_CONTINUE_AND_CHANGE_ALT = 30; /* Continue on the current course and climb/descend to specified altitude. When the altitude is reached continue to the next command (i.e., don't proceed to the next command until the desired altitude is reached. |Climb or Descend (0 = Neutral, command completes when within 5m of this command's altitude, 1 = Climbing, command completes when at or above this command's altitude, 2 = Descending, command completes when at or below this command's altitude. | Empty| Empty| Empty| Empty| Empty| Desired altitude in meters| */ + public static final int MAV_CMD_NAV_LOITER_TO_ALT = 31; /* Begin loiter at the specified Latitude and Longitude. If Lat=Lon=0, then loiter at the current position. Don't consider the navigation command complete (don't leave loiter) until the altitude has been reached. Additionally, if the Heading Required parameter is non-zero the aircraft will not leave the loiter until heading toward the next waypoint. |Heading Required (0 = False)| Radius in meters. If positive loiter clockwise, negative counter-clockwise, 0 means no change to standard loiter.| Empty| Forward moving aircraft this sets exit xtrack location: 0 for center of loiter wp, 1 for exit location| Latitude| Longitude| Altitude| */ + public static final int MAV_CMD_DO_FOLLOW = 32; /* Being following a target |System ID (the system ID of the FOLLOW_TARGET beacon). Send 0 to disable follow-me and return to the default position hold mode| RESERVED| RESERVED| altitude flag: 0: Keep current altitude, 1: keep altitude difference to target, 2: go to a fixed altitude above home| altitude| RESERVED| TTL in seconds in which the MAV should go to the default position hold mode after a message rx timeout| */ + public static final int MAV_CMD_DO_FOLLOW_REPOSITION = 33; /* Reposition the MAV after a follow target command has been sent |Camera q1 (where 0 is on the ray from the camera to the tracking device)| Camera q2| Camera q3| Camera q4| altitude offset from target (m)| X offset from target (m)| Y offset from target (m)| */ + public static final int MAV_CMD_NAV_ROI = 80; /* Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicles control system to control the vehicle attitude and the attitude of various sensors such as cameras. |Region of intereset mode. (see MAV_ROI enum)| MISSION index/ target ID. (see MAV_ROI enum)| ROI index (allows a vehicle to manage multiple ROI's)| Empty| x the location of the fixed ROI (see MAV_FRAME)| y| z| */ + public static final int MAV_CMD_NAV_PATHPLANNING = 81; /* Control autonomous path planning on the MAV. |0: Disable local obstacle avoidance / local path planning (without resetting map), 1: Enable local path planning, 2: Enable and reset local path planning| 0: Disable full path planning (without resetting map), 1: Enable, 2: Enable and reset map/occupancy grid, 3: Enable and reset planned route, but not occupancy grid| Empty| Yaw angle at goal, in compass degrees, [0..360]| Latitude/X of goal| Longitude/Y of goal| Altitude/Z of goal| */ + public static final int MAV_CMD_NAV_SPLINE_WAYPOINT = 82; /* Navigate to MISSION using a spline path. |Hold time in decimal seconds. (ignored by fixed wing, time to stay at MISSION for rotary wing)| Empty| Empty| Empty| Latitude/X of goal| Longitude/Y of goal| Altitude/Z of goal| */ + public static final int MAV_CMD_NAV_ALTITUDE_WAIT = 83; /* Mission command to wait for an altitude or downwards vertical speed. This is meant for high altitude balloon launches, allowing the aircraft to be idle until either an altitude is reached or a negative vertical speed is reached (indicating early balloon burst). The wiggle time is how often to wiggle the control surfaces to prevent them seizing up. |altitude (m)| descent speed (m/s)| Wiggle Time (s)| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_NAV_VTOL_TAKEOFF = 84; /* Takeoff from ground using VTOL mode |Empty| Front transition heading, see VTOL_TRANSITION_HEADING enum.| Empty| Yaw angle in degrees. NaN for unchanged.| Latitude| Longitude| Altitude| */ + public static final int MAV_CMD_NAV_VTOL_LAND = 85; /* Land using VTOL mode |Empty| Empty| Approach altitude (with the same reference as the Altitude field). NaN if unspecified.| Yaw angle in degrees. NaN for unchanged.| Latitude| Longitude| Altitude (ground level)| */ + public static final int MAV_CMD_NAV_GUIDED_ENABLE = 92; /* hand control over to an external controller |On / Off (> 0.5f on)| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_NAV_DELAY = 93; /* Delay the next navigation command a number of seconds or until a specified time |Delay in seconds (decimal, -1 to enable time-of-day fields)| hour (24h format, UTC, -1 to ignore)| minute (24h format, UTC, -1 to ignore)| second (24h format, UTC)| Empty| Empty| Empty| */ + public static final int MAV_CMD_NAV_PAYLOAD_PLACE = 94; /* Descend and place payload. Vehicle descends until it detects a hanging payload has reached the ground, the gripper is opened to release the payload |Maximum distance to descend (meters)| Empty| Empty| Empty| Latitude (deg * 1E7)| Longitude (deg * 1E7)| Altitude (meters)| */ + public static final int MAV_CMD_NAV_LAST = 95; /* NOP - This command is only used to mark the upper limit of the NAV/ACTION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_CONDITION_DELAY = 112; /* Delay mission state machine. |Delay in seconds (decimal)| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_CONDITION_CHANGE_ALT = 113; /* Ascend/descend at rate. Delay mission state machine until desired altitude reached. |Descent / Ascend rate (m/s)| Empty| Empty| Empty| Empty| Empty| Finish Altitude| */ + public static final int MAV_CMD_CONDITION_DISTANCE = 114; /* Delay mission state machine until within desired distance of next NAV point. |Distance (meters)| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_CONDITION_YAW = 115; /* Reach a certain target angle. |target angle: [0-360], 0 is north| speed during yaw change:[deg per second]| direction: negative: counter clockwise, positive: clockwise [-1,1]| relative offset or absolute angle: [ 1,0]| Empty| Empty| Empty| */ + public static final int MAV_CMD_CONDITION_LAST = 159; /* NOP - This command is only used to mark the upper limit of the CONDITION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_SET_MODE = 176; /* Set system mode. |Mode, as defined by ENUM MAV_MODE| Custom mode - this is system specific, please refer to the individual autopilot specifications for details.| Custom sub mode - this is system specific, please refer to the individual autopilot specifications for details.| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_JUMP = 177; /* Jump to the desired command in the mission list. Repeat this action only the specified number of times |Sequence number| Repeat count| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_CHANGE_SPEED = 178; /* Change speed and/or throttle set points. |Speed type (0=Airspeed, 1=Ground Speed)| Speed (m/s, -1 indicates no change)| Throttle ( Percent, -1 indicates no change)| absolute or relative [0,1]| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_SET_HOME = 179; /* Changes the home location either to the current location or a specified location. |Use current (1=use current location, 0=use specified location)| Empty| Empty| Empty| Latitude| Longitude| Altitude| */ + public static final int MAV_CMD_DO_SET_PARAMETER = 180; /* Set a system parameter. Caution! Use of this command requires knowledge of the numeric enumeration value of the parameter. |Parameter number| Parameter value| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_SET_RELAY = 181; /* Set a relay to a condition. |Relay number| Setting (1=on, 0=off, others possible depending on system hardware)| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_REPEAT_RELAY = 182; /* Cycle a relay on and off for a desired number of cyles with a desired period. |Relay number| Cycle count| Cycle time (seconds, decimal)| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_SET_SERVO = 183; /* Set a servo to a desired PWM value. |Servo number| PWM (microseconds, 1000 to 2000 typical)| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_REPEAT_SERVO = 184; /* Cycle a between its nominal setting and a desired PWM for a desired number of cycles with a desired period. |Servo number| PWM (microseconds, 1000 to 2000 typical)| Cycle count| Cycle time (seconds)| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_FLIGHTTERMINATION = 185; /* Terminate flight immediately |Flight termination activated if > 0.5| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_CHANGE_ALTITUDE = 186; /* Change altitude set point. |Altitude in meters| Mav frame of new altitude (see MAV_FRAME)| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_LAND_START = 189; /* Mission command to perform a landing. This is used as a marker in a mission to tell the autopilot where a sequence of mission items that represents a landing starts. It may also be sent via a COMMAND_LONG to trigger a landing, in which case the nearest (geographically) landing sequence in the mission will be used. The Latitude/Longitude is optional, and may be set to 0 if not needed. If specified then it will be used to help find the closest landing sequence. |Empty| Empty| Empty| Empty| Latitude| Longitude| Empty| */ + public static final int MAV_CMD_DO_RALLY_LAND = 190; /* Mission command to perform a landing from a rally point. |Break altitude (meters)| Landing speed (m/s)| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_GO_AROUND = 191; /* Mission command to safely abort an autonmous landing. |Altitude (meters)| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_REPOSITION = 192; /* Reposition the vehicle to a specific WGS84 global position. |Ground speed, less than 0 (-1) for default| Bitmask of option flags, see the MAV_DO_REPOSITION_FLAGS enum.| Reserved| Yaw heading, NaN for unchanged. For planes indicates loiter direction (0: clockwise, 1: counter clockwise)| Latitude (deg * 1E7)| Longitude (deg * 1E7)| Altitude (meters)| */ + public static final int MAV_CMD_DO_PAUSE_CONTINUE = 193; /* If in a GPS controlled position mode, hold the current position or continue. |0: Pause current mission or reposition command, hold current position. 1: Continue mission. A VTOL capable vehicle should enter hover mode (multicopter and VTOL planes). A plane should loiter with the default loiter radius.| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ + public static final int MAV_CMD_DO_SET_REVERSE = 194; /* Set moving direction to forward or reverse. |Direction (0=Forward, 1=Reverse)| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_CONTROL_VIDEO = 200; /* Control onboard camera system. |Camera ID (-1 for all)| Transmission: 0: disabled, 1: enabled compressed, 2: enabled raw| Transmission mode: 0: video stream, >0: single images every n seconds (decimal)| Recording: 0: disabled, 1: enabled compressed, 2: enabled raw| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_SET_ROI = 201; /* Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicles control system to control the vehicle attitude and the attitude of various sensors such as cameras. |Region of intereset mode. (see MAV_ROI enum)| MISSION index/ target ID. (see MAV_ROI enum)| ROI index (allows a vehicle to manage multiple ROI's)| Empty| x the location of the fixed ROI (see MAV_FRAME)| y| z| */ + public static final int MAV_CMD_DO_DIGICAM_CONFIGURE = 202; /* Mission command to configure an on-board camera controller system. |Modes: P, TV, AV, M, Etc| Shutter speed: Divisor number for one second| Aperture: F stop number| ISO number e.g. 80, 100, 200, Etc| Exposure type enumerator| Command Identity| Main engine cut-off time before camera trigger in seconds/10 (0 means no cut-off)| */ + public static final int MAV_CMD_DO_DIGICAM_CONTROL = 203; /* Mission command to control an on-board camera controller system. |Session control e.g. show/hide lens| Zoom's absolute position| Zooming step value to offset zoom from the current position| Focus Locking, Unlocking or Re-locking| Shooting Command| Command Identity| Test shot identifier. If set to 1, image will only be captured, but not counted towards internal frame count.| */ + public static final int MAV_CMD_DO_MOUNT_CONFIGURE = 204; /* Mission command to configure a camera or antenna mount |Mount operation mode (see MAV_MOUNT_MODE enum)| stabilize roll? (1 = yes, 0 = no)| stabilize pitch? (1 = yes, 0 = no)| stabilize yaw? (1 = yes, 0 = no)| roll input (0 = angle, 1 = angular rate)| pitch input (0 = angle, 1 = angular rate)| yaw input (0 = angle, 1 = angular rate)| */ + public static final int MAV_CMD_DO_MOUNT_CONTROL = 205; /* Mission command to control a camera or antenna mount |pitch depending on mount mode (degrees or degrees/second depending on pitch input).| roll depending on mount mode (degrees or degrees/second depending on roll input).| yaw depending on mount mode (degrees or degrees/second depending on yaw input).| alt in meters depending on mount mode.| latitude in degrees * 1E7, set if appropriate mount mode.| longitude in degrees * 1E7, set if appropriate mount mode.| MAV_MOUNT_MODE enum value| */ + public static final int MAV_CMD_DO_SET_CAM_TRIGG_DIST = 206; /* Mission command to set camera trigger distance for this flight. The camera is trigerred each time this distance is exceeded. This command can also be used to set the shutter integration time for the camera. |Camera trigger distance (meters). 0 to stop triggering.| Camera shutter integration time (milliseconds). -1 or 0 to ignore| Trigger camera once immediately. (0 = no trigger, 1 = trigger)| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_FENCE_ENABLE = 207; /* Mission command to enable the geofence |enable? (0=disable, 1=enable, 2=disable_floor_only)| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_PARACHUTE = 208; /* Mission command to trigger a parachute |action (0=disable, 1=enable, 2=release, for some systems see PARACHUTE_ACTION enum, not in general message set.)| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_MOTOR_TEST = 209; /* Mission command to perform motor test |motor sequence number (a number from 1 to max number of motors on the vehicle)| throttle type (0=throttle percentage, 1=PWM, 2=pilot throttle channel pass-through. See MOTOR_TEST_THROTTLE_TYPE enum)| throttle| timeout (in seconds)| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_INVERTED_FLIGHT = 210; /* Change to/from inverted flight |inverted (0=normal, 1=inverted)| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_GRIPPER = 211; /* Mission command to operate EPM gripper |gripper number (a number from 1 to max number of grippers on the vehicle)| gripper action (0=release, 1=grab. See GRIPPER_ACTIONS enum)| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_AUTOTUNE_ENABLE = 212; /* Enable/disable autotune |enable (1: enable, 0:disable)| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_NAV_SET_YAW_SPEED = 213; /* Sets a desired vehicle turn angle and speed change |yaw angle to adjust steering by in centidegress| speed - normalized to 0 .. 1| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_SET_CAM_TRIGG_INTERVAL = 214; /* Mission command to set camera trigger interval for this flight. If triggering is enabled, the camera is triggered each time this interval expires. This command can also be used to set the shutter integration time for the camera. |Camera trigger cycle time (milliseconds). -1 or 0 to ignore.| Camera shutter integration time (milliseconds). Should be less than trigger cycle time. -1 or 0 to ignore.| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_MOUNT_CONTROL_QUAT = 220; /* Mission command to control a camera or antenna mount, using a quaternion as reference. |q1 - quaternion param #1, w (1 in null-rotation)| q2 - quaternion param #2, x (0 in null-rotation)| q3 - quaternion param #3, y (0 in null-rotation)| q4 - quaternion param #4, z (0 in null-rotation)| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_GUIDED_MASTER = 221; /* set id of master controller |System ID| Component ID| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_GUIDED_LIMITS = 222; /* set limits for external control |timeout - maximum time (in seconds) that external controller will be allowed to control vehicle. 0 means no timeout| absolute altitude min (in meters, AMSL) - if vehicle moves below this alt, the command will be aborted and the mission will continue. 0 means no lower altitude limit| absolute altitude max (in meters)- if vehicle moves above this alt, the command will be aborted and the mission will continue. 0 means no upper altitude limit| horizontal move limit (in meters, AMSL) - if vehicle moves more than this distance from it's location at the moment the command was executed, the command will be aborted and the mission will continue. 0 means no horizontal altitude limit| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_ENGINE_CONTROL = 223; /* Control vehicle engine. This is interpreted by the vehicles engine controller to change the target engine state. It is intended for vehicles with internal combustion engines |0: Stop engine, 1:Start Engine| 0: Warm start, 1:Cold start. Controls use of choke where applicable| Height delay (meters). This is for commanding engine start only after the vehicle has gained the specified height. Used in VTOL vehicles during takeoff to start engine after the aircraft is off the ground. Zero for no delay.| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_LAST = 240; /* NOP - This command is only used to mark the upper limit of the DO commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_PREFLIGHT_CALIBRATION = 241; /* Trigger calibration. This command will be only accepted if in pre-flight mode. Except for Temperature Calibration, only one sensor should be set in a single message and all others should be zero. |1: gyro calibration, 3: gyro temperature calibration| 1: magnetometer calibration| 1: ground pressure calibration| 1: radio RC calibration, 2: RC trim calibration| 1: accelerometer calibration, 2: board level calibration, 3: accelerometer temperature calibration| 1: APM: compass/motor interference calibration (PX4: airspeed calibration, deprecated), 2: airspeed calibration| 1: ESC calibration, 3: barometer temperature calibration| */ + public static final int MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS = 242; /* Set sensor offsets. This command will be only accepted if in pre-flight mode. |Sensor to adjust the offsets for: 0: gyros, 1: accelerometer, 2: magnetometer, 3: barometer, 4: optical flow, 5: second magnetometer, 6: third magnetometer| X axis offset (or generic dimension 1), in the sensor's raw units| Y axis offset (or generic dimension 2), in the sensor's raw units| Z axis offset (or generic dimension 3), in the sensor's raw units| Generic dimension 4, in the sensor's raw units| Generic dimension 5, in the sensor's raw units| Generic dimension 6, in the sensor's raw units| */ + public static final int MAV_CMD_PREFLIGHT_UAVCAN = 243; /* Trigger UAVCAN config. This command will be only accepted if in pre-flight mode. |1: Trigger actuator ID assignment and direction mapping.| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ + public static final int MAV_CMD_PREFLIGHT_STORAGE = 245; /* Request storage of different parameter values and logs. This command will be only accepted if in pre-flight mode. |Parameter storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM, 2: Reset to defaults| Mission storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM, 2: Reset to defaults| Onboard logging: 0: Ignore, 1: Start default rate logging, -1: Stop logging, > 1: start logging with rate of param 3 in Hz (e.g. set to 1000 for 1000 Hz logging)| Reserved| Empty| Empty| Empty| */ + public static final int MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN = 246; /* Request the reboot or shutdown of system components. |0: Do nothing for autopilot, 1: Reboot autopilot, 2: Shutdown autopilot, 3: Reboot autopilot and keep it in the bootloader until upgraded.| 0: Do nothing for onboard computer, 1: Reboot onboard computer, 2: Shutdown onboard computer, 3: Reboot onboard computer and keep it in the bootloader until upgraded.| WIP: 0: Do nothing for camera, 1: Reboot onboard camera, 2: Shutdown onboard camera, 3: Reboot onboard camera and keep it in the bootloader until upgraded| WIP: 0: Do nothing for mount (e.g. gimbal), 1: Reboot mount, 2: Shutdown mount, 3: Reboot mount and keep it in the bootloader until upgraded| Reserved, send 0| Reserved, send 0| WIP: ID (e.g. camera ID -1 for all IDs)| */ + public static final int MAV_CMD_OVERRIDE_GOTO = 252; /* Hold / continue the current action |MAV_GOTO_DO_HOLD: hold MAV_GOTO_DO_CONTINUE: continue with next item in mission plan| MAV_GOTO_HOLD_AT_CURRENT_POSITION: Hold at current position MAV_GOTO_HOLD_AT_SPECIFIED_POSITION: hold at specified position| MAV_FRAME coordinate frame of hold point| Desired yaw angle in degrees| Latitude / X position| Longitude / Y position| Altitude / Z position| */ + public static final int MAV_CMD_MISSION_START = 300; /* start running a mission |first_item: the first mission item to run| last_item: the last mission item to run (after this item is run, the mission ends)| */ + public static final int MAV_CMD_COMPONENT_ARM_DISARM = 400; /* Arms / Disarms a component |1 to arm, 0 to disarm| */ + public static final int MAV_CMD_GET_HOME_POSITION = 410; /* Request the home position from the vehicle. |Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ + public static final int MAV_CMD_START_RX_PAIR = 500; /* Starts receiver pairing |0:Spektrum| 0:Spektrum DSM2, 1:Spektrum DSMX| */ + public static final int MAV_CMD_GET_MESSAGE_INTERVAL = 510; /* Request the interval between messages for a particular MAVLink message ID |The MAVLink message ID| */ + public static final int MAV_CMD_SET_MESSAGE_INTERVAL = 511; /* Request the interval between messages for a particular MAVLink message ID. This interface replaces REQUEST_DATA_STREAM |The MAVLink message ID| The interval between two messages, in microseconds. Set to -1 to disable and 0 to request default rate.| */ + public static final int MAV_CMD_REQUEST_PROTOCOL_VERSION = 519; /* Request MAVLink protocol version compatibility |1: Request supported protocol versions by all nodes on the network| Reserved (all remaining params)| */ + public static final int MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES = 520; /* Request autopilot capabilities |1: Request autopilot version| Reserved (all remaining params)| */ + public static final int MAV_CMD_REQUEST_CAMERA_INFORMATION = 521; /* WIP: Request camera information (CAMERA_INFORMATION). |0: No action 1: Request camera capabilities| Reserved (all remaining params)| */ + public static final int MAV_CMD_REQUEST_CAMERA_SETTINGS = 522; /* WIP: Request camera settings (CAMERA_SETTINGS). |0: No Action 1: Request camera settings| Reserved (all remaining params)| */ + public static final int MAV_CMD_REQUEST_STORAGE_INFORMATION = 525; /* WIP: Request storage information (STORAGE_INFORMATION). Use the command's target_component to target a specific component's storage. |Storage ID (0 for all, 1 for first, 2 for second, etc.)| 0: No Action 1: Request storage information| Reserved (all remaining params)| */ + public static final int MAV_CMD_STORAGE_FORMAT = 526; /* WIP: Format a storage medium. Once format is complete, a STORAGE_INFORMATION message is sent. Use the command's target_component to target a specific component's storage. |Storage ID (1 for first, 2 for second, etc.)| 0: No action 1: Format storage| Reserved (all remaining params)| */ + public static final int MAV_CMD_REQUEST_CAMERA_CAPTURE_STATUS = 527; /* WIP: Request camera capture status (CAMERA_CAPTURE_STATUS) |0: No Action 1: Request camera capture status| Reserved (all remaining params)| */ + public static final int MAV_CMD_REQUEST_FLIGHT_INFORMATION = 528; /* WIP: Request flight information (FLIGHT_INFORMATION) |1: Request flight information| Reserved (all remaining params)| */ + public static final int MAV_CMD_RESET_CAMERA_SETTINGS = 529; /* WIP: Reset all camera settings to Factory Default |0: No Action 1: Reset all settings| Reserved (all remaining params)| */ + public static final int MAV_CMD_SET_CAMERA_MODE = 530; /* Set camera running mode. Use NAN for reserved values. |Reserved (Set to 0)| Camera mode (see CAMERA_MODE enum)| Reserved (all remaining params)| */ + public static final int MAV_CMD_IMAGE_START_CAPTURE = 2000; /* Start image capture sequence. Sends CAMERA_IMAGE_CAPTURED after each capture. Use NAN for reserved values. |Reserved (Set to 0)| Duration between two consecutive pictures (in seconds)| Number of images to capture total - 0 for unlimited capture| Reserved (all remaining params)| */ + public static final int MAV_CMD_IMAGE_STOP_CAPTURE = 2001; /* Stop image capture sequence Use NAN for reserved values. |Reserved (Set to 0)| Reserved (all remaining params)| */ + public static final int MAV_CMD_REQUEST_CAMERA_IMAGE_CAPTURE = 2002; /* WIP: Re-request a CAMERA_IMAGE_CAPTURE packet. Use NAN for reserved values. |Sequence number for missing CAMERA_IMAGE_CAPTURE packet| Reserved (all remaining params)| */ + public static final int MAV_CMD_DO_TRIGGER_CONTROL = 2003; /* Enable or disable on-board camera triggering system. |Trigger enable/disable (0 for disable, 1 for start), -1 to ignore| 1 to reset the trigger sequence, -1 or 0 to ignore| 1 to pause triggering, but without switching the camera off or retracting it. -1 to ignore| */ + public static final int MAV_CMD_VIDEO_START_CAPTURE = 2500; /* Starts video capture (recording). Use NAN for reserved values. |Reserved (Set to 0)| Frequency CAMERA_CAPTURE_STATUS messages should be sent while recording (0 for no messages, otherwise frequency in Hz)| Reserved (all remaining params)| */ + public static final int MAV_CMD_VIDEO_STOP_CAPTURE = 2501; /* Stop the current video capture (recording). Use NAN for reserved values. |Reserved (Set to 0)| Reserved (all remaining params)| */ + public static final int MAV_CMD_VIDEO_START_STREAMING = 2502; /* WIP: Start video streaming |Camera ID (0 for all cameras, 1 for first, 2 for second, etc.)| Reserved| */ + public static final int MAV_CMD_VIDEO_STOP_STREAMING = 2503; /* WIP: Stop the current video streaming |Camera ID (0 for all cameras, 1 for first, 2 for second, etc.)| Reserved| */ + public static final int MAV_CMD_REQUEST_VIDEO_STREAM_INFORMATION = 2504; /* WIP: Request video stream information (VIDEO_STREAM_INFORMATION) |Camera ID (0 for all cameras, 1 for first, 2 for second, etc.)| 0: No Action 1: Request video stream information| Reserved (all remaining params)| */ + public static final int MAV_CMD_LOGGING_START = 2510; /* Request to start streaming logging data over MAVLink (see also LOGGING_DATA message) |Format: 0: ULog| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ + public static final int MAV_CMD_LOGGING_STOP = 2511; /* Request to stop streaming log data over MAVLink |Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ + public static final int MAV_CMD_AIRFRAME_CONFIGURATION = 2520; /* |Landing gear ID (default: 0, -1 for all)| Landing gear position (Down: 0, Up: 1, NAN for no change)| Reserved, set to NAN| Reserved, set to NAN| Reserved, set to NAN| Reserved, set to NAN| Reserved, set to NAN| */ + public static final int MAV_CMD_PANORAMA_CREATE = 2800; /* Create a panorama at the current position |Viewing angle horizontal of the panorama (in degrees, +- 0.5 the total angle)| Viewing angle vertical of panorama (in degrees)| Speed of the horizontal rotation (in degrees per second)| Speed of the vertical rotation (in degrees per second)| */ + public static final int MAV_CMD_DO_VTOL_TRANSITION = 3000; /* Request VTOL transition |The target VTOL state, as defined by ENUM MAV_VTOL_STATE. Only MAV_VTOL_STATE_MC and MAV_VTOL_STATE_FW can be used.| */ + public static final int MAV_CMD_ARM_AUTHORIZATION_REQUEST = 3001; /* Request authorization to arm the vehicle to a external entity, the arm authorizer is resposible to request all data that is needs from the vehicle before authorize or deny the request. If approved the progress of command_ack message should be set with period of time that this authorization is valid in seconds or in case it was denied it should be set with one of the reasons in ARM_AUTH_DENIED_REASON. + |Vehicle system id, this way ground station can request arm authorization on behalf of any vehicle| */ + public static final int MAV_CMD_SET_GUIDED_SUBMODE_STANDARD = 4000; /* This command sets the submode to standard guided when vehicle is in guided mode. The vehicle holds position and altitude and the user can input the desired velocites along all three axes. + | */ + public static final int MAV_CMD_SET_GUIDED_SUBMODE_CIRCLE = 4001; /* This command sets submode circle when vehicle is in guided mode. Vehicle flies along a circle facing the center of the circle. The user can input the velocity along the circle and change the radius. If no input is given the vehicle will hold position. + |Radius of desired circle in CIRCLE_MODE| User defined| User defined| User defined| Unscaled target latitude of center of circle in CIRCLE_MODE| Unscaled target longitude of center of circle in CIRCLE_MODE| */ + public static final int MAV_CMD_CONDITION_GATE = 4501; /* WIP: Delay mission state machine until gate has been reached. |Geometry: 0: orthogonal to path between previous and next waypoint.| Altitude: 0: ignore altitude| Empty| Empty| Latitude| Longitude| Altitude| */ + public static final int MAV_CMD_NAV_FENCE_RETURN_POINT = 5000; /* Fence return point. There can only be one fence return point. + |Reserved| Reserved| Reserved| Reserved| Latitude| Longitude| Altitude| */ + public static final int MAV_CMD_NAV_FENCE_POLYGON_VERTEX_INCLUSION = 5001; /* Fence vertex for an inclusion polygon (the polygon must not be self-intersecting). The vehicle must stay within this area. Minimum of 3 vertices required. + |Polygon vertex count| Reserved| Reserved| Reserved| Latitude| Longitude| Reserved| */ + public static final int MAV_CMD_NAV_FENCE_POLYGON_VERTEX_EXCLUSION = 5002; /* Fence vertex for an exclusion polygon (the polygon must not be self-intersecting). The vehicle must stay outside this area. Minimum of 3 vertices required. + |Polygon vertex count| Reserved| Reserved| Reserved| Latitude| Longitude| Reserved| */ + public static final int MAV_CMD_NAV_FENCE_CIRCLE_INCLUSION = 5003; /* Circular fence area. The vehicle must stay inside this area. + |radius in meters| Reserved| Reserved| Reserved| Latitude| Longitude| Reserved| */ + public static final int MAV_CMD_NAV_FENCE_CIRCLE_EXCLUSION = 5004; /* Circular fence area. The vehicle must stay outside this area. + |radius in meters| Reserved| Reserved| Reserved| Latitude| Longitude| Reserved| */ + public static final int MAV_CMD_NAV_RALLY_POINT = 5100; /* Rally point. You can have multiple rally points defined. + |Reserved| Reserved| Reserved| Reserved| Latitude| Longitude| Altitude| */ + public static final int MAV_CMD_UAVCAN_GET_NODE_INFO = 5200; /* Commands the vehicle to respond with a sequence of messages UAVCAN_NODE_INFO, one message per every UAVCAN node that is online. Note that some of the response messages can be lost, which the receiver can detect easily by checking whether every received UAVCAN_NODE_STATUS has a matching message UAVCAN_NODE_INFO received earlier; if not, this command should be sent again in order to request re-transmission of the node information messages. |Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| Reserved (set to 0)| */ + public static final int MAV_CMD_PAYLOAD_PREPARE_DEPLOY = 30001; /* Deploy payload on a Lat / Lon / Alt position. This includes the navigation to reach the required release position and velocity. |Operation mode. 0: prepare single payload deploy (overwriting previous requests), but do not execute it. 1: execute payload deploy immediately (rejecting further deploy commands during execution, but allowing abort). 2: add payload deploy to existing deployment list.| Desired approach vector in degrees compass heading (0..360). A negative value indicates the system can define the approach vector at will.| Desired ground speed at release time. This can be overriden by the airframe in case it needs to meet minimum airspeed. A negative value indicates the system can define the ground speed at will.| Minimum altitude clearance to the release position in meters. A negative value indicates the system can define the clearance at will.| Latitude unscaled for MISSION_ITEM or in 1e7 degrees for MISSION_ITEM_INT| Longitude unscaled for MISSION_ITEM or in 1e7 degrees for MISSION_ITEM_INT| Altitude, in meters AMSL| */ + public static final int MAV_CMD_PAYLOAD_CONTROL_DEPLOY = 30002; /* Control the payload deployment. |Operation mode. 0: Abort deployment, continue normal mission. 1: switch to payload deploment mode. 100: delete first payload deployment request. 101: delete all payload deployment requests.| Reserved| Reserved| Reserved| Reserved| Reserved| Reserved| */ + public static final int MAV_CMD_WAYPOINT_USER_1 = 31000; /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude, in meters AMSL| */ + public static final int MAV_CMD_WAYPOINT_USER_2 = 31001; /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude, in meters AMSL| */ + public static final int MAV_CMD_WAYPOINT_USER_3 = 31002; /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude, in meters AMSL| */ + public static final int MAV_CMD_WAYPOINT_USER_4 = 31003; /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude, in meters AMSL| */ + public static final int MAV_CMD_WAYPOINT_USER_5 = 31004; /* User defined waypoint item. Ground Station will show the Vehicle as flying through this item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude, in meters AMSL| */ + public static final int MAV_CMD_SPATIAL_USER_1 = 31005; /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude, in meters AMSL| */ + public static final int MAV_CMD_SPATIAL_USER_2 = 31006; /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude, in meters AMSL| */ + public static final int MAV_CMD_SPATIAL_USER_3 = 31007; /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude, in meters AMSL| */ + public static final int MAV_CMD_SPATIAL_USER_4 = 31008; /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude, in meters AMSL| */ + public static final int MAV_CMD_SPATIAL_USER_5 = 31009; /* User defined spatial item. Ground Station will not show the Vehicle as flying through this item. Example: ROI item. |User defined| User defined| User defined| User defined| Latitude unscaled| Longitude unscaled| Altitude, in meters AMSL| */ + public static final int MAV_CMD_USER_1 = 31010; /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ + public static final int MAV_CMD_USER_2 = 31011; /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ + public static final int MAV_CMD_USER_3 = 31012; /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ + public static final int MAV_CMD_USER_4 = 31013; /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ + public static final int MAV_CMD_USER_5 = 31014; /* User defined command. Ground Station will not show the Vehicle as flying through this item. Example: MAV_CMD_DO_SET_PARAMETER item. |User defined| User defined| User defined| User defined| User defined| User defined| User defined| */ + public static final int MAV_CMD_POWER_OFF_INITIATED = 42000; /* A system wide power-off event has been initiated. |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_SOLO_BTN_FLY_CLICK = 42001; /* FLY button has been clicked. |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_SOLO_BTN_FLY_HOLD = 42002; /* FLY button has been held for 1.5 seconds. |Takeoff altitude| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_SOLO_BTN_PAUSE_CLICK = 42003; /* PAUSE button has been clicked. |1 if Solo is in a shot mode, 0 otherwise| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_START_MAG_CAL = 42424; /* Initiate a magnetometer calibration |uint8_t bitmask of magnetometers (0 means all)| Automatically retry on failure (0=no retry, 1=retry).| Save without user input (0=require input, 1=autosave).| Delay (seconds)| Autoreboot (0=user reboot, 1=autoreboot)| Empty| Empty| */ + public static final int MAV_CMD_DO_ACCEPT_MAG_CAL = 42425; /* Initiate a magnetometer calibration |uint8_t bitmask of magnetometers (0 means all)| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_CANCEL_MAG_CAL = 42426; /* Cancel a running magnetometer calibration |uint8_t bitmask of magnetometers (0 means all)| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_SET_FACTORY_TEST_MODE = 42427; /* Command autopilot to get into factory test/diagnostic mode |0 means get out of test mode, 1 means get into test mode| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_DO_SEND_BANNER = 42428; /* Reply with the version banner |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_ACCELCAL_VEHICLE_POS = 42429; /* Used when doing accelerometer calibration. When sent to the GCS tells it what position to put the vehicle in. When sent to the vehicle says what position the vehicle is in. |Position, one of the ACCELCAL_VEHICLE_POS enum values| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_GIMBAL_RESET = 42501; /* Causes the gimbal to reset and boot as if it was just powered on |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_GIMBAL_AXIS_CALIBRATION_STATUS = 42502; /* Reports progress and success or failure of gimbal axis calibration procedure |Gimbal axis we're reporting calibration progress for| Current calibration progress for this axis, 0x64=100%| Status of the calibration| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_GIMBAL_REQUEST_AXIS_CALIBRATION = 42503; /* Starts commutation calibration on the gimbal |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + public static final int MAV_CMD_GIMBAL_FULL_RESET = 42505; /* Erases gimbal application and parameters |Magic number| Magic number| Magic number| Magic number| Magic number| Magic number| Magic number| */ + public static final int MAV_CMD_ENUM_END = 42506; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_CMD_ACK.java b/app/src/main/java/com/MAVLink/enums/MAV_CMD_ACK.java new file mode 100644 index 0000000..e0304e8 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_CMD_ACK.java @@ -0,0 +1,24 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * ACK / NACK / ERROR values as a result of MAV_CMDs and for mission item transmission. + */ +public class MAV_CMD_ACK { + public static final int MAV_CMD_ACK_OK = 1; /* Command / mission item is ok. | */ + public static final int MAV_CMD_ACK_ERR_FAIL = 2; /* Generic error message if none of the other reasons fails or if no detailed error reporting is implemented. | */ + public static final int MAV_CMD_ACK_ERR_ACCESS_DENIED = 3; /* The system is refusing to accept this command from this source / communication partner. | */ + public static final int MAV_CMD_ACK_ERR_NOT_SUPPORTED = 4; /* Command or mission item is not supported, other commands would be accepted. | */ + public static final int MAV_CMD_ACK_ERR_COORDINATE_FRAME_NOT_SUPPORTED = 5; /* The coordinate frame of this command / mission item is not supported. | */ + public static final int MAV_CMD_ACK_ERR_COORDINATES_OUT_OF_RANGE = 6; /* The coordinate frame of this command is ok, but he coordinate values exceed the safety limits of this system. This is a generic error, please use the more specific error messages below if possible. | */ + public static final int MAV_CMD_ACK_ERR_X_LAT_OUT_OF_RANGE = 7; /* The X or latitude value is out of range. | */ + public static final int MAV_CMD_ACK_ERR_Y_LON_OUT_OF_RANGE = 8; /* The Y or longitude value is out of range. | */ + public static final int MAV_CMD_ACK_ERR_Z_ALT_OUT_OF_RANGE = 9; /* The Z or altitude value is out of range. | */ + public static final int MAV_CMD_ACK_ENUM_END = 10; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_COLLISION_ACTION.java b/app/src/main/java/com/MAVLink/enums/MAV_COLLISION_ACTION.java new file mode 100644 index 0000000..3bbfcbe --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_COLLISION_ACTION.java @@ -0,0 +1,22 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Possible actions an aircraft can take to avoid a collision. + */ +public class MAV_COLLISION_ACTION { + public static final int MAV_COLLISION_ACTION_NONE = 0; /* Ignore any potential collisions | */ + public static final int MAV_COLLISION_ACTION_REPORT = 1; /* Report potential collision | */ + public static final int MAV_COLLISION_ACTION_ASCEND_OR_DESCEND = 2; /* Ascend or Descend to avoid threat | */ + public static final int MAV_COLLISION_ACTION_MOVE_HORIZONTALLY = 3; /* Move horizontally to avoid threat | */ + public static final int MAV_COLLISION_ACTION_MOVE_PERPENDICULAR = 4; /* Aircraft to move perpendicular to the collision's velocity vector | */ + public static final int MAV_COLLISION_ACTION_RTL = 5; /* Aircraft to fly directly back to its launch point | */ + public static final int MAV_COLLISION_ACTION_HOVER = 6; /* Aircraft to stop in place | */ + public static final int MAV_COLLISION_ACTION_ENUM_END = 7; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_COLLISION_SRC.java b/app/src/main/java/com/MAVLink/enums/MAV_COLLISION_SRC.java new file mode 100644 index 0000000..16fb78c --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_COLLISION_SRC.java @@ -0,0 +1,17 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Source of information about this collision. + */ +public class MAV_COLLISION_SRC { + public static final int MAV_COLLISION_SRC_ADSB = 0; /* ID field references ADSB_VEHICLE packets | */ + public static final int MAV_COLLISION_SRC_MAVLINK_GPS_GLOBAL_INT = 1; /* ID field references MAVLink SRC ID | */ + public static final int MAV_COLLISION_SRC_ENUM_END = 2; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_COLLISION_THREAT_LEVEL.java b/app/src/main/java/com/MAVLink/enums/MAV_COLLISION_THREAT_LEVEL.java new file mode 100644 index 0000000..1ea6428 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_COLLISION_THREAT_LEVEL.java @@ -0,0 +1,18 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Aircraft-rated danger from this threat. + */ +public class MAV_COLLISION_THREAT_LEVEL { + public static final int MAV_COLLISION_THREAT_LEVEL_NONE = 0; /* Not a threat | */ + public static final int MAV_COLLISION_THREAT_LEVEL_LOW = 1; /* Craft is mildly concerned about this threat | */ + public static final int MAV_COLLISION_THREAT_LEVEL_HIGH = 2; /* Craft is panicing, and may take actions to avoid threat | */ + public static final int MAV_COLLISION_THREAT_LEVEL_ENUM_END = 3; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_COMPONENT.java b/app/src/main/java/com/MAVLink/enums/MAV_COMPONENT.java new file mode 100644 index 0000000..776c113 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_COMPONENT.java @@ -0,0 +1,54 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class MAV_COMPONENT { + public static final int MAV_COMP_ID_ALL = 0; /* | */ + public static final int MAV_COMP_ID_AUTOPILOT1 = 1; /* | */ + public static final int MAV_COMP_ID_CAMERA = 100; /* | */ + public static final int MAV_COMP_ID_CAMERA2 = 101; /* | */ + public static final int MAV_COMP_ID_CAMERA3 = 102; /* | */ + public static final int MAV_COMP_ID_CAMERA4 = 103; /* | */ + public static final int MAV_COMP_ID_CAMERA5 = 104; /* | */ + public static final int MAV_COMP_ID_CAMERA6 = 105; /* | */ + public static final int MAV_COMP_ID_SERVO1 = 140; /* | */ + public static final int MAV_COMP_ID_SERVO2 = 141; /* | */ + public static final int MAV_COMP_ID_SERVO3 = 142; /* | */ + public static final int MAV_COMP_ID_SERVO4 = 143; /* | */ + public static final int MAV_COMP_ID_SERVO5 = 144; /* | */ + public static final int MAV_COMP_ID_SERVO6 = 145; /* | */ + public static final int MAV_COMP_ID_SERVO7 = 146; /* | */ + public static final int MAV_COMP_ID_SERVO8 = 147; /* | */ + public static final int MAV_COMP_ID_SERVO9 = 148; /* | */ + public static final int MAV_COMP_ID_SERVO10 = 149; /* | */ + public static final int MAV_COMP_ID_SERVO11 = 150; /* | */ + public static final int MAV_COMP_ID_SERVO12 = 151; /* | */ + public static final int MAV_COMP_ID_SERVO13 = 152; /* | */ + public static final int MAV_COMP_ID_SERVO14 = 153; /* | */ + public static final int MAV_COMP_ID_GIMBAL = 154; /* | */ + public static final int MAV_COMP_ID_LOG = 155; /* | */ + public static final int MAV_COMP_ID_ADSB = 156; /* | */ + public static final int MAV_COMP_ID_OSD = 157; /* On Screen Display (OSD) devices for video links | */ + public static final int MAV_COMP_ID_PERIPHERAL = 158; /* Generic autopilot peripheral component ID. Meant for devices that do not implement the parameter sub-protocol | */ + public static final int MAV_COMP_ID_QX1_GIMBAL = 159; /* | */ + public static final int MAV_COMP_ID_MAPPER = 180; /* | */ + public static final int MAV_COMP_ID_MISSIONPLANNER = 190; /* | */ + public static final int MAV_COMP_ID_PATHPLANNER = 195; /* | */ + public static final int MAV_COMP_ID_IMU = 200; /* | */ + public static final int MAV_COMP_ID_IMU_2 = 201; /* | */ + public static final int MAV_COMP_ID_IMU_3 = 202; /* | */ + public static final int MAV_COMP_ID_GPS = 220; /* | */ + public static final int MAV_COMP_ID_GPS2 = 221; /* | */ + public static final int MAV_COMP_ID_UDP_BRIDGE = 240; /* | */ + public static final int MAV_COMP_ID_UART_BRIDGE = 241; /* | */ + public static final int MAV_COMP_ID_SYSTEM_CONTROL = 250; /* | */ + public static final int MAV_COMPONENT_ENUM_END = 251; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_DATA_STREAM.java b/app/src/main/java/com/MAVLink/enums/MAV_DATA_STREAM.java new file mode 100644 index 0000000..8a8ad65 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_DATA_STREAM.java @@ -0,0 +1,26 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * THIS INTERFACE IS DEPRECATED AS OF JULY 2015. Please use MESSAGE_INTERVAL instead. A data stream is not a fixed set of messages, but rather a + * recommendation to the autopilot software. Individual autopilots may or may not obey + * the recommended messages. + */ +public class MAV_DATA_STREAM { + public static final int MAV_DATA_STREAM_ALL = 0; /* Enable all data streams | */ + public static final int MAV_DATA_STREAM_RAW_SENSORS = 1; /* Enable IMU_RAW, GPS_RAW, GPS_STATUS packets. | */ + public static final int MAV_DATA_STREAM_EXTENDED_STATUS = 2; /* Enable GPS_STATUS, CONTROL_STATUS, AUX_STATUS | */ + public static final int MAV_DATA_STREAM_RC_CHANNELS = 3; /* Enable RC_CHANNELS_SCALED, RC_CHANNELS_RAW, SERVO_OUTPUT_RAW | */ + public static final int MAV_DATA_STREAM_RAW_CONTROLLER = 4; /* Enable ATTITUDE_CONTROLLER_OUTPUT, POSITION_CONTROLLER_OUTPUT, NAV_CONTROLLER_OUTPUT. | */ + public static final int MAV_DATA_STREAM_POSITION = 6; /* Enable LOCAL_POSITION, GLOBAL_POSITION/GLOBAL_POSITION_INT messages. | */ + public static final int MAV_DATA_STREAM_EXTRA1 = 10; /* Dependent on the autopilot | */ + public static final int MAV_DATA_STREAM_EXTRA2 = 11; /* Dependent on the autopilot | */ + public static final int MAV_DATA_STREAM_EXTRA3 = 12; /* Dependent on the autopilot | */ + public static final int MAV_DATA_STREAM_ENUM_END = 13; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_DISTANCE_SENSOR.java b/app/src/main/java/com/MAVLink/enums/MAV_DISTANCE_SENSOR.java new file mode 100644 index 0000000..65d4fad --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_DISTANCE_SENSOR.java @@ -0,0 +1,20 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Enumeration of distance sensor types + */ +public class MAV_DISTANCE_SENSOR { + public static final int MAV_DISTANCE_SENSOR_LASER = 0; /* Laser rangefinder, e.g. LightWare SF02/F or PulsedLight units | */ + public static final int MAV_DISTANCE_SENSOR_ULTRASOUND = 1; /* Ultrasound rangefinder, e.g. MaxBotix units | */ + public static final int MAV_DISTANCE_SENSOR_INFRARED = 2; /* Infrared rangefinder, e.g. Sharp units | */ + public static final int MAV_DISTANCE_SENSOR_RADAR = 3; /* Radar type, e.g. uLanding units | */ + public static final int MAV_DISTANCE_SENSOR_UNKNOWN = 4; /* Broken or unknown type, e.g. analog units | */ + public static final int MAV_DISTANCE_SENSOR_ENUM_END = 5; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_DO_REPOSITION_FLAGS.java b/app/src/main/java/com/MAVLink/enums/MAV_DO_REPOSITION_FLAGS.java new file mode 100644 index 0000000..6225a6d --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_DO_REPOSITION_FLAGS.java @@ -0,0 +1,16 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Bitmask of options for the MAV_CMD_DO_REPOSITION + */ +public class MAV_DO_REPOSITION_FLAGS { + public static final int MAV_DO_REPOSITION_FLAGS_CHANGE_MODE = 1; /* The aircraft should immediately transition into guided. This should not be set for follow me applications | */ + public static final int MAV_DO_REPOSITION_FLAGS_ENUM_END = 2; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_ESTIMATOR_TYPE.java b/app/src/main/java/com/MAVLink/enums/MAV_ESTIMATOR_TYPE.java new file mode 100644 index 0000000..7d33325 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_ESTIMATOR_TYPE.java @@ -0,0 +1,20 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Enumeration of estimator types + */ +public class MAV_ESTIMATOR_TYPE { + public static final int MAV_ESTIMATOR_TYPE_NAIVE = 1; /* This is a naive estimator without any real covariance feedback. | */ + public static final int MAV_ESTIMATOR_TYPE_VISION = 2; /* Computer vision based estimate. Might be up to scale. | */ + public static final int MAV_ESTIMATOR_TYPE_VIO = 3; /* Visual-inertial estimate. | */ + public static final int MAV_ESTIMATOR_TYPE_GPS = 4; /* Plain GPS estimate. | */ + public static final int MAV_ESTIMATOR_TYPE_GPS_INS = 5; /* Estimator integrating GPS and inertial sensing. | */ + public static final int MAV_ESTIMATOR_TYPE_ENUM_END = 6; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_FRAME.java b/app/src/main/java/com/MAVLink/enums/MAV_FRAME.java new file mode 100644 index 0000000..23a4b8a --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_FRAME.java @@ -0,0 +1,27 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class MAV_FRAME { + public static final int MAV_FRAME_GLOBAL = 0; /* Global coordinate frame, WGS84 coordinate system. First value / x: latitude, second value / y: longitude, third value / z: positive altitude over mean sea level (MSL) | */ + public static final int MAV_FRAME_LOCAL_NED = 1; /* Local coordinate frame, Z-up (x: north, y: east, z: down). | */ + public static final int MAV_FRAME_MISSION = 2; /* NOT a coordinate frame, indicates a mission command. | */ + public static final int MAV_FRAME_GLOBAL_RELATIVE_ALT = 3; /* Global coordinate frame, WGS84 coordinate system, relative altitude over ground with respect to the home position. First value / x: latitude, second value / y: longitude, third value / z: positive altitude with 0 being at the altitude of the home location. | */ + public static final int MAV_FRAME_LOCAL_ENU = 4; /* Local coordinate frame, Z-down (x: east, y: north, z: up) | */ + public static final int MAV_FRAME_GLOBAL_INT = 5; /* Global coordinate frame, WGS84 coordinate system. First value / x: latitude in degrees*1.0e-7, second value / y: longitude in degrees*1.0e-7, third value / z: positive altitude over mean sea level (MSL) | */ + public static final int MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6; /* Global coordinate frame, WGS84 coordinate system, relative altitude over ground with respect to the home position. First value / x: latitude in degrees*10e-7, second value / y: longitude in degrees*10e-7, third value / z: positive altitude with 0 being at the altitude of the home location. | */ + public static final int MAV_FRAME_LOCAL_OFFSET_NED = 7; /* Offset to the current local frame. Anything expressed in this frame should be added to the current local frame position. | */ + public static final int MAV_FRAME_BODY_NED = 8; /* Setpoint in body NED frame. This makes sense if all position control is externalized - e.g. useful to command 2 m/s^2 acceleration to the right. | */ + public static final int MAV_FRAME_BODY_OFFSET_NED = 9; /* Offset in body NED frame. This makes sense if adding setpoints to the current flight path, to avoid an obstacle - e.g. useful to command 2 m/s^2 acceleration to the east. | */ + public static final int MAV_FRAME_GLOBAL_TERRAIN_ALT = 10; /* Global coordinate frame with above terrain level altitude. WGS84 coordinate system, relative altitude over terrain with respect to the waypoint coordinate. First value / x: latitude in degrees, second value / y: longitude in degrees, third value / z: positive altitude in meters with 0 being at ground level in terrain model. | */ + public static final int MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11; /* Global coordinate frame with above terrain level altitude. WGS84 coordinate system, relative altitude over terrain with respect to the waypoint coordinate. First value / x: latitude in degrees*10e-7, second value / y: longitude in degrees*10e-7, third value / z: positive altitude in meters with 0 being at ground level in terrain model. | */ + public static final int MAV_FRAME_ENUM_END = 12; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_GOTO.java b/app/src/main/java/com/MAVLink/enums/MAV_GOTO.java new file mode 100644 index 0000000..b33a39c --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_GOTO.java @@ -0,0 +1,19 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Override command, pauses current mission execution and moves immediately to a position + */ +public class MAV_GOTO { + public static final int MAV_GOTO_DO_HOLD = 0; /* Hold at the current position. | */ + public static final int MAV_GOTO_DO_CONTINUE = 1; /* Continue with the next item in mission execution. | */ + public static final int MAV_GOTO_HOLD_AT_CURRENT_POSITION = 2; /* Hold at the current position of the system | */ + public static final int MAV_GOTO_HOLD_AT_SPECIFIED_POSITION = 3; /* Hold at the position specified in the parameters of the DO_HOLD action | */ + public static final int MAV_GOTO_ENUM_END = 4; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_LANDED_STATE.java b/app/src/main/java/com/MAVLink/enums/MAV_LANDED_STATE.java new file mode 100644 index 0000000..f6943ab --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_LANDED_STATE.java @@ -0,0 +1,20 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Enumeration of landed detector states + */ +public class MAV_LANDED_STATE { + public static final int MAV_LANDED_STATE_UNDEFINED = 0; /* MAV landed state is unknown | */ + public static final int MAV_LANDED_STATE_ON_GROUND = 1; /* MAV is landed (on ground) | */ + public static final int MAV_LANDED_STATE_IN_AIR = 2; /* MAV is in air | */ + public static final int MAV_LANDED_STATE_TAKEOFF = 3; /* MAV currently taking off | */ + public static final int MAV_LANDED_STATE_LANDING = 4; /* MAV currently landing | */ + public static final int MAV_LANDED_STATE_ENUM_END = 5; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_MISSION_RESULT.java b/app/src/main/java/com/MAVLink/enums/MAV_MISSION_RESULT.java new file mode 100644 index 0000000..8a6fdbb --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_MISSION_RESULT.java @@ -0,0 +1,30 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * result in a mavlink mission ack + */ +public class MAV_MISSION_RESULT { + public static final int MAV_MISSION_ACCEPTED = 0; /* mission accepted OK | */ + public static final int MAV_MISSION_ERROR = 1; /* generic error / not accepting mission commands at all right now | */ + public static final int MAV_MISSION_UNSUPPORTED_FRAME = 2; /* coordinate frame is not supported | */ + public static final int MAV_MISSION_UNSUPPORTED = 3; /* command is not supported | */ + public static final int MAV_MISSION_NO_SPACE = 4; /* mission item exceeds storage space | */ + public static final int MAV_MISSION_INVALID = 5; /* one of the parameters has an invalid value | */ + public static final int MAV_MISSION_INVALID_PARAM1 = 6; /* param1 has an invalid value | */ + public static final int MAV_MISSION_INVALID_PARAM2 = 7; /* param2 has an invalid value | */ + public static final int MAV_MISSION_INVALID_PARAM3 = 8; /* param3 has an invalid value | */ + public static final int MAV_MISSION_INVALID_PARAM4 = 9; /* param4 has an invalid value | */ + public static final int MAV_MISSION_INVALID_PARAM5_X = 10; /* x/param5 has an invalid value | */ + public static final int MAV_MISSION_INVALID_PARAM6_Y = 11; /* y/param6 has an invalid value | */ + public static final int MAV_MISSION_INVALID_PARAM7 = 12; /* param7 has an invalid value | */ + public static final int MAV_MISSION_INVALID_SEQUENCE = 13; /* received waypoint out of sequence | */ + public static final int MAV_MISSION_DENIED = 14; /* not accepting any mission commands from this communication partner | */ + public static final int MAV_MISSION_RESULT_ENUM_END = 15; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_MISSION_TYPE.java b/app/src/main/java/com/MAVLink/enums/MAV_MISSION_TYPE.java new file mode 100644 index 0000000..4f8a24f --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_MISSION_TYPE.java @@ -0,0 +1,19 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Type of mission items being requested/sent in mission protocol. + */ +public class MAV_MISSION_TYPE { + public static final int MAV_MISSION_TYPE_MISSION = 0; /* Items are mission commands for main mission. | */ + public static final int MAV_MISSION_TYPE_FENCE = 1; /* Specifies GeoFence area(s). Items are MAV_CMD_FENCE_ GeoFence items. | */ + public static final int MAV_MISSION_TYPE_RALLY = 2; /* Specifies the rally points for the vehicle. Rally points are alternative RTL points. Items are MAV_CMD_RALLY_POINT rally point items. | */ + public static final int MAV_MISSION_TYPE_ALL = 255; /* Only used in MISSION_CLEAR_ALL to clear all mission types. | */ + public static final int MAV_MISSION_TYPE_ENUM_END = 256; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_MODE.java b/app/src/main/java/com/MAVLink/enums/MAV_MODE.java new file mode 100644 index 0000000..9b74b7d --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_MODE.java @@ -0,0 +1,27 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * These defines are predefined OR-combined mode flags. There is no need to use values from this enum, but it + * simplifies the use of the mode flags. Note that manual input is enabled in all modes as a safety override. + */ +public class MAV_MODE { + public static final int MAV_MODE_PREFLIGHT = 0; /* System is not ready to fly, booting, calibrating, etc. No flag is set. | */ + public static final int MAV_MODE_MANUAL_DISARMED = 64; /* System is allowed to be active, under manual (RC) control, no stabilization | */ + public static final int MAV_MODE_TEST_DISARMED = 66; /* UNDEFINED mode. This solely depends on the autopilot - use with caution, intended for developers only. | */ + public static final int MAV_MODE_STABILIZE_DISARMED = 80; /* System is allowed to be active, under assisted RC control. | */ + public static final int MAV_MODE_GUIDED_DISARMED = 88; /* System is allowed to be active, under autonomous control, manual setpoint | */ + public static final int MAV_MODE_AUTO_DISARMED = 92; /* System is allowed to be active, under autonomous control and navigation (the trajectory is decided onboard and not pre-programmed by MISSIONs) | */ + public static final int MAV_MODE_MANUAL_ARMED = 192; /* System is allowed to be active, under manual (RC) control, no stabilization | */ + public static final int MAV_MODE_TEST_ARMED = 194; /* UNDEFINED mode. This solely depends on the autopilot - use with caution, intended for developers only. | */ + public static final int MAV_MODE_STABILIZE_ARMED = 208; /* System is allowed to be active, under assisted RC control. | */ + public static final int MAV_MODE_GUIDED_ARMED = 216; /* System is allowed to be active, under autonomous control, manual setpoint | */ + public static final int MAV_MODE_AUTO_ARMED = 220; /* System is allowed to be active, under autonomous control and navigation (the trajectory is decided onboard and not pre-programmed by MISSIONs) | */ + public static final int MAV_MODE_ENUM_END = 221; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_MODE_FLAG.java b/app/src/main/java/com/MAVLink/enums/MAV_MODE_FLAG.java new file mode 100644 index 0000000..c5e9f7a --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_MODE_FLAG.java @@ -0,0 +1,23 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * These flags encode the MAV mode. + */ +public class MAV_MODE_FLAG { + public static final int MAV_MODE_FLAG_CUSTOM_MODE_ENABLED = 1; /* 0b00000001 Reserved for future use. | */ + public static final int MAV_MODE_FLAG_TEST_ENABLED = 2; /* 0b00000010 system has a test mode enabled. This flag is intended for temporary system tests and should not be used for stable implementations. | */ + public static final int MAV_MODE_FLAG_AUTO_ENABLED = 4; /* 0b00000100 autonomous mode enabled, system finds its own goal positions. Guided flag can be set or not, depends on the actual implementation. | */ + public static final int MAV_MODE_FLAG_GUIDED_ENABLED = 8; /* 0b00001000 guided mode enabled, system flies MISSIONs / mission items. | */ + public static final int MAV_MODE_FLAG_STABILIZE_ENABLED = 16; /* 0b00010000 system stabilizes electronically its attitude (and optionally position). It needs however further control inputs to move around. | */ + public static final int MAV_MODE_FLAG_HIL_ENABLED = 32; /* 0b00100000 hardware in the loop simulation. All motors / actuators are blocked, but internal software is full operational. | */ + public static final int MAV_MODE_FLAG_MANUAL_INPUT_ENABLED = 64; /* 0b01000000 remote control input is enabled. | */ + public static final int MAV_MODE_FLAG_SAFETY_ARMED = 128; /* 0b10000000 MAV safety set to armed. Motors are enabled / running / can start. Ready to fly. Additional note: this flag is to be ignore when sent in the command MAV_CMD_DO_SET_MODE and MAV_CMD_COMPONENT_ARM_DISARM shall be used instead. The flag can still be used to report the armed state. | */ + public static final int MAV_MODE_FLAG_ENUM_END = 129; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_MODE_FLAG_DECODE_POSITION.java b/app/src/main/java/com/MAVLink/enums/MAV_MODE_FLAG_DECODE_POSITION.java new file mode 100644 index 0000000..fcc65fa --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_MODE_FLAG_DECODE_POSITION.java @@ -0,0 +1,23 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * These values encode the bit positions of the decode position. These values can be used to read the value of a flag bit by combining the base_mode variable with AND with the flag position value. The result will be either 0 or 1, depending on if the flag is set or not. + */ +public class MAV_MODE_FLAG_DECODE_POSITION { + public static final int MAV_MODE_FLAG_DECODE_POSITION_CUSTOM_MODE = 1; /* Eighth bit: 00000001 | */ + public static final int MAV_MODE_FLAG_DECODE_POSITION_TEST = 2; /* Seventh bit: 00000010 | */ + public static final int MAV_MODE_FLAG_DECODE_POSITION_AUTO = 4; /* Sixt bit: 00000100 | */ + public static final int MAV_MODE_FLAG_DECODE_POSITION_GUIDED = 8; /* Fifth bit: 00001000 | */ + public static final int MAV_MODE_FLAG_DECODE_POSITION_STABILIZE = 16; /* Fourth bit: 00010000 | */ + public static final int MAV_MODE_FLAG_DECODE_POSITION_HIL = 32; /* Third bit: 00100000 | */ + public static final int MAV_MODE_FLAG_DECODE_POSITION_MANUAL = 64; /* Second bit: 01000000 | */ + public static final int MAV_MODE_FLAG_DECODE_POSITION_SAFETY = 128; /* First bit: 10000000 | */ + public static final int MAV_MODE_FLAG_DECODE_POSITION_ENUM_END = 129; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_MODE_GIMBAL.java b/app/src/main/java/com/MAVLink/enums/MAV_MODE_GIMBAL.java new file mode 100644 index 0000000..2fa2e46 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_MODE_GIMBAL.java @@ -0,0 +1,22 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class MAV_MODE_GIMBAL { + public static final int MAV_MODE_GIMBAL_UNINITIALIZED = 0; /* Gimbal is powered on but has not started initializing yet | */ + public static final int MAV_MODE_GIMBAL_CALIBRATING_PITCH = 1; /* Gimbal is currently running calibration on the pitch axis | */ + public static final int MAV_MODE_GIMBAL_CALIBRATING_ROLL = 2; /* Gimbal is currently running calibration on the roll axis | */ + public static final int MAV_MODE_GIMBAL_CALIBRATING_YAW = 3; /* Gimbal is currently running calibration on the yaw axis | */ + public static final int MAV_MODE_GIMBAL_INITIALIZED = 4; /* Gimbal has finished calibrating and initializing, but is relaxed pending reception of first rate command from copter | */ + public static final int MAV_MODE_GIMBAL_ACTIVE = 5; /* Gimbal is actively stabilizing | */ + public static final int MAV_MODE_GIMBAL_RATE_CMD_TIMEOUT = 6; /* Gimbal is relaxed because it missed more than 10 expected rate command messages in a row. Gimbal will move back to active mode when it receives a new rate command | */ + public static final int MAV_MODE_GIMBAL_ENUM_END = 7; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_MOUNT_MODE.java b/app/src/main/java/com/MAVLink/enums/MAV_MOUNT_MODE.java new file mode 100644 index 0000000..0039397 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_MOUNT_MODE.java @@ -0,0 +1,20 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Enumeration of possible mount operation modes + */ +public class MAV_MOUNT_MODE { + public static final int MAV_MOUNT_MODE_RETRACT = 0; /* Load and keep safe position (Roll,Pitch,Yaw) from permant memory and stop stabilization | */ + public static final int MAV_MOUNT_MODE_NEUTRAL = 1; /* Load and keep neutral position (Roll,Pitch,Yaw) from permanent memory. | */ + public static final int MAV_MOUNT_MODE_MAVLINK_TARGETING = 2; /* Load neutral position and start MAVLink Roll,Pitch,Yaw control with stabilization | */ + public static final int MAV_MOUNT_MODE_RC_TARGETING = 3; /* Load neutral position and start RC Roll,Pitch,Yaw control with stabilization | */ + public static final int MAV_MOUNT_MODE_GPS_POINT = 4; /* Load neutral position and start to point to Lat,Lon,Alt | */ + public static final int MAV_MOUNT_MODE_ENUM_END = 5; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_PARAM_TYPE.java b/app/src/main/java/com/MAVLink/enums/MAV_PARAM_TYPE.java new file mode 100644 index 0000000..7a75c08 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_PARAM_TYPE.java @@ -0,0 +1,25 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Specifies the datatype of a MAVLink parameter. + */ +public class MAV_PARAM_TYPE { + public static final int MAV_PARAM_TYPE_UINT8 = 1; /* 8-bit unsigned integer | */ + public static final int MAV_PARAM_TYPE_INT8 = 2; /* 8-bit signed integer | */ + public static final int MAV_PARAM_TYPE_UINT16 = 3; /* 16-bit unsigned integer | */ + public static final int MAV_PARAM_TYPE_INT16 = 4; /* 16-bit signed integer | */ + public static final int MAV_PARAM_TYPE_UINT32 = 5; /* 32-bit unsigned integer | */ + public static final int MAV_PARAM_TYPE_INT32 = 6; /* 32-bit signed integer | */ + public static final int MAV_PARAM_TYPE_UINT64 = 7; /* 64-bit unsigned integer | */ + public static final int MAV_PARAM_TYPE_INT64 = 8; /* 64-bit signed integer | */ + public static final int MAV_PARAM_TYPE_REAL32 = 9; /* 32-bit floating-point | */ + public static final int MAV_PARAM_TYPE_REAL64 = 10; /* 64-bit floating-point | */ + public static final int MAV_PARAM_TYPE_ENUM_END = 11; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_POWER_STATUS.java b/app/src/main/java/com/MAVLink/enums/MAV_POWER_STATUS.java new file mode 100644 index 0000000..b50ad23 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_POWER_STATUS.java @@ -0,0 +1,21 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Power supply status flags (bitmask) + */ +public class MAV_POWER_STATUS { + public static final int MAV_POWER_STATUS_BRICK_VALID = 1; /* main brick power supply valid | */ + public static final int MAV_POWER_STATUS_SERVO_VALID = 2; /* main servo power supply valid for FMU | */ + public static final int MAV_POWER_STATUS_USB_CONNECTED = 4; /* USB power is connected | */ + public static final int MAV_POWER_STATUS_PERIPH_OVERCURRENT = 8; /* peripheral supply is in over-current state | */ + public static final int MAV_POWER_STATUS_PERIPH_HIPOWER_OVERCURRENT = 16; /* hi-power peripheral supply is in over-current state | */ + public static final int MAV_POWER_STATUS_CHANGED = 32; /* Power status has changed since boot | */ + public static final int MAV_POWER_STATUS_ENUM_END = 33; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_PROTOCOL_CAPABILITY.java b/app/src/main/java/com/MAVLink/enums/MAV_PROTOCOL_CAPABILITY.java new file mode 100644 index 0000000..bfa4838 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_PROTOCOL_CAPABILITY.java @@ -0,0 +1,32 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Bitmask of (optional) autopilot capabilities (64 bit). If a bit is set, the autopilot supports this capability. + */ +public class MAV_PROTOCOL_CAPABILITY { + public static final int MAV_PROTOCOL_CAPABILITY_MISSION_FLOAT = 1; /* Autopilot supports MISSION float message type. | */ + public static final int MAV_PROTOCOL_CAPABILITY_PARAM_FLOAT = 2; /* Autopilot supports the new param float message type. | */ + public static final int MAV_PROTOCOL_CAPABILITY_MISSION_INT = 4; /* Autopilot supports MISSION_INT scaled integer message type. | */ + public static final int MAV_PROTOCOL_CAPABILITY_COMMAND_INT = 8; /* Autopilot supports COMMAND_INT scaled integer message type. | */ + public static final int MAV_PROTOCOL_CAPABILITY_PARAM_UNION = 16; /* Autopilot supports the new param union message type. | */ + public static final int MAV_PROTOCOL_CAPABILITY_FTP = 32; /* Autopilot supports the new FILE_TRANSFER_PROTOCOL message type. | */ + public static final int MAV_PROTOCOL_CAPABILITY_SET_ATTITUDE_TARGET = 64; /* Autopilot supports commanding attitude offboard. | */ + public static final int MAV_PROTOCOL_CAPABILITY_SET_POSITION_TARGET_LOCAL_NED = 128; /* Autopilot supports commanding position and velocity targets in local NED frame. | */ + public static final int MAV_PROTOCOL_CAPABILITY_SET_POSITION_TARGET_GLOBAL_INT = 256; /* Autopilot supports commanding position and velocity targets in global scaled integers. | */ + public static final int MAV_PROTOCOL_CAPABILITY_TERRAIN = 512; /* Autopilot supports terrain protocol / data handling. | */ + public static final int MAV_PROTOCOL_CAPABILITY_SET_ACTUATOR_TARGET = 1024; /* Autopilot supports direct actuator control. | */ + public static final int MAV_PROTOCOL_CAPABILITY_FLIGHT_TERMINATION = 2048; /* Autopilot supports the flight termination command. | */ + public static final int MAV_PROTOCOL_CAPABILITY_COMPASS_CALIBRATION = 4096; /* Autopilot supports onboard compass calibration. | */ + public static final int MAV_PROTOCOL_CAPABILITY_MAVLINK2 = 8192; /* Autopilot supports mavlink version 2. | */ + public static final int MAV_PROTOCOL_CAPABILITY_MISSION_FENCE = 16384; /* Autopilot supports mission fence protocol. | */ + public static final int MAV_PROTOCOL_CAPABILITY_MISSION_RALLY = 32768; /* Autopilot supports mission rally point protocol. | */ + public static final int MAV_PROTOCOL_CAPABILITY_FLIGHT_INFORMATION = 65536; /* Autopilot supports the flight information protocol. | */ + public static final int MAV_PROTOCOL_CAPABILITY_ENUM_END = 65537; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_REMOTE_LOG_DATA_BLOCK_COMMANDS.java b/app/src/main/java/com/MAVLink/enums/MAV_REMOTE_LOG_DATA_BLOCK_COMMANDS.java new file mode 100644 index 0000000..2876510 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_REMOTE_LOG_DATA_BLOCK_COMMANDS.java @@ -0,0 +1,17 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Special ACK block numbers control activation of dataflash log streaming + */ +public class MAV_REMOTE_LOG_DATA_BLOCK_COMMANDS { + public static final int MAV_REMOTE_LOG_DATA_BLOCK_STOP = 2147483645; /* UAV to stop sending DataFlash blocks | */ + public static final int MAV_REMOTE_LOG_DATA_BLOCK_START = 2147483646; /* UAV to start sending DataFlash blocks | */ + public static final int MAV_REMOTE_LOG_DATA_BLOCK_COMMANDS_ENUM_END = 2147483647; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_REMOTE_LOG_DATA_BLOCK_STATUSES.java b/app/src/main/java/com/MAVLink/enums/MAV_REMOTE_LOG_DATA_BLOCK_STATUSES.java new file mode 100644 index 0000000..c34673f --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_REMOTE_LOG_DATA_BLOCK_STATUSES.java @@ -0,0 +1,17 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Possible remote log data block statuses + */ +public class MAV_REMOTE_LOG_DATA_BLOCK_STATUSES { + public static final int MAV_REMOTE_LOG_DATA_BLOCK_NACK = 0; /* This block has NOT been received | */ + public static final int MAV_REMOTE_LOG_DATA_BLOCK_ACK = 1; /* This block has been received | */ + public static final int MAV_REMOTE_LOG_DATA_BLOCK_STATUSES_ENUM_END = 2; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_RESULT.java b/app/src/main/java/com/MAVLink/enums/MAV_RESULT.java new file mode 100644 index 0000000..5c09333 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_RESULT.java @@ -0,0 +1,21 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * result from a mavlink command + */ +public class MAV_RESULT { + public static final int MAV_RESULT_ACCEPTED = 0; /* Command ACCEPTED and EXECUTED | */ + public static final int MAV_RESULT_TEMPORARILY_REJECTED = 1; /* Command TEMPORARY REJECTED/DENIED | */ + public static final int MAV_RESULT_DENIED = 2; /* Command PERMANENTLY DENIED | */ + public static final int MAV_RESULT_UNSUPPORTED = 3; /* Command UNKNOWN/UNSUPPORTED | */ + public static final int MAV_RESULT_FAILED = 4; /* Command executed, but failed | */ + public static final int MAV_RESULT_IN_PROGRESS = 5; /* WIP: Command being executed | */ + public static final int MAV_RESULT_ENUM_END = 6; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_ROI.java b/app/src/main/java/com/MAVLink/enums/MAV_ROI.java new file mode 100644 index 0000000..6d80f98 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_ROI.java @@ -0,0 +1,22 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * The ROI (region of interest) for the vehicle. This can be + * be used by the vehicle for camera/vehicle attitude alignment (see + * MAV_CMD_NAV_ROI). + */ +public class MAV_ROI { + public static final int MAV_ROI_NONE = 0; /* No region of interest. | */ + public static final int MAV_ROI_WPNEXT = 1; /* Point toward next MISSION. | */ + public static final int MAV_ROI_WPINDEX = 2; /* Point toward given MISSION. | */ + public static final int MAV_ROI_LOCATION = 3; /* Point toward fixed location. | */ + public static final int MAV_ROI_TARGET = 4; /* Point toward of given id. | */ + public static final int MAV_ROI_ENUM_END = 5; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_SENSOR_ORIENTATION.java b/app/src/main/java/com/MAVLink/enums/MAV_SENSOR_ORIENTATION.java new file mode 100644 index 0000000..7716931 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_SENSOR_ORIENTATION.java @@ -0,0 +1,54 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Enumeration of sensor orientation, according to its rotations + */ +public class MAV_SENSOR_ORIENTATION { + public static final int MAV_SENSOR_ROTATION_NONE = 0; /* Roll: 0, Pitch: 0, Yaw: 0 | */ + public static final int MAV_SENSOR_ROTATION_YAW_45 = 1; /* Roll: 0, Pitch: 0, Yaw: 45 | */ + public static final int MAV_SENSOR_ROTATION_YAW_90 = 2; /* Roll: 0, Pitch: 0, Yaw: 90 | */ + public static final int MAV_SENSOR_ROTATION_YAW_135 = 3; /* Roll: 0, Pitch: 0, Yaw: 135 | */ + public static final int MAV_SENSOR_ROTATION_YAW_180 = 4; /* Roll: 0, Pitch: 0, Yaw: 180 | */ + public static final int MAV_SENSOR_ROTATION_YAW_225 = 5; /* Roll: 0, Pitch: 0, Yaw: 225 | */ + public static final int MAV_SENSOR_ROTATION_YAW_270 = 6; /* Roll: 0, Pitch: 0, Yaw: 270 | */ + public static final int MAV_SENSOR_ROTATION_YAW_315 = 7; /* Roll: 0, Pitch: 0, Yaw: 315 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_180 = 8; /* Roll: 180, Pitch: 0, Yaw: 0 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_180_YAW_45 = 9; /* Roll: 180, Pitch: 0, Yaw: 45 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_180_YAW_90 = 10; /* Roll: 180, Pitch: 0, Yaw: 90 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_180_YAW_135 = 11; /* Roll: 180, Pitch: 0, Yaw: 135 | */ + public static final int MAV_SENSOR_ROTATION_PITCH_180 = 12; /* Roll: 0, Pitch: 180, Yaw: 0 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_180_YAW_225 = 13; /* Roll: 180, Pitch: 0, Yaw: 225 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_180_YAW_270 = 14; /* Roll: 180, Pitch: 0, Yaw: 270 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_180_YAW_315 = 15; /* Roll: 180, Pitch: 0, Yaw: 315 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_90 = 16; /* Roll: 90, Pitch: 0, Yaw: 0 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_90_YAW_45 = 17; /* Roll: 90, Pitch: 0, Yaw: 45 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_90_YAW_90 = 18; /* Roll: 90, Pitch: 0, Yaw: 90 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_90_YAW_135 = 19; /* Roll: 90, Pitch: 0, Yaw: 135 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_270 = 20; /* Roll: 270, Pitch: 0, Yaw: 0 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_270_YAW_45 = 21; /* Roll: 270, Pitch: 0, Yaw: 45 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_270_YAW_90 = 22; /* Roll: 270, Pitch: 0, Yaw: 90 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_270_YAW_135 = 23; /* Roll: 270, Pitch: 0, Yaw: 135 | */ + public static final int MAV_SENSOR_ROTATION_PITCH_90 = 24; /* Roll: 0, Pitch: 90, Yaw: 0 | */ + public static final int MAV_SENSOR_ROTATION_PITCH_270 = 25; /* Roll: 0, Pitch: 270, Yaw: 0 | */ + public static final int MAV_SENSOR_ROTATION_PITCH_180_YAW_90 = 26; /* Roll: 0, Pitch: 180, Yaw: 90 | */ + public static final int MAV_SENSOR_ROTATION_PITCH_180_YAW_270 = 27; /* Roll: 0, Pitch: 180, Yaw: 270 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_90_PITCH_90 = 28; /* Roll: 90, Pitch: 90, Yaw: 0 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_180_PITCH_90 = 29; /* Roll: 180, Pitch: 90, Yaw: 0 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_270_PITCH_90 = 30; /* Roll: 270, Pitch: 90, Yaw: 0 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_90_PITCH_180 = 31; /* Roll: 90, Pitch: 180, Yaw: 0 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_270_PITCH_180 = 32; /* Roll: 270, Pitch: 180, Yaw: 0 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_90_PITCH_270 = 33; /* Roll: 90, Pitch: 270, Yaw: 0 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_180_PITCH_270 = 34; /* Roll: 180, Pitch: 270, Yaw: 0 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_270_PITCH_270 = 35; /* Roll: 270, Pitch: 270, Yaw: 0 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_90_PITCH_180_YAW_90 = 36; /* Roll: 90, Pitch: 180, Yaw: 90 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_90_YAW_270 = 37; /* Roll: 90, Pitch: 0, Yaw: 270 | */ + public static final int MAV_SENSOR_ROTATION_ROLL_315_PITCH_315_YAW_315 = 38; /* Roll: 315, Pitch: 315, Yaw: 315 | */ + public static final int MAV_SENSOR_ORIENTATION_ENUM_END = 39; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_SEVERITY.java b/app/src/main/java/com/MAVLink/enums/MAV_SEVERITY.java new file mode 100644 index 0000000..3cfb121 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_SEVERITY.java @@ -0,0 +1,23 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Indicates the severity level, generally used for status messages to indicate their relative urgency. Based on RFC-5424 using expanded definitions at: http://www.kiwisyslog.com/kb/info:-syslog-message-levels/. + */ +public class MAV_SEVERITY { + public static final int MAV_SEVERITY_EMERGENCY = 0; /* System is unusable. This is a "panic" condition. | */ + public static final int MAV_SEVERITY_ALERT = 1; /* Action should be taken immediately. Indicates error in non-critical systems. | */ + public static final int MAV_SEVERITY_CRITICAL = 2; /* Action must be taken immediately. Indicates failure in a primary system. | */ + public static final int MAV_SEVERITY_ERROR = 3; /* Indicates an error in secondary/redundant systems. | */ + public static final int MAV_SEVERITY_WARNING = 4; /* Indicates about a possible future error if this is not resolved within a given timeframe. Example would be a low battery warning. | */ + public static final int MAV_SEVERITY_NOTICE = 5; /* An unusual event has occured, though not an error condition. This should be investigated for the root cause. | */ + public static final int MAV_SEVERITY_INFO = 6; /* Normal operational messages. Useful for logging. No action is required for these messages. | */ + public static final int MAV_SEVERITY_DEBUG = 7; /* Useful non-operational messages that can assist in debugging. These should not occur during normal operation. | */ + public static final int MAV_SEVERITY_ENUM_END = 8; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_STATE.java b/app/src/main/java/com/MAVLink/enums/MAV_STATE.java new file mode 100644 index 0000000..563f60b --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_STATE.java @@ -0,0 +1,24 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class MAV_STATE { + public static final int MAV_STATE_UNINIT = 0; /* Uninitialized system, state is unknown. | */ + public static final int MAV_STATE_BOOT = 1; /* System is booting up. | */ + public static final int MAV_STATE_CALIBRATING = 2; /* System is calibrating and not flight-ready. | */ + public static final int MAV_STATE_STANDBY = 3; /* System is grounded and on standby. It can be launched any time. | */ + public static final int MAV_STATE_ACTIVE = 4; /* System is active and might be already airborne. Motors are engaged. | */ + public static final int MAV_STATE_CRITICAL = 5; /* System is in a non-normal flight mode. It can however still navigate. | */ + public static final int MAV_STATE_EMERGENCY = 6; /* System is in a non-normal flight mode. It lost control over parts or over the whole airframe. It is in mayday and going down. | */ + public static final int MAV_STATE_POWEROFF = 7; /* System just initialized its power-down sequence, will shut down now. | */ + public static final int MAV_STATE_FLIGHT_TERMINATION = 8; /* System is terminating itself. | */ + public static final int MAV_STATE_ENUM_END = 9; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_SYS_STATUS_SENSOR.java b/app/src/main/java/com/MAVLink/enums/MAV_SYS_STATUS_SENSOR.java new file mode 100644 index 0000000..7350b94 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_SYS_STATUS_SENSOR.java @@ -0,0 +1,41 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * These encode the sensors whose status is sent as part of the SYS_STATUS message. + */ +public class MAV_SYS_STATUS_SENSOR { + public static final int MAV_SYS_STATUS_SENSOR_3D_GYRO = 1; /* 0x01 3D gyro | */ + public static final int MAV_SYS_STATUS_SENSOR_3D_ACCEL = 2; /* 0x02 3D accelerometer | */ + public static final int MAV_SYS_STATUS_SENSOR_3D_MAG = 4; /* 0x04 3D magnetometer | */ + public static final int MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE = 8; /* 0x08 absolute pressure | */ + public static final int MAV_SYS_STATUS_SENSOR_DIFFERENTIAL_PRESSURE = 16; /* 0x10 differential pressure | */ + public static final int MAV_SYS_STATUS_SENSOR_GPS = 32; /* 0x20 GPS | */ + public static final int MAV_SYS_STATUS_SENSOR_OPTICAL_FLOW = 64; /* 0x40 optical flow | */ + public static final int MAV_SYS_STATUS_SENSOR_VISION_POSITION = 128; /* 0x80 computer vision position | */ + public static final int MAV_SYS_STATUS_SENSOR_LASER_POSITION = 256; /* 0x100 laser based position | */ + public static final int MAV_SYS_STATUS_SENSOR_EXTERNAL_GROUND_TRUTH = 512; /* 0x200 external ground truth (Vicon or Leica) | */ + public static final int MAV_SYS_STATUS_SENSOR_ANGULAR_RATE_CONTROL = 1024; /* 0x400 3D angular rate control | */ + public static final int MAV_SYS_STATUS_SENSOR_ATTITUDE_STABILIZATION = 2048; /* 0x800 attitude stabilization | */ + public static final int MAV_SYS_STATUS_SENSOR_YAW_POSITION = 4096; /* 0x1000 yaw position | */ + public static final int MAV_SYS_STATUS_SENSOR_Z_ALTITUDE_CONTROL = 8192; /* 0x2000 z/altitude control | */ + public static final int MAV_SYS_STATUS_SENSOR_XY_POSITION_CONTROL = 16384; /* 0x4000 x/y position control | */ + public static final int MAV_SYS_STATUS_SENSOR_MOTOR_OUTPUTS = 32768; /* 0x8000 motor outputs / control | */ + public static final int MAV_SYS_STATUS_SENSOR_RC_RECEIVER = 65536; /* 0x10000 rc receiver | */ + public static final int MAV_SYS_STATUS_SENSOR_3D_GYRO2 = 131072; /* 0x20000 2nd 3D gyro | */ + public static final int MAV_SYS_STATUS_SENSOR_3D_ACCEL2 = 262144; /* 0x40000 2nd 3D accelerometer | */ + public static final int MAV_SYS_STATUS_SENSOR_3D_MAG2 = 524288; /* 0x80000 2nd 3D magnetometer | */ + public static final int MAV_SYS_STATUS_GEOFENCE = 1048576; /* 0x100000 geofence | */ + public static final int MAV_SYS_STATUS_AHRS = 2097152; /* 0x200000 AHRS subsystem health | */ + public static final int MAV_SYS_STATUS_TERRAIN = 4194304; /* 0x400000 Terrain subsystem health | */ + public static final int MAV_SYS_STATUS_REVERSE_MOTOR = 8388608; /* 0x800000 Motors are reversed | */ + public static final int MAV_SYS_STATUS_LOGGING = 16777216; /* 0x1000000 Logging | */ + public static final int MAV_SYS_STATUS_SENSOR_BATTERY = 33554432; /* 0x2000000 Battery | */ + public static final int MAV_SYS_STATUS_SENSOR_ENUM_END = 33554433; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_TYPE.java b/app/src/main/java/com/MAVLink/enums/MAV_TYPE.java new file mode 100644 index 0000000..afb1420 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_TYPE.java @@ -0,0 +1,43 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class MAV_TYPE { + public static final int MAV_TYPE_GENERIC = 0; /* Generic micro air vehicle. | */ + public static final int MAV_TYPE_FIXED_WING = 1; /* Fixed wing aircraft. | */ + public static final int MAV_TYPE_QUADROTOR = 2; /* Quadrotor | */ + public static final int MAV_TYPE_COAXIAL = 3; /* Coaxial helicopter | */ + public static final int MAV_TYPE_HELICOPTER = 4; /* Normal helicopter with tail rotor. | */ + public static final int MAV_TYPE_ANTENNA_TRACKER = 5; /* Ground installation | */ + public static final int MAV_TYPE_GCS = 6; /* Operator control unit / ground control station | */ + public static final int MAV_TYPE_AIRSHIP = 7; /* Airship, controlled | */ + public static final int MAV_TYPE_FREE_BALLOON = 8; /* Free balloon, uncontrolled | */ + public static final int MAV_TYPE_ROCKET = 9; /* Rocket | */ + public static final int MAV_TYPE_GROUND_ROVER = 10; /* Ground rover | */ + public static final int MAV_TYPE_SURFACE_BOAT = 11; /* Surface vessel, boat, ship | */ + public static final int MAV_TYPE_SUBMARINE = 12; /* Submarine | */ + public static final int MAV_TYPE_HEXAROTOR = 13; /* Hexarotor | */ + public static final int MAV_TYPE_OCTOROTOR = 14; /* Octorotor | */ + public static final int MAV_TYPE_TRICOPTER = 15; /* Tricopter | */ + public static final int MAV_TYPE_FLAPPING_WING = 16; /* Flapping wing | */ + public static final int MAV_TYPE_KITE = 17; /* Kite | */ + public static final int MAV_TYPE_ONBOARD_CONTROLLER = 18; /* Onboard companion controller | */ + public static final int MAV_TYPE_VTOL_DUOROTOR = 19; /* Two-rotor VTOL using control surfaces in vertical operation in addition. Tailsitter. | */ + public static final int MAV_TYPE_VTOL_QUADROTOR = 20; /* Quad-rotor VTOL using a V-shaped quad config in vertical operation. Tailsitter. | */ + public static final int MAV_TYPE_VTOL_TILTROTOR = 21; /* Tiltrotor VTOL | */ + public static final int MAV_TYPE_VTOL_RESERVED2 = 22; /* VTOL reserved 2 | */ + public static final int MAV_TYPE_VTOL_RESERVED3 = 23; /* VTOL reserved 3 | */ + public static final int MAV_TYPE_VTOL_RESERVED4 = 24; /* VTOL reserved 4 | */ + public static final int MAV_TYPE_VTOL_RESERVED5 = 25; /* VTOL reserved 5 | */ + public static final int MAV_TYPE_GIMBAL = 26; /* Onboard gimbal | */ + public static final int MAV_TYPE_ADSB = 27; /* Onboard ADSB peripheral | */ + public static final int MAV_TYPE_ENUM_END = 28; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MAV_VTOL_STATE.java b/app/src/main/java/com/MAVLink/enums/MAV_VTOL_STATE.java new file mode 100644 index 0000000..f2d28dc --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MAV_VTOL_STATE.java @@ -0,0 +1,20 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Enumeration of VTOL states + */ +public class MAV_VTOL_STATE { + public static final int MAV_VTOL_STATE_UNDEFINED = 0; /* MAV is not configured as VTOL | */ + public static final int MAV_VTOL_STATE_TRANSITION_TO_FW = 1; /* VTOL is in transition from multicopter to fixed-wing | */ + public static final int MAV_VTOL_STATE_TRANSITION_TO_MC = 2; /* VTOL is in transition from fixed-wing to multicopter | */ + public static final int MAV_VTOL_STATE_MC = 3; /* VTOL is in multicopter state | */ + public static final int MAV_VTOL_STATE_FW = 4; /* VTOL is in fixed-wing state | */ + public static final int MAV_VTOL_STATE_ENUM_END = 5; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/MOTOR_TEST_THROTTLE_TYPE.java b/app/src/main/java/com/MAVLink/enums/MOTOR_TEST_THROTTLE_TYPE.java new file mode 100644 index 0000000..5281642 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/MOTOR_TEST_THROTTLE_TYPE.java @@ -0,0 +1,18 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class MOTOR_TEST_THROTTLE_TYPE { + public static final int MOTOR_TEST_THROTTLE_PERCENT = 0; /* throttle as a percentage from 0 ~ 100 | */ + public static final int MOTOR_TEST_THROTTLE_PWM = 1; /* throttle as an absolute PWM value (normally in range of 1000~2000) | */ + public static final int MOTOR_TEST_THROTTLE_PILOT = 2; /* throttle pass-through from pilot's transmitter | */ + public static final int MOTOR_TEST_THROTTLE_TYPE_ENUM_END = 3; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/PARACHUTE_ACTION.java b/app/src/main/java/com/MAVLink/enums/PARACHUTE_ACTION.java new file mode 100644 index 0000000..d7fc0bf --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/PARACHUTE_ACTION.java @@ -0,0 +1,18 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class PARACHUTE_ACTION { + public static final int PARACHUTE_DISABLE = 0; /* Disable parachute release | */ + public static final int PARACHUTE_ENABLE = 1; /* Enable parachute release | */ + public static final int PARACHUTE_RELEASE = 2; /* Release parachute | */ + public static final int PARACHUTE_ACTION_ENUM_END = 3; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/PARAM_ACK.java b/app/src/main/java/com/MAVLink/enums/PARAM_ACK.java new file mode 100644 index 0000000..a53afc7 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/PARAM_ACK.java @@ -0,0 +1,19 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Result from a PARAM_EXT_SET message. + */ +public class PARAM_ACK { + public static final int PARAM_ACK_ACCEPTED = 0; /* Parameter value ACCEPTED and SET | */ + public static final int PARAM_ACK_VALUE_UNSUPPORTED = 1; /* Parameter value UNKNOWN/UNSUPPORTED | */ + public static final int PARAM_ACK_FAILED = 2; /* Parameter failed to set | */ + public static final int PARAM_ACK_IN_PROGRESS = 3; /* Parameter value received but not yet validated or set. A subsequent PARAM_EXT_ACK will follow once operation is completed with the actual result. These are for parameters that may take longer to set. Instead of waiting for an ACK and potentially timing out, you will immediately receive this response to let you know it was received. | */ + public static final int PARAM_ACK_ENUM_END = 4; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/PID_TUNING_AXIS.java b/app/src/main/java/com/MAVLink/enums/PID_TUNING_AXIS.java new file mode 100644 index 0000000..8e985ba --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/PID_TUNING_AXIS.java @@ -0,0 +1,21 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * + */ +public class PID_TUNING_AXIS { + public static final int PID_TUNING_ROLL = 1; /* | */ + public static final int PID_TUNING_PITCH = 2; /* | */ + public static final int PID_TUNING_YAW = 3; /* | */ + public static final int PID_TUNING_ACCZ = 4; /* | */ + public static final int PID_TUNING_STEER = 5; /* | */ + public static final int PID_TUNING_LANDING = 6; /* | */ + public static final int PID_TUNING_AXIS_ENUM_END = 7; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/RALLY_FLAGS.java b/app/src/main/java/com/MAVLink/enums/RALLY_FLAGS.java new file mode 100644 index 0000000..e2d68ee --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/RALLY_FLAGS.java @@ -0,0 +1,17 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Flags in RALLY_POINT message + */ +public class RALLY_FLAGS { + public static final int FAVORABLE_WIND = 1; /* Flag set when requiring favorable winds for landing. | */ + public static final int LAND_IMMEDIATELY = 2; /* Flag set when plane is to immediately descend to break altitude and land without GCS intervention. Flag not set when plane is to loiter at Rally point until commanded to land. | */ + public static final int RALLY_FLAGS_ENUM_END = 3; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/SERIAL_CONTROL_DEV.java b/app/src/main/java/com/MAVLink/enums/SERIAL_CONTROL_DEV.java new file mode 100644 index 0000000..dcfc67a --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/SERIAL_CONTROL_DEV.java @@ -0,0 +1,20 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * SERIAL_CONTROL device types + */ +public class SERIAL_CONTROL_DEV { + public static final int SERIAL_CONTROL_DEV_TELEM1 = 0; /* First telemetry port | */ + public static final int SERIAL_CONTROL_DEV_TELEM2 = 1; /* Second telemetry port | */ + public static final int SERIAL_CONTROL_DEV_GPS1 = 2; /* First GPS port | */ + public static final int SERIAL_CONTROL_DEV_GPS2 = 3; /* Second GPS port | */ + public static final int SERIAL_CONTROL_DEV_SHELL = 10; /* system shell | */ + public static final int SERIAL_CONTROL_DEV_ENUM_END = 11; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/SERIAL_CONTROL_FLAG.java b/app/src/main/java/com/MAVLink/enums/SERIAL_CONTROL_FLAG.java new file mode 100644 index 0000000..92e3933 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/SERIAL_CONTROL_FLAG.java @@ -0,0 +1,20 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * SERIAL_CONTROL flags (bitmask) + */ +public class SERIAL_CONTROL_FLAG { + public static final int SERIAL_CONTROL_FLAG_REPLY = 1; /* Set if this is a reply | */ + public static final int SERIAL_CONTROL_FLAG_RESPOND = 2; /* Set if the sender wants the receiver to send a response as another SERIAL_CONTROL message | */ + public static final int SERIAL_CONTROL_FLAG_EXCLUSIVE = 4; /* Set if access to the serial port should be removed from whatever driver is currently using it, giving exclusive access to the SERIAL_CONTROL protocol. The port can be handed back by sending a request without this flag set | */ + public static final int SERIAL_CONTROL_FLAG_BLOCKING = 8; /* Block on writes to the serial port | */ + public static final int SERIAL_CONTROL_FLAG_MULTI = 16; /* Send multiple replies until port is drained | */ + public static final int SERIAL_CONTROL_FLAG_ENUM_END = 17; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/UAVCAN_NODE_HEALTH.java b/app/src/main/java/com/MAVLink/enums/UAVCAN_NODE_HEALTH.java new file mode 100644 index 0000000..eaa3d9d --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/UAVCAN_NODE_HEALTH.java @@ -0,0 +1,19 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Generalized UAVCAN node health + */ +public class UAVCAN_NODE_HEALTH { + public static final int UAVCAN_NODE_HEALTH_OK = 0; /* The node is functioning properly. | */ + public static final int UAVCAN_NODE_HEALTH_WARNING = 1; /* A critical parameter went out of range or the node has encountered a minor failure. | */ + public static final int UAVCAN_NODE_HEALTH_ERROR = 2; /* The node has encountered a major failure. | */ + public static final int UAVCAN_NODE_HEALTH_CRITICAL = 3; /* The node has suffered a fatal malfunction. | */ + public static final int UAVCAN_NODE_HEALTH_ENUM_END = 4; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/UAVCAN_NODE_MODE.java b/app/src/main/java/com/MAVLink/enums/UAVCAN_NODE_MODE.java new file mode 100644 index 0000000..8a15689 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/UAVCAN_NODE_MODE.java @@ -0,0 +1,20 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Generalized UAVCAN node mode + */ +public class UAVCAN_NODE_MODE { + public static final int UAVCAN_NODE_MODE_OPERATIONAL = 0; /* The node is performing its primary functions. | */ + public static final int UAVCAN_NODE_MODE_INITIALIZATION = 1; /* The node is initializing; this mode is entered immediately after startup. | */ + public static final int UAVCAN_NODE_MODE_MAINTENANCE = 2; /* The node is under maintenance. | */ + public static final int UAVCAN_NODE_MODE_SOFTWARE_UPDATE = 3; /* The node is in the process of updating its software. | */ + public static final int UAVCAN_NODE_MODE_OFFLINE = 7; /* The node is no longer available online. | */ + public static final int UAVCAN_NODE_MODE_ENUM_END = 8; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_EMERGENCY_STATUS.java b/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_EMERGENCY_STATUS.java new file mode 100644 index 0000000..61c4ab6 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_EMERGENCY_STATUS.java @@ -0,0 +1,23 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Emergency status encoding + */ +public class UAVIONIX_ADSB_EMERGENCY_STATUS { + public static final int UAVIONIX_ADSB_OUT_NO_EMERGENCY = 0; /* | */ + public static final int UAVIONIX_ADSB_OUT_GENERAL_EMERGENCY = 1; /* | */ + public static final int UAVIONIX_ADSB_OUT_LIFEGUARD_EMERGENCY = 2; /* | */ + public static final int UAVIONIX_ADSB_OUT_MINIMUM_FUEL_EMERGENCY = 3; /* | */ + public static final int UAVIONIX_ADSB_OUT_NO_COMM_EMERGENCY = 4; /* | */ + public static final int UAVIONIX_ADSB_OUT_UNLAWFUL_INTERFERANCE_EMERGENCY = 5; /* | */ + public static final int UAVIONIX_ADSB_OUT_DOWNED_AIRCRAFT_EMERGENCY = 6; /* | */ + public static final int UAVIONIX_ADSB_OUT_RESERVED = 7; /* | */ + public static final int UAVIONIX_ADSB_EMERGENCY_STATUS_ENUM_END = 8; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_OUT_CFG_AIRCRAFT_SIZE.java b/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_OUT_CFG_AIRCRAFT_SIZE.java new file mode 100644 index 0000000..e0ad324 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_OUT_CFG_AIRCRAFT_SIZE.java @@ -0,0 +1,31 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Definitions for aircraft size + */ +public class UAVIONIX_ADSB_OUT_CFG_AIRCRAFT_SIZE { + public static final int UAVIONIX_ADSB_OUT_CFG_AIRCRAFT_SIZE_NO_DATA = 0; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_AIRCRAFT_SIZE_L15M_W23M = 1; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_AIRCRAFT_SIZE_L25M_W28P5M = 2; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_AIRCRAFT_SIZE_L25_34M = 3; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_AIRCRAFT_SIZE_L35_33M = 4; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_AIRCRAFT_SIZE_L35_38M = 5; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_AIRCRAFT_SIZE_L45_39P5M = 6; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_AIRCRAFT_SIZE_L45_45M = 7; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_AIRCRAFT_SIZE_L55_45M = 8; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_AIRCRAFT_SIZE_L55_52M = 9; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_AIRCRAFT_SIZE_L65_59P5M = 10; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_AIRCRAFT_SIZE_L65_67M = 11; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_AIRCRAFT_SIZE_L75_W72P5M = 12; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_AIRCRAFT_SIZE_L75_W80M = 13; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_AIRCRAFT_SIZE_L85_W80M = 14; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_AIRCRAFT_SIZE_L85_W90M = 15; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_AIRCRAFT_SIZE_ENUM_END = 16; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LAT.java b/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LAT.java new file mode 100644 index 0000000..962833a --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LAT.java @@ -0,0 +1,23 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * GPS lataral offset encoding + */ +public class UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LAT { + public static final int UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LAT_NO_DATA = 0; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LAT_LEFT_2M = 1; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LAT_LEFT_4M = 2; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LAT_LEFT_6M = 3; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LAT_RIGHT_0M = 4; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LAT_RIGHT_2M = 5; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LAT_RIGHT_4M = 6; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LAT_RIGHT_6M = 7; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LAT_ENUM_END = 8; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON.java b/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON.java new file mode 100644 index 0000000..3446148 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON.java @@ -0,0 +1,17 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * GPS longitudinal offset encoding + */ +public class UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON { + public static final int UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON_NO_DATA = 0; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON_APPLIED_BY_SENSOR = 1; /* | */ + public static final int UAVIONIX_ADSB_OUT_CFG_GPS_OFFSET_LON_ENUM_END = 2; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_OUT_DYNAMIC_GPS_FIX.java b/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_OUT_DYNAMIC_GPS_FIX.java new file mode 100644 index 0000000..d001feb --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_OUT_DYNAMIC_GPS_FIX.java @@ -0,0 +1,21 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Status for ADS-B transponder dynamic input + */ +public class UAVIONIX_ADSB_OUT_DYNAMIC_GPS_FIX { + public static final int UAVIONIX_ADSB_OUT_DYNAMIC_GPS_FIX_NONE_0 = 0; /* | */ + public static final int UAVIONIX_ADSB_OUT_DYNAMIC_GPS_FIX_NONE_1 = 1; /* | */ + public static final int UAVIONIX_ADSB_OUT_DYNAMIC_GPS_FIX_2D = 2; /* | */ + public static final int UAVIONIX_ADSB_OUT_DYNAMIC_GPS_FIX_3D = 3; /* | */ + public static final int UAVIONIX_ADSB_OUT_DYNAMIC_GPS_FIX_DGPS = 4; /* | */ + public static final int UAVIONIX_ADSB_OUT_DYNAMIC_GPS_FIX_RTK = 5; /* | */ + public static final int UAVIONIX_ADSB_OUT_DYNAMIC_GPS_FIX_ENUM_END = 6; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_OUT_DYNAMIC_STATE.java b/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_OUT_DYNAMIC_STATE.java new file mode 100644 index 0000000..729c384 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_OUT_DYNAMIC_STATE.java @@ -0,0 +1,20 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * State flags for ADS-B transponder dynamic report + */ +public class UAVIONIX_ADSB_OUT_DYNAMIC_STATE { + public static final int UAVIONIX_ADSB_OUT_DYNAMIC_STATE_INTENT_CHANGE = 1; /* | */ + public static final int UAVIONIX_ADSB_OUT_DYNAMIC_STATE_AUTOPILOT_ENABLED = 2; /* | */ + public static final int UAVIONIX_ADSB_OUT_DYNAMIC_STATE_NICBARO_CROSSCHECKED = 4; /* | */ + public static final int UAVIONIX_ADSB_OUT_DYNAMIC_STATE_ON_GROUND = 8; /* | */ + public static final int UAVIONIX_ADSB_OUT_DYNAMIC_STATE_IDENT = 16; /* | */ + public static final int UAVIONIX_ADSB_OUT_DYNAMIC_STATE_ENUM_END = 17; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_OUT_RF_SELECT.java b/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_OUT_RF_SELECT.java new file mode 100644 index 0000000..2e801fb --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_OUT_RF_SELECT.java @@ -0,0 +1,18 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Transceiver RF control flags for ADS-B transponder dynamic reports + */ +public class UAVIONIX_ADSB_OUT_RF_SELECT { + public static final int UAVIONIX_ADSB_OUT_RF_SELECT_STANDBY = 0; /* | */ + public static final int UAVIONIX_ADSB_OUT_RF_SELECT_RX_ENABLED = 1; /* | */ + public static final int UAVIONIX_ADSB_OUT_RF_SELECT_TX_ENABLED = 2; /* | */ + public static final int UAVIONIX_ADSB_OUT_RF_SELECT_ENUM_END = 3; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_RF_HEALTH.java b/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_RF_HEALTH.java new file mode 100644 index 0000000..b4776f1 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/UAVIONIX_ADSB_RF_HEALTH.java @@ -0,0 +1,19 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Status flags for ADS-B transponder dynamic output + */ +public class UAVIONIX_ADSB_RF_HEALTH { + public static final int UAVIONIX_ADSB_RF_HEALTH_INITIALIZING = 0; /* | */ + public static final int UAVIONIX_ADSB_RF_HEALTH_OK = 1; /* | */ + public static final int UAVIONIX_ADSB_RF_HEALTH_FAIL_TX = 2; /* | */ + public static final int UAVIONIX_ADSB_RF_HEALTH_FAIL_RX = 16; /* | */ + public static final int UAVIONIX_ADSB_RF_HEALTH_ENUM_END = 17; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/enums/VTOL_TRANSITION_HEADING.java b/app/src/main/java/com/MAVLink/enums/VTOL_TRANSITION_HEADING.java new file mode 100644 index 0000000..1217d41 --- /dev/null +++ b/app/src/main/java/com/MAVLink/enums/VTOL_TRANSITION_HEADING.java @@ -0,0 +1,20 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.enums; + +/** + * Direction of VTOL transition + */ +public class VTOL_TRANSITION_HEADING { + public static final int VTOL_TRANSITION_HEADING_VEHICLE_DEFAULT = 0; /* Respect the heading configuration of the vehicle. | */ + public static final int VTOL_TRANSITION_HEADING_NEXT_WAYPOINT = 1; /* Use the heading pointing towards the next waypoint. | */ + public static final int VTOL_TRANSITION_HEADING_TAKEOFF = 2; /* Use the heading on takeoff (while sitting on the ground). | */ + public static final int VTOL_TRANSITION_HEADING_SPECIFIED = 3; /* Use the specified heading in parameter 4. | */ + public static final int VTOL_TRANSITION_HEADING_ANY = 4; /* Use the current heading when reaching takeoff altitude (potentially facing the wind when weather-vaning is active). | */ + public static final int VTOL_TRANSITION_HEADING_ENUM_END = 5; /* | */ +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/uAvionix/CRC.java b/app/src/main/java/com/MAVLink/uAvionix/CRC.java new file mode 100644 index 0000000..ff8c777 --- /dev/null +++ b/app/src/main/java/com/MAVLink/uAvionix/CRC.java @@ -0,0 +1,64 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +package com.MAVLink.uAvionix; + +/** + * X.25 CRC calculation for MAVlink messages. The checksum must be initialized, + * updated with witch field of the message, and then finished with the message + * id. + */ +public class CRC { + private static final int[] MAVLINK_MESSAGE_CRCS = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + private static final int CRC_INIT_VALUE = 0xffff; + private int crcValue; + + /** + * Accumulate the X.25 CRC by adding one char at a time. + * <p> + * The checksum function adds the hash of one char at a time to the 16 bit + * checksum (uint16_t). + * + * @param data new char to hash + **/ + public void update_checksum(int data) { + data = data & 0xff; //cast because we want an unsigned type + int tmp = data ^ (crcValue & 0xff); + tmp ^= (tmp << 4) & 0xff; + crcValue = ((crcValue >> 8) & 0xff) ^ (tmp << 8) ^ (tmp << 3) ^ ((tmp >> 4) & 0xf); + } + + /** + * Finish the CRC calculation of a message, by running the CRC with the + * Magic Byte. This Magic byte has been defined in MAVlink v1.0. + * + * @param msgid The message id number + */ + public void finish_checksum(int msgid) { + update_checksum(MAVLINK_MESSAGE_CRCS[msgid]); + } + + /** + * Initialize the buffer for the X.25 CRC + */ + public void start_checksum() { + crcValue = CRC_INIT_VALUE; + } + + public int getMSB() { + return ((crcValue >> 8) & 0xff); + } + + public int getLSB() { + return (crcValue & 0xff); + } + + public CRC() { + start_checksum(); + } + +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/uAvionix/msg_uavionix_adsb_out_cfg.java b/app/src/main/java/com/MAVLink/uAvionix/msg_uavionix_adsb_out_cfg.java new file mode 100644 index 0000000..ccb8314 --- /dev/null +++ b/app/src/main/java/com/MAVLink/uAvionix/msg_uavionix_adsb_out_cfg.java @@ -0,0 +1,184 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE UAVIONIX_ADSB_OUT_CFG PACKING +package com.MAVLink.uAvionix; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Static data to configure the ADS-B transponder (send within 10 sec of a POR and every 10 sec thereafter) + */ +public class msg_uavionix_adsb_out_cfg extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG = 10001; + public static final int MAVLINK_MSG_LENGTH = 20; + private static final long serialVersionUID = MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG; + + + /** + * Vehicle address (24 bit) + */ + public long ICAO; + + /** + * Aircraft stall speed in cm/s + */ + public int stallSpeed; + + /** + * Vehicle identifier (8 characters, null terminated, valid characters are A-Z, 0-9, " " only) + */ + public byte callsign[] = new byte[9]; + + /** + * Transmitting vehicle type. See ADSB_EMITTER_TYPE enum + */ + public short emitterType; + + /** + * Aircraft length and width encoding (table 2-35 of DO-282B) + */ + public short aircraftSize; + + /** + * GPS antenna lateral offset (table 2-36 of DO-282B) + */ + public short gpsOffsetLat; + + /** + * GPS antenna longitudinal offset from nose [if non-zero, take position (in meters) divide by 2 and add one] (table 2-37 DO-282B) + */ + public short gpsOffsetLon; + + /** + * ADS-B transponder reciever and transmit enable flags + */ + public short rfSelect; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG; + + packet.payload.putUnsignedInt(ICAO); + + packet.payload.putUnsignedShort(stallSpeed); + + + for (int i = 0; i < callsign.length; i++) { + packet.payload.putByte(callsign[i]); + } + + + packet.payload.putUnsignedByte(emitterType); + + packet.payload.putUnsignedByte(aircraftSize); + + packet.payload.putUnsignedByte(gpsOffsetLat); + + packet.payload.putUnsignedByte(gpsOffsetLon); + + packet.payload.putUnsignedByte(rfSelect); + + return packet; + } + + /** + * Decode a uavionix_adsb_out_cfg message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.ICAO = payload.getUnsignedInt(); + + this.stallSpeed = payload.getUnsignedShort(); + + + for (int i = 0; i < this.callsign.length; i++) { + this.callsign[i] = payload.getByte(); + } + + + this.emitterType = payload.getUnsignedByte(); + + this.aircraftSize = payload.getUnsignedByte(); + + this.gpsOffsetLat = payload.getUnsignedByte(); + + this.gpsOffsetLon = payload.getUnsignedByte(); + + this.rfSelect = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_uavionix_adsb_out_cfg() { + msgid = MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_uavionix_adsb_out_cfg(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG; + unpack(mavLinkPacket.payload); + } + + + /** + * Sets the buffer of this message with a string, adds the necessary padding + */ + public void setCallsign(String str) { + int len = Math.min(str.length(), 9); + for (int i = 0; i < len; i++) { + callsign[i] = (byte) str.charAt(i); + } + + for (int i = len; i < 9; i++) { // padding for the rest of the buffer + callsign[i] = 0; + } + } + + /** + * Gets the message, formated as a string + */ + public String getCallsign() { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 9; i++) { + if (callsign[i] != 0) + buf.append((char) callsign[i]); + else + break; + } + return buf.toString(); + + } + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_CFG - sysid:" + sysid + " compid:" + compid + " ICAO:" + ICAO + " stallSpeed:" + stallSpeed + " callsign:" + callsign + " emitterType:" + emitterType + " aircraftSize:" + aircraftSize + " gpsOffsetLat:" + gpsOffsetLat + " gpsOffsetLon:" + gpsOffsetLon + " rfSelect:" + rfSelect + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/uAvionix/msg_uavionix_adsb_out_dynamic.java b/app/src/main/java/com/MAVLink/uAvionix/msg_uavionix_adsb_out_dynamic.java new file mode 100644 index 0000000..92eb374 --- /dev/null +++ b/app/src/main/java/com/MAVLink/uAvionix/msg_uavionix_adsb_out_dynamic.java @@ -0,0 +1,219 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE UAVIONIX_ADSB_OUT_DYNAMIC PACKING +package com.MAVLink.uAvionix; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Dynamic data used to generate ADS-B out transponder data (send at 5Hz) + */ +public class msg_uavionix_adsb_out_dynamic extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC = 10002; + public static final int MAVLINK_MSG_LENGTH = 41; + private static final long serialVersionUID = MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC; + + + /** + * UTC time in seconds since GPS epoch (Jan 6, 1980). If unknown set to UINT32_MAX + */ + public long utcTime; + + /** + * Latitude WGS84 (deg * 1E7). If unknown set to INT32_MAX + */ + public int gpsLat; + + /** + * Longitude WGS84 (deg * 1E7). If unknown set to INT32_MAX + */ + public int gpsLon; + + /** + * Altitude in mm (m * 1E-3) UP +ve. WGS84 altitude. If unknown set to INT32_MAX + */ + public int gpsAlt; + + /** + * Barometric pressure altitude relative to a standard atmosphere of 1013.2 mBar and NOT bar corrected altitude (m * 1E-3). (up +ve). If unknown set to INT32_MAX + */ + public int baroAltMSL; + + /** + * Horizontal accuracy in mm (m * 1E-3). If unknown set to UINT32_MAX + */ + public long accuracyHor; + + /** + * Vertical accuracy in cm. If unknown set to UINT16_MAX + */ + public int accuracyVert; + + /** + * Velocity accuracy in mm/s (m * 1E-3). If unknown set to UINT16_MAX + */ + public int accuracyVel; + + /** + * GPS vertical speed in cm/s. If unknown set to INT16_MAX + */ + public short velVert; + + /** + * North-South velocity over ground in cm/s North +ve. If unknown set to INT16_MAX + */ + public short velNS; + + /** + * East-West velocity over ground in cm/s East +ve. If unknown set to INT16_MAX + */ + public short VelEW; + + /** + * ADS-B transponder dynamic input state flags + */ + public int state; + + /** + * Mode A code (typically 1200 [0x04B0] for VFR) + */ + public int squawk; + + /** + * 0-1: no fix, 2: 2D fix, 3: 3D fix, 4: DGPS, 5: RTK + */ + public short gpsFix; + + /** + * Number of satellites visible. If unknown set to UINT8_MAX + */ + public short numSats; + + /** + * Emergency status + */ + public short emergencyStatus; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC; + + packet.payload.putUnsignedInt(utcTime); + + packet.payload.putInt(gpsLat); + + packet.payload.putInt(gpsLon); + + packet.payload.putInt(gpsAlt); + + packet.payload.putInt(baroAltMSL); + + packet.payload.putUnsignedInt(accuracyHor); + + packet.payload.putUnsignedShort(accuracyVert); + + packet.payload.putUnsignedShort(accuracyVel); + + packet.payload.putShort(velVert); + + packet.payload.putShort(velNS); + + packet.payload.putShort(VelEW); + + packet.payload.putUnsignedShort(state); + + packet.payload.putUnsignedShort(squawk); + + packet.payload.putUnsignedByte(gpsFix); + + packet.payload.putUnsignedByte(numSats); + + packet.payload.putUnsignedByte(emergencyStatus); + + return packet; + } + + /** + * Decode a uavionix_adsb_out_dynamic message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.utcTime = payload.getUnsignedInt(); + + this.gpsLat = payload.getInt(); + + this.gpsLon = payload.getInt(); + + this.gpsAlt = payload.getInt(); + + this.baroAltMSL = payload.getInt(); + + this.accuracyHor = payload.getUnsignedInt(); + + this.accuracyVert = payload.getUnsignedShort(); + + this.accuracyVel = payload.getUnsignedShort(); + + this.velVert = payload.getShort(); + + this.velNS = payload.getShort(); + + this.VelEW = payload.getShort(); + + this.state = payload.getUnsignedShort(); + + this.squawk = payload.getUnsignedShort(); + + this.gpsFix = payload.getUnsignedByte(); + + this.numSats = payload.getUnsignedByte(); + + this.emergencyStatus = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_uavionix_adsb_out_dynamic() { + msgid = MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_uavionix_adsb_out_dynamic(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_UAVIONIX_ADSB_OUT_DYNAMIC - sysid:" + sysid + " compid:" + compid + " utcTime:" + utcTime + " gpsLat:" + gpsLat + " gpsLon:" + gpsLon + " gpsAlt:" + gpsAlt + " baroAltMSL:" + baroAltMSL + " accuracyHor:" + accuracyHor + " accuracyVert:" + accuracyVert + " accuracyVel:" + accuracyVel + " velVert:" + velVert + " velNS:" + velNS + " VelEW:" + VelEW + " state:" + state + " squawk:" + squawk + " gpsFix:" + gpsFix + " numSats:" + numSats + " emergencyStatus:" + emergencyStatus + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/com/MAVLink/uAvionix/msg_uavionix_adsb_transceiver_health_report.java b/app/src/main/java/com/MAVLink/uAvionix/msg_uavionix_adsb_transceiver_health_report.java new file mode 100644 index 0000000..67182ff --- /dev/null +++ b/app/src/main/java/com/MAVLink/uAvionix/msg_uavionix_adsb_transceiver_health_report.java @@ -0,0 +1,84 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * java mavlink generator tool. It should not be modified by hand. + */ + +// MESSAGE UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT PACKING +package com.MAVLink.uAvionix; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Messages.MAVLinkPayload; + +/** + * Transceiver heartbeat with health report (updated every 10s) + */ +public class msg_uavionix_adsb_transceiver_health_report extends MAVLinkMessage { + + public static final int MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT = 10003; + public static final int MAVLINK_MSG_LENGTH = 1; + private static final long serialVersionUID = MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT; + + + /** + * ADS-B transponder messages + */ + public short rfHealth; + + + /** + * Generates the payload for a mavlink message for a message of this type + * + * @return + */ + public MAVLinkPacket pack() { + MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH); + packet.sysid = 255; + packet.compid = 190; + packet.msgid = MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT; + + packet.payload.putUnsignedByte(rfHealth); + + return packet; + } + + /** + * Decode a uavionix_adsb_transceiver_health_report message into this class fields + * + * @param payload The message to decode + */ + public void unpack(MAVLinkPayload payload) { + payload.resetIndex(); + + this.rfHealth = payload.getUnsignedByte(); + + } + + /** + * Constructor for a new message, just initializes the msgid + */ + public msg_uavionix_adsb_transceiver_health_report() { + msgid = MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT; + } + + /** + * Constructor for a new message, initializes the message with the payload + * from a mavlink packet + */ + public msg_uavionix_adsb_transceiver_health_report(MAVLinkPacket mavLinkPacket) { + this.sysid = mavLinkPacket.sysid; + this.compid = mavLinkPacket.compid; + this.msgid = MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT; + unpack(mavLinkPacket.payload); + } + + + /** + * Returns a string with the MSG name and data + */ + public String toString() { + return "MAVLINK_MSG_ID_UAVIONIX_ADSB_TRANSCEIVER_HEALTH_REPORT - sysid:" + sysid + " compid:" + compid + " rfHealth:" + rfHealth + ""; + } +} + \ No newline at end of file diff --git a/app/src/main/java/sq/rogue/rosettadrone/ArduCopterFlightModes.java b/app/src/main/java/sq/rogue/rosettadrone/ArduCopterFlightModes.java new file mode 100644 index 0000000..69117a3 --- /dev/null +++ b/app/src/main/java/sq/rogue/rosettadrone/ArduCopterFlightModes.java @@ -0,0 +1,24 @@ +package sq.rogue.rosettadrone; + +public class ArduCopterFlightModes { + final static int STABILIZE = 0; // manual airframe angle with manual throttle + final static int ACRO = 1; // manual body-frame angular rate with manual throttle + final static int ALT_HOLD = 2; // manual airframe angle with automatic throttle + final static int AUTO = 3; // fully automatic waypoint control using mission commands + final static int GUIDED = 4; // fully automatic fly to coordinate or fly at velocity/direction using GCS immediate commands + final static int LOITER = 5; // automatic horizontal acceleration with automatic throttle + final static int RTL = 6; // automatic return to launching point + final static int CIRCLE = 7; // automatic circular flight with automatic throttle + final static int LAND = 9; // automatic landing with horizontal position control + final static int DRIFT = 11; // semi-automous position, yaw and throttle control + final static int SPORT = 13; // manual earth-frame angular rate control with manual throttle + final static int FLIP = 14; // automatically flip the vehicle on the roll axis + final static int AUTOTUNE = 15; // automatically tune the vehicle's roll and pitch gains + final static int POSHOLD = 16; // automatic position hold with manual override, with automatic throttle + final static int BRAKE = 17; // full-brake using inertial/GPS system, no pilot input + final static int THROW = 18; // throw to launch mode using inertial/GPS system, no pilot input + final static int AVOID_ADSB = 19; // automatic avoidance of obstacles in the macro scale - e.g. full-sized aircraft + final static int GUIDED_NOGPS = 20; // guided mode but only accepts attitude and altitude + final static int SMART_RTL = 21; // SMART_RTL returns to home by retracing its steps +}; + diff --git a/app/src/main/java/sq/rogue/rosettadrone/DroneModel.java b/app/src/main/java/sq/rogue/rosettadrone/DroneModel.java new file mode 100644 index 0000000..8ef9a7a --- /dev/null +++ b/app/src/main/java/sq/rogue/rosettadrone/DroneModel.java @@ -0,0 +1,1097 @@ +package sq.rogue.rosettadrone; + +import android.support.annotation.NonNull; +import android.util.Log; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.common.msg_altitude; +import com.MAVLink.common.msg_attitude; +import com.MAVLink.common.msg_autopilot_version; +import com.MAVLink.common.msg_battery_status; +import com.MAVLink.common.msg_global_position_int; +import com.MAVLink.common.msg_gps_raw_int; +import com.MAVLink.common.msg_heartbeat; +import com.MAVLink.common.msg_home_position; +import com.MAVLink.common.msg_mission_ack; +import com.MAVLink.common.msg_mission_count; +import com.MAVLink.common.msg_mission_item; +import com.MAVLink.common.msg_mission_item_reached; +import com.MAVLink.common.msg_mission_request; +import com.MAVLink.common.msg_mission_request_list; +import com.MAVLink.common.msg_param_value; +import com.MAVLink.common.msg_power_status; +import com.MAVLink.common.msg_radio_status; +import com.MAVLink.common.msg_rc_channels; +import com.MAVLink.common.msg_statustext; +import com.MAVLink.common.msg_sys_status; +import com.MAVLink.common.msg_vfr_hud; +import com.MAVLink.common.msg_vibration; +import com.MAVLink.enums.GPS_FIX_TYPE; +import com.MAVLink.enums.MAV_AUTOPILOT; +import com.MAVLink.enums.MAV_FRAME; +import com.MAVLink.enums.MAV_MISSION_RESULT; +import com.MAVLink.enums.MAV_MISSION_TYPE; +import com.MAVLink.enums.MAV_MODE_FLAG; +import com.MAVLink.enums.MAV_PROTOCOL_CAPABILITY; +import com.MAVLink.enums.MAV_STATE; +import com.MAVLink.enums.MAV_TYPE; + +import java.io.IOException; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.PortUnreachableException; +import java.util.ArrayList; +import java.util.Arrays; + +import dji.common.battery.AggregationState; +import dji.common.battery.BatteryState; +import dji.common.error.DJIError; +import dji.common.flightcontroller.Attitude; +import dji.common.flightcontroller.ConnectionFailSafeBehavior; +import dji.common.flightcontroller.ControlMode; +import dji.common.flightcontroller.FlightControlState; +import dji.common.flightcontroller.GPSSignalLevel; +import dji.common.flightcontroller.LocationCoordinate3D; +import dji.common.flightcontroller.virtualstick.RollPitchControlMode; +import dji.common.flightcontroller.virtualstick.VerticalControlMode; +import dji.common.flightcontroller.virtualstick.YawControlMode; +import dji.common.mission.waypoint.Waypoint; +import dji.common.mission.waypoint.WaypointMission; +import dji.common.mission.waypoint.WaypointMissionState; +import dji.common.remotecontroller.HardwareState; +import dji.common.util.CommonCallbacks; +import dji.sdk.battery.Battery; +import dji.sdk.mission.MissionControl; +import dji.sdk.mission.waypoint.WaypointMissionOperator; +import dji.sdk.products.Aircraft; + + +import static com.MAVLink.enums.MAV_COMPONENT.MAV_COMP_ID_AUTOPILOT1; +import static sq.rogue.rosettadrone.util.getTimestampMicroseconds; + + +public class DroneModel implements CommonCallbacks.CompletionCallback { + private final String TAG = "RosettaDrone"; + + private Aircraft djiAircraft; + private ArrayList<MAVParam> params = new ArrayList<MAVParam>(); + private DatagramSocket socket; + private long ticks = 0; + private MainActivity parent; + private int mSystemId = 1; + private int mComponentId = MAV_COMP_ID_AUTOPILOT1; + + private int mThrottleSetting; + private int mFullChargeCapacity_mAh; + private int mChargeRemaining_mAh; + private int mVoltage_mV; + private int mCurrent_mA; + private float mBatteryTemp_C; + private int[] mCellVoltages = new int[10]; + private int mDownlinkQuality = 0; + private int mUplinkQuality = 0; + + private boolean mRSArmingEnabled = false; + + private MissionControl mMissionControl; + private WaypointMission mWaypointMission; + private WaypointMissionOperator mWaypointMissionOperator; + private RosettaMissionOperatorListener mMissionOperatorListener; + + public void setWaypointMission(WaypointMission wpMission) { + mWaypointMission = wpMission; + } + + public Aircraft getDjiAircraft() { + return djiAircraft; + } + + public boolean isRSArmingEnabled() { + return mRSArmingEnabled; + } + + public void setRSArmingEnabled(boolean RSArmingEnabled) { + mRSArmingEnabled = RSArmingEnabled; + } + + public void setDjiAircraft(Aircraft djiAircraft) { + + this.djiAircraft = djiAircraft; + if (djiAircraft == null || djiAircraft.getRemoteController() == null) + return; + + Arrays.fill(mCellVoltages, 0xffff); // indicates no cell per mavlink definition + + /************************************************** + * Called whenever RC state changes * + **************************************************/ + + djiAircraft.getRemoteController().setHardwareStateCallback(new HardwareState.HardwareStateCallback() { + @Override + public void onUpdate(@NonNull HardwareState rcHardwareState) { + // DJI: range [-660,660] + mThrottleSetting = (rcHardwareState.getLeftStick().getVerticalPosition() + 660) / 1320; + } + }); + + /************************************************** + * Called whenever battery state changes * + **************************************************/ + + + djiAircraft.getBattery().setStateCallback(new BatteryState.Callback() { + + @Override + public void onUpdate(BatteryState batteryState) { + Log.d(TAG, "Battery State callback"); + mFullChargeCapacity_mAh = batteryState.getFullChargeCapacity(); + mChargeRemaining_mAh = batteryState.getChargeRemaining(); + mVoltage_mV = batteryState.getVoltage(); + mCurrent_mA = Math.abs(batteryState.getCurrent()); + mBatteryTemp_C = batteryState.getTemperature(); + Log.d(TAG, "Current: " + String.valueOf(batteryState.getCurrent())); + } + }); + + djiAircraft.getBattery().getCellVoltages(new CellVoltageCompletionCallback()); + + Battery.setAggregationStateCallback(new AggregationState.Callback() { + @Override + public void onUpdate(AggregationState aggregationState) { + Log.d(TAG, "Aggregation State callback"); + mFullChargeCapacity_mAh = aggregationState.getFullChargeCapacity(); + mChargeRemaining_mAh = aggregationState.getChargeRemaining(); + mVoltage_mV = aggregationState.getVoltage(); + mCurrent_mA = aggregationState.getCurrent(); + Log.d(TAG, "Aggregated voltage: " + String.valueOf(aggregationState.getVoltage())); + } + }); + + /************************************************** + * Called whenever airlink quality changes * + **************************************************/ +// +// djiAircraft.getAirLink().setDownlinkSignalQualityCallback(new SignalQualityCallback() { +// @Override +// public void onUpdate(int i) { +// mDownlinkQuality = i; +// } +// }); +// +// djiAircraft.getAirLink().setUplinkSignalQualityCallback(new SignalQualityCallback() { +// @Override +// public void onUpdate(int i) { +// mUplinkQuality = i; +// } +// }); + + if (mWaypointMissionOperator == null) { + mWaypointMissionOperator = MissionControl.getInstance().getWaypointMissionOperator(); + } + + mMissionOperatorListener = new RosettaMissionOperatorListener(); + + mWaypointMissionOperator.addListener(mMissionOperatorListener); + } + + public void setMissionControl(MissionControl missionControl) { + this.mMissionControl = missionControl; + } + + public MissionControl getMissionControl() { + return mMissionControl; + } + + public ArrayList<MAVParam> getParams() { + return params; + } + + public DatagramSocket getSocket() { + return socket; + } + + public void setSocket(DatagramSocket socket) { + this.socket = socket; + } + + public DroneModel(MainActivity parent, DatagramSocket socket) { + this.parent = parent; + this.socket = socket; + } + + public void tick() { + ticks += 100; + + if (djiAircraft == null) + return; + + try { + if (ticks % 100 == 0) { + send_attitude(); + send_altitude(); + send_vibration(); + send_vfr_hud(); + } + if (ticks % 300 == 0) { + send_global_position_int(); + send_gps_raw_int(); + send_radio_status(); + send_rc_channels(); + } + if (ticks % 1000 == 0) { + send_heartbeat(); + send_sys_status(); + send_power_status(); + send_battery_status(); + } + if (ticks % 5000 == 0) { + send_home_position(); + } + + } catch (Exception e) { + Log.d(TAG, "exception", e); + } + } + +// private void disarmIfNeeded() { +// // This handles an edge case where ground stations may send multiple commands to start the drone if +// // previous attempts are unsuccessful. Once the user gives the stick down command to disable the +// // motors, we disable RosettaDrone arming to be absolutely sure the motors can't start up again. +// if(djiAircraft.getFlightController().getState().areMotorsOn() == false && mRSArmingEnabled == true && mArmingWasCommanded == true) { +// parent.logMessageDJI("disarmIfNeeded()"); +// mRSArmingEnabled = false; +// } +// } + + public void armMotors() { + Log.d(TAG, "Command: arm motors"); + if (!mRSArmingEnabled) { + parent.logMessageDJI("You must arm Rosetta Drone before arming motors"); + return; + } + + djiAircraft.getFlightController().turnOnMotors(new CommonCallbacks.CompletionCallback() { + @Override + public void onResult(DJIError djiError) { + // TODO reattempt if arming/disarming fails + Log.d(TAG, "onResult()"); + mRSArmingEnabled = false; + } + }); + } + + public void disarmMotors() { + Log.d(TAG, "Command: disarm motors"); + djiAircraft.getFlightController().turnOffMotors(new CommonCallbacks.CompletionCallback() { + + @Override + public void onResult(DJIError djiError) { + // TODO reattempt if arming/disarming fails + Log.d(TAG, "onResult()"); + mRSArmingEnabled = false; + } + }); + } + + private void sendMessage(MAVLinkMessage msg) { + if (socket == null) + return; + + MAVLinkPacket packet = msg.pack(); + + packet.sysid = mSystemId; + packet.compid = mComponentId; + + byte[] bytes = packet.encodePacket(); + + try { + DatagramPacket p = new DatagramPacket(bytes, bytes.length, socket.getInetAddress(), socket.getPort()); + socket.send(p); + parent.logMessageToGCS(msg.toString()); +// if(msg.msgid != MAVLINK_MSG_ID_POWER_STATUS && +// msg.msgid != MAVLINK_MSG_ID_SYS_STATUS && +// msg.msgid != MAVLINK_MSG_ID_VIBRATION && +// msg.msgid != MAVLINK_MSG_ID_ATTITUDE && +// msg.msgid != MAVLINK_MSG_ID_VFR_HUD && +// msg.msgid != MAVLINK_MSG_ID_GLOBAL_POSITION_INT && +// msg.msgid != MAVLINK_MSG_ID_GPS_RAW_INT && +// msg.msgid != MAVLINK_MSG_ID_RADIO_STATUS) +// parent.logMessageToGCS(msg.toString()); + + } catch (PortUnreachableException e) { + } catch (IOException e) { + } + } + + public void send_autopilot_version() { + msg_autopilot_version msg = new msg_autopilot_version(); + msg.capabilities = MAV_PROTOCOL_CAPABILITY.MAV_PROTOCOL_CAPABILITY_COMMAND_INT; + msg.capabilities |= MAV_PROTOCOL_CAPABILITY.MAV_PROTOCOL_CAPABILITY_MISSION_INT; + sendMessage(msg); + } + + public void send_heartbeat() { + msg_heartbeat msg = new msg_heartbeat(); + msg.type = MAV_TYPE.MAV_TYPE_QUADROTOR; + msg.autopilot = MAV_AUTOPILOT.MAV_AUTOPILOT_ARDUPILOTMEGA; + + // For base mode logic, see Copter::sendHeartBeat() in ArduCopter/GCS_Mavlink.cpp + msg.base_mode = MAV_MODE_FLAG.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED; + msg.base_mode |= MAV_MODE_FLAG.MAV_MODE_FLAG_MANUAL_INPUT_ENABLED; + + switch (djiAircraft.getFlightController().getState().getFlightMode()) { + case MANUAL: + msg.custom_mode = ArduCopterFlightModes.STABILIZE; + break; + case ATTI: + msg.custom_mode = ArduCopterFlightModes.LOITER; + break; + case ATTI_COURSE_LOCK: + break; + case GPS_ATTI: + break; + case GPS_COURSE_LOCK: + break; + case GPS_HOME_LOCK: + break; + case GPS_HOT_POINT: + break; + case ASSISTED_TAKEOFF: + break; + case AUTO_TAKEOFF: + msg.custom_mode = ArduCopterFlightModes.GUIDED; + msg.base_mode |= MAV_MODE_FLAG.MAV_MODE_FLAG_GUIDED_ENABLED; + break; + case AUTO_LANDING: + msg.custom_mode = ArduCopterFlightModes.LAND; + msg.base_mode |= MAV_MODE_FLAG.MAV_MODE_FLAG_GUIDED_ENABLED; + break; + case GPS_WAYPOINT: + msg.custom_mode = ArduCopterFlightModes.AUTO; + msg.base_mode |= MAV_MODE_FLAG.MAV_MODE_FLAG_GUIDED_ENABLED; + break; + case GO_HOME: + msg.custom_mode = ArduCopterFlightModes.RTL; + msg.base_mode |= MAV_MODE_FLAG.MAV_MODE_FLAG_GUIDED_ENABLED; + break; + case JOYSTICK: + break; + case GPS_ATTI_WRISTBAND: + break; + case DRAW: + msg.base_mode |= MAV_MODE_FLAG.MAV_MODE_FLAG_GUIDED_ENABLED; + break; + case GPS_FOLLOW_ME: + msg.custom_mode = ArduCopterFlightModes.GUIDED; + msg.base_mode |= MAV_MODE_FLAG.MAV_MODE_FLAG_GUIDED_ENABLED; + break; + case ACTIVE_TRACK: + msg.custom_mode = ArduCopterFlightModes.GUIDED; + msg.base_mode |= MAV_MODE_FLAG.MAV_MODE_FLAG_GUIDED_ENABLED; + break; + case TAP_FLY: + msg.custom_mode = ArduCopterFlightModes.GUIDED; + break; + case GPS_SPORT: + break; + case GPS_NOVICE: + break; + case UNKNOWN: + break; + case CONFIRM_LANDING: + break; + case TERRAIN_FOLLOW: + break; + case TRIPOD: + break; + case TRACK_SPOTLIGHT: + break; + case MOTORS_JUST_STARTED: + break; + } + + if (djiAircraft.getFlightController().getState().areMotorsOn()) + msg.base_mode |= MAV_MODE_FLAG.MAV_MODE_FLAG_SAFETY_ARMED; + + // msg.custom_mode = + msg.system_status = MAV_STATE.MAV_STATE_ACTIVE; + msg.mavlink_version = 3; + sendMessage(msg); + } + + public void send_attitude() { + msg_attitude msg = new msg_attitude(); + // TODO: this next line causes an exception + //msg.time_boot_ms = getTimestampMilliseconds(); + Attitude att = djiAircraft.getFlightController().getState().getAttitude(); + msg.roll = (float) (att.roll * Math.PI / 180); + msg.pitch = (float) (att.pitch * Math.PI / 180); + msg.yaw = (float) (att.yaw * Math.PI / 180); + // TODO msg.rollspeed = 0; + // TODO msg.pitchspeed = 0; + // TODO msg.yawspeed = 0; + sendMessage(msg); + } + + public void send_altitude() { + msg_altitude msg = new msg_altitude(); + LocationCoordinate3D coord = djiAircraft.getFlightController().getState().getAircraftLocation(); + msg.altitude_relative = (int) (coord.getAltitude() * 1000); + sendMessage(msg); + } + + public void send_global_position_int() { + msg_global_position_int msg = new msg_global_position_int(); + + LocationCoordinate3D coord = djiAircraft.getFlightController().getState().getAircraftLocation(); + msg.lat = (int) (coord.getLatitude() * Math.pow(10, 7)); + msg.lon = (int) (coord.getLongitude() * Math.pow(10, 7)); + + // NOTE: Commented out this field, because msg.relative_alt seems to be intended for altitude above the current terrain, + // but DJI reports altitude above home point. + // Mavlink: Millimeters above ground (unspecified: presumably above home point?) + // DJI: relative altitude of the aircraft relative to take off location, measured by barometer, in meters. + msg.relative_alt = (int) (coord.getAltitude() * 1000); + + // Mavlink: Millimeters AMSL + // msg.alt = ??? No method in SDK for obtaining MSL altitude. + // djiAircraft.getFlightController().getState().getHomePointAltitude()) seems promising, but always returns 0 + + // Mavlink: m/s*100 + // DJI: m/s + msg.vx = (short) (djiAircraft.getFlightController().getState().getVelocityX() * 100); // positive values N + msg.vy = (short) (djiAircraft.getFlightController().getState().getVelocityY() * 100); // positive values E + msg.vz = (short) (djiAircraft.getFlightController().getState().getVelocityZ() * 100); // positive values down + + // DJI=[-180,180] where 0 is true north, Mavlink=degrees + // TODO unspecified in Mavlink documentation whether this heading is true or magnetic + double yaw = djiAircraft.getFlightController().getState().getAttitude().yaw; + if (yaw < 0) + yaw += 360; + msg.hdg = (int) (yaw * 100); + + sendMessage(msg); + } + + public void send_global_position_int_cov() { + // not implemented + return; + } + + public void send_gps_raw_int() { + msg_gps_raw_int msg = new msg_gps_raw_int(); + + LocationCoordinate3D coord = djiAircraft.getFlightController().getState().getAircraftLocation(); + + + msg.time_usec = getTimestampMicroseconds(); + msg.lat = (int) (coord.getLatitude() * Math.pow(10, 7)); + msg.lon = (int) (coord.getLongitude() * Math.pow(10, 7)); + // TODO msg.alt + // TODO msg.eph + // TODO msg.epv + // TODO msg.vel + // TODO msg.cog + msg.satellites_visible = (short) djiAircraft.getFlightController().getState().getSatelliteCount(); + + // DJI reports signal quality on a scale of 1-5 + // Mavlink has separate codes for fix type. + GPSSignalLevel gpsLevel = djiAircraft.getFlightController().getState().getGPSSignalLevel(); + if (gpsLevel == GPSSignalLevel.NONE) + msg.fix_type = GPS_FIX_TYPE.GPS_FIX_TYPE_NO_FIX; + if (gpsLevel == GPSSignalLevel.LEVEL_0 || gpsLevel == GPSSignalLevel.LEVEL_1) + msg.fix_type = GPS_FIX_TYPE.GPS_FIX_TYPE_NO_FIX; + if (gpsLevel == GPSSignalLevel.LEVEL_2) + msg.fix_type = GPS_FIX_TYPE.GPS_FIX_TYPE_2D_FIX; + if (gpsLevel == GPSSignalLevel.LEVEL_3 || gpsLevel == GPSSignalLevel.LEVEL_4 || + gpsLevel == GPSSignalLevel.LEVEL_5) + msg.fix_type = GPS_FIX_TYPE.GPS_FIX_TYPE_3D_FIX; + + sendMessage(msg); + } + + public void send_sys_status() { + msg_sys_status msg = new msg_sys_status(); + + Log.d(TAG, "Full charge capacity: " + String.valueOf(mFullChargeCapacity_mAh)); + Log.d(TAG, "Charge remaining: " + String.valueOf(mChargeRemaining_mAh)); + Log.d(TAG, "Full charge capacity: " + String.valueOf(mFullChargeCapacity_mAh)); + + if (mFullChargeCapacity_mAh > 0) { + msg.battery_remaining = (byte) ((float) mChargeRemaining_mAh / (float) mFullChargeCapacity_mAh * 100.0); + Log.d(TAG, "calc'ed bat remain: " + String.valueOf(msg.battery_remaining)); + } else { + Log.d(TAG, "divide by zero"); + msg.battery_remaining = 100; // Prevent divide by zero + } + msg.voltage_battery = mVoltage_mV; + msg.current_battery = (short) mCurrent_mA; + sendMessage(msg); + } + + public void send_power_status() { + msg_power_status msg = new msg_power_status(); + sendMessage(msg); + } + + public void send_radio_status() { + msg_radio_status msg = new msg_radio_status(); + msg.rssi = 0; // TODO: work out units conversion (see issue #1) + msg.remrssi = 0; // TODO: work out units conversion (see issue #1) + sendMessage(msg); + } + + public void send_rc_channels() { + msg_rc_channels msg = new msg_rc_channels(); + msg.rssi = (short) mUplinkQuality; + sendMessage(msg); + } + + public void send_vibration() { + msg_vibration msg = new msg_vibration(); + sendMessage(msg); + } + + public void send_battery_status() { + msg_battery_status msg = new msg_battery_status(); + msg.current_consumed = mFullChargeCapacity_mAh - mChargeRemaining_mAh; + msg.voltages = mCellVoltages; + msg.temperature = (short) (mBatteryTemp_C * 100); + msg.current_battery = (short) (mCurrent_mA * 10); + Log.d(TAG, "temp: " + String.valueOf(mBatteryTemp_C)); + Log.d(TAG, "send_battery_status() complete"); + // TODO cell voltages + sendMessage(msg); + } + + public void send_vfr_hud() { + msg_vfr_hud msg = new msg_vfr_hud(); + + // Mavlink: Current airspeed in m/s + // DJI: unclear whether getState() returns airspeed or groundspeed + msg.airspeed = (float) (Math.sqrt(Math.pow(djiAircraft.getFlightController().getState().getVelocityX(), 2) + + Math.pow(djiAircraft.getFlightController().getState().getVelocityY(), 2))); + + // Mavlink: Current ground speed in m/s. For now, just echoing airspeed. + msg.groundspeed = msg.airspeed; + + // Mavlink: Current heading in degrees, in compass units (0..360, 0=north) + // TODO: unspecified in Mavlink documentation whether this heading is true or magnetic + // DJI=[-180,180] where 0 is true north, Mavlink=degrees + double yaw = djiAircraft.getFlightController().getState().getAttitude().yaw; + if (yaw < 0) + yaw += 360; + msg.heading = (short) yaw; + + // Mavlink: Current throttle setting in integer percent, 0 to 100 + msg.throttle = mThrottleSetting; + + // Mavlink: Current altitude (MSL), in meters + // DJI: relative altitude is altitude of the aircraft relative to take off location, measured by barometer, in meters. + // DJI: home altitude is home point's altitude. Units unspecified in DJI SDK documentation. Presumably meters AMSL. + LocationCoordinate3D coord = djiAircraft.getFlightController().getState().getAircraftLocation(); + msg.alt = (int) (coord.getAltitude()); + + // Mavlink: Current climb rate in meters/second + // DJI: m/s, positive values down + msg.climb = -(short) (djiAircraft.getFlightController().getState().getVelocityZ()); + + sendMessage(msg); + } + + public void send_home_position() { + msg_home_position msg = new msg_home_position(); + + msg.latitude = (int) (djiAircraft.getFlightController().getState().getHomeLocation().getLatitude() * Math.pow(10, 7)); + msg.longitude = (int) (djiAircraft.getFlightController().getState().getHomeLocation().getLongitude() * Math.pow(10, 7)); + msg.altitude = (int) (djiAircraft.getFlightController().getState().getHomePointAltitude()); + + // msg.x = 0; + // msg.y = 0; + // msg.z = 0; + // msg.approach_x = 0; + // msg.approach_y = 0; + // msg.approach_z = 0; + sendMessage(msg); + } + + public void send_statustext(String text, int severity) { + msg_statustext msg = new msg_statustext(); + msg.text = text.getBytes(); + msg.severity = (short) severity; + sendMessage(msg); + } + + public void send_param(int index) { + MAVParam param = params.get(index); + send_param(param.getParamName(), + param.getParamValue(), + param.getParamType(), + params.size(), + index); + } + + public void send_param(String key, float value, short type, int count, int index) { + + msg_param_value msg = new msg_param_value(); + msg.setParam_Id(key); + msg.param_value = value; + msg.param_type = type; + msg.param_count = count; + msg.param_index = index; + + Log.d("Rosetta", "Sending param: " + msg.toString()); + + sendMessage(msg); + } + + public void send_all_params() { + for (int i = 0; i < params.size(); i++) + send_param(i); + } + + public void loadParamsFromDJI() { + for (int i = 0; i < getParams().size(); i++) { + + switch (getParams().get(i).getParamName()) { + case "DJI_CTRL_MODE": + getDjiAircraft().getFlightController().getControlMode(new ParamControlModeCallback(i)); + break; + case "DJI_ENBL_LEDS": + getDjiAircraft().getFlightController().getLEDsEnabled(new ParamBooleanCallback(i)); + break; + case "DJI_ENBL_QSPIN": + getDjiAircraft().getFlightController().getQuickSpinEnabled(new ParamBooleanCallback(i)); + break; + case "DJI_ENBL_RADIUS": + getDjiAircraft().getFlightController().getMaxFlightRadiusLimitationEnabled(new ParamBooleanCallback(i)); + break; + case "DJI_ENBL_TFOLLOW": + getDjiAircraft().getFlightController().getTerrainFollowModeEnabled(new ParamBooleanCallback(i)); + break; + case "DJI_ENBL_TRIPOD": + getDjiAircraft().getFlightController().getTripodModeEnabled(new ParamBooleanCallback(i)); + break; + case "DJI_FAILSAFE": + getDjiAircraft().getFlightController().getConnectionFailSafeBehavior(new ParamConnectionFailSafeBehaviorCallback(i)); + break; + case "DJI_LOW_BAT": + getDjiAircraft().getFlightController().getLowBatteryWarningThreshold(new ParamIntegerCallback(i)); + break; + case "DJI_MAX_HEIGHT": + getDjiAircraft().getFlightController().getMaxFlightHeight(new ParamIntegerCallback(i)); + break; + case "DJI_MAX_RADIUS": + getDjiAircraft().getFlightController().getMaxFlightRadius(new ParamIntegerCallback(i)); + break; + case "DJI_RLPCH_MODE": + if (getDjiAircraft().getFlightController().getRollPitchControlMode() == RollPitchControlMode.ANGLE) + getParams().get(i).setParamValue(0f); + else if (getDjiAircraft().getFlightController().getRollPitchControlMode() == RollPitchControlMode.VELOCITY) + getParams().get(i).setParamValue(1f); + break; + case "DJI_RTL_HEIGHT": + getDjiAircraft().getFlightController().getGoHomeHeightInMeters(new ParamIntegerCallback(i)); + break; + case "DJI_SERIOUS_BAT": + getDjiAircraft().getFlightController().getSeriousLowBatteryWarningThreshold(new ParamIntegerCallback(i)); + break; + case "DJI_SMART_RTH": + getDjiAircraft().getFlightController().getSmartReturnToHomeEnabled(new ParamBooleanCallback(i)); + break; + case "DJI_VERT_MODE": + if (getDjiAircraft().getFlightController().getVerticalControlMode() == VerticalControlMode.VELOCITY) + getParams().get(i).setParamValue(0f); + else if (getDjiAircraft().getFlightController().getVerticalControlMode() == VerticalControlMode.POSITION) + getParams().get(i).setParamValue(1f); + break; + case "DJI_YAW_MODE": + if (getDjiAircraft().getFlightController().getYawControlMode() == YawControlMode.ANGLE) + getParams().get(i).setParamValue(0f); + else if (getDjiAircraft().getFlightController().getYawControlMode() == YawControlMode.ANGULAR_VELOCITY) + getParams().get(i).setParamValue(1f); + break; + } + } + } + + + public void changeParam(MAVParam param) { + for (int i = 0; i < getParams().size(); i++) { + if (getParams().get(i).getParamName().equals(param.getParamName())) { + getParams().get(i).setParamValue(param.getParamValue()); + switch (param.getParamName()) { + case "DJI_CTRL_MODE": + if (param.getParamValue() == 0) + getDjiAircraft().getFlightController().setControlMode(ControlMode.MANUAL, new ParamWriteCompletionCallback(i)); + else if (param.getParamValue() == 2) + getDjiAircraft().getFlightController().setControlMode(ControlMode.SMART, new ParamWriteCompletionCallback(i)); + else if (param.getParamValue() == 255) + getDjiAircraft().getFlightController().setControlMode(ControlMode.UNKNOWN, new ParamWriteCompletionCallback(i)); + break; + case "DJI_ENBL_LEDS": + getDjiAircraft().getFlightController().setLEDsEnabled(param.getParamValue() > 0, new ParamWriteCompletionCallback(i)); + break; + case "DJI_ENBL_QSPIN": + getDjiAircraft().getFlightController().setAutoQuickSpinEnabled(param.getParamValue() > 0, new ParamWriteCompletionCallback(i)); + break; + case "DJI_ENBL_RADIUS": + getDjiAircraft().getFlightController().setMaxFlightRadiusLimitationEnabled((param.getParamValue() > 0), new ParamWriteCompletionCallback(i)); + break; + case "DJI_ENBL_TFOLLOW": + getDjiAircraft().getFlightController().setTerrainFollowModeEnabled(param.getParamValue() > 0, new ParamWriteCompletionCallback(i)); + break; + case "DJI_ENBL_TRIPOD": + getDjiAircraft().getFlightController().setTripodModeEnabled(param.getParamValue() > 0, new ParamWriteCompletionCallback(i)); + break; + case "DJI_FAILSAFE": + if (param.getParamValue() == 0) + getDjiAircraft().getFlightController().setConnectionFailSafeBehavior(ConnectionFailSafeBehavior.HOVER, new ParamWriteCompletionCallback(i)); + else if (param.getParamValue() == 1) + getDjiAircraft().getFlightController().setConnectionFailSafeBehavior(ConnectionFailSafeBehavior.LANDING, new ParamWriteCompletionCallback(i)); + else if (param.getParamValue() == 0) + getDjiAircraft().getFlightController().setConnectionFailSafeBehavior(ConnectionFailSafeBehavior.GO_HOME, new ParamWriteCompletionCallback(i)); + else if (param.getParamValue() == 255) + getDjiAircraft().getFlightController().setConnectionFailSafeBehavior(ConnectionFailSafeBehavior.UNKNOWN, new ParamWriteCompletionCallback(i)); + break; + case "DJI_LOW_BAT": + getDjiAircraft().getFlightController().setLowBatteryWarningThreshold(Math.round(param.getParamValue()), new ParamWriteCompletionCallback(i)); + break; + case "DJI_MAX_HEIGHT": + getDjiAircraft().getFlightController().setMaxFlightHeight(Math.round(param.getParamValue()), new ParamWriteCompletionCallback(i)); + break; + case "DJI_MAX_RADIUS": + getDjiAircraft().getFlightController().setMaxFlightRadius(Math.round(param.getParamValue()), new ParamWriteCompletionCallback(i)); + break; + case "DJI_RLPCH_MODE": + if (param.getParamValue() == 0) + getDjiAircraft().getFlightController().setRollPitchControlMode(RollPitchControlMode.ANGLE); + else if (param.getParamValue() == 1) + getDjiAircraft().getFlightController().setRollPitchControlMode(RollPitchControlMode.VELOCITY); + break; + case "DJI_RTL_HEIGHT": + getDjiAircraft().getFlightController().setGoHomeHeightInMeters(Math.round(param.getParamValue()), new ParamWriteCompletionCallback(i)); + break; + case "DJI_SERIOUS_BAT": + getDjiAircraft().getFlightController().setSeriousLowBatteryWarningThreshold(Math.round(param.getParamValue()), new ParamWriteCompletionCallback(i)); + break; + case "DJI_SMART_RTH": + getDjiAircraft().getFlightController().setSmartReturnToHomeEnabled(param.getParamValue() > 0, new ParamWriteCompletionCallback(i)); + break; + case "DJI_VERT_MODE": + if (param.getParamValue() == 0) + getDjiAircraft().getFlightController().setVerticalControlMode(VerticalControlMode.VELOCITY); + else if (param.getParamValue() == 1) + getDjiAircraft().getFlightController().setVerticalControlMode(VerticalControlMode.POSITION); + break; + case "DJI_YAW_MODE": + if (param.getParamValue() == 0) + getDjiAircraft().getFlightController().setYawControlMode(YawControlMode.ANGLE); + else if (param.getParamValue() == 1) + getDjiAircraft().getFlightController().setYawControlMode(YawControlMode.ANGULAR_VELOCITY); + break; + default: + parent.logMessageDJI("Unknown parameter name"); + + } + send_param(i); + break; + } + } + Log.d(TAG, "Request to set param that doesn't exist"); + + } + + + public void send_mission_count() { + msg_mission_count msg = new msg_mission_count(); + msg.mission_type = MAV_MISSION_TYPE.MAV_MISSION_TYPE_MISSION; + sendMessage(msg); + return; + } + + public void send_mission_item(int i) { + msg_mission_item msg = new msg_mission_item(); + + if (i == 0) { + msg.x = (float) (djiAircraft.getFlightController().getState().getHomeLocation().getLatitude()); + msg.y = (float) (djiAircraft.getFlightController().getState().getHomeLocation().getLongitude()); + msg.z = 0; + } else { + Waypoint wp = mMissionControl.getWaypointMissionOperator().getLoadedMission().getWaypointList().get(i - 1); + msg.x = (float) (wp.coordinate.getLatitude()); + msg.y = (float) (wp.coordinate.getLongitude()); + msg.z = wp.altitude; + } + + msg.seq = i; + msg.frame = MAV_FRAME.MAV_FRAME_GLOBAL_RELATIVE_ALT; + sendMessage(msg); + } + + public void send_mission_item_reached(int seq) { + msg_mission_item_reached msg = new msg_mission_item_reached(); + msg.seq = seq; + sendMessage(msg); + } + + public void send_mission_ack() { + msg_mission_ack msg = new msg_mission_ack(); + msg.type = MAV_MISSION_RESULT.MAV_MISSION_ACCEPTED; + sendMessage(msg); + } + + public void fetch_gcs_mission() { + request_mission_list(); + } + + public void request_mission_list() { + msg_mission_request_list msg = new msg_mission_request_list(); + sendMessage(msg); + } + + public void request_mission_item(int seq) { + msg_mission_request msg = new msg_mission_request(); + msg.seq = seq; + msg.mission_type = MAV_MISSION_TYPE.MAV_MISSION_TYPE_MISSION; + sendMessage(msg); + } + + public void startWaypointMission() { + if (mWaypointMissionOperator == null) { + parent.logMessageDJI("start WaypointMission() - mWaypointMissionOperator null"); + return; + } + if (mWaypointMissionOperator.getCurrentState() == WaypointMissionState.READY_TO_EXECUTE) { + parent.logMessageDJI("Ready to execute mission!\n"); + } else { + parent.logMessageDJI("Not ready to execute mission\n"); + return; + } + if (mRSArmingEnabled) { + do_takeoff(); + mWaypointMissionOperator.startMission(new CommonCallbacks.CompletionCallback() { + @Override + public void onResult(DJIError djiError) { + if (djiError != null) + parent.logMessageDJI("Error: " + djiError.toString()); + else + parent.logMessageDJI("Mission started!"); + } + }); + } else + parent.logMessageDJI("You must arm Rosetta Drone before starting a mission"); + } + + public void stopWaypointMission() { + if (mWaypointMissionOperator == null) { + parent.logMessageDJI("stopWaypointMission() - mWaypointMissionOperator null"); + return; + } + + if (mWaypointMissionOperator.getCurrentState() == WaypointMissionState.EXECUTING) { + parent.logMessageDJI("Stopping mission...\n"); + mWaypointMissionOperator.pauseMission(new CommonCallbacks.CompletionCallback() { + @Override + public void onResult(DJIError djiError) { + if (djiError != null) + parent.logMessageDJI("Error: " + djiError.toString()); + else + parent.logMessageDJI("Mission stopped!\n"); + } + }); + } + } + + public void do_takeoff() { + if (!mRSArmingEnabled) { + parent.logMessageDJI("You must arm Rosetta Drone before commanding a takeoff"); + return; + } + mRSArmingEnabled = false; + parent.logMessageDJI("Taking off..."); + djiAircraft.getFlightController().startTakeoff(new CommonCallbacks.CompletionCallback() { + @Override + public void onResult(DJIError djiError) { + if (djiError != null) + parent.logMessageDJI("Error: " + djiError.toString()); + else { + parent.logMessageDJI("Takeoff successful!\n"); + } + } + }); + } + + public void do_land() { + parent.logMessageDJI("Landing..."); + djiAircraft.getFlightController().startLanding(new CommonCallbacks.CompletionCallback() { + @Override + public void onResult(DJIError djiError) { + if (djiError != null) + parent.logMessageDJI("Error: " + djiError.toString()); + else + parent.logMessageDJI("Land successful!\n"); + } + }); + } + + public void do_go_home() { + parent.logMessageDJI("Going home..."); + djiAircraft.getFlightController().startGoHome(new CommonCallbacks.CompletionCallback() { + @Override + public void onResult(DJIError djiError) { + if (djiError != null) + parent.logMessageDJI("Error: " + djiError.toString()); + else + parent.logMessageDJI("Go home successful!\n"); + } + }); + } + + public void set_flight_mode(FlightControlState djiMode) { + // TODO + return; + } + + + /******************************************** + * CompletionCallback implementation * + ********************************************/ + + @Override + public void onResult(DJIError djiError) { + + } + + + /******************************************** + * Parameter callbacks * + ********************************************/ + + public class ParamIntegerCallback implements CommonCallbacks.CompletionCallbackWith<Integer> { + private int paramIndex; + + public ParamIntegerCallback(int paramIndex) { + this.paramIndex = paramIndex; + } + + @Override + public void onSuccess(Integer integer) { + getParams().get(paramIndex).setParamValue((float) integer); + parent.logMessageDJI("Fetched param from DJI: " + getParams().get(paramIndex).getParamName() + "=" + String.valueOf(integer)); + } + + @Override + public void onFailure(DJIError djiError) { + getParams().get(paramIndex).setParamValue(-99.0f); + parent.logMessageDJI("Param fetch fail: " + getParams().get(paramIndex).getParamName()); + } + } + + public class ParamBooleanCallback implements CommonCallbacks.CompletionCallbackWith<Boolean> { + private int paramIndex; + + public ParamBooleanCallback(int paramIndex) { + this.paramIndex = paramIndex; + } + + @Override + public void onSuccess(Boolean aBoolean) { + getParams().get(paramIndex).setParamValue(aBoolean ? 1.0f : 0.0f); + parent.logMessageDJI("Fetched param from DJI: " + getParams().get(paramIndex).getParamName() + "=" + String.valueOf(aBoolean)); + } + + @Override + public void onFailure(DJIError djiError) { + getParams().get(paramIndex).setParamValue(-99.0f); + parent.logMessageDJI("Param fetch fail: " + getParams().get(paramIndex).getParamName()); + } + } + + public class ParamControlModeCallback implements CommonCallbacks.CompletionCallbackWith<ControlMode> { + private int paramIndex; + + public ParamControlModeCallback(int paramIndex) { + this.paramIndex = paramIndex; + } + + @Override + public void onSuccess(ControlMode cMode) { + if (cMode == ControlMode.MANUAL) + getParams().get(paramIndex).setParamValue(0f); + else if (cMode == ControlMode.SMART) + getParams().get(paramIndex).setParamValue(2f); + else if (cMode == ControlMode.UNKNOWN) + getParams().get(paramIndex).setParamValue(255f); + + parent.logMessageDJI("Fetched param from DJI: " + getParams().get(paramIndex).getParamName() + "=" + String.valueOf(cMode)); + } + + @Override + public void onFailure(DJIError djiError) { + getParams().get(paramIndex).setParamValue(-99.0f); + parent.logMessageDJI("Param fetch fail: " + getParams().get(paramIndex).getParamName()); + } + } + + public class ParamConnectionFailSafeBehaviorCallback implements CommonCallbacks.CompletionCallbackWith<ConnectionFailSafeBehavior> { + private int paramIndex; + + public ParamConnectionFailSafeBehaviorCallback(int paramIndex) { + this.paramIndex = paramIndex; + } + + @Override + public void onSuccess(ConnectionFailSafeBehavior behavior) { + if (behavior == ConnectionFailSafeBehavior.HOVER) + getParams().get(paramIndex).setParamValue(0f); + else if (behavior == ConnectionFailSafeBehavior.LANDING) + getParams().get(paramIndex).setParamValue(1f); + else if (behavior == ConnectionFailSafeBehavior.GO_HOME) + getParams().get(paramIndex).setParamValue(2f); + else if (behavior == ConnectionFailSafeBehavior.UNKNOWN) + getParams().get(paramIndex).setParamValue(255f); + + parent.logMessageDJI("Fetched param from DJI: " + getParams().get(paramIndex).getParamName() + "=" + String.valueOf(behavior)); + } + + @Override + public void onFailure(DJIError djiError) { + getParams().get(paramIndex).setParamValue(-99.0f); + parent.logMessageDJI("Param fetch fail: " + getParams().get(paramIndex).getParamName()); + } + } + + public class ParamWriteCompletionCallback implements CommonCallbacks.CompletionCallback { + + private int paramIndex; + + public ParamWriteCompletionCallback(int paramIndex) { + this.paramIndex = paramIndex; + } + + @Override + public void onResult(DJIError djiError) { + if (djiError == null) + parent.logMessageDJI(("Wrote param to DJI: " + getParams().get(paramIndex).getParamName())); + else + parent.logMessageDJI(("Error writing param to DJI: " + getParams().get(paramIndex).getParamName())); + } + } + + public class CellVoltageCompletionCallback implements CommonCallbacks.CompletionCallbackWith<Integer[]> { + + @Override + public void onSuccess(Integer integer[]) { + for (int i = 0; i < integer.length; i++) + mCellVoltages[i] = integer[i]; + Log.d(TAG, "got cell voltages, v[0] =" + String.valueOf(mCellVoltages[0])); + } + + @Override + public void onFailure(DJIError djiError) { + + } + } +} diff --git a/app/src/main/java/sq/rogue/rosettadrone/LogFragment.java b/app/src/main/java/sq/rogue/rosettadrone/LogFragment.java new file mode 100644 index 0000000..1388b5d --- /dev/null +++ b/app/src/main/java/sq/rogue/rosettadrone/LogFragment.java @@ -0,0 +1,108 @@ +package sq.rogue.rosettadrone; + +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; +import android.text.Editable; +import android.text.TextWatcher; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.ViewTreeObserver; +import android.widget.ScrollView; +import android.widget.TextView; + +public class LogFragment extends Fragment { + + private final int DEFAULT_MAX_CHARACTERS = 200000; + + private TextView mTextViewTraffic; + private ScrollView mScrollView; + private boolean mViewAtBottom = true; + + private int mMaxCharacters = DEFAULT_MAX_CHARACTERS; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.fragment_log, container, false); + mTextViewTraffic = (TextView) view.findViewById(R.id.textView_traffic); + mScrollView = (ScrollView) view.findViewById(R.id.textAreaScrollerTraffic); + + mTextViewTraffic.addTextChangedListener(new TextWatcher() { + + @Override + public void afterTextChanged(Editable arg0) { + if (mViewAtBottom) + mScrollView.fullScroll(ScrollView.FOCUS_DOWN); + } + + @Override + public void beforeTextChanged(CharSequence arg0, int arg1, + int arg2, int arg3) { + //override stub + } + + @Override + public void onTextChanged(CharSequence arg0, int arg1, int arg2, + int arg3) { + //override stub + } + }); + mScrollView.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() { + @Override + public void onScrollChanged() { + if (mScrollView != null) { + if (mScrollView.getChildAt(0).getBottom() <= (mScrollView.getHeight() + mScrollView.getScrollY()) + 200) { + mViewAtBottom = true; + } else { + mViewAtBottom = false; + } + } + } + }); + return view; + } + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + + } + + public void appendLogText(String text) { + String newText = mTextViewTraffic.getText().toString() + text; + int overflow = newText.length() - mMaxCharacters; + if (overflow > 0) { + newText = newText.substring(overflow); // trim off oldest characters + newText = newText.split("\n", 2)[1]; // ensure the remainder starts on a new message + } + mTextViewTraffic.setText(newText); + } + + public void clearLogText(String text) { + mTextViewTraffic.setText(""); + } + + public void setLogText(String text) { + mTextViewTraffic.setText(text); + } + + public String getLogText() { + if (mTextViewTraffic != null) + return mTextViewTraffic.getText().toString(); + return ""; + } + + public int getMaxCharacters() { + return mMaxCharacters; + } + + public void setMaxCharacters(int maxCharacters) { + mMaxCharacters = maxCharacters; + } +} diff --git a/app/src/main/java/sq/rogue/rosettadrone/LogPagerAdapter.java b/app/src/main/java/sq/rogue/rosettadrone/LogPagerAdapter.java new file mode 100644 index 0000000..a239212 --- /dev/null +++ b/app/src/main/java/sq/rogue/rosettadrone/LogPagerAdapter.java @@ -0,0 +1,26 @@ +package sq.rogue.rosettadrone; + +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentManager; +import android.support.v4.app.FragmentPagerAdapter; + +public class LogPagerAdapter extends FragmentPagerAdapter { + + private LogFragment[] fragments = new LogFragment[3]; + + + public LogPagerAdapter(LogFragment[] fragments, FragmentManager fm) { + super(fm); + this.fragments = fragments; + } + + @Override + public Fragment getItem(int position) { + return fragments[position]; + } + + @Override + public int getCount() { + return 3; + } +} \ No newline at end of file diff --git a/app/src/main/java/sq/rogue/rosettadrone/MAVLinkReceiver.java b/app/src/main/java/sq/rogue/rosettadrone/MAVLinkReceiver.java new file mode 100644 index 0000000..6f25720 --- /dev/null +++ b/app/src/main/java/sq/rogue/rosettadrone/MAVLinkReceiver.java @@ -0,0 +1,252 @@ +package sq.rogue.rosettadrone; + +import android.util.Log; + +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.common.msg_command_long; +import com.MAVLink.common.msg_mission_ack; +import com.MAVLink.common.msg_mission_count; +import com.MAVLink.common.msg_mission_item; +import com.MAVLink.common.msg_mission_request; +import com.MAVLink.common.msg_param_request_read; +import com.MAVLink.common.msg_param_set; +import com.MAVLink.common.msg_set_mode; + +import java.util.ArrayList; +import java.util.List; + +import dji.common.mission.waypoint.Waypoint; +import dji.common.mission.waypoint.WaypointMission; +import dji.common.mission.waypoint.WaypointMissionFinishedAction; +import dji.common.mission.waypoint.WaypointMissionFlightPathMode; +import dji.common.mission.waypoint.WaypointMissionGotoWaypointMode; +import dji.common.mission.waypoint.WaypointMissionHeadingMode; + +import static com.MAVLink.common.msg_command_int.MAVLINK_MSG_ID_COMMAND_INT; +import static com.MAVLink.common.msg_command_long.MAVLINK_MSG_ID_COMMAND_LONG; +import static com.MAVLink.common.msg_heartbeat.MAVLINK_MSG_ID_HEARTBEAT; +import static com.MAVLink.common.msg_mission_ack.MAVLINK_MSG_ID_MISSION_ACK; +import static com.MAVLink.common.msg_mission_clear_all.MAVLINK_MSG_ID_MISSION_CLEAR_ALL; +import static com.MAVLink.common.msg_mission_count.MAVLINK_MSG_ID_MISSION_COUNT; +import static com.MAVLink.common.msg_mission_item.MAVLINK_MSG_ID_MISSION_ITEM; +import static com.MAVLink.common.msg_mission_request.MAVLINK_MSG_ID_MISSION_REQUEST; +import static com.MAVLink.common.msg_mission_request_list.MAVLINK_MSG_ID_MISSION_REQUEST_LIST; +import static com.MAVLink.common.msg_mission_request_partial_list.MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST; +import static com.MAVLink.common.msg_mission_set_current.MAVLINK_MSG_ID_MISSION_SET_CURRENT; +import static com.MAVLink.common.msg_param_request_list.MAVLINK_MSG_ID_PARAM_REQUEST_LIST; +import static com.MAVLink.common.msg_param_request_read.MAVLINK_MSG_ID_PARAM_REQUEST_READ; +import static com.MAVLink.common.msg_param_set.MAVLINK_MSG_ID_PARAM_SET; +import static com.MAVLink.common.msg_set_mode.MAVLINK_MSG_ID_SET_MODE; +import static com.MAVLink.enums.MAV_CMD.MAV_CMD_COMPONENT_ARM_DISARM; +import static com.MAVLink.enums.MAV_CMD.MAV_CMD_DO_SET_HOME; +import static com.MAVLink.enums.MAV_CMD.MAV_CMD_GET_HOME_POSITION; +import static com.MAVLink.enums.MAV_CMD.MAV_CMD_NAV_LAND; +import static com.MAVLink.enums.MAV_CMD.MAV_CMD_NAV_LOITER_UNLIM; +import static com.MAVLink.enums.MAV_CMD.MAV_CMD_NAV_TAKEOFF; +import static com.MAVLink.enums.MAV_CMD.MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES; +import static com.MAVLink.enums.MAV_MISSION_TYPE.MAV_MISSION_TYPE_MISSION; +import static dji.common.flightcontroller.FlightControlState.ATTI; + + +public class MAVLinkReceiver { + private final String TAG = "RosettaDrone"; + + DroneModel mModel; + private long mTimeStampLastGCSHeartbeat = 0; + + private int mNumGCSWaypoints = 0; + private int wpState = 0; + private final int WP_STATE_INACTIVE = 0; + private final int WP_STATE_REQ_COUNT = 1; + private final int WP_STATE_REQ_WP = 2; + private MainActivity parent; + private WaypointMission.Builder mBuilder; + private List<Waypoint> mWaypointList; + + public MAVLinkReceiver(MainActivity parent, DroneModel model) { + + this.parent = parent; + this.mModel = model; + + } + + public void process(MAVLinkMessage msg) { + switch (msg.msgid) { + case MAVLINK_MSG_ID_HEARTBEAT: + this.mTimeStampLastGCSHeartbeat = System.currentTimeMillis(); + break; + + case MAVLINK_MSG_ID_COMMAND_LONG: + msg_command_long msg_cmd = (msg_command_long) msg; + switch (msg_cmd.command) { + case MAV_CMD_COMPONENT_ARM_DISARM: + if (msg_cmd.param1 == 1) + mModel.armMotors(); + else + mModel.disarmMotors(); + case MAV_CMD_NAV_LOITER_UNLIM: + mModel.set_flight_mode(ATTI); + break; + case MAV_CMD_NAV_TAKEOFF: + mModel.do_takeoff(); + break; + case MAV_CMD_NAV_LAND: + mModel.do_land(); + break; + case MAV_CMD_DO_SET_HOME: + // TODO; + break; + case MAV_CMD_GET_HOME_POSITION: + mModel.send_home_position(); + break; + case MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES: + mModel.send_autopilot_version(); + break; + } + break; + + case MAVLINK_MSG_ID_COMMAND_INT: + // TODO I don't understand what this message is, but ArduCopter handles it. + // See ArduCopter/GCS_Mavlink.cpp + break; + + case MAVLINK_MSG_ID_SET_MODE: + msg_set_mode msg_set_mode = (msg_set_mode) msg; + if (msg_set_mode.custom_mode == ArduCopterFlightModes.AUTO) + mModel.startWaypointMission(); + else if (msg_set_mode.custom_mode == ArduCopterFlightModes.RTL) + mModel.do_go_home(); + else if (msg_set_mode.custom_mode == ArduCopterFlightModes.LAND) + mModel.do_land(); + else if (msg_set_mode.custom_mode == ArduCopterFlightModes.GUIDED) + mModel.do_takeoff(); + if (msg_set_mode.custom_mode != ArduCopterFlightModes.AUTO) + mModel.stopWaypointMission(); + break; + /************************************************************** + * These messages are used when GCS requests params from MAV * + **************************************************************/ + + case MAVLINK_MSG_ID_PARAM_REQUEST_LIST: + mModel.send_all_params(); + break; + + case MAVLINK_MSG_ID_PARAM_REQUEST_READ: + msg_param_request_read msg_param = (msg_param_request_read) msg; + //String paramStr = msg_param.getParam_Id(); + //parent.logMessageFromGCS("***" + paramStr); + mModel.send_param(msg_param.param_index); + // TODO I am not able to convert the param_id bytearray into String +// for(int i = 0; i < mModel.getParams().size(); i++) +// if(mModel.getParams().get(i).getParamName().equals(msg_param.getParam_Id())) { +// mModel.send_param(i); +// break; +// } + Log.d(TAG, "Request to read param that doesn't exist"); + break; + + case MAVLINK_MSG_ID_PARAM_SET: + msg_param_set msg_param2 = (msg_param_set) msg; + MAVParam param = new MAVParam(msg_param2.getParam_Id(), + msg_param2.param_value, + msg_param2.param_type); + mModel.changeParam(param); + break; + + /************************************************************** + * These messages are used when GCS downloads mission from MAV * + **************************************************************/ + + case MAVLINK_MSG_ID_MISSION_REQUEST_LIST: + parent.logMessageToGCS("mission_request_list received"); + mModel.send_mission_count(); + break; + + case MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST: + // TODO + break; + + case MAVLINK_MSG_ID_MISSION_REQUEST: + msg_mission_request msg_request = new msg_mission_request(); + mModel.send_mission_item(msg_request.seq); + break; + + case MAVLINK_MSG_ID_MISSION_ACK: + msg_mission_ack msg_ack = new msg_mission_ack(); + if (msg_ack.type == MAV_MISSION_TYPE_MISSION) { + // TODO success + } else { + // TODO fail + } + break; + + /************************************************************** + * These messages are used when GCS uploads a mission to MAV * + **************************************************************/ + + case MAVLINK_MSG_ID_MISSION_COUNT: + generateNewMission(); + //mModel.getMissionControl().getWaypointMissionOperator().getLoadedMission().getWaypointList().clear(); + msg_mission_count msg_count = (msg_mission_count) msg; + mNumGCSWaypoints = msg_count.count; + parent.logMessageToGCS("Num GCS waypoints: " + String.valueOf(mNumGCSWaypoints)); + wpState = WP_STATE_REQ_WP; + mModel.request_mission_item(0); + break; + + case MAVLINK_MSG_ID_MISSION_ITEM: + msg_mission_item msg_item = (msg_mission_item) msg; + Waypoint wp = new Waypoint(msg_item.x, msg_item.y, msg_item.z); // TODO check altitude conversion + mWaypointList.add(wp); + + // We are done fetching a complete mission from the GCS... + if (msg_item.seq == mNumGCSWaypoints - 1) { + parent.logMessageToGCS("All wps received"); + wpState = WP_STATE_INACTIVE; + finalizeNewMission(); + mModel.send_mission_ack(); + } else { + parent.logMessageToGCS("Received " + msg_item.seq + ", requesting next wp:" + String.valueOf(msg_item.seq + 1)); + mModel.request_mission_item((msg_item.seq + 1)); + } + break; + + /************************************************************** + * These messages from GCS direct a mission-related action * + **************************************************************/ + + case MAVLINK_MSG_ID_MISSION_SET_CURRENT: + // TODO + break; + + case MAVLINK_MSG_ID_MISSION_CLEAR_ALL: + mModel.getMissionControl().getWaypointMissionOperator().getLoadedMission().getWaypointList().clear(); + break; + + } + + } + + public long getTimestampLastGCSHeartbeat() { + return mTimeStampLastGCSHeartbeat; + } + + protected void generateNewMission() { + mBuilder = new WaypointMission.Builder(); + mBuilder.autoFlightSpeed(5f); + mBuilder.maxFlightSpeed(10f); + mBuilder.setExitMissionOnRCSignalLostEnabled(false); + mBuilder.finishedAction(WaypointMissionFinishedAction.NO_ACTION); + mBuilder.flightPathMode(WaypointMissionFlightPathMode.NORMAL); + mBuilder.gotoFirstWaypointMode(WaypointMissionGotoWaypointMode.SAFELY); + mBuilder.headingMode(WaypointMissionHeadingMode.AUTO); + mBuilder.repeatTimes(1); + mWaypointList = new ArrayList<>(); + } + + protected void finalizeNewMission() { + mBuilder.waypointList(mWaypointList).waypointCount(mWaypointList.size()); + mModel.setWaypointMission(mBuilder.build()); + } + +} diff --git a/app/src/main/java/sq/rogue/rosettadrone/MAVParam.java b/app/src/main/java/sq/rogue/rosettadrone/MAVParam.java new file mode 100644 index 0000000..b99ab46 --- /dev/null +++ b/app/src/main/java/sq/rogue/rosettadrone/MAVParam.java @@ -0,0 +1,44 @@ +package sq.rogue.rosettadrone; + +/** + * Created by markjacobsen on 11/12/17. + */ + +public class MAVParam { + + private String paramName; + private Float paramValue; + private short paramType; + + MAVParam(String paramName, float paramValue, short paramType) { + this.paramName = paramName; + this.paramValue = paramValue; + this.paramType = paramType; + } + + public String getParamName() { + return paramName; + } + + public void setParamName(String paramName) { + this.paramName = paramName; + } + + public Float getParamValue() { + return paramValue; + } + + public void setParamValue(Float paramValue) { + this.paramValue = paramValue; + } + + public short getParamType() { + return paramType; + } + + public void setParamType(short paramType) { + this.paramType = paramType; + } + + +} diff --git a/app/src/main/java/sq/rogue/rosettadrone/MainActivity.java b/app/src/main/java/sq/rogue/rosettadrone/MainActivity.java new file mode 100644 index 0000000..f22ebeb --- /dev/null +++ b/app/src/main/java/sq/rogue/rosettadrone/MainActivity.java @@ -0,0 +1,701 @@ +package sq.rogue.rosettadrone; + +// Acknowledgements: +// IP address validation: https://stackoverflow.com/questions/3698034/validating-ip-in-android/11545229#11545229 +// Hide keyboard: https://stackoverflow.com/questions/16495440/how-to-hide-keyboard-by-default-and-show-only-when-click-on-edittext +// MenuItemTetColor: RPP @ https://stackoverflow.com/questions/31713628/change-menuitem-text-color-programmatically + +import android.Manifest; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.res.AssetManager; +import android.graphics.Color; +import android.os.AsyncTask; +import android.os.Build; +import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; +import android.preference.PreferenceManager; +import android.support.annotation.NonNull; +import android.support.design.widget.TabLayout; +import android.support.v4.app.ActivityCompat; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; +import android.util.Log; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.widget.Button; +import android.widget.CompoundButton; +import android.widget.TextView; +import android.widget.ToggleButton; + +import com.MAVLink.MAVLinkPacket; +import com.MAVLink.Messages.MAVLinkMessage; +import com.MAVLink.Parser; + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.InetAddress; +import java.net.PortUnreachableException; +import java.net.SocketException; +import java.net.SocketTimeoutException; +import java.net.UnknownHostException; +import java.util.Arrays; +import java.util.Timer; +import java.util.TimerTask; +import java.util.regex.Pattern; + +import dji.common.error.DJIError; +import dji.common.error.DJISDKError; +import dji.common.product.Model; +import dji.sdk.base.BaseComponent; +import dji.sdk.base.BaseProduct; +import dji.sdk.camera.VideoFeeder; +import dji.sdk.products.Aircraft; +import dji.sdk.sdkmanager.DJISDKManager; +import sq.rogue.rosettadrone.video.DJIVideoStreamDecoder; +import sq.rogue.rosettadrone.video.H264Packetizer; +import sq.rogue.rosettadrone.video.NativeHelper; + +public class MainActivity extends AppCompatActivity implements DJIVideoStreamDecoder.IYuvDataListener, DJIVideoStreamDecoder.IFrameDataListener { + + private Handler mDJIHandler; + private Handler mUIHandler; + + private final static int RESULT_SETTINGS = 1001; + + private final String TAG = "RosettaDrone"; + private final int GCS_TIMEOUT_mSEC = 2000; + public static final String FLAG_CONNECTION_CHANGE = "dji_sdk_connection_change"; + private static BaseProduct mProduct; + + private Button mButtonClear; + private ToggleButton toggleBtnArming; + protected VideoFeeder.VideoDataCallback mReceivedVideoDataCallBack = null; + private H264Packetizer packetizer; + + private LogFragment logDJI; + private LogFragment logToGCS; + private LogFragment logFromGCS; + private TabLayout tabLayout; + private ViewPager viewPager; + private LogPagerAdapter adapter; + + + private String mNewOutbound = ""; + private String mNewInbound = ""; + private String mNewDJI = ""; + + private DatagramSocket socket; + + private DroneModel mModel; + private MAVLinkReceiver mMavlinkReceiver; + private Parser mMavlinkParser; + private GCSCommunicatorAsyncTask mGCSCommunicator; + + private static final Pattern PARTIAl_IP_ADDRESS = + Pattern.compile("^((25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[0-9])\\.){0,3}" + + "((25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[0-9])){0,1}$"); + + + private Runnable RunnableUpdateUI = new Runnable() { + // We have to update UI from here because we can't update the UI from the + // drone/GCS handling threads + + @Override + public void run() { + + try { + if (!mNewOutbound.equals("")) { + //((LogFragment)adapter.getItem(0)).appendLogText(mNewOutbound); + logToGCS.appendLogText(mNewOutbound); + mNewOutbound = ""; + } + if (!mNewInbound.equals("")) { + //((LogFragment)adapter.getItem(1)).appendLogText(mNewOutbound); + logFromGCS.appendLogText(mNewInbound); + mNewInbound = ""; + } + if (!mNewDJI.equals("")) { + //((LogFragment)adapter.getItem(2)).appendLogText(mNewOutbound); + logDJI.appendLogText(mNewDJI); + mNewDJI = ""; + } + if (mModel.isRSArmingEnabled()) + toggleBtnArming.setChecked(true); + else + toggleBtnArming.setChecked(false); + invalidateOptionsMenu(); + } catch (Exception e) { + Log.d(TAG, "exception", e); + } + mUIHandler.postDelayed(this, 100); + } + }; + + @Override + protected void onCreate(Bundle savedInstanceState) { + + Log.d("TABS", "*** onCreate()"); + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + PreferenceManager.setDefaultValues(this, R.xml.preferences, false); + + requestPermissions(); + + mButtonClear = (Button) findViewById(R.id.button_clear); + viewPager = (ViewPager) findViewById(R.id.pager); + toggleBtnArming = (ToggleButton) findViewById(R.id.toggBtnEnablerArming); + tabLayout = (TabLayout) findViewById(R.id.tab_layout); + + mButtonClear.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + logDJI.setLogText(""); + logFromGCS.setLogText(""); + logToGCS.setLogText(""); + } + }); + + + toggleBtnArming.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + if (isChecked) { + mModel.setRSArmingEnabled(true); + toggleBtnArming.setTextColor(Color.GREEN); + } else { + mModel.setRSArmingEnabled(false); + toggleBtnArming.setTextColor(Color.RED); + } + } + }); + + tabLayout.removeAllTabs(); + tabLayout.addTab(tabLayout.newTab().setText("DJI")); + tabLayout.addTab(tabLayout.newTab().setText("To GCS")); + tabLayout.addTab(tabLayout.newTab().setText("From GCS")); + tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); + + LogFragment[] fragments = new LogFragment[3]; + if (savedInstanceState == null) { + for (int i = 0; i < 3; i++) + fragments[i] = new LogFragment(); + } else { + for (int i = 0; i < 3; i++) + fragments[i] = (LogFragment) getSupportFragmentManager().getFragments().get(i); + } + adapter = new LogPagerAdapter(fragments, getSupportFragmentManager()); + viewPager.setAdapter(adapter); + viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); + viewPager.setOffscreenPageLimit(2); + + + tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { + @Override + public void onTabSelected(TabLayout.Tab tab) { + viewPager.setCurrentItem(tab.getPosition()); + } + + @Override + public void onTabUnselected(TabLayout.Tab tab) { + + } + + @Override + public void onTabReselected(TabLayout.Tab tab) { + + } + }); + + logDJI = (LogFragment) adapter.getItem(0); + logToGCS = (LogFragment) adapter.getItem(1); + logFromGCS = (LogFragment) adapter.getItem(2); + + mModel = new DroneModel(this, null); + mMavlinkReceiver = new MAVLinkReceiver(this, mModel); + loadMockParamFile(); + + mDJIHandler = new Handler(Looper.getMainLooper()); + mUIHandler = new Handler(Looper.getMainLooper()); + mUIHandler.postDelayed(RunnableUpdateUI, 1000); + mGCSCommunicator = new GCSCommunicatorAsyncTask(); + mGCSCommunicator.execute(); + } + + private void requestPermissions() { + // When the compile and target version is higher than 22, please request the following permission at runtime to ensure the SDK works well. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + ActivityCompat.requestPermissions(this, + new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.VIBRATE, + Manifest.permission.INTERNET, Manifest.permission.ACCESS_WIFI_STATE, + Manifest.permission.WAKE_LOCK, Manifest.permission.ACCESS_COARSE_LOCATION, + Manifest.permission.ACCESS_NETWORK_STATE, Manifest.permission.ACCESS_FINE_LOCATION, + Manifest.permission.CHANGE_WIFI_STATE, Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS, + Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.SYSTEM_ALERT_WINDOW, + Manifest.permission.READ_PHONE_STATE, + } + , 1); + } + } + + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + DJISDKManager.getInstance().registerApp(this, mDJISDKManagerCallback); + invalidateOptionsMenu(); + } + + private void initVideoStreamDecoder() { + NativeHelper.getInstance().init(); + DJIVideoStreamDecoder.getInstance().init(getApplicationContext(), null); + DJIVideoStreamDecoder.getInstance().setYuvDataListener(MainActivity.this); + DJIVideoStreamDecoder.getInstance().setFrameDataListener(MainActivity.this); + DJIVideoStreamDecoder.getInstance().resume(); + } + + private void initPacketizer() { + packetizer = new H264Packetizer(); + packetizer.setInputStream(new ByteArrayInputStream("".getBytes())); + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(MainActivity.this); + String videoIPString = "127.0.0.1"; + if (prefs.getBoolean("pref_external_gcs", false)) + videoIPString = prefs.getString("pref_gcs_ip", null); + int videoPort = Integer.parseInt(prefs.getString("pref_video_port", "-1")); + try { + packetizer.getRtpSocket().setDestination(InetAddress.getByName(videoIPString), videoPort, 5000); + logMessageDJI("Starting GCS video link: " + videoIPString + ":" + String.valueOf(videoPort)); + + } catch (UnknownHostException e) { + Log.d(TAG, "exception", e); + logMessageDJI("Unknown video host: " + videoIPString + ":" + String.valueOf(videoPort)); + } + } + + @Override + protected void onResume() { + super.onResume(); + } + + @Override + protected void onPause() { + Log.d(TAG, "onPause()"); + super.onPause(); + // We have to save text when onPause is called or it will be erased +// mNewOutbound = logToGCS.getLogText() + mNewOutbound; +// mNewInbound = logFromGCS.getLogText() + mNewInbound; +// mNewDJI = logDJI.getLogText() + mNewDJI; + } + + @Override + protected void onStop() { + Log.i(TAG, "onStop"); + super.onStop(); + } + + @Override + protected void onDestroy() { + Log.i(TAG, "onDestroy"); + mGCSCommunicator.cancel(true); + super.onDestroy(); + } + + @Override + protected void onActivityResult(int reqCode, int resCode, Intent data) { + super.onActivityResult(reqCode, resCode, data); + if (reqCode == RESULT_SETTINGS) + mGCSCommunicator.renewDatalinks(); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.menu_toolbar, menu); + + return true; + } + + @Override + public boolean onPrepareOptionsMenu(Menu menu) { + boolean result = super.onPrepareOptionsMenu(menu); + + View view_status_dji = findViewById(R.id.action_dji); + View view_status_gcs = findViewById(R.id.action_gcs); + + if (view_status_dji != null && view_status_dji instanceof TextView) { + if (mProduct instanceof Aircraft) + ((TextView) view_status_dji).setTextColor(Color.GREEN); + else + ((TextView) view_status_dji).setTextColor(Color.RED); + } + + if (view_status_gcs != null && view_status_gcs instanceof TextView) { + if (System.currentTimeMillis() - mMavlinkReceiver.getTimestampLastGCSHeartbeat() <= GCS_TIMEOUT_mSEC) + ((TextView) view_status_gcs).setTextColor(Color.GREEN); + else + ((TextView) view_status_gcs).setTextColor(Color.RED); + } + return result; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + Log.d(TAG, "menu item selected"); + // Handle item selection + switch (item.getItemId()) { + case R.id.action_dji: + onClickDJIStatus(); + return true; + case R.id.action_gcs: + onClickGCSStatus(); + return true; + case R.id.action_settings: + onClickSettings(); + default: + return super.onOptionsItemSelected(item); + } + } + + private void onClickDJIStatus() { + Log.d(TAG, "onClickDJIStatus()"); + } + + private void onClickGCSStatus() { + Log.d(TAG, "onClickGCSStatus()"); + } + + private void onClickSettings() { + Log.d(TAG, "onClickSettings()"); + Intent intent = new Intent(MainActivity.this, SettingsActivity.class); + startActivityForResult(intent, RESULT_SETTINGS); + } + + private DJISDKManager.SDKManagerCallback mDJISDKManagerCallback = new DJISDKManager.SDKManagerCallback() { + @Override + public void onRegister(DJIError error) { + Log.d(TAG, error == null ? "success" : error.getDescription()); + if (error == DJISDKError.REGISTRATION_SUCCESS) { + DJISDKManager.getInstance().startConnectionToProduct(); + Handler handler = new Handler(Looper.getMainLooper()); + handler.post(new Runnable() { + @Override + public void run() { + //Toast.makeText(getApplicationContext(), "DJI SDK registered", Toast.LENGTH_LONG).show(); + logMessageDJI("DJI SDK registered"); + } + }); + } else { + Handler handler = new Handler(Looper.getMainLooper()); + handler.post(new Runnable() { + @Override + public void run() { + logMessageDJI("DJI SDK registration failed"); + //Toast.makeText(getApplicationContext(), "DJI SDK registration failed", Toast.LENGTH_LONG).show(); + } + }); + } + if (error != null) { + Log.e(TAG, error.toString()); + } + } + + @Override + public void onProductChange(BaseProduct oldProduct, BaseProduct newProduct) { + Log.d(TAG, "onProductChange()"); + + mProduct = newProduct; + + if (mProduct == null) { + logMessageDJI("No DJI drone detected"); + onDroneDisconnected(); + } else { + if (mProduct instanceof Aircraft) { + logMessageDJI("DJI aircraft detected"); + onDroneConnected(); + } else { + logMessageDJI("DJI non-aircraft product detected"); + onDroneDisconnected(); + } + mProduct.setBaseProductListener(mDJIBaseProductListener); + } + + notifyStatusChange(); + } + }; + + private void onDroneConnected() { + mModel.setDjiAircraft((Aircraft) mProduct); + mModel.setMissionControl(DJISDKManager.getInstance().getMissionControl()); + mModel.loadParamsFromDJI(); + initVideoStreamDecoder(); + initPacketizer(); + mReceivedVideoDataCallBack = new VideoFeeder.VideoDataCallback() { + + @Override + public void onReceive(byte[] videoBuffer, int size) { + //Log.d(TAG, "camera recv video data size: " + size); + //sendNAL(videoBuffer); + DJIVideoStreamDecoder.getInstance().parse(videoBuffer, size); + } + }; + if (!mProduct.getModel().equals(Model.UNKNOWN_AIRCRAFT)) { + if (VideoFeeder.getInstance().getPrimaryVideoFeed() != null) { + VideoFeeder.getInstance().getPrimaryVideoFeed().setCallback(mReceivedVideoDataCallBack); + } + } + } + + private void onDroneDisconnected() { + mModel.setDjiAircraft(null); + mModel.setMissionControl(null); + } + + + @Override + public void onYuvDataReceived(byte[] yuvFrame, int width, int height) { + } + + @Override + public void onFrameDataReceived(byte[] frame, int width, int height) { + // Called whenever a new H264 frame is received from the DJI video decoder + splitNALs(frame); + } + + public void splitNALs(byte[] buffer) { + // One H264 frame can contain multiple NALs + int packet_start_idx = 0; + int packet_end_idx = 0; + if (buffer.length < 4) + return; + for (int i = 3; i < buffer.length - 3; i++) { + // This block handles all but the last NAL in the frame + if ((buffer[i] & 0xff) == 0 && (buffer[i + 1] & 0xff) == 0 && (buffer[i + 2] & 0xff) == 0 && (buffer[i + 3] & 0xff) == 1) { + packet_end_idx = i; + byte[] packet = Arrays.copyOfRange(buffer, packet_start_idx, packet_end_idx); + sendNAL(packet); + packet_start_idx = i; + } + + + } + // This block handles the last NAL in the frame, or the single NAL if only one exists + packet_end_idx = buffer.length; + byte[] packet = Arrays.copyOfRange(buffer, packet_start_idx, packet_end_idx); + sendNAL(packet); + //sendPacket(packet); + } + + protected void sendNAL(byte[] buffer) { + // Pack a single NAL for RTP and send + if (packetizer != null) { + ByteArrayInputStream is = new ByteArrayInputStream(buffer); + packetizer.setInputStream(is); + packetizer.run2(); + } + } + + private BaseProduct.BaseProductListener mDJIBaseProductListener = new BaseProduct.BaseProductListener() { + @Override + public void onComponentChange(BaseProduct.ComponentKey key, BaseComponent oldComponent, BaseComponent newComponent) { + Log.d(TAG, "onComponentChange()"); + if (newComponent != null) { + newComponent.setComponentListener(mDJIComponentListener); + } + notifyStatusChange(); + } + + @Override + public void onConnectivityChange(boolean isConnected) { + Log.d(TAG, "onConnectivityChange()"); + if (!isConnected) { + onDroneDisconnected(); + } + notifyStatusChange(); + } + }; + private BaseComponent.ComponentListener mDJIComponentListener = new BaseComponent.ComponentListener() { + @Override + public void onConnectivityChange(boolean isConnected) { + notifyStatusChange(); + } + }; + + private void notifyStatusChange() { + mDJIHandler.removeCallbacks(djiUpdateRunnable); + Log.d(TAG, "notifyStatusChange()"); + mDJIHandler.postDelayed(djiUpdateRunnable, 500); + } + + private Runnable djiUpdateRunnable = new Runnable() { + @Override + public void run() { + Intent intent = new Intent(FLAG_CONNECTION_CHANGE); + sendBroadcast(intent); + } + }; + + private class GCSSenderTimerTask extends TimerTask { + @Override + public void run() { + mModel.tick(); + } + } + + + private class GCSCommunicatorAsyncTask extends AsyncTask<Integer, Integer, Integer> { + + public boolean request_renew_datalinks = false; + private Timer timer; + + public void renewDatalinks() { + request_renew_datalinks = true; + } + + private void onRenewDatalinks() { + createTelemetrySocket(); + initPacketizer(); + } + + protected Integer doInBackground(Integer... ints2) { + Log.d("TABS", "doInBackground()"); + + try { + onRenewDatalinks(); + mMavlinkParser = new Parser(); + + GCSSenderTimerTask gcsSender = new GCSSenderTimerTask(); + timer = new Timer(true); + timer.scheduleAtFixedRate(gcsSender, 0, 100); + + while (!isCancelled()) { + // Listen for packets + try { + if (request_renew_datalinks == true) { + request_renew_datalinks = false; + onRenewDatalinks(); + + } + byte[] buf = new byte[1000]; + DatagramPacket dp = new DatagramPacket(buf, buf.length); + socket.receive(dp); + + byte[] bytes = dp.getData(); + int[] ints = new int[bytes.length]; + for (int i = 0; i < bytes.length; i++) + ints[i] = bytes[i] & 0xff; + + for (int i = 0; i < bytes.length; i++) { + MAVLinkPacket packet = mMavlinkParser.mavlink_parse_char(ints[i]); + + if (packet != null) { + MAVLinkMessage msg = packet.unpack(); + logMessageFromGCS(msg.toString()); + mMavlinkReceiver.process(msg); + } + } + } catch (PortUnreachableException e) { + //logMessageDJI("Port unreachable: " + e.toString()); + } catch (SocketTimeoutException e) { + } catch (IOException e) { + //logMessageDJI("IOException: " + e.toString()); + } + } + + } catch (Exception e) { + Log.d(TAG, "exception", e); + } + return 0; + } + + protected void onProgressUpdate(Integer... progress) { + + } + + protected void onPostExecute(Long result) { + Log.d("TABS", "onPostExecute()"); + socket.disconnect(); + + timer.cancel(); + } + + private void createTelemetrySocket() { + if (socket != null) + socket.disconnect(); + + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(MainActivity.this); + String gcsIPString = "127.0.0.1"; + if (prefs.getBoolean("pref_external_gcs", false) == true) + gcsIPString = prefs.getString("pref_gcs_ip", null); + int telemIPPort = Integer.parseInt(prefs.getString("pref_telem_port", "-1")); + + try { + socket = new DatagramSocket(); + socket.connect(InetAddress.getByName(gcsIPString), telemIPPort); + socket.setSoTimeout(10); + logMessageDJI("Starting GCS telemetry link: " + gcsIPString + ":" + String.valueOf(telemIPPort)); + } catch (SocketException e) { + Log.d(TAG, "createTelemetrySocket() - socket exception"); + Log.d(TAG, "exception", e); + logMessageDJI("Telemetry socket exception: " + gcsIPString + ":" + String.valueOf(telemIPPort)); + } // TODO + catch (UnknownHostException e) { + Log.d(TAG, "createTelemetrySocket() - unknown host exception"); + Log.d(TAG, "exception", e); + logMessageDJI("Unknown telemetry host: " + gcsIPString + ":" + String.valueOf(telemIPPort)); + } // TODO + + Log.d(TAG, socket.getInetAddress().toString()); + Log.d(TAG, socket.getLocalAddress().toString()); + Log.d(TAG, String.valueOf(socket.getPort())); + Log.d(TAG, String.valueOf(socket.getLocalPort())); + + mModel.setSocket(socket); + } + } + + private void loadMockParamFile() { + mModel.getParams().clear(); + try { + + AssetManager am = getAssets(); + InputStream is = am.open("DJIMock.txt"); + InputStreamReader inputStreamReader = new InputStreamReader(is); + BufferedReader br = new BufferedReader(inputStreamReader); + + String line; + while ((line = br.readLine()) != null) { + if (line.startsWith("#")) + continue; + Log.d(TAG, line); + String[] paramData = line.split("\t"); + String paramName = paramData[2]; + Float paramValue = Float.valueOf(paramData[3]); + short paramType = Short.valueOf(paramData[4]); + + mModel.getParams().add(new MAVParam(paramName, paramValue, paramType)); + } + } catch (FileNotFoundException e) { + Log.d(TAG, "exception", e); + } catch (IOException e) { + Log.d(TAG, "exception", e); + } + } + + public void logMessageToGCS(String msg) { + mNewOutbound += "\n" + msg; + } + + public void logMessageFromGCS(String msg) { + mNewInbound += "\n" + msg; + } + + public void logMessageDJI(String msg) { + mNewDJI += "\n" + msg; + } +} diff --git a/app/src/main/java/sq/rogue/rosettadrone/RDApplication.java b/app/src/main/java/sq/rogue/rosettadrone/RDApplication.java new file mode 100644 index 0000000..6f0838c --- /dev/null +++ b/app/src/main/java/sq/rogue/rosettadrone/RDApplication.java @@ -0,0 +1,14 @@ +package sq.rogue.rosettadrone; + +import android.app.Application; +import android.content.Context; + +import com.secneo.sdk.Helper; + +public class RDApplication extends Application { + @Override + protected void attachBaseContext(Context paramContext) { + super.attachBaseContext(paramContext); + Helper.install(RDApplication.this); + } +} diff --git a/app/src/main/java/sq/rogue/rosettadrone/RosettaMissionOperatorListener.java b/app/src/main/java/sq/rogue/rosettadrone/RosettaMissionOperatorListener.java new file mode 100644 index 0000000..b2f1050 --- /dev/null +++ b/app/src/main/java/sq/rogue/rosettadrone/RosettaMissionOperatorListener.java @@ -0,0 +1,69 @@ +package sq.rogue.rosettadrone; + + +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.util.Log; + +import dji.common.error.DJIError; +import dji.common.mission.waypoint.WaypointMissionDownloadEvent; +import dji.common.mission.waypoint.WaypointMissionExecutionEvent; +import dji.common.mission.waypoint.WaypointMissionUploadEvent; +import dji.sdk.mission.waypoint.WaypointMissionOperatorListener; + +class RosettaMissionOperatorListener implements WaypointMissionOperatorListener { + private String TAG = "RosettaDrone"; + private int WAYPOINT_COUNT = 0; + + @Override + public void onDownloadUpdate(@NonNull WaypointMissionDownloadEvent waypointMissionDownloadEvent) { + // Example of Download Listener + if (waypointMissionDownloadEvent.getProgress() != null + && waypointMissionDownloadEvent.getProgress().isSummaryDownloaded + && waypointMissionDownloadEvent.getProgress().downloadedWaypointIndex == (WAYPOINT_COUNT - 1)) { + Log.d(TAG, "Download successful!"); + } + updateWaypointMissionState(); + } + + @Override + public void onUploadUpdate(@NonNull WaypointMissionUploadEvent waypointMissionUploadEvent) { + // Example of Upload Listener + if (waypointMissionUploadEvent.getProgress() != null + && waypointMissionUploadEvent.getProgress().isSummaryUploaded + && waypointMissionUploadEvent.getProgress().uploadedWaypointIndex == (WAYPOINT_COUNT - 1)) { + Log.d(TAG, "Upload successful!"); + } + updateWaypointMissionState(); + } + + @Override + public void onExecutionUpdate(@NonNull WaypointMissionExecutionEvent waypointMissionExecutionEvent) { + // Example of Execution Listener + Log.d(TAG, + (waypointMissionExecutionEvent.getPreviousState() == null + ? "" + : waypointMissionExecutionEvent.getPreviousState().getName()) + + ", " + + waypointMissionExecutionEvent.getCurrentState().getName() + + (waypointMissionExecutionEvent.getProgress() == null + ? "" + : waypointMissionExecutionEvent.getProgress().targetWaypointIndex)); + updateWaypointMissionState(); + } + + @Override + public void onExecutionStart() { + Log.d(TAG, "Execution started!"); + updateWaypointMissionState(); + } + + @Override + public void onExecutionFinish(@Nullable DJIError djiError) { + Log.d(TAG, "Execution finished!"); + updateWaypointMissionState(); + } + + private void updateWaypointMissionState() { + } +}; \ No newline at end of file diff --git a/app/src/main/java/sq/rogue/rosettadrone/SettingsActivity.java b/app/src/main/java/sq/rogue/rosettadrone/SettingsActivity.java new file mode 100644 index 0000000..03e86de --- /dev/null +++ b/app/src/main/java/sq/rogue/rosettadrone/SettingsActivity.java @@ -0,0 +1,18 @@ +package sq.rogue.rosettadrone; + +import android.app.Activity; +import android.os.Bundle; + +public class SettingsActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Display the fragment as the main content. + getFragmentManager().beginTransaction() + .replace(android.R.id.content, new SettingsFragment()) + .commit(); + } + +} \ No newline at end of file diff --git a/app/src/main/java/sq/rogue/rosettadrone/SettingsFragment.java b/app/src/main/java/sq/rogue/rosettadrone/SettingsFragment.java new file mode 100644 index 0000000..eac60e9 --- /dev/null +++ b/app/src/main/java/sq/rogue/rosettadrone/SettingsFragment.java @@ -0,0 +1,72 @@ +package sq.rogue.rosettadrone; + +import android.content.SharedPreferences; +import android.os.Bundle; +import android.preference.EditTextPreference; +import android.preference.ListPreference; +import android.preference.MultiSelectListPreference; +import android.preference.Preference; +import android.preference.PreferenceFragment; +import android.preference.PreferenceScreen; + +// Display value of preference in summary field + +import java.util.Arrays; + +public class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener { + SharedPreferences sharedPreferences; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Load the preferences from an XML resource + addPreferencesFromResource(R.xml.preferences); + } + + @Override + public void onResume() { + super.onResume(); + sharedPreferences = getPreferenceManager().getSharedPreferences(); + sharedPreferences.registerOnSharedPreferenceChangeListener(this); + + PreferenceScreen preferenceScreen = getPreferenceScreen(); + for (int i = 0; i < preferenceScreen.getPreferenceCount(); i++) { + setSummary(getPreferenceScreen().getPreference(i)); + } + } + + @Override + public void onPause() { + sharedPreferences.unregisterOnSharedPreferenceChangeListener(this); + super.onPause(); + } + + @Override + public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { + Preference pref = getPreferenceScreen().findPreference(key); + setSummary(pref); + } + + private void setSummary(Preference pref) { + if (pref instanceof EditTextPreference) { + updateSummary((EditTextPreference) pref); + } else if (pref instanceof ListPreference) { + updateSummary((ListPreference) pref); + } else if (pref instanceof MultiSelectListPreference) { + updateSummary((MultiSelectListPreference) pref); + } + } + + private void updateSummary(MultiSelectListPreference pref) { + pref.setSummary(Arrays.toString(pref.getValues().toArray())); + } + + private void updateSummary(ListPreference pref) { + pref.setSummary(pref.getValue()); + } + + private void updateSummary(EditTextPreference preference) { + preference.setSummary(preference.getText()); + } +} \ No newline at end of file diff --git a/app/src/main/java/sq/rogue/rosettadrone/WPMissionConverter.java b/app/src/main/java/sq/rogue/rosettadrone/WPMissionConverter.java new file mode 100644 index 0000000..81448bb --- /dev/null +++ b/app/src/main/java/sq/rogue/rosettadrone/WPMissionConverter.java @@ -0,0 +1,13 @@ +package sq.rogue.rosettadrone; + +import dji.sdk.products.Aircraft; + +/** + * Created by markjacobsen on 2/8/18. + */ + +public class WPMissionConverter { + public void uploadMission(Aircraft djiAircraft) { + } +} + diff --git a/app/src/main/java/sq/rogue/rosettadrone/util.java b/app/src/main/java/sq/rogue/rosettadrone/util.java new file mode 100644 index 0000000..e43344d --- /dev/null +++ b/app/src/main/java/sq/rogue/rosettadrone/util.java @@ -0,0 +1,23 @@ +package sq.rogue.rosettadrone; + +public class util { + + public static long getTimestampMicroseconds() { + return System.currentTimeMillis() / 10; + } + + public static long getTimestampMilliseconds() { + return System.currentTimeMillis(); + } + + public static long getTimestampSeconds() { + return System.currentTimeMillis() / 1000; + } + + public static void safeSleep(int millis) { + try { + Thread.sleep(millis); + } catch (InterruptedException e) { + } + } +} diff --git a/app/src/main/java/sq/rogue/rosettadrone/video/AbstractPacketizer.java b/app/src/main/java/sq/rogue/rosettadrone/video/AbstractPacketizer.java new file mode 100755 index 0000000..58bb83c --- /dev/null +++ b/app/src/main/java/sq/rogue/rosettadrone/video/AbstractPacketizer.java @@ -0,0 +1,172 @@ +/* + * Copyright (C) 2011-2015 GUIGUI Simon, fyhertz@gmail.com + * + * This file is part of libstreaming (https://github.com/fyhertz/libstreaming) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sq.rogue.rosettadrone.video; + +import java.io.IOException; +import java.io.InputStream; +import java.net.InetAddress; +import java.util.Random; + +/** + * Each packetizer inherits from this one and therefore uses RTP and UDP. + */ +abstract public class AbstractPacketizer { + + protected static final int rtphl = RtpSocket.RTP_HEADER_LENGTH; + + // Maximum size of RTP packets + protected final static int MAXPACKETSIZE = RtpSocket.MTU - 28; + + protected RtpSocket socket = null; + protected InputStream is = null; + protected byte[] buffer; + + protected long ts = 0; + + public AbstractPacketizer() { + int ssrc = new Random().nextInt(); + ts = new Random().nextInt(); + socket = new RtpSocket(); + socket.setSSRC(ssrc); + } + + public RtpSocket getRtpSocket() { + return socket; + } + + public void setSSRC(int ssrc) { + socket.setSSRC(ssrc); + } + + public int getSSRC() { + return socket.getSSRC(); + } + + public void setInputStream(InputStream is) { + this.is = is; + } + + public void setTimeToLive(int ttl) throws IOException { + socket.setTimeToLive(ttl); + } + + /** + * Sets the destination of the stream. + * + * @param dest The destination address of the stream + * @param rtpPort Destination port that will be used for RTP + * @param rtcpPort Destination port that will be used for RTCP + */ + public void setDestination(InetAddress dest, int rtpPort, int rtcpPort) { + socket.setDestination(dest, rtpPort, rtcpPort); + } + + /** + * Starts the packetizer. + */ + public abstract void start(); + + /** + * Stops the packetizer. + */ + public abstract void stop(); + + /** + * Updates data for RTCP SR and sends the packet. + */ + protected void send(int length) throws IOException { + socket.commitBuffer(length); + } + + /** + * For debugging purposes. + */ + protected static String printBuffer(byte[] buffer, int start, int end) { + String str = ""; + for (int i = start; i < end; i++) str += "," + Integer.toHexString(buffer[i] & 0xFF); + return str; + } + + /** + * Used in packetizers to estimate timestamps in RTP packets. + */ + protected static class Statistics { + + public final static String TAG = "Statistics"; + + private int count = 700, c = 0; + private float m = 0, q = 0; + private long elapsed = 0; + private long start = 0; + private long duration = 0; + private long period = 10000000000L; + private boolean initoffset = false; + + public Statistics() { + } + + public Statistics(int count, int period) { + this.count = count; + this.period = period; + } + + public void reset() { + initoffset = false; + q = 0; + m = 0; + c = 0; + elapsed = 0; + start = 0; + duration = 0; + } + + public void push(long value) { + elapsed += value; + if (elapsed > period) { + elapsed = 0; + long now = System.nanoTime(); + if (!initoffset || (now - start < 0)) { + start = now; + duration = 0; + initoffset = true; + } + // Prevents drifting issues by comparing the real duration of the + // stream with the sum of all temporal lengths of RTP packets. + value += (now - start) - duration; + //Log.d(TAG, "sum1: "+duration/1000000+" sum2: "+(now-start)/1000000+" drift: "+((now-start)-duration)/1000000+" v: "+value/1000000); + } + if (c < 5) { + // We ignore the first 20 measured values because they may not be accurate + c++; + m = value; + } else { + m = (m * q + value) / (q + 1); + if (q < count) q++; + } + } + + public long average() { + long l = (long) m; + duration += l; + return l; + } + + } + +} diff --git a/app/src/main/java/sq/rogue/rosettadrone/video/DJIVideoStreamDecoder.java b/app/src/main/java/sq/rogue/rosettadrone/video/DJIVideoStreamDecoder.java new file mode 100644 index 0000000..e16fa2b --- /dev/null +++ b/app/src/main/java/sq/rogue/rosettadrone/video/DJIVideoStreamDecoder.java @@ -0,0 +1,752 @@ +package sq.rogue.rosettadrone.video; + +import android.annotation.TargetApi; +import android.content.Context; +import android.media.MediaCodec; +import android.media.MediaCodecInfo; +import android.media.MediaFormat; +import android.os.Build; +import android.os.Handler; +import android.os.HandlerThread; +import android.os.Message; +import android.util.Log; +import android.view.Surface; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.ByteBuffer; +import java.util.LinkedList; +import java.util.Queue; +import java.util.concurrent.ArrayBlockingQueue; + +import dji.common.product.Model; +import dji.log.DJILog; +import dji.midware.data.model.P3.DataCameraGetPushStateInfo; +import dji.sdk.base.BaseProduct; +import dji.sdk.sdkmanager.DJISDKManager; +import sq.rogue.rosettadrone.R; + +/** + * This class is a helper class for hardware decoding. Please follow the following steps to use it: + * <p> + * 1. Initialize and set the instance as a listener of NativeDataListener to receive the frame data. + * <p> + * 2. Send the raw data from camera to ffmpeg for frame parsing. + * <p> + * 3. Get the parsed frame data from ffmpeg parsing frame callback and cache the parsed framed data into the frameQueue. + * <p> + * 4. Initialize the MediaCodec as a decoder and then check whether there is any i-frame in the MediaCodec. If not, get + * the default i-frame from sdk resource and insert it at the head of frameQueue. Then dequeue the framed data from the + * frameQueue and feed it(which is Byte buffer) into the MediaCodec. + * <p> + * 5. Get the output byte buffer from MediaCodec, if a surface(Video Previewing View) is configured in the MediaCodec, + * the output byte buffer is only need to be released. If not, the output yuv data should invoke the callback and pass + * it out to external listener, it should also be released too. + * <p> + * 6. Release the ffmpeg and the MediaCodec, stop the decoding thread. + */ +public class DJIVideoStreamDecoder implements NativeHelper.NativeDataListener { + private static final String TAG = DJIVideoStreamDecoder.class.getSimpleName(); + private static final int BUF_QUEUE_SIZE = 30; + private static final int MSG_INIT_CODEC = 0; + private static final int MSG_FRAME_QUEUE_IN = 1; + private static final int MSG_DECODE_FRAME = 2; + private static final int MSG_YUV_DATA = 3; + public static final String VIDEO_ENCODING_FORMAT = "video/avc"; + private HandlerThread handlerThreadNew; + private Handler handlerNew; + private final boolean DEBUG = false; + private static DJIVideoStreamDecoder instance; + private Queue<DJIFrame> frameQueue; + private HandlerThread dataHandlerThread; + private Handler dataHandler; + private Context context; + private MediaCodec codec; + private Surface surface; + + public int frameIndex = -1; + private long currentTime; + public int width; + public int height; + private boolean hasIFrameInQueue = false; + MediaCodec.BufferInfo bufferInfo = new MediaCodec.BufferInfo(); + LinkedList<Long> bufferChangedQueue = new LinkedList<Long>(); + + private long createTime; + + public interface IYuvDataListener { + /** + * Callback method for processing the yuv frame data from hardware decoder. + * + * @param yuvFrame + * @param width + * @param height + */ + void onYuvDataReceived(byte[] yuvFrame, int width, int height); + } + + public interface IFrameDataListener { + void onFrameDataReceived(byte[] frame, int width, int height); + } + + /** + * Set the yuv frame data receiving callback. The callback method will be invoked when the decoder + * output yuv frame data. What should be noted here is that the hardware decoder would not output + * any yuv data if a surface is configured into, which mean that if you want the yuv frames, you + * should set "null" surface when calling the "configure" method of MediaCodec. + * + * @param yuvDataListener + */ + public void setYuvDataListener(IYuvDataListener yuvDataListener) { + this.yuvDataListener = yuvDataListener; + } + + public void setFrameDataListener(IFrameDataListener frameDataListener) { + this.frameDataListener = frameDataListener; + } + + private IYuvDataListener yuvDataListener; + private IFrameDataListener frameDataListener; + + /** + * A data structure for containing the frames. + */ + private static class DJIFrame { + public byte[] videoBuffer; + public int size; + public long pts; + public long incomingTimeMs; + public long fedIntoCodecTime; + public long codecOutputTime; + public boolean isKeyFrame; + public int frameNum; + public long frameIndex; + public int width; + public int height; + + public DJIFrame(byte[] videoBuffer, int size, long pts, long incomingTimeUs, boolean isKeyFrame, + int frameNum, long frameIndex, int width, int height) { + this.videoBuffer = videoBuffer; + this.size = size; + this.pts = pts; + this.incomingTimeMs = incomingTimeUs; + this.isKeyFrame = isKeyFrame; + this.frameNum = frameNum; + this.frameIndex = frameIndex; + this.width = width; + this.height = height; + } + + public long getQueueDelay() { + return fedIntoCodecTime - incomingTimeMs; + } + + public long getDecodingDelay() { + return codecOutputTime - fedIntoCodecTime; + } + + public long getTotalDelay() { + return codecOutputTime - fedIntoCodecTime; + } + } + + private void logd(String tag, String log) { + if (!DEBUG) { + return; + } + Log.d(tag, log); + } + + private void loge(String tag, String log) { + if (!DEBUG) { + return; + } + Log.e(tag, log); + } + + private void logd(String log) { + logd(TAG, log); + } + + private void loge(String log) { + loge(TAG, log); + } + + private DJIVideoStreamDecoder() { + createTime = System.currentTimeMillis(); + frameQueue = new ArrayBlockingQueue<DJIFrame>(BUF_QUEUE_SIZE); + startDataHandler(); + handlerThreadNew = new HandlerThread("native parser thread"); + handlerThreadNew.start(); + handlerNew = new Handler(handlerThreadNew.getLooper(), new Handler.Callback() { + @Override + public boolean handleMessage(Message msg) { + byte[] buf = (byte[]) msg.obj; + NativeHelper.getInstance().parse(buf, msg.arg1); + return false; + } + }); + } + + + public static DJIVideoStreamDecoder getInstance() { + if (instance == null) { + instance = new DJIVideoStreamDecoder(); + } + return instance; + } + + /** + * Initialize the decoder + * + * @param context The application context + * @param surface The displaying surface for the video stream. What should be noted here is that the hardware decoder would not output + * any yuv data if a surface is configured into, which mean that if you want the yuv frames, you + * should set "null" surface when calling the "configure" method of MediaCodec. + */ + public void init(Context context, Surface surface) { + this.context = context; + this.surface = surface; + NativeHelper.getInstance().setDataListener(this); + if (dataHandler != null && !dataHandler.hasMessages(MSG_INIT_CODEC)) { + dataHandler.sendEmptyMessage(MSG_INIT_CODEC); + } + } + + /** + * Framing the raw data from the camera. + * + * @param buf Raw data from camera. + * @param size Data length + */ + public void parse(byte[] buf, int size) { + Message message = handlerNew.obtainMessage(); + message.obj = buf; + message.arg1 = size; + handlerNew.sendMessage(message); + } + + /** + * Get the resource ID of the IDR frame. + * + * @param pModel Product model of connecting DJI product. + * @param width Width of current video stream. + * @return Resource ID of the IDR frame + */ + public int getIframeRawId(Model pModel, int width) { + int iframeId = R.raw.iframe_1280x720_ins; + + switch (pModel) { + case PHANTOM_3_ADVANCED: + case PHANTOM_3_STANDARD: + if (width == 960) { + //for photo mode, 960x720, GDR + iframeId = R.raw.iframe_960x720_3s; + } else { + //for record mode, 1280x720, GDR + iframeId = R.raw.iframe_1280x720_3s; + } + break; + + case Phantom_3_4K: + switch (width) { + case 640: + //for P3-4K with resolution 640*480 + iframeId = R.raw.iframe_640x480; + break; + case 848: + //for P3-4K with resolution 848*480 + iframeId = R.raw.iframe_848x480; + break; + default: + iframeId = R.raw.iframe_1280x720_3s; + break; + } + break; + + case OSMO_PRO: + case OSMO: + iframeId = -1; + break; + + case PHANTOM_4: + iframeId = R.raw.iframe_1280x720_p4; + break; + case PHANTOM_4_PRO: // p4p + switch (width) { + case 1280: + iframeId = R.raw.iframe_p4p_720_16x9; + break; + case 960: + iframeId = R.raw.iframe_p4p_720_4x3; + break; + case 1088: + iframeId = R.raw.iframe_p4p_720_3x2; + break; + case 1344: + iframeId = R.raw.iframe_p4p_1344x720; + break; + default: + iframeId = R.raw.iframe_p4p_720_16x9; + break; + } + break; + case INSPIRE_2: //inspire2 + DataCameraGetPushStateInfo.CameraType cameraType = DataCameraGetPushStateInfo.getInstance().getCameraType(); + if (cameraType == DataCameraGetPushStateInfo.CameraType.DJICameraTypeGD600) { + iframeId = R.raw.iframe_1080x720_gd600; + } else { + if (width == 640 && height == 368) { + DJILog.i(TAG, "Selected Iframe=iframe_640x368_wm620"); + iframeId = R.raw.iframe_640x368_wm620; + } + if (width == 608 && height == 448) { + DJILog.i(TAG, "Selected Iframe=iframe_608x448_wm620"); + iframeId = R.raw.iframe_608x448_wm620; + } else if (width == 720 && height == 480) { + DJILog.i(TAG, "Selected Iframe=iframe_720x480_wm620"); + iframeId = R.raw.iframe_720x480_wm620; + } else if (width == 1280 && height == 720) { + DJILog.i(TAG, "Selected Iframe=iframe_1280x720_wm620"); + iframeId = R.raw.iframe_1280x720_wm620; + } else if (width == 1080 && height == 720) { + DJILog.i(TAG, "Selected Iframe=iframe_1080x720_wm620"); + iframeId = R.raw.iframe_1080x720_wm620; + } else if (width == 960 && height == 720) { + DJILog.i(TAG, "Selected Iframe=iframe_960x720_wm620"); + iframeId = R.raw.iframe_960x720_wm620; + } else if (width == 1360 && height == 720) { + DJILog.i(TAG, "Selected Iframe=iframe_1360x720_wm620"); + iframeId = R.raw.iframe_1360x720_wm620; + } else if (width == 1344 && height == 720) { + DJILog.i(TAG, "Selected Iframe=iframe_1344x720_wm620"); + iframeId = R.raw.iframe_1344x720_wm620; + } else if (width == 1760 && height == 720) { + DJILog.i(TAG, "Selected Iframe=iframe_1760x720_wm620"); + iframeId = R.raw.iframe_1760x720_wm620; + } else if (width == 1920 && height == 800) { + DJILog.i(TAG, "Selected Iframe=iframe_1920x800_wm620"); + iframeId = R.raw.iframe_1920x800_wm620; + } else if (width == 1920 && height == 1024) { + DJILog.i(TAG, "Selected Iframe=iframe_1920x1024_wm620"); + iframeId = R.raw.iframe_1920x1024_wm620; + } else if (width == 1920 && height == 1088) { + DJILog.i(TAG, "Selected Iframe=iframe_1920x1080_wm620"); + iframeId = R.raw.iframe_1920x1088_wm620; + } else if (width == 1920 && height == 1440) { + DJILog.i(TAG, "Selected Iframe=iframe_1920x1440_wm620"); + iframeId = R.raw.iframe_1920x1440_wm620; + } + } + break; + default: //for P3P, Inspire1, etc/ + iframeId = R.raw.iframe_1280x720_ins; + break; + } + return iframeId; + } + + /** + * Get default black IDR frame. + * + * @param width Width of current video stream. + * @return IDR frame data + * @throws IOException + */ + private byte[] getDefaultKeyFrame(int width) throws IOException { + BaseProduct product = DJISDKManager.getInstance().getProduct(); + if (product == null || product.getModel() == null) { + return null; + } + int iframeId = getIframeRawId(product.getModel(), width); + if (iframeId >= 0) { + + InputStream inputStream = context.getResources().openRawResource(iframeId); + int length = inputStream.available(); + logd("iframeId length=" + length); + byte[] buffer = new byte[length]; + inputStream.read(buffer); + inputStream.close(); + + return buffer; + } + return null; + } + + + /** + * Initialize the hardware decoder. + */ + private void initCodec() { + if (width == 0 || height == 0) { + return; + } + if (codec != null) { + releaseCodec(); + } + loge("initVideoDecoder----------------------------------------------------------"); + loge("initVideoDecoder video width = " + width + " height = " + height); + // create the media format + MediaFormat format = MediaFormat.createVideoFormat(VIDEO_ENCODING_FORMAT, width, height); + if (surface == null) { + logd("initVideoDecoder: yuv output"); + // The surface is null, which means that the yuv data is needed, so the color format should + // be set to YUV420. + format.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Planar); + } else { + logd("initVideoDecoder: display"); + // The surface is set, so the color format should be set to format surface. + format.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface); + } + try { + // Create the codec instance. + codec = MediaCodec.createDecoderByType(VIDEO_ENCODING_FORMAT); + logd("initVideoDecoder create: " + (codec == null)); + // Configure the codec. What should be noted here is that the hardware decoder would not output + // any yuv data if a surface is configured into, which mean that if you want the yuv frames, you + // should set "null" surface when calling the "configure" method of MediaCodec. + codec.configure(format, surface, null, 0); + logd("initVideoDecoder configure"); + // codec.configure(format, null, null, 0); + if (codec == null) { + loge("Can't find video info!"); + return; + } + // Start the codec + codec.start(); + } catch (Exception e) { + loge("init codec failed, do it again: " + e); + if (e instanceof MediaCodec.CodecException) { + MediaCodec.CodecException ce = (MediaCodec.CodecException) e; + } + e.printStackTrace(); + } + } + + private void startDataHandler() { + if (dataHandlerThread != null && dataHandlerThread.isAlive()) { + return; + } + dataHandlerThread = new HandlerThread("frame data handler thread"); + dataHandlerThread.start(); + dataHandler = new Handler(dataHandlerThread.getLooper()) { + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case MSG_INIT_CODEC: + try { + initCodec(); + } catch (Exception e) { + loge("init codec error: " + e.getMessage()); + e.printStackTrace(); + } + + removeCallbacksAndMessages(null); + sendEmptyMessageDelayed(MSG_DECODE_FRAME, 1); + break; + case MSG_FRAME_QUEUE_IN: + try { + onFrameQueueIn(msg); + } catch (Exception e) { + loge("queue in frame error: " + e); + e.printStackTrace(); + } + + if (!hasMessages(MSG_DECODE_FRAME)) { + sendEmptyMessage(MSG_DECODE_FRAME); + } + break; + case MSG_DECODE_FRAME: + try { + decodeFrame(); + } catch (Exception e) { + loge("handle frame error: " + e); + if (e instanceof MediaCodec.CodecException) { + } + e.printStackTrace(); + initCodec(); + } finally { + if (frameQueue.size() > 0) { + sendEmptyMessage(MSG_DECODE_FRAME); + } + } + break; + case MSG_YUV_DATA: + if (yuvDataListener != null) { + yuvDataListener.onYuvDataReceived((byte[]) msg.obj, msg.arg1, msg.arg2); + } + break; + default: + break; + } + } + }; + } + + /** + * Stop the data processing thread + */ + private void stopDataHandler() { + if (dataHandlerThread == null || !dataHandlerThread.isAlive()) { + return; + } + if (dataHandler != null) { + dataHandler.removeCallbacksAndMessages(null); + } + if (Build.VERSION.SDK_INT >= 18) { + dataHandlerThread.quitSafely(); + } else { + dataHandlerThread.quit(); + } + + try { + dataHandlerThread.join(3000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + releaseCodec(); + dataHandler = null; + } + + /** + * Change the displaying surface of the decoder. What should be noted here is that the hardware decoder would not output + * any yuv data if a surface is configured into, which mean that if you want the yuv frames, you + * should set "null" surface when calling the "configure" method of MediaCodec. + * + * @param surface + */ + public void changeSurface(Surface surface) { + if (this.surface != surface) { + this.surface = surface; + if (dataHandler != null && !dataHandler.hasMessages(MSG_INIT_CODEC)) { + dataHandler.sendEmptyMessage(MSG_INIT_CODEC); + } + } + } + + /** + * Release and close the codec. + */ + private void releaseCodec() { + if (frameQueue != null) { + frameQueue.clear(); + hasIFrameInQueue = false; + } + if (codec != null) { + try { + codec.flush(); + } catch (Exception e) { + loge("flush codec error: " + e.getMessage()); + } + + try { + codec.stop(); + codec.release(); + } catch (Exception e) { + loge("close codec error: " + e.getMessage()); + } finally { + codec = null; + } + } + } + + /** + * Queue in the frame. + * + * @param msg + */ + private void onFrameQueueIn(Message msg) { + DJIFrame inputFrame = (DJIFrame) msg.obj; + if (inputFrame == null) { + return; + } + if (!hasIFrameInQueue) { // check the I frame flag + if (inputFrame.frameNum != 1 && !inputFrame.isKeyFrame) { + loge("the timing for setting iframe has not yet come."); + return; + } + byte[] defaultKeyFrame = null; + try { + defaultKeyFrame = getDefaultKeyFrame(inputFrame.width); // Get I frame data + } catch (IOException e) { + loge("get default key frame error: " + e.getMessage()); + } + if (defaultKeyFrame != null) { + DJIFrame iFrame = new DJIFrame( + defaultKeyFrame, + defaultKeyFrame.length, + inputFrame.pts, + System.currentTimeMillis(), + inputFrame.isKeyFrame, + 0, + inputFrame.frameIndex - 1, + inputFrame.width, + inputFrame.height + ); + frameQueue.clear(); + frameQueue.offer(iFrame); // Queue in the I frame. + logd("add iframe success!!!!"); + hasIFrameInQueue = true; + } else if (inputFrame.isKeyFrame) { + logd("onFrameQueueIn no need add i frame!!!!"); + hasIFrameInQueue = true; + } else { + loge("input key frame failed"); + } + } + if (inputFrame.width != 0 && inputFrame.height != 0 && + inputFrame.width != this.width && + inputFrame.height != this.height) { + this.width = inputFrame.width; + this.height = inputFrame.height; + /* + * On some devices, the codec supports changing of resolution during the fly + * However, on some devices, that is not the case. + * So, reset the codec in order to fix this issue. + */ + loge("init decoder for the 1st time or when resolution changes"); + if (dataHandler != null && !dataHandler.hasMessages(MSG_INIT_CODEC)) { + dataHandler.sendEmptyMessage(MSG_INIT_CODEC); + } + } + // Queue in the input frame. + if (this.frameQueue.offer(inputFrame)) { + logd("put a frame into the Extended-Queue with index=" + inputFrame.frameIndex); + } else { + // If the queue is full, drop a frame. + DJIFrame dropFrame = frameQueue.poll(); + this.frameQueue.offer(inputFrame); + loge("Drop a frame with index=" + dropFrame.frameIndex + " and append a frame with index=" + inputFrame.frameIndex); + } + } + + /** + * Dequeue the frames from the queue and decode them using the hardware decoder. + * + * @throws Exception + */ + @TargetApi(Build.VERSION_CODES.LOLLIPOP) + private void decodeFrame() throws Exception { + DJIFrame inputFrame = frameQueue.poll(); + if (inputFrame == null) { + return; + } + if (codec == null) { + if (dataHandler != null && !dataHandler.hasMessages(MSG_INIT_CODEC)) { + dataHandler.sendEmptyMessage(MSG_INIT_CODEC); + } + return; + } + + int inIndex = codec.dequeueInputBuffer(0); + + // Decode the frame using MediaCodec + if (inIndex >= 0) { + //Log.d(TAG, "decodeFrame: index=" + inIndex); + ByteBuffer buffer = codec.getInputBuffer(inIndex); + buffer.put(inputFrame.videoBuffer); + inputFrame.fedIntoCodecTime = System.currentTimeMillis(); + long queueingDelay = inputFrame.getQueueDelay(); + // Feed the frame data to the decoder. + codec.queueInputBuffer(inIndex, 0, inputFrame.size, inputFrame.pts, 0); + + // Get the output data from the decoder. + int outIndex = codec.dequeueOutputBuffer(bufferInfo, 0); + + if (outIndex >= 0) { + //Log.d(TAG, "decodeFrame: outIndex: " + outIndex); + if (surface == null && yuvDataListener != null) { + // If the surface is null, the yuv data should be get from the buffer and invoke the callback. + logd("decodeFrame: need callback"); + ByteBuffer yuvDataBuf = codec.getOutputBuffer(outIndex); + yuvDataBuf.position(bufferInfo.offset); + yuvDataBuf.limit(bufferInfo.size - bufferInfo.offset); + byte[] bytes = new byte[bufferInfo.size - bufferInfo.offset]; + yuvDataBuf.get(bytes); + Message message = dataHandler.obtainMessage(); + message.obj = bytes; + message.arg1 = width; + message.arg2 = height; + message.what = MSG_YUV_DATA; + dataHandler.sendMessage(message); + } + // All the output buffer must be release no matter whether the yuv data is output or + // not, so that the codec can reuse the buffer. + codec.releaseOutputBuffer(outIndex, true); + } else if (outIndex == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) { + // The output buffer set is changed. So the decoder should be reinitialized and the + // output buffers should be retrieved. + long curTime = System.currentTimeMillis(); + bufferChangedQueue.addLast(curTime); + if (bufferChangedQueue.size() >= 10) { + long headTime = bufferChangedQueue.pollFirst(); + if (curTime - headTime < 1000) { + // reset decoder + loge("Reset decoder. Get INFO_OUTPUT_BUFFERS_CHANGED more than 10 times within a second."); + bufferChangedQueue.clear(); + dataHandler.removeCallbacksAndMessages(null); + dataHandler.sendEmptyMessage(MSG_INIT_CODEC); + return; + } + } + } else if (outIndex == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) { + loge("format changed, color: " + codec.getOutputFormat().getInteger(MediaFormat.KEY_COLOR_FORMAT)); + } + } else { + codec.flush(); + } + } + + /** + * Stop the decoding process. + */ + public void stop() { + if (dataHandler != null) { + dataHandler.removeCallbacksAndMessages(null); + } + + if (frameQueue != null) { + frameQueue.clear(); + hasIFrameInQueue = false; + } + if (codec != null) { + try { + codec.flush(); + } catch (IllegalStateException e) { + } + } + stopDataHandler(); + } + + public void resume() { + startDataHandler(); + } + + public void destroy() { + } + + @Override + public void onDataRecv(byte[] data, int size, int frameNum, boolean isKeyFrame, int width, int height) { + if (dataHandler == null || dataHandlerThread == null || !dataHandlerThread.isAlive()) { + return; + } + if (data.length != size) { + loge("recv data size: " + size + ", data lenght: " + data.length); + } else { + logd("recv data size: " + size + ", frameNum: " + frameNum + ", isKeyframe: " + isKeyFrame + "," + + " width: " + width + ", height: " + height); + currentTime = System.currentTimeMillis(); + frameIndex++; + DJIFrame newFrame = new DJIFrame(data, size, currentTime, currentTime, isKeyFrame, + frameNum, frameIndex, width, height); + + // ADDED + if (frameDataListener != null) + frameDataListener.onFrameDataReceived(data, width, height); + + dataHandler.obtainMessage(MSG_FRAME_QUEUE_IN, newFrame).sendToTarget(); + + } + } +} \ No newline at end of file diff --git a/app/src/main/java/sq/rogue/rosettadrone/video/H264Packetizer.java b/app/src/main/java/sq/rogue/rosettadrone/video/H264Packetizer.java new file mode 100755 index 0000000..fdf9835 --- /dev/null +++ b/app/src/main/java/sq/rogue/rosettadrone/video/H264Packetizer.java @@ -0,0 +1,289 @@ +/* + * Copyright (C) 2011-2015 GUIGUI Simon, fyhertz@gmail.com + * + * This file is part of libstreaming (https://github.com/fyhertz/libstreaming) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sq.rogue.rosettadrone.video; + +import android.annotation.SuppressLint; +import android.util.Log; + +import java.io.IOException; +import java.net.InetAddress; + +/** + * RFC 3984. + * <p> + * H.264 streaming over RTP. + * <p> + * Must be fed with an InputStream containing H.264 NAL units preceded by their length (4 bytes). + * The stream must start with mpeg4 or 3gpp header, it will be skipped. + */ +public class H264Packetizer extends AbstractPacketizer implements Runnable { + + public final static String TAG = "H264Packetizer"; + + private Thread t = null; + private int naluLength = 0; + private long delay = 0, oldtime = 0; + private Statistics stats = new Statistics(); + private byte[] sps = null, pps = null, stapa = null; + byte[] header = new byte[5]; + private int count = 0; + private int streamType = 1; + + + public H264Packetizer() { + super(); + socket.setClockFrequency(90000); + try { + socket.setDestination(InetAddress.getByName("127.0.0.1"), 5601, 5000); + Log.d(TAG, "socket address configured"); + } catch (IOException e) { + Log.d(TAG, "error setting socket", e); + } + } + + public void start() { + Log.d(TAG, "start()"); + if (t == null) { + t = new Thread(this); + t.start(); + } + } + + public void stop() { + if (t != null) { + try { + is.close(); + } catch (IOException e) { + } + t.interrupt(); + try { + t.join(); + } catch (InterruptedException e) { + } + t = null; + } + } + + public void setStreamParameters(byte[] pps, byte[] sps) { + this.pps = pps; + this.sps = sps; + + // A STAP-A NAL (NAL type 24) containing the sps and pps of the stream + if (pps != null && sps != null) { + // STAP-A NAL header + NALU 1 (SPS) size + NALU 2 (PPS) size = 5 bytes + stapa = new byte[sps.length + pps.length + 5]; + + // STAP-A NAL header is 24 + stapa[0] = 24; + + // Write NALU 1 size into the array (NALU 1 is the SPS). + stapa[1] = (byte) (sps.length >> 8); + stapa[2] = (byte) (sps.length & 0xFF); + + // Write NALU 2 size into the array (NALU 2 is the PPS). + stapa[sps.length + 3] = (byte) (pps.length >> 8); + stapa[sps.length + 4] = (byte) (pps.length & 0xFF); + + // Write NALU 1 into the array, then write NALU 2 into the array. + System.arraycopy(sps, 0, stapa, 3, sps.length); + System.arraycopy(pps, 0, stapa, 5 + sps.length, pps.length); + } + } + + public void run() { + } + + public void run2() { + long duration = 0; + stats.reset(); + count = 0; + streamType = 1; + socket.setCacheSize(0); + + try { + while (is.available() > 0) { + oldtime = System.nanoTime(); + // We read a NAL units from the input stream and we send them + send(); + // We measure how long it took to receive NAL units from the phone + duration = System.nanoTime() - oldtime; + + stats.push(duration); + // Computes the average duration of a NAL unit + delay = stats.average(); + //Log.d(TAG,"duration: "+duration/1000000+" delay: "+delay/1000000); + } + } catch (IOException e) { + Log.d(TAG, "exception", e); + } catch (InterruptedException e) { + Log.d(TAG, "exception", e); + } + } + + /** + * Reads a NAL unit in the FIFO and sends it. + * If it is too big, we split it in FU-A units (RFC 3984). + */ + @SuppressLint("NewApi") + private void send() throws IOException, InterruptedException { + int sum = 1, len = 0, type; + + if (streamType == 0) { + // NAL units are preceeded by their length, we parse the length + fill(header, 0, 5); + ts += delay; + naluLength = header[3] & 0xFF | (header[2] & 0xFF) << 8 | (header[1] & 0xFF) << 16 | (header[0] & 0xFF) << 24; + if (naluLength > 100000 || naluLength < 0) resync(); + } else if (streamType == 1) { + // NAL units are preceeded with 0x00000001 + fill(header, 0, 5); + //ts = ((MediaCodecInputStream)is).getLastBufferInfo().presentationTimeUs*1000L; + ts = System.currentTimeMillis() * 1000L; + //ts += delay; + naluLength = is.available() + 1; + if (!(header[0] == 0 && header[1] == 0 && header[2] == 0)) { + // Turns out, the NAL units are not preceeded with 0x00000001 + Log.e(TAG, "NAL units are not preceeded by 0x00000001"); + streamType = 2; + return; + } + } else { + // Nothing preceededs the NAL units + fill(header, 0, 1); + header[4] = header[0]; + //ts = ((MediaCodecInputStream)is).getLastBufferInfo().presentationTimeUs*1000L; + ts = System.currentTimeMillis() * 1000L; + //ts += delay; + naluLength = is.available() + 1; + } + + // Parses the NAL unit type + type = header[4] & 0x1F; + + + // The stream already contains NAL unit type 7 or 8, we don't need + // to add them to the stream ourselves + if (type == 7 || type == 8) { + Log.v(TAG, "SPS or PPS present in the stream."); + count++; + if (count > 4) { + sps = null; + pps = null; + } + } + + // We send two packets containing NALU type 7 (SPS) and 8 (PPS) + // Those should allow the H264 stream to be decoded even if no SDP was sent to the decoder. + if (type == 5 && sps != null && pps != null) { + buffer = socket.requestBuffer(); + socket.markNextPacket(); + socket.updateTimestamp(ts); + System.arraycopy(stapa, 0, buffer, rtphl, stapa.length); + super.send(rtphl + stapa.length); + } + + //Log.d(TAG,"- Nal unit length: " + naluLength + " delay: "+delay/1000000+" type: "+type); + + // Small NAL unit => Single NAL unit + if (naluLength <= MAXPACKETSIZE - rtphl - 2) { + buffer = socket.requestBuffer(); + buffer[rtphl] = header[4]; + len = fill(buffer, rtphl + 1, naluLength - 1); + socket.updateTimestamp(ts); + socket.markNextPacket(); + super.send(naluLength + rtphl); + //Log.d(TAG,"----- Single NAL unit - len:"+len+" delay: "+delay); + } + // Large NAL unit => Split nal unit + else { + + // Set FU-A header + header[1] = (byte) (header[4] & 0x1F); // FU header type + header[1] += 0x80; // Start bit + // Set FU-A indicator + header[0] = (byte) ((header[4] & 0x60) & 0xFF); // FU indicator NRI + header[0] += 28; + + while (sum < naluLength) { + buffer = socket.requestBuffer(); + buffer[rtphl] = header[0]; + buffer[rtphl + 1] = header[1]; + socket.updateTimestamp(ts); + if ((len = fill(buffer, rtphl + 2, naluLength - sum > MAXPACKETSIZE - rtphl - 2 ? MAXPACKETSIZE - rtphl - 2 : naluLength - sum)) < 0) + return; + sum += len; + // Last packet before next NAL + if (sum >= naluLength) { + // End bit on + buffer[rtphl + 1] += 0x40; + socket.markNextPacket(); + } + super.send(len + rtphl + 2); + // Switch start bit + header[1] = (byte) (header[1] & 0x7F); + //Log.d(TAG,"----- FU-A unit, sum:"+sum); + } + } + } + + private int fill(byte[] buffer, int offset, int length) throws IOException { + int sum = 0, len; + while (sum < length) { + len = is.read(buffer, offset + sum, length - sum); + if (len < 0) { + throw new IOException("End of stream"); + } else sum += len; + } + return sum; + } + + private void resync() throws IOException { + int type; + + Log.e(TAG, "Packetizer out of sync ! Let's try to fix that...(NAL length: " + naluLength + ")"); + + while (true) { + + header[0] = header[1]; + header[1] = header[2]; + header[2] = header[3]; + header[3] = header[4]; + header[4] = (byte) is.read(); + + type = header[4] & 0x1F; + + if (type == 5 || type == 1) { + naluLength = header[3] & 0xFF | (header[2] & 0xFF) << 8 | (header[1] & 0xFF) << 16 | (header[0] & 0xFF) << 24; + if (naluLength > 0 && naluLength < 100000) { + oldtime = System.nanoTime(); + Log.e(TAG, "A NAL unit may have been found in the bit stream !"); + break; + } + if (naluLength == 0) { + Log.e(TAG, "NAL unit with NULL size found..."); + } else if (header[3] == 0xFF && header[2] == 0xFF && header[1] == 0xFF && header[0] == 0xFF) { + Log.e(TAG, "NAL unit with 0xFFFFFFFF size found..."); + } + } + + } + + } + +} diff --git a/app/src/main/java/sq/rogue/rosettadrone/video/MediaCodecInputStream.java b/app/src/main/java/sq/rogue/rosettadrone/video/MediaCodecInputStream.java new file mode 100755 index 0000000..3f6d89f --- /dev/null +++ b/app/src/main/java/sq/rogue/rosettadrone/video/MediaCodecInputStream.java @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2011-2015 GUIGUI Simon, fyhertz@gmail.com + * + * This file is part of libstreaming (https://github.com/fyhertz/libstreaming) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sq.rogue.rosettadrone.video; + +import android.annotation.SuppressLint; +import android.media.MediaCodec; +import android.media.MediaCodec.BufferInfo; +import android.media.MediaFormat; +import android.util.Log; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.ByteBuffer; + +/** + * An InputStream that uses data from a MediaCodec. + * The purpose of this class is to interface existing RTP packetizers of + * libstreaming with the new MediaCodec API. This class is not thread safe ! + */ +@SuppressLint("NewApi") +public class MediaCodecInputStream extends InputStream { + + public final String TAG = "MediaCodecInputStream"; + + private MediaCodec mMediaCodec = null; + private BufferInfo mBufferInfo = new BufferInfo(); + private ByteBuffer[] mBuffers = null; + private ByteBuffer mBuffer = null; + private int mIndex = -1; + private boolean mClosed = false; + + public MediaFormat mMediaFormat; + + public MediaCodecInputStream(MediaCodec mediaCodec) { + mMediaCodec = mediaCodec; + mBuffers = mMediaCodec.getOutputBuffers(); + } + + @Override + public void close() { + mClosed = true; + } + + @Override + public int read() throws IOException { + return 0; + } + + @Override + public int read(byte[] buffer, int offset, int length) throws IOException { + int min = 0; + + try { + if (mBuffer == null) { + while (!Thread.interrupted() && !mClosed) { + mIndex = mMediaCodec.dequeueOutputBuffer(mBufferInfo, 500000); + if (mIndex >= 0) { + //Log.d(TAG,"Index: "+mIndex+" Time: "+mBufferInfo.presentationTimeUs+" size: "+mBufferInfo.size); + mBuffer = mBuffers[mIndex]; + mBuffer.position(0); + break; + } else if (mIndex == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) { + mBuffers = mMediaCodec.getOutputBuffers(); + } else if (mIndex == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) { + mMediaFormat = mMediaCodec.getOutputFormat(); + Log.i(TAG, mMediaFormat.toString()); + } else if (mIndex == MediaCodec.INFO_TRY_AGAIN_LATER) { + Log.v(TAG, "No buffer available..."); + //return 0; + } else { + Log.e(TAG, "Message: " + mIndex); + //return 0; + } + } + } + + if (mClosed) throw new IOException("This InputStream was closed"); + + min = length < mBufferInfo.size - mBuffer.position() ? length : mBufferInfo.size - mBuffer.position(); + mBuffer.get(buffer, offset, min); + if (mBuffer.position() >= mBufferInfo.size) { + mMediaCodec.releaseOutputBuffer(mIndex, false); + mBuffer = null; + } + + } catch (RuntimeException e) { + e.printStackTrace(); + } + + return min; + } + + public int available() { + if (mBuffer != null) + return mBufferInfo.size - mBuffer.position(); + else + return 0; + } + + public BufferInfo getLastBufferInfo() { + return mBufferInfo; + } + +} diff --git a/app/src/main/java/sq/rogue/rosettadrone/video/NativeHelper.java b/app/src/main/java/sq/rogue/rosettadrone/video/NativeHelper.java new file mode 100644 index 0000000..9052e3d --- /dev/null +++ b/app/src/main/java/sq/rogue/rosettadrone/video/NativeHelper.java @@ -0,0 +1,98 @@ +package sq.rogue.rosettadrone.video; + +/** + * A helper class to invoke native methods + */ +public class NativeHelper { + + public static final String TAG = NativeHelper.class.getSimpleName(); + + public interface NativeDataListener { + /** + * Callback method for receiving the frame data from NativeHelper. + * Note that this method will be invoke in framing thread, which means time consuming + * processing should not in this thread, or the framing process will be blocked. + * + * @param data + * @param size + * @param frameNum + * @param isKeyFrame + * @param width + * @param height + */ + void onDataRecv(byte[] data, int size, int frameNum, boolean isKeyFrame, int width, int height); + } + + private NativeDataListener dataListener; + + public void setDataListener(NativeDataListener dataListener) { + this.dataListener = dataListener; + } + //JNI + + /** + * Test the ffmpeg. + * + * @return + */ + public native String codecinfotest(); + + /** + * Initialize the ffmpeg. + * + * @return + */ + public native boolean init(); + + + /** + * Framing the raw data from camera + * + * @param buf + * @param size + * @return + */ + public native boolean parse(byte[] buf, int size); + + + /** + * Release the ffmpeg + * + * @return + */ + public native boolean release(); + + static { + System.loadLibrary("ffmpeg"); + System.loadLibrary("djivideojni"); + } + + private static NativeHelper instance; + + public static NativeHelper getInstance() { + if (instance == null) { + instance = new NativeHelper(); + } + return instance; + } + + private NativeHelper() { + } + + /** + * Invoke by JNI + * Callback the frame data. + * + * @param buf + * @param size + * @param frameNum + * @param isKeyFrame + * @param width + * @param height + */ + public void onFrameDataRecv(byte[] buf, int size, int frameNum, boolean isKeyFrame, int width, int height) { + if (dataListener != null) { + dataListener.onDataRecv(buf, size, frameNum, isKeyFrame, width, height); + } + } +} diff --git a/app/src/main/java/sq/rogue/rosettadrone/video/RtpSocket.java b/app/src/main/java/sq/rogue/rosettadrone/video/RtpSocket.java new file mode 100755 index 0000000..483d702 --- /dev/null +++ b/app/src/main/java/sq/rogue/rosettadrone/video/RtpSocket.java @@ -0,0 +1,484 @@ +/* + * Copyright (C) 2011-2015 GUIGUI Simon, fyhertz@gmail.com + * + * This file is part of libstreaming (https://github.com/fyhertz/libstreaming) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sq.rogue.rosettadrone.video; + +import android.os.SystemClock; +import android.util.Log; + +import java.io.IOException; +import java.io.OutputStream; +import java.net.DatagramPacket; +import java.net.InetAddress; +import java.net.MulticastSocket; +import java.util.concurrent.Semaphore; +import java.util.concurrent.TimeUnit; + +/** + * A basic implementation of an RTP socket. + * It implements a buffering mechanism, relying on a FIFO of buffers and a Thread. + * That way, if a packetizer tries to send many packets too quickly, the FIFO will + * grow and packets will be sent one by one smoothly. + */ +public class RtpSocket implements Runnable { + + public static final String TAG = "RtpSocket"; + + /** + * Use this to use UDP for the transport protocol. + */ + public final static int TRANSPORT_UDP = 0x00; + + /** + * Use this to use TCP for the transport protocol. + */ + public final static int TRANSPORT_TCP = 0x01; + + public static final int RTP_HEADER_LENGTH = 12; + public static final int MTU = 1300; + + private MulticastSocket mSocket; + private DatagramPacket[] mPackets; + private byte[][] mBuffers; + private long[] mTimestamps; + + //private SenderReport mReport; + + private Semaphore mBufferRequested, mBufferCommitted; + private Thread mThread; + + private int mTransport; + private long mCacheSize; + private long mClock = 0; + private long mOldTimestamp = 0; + private int mSsrc, mSeq = 0, mPort = -1; + private int mBufferCount, mBufferIn, mBufferOut; + private int mCount = 0; + private byte mTcpHeader[]; + protected OutputStream mOutputStream = null; + + private AverageBitrate mAverageBitrate; + + /** + * This RTP socket implements a buffering mechanism relying on a FIFO of buffers and a Thread. + * + * @throws IOException + */ + public RtpSocket() { + + mCacheSize = 0; + mBufferCount = 300; // TODO: readjust that when the FIFO is full + mBuffers = new byte[mBufferCount][]; + mPackets = new DatagramPacket[mBufferCount]; + //mReport = new SenderReport(); + mAverageBitrate = new AverageBitrate(); + mTransport = TRANSPORT_UDP; + mTcpHeader = new byte[]{'$', 0, 0, 0}; + + resetFifo(); + + for (int i = 0; i < mBufferCount; i++) { + + mBuffers[i] = new byte[MTU]; + mPackets[i] = new DatagramPacket(mBuffers[i], 1); + + /* Version(2) Padding(0) */ + /* ^ ^ Extension(0) */ + /* | | ^ */ + /* | -------- | */ + /* | |--------------------- */ + /* | || -----------------------> Source Identifier(0) */ + /* | || | */ + mBuffers[i][0] = (byte) Integer.parseInt("10000000", 2); + + /* Payload Type */ + mBuffers[i][1] = (byte) 96; + + /* Byte 2,3 -> Sequence Number */ + /* Byte 4,5,6,7 -> Timestamp */ + /* Byte 8,9,10,11 -> Sync Source Identifier */ + + } + + try { + mSocket = new MulticastSocket(); + } catch (Exception e) { + throw new RuntimeException(e.getMessage()); + } + + } + + private void resetFifo() { + mCount = 0; + mBufferIn = 0; + mBufferOut = 0; + mTimestamps = new long[mBufferCount]; + mBufferRequested = new Semaphore(mBufferCount); + mBufferCommitted = new Semaphore(0); + //mReport.reset(); + mAverageBitrate.reset(); + } + + /** + * Closes the underlying socket. + */ + public void close() { + mSocket.close(); + } + + /** + * Sets the SSRC of the stream. + */ + public void setSSRC(int ssrc) { + this.mSsrc = ssrc; + for (int i = 0; i < mBufferCount; i++) { + setLong(mBuffers[i], ssrc, 8, 12); + } + //mReport.setSSRC(mSsrc); + } + + /** + * Returns the SSRC of the stream. + */ + public int getSSRC() { + return mSsrc; + } + + /** + * Sets the clock frequency of the stream in Hz. + */ + public void setClockFrequency(long clock) { + mClock = clock; + } + + /** + * Sets the size of the FIFO in ms. + */ + public void setCacheSize(long cacheSize) { + mCacheSize = cacheSize; + } + + /** + * Sets the Time To Live of the UDP packets. + */ + public void setTimeToLive(int ttl) throws IOException { + mSocket.setTimeToLive(ttl); + } + + /** + * Sets the destination address and to which the packets will be sent. + */ + public void setDestination(InetAddress dest, int dport, int rtcpPort) { + if (dport != 0 && rtcpPort != 0) { + mTransport = TRANSPORT_UDP; + mPort = dport; + for (int i = 0; i < mBufferCount; i++) { + mPackets[i].setPort(dport); + mPackets[i].setAddress(dest); + } + //mReport.setDestination(dest, rtcpPort); + } + } + + /** + * If a TCP is used as the transport protocol for the RTP session, + * the output stream to which RTP packets will be written to must + * be specified with this method. + */ + public void setOutputStream(OutputStream outputStream, byte channelIdentifier) { + if (outputStream != null) { + mTransport = TRANSPORT_TCP; + mOutputStream = outputStream; + mTcpHeader[1] = channelIdentifier; + //mReport.setOutputStream(outputStream, (byte) (channelIdentifier+1)); + } + } + + public int getPort() { + return mPort; + } + + public int[] getLocalPorts() { + return new int[]{ + mSocket.getLocalPort(), + //mReport.getLocalPort() + }; + + } + + /** + * Returns an available buffer from the FIFO, it can then be modified. + * Call {@link #commitBuffer(int)} to send it over the network. + * + * @throws InterruptedException + **/ + public byte[] requestBuffer() throws InterruptedException { + mBufferRequested.acquire(); + mBuffers[mBufferIn][1] &= 0x7F; + return mBuffers[mBufferIn]; + } + + /** + * Puts the buffer back into the FIFO without sending the packet. + */ + public void commitBuffer() throws IOException { + + if (mThread == null) { + mThread = new Thread(this); + mThread.start(); + } + + if (++mBufferIn >= mBufferCount) mBufferIn = 0; + mBufferCommitted.release(); + + } + + /** + * Sends the RTP packet over the network. + */ + public void commitBuffer(int length) throws IOException { + updateSequence(); + mPackets[mBufferIn].setLength(length); + + mAverageBitrate.push(length); + + if (++mBufferIn >= mBufferCount) mBufferIn = 0; + mBufferCommitted.release(); + + if (mThread == null) { + mThread = new Thread(this); + mThread.start(); + } + + } + + /** + * Returns an approximation of the bitrate of the RTP stream in bits per second. + */ + public long getBitrate() { + return mAverageBitrate.average(); + } + + /** + * Increments the sequence number. + */ + private void updateSequence() { + setLong(mBuffers[mBufferIn], ++mSeq, 2, 4); + } + + /** + * Overwrites the timestamp in the packet. + * + * @param timestamp The new timestamp in ns. + **/ + public void updateTimestamp(long timestamp) { + mTimestamps[mBufferIn] = timestamp; + setLong(mBuffers[mBufferIn], (timestamp / 100L) * (mClock / 1000L) / 10000L, 4, 8); + } + + /** + * Sets the marker in the RTP packet. + */ + public void markNextPacket() { + mBuffers[mBufferIn][1] |= 0x80; + } + + /** + * The Thread sends the packets in the FIFO one by one at a constant rate. + */ + @Override + public void run() { + Statistics stats = new Statistics(50, 3000); + try { + // Caches mCacheSize milliseconds of the stream in the FIFO. + Thread.sleep(mCacheSize); + long delta = 0; + while (mBufferCommitted.tryAcquire(4, TimeUnit.SECONDS)) { + if (mOldTimestamp != 0) { + // We use our knowledge of the clock rate of the stream and the difference between two timestamps to + // compute the time lapse that the packet represents. + if ((mTimestamps[mBufferOut] - mOldTimestamp) > 0) { + stats.push(mTimestamps[mBufferOut] - mOldTimestamp); + long d = stats.average() / 1000000; + //Log.d(TAG,"delay: "+d+" d: "+(mTimestamps[mBufferOut]-mOldTimestamp)/1000000); + // We ensure that packets are sent at a constant and suitable rate no matter how the RtpSocket is used. + if (mCacheSize > 0) Thread.sleep(d); + } else if ((mTimestamps[mBufferOut] - mOldTimestamp) < 0) { + Log.e(TAG, "TS: " + mTimestamps[mBufferOut] + " OLD: " + mOldTimestamp); + } + delta += mTimestamps[mBufferOut] - mOldTimestamp; + if (delta > 500000000 || delta < 0) { + //Log.d(TAG,"permits: "+mBufferCommitted.availablePermits()); + delta = 0; + } + } + //mReport.update(mPackets[mBufferOut].getLength(), (mTimestamps[mBufferOut]/100L)*(mClock/1000L)/10000L); + mOldTimestamp = mTimestamps[mBufferOut]; + if (mCount++ > 30) { + if (mTransport == TRANSPORT_UDP) { + mSocket.send(mPackets[mBufferOut]); + } else { + sendTCP(); + } + } + if (++mBufferOut >= mBufferCount) mBufferOut = 0; + mBufferRequested.release(); + } + } catch (Exception e) { + e.printStackTrace(); + } + mThread = null; + resetFifo(); + } + + private void sendTCP() { + synchronized (mOutputStream) { + int len = mPackets[mBufferOut].getLength(); + Log.d(TAG, "sent " + len); + mTcpHeader[2] = (byte) (len >> 8); + mTcpHeader[3] = (byte) (len & 0xFF); + try { + mOutputStream.write(mTcpHeader); + mOutputStream.write(mBuffers[mBufferOut], 0, len); + } catch (Exception e) { + } + } + } + + private void setLong(byte[] buffer, long n, int begin, int end) { + for (end--; end >= begin; end--) { + buffer[end] = (byte) (n % 256); + n >>= 8; + } + } + + /** + * Computes an average bit rate. + **/ + protected static class AverageBitrate { + + private final static long RESOLUTION = 200; + + private long mOldNow, mNow, mDelta; + private long[] mElapsed, mSum; + private int mCount, mIndex, mTotal; + private int mSize; + + public AverageBitrate() { + mSize = 5000 / ((int) RESOLUTION); + reset(); + } + + public AverageBitrate(int delay) { + mSize = delay / ((int) RESOLUTION); + reset(); + } + + public void reset() { + mSum = new long[mSize]; + mElapsed = new long[mSize]; + mNow = SystemClock.elapsedRealtime(); + mOldNow = mNow; + mCount = 0; + mDelta = 0; + mTotal = 0; + mIndex = 0; + } + + public void push(int length) { + mNow = SystemClock.elapsedRealtime(); + if (mCount > 0) { + mDelta += mNow - mOldNow; + mTotal += length; + if (mDelta > RESOLUTION) { + mSum[mIndex] = mTotal; + mTotal = 0; + mElapsed[mIndex] = mDelta; + mDelta = 0; + mIndex++; + if (mIndex >= mSize) mIndex = 0; + } + } + mOldNow = mNow; + mCount++; + } + + public int average() { + long delta = 0, sum = 0; + for (int i = 0; i < mSize; i++) { + sum += mSum[i]; + delta += mElapsed[i]; + } + //Log.d(TAG, "Time elapsed: "+delta); + return (int) (delta > 0 ? 8000 * sum / delta : 0); + } + + } + + /** + * Computes the proper rate at which packets are sent. + */ + protected static class Statistics { + + public final static String TAG = "Statistics"; + + private int count = 500, c = 0; + private float m = 0, q = 0; + private long elapsed = 0; + private long start = 0; + private long duration = 0; + private long period = 6000000000L; + private boolean initoffset = false; + + public Statistics(int count, long period) { + this.count = count; + this.period = period * 1000000L; + } + + public void push(long value) { + duration += value; + elapsed += value; + if (elapsed > period) { + elapsed = 0; + long now = System.nanoTime(); + if (!initoffset || (now - start < 0)) { + start = now; + duration = 0; + initoffset = true; + } + value -= (now - start) - duration; + //Log.d(TAG, "sum1: "+duration/1000000+" sum2: "+(now-start)/1000000+" drift: "+((now-start)-duration)/1000000+" v: "+value/1000000); + } + if (c < 40) { + // We ignore the first 40 measured values because they may not be accurate + c++; + m = value; + } else { + m = (m * q + value) / (q + 1); + if (q < count) q++; + } + } + + public long average() { + long l = (long) m - 2000000; + return l > 0 ? l : 0; + } + + } + +} diff --git a/app/src/main/res/drawable-hdpi/ic_settings_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_settings_white_24dp.png new file mode 100644 index 0000000..97ded33 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_settings_white_24dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_settings_white_24dp.png b/app/src/main/res/drawable-mdpi/ic_settings_white_24dp.png new file mode 100644 index 0000000..8909c35 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_settings_white_24dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_settings_white_24dp.png b/app/src/main/res/drawable-xhdpi/ic_settings_white_24dp.png new file mode 100644 index 0000000..5caedc8 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_settings_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_settings_white_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_settings_white_24dp.png new file mode 100644 index 0000000..eabb0a2 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_settings_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_settings_white_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_settings_white_24dp.png new file mode 100644 index 0000000..507c5ed Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_settings_white_24dp.png differ diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..d17a4e3 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + tools:context="sq.rogue.rosettadrone.MainActivity"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <ToggleButton + android:id="@+id/toggBtnEnablerArming" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textOn="Arming Enabled" + android:textOff="Arming Disabled" + android:gravity="center" + android:textColor="@color/colorRed" + /> + + <Button + android:id="@+id/button_clear" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Clear Log"/> + + </LinearLayout> + + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + </LinearLayout> + + <android.support.design.widget.TabLayout + android:id="@+id/tab_layout" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@+id/toolbar" + android:background="?attr/colorPrimary" + android:elevation="6dp" + android:minHeight="?attr/actionBarSize" + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/> + + <android.support.v4.view.ViewPager + android:id="@+id/pager" + android:layout_width="match_parent" + android:layout_height="fill_parent" + android:layout_below="@id/tab_layout"/> + + +</LinearLayout> diff --git a/app/src/main/res/layout/fragment_log.xml b/app/src/main/res/layout/fragment_log.xml new file mode 100644 index 0000000..46f33ad --- /dev/null +++ b/app/src/main/res/layout/fragment_log.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <ScrollView + android:id="@+id/textAreaScrollerTraffic" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" + android:scrollbars="vertical"> + + <HorizontalScrollView + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <TextView + android:id="@+id/textView_traffic" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:scrollHorizontally="true" + android:ellipsize="start" + android:text="" + /> + </HorizontalScrollView> + </ScrollView> + +</LinearLayout> \ No newline at end of file diff --git a/app/src/main/res/menu/menu_toolbar.xml b/app/src/main/res/menu/menu_toolbar.xml new file mode 100644 index 0000000..51a46f3 --- /dev/null +++ b/app/src/main/res/menu/menu_toolbar.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools"> + <item + android:id="@+id/action_dji" + android:orderInCategory="200" + app:showAsAction="always" + android:title="DJI"/> + <item + android:id="@+id/action_gcs" + android:orderInCategory="300" + app:showAsAction="always" + android:title="GCS"/> + <item + android:id="@+id/action_settings" + android:orderInCategory="400" + app:showAsAction="always" + android:title="Settings" + android:icon="@drawable/ic_settings_white_24dp"/> + +</menu> \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..19e00be Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..9a078e3 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..a147752 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..efc028a Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..95cd6f4 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..3af2608 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..7374014 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..9bec2e6 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..8420807 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..34947cd Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..09033f2 --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <color name="colorPrimary">#3F51B5</color> + <color name="colorPrimaryDark">#303F9F</color> + <color name="colorAccent">#FF4081</color> + <color name="colorRed">#FF0000</color> + <color name="colorGreen">#00FF00</color> +</resources> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..0414bcc --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,6 @@ +<resources> + <string name="app_name">Rosetta Drone</string> + <string name="pref_gcs_ip">GCS IP Address</string> + <string name="pref_telem_port">Telemetry Port</string> + <string name="pref_video_port">Video Port</string> +</resources> diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..5885930 --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,11 @@ +<resources> + + <!-- Base application theme. --> + <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> + <!-- Customize your theme here. --> + <item name="colorPrimary">@color/colorPrimary</item> + <item name="colorPrimaryDark">@color/colorPrimaryDark</item> + <item name="colorAccent">@color/colorAccent</item> + </style> + +</resources> diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml new file mode 100644 index 0000000..1864e1c --- /dev/null +++ b/app/src/main/res/xml/preferences.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> + <CheckBoxPreference + android:key="pref_external_gcs" + android:title="Use GCS on an external device" + android:defaultValue="false"/> + <EditTextPreference + android:key="pref_gcs_ip" + android:title="@string/pref_gcs_ip" + android:inputType="number" + android:digits="0123456789." + android:defaultValue="127.0.0.1" + android:dependency="pref_external_gcs"/> + <EditTextPreference + android:key="pref_telem_port" + android:title="@string/pref_telem_port" + android:numeric="integer" + android:defaultValue="14550"/> + <EditTextPreference + android:key="pref_video_port" + android:title="@string/pref_video_port" + android:numeric="integer" + android:defaultValue="5600"/> +</PreferenceScreen> \ No newline at end of file diff --git a/app/src/test/java/sq/rogue/rosettadrone/ExampleUnitTest.java b/app/src/test/java/sq/rogue/rosettadrone/ExampleUnitTest.java new file mode 100644 index 0000000..a7d1ae9 --- /dev/null +++ b/app/src/test/java/sq/rogue/rosettadrone/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package sq.rogue.rosettadrone; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..7e01a0a --- /dev/null +++ b/build.gradle @@ -0,0 +1,25 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + google() + } + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + google() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..f5cb7da --- /dev/null +++ b/gradle.properties @@ -0,0 +1,15 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx1536m +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +android.enableAapt2=false +android.useDeprecatedNdk=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..13372ae Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..9e17a55 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Nov 10 22:13:28 PST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..9d82f78 --- /dev/null +++ b/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..aec9973 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include ':app'