[
  {
    "path": ".appveyor.yml",
    "content": "version: \"{build}\"\r\n\r\nenvironment:\r\n  global:\r\n    HAXELIB_ROOT: C:\\projects\\haxelib\r\n\r\ncache:\r\n  - c:\\projects\\air\r\n\r\ninit:\r\n  - set AIR_SDK=c:\\projects\\air\r\n\r\ninstall:\r\n  # Chocolatey was failing trying to install some Windows updates..!?\r\n  # This fixes it somehow.\r\n  - ps: Set-Service wuauserv -StartupType Manual\r\n  - cinst -y php\r\n  # Appveyor doesn't get submodules by default.\r\n  - git submodule update --init --recursive\r\n  # Install the haxe chocolatey package (https://chocolatey.org/packages/haxe)\r\n  - cinst haxe --version 3.4.7 -y\r\n  # Install NSIS for installer generation.\r\n  - cinst nsis --version 3.02 -y\r\n  - RefreshEnv\r\n  # Setup haxelib\r\n  - mkdir \"%HAXELIB_ROOT%\"\r\n  - haxelib setup \"%HAXELIB_ROOT%\"\r\n  # Install project dependencies\r\n  # `> log.txt || type log.txt` is for muting the output unless there is an error\r\n  - haxelib install air3 > log.txt || type log.txt && cmd /C exit 1\r\n  - haxelib list\r\n  # Download and unzip Adobe AIR SDK if not cached.\r\n  - if not exist %AIR_SDK% (\r\n    curl -fsS -O https://airdownload.adobe.com/air/win/download/latest/AIRSDK_Compiler.zip &&\r\n    mkdir %AIR_SDK% &&\r\n    7z x -o%AIR_SDK% AIRSDK_Compiler.zip)\r\n\r\n# We don't use the build section, but do both build and \r\n# test in `test_script:`.\r\n# It is just because it is more similar to the TravisCI config,\r\n# thus it would be easier to update both of them.\r\nbuild: off\r\n\r\ntest_script:\r\n  # Build Swivel.swf.\r\n  - haxe Swivel.hxml\r\n  # Package AIR runtime.\r\n  - PackageApp.bat\r\n  # Build NSIS installer.\r\n  - set PATH=\"C:\\Program Files (x86)\\NSIS\";%PATH%\r\n  - makensis win-installer.nsi\r\n\r\nartifacts:\r\n  - path: swivel-win32.exe\r\n"
  },
  {
    "path": ".gitignore",
    "content": "/bin\r\n/obj\r\n/redirecter/ipch\r\n/redirecter/Debug\r\n/redirecter/Release\r\n/redirecter/redirecter/Debug\r\n/redirecter/redirecter/Release\r\nRECOVER_*.fla\r\nswivel*.exe\r\nSwivel.exe\r\n*.mp4\r\n*.opensdf\r\n*.sdf\r\n*.suo\r\n*.vcxproj.user\r\nThumbs.db\r\n"
  },
  {
    "path": ".gitmodules",
    "content": "[submodule \"lib/format\"]\n\tpath = lib/format\n\turl = https://github.com/Herschel/format\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: haxe\nos: osx\n\nenv:\n  - AIR_SDK=air_sdk HAXELIB_ROOT=haxelib\n\ncache:\n  directiories:\n  - air_sdk\n  - haxelib\n\ninstall:\n  # Setup haxelib and install libraries.\n  - mkdir $HAXELIB_ROOT\n  - haxelib setup $HAXELIB_ROOT\n  - yes | haxelib install Swivel.hxml\n\n  # Download and unzip the Adobe AIR SDK if not cached.\n  - test -f $AIR_SDK || (\n    curl -fsS -O https://airdownload.adobe.com/air/mac/download/latest/AIRSDK_Compiler.dmg &&\n    mkdir $AIR_SDK &&\n    hdiutil attach -noverify -mountpoint /Volumes/air AIRSDK_Compiler.dmg &&\n    cp -R /Volumes/air/* $AIR_SDK &&\n    hdiutil detach /Volumes/air)\n  - export PATH=$PATH:$AIR_SDK/bin\n\n  # Install appdmg node package.\n  - npm install -g appdmg@0.5.2\n\nscript:\n  # Run make to build package.\n  - make all\n\nhaxe:\n  - \"3.4.4\"\n  - development\n\nmatrix:\n  allow_failures:\n    - haxe: development\n\ndeploy:\n  provider: releases\n  api_key:\n    - secure: \"i0Fm7EmabkefgOfe/G6tUKwtnWonGugKMsyZognTlBJbqGkrsJMt34fSlqk7HnoG7B3P6FXbJDwGwunQWQx/AUDB2jyTec4Oawd6WJ8LhWs9KAPW5GiDWXJvJTLGdvCS1aFj62cs80XH6ipmCUpIx1nxvN+Vh24zxltjQyHShiAvjYOaxiQ5vfFYKaSTJB6MwfC/p4B5JXgcn9eioe2FZj4xR726Ug3YR7zQm7jc/f9NZL5c6Q34iAyBbKzNe6lMiypMaPtZQekQ/NrVqaVtTNeJnnbLRET09DLnSVPFiqKuBi2RiBYy2vJRXucaCCjlHx6FzgdR+m0l+9ExkQvmcaZn2SxamSfru6Kqd5jrbYZpMB1JlkI6xTnEih5PPuTZom5eOfsu4TsWTw4s7fXJccIYSZ3Lstym5XDpFAe2KmLf08RiLbqQ0QDQZPBvxGTJ9R0yORH6V8yft1N1OhZIFRvw+P24aJyh8+zJBQvqAKEZo4t/eJ5ftNp026lwNsBg1xKy+X39aOCQ+vTNnd8enJES/5yLmNN4howIfuD7eZdrpVKx/aXWapoceArRFJMO7KnSdw5/LmRF/UAzzgAWcInCOIQL9EK3gVd0pH5Nj3wLZgYu/tX9qFLNlgatCStoPX9axSbB6Znp6JDgGG3EqZcc1VGCozMWCEoTWw5jdUk=\"\n  file: \"bin/Swivel.dmg\"\n  skip_cleanup: true\n  on:\n    tags: true\n"
  },
  {
    "path": "LICENSE.md",
    "content": "GNU General Public License\n==========================\n\n_Version 3, 29 June 2007_  \n_Copyright © 2007 Free Software Foundation, Inc. &lt;<http://fsf.org/>&gt;_\n\nEveryone is permitted to copy and distribute verbatim copies of this license\ndocument, but changing it is not allowed.\n\n## Preamble\n\nThe GNU General Public License is a free, copyleft license for software and other\nkinds of works.\n\nThe licenses for most software and other practical works are designed to take away\nyour freedom to share and change the works. By contrast, the GNU General Public\nLicense is intended to guarantee your freedom to share and change all versions of a\nprogram--to make sure it remains free software for all its users. We, the Free\nSoftware Foundation, use the GNU General Public License for most of our software; it\napplies also to any other work released this way by its authors. You can apply it to\nyour programs, too.\n\nWhen we speak of free software, we are referring to freedom, not price. Our General\nPublic Licenses are designed to make sure that you have the freedom to distribute\ncopies of free software (and charge for them if you wish), that you receive source\ncode or can get it if you want it, that you can change the software or use pieces of\nit in new free programs, and that you know you can do these things.\n\nTo protect your rights, we need to prevent others from denying you these rights or\nasking you to surrender the rights. Therefore, you have certain responsibilities if\nyou distribute copies of the software, or if you modify it: responsibilities to\nrespect the freedom of others.\n\nFor example, if you distribute copies of such a program, whether gratis or for a fee,\nyou must pass on to the recipients the same freedoms that you received. You must make\nsure that they, too, receive or can get the source code. And you must show them these\nterms so they know their rights.\n\nDevelopers that use the GNU GPL protect your rights with two steps: **(1)** assert\ncopyright on the software, and **(2)** offer you this License giving you legal permission\nto copy, distribute and/or modify it.\n\nFor the developers' and authors' protection, the GPL clearly explains that there is\nno warranty for this free software. For both users' and authors' sake, the GPL\nrequires that modified versions be marked as changed, so that their problems will not\nbe attributed erroneously to authors of previous versions.\n\nSome devices are designed to deny users access to install or run modified versions of\nthe software inside them, although the manufacturer can do so. This is fundamentally\nincompatible with the aim of protecting users' freedom to change the software. The\nsystematic pattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable. Therefore, we have designed\nthis version of the GPL to prohibit the practice for those products. If such problems\narise substantially in other domains, we stand ready to extend this provision to\nthose domains in future versions of the GPL, as needed to protect the freedom of\nusers.\n\nFinally, every program is threatened constantly by software patents. States should\nnot allow patents to restrict development and use of software on general-purpose\ncomputers, but in those that do, we wish to avoid the special danger that patents\napplied to a free program could make it effectively proprietary. To prevent this, the\nGPL assures that patents cannot be used to render the program non-free.\n\nThe precise terms and conditions for copying, distribution and modification follow.\n\n## TERMS AND CONDITIONS\n\n### 0. Definitions\n\n“This License” refers to version 3 of the GNU General Public License.\n\n“Copyright” also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n“The Program” refers to any copyrightable work licensed under this\nLicense. Each licensee is addressed as “you”. “Licensees” and\n“recipients” may be individuals or organizations.\n\nTo “modify” a work means to copy from or adapt all or part of the work in\na fashion requiring copyright permission, other than the making of an exact copy. The\nresulting work is called a “modified version” of the earlier work or a\nwork “based on” the earlier work.\n\nA “covered work” means either the unmodified Program or a work based on\nthe Program.\n\nTo “propagate” a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for infringement under\napplicable copyright law, except executing it on a computer or modifying a private\ncopy. Propagation includes copying, distribution (with or without modification),\nmaking available to the public, and in some countries other activities as well.\n\nTo “convey” a work means any kind of propagation that enables other\nparties to make or receive copies. Mere interaction with a user through a computer\nnetwork, with no transfer of a copy, is not conveying.\n\nAn interactive user interface displays “Appropriate Legal Notices” to the\nextent that it includes a convenient and prominently visible feature that **(1)**\ndisplays an appropriate copyright notice, and **(2)** tells the user that there is no\nwarranty for the work (except to the extent that warranties are provided), that\nlicensees may convey the work under this License, and how to view a copy of this\nLicense. If the interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n### 1. Source Code\n\nThe “source code” for a work means the preferred form of the work for\nmaking modifications to it. “Object code” means any non-source form of a\nwork.\n\nA “Standard Interface” means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of interfaces\nspecified for a particular programming language, one that is widely used among\ndevelopers working in that language.\n\nThe “System Libraries” of an executable work include anything, other than\nthe work as a whole, that **(a)** is included in the normal form of packaging a Major\nComponent, but which is not part of that Major Component, and **(b)** serves only to\nenable use of the work with that Major Component, or to implement a Standard\nInterface for which an implementation is available to the public in source code form.\nA “Major Component”, in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system (if any) on which\nthe executable work runs, or a compiler used to produce the work, or an object code\ninterpreter used to run it.\n\nThe “Corresponding Source” for a work in object code form means all the\nsource code needed to generate, install, and (for an executable work) run the object\ncode and to modify the work, including scripts to control those activities. However,\nit does not include the work's System Libraries, or general-purpose tools or\ngenerally available free programs which are used unmodified in performing those\nactivities but which are not part of the work. For example, Corresponding Source\nincludes interface definition files associated with source files for the work, and\nthe source code for shared libraries and dynamically linked subprograms that the work\nis specifically designed to require, such as by intimate data communication or\ncontrol flow between those subprograms and other parts of the work.\n\nThe Corresponding Source need not include anything that users can regenerate\nautomatically from other parts of the Corresponding Source.\n\nThe Corresponding Source for a work in source code form is that same work.\n\n### 2. Basic Permissions\n\nAll rights granted under this License are granted for the term of copyright on the\nProgram, and are irrevocable provided the stated conditions are met. This License\nexplicitly affirms your unlimited permission to run the unmodified Program. The\noutput from running a covered work is covered by this License only if the output,\ngiven its content, constitutes a covered work. This License acknowledges your rights\nof fair use or other equivalent, as provided by copyright law.\n\nYou may make, run and propagate covered works that you do not convey, without\nconditions so long as your license otherwise remains in force. You may convey covered\nworks to others for the sole purpose of having them make modifications exclusively\nfor you, or provide you with facilities for running those works, provided that you\ncomply with the terms of this License in conveying all material for which you do not\ncontrol copyright. Those thus making or running the covered works for you must do so\nexclusively on your behalf, under your direction and control, on terms that prohibit\nthem from making any copies of your copyrighted material outside their relationship\nwith you.\n\nConveying under any other circumstances is permitted solely under the conditions\nstated below. Sublicensing is not allowed; section 10 makes it unnecessary.\n\n### 3. Protecting Users' Legal Rights From Anti-Circumvention Law\n\nNo covered work shall be deemed part of an effective technological measure under any\napplicable law fulfilling obligations under article 11 of the WIPO copyright treaty\nadopted on 20 December 1996, or similar laws prohibiting or restricting circumvention\nof such measures.\n\nWhen you convey a covered work, you waive any legal power to forbid circumvention of\ntechnological measures to the extent such circumvention is effected by exercising\nrights under this License with respect to the covered work, and you disclaim any\nintention to limit operation or modification of the work as a means of enforcing,\nagainst the work's users, your or third parties' legal rights to forbid circumvention\nof technological measures.\n\n### 4. Conveying Verbatim Copies\n\nYou may convey verbatim copies of the Program's source code as you receive it, in any\nmedium, provided that you conspicuously and appropriately publish on each copy an\nappropriate copyright notice; keep intact all notices stating that this License and\nany non-permissive terms added in accord with section 7 apply to the code; keep\nintact all notices of the absence of any warranty; and give all recipients a copy of\nthis License along with the Program.\n\nYou may charge any price or no price for each copy that you convey, and you may offer\nsupport or warranty protection for a fee.\n\n### 5. Conveying Modified Source Versions\n\nYou may convey a work based on the Program, or the modifications to produce it from\nthe Program, in the form of source code under the terms of section 4, provided that\nyou also meet all of these conditions:\n\n* **a)** The work must carry prominent notices stating that you modified it, and giving a\nrelevant date.\n* **b)** The work must carry prominent notices stating that it is released under this\nLicense and any conditions added under section 7. This requirement modifies the\nrequirement in section 4 to “keep intact all notices”.\n* **c)** You must license the entire work, as a whole, under this License to anyone who\ncomes into possession of a copy. This License will therefore apply, along with any\napplicable section 7 additional terms, to the whole of the work, and all its parts,\nregardless of how they are packaged. This License gives no permission to license the\nwork in any other way, but it does not invalidate such permission if you have\nseparately received it.\n* **d)** If the work has interactive user interfaces, each must display Appropriate Legal\nNotices; however, if the Program has interactive interfaces that do not display\nAppropriate Legal Notices, your work need not make them do so.\n\nA compilation of a covered work with other separate and independent works, which are\nnot by their nature extensions of the covered work, and which are not combined with\nit such as to form a larger program, in or on a volume of a storage or distribution\nmedium, is called an “aggregate” if the compilation and its resulting\ncopyright are not used to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit. Inclusion of a covered work in an aggregate\ndoes not cause this License to apply to the other parts of the aggregate.\n\n### 6. Conveying Non-Source Forms\n\nYou may convey a covered work in object code form under the terms of sections 4 and\n5, provided that you also convey the machine-readable Corresponding Source under the\nterms of this License, in one of these ways:\n\n* **a)** Convey the object code in, or embodied in, a physical product (including a\nphysical distribution medium), accompanied by the Corresponding Source fixed on a\ndurable physical medium customarily used for software interchange.\n* **b)** Convey the object code in, or embodied in, a physical product (including a\nphysical distribution medium), accompanied by a written offer, valid for at least\nthree years and valid for as long as you offer spare parts or customer support for\nthat product model, to give anyone who possesses the object code either **(1)** a copy of\nthe Corresponding Source for all the software in the product that is covered by this\nLicense, on a durable physical medium customarily used for software interchange, for\na price no more than your reasonable cost of physically performing this conveying of\nsource, or **(2)** access to copy the Corresponding Source from a network server at no\ncharge.\n* **c)** Convey individual copies of the object code with a copy of the written offer to\nprovide the Corresponding Source. This alternative is allowed only occasionally and\nnoncommercially, and only if you received the object code with such an offer, in\naccord with subsection 6b.\n* **d)** Convey the object code by offering access from a designated place (gratis or for\na charge), and offer equivalent access to the Corresponding Source in the same way\nthrough the same place at no further charge. You need not require recipients to copy\nthe Corresponding Source along with the object code. If the place to copy the object\ncode is a network server, the Corresponding Source may be on a different server\n(operated by you or a third party) that supports equivalent copying facilities,\nprovided you maintain clear directions next to the object code saying where to find\nthe Corresponding Source. Regardless of what server hosts the Corresponding Source,\nyou remain obligated to ensure that it is available for as long as needed to satisfy\nthese requirements.\n* **e)** Convey the object code using peer-to-peer transmission, provided you inform\nother peers where the object code and Corresponding Source of the work are being\noffered to the general public at no charge under subsection 6d.\n\nA separable portion of the object code, whose source code is excluded from the\nCorresponding Source as a System Library, need not be included in conveying the\nobject code work.\n\nA “User Product” is either **(1)** a “consumer product”, which\nmeans any tangible personal property which is normally used for personal, family, or\nhousehold purposes, or **(2)** anything designed or sold for incorporation into a\ndwelling. In determining whether a product is a consumer product, doubtful cases\nshall be resolved in favor of coverage. For a particular product received by a\nparticular user, “normally used” refers to a typical or common use of\nthat class of product, regardless of the status of the particular user or of the way\nin which the particular user actually uses, or expects or is expected to use, the\nproduct. A product is a consumer product regardless of whether the product has\nsubstantial commercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n“Installation Information” for a User Product means any methods,\nprocedures, authorization keys, or other information required to install and execute\nmodified versions of a covered work in that User Product from a modified version of\nits Corresponding Source. The information must suffice to ensure that the continued\nfunctioning of the modified object code is in no case prevented or interfered with\nsolely because modification has been made.\n\nIf you convey an object code work under this section in, or with, or specifically for\nuse in, a User Product, and the conveying occurs as part of a transaction in which\nthe right of possession and use of the User Product is transferred to the recipient\nin perpetuity or for a fixed term (regardless of how the transaction is\ncharacterized), the Corresponding Source conveyed under this section must be\naccompanied by the Installation Information. But this requirement does not apply if\nneither you nor any third party retains the ability to install modified object code\non the User Product (for example, the work has been installed in ROM).\n\nThe requirement to provide Installation Information does not include a requirement to\ncontinue to provide support service, warranty, or updates for a work that has been\nmodified or installed by the recipient, or for the User Product in which it has been\nmodified or installed. Access to a network may be denied when the modification itself\nmaterially and adversely affects the operation of the network or violates the rules\nand protocols for communication across the network.\n\nCorresponding Source conveyed, and Installation Information provided, in accord with\nthis section must be in a format that is publicly documented (and with an\nimplementation available to the public in source code form), and must require no\nspecial password or key for unpacking, reading or copying.\n\n### 7. Additional Terms\n\n“Additional permissions” are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions. Additional\npermissions that are applicable to the entire Program shall be treated as though they\nwere included in this License, to the extent that they are valid under applicable\nlaw. If additional permissions apply only to part of the Program, that part may be\nused separately under those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\nWhen you convey a copy of a covered work, you may at your option remove any\nadditional permissions from that copy, or from any part of it. (Additional\npermissions may be written to require their own removal in certain cases when you\nmodify the work.) You may place additional permissions on material, added by you to a\ncovered work, for which you have or can give appropriate copyright permission.\n\nNotwithstanding any other provision of this License, for material you add to a\ncovered work, you may (if authorized by the copyright holders of that material)\nsupplement the terms of this License with terms:\n\n* **a)** Disclaiming warranty or limiting liability differently from the terms of\nsections 15 and 16 of this License; or\n* **b)** Requiring preservation of specified reasonable legal notices or author\nattributions in that material or in the Appropriate Legal Notices displayed by works\ncontaining it; or\n* **c)** Prohibiting misrepresentation of the origin of that material, or requiring that\nmodified versions of such material be marked in reasonable ways as different from the\noriginal version; or\n* **d)** Limiting the use for publicity purposes of names of licensors or authors of the\nmaterial; or\n* **e)** Declining to grant rights under trademark law for use of some trade names,\ntrademarks, or service marks; or\n* **f)** Requiring indemnification of licensors and authors of that material by anyone\nwho conveys the material (or modified versions of it) with contractual assumptions of\nliability to the recipient, for any liability that these contractual assumptions\ndirectly impose on those licensors and authors.\n\nAll other non-permissive additional terms are considered “further\nrestrictions” within the meaning of section 10. If the Program as you received\nit, or any part of it, contains a notice stating that it is governed by this License\nalong with a term that is a further restriction, you may remove that term. If a\nlicense document contains a further restriction but permits relicensing or conveying\nunder this License, you may add to a covered work material governed by the terms of\nthat license document, provided that the further restriction does not survive such\nrelicensing or conveying.\n\nIf you add terms to a covered work in accord with this section, you must place, in\nthe relevant source files, a statement of the additional terms that apply to those\nfiles, or a notice indicating where to find the applicable terms.\n\nAdditional terms, permissive or non-permissive, may be stated in the form of a\nseparately written license, or stated as exceptions; the above requirements apply\neither way.\n\n### 8. Termination\n\nYou may not propagate or modify a covered work except as expressly provided under\nthis License. Any attempt otherwise to propagate or modify it is void, and will\nautomatically terminate your rights under this License (including any patent licenses\ngranted under the third paragraph of section 11).\n\nHowever, if you cease all violation of this License, then your license from a\nparticular copyright holder is reinstated **(a)** provisionally, unless and until the\ncopyright holder explicitly and finally terminates your license, and **(b)** permanently,\nif the copyright holder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\nMoreover, your license from a particular copyright holder is reinstated permanently\nif the copyright holder notifies you of the violation by some reasonable means, this\nis the first time you have received notice of violation of this License (for any\nwork) from that copyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\nTermination of your rights under this section does not terminate the licenses of\nparties who have received copies or rights from you under this License. If your\nrights have been terminated and not permanently reinstated, you do not qualify to\nreceive new licenses for the same material under section 10.\n\n### 9. Acceptance Not Required for Having Copies\n\nYou are not required to accept this License in order to receive or run a copy of the\nProgram. Ancillary propagation of a covered work occurring solely as a consequence of\nusing peer-to-peer transmission to receive a copy likewise does not require\nacceptance. However, nothing other than this License grants you permission to\npropagate or modify any covered work. These actions infringe copyright if you do not\naccept this License. Therefore, by modifying or propagating a covered work, you\nindicate your acceptance of this License to do so.\n\n### 10. Automatic Licensing of Downstream Recipients\n\nEach time you convey a covered work, the recipient automatically receives a license\nfrom the original licensors, to run, modify and propagate that work, subject to this\nLicense. You are not responsible for enforcing compliance by third parties with this\nLicense.\n\nAn “entity transaction” is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an organization, or\nmerging organizations. If propagation of a covered work results from an entity\ntransaction, each party to that transaction who receives a copy of the work also\nreceives whatever licenses to the work the party's predecessor in interest had or\ncould give under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if the predecessor\nhas it or can get it with reasonable efforts.\n\nYou may not impose any further restrictions on the exercise of the rights granted or\naffirmed under this License. For example, you may not impose a license fee, royalty,\nor other charge for exercise of rights granted under this License, and you may not\ninitiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging\nthat any patent claim is infringed by making, using, selling, offering for sale, or\nimporting the Program or any portion of it.\n\n### 11. Patents\n\nA “contributor” is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based. The work thus\nlicensed is called the contributor's “contributor version”.\n\nA contributor's “essential patent claims” are all patent claims owned or\ncontrolled by the contributor, whether already acquired or hereafter acquired, that\nwould be infringed by some manner, permitted by this License, of making, using, or\nselling its contributor version, but do not include claims that would be infringed\nonly as a consequence of further modification of the contributor version. For\npurposes of this definition, “control” includes the right to grant patent\nsublicenses in a manner consistent with the requirements of this License.\n\nEach contributor grants you a non-exclusive, worldwide, royalty-free patent license\nunder the contributor's essential patent claims, to make, use, sell, offer for sale,\nimport and otherwise run, modify and propagate the contents of its contributor\nversion.\n\nIn the following three paragraphs, a “patent license” is any express\nagreement or commitment, however denominated, not to enforce a patent (such as an\nexpress permission to practice a patent or covenant not to sue for patent\ninfringement). To “grant” such a patent license to a party means to make\nsuch an agreement or commitment not to enforce a patent against the party.\n\nIf you convey a covered work, knowingly relying on a patent license, and the\nCorresponding Source of the work is not available for anyone to copy, free of charge\nand under the terms of this License, through a publicly available network server or\nother readily accessible means, then you must either **(1)** cause the Corresponding\nSource to be so available, or **(2)** arrange to deprive yourself of the benefit of the\npatent license for this particular work, or **(3)** arrange, in a manner consistent with\nthe requirements of this License, to extend the patent license to downstream\nrecipients. “Knowingly relying” means you have actual knowledge that, but\nfor the patent license, your conveying the covered work in a country, or your\nrecipient's use of the covered work in a country, would infringe one or more\nidentifiable patents in that country that you have reason to believe are valid.\n\nIf, pursuant to or in connection with a single transaction or arrangement, you\nconvey, or propagate by procuring conveyance of, a covered work, and grant a patent\nlicense to some of the parties receiving the covered work authorizing them to use,\npropagate, modify or convey a specific copy of the covered work, then the patent\nlicense you grant is automatically extended to all recipients of the covered work and\nworks based on it.\n\nA patent license is “discriminatory” if it does not include within the\nscope of its coverage, prohibits the exercise of, or is conditioned on the\nnon-exercise of one or more of the rights that are specifically granted under this\nLicense. You may not convey a covered work if you are a party to an arrangement with\na third party that is in the business of distributing software, under which you make\npayment to the third party based on the extent of your activity of conveying the\nwork, and under which the third party grants, to any of the parties who would receive\nthe covered work from you, a discriminatory patent license **(a)** in connection with\ncopies of the covered work conveyed by you (or copies made from those copies), or **(b)**\nprimarily for and in connection with specific products or compilations that contain\nthe covered work, unless you entered into that arrangement, or that patent license\nwas granted, prior to 28 March 2007.\n\nNothing in this License shall be construed as excluding or limiting any implied\nlicense or other defenses to infringement that may otherwise be available to you\nunder applicable patent law.\n\n### 12. No Surrender of Others' Freedom\n\nIf conditions are imposed on you (whether by court order, agreement or otherwise)\nthat contradict the conditions of this License, they do not excuse you from the\nconditions of this License. If you cannot convey a covered work so as to satisfy\nsimultaneously your obligations under this License and any other pertinent\nobligations, then as a consequence you may not convey it at all. For example, if you\nagree to terms that obligate you to collect a royalty for further conveying from\nthose to whom you convey the Program, the only way you could satisfy both those terms\nand this License would be to refrain entirely from conveying the Program.\n\n### 13. Use with the GNU Affero General Public License\n\nNotwithstanding any other provision of this License, you have permission to link or\ncombine any covered work with a work licensed under version 3 of the GNU Affero\nGeneral Public License into a single combined work, and to convey the resulting work.\nThe terms of this License will continue to apply to the part which is the covered\nwork, but the special requirements of the GNU Affero General Public License, section\n13, concerning interaction through a network will apply to the combination as such.\n\n### 14. Revised Versions of this License\n\nThe Free Software Foundation may publish revised and/or new versions of the GNU\nGeneral Public License from time to time. Such new versions will be similar in spirit\nto the present version, but may differ in detail to address new problems or concerns.\n\nEach version is given a distinguishing version number. If the Program specifies that\na certain numbered version of the GNU General Public License “or any later\nversion” applies to it, you have the option of following the terms and\nconditions either of that numbered version or of any later version published by the\nFree Software Foundation. If the Program does not specify a version number of the GNU\nGeneral Public License, you may choose any version ever published by the Free\nSoftware Foundation.\n\nIf the Program specifies that a proxy can decide which future versions of the GNU\nGeneral Public License can be used, that proxy's public statement of acceptance of a\nversion permanently authorizes you to choose that version for the Program.\n\nLater license versions may give you additional or different permissions. However, no\nadditional obligations are imposed on any author or copyright holder as a result of\nyour choosing to follow a later version.\n\n### 15. Disclaimer of Warranty\n\nTHERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.\nEXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\nPROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER\nEXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE\nQUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE\nDEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n### 16. Limitation of Liability\n\nIN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY\nCOPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS\nPERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,\nINCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE\nPROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE\nOR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE\nWITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGES.\n\n### 17. Interpretation of Sections 15 and 16\n\nIf the disclaimer of warranty and limitation of liability provided above cannot be\ngiven local legal effect according to their terms, reviewing courts shall apply local\nlaw that most closely approximates an absolute waiver of all civil liability in\nconnection with the Program, unless a warranty or assumption of liability accompanies\na copy of the Program in return for a fee.\n\n_END OF TERMS AND CONDITIONS_\n\n## How to Apply These Terms to Your New Programs\n\nIf you develop a new program, and you want it to be of the greatest possible use to\nthe public, the best way to achieve this is to make it free software which everyone\ncan redistribute and change under these terms.\n\nTo do so, attach the following notices to the program. It is safest to attach them\nto the start of each source file to most effectively state the exclusion of warranty;\nand each file should have at least the “copyright” line and a pointer to\nwhere the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\nIf the program does terminal interaction, make it output a short notice like this\nwhen it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type 'show c' for details.\n\nThe hypothetical commands `show w` and `show c` should show the appropriate parts of\nthe General Public License. Of course, your program's commands might be different;\nfor a GUI interface, you would use an “about box”.\n\nYou should also get your employer (if you work as a programmer) or school, if any, to\nsign a “copyright disclaimer” for the program, if necessary. For more\ninformation on this, and how to apply and follow the GNU GPL, see\n&lt;<http://www.gnu.org/licenses/>&gt;.\n\nThe GNU General Public License does not permit incorporating your program into\nproprietary programs. If your program is a subroutine library, you may consider it\nmore useful to permit linking proprietary applications with the library. If this is\nwhat you want to do, use the GNU Lesser General Public License instead of this\nLicense. But first, please read\n&lt;<http://www.gnu.org/philosophy/why-not-lgpl.html>&gt;."
  },
  {
    "path": "Makefile",
    "content": "HAXE=haxe\nADL=adl\nADT=adt\nSWF=bin/Swivel.swf\nCERT_PASS=ngswivel!430\nPACKAGE_FILES=application.xml $(SWF) ffmpeg/mac64 ffmpeg/licenses assets/icons README.md LICENSE.md\nADTFLAGS=-package -storetype pkcs12 -keystore bat/Swivel.p12 -storepass $(CERT_PASS) -target bundle bin/Swivel\t\t\t\t\t\nHXML_FILE=Swivel.hxml\nAPP_PATH=bin/Swivel.app\nDMG_PATH=bin/Swivel.dmg\n\n.PHONY: clean package debug run\n\nall: package\n\nrun: $(SWF)\n\t$(ADL) application.xml .\n\ndebug:\n\t# Force rebuild with debug parameters.\n\t$(HAXE) $(HXML_FILE) -debug -D fdb\n\t$(ADL) application.xml .\n\npackage: $(DMG_PATH)\n\nclean:\n\trm -rf bin\n\n$(SWF): $(HXML_FILE)\n\t$(HAXE) $(HXML_FILE) $(HXML_FLAGS)\n\n$(DMG_PATH): $(APP_PATH) mac-installer.json\n\t# Use appdmg to build the DMG image.\n\trm -rf $(DMG_PATH)\n\tappdmg mac-installer.json $(DMG_PATH)\n\n$(APP_PATH): $(SWF) $(PACKAGE_FILES)\n\t# Package app using ADT.\n\t$(ADT) $(ADTFLAGS) $(PACKAGE_FILES)\n\t# Create debug file to force AIR app into Debug mode.\n\t# This is necessary to use the System.pause methods in AS3.\n\ttouch bin/Swivel.app/Contents/Resources/META-INF/debug\n\n\t"
  },
  {
    "path": "PackageApp.bat",
    "content": "@echo off\nset PAUSE_ERRORS=1\ncall bat\\SetupSDK.bat\ncall bat\\SetupApplication.bat\n\nset AIR_TARGET=\nset OPTIONS=\ncall bat\\Packager.bat\n\necho. 2>bin\\Swivel\\META-INF\\AIR\\debug\n"
  },
  {
    "path": "README.md",
    "content": "# ![Swivel](https://www.newgrounds.com/imgs/swivel/logo.png)\n[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/Herschel/Swivel)](https://ci.appveyor.com/project/Herschel/swivel)\n[![Travis Build Status](https://travis-ci.org/Herschel/Swivel.svg?branch=master)](https://travis-ci.org/Herschel/Swivel)\n\nConverts Adobe Flash SWF files to video.\n\n## Binaries\n\nThe latest stable release of Swivel can be found at <https://www.newgrounds.com/wiki/creator-resources/flash-resources/swivel?path=/wiki/creator-resources/flash-resources/swivel>.\n\n## Building from source\n\nSwivel is built using the [Haxe](http://www.haxe.org) programming language.\nRun `haxe Swivel.hxml` to build, then run `PackageApp.bat` to package the app.\n\nThe current source will have regressions from the binary release on Newgrounds;\nI'm trying to get everything working again!\n\n## License\n\nSwivel is licensed under the GNU GPLv3.\nSee [LICENSE.md](LICENSE.md) for the full license.\n\nSwivel runs using the [Adobe AIR](https://get.adobe.com/air/) runtime. AIR is \nowned by Adobe Systems, Inc.\n\nSwivel uses software from the [FFmpeg](https://www.ffmpeg.org) project along \nwith supporting libraries, licensed under their corresponding licenses. These \nlibraries include:\n\nbzip2, fontconfig, FreeType, frei0r, gnutls, LAME, libass, libbluray, libcaca,\nlibgsm, libtheora, libvorbis, libvpx, opencore-amr, openjpeg, opus, rtmpdump,\nschroedinger, speez, twolame, vo-aacenc, vo-amrwbenc, libx264, xavs, xvid, zlib\n\nThe full licenses for FFmpeg and each library can be found in the [FFmpeg/licenses](FFmpeg/licenses) \nfolder. These licenses are compatible with the GPLv3.\n\nFFmpeg and the these libraries are property of their respective owners.\nThe FFmpeg build bundled in this software was compiled by Kyle Schwarz and\ndownloaded from <http://ffmpeg.zeranoe.com/builds/>.\n"
  },
  {
    "path": "Run.bat",
    "content": "@echo off\nset PAUSE_ERRORS=1\ncall bat\\SetupSDK.bat\ncall bat\\SetupApplication.bat\n\necho.\necho Starting AIR Debug Launcher...\necho.\n\nadl \"%APP_XML%\" .\nif errorlevel 1 goto error\ngoto end\n\n:error\npause\n\n:end"
  },
  {
    "path": "Swivel.hxml",
    "content": "com.newgrounds.swivel.Swivel\n-cp src\n-cp huey/src\n-cp huey/test\n-cp lib/format\n-lib air3\n-main com.newgrounds.swivel.Swivel\n-swf bin/Swivel.swf\n-swf-header 930:590:30\n-swf-version 27\n-swf-lib assets/SwivelFonts.swf\n-D air\n--flash-strict\n"
  },
  {
    "path": "Swivel.hxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<project version=\"2\">\r\n  <!-- Output SWF options -->\r\n  <output>\r\n    <movie outputType=\"Application\" />\r\n    <movie input=\"\" />\r\n    <movie path=\"bin\\Swivel.swf\" />\r\n    <movie fps=\"30\" />\r\n    <movie width=\"930\" />\r\n    <movie height=\"590\" />\r\n    <movie version=\"27\" />\r\n    <movie minorVersion=\"0\" />\r\n    <movie platform=\"AIR\" />\r\n    <movie background=\"#FFFFFF\" />\r\n  </output>\r\n  <!-- Other classes to be compiled into your SWF -->\r\n  <classpaths>\r\n    <class path=\"src\" />\r\n    <class path=\"huey\\src\" />\r\n    <class path=\"lib\\format\" />\r\n  </classpaths>\r\n  <!-- Build options -->\r\n  <build>\r\n    <option directives=\"air\" />\r\n    <option flashStrict=\"True\" />\r\n    <option noInlineOnDebug=\"False\" />\r\n    <option mainClass=\"com.newgrounds.swivel.Swivel\" />\r\n    <option enabledebug=\"True\" />\r\n    <option additional=\"-swf-version 11.4\" />\r\n  </build>\r\n  <!-- haxelib libraries -->\r\n  <haxelib>\r\n    <library name=\"air3\" />\r\n  </haxelib>\r\n  <!-- Class files to compile (other referenced classes will automatically be included) -->\r\n  <compileTargets>\r\n    <compile path=\"src\\com\\newgrounds\\swivel\\Swivel.hx\" />\r\n  </compileTargets>\r\n  <!-- Assets to embed into the output SWF -->\r\n  <library>\r\n    <asset path=\"assets\\SwivelFonts.swf\" />\r\n  </library>\r\n  <!-- Paths to exclude from the Project Explorer tree -->\r\n  <hiddenPaths>\r\n    <hidden path=\"obj\" />\r\n  </hiddenPaths>\r\n  <!-- Executed before build -->\r\n  <preBuildCommand />\r\n  <!-- Executed after build -->\r\n  <postBuildCommand alwaysRun=\"False\" />\r\n  <!-- Other project options -->\r\n  <options>\r\n    <option showHiddenPaths=\"False\" />\r\n    <option testMovie=\"Custom\" />\r\n    <option testMovieCommand=\"Run.bat\" />\r\n  </options>\r\n  <!-- Plugin storage -->\r\n  <storage />\r\n</project>"
  },
  {
    "path": "SwivelHuey.xml",
    "content": "<application>\n\t<assets>\n\t\t<asset name=\"shadow\" source=\"assets/SHADOW.png\"/>\n\t\t<asset name=\"bg01\" source=\"assets/BG-01.png\"/>\n\t\t<asset name=\"bgConverting\" source=\"assets/BG-02.png\"/>\n\t\t<asset name=\"killBg\" source=\"assets/KILL.png\"/>\n\t\t<asset name=\"ngUpsell\" source=\"assets/NEWGROUNDS.png\"/>\n\n\t\t<asset name=\"aboutBox\" source=\"assets/infoPOD.png\"/>\n\t\t<asset name=\"aboutBoxLights\" source=\"assets/infoPOD-ON.png\"/>\n\t\t\n\t\t<asset name=\"btnSourceOver\" source=\"assets/SOURCE-OVER.jpg\"/>\n\t\t<asset name=\"btnSourceOn\" source=\"assets/SOURCE-ON.jpg\"/>\n\n\t\t<asset name=\"btnVideoOver\" source=\"assets/VIDEO-OVER.jpg\"/>\n\t\t<asset name=\"btnVideoOn\" source=\"assets/VIDEO-ON.jpg\"/>\n\n\t\t<asset name=\"btnAudioOver\" source=\"assets/AUDIO-OVER.jpg\"/>\n\t\t<asset name=\"btnAudioOn\" source=\"assets/AUDIO-ON.jpg\"/>\n\n\t\t<asset name=\"btnOverlayOver\" source=\"assets/OVERLAY-OVER.jpg\"/>\n\t\t<asset name=\"btnOverlayOn\" source=\"assets/OVERLAY-ON.jpg\"/>\n\n\t\t<asset name=\"btnInfoOver\" source=\"assets/INFO-OVER.jpg\"/>\n\t\t<asset name=\"btnInfoOn\" source=\"assets/INFO-INFO.jpg\"/>\n\n\t\t<asset name=\"btnHelpOver\" source=\"assets/HELP-OVER.jpg\"/>\n\t\t<asset name=\"btnHelpOn\" source=\"assets/HELP-ON.jpg\"/>\n\n\t\t<asset name=\"tabSource\" source=\"assets/barTOGGLE-01.png\"/>\n\t\t<asset name=\"tabVideo\" source=\"assets/barTOGGLE-02.png\"/>\n\t\t<asset name=\"tabAudio\" source=\"assets/barTOGGLE-03.png\"/>\n\t\t<asset name=\"tabOverlay\" source=\"assets/barTOGGLE-04.png\"/>\n\n\t\t<asset name=\"dummybar\" source=\"assets/DUMMYBAR.png\"/>\n\t\t\n\t\t<asset name=\"btnCloseOver\" source=\"assets/CLOSE-OVER.png\"/>\n\t\t<asset name=\"btnCloseDown\" source=\"assets/CLOSE-DOWN.png\"/>\n\t\t\n\t\t<asset name=\"btnMinOver\" source=\"assets/MIN-OVER.png\"/>\n\t\t<asset name=\"btnMinDown\" source=\"assets/MIN-DOWN.png\"/>\n\t\t\n\t\t<asset name=\"btnAddUp\" source=\"assets/ADD.png\"/>\n\t\t<asset name=\"btnAddOver\" source=\"assets/ADD-OVER.png\"/>\n\t\t<asset name=\"btnAddDown\" source=\"assets/ADD-DOWN.png\"/>\n\n\t\t<asset name=\"btnRemoveUp\" source=\"assets/REMOVE.png\"/>\n\t\t<asset name=\"btnRemoveOver\" source=\"assets/REMOVE-OVER.png\"/>\n\t\t<asset name=\"btnRemoveDown\" source=\"assets/REMOVE-DOWN.png\"/>\n\n\t\t<asset name=\"btnConvertOver\" source=\"assets/CONVERT-OVER.jpg\"/>\n\t\t<asset name=\"btnConvertOn\" source=\"assets/CONVERT-ON.jpg\"/>\n\n\t\t<asset name=\"btnLockUp\" source=\"assets/LOCKOPEN.png\"/>\n\t\t<asset name=\"btnLockOver\" source=\"assets/LOCKOPEN-OVER.png\"/>\n\t\t<asset name=\"btnLockSelected\" source=\"assets/LOCKSHUT.png\"/>\n\t\t<asset name=\"btnLockSelectedOver\" source=\"assets/LOCKSHUT-OVER.png\"/>\n\n\t\t<asset name=\"btnCheckUp\" source=\"assets/CHECK-OFF.png\"/>\n\t\t<asset name=\"btnCheckOver\" source=\"assets/CHECK-OVER.png\"/>\n\t\t<asset name=\"btnCheckDown\" source=\"assets/CHECK-DOWN.png\"/>\n\t\t<asset name=\"btnCheckSelected\" source=\"assets/CHECK-ON.png\"/>\n\t\t\n\t\t<asset name=\"btnRadioUp\" source=\"assets/RADIO-OFF.png\"/>\n\t\t<asset name=\"btnRadioOver\" source=\"assets/RADIO-OVER.png\"/>\n\t\t<asset name=\"btnRadioDown\" source=\"assets/RADIO-DOWN.png\"/>\n\t\t<asset name=\"btnRadioSelected\" source=\"assets/RADIO-ON.png\"/>\n\n\t\t<asset name=\"btnBrowseUp\" source=\"assets/BROWSE.png\"/>\n\t\t<asset name=\"btnBrowseOver\" source=\"assets/BROWSE-OVER.png\"/>\n\t\t<asset name=\"btnBrowseDown\" source=\"assets/BROWSE-DOWN.png\"/>\n\n\t\t<asset name=\"listBoxBigBG\" source=\"assets/FIELD-BIG.png\"/>\n\t\t\n\t\t<asset name=\"btnCancelUp\" source=\"assets/CANCEL.jpg\"/>\n\t\t<asset name=\"btnCancelDown\" source=\"assets/CANCEL-DOWN.jpg\"/>\n\t\t<asset name=\"btnCancelOver\" source=\"assets/CANEL-OVER.jpg\"/>\n\t\t\n\t\t<asset name=\"sliderTrack\" source=\"assets/SLIDER-BG.png\"/>\n\t\t<asset name=\"btnSliderNubUp\" source=\"assets/SLIDERGRIP.png\"/>\n\t\t<asset name=\"btnSliderNubOver\" source=\"assets/SLIDERGRIP-OVER.png\"/>\n\t\t\n\t\t<asset name=\"btnIncUp\" source=\"assets/aINC.png\"/>\n\t\t<asset name=\"btnIncDown\" source=\"assets/aINC-DOWN.png\"/>\n\t\t<asset name=\"btnIncOver\" source=\"assets/aINC-OVER.png\"/>\n\t\t\n\t\t<asset name=\"btnDecUp\" source=\"assets/aDEC.png\"/>\n\t\t<asset name=\"btnDecDown\" source=\"assets/aDEC-DOWN.png\"/>\n\t\t<asset name=\"btnDecOver\" source=\"assets/aDEC-OVER.png\"/>\n\t\t\n\t\t<asset name=\"textFieldSmall\" source=\"assets/FIELD-SM.png\"/>\n\t\t<asset name=\"textFieldBig\" source=\"assets/FIELD.png\"/>\n\t\t\n\t\t<asset name=\"txtComplete\" source=\"assets/txtSUCCESS.png\"/>\n\t\t\n\t\t<asset name=\"btnBackUp\" source=\"assets/BACK.jpg\"/>\n\t\t<asset name=\"btnBackDown\" source=\"assets/BACK-DOWN.jpg\"/>\n\t\t<asset name=\"btnBackOver\" source=\"assets/BACK-OVER.jpg\"/>\n\t\t\n\t\t<asset name=\"progressBar\" source=\"assets/PROGRESS.jpg\"/>\n\t\t\n\t\t<asset name=\"aboutBox\" source=\"assets/infoPOD.png\"/>\n\t\t<asset name=\"btnAlignUp\" source=\"assets/ALIGN-OFF.png\"/>\n\t\t<asset name=\"btnAlignOver\" source=\"assets/ALIGN-OVER.png\"/>\n\t\t<asset name=\"btnAlignDown\" source=\"assets/ALIGN-DOWN.png\"/>\n\t\t<asset name=\"btnAlignSelected\" source=\"assets/ALIGN-ON.png\"/>\n\t\t\n\t\t<asset name=\"btnDragger\" source=\"assets/DRAGGER.png\"/>\n\t\t\n\t\t<asset name=\"btnLicenseOver\" source=\"assets/infoLICENSE.jpg\"/>\n\t\t<asset name=\"btnContactOver\" source=\"assets/infoCONTACT.jpg\"/>\n\t\t\n\t\t<asset name=\"btnRecordStart\" source=\"assets/RECORD.png\"/>\n\t\t<asset name=\"btnRecordStop\" source=\"assets/RECORD-STOP.png\"/>\n\t\t\n\t\t<asset name=\"busySpinner\" source=\"assets/DUMBSPINNER.png\"/>\n\t</assets>\n\n\t<ui>\n\t\t<image source=\"shadow\" x=\"0\" y=\"0\"/>\n\t\t\t\t\n\t\t<container name=\"mainContainer\">\n\t\t\t<state name=\"setup\">\n\t\t\t\t<image source=\"bg01\" x=\"0\" y=\"0\"/>\n\t\t\t\t<button onClick=\"ngUpsellClickHandler\" x=\"179\" y=\"480\"><upState><image source=\"ngUpsell\"/></upState></button>\n\n\t\t\t\t<radioGroup name=\"setupGroup\"/>\n\n\t\t\t\t<radioButton x=\"363\" y=\"54\" name=\"sourceButton\" onClick=\"navClickHandler\" group=\"setupGroup\" selected=\"true\">\n\t\t\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"114\" height=\"37\"/></hitArea>\n\t\t\t\t\t<overState><image source=\"btnSourceOver\"/></overState>\n\t\t\t\t\t<downState><image source=\"btnSourceOn\"/></downState>\n\t\t\t\t\t<selectedUpState><image source=\"btnSourceOn\"/></selectedUpState>\n\t\t\t\t</radioButton>\n\n\t\t\t\t<radioButton x=\"483\" y=\"54\" name=\"videoButton\" onClick=\"navClickHandler\" group=\"setupGroup\">\n\t\t\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"114\" height=\"37\"/></hitArea>\n\t\t\t\t\t<overState><image source=\"btnVideoOver\"/></overState>\n\t\t\t\t\t<downState><image source=\"btnVideoOn\"/></downState>\n\t\t\t\t\t<selectedUpState><image source=\"btnVideoOn\"/></selectedUpState>\n\t\t\t\t</radioButton>\n\n\t\t\t\t<radioButton x=\"603\" y=\"54\" name=\"audioButton\" onClick=\"navClickHandler\" group=\"setupGroup\">\n\t\t\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"114\" height=\"37\"/></hitArea>\n\t\t\t\t\t<overState><image source=\"btnAudioOver\"/></overState>\n\t\t\t\t\t<downState><image source=\"btnAudioOn\"/></downState>\n\t\t\t\t\t<selectedUpState><image source=\"btnAudioOn\"/></selectedUpState>\n\t\t\t\t</radioButton>\n\n\t\t\t\t<radioButton x=\"723\" y=\"54\" name=\"overlayButton\" onClick=\"navClickHandler\" group=\"setupGroup\">\n\t\t\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"114\" height=\"37\"/></hitArea>\n\t\t\t\t\t<overState><image source=\"btnOverlayOver\"/></overState>\n\t\t\t\t\t<downState><image source=\"btnOverlayOn\"/></downState>\n\t\t\t\t\t<selectedUpState><image source=\"btnOverlayOn\"/></selectedUpState>\n\t\t\t\t</radioButton>\n\n\t\t\t\t<button x=\"96\" y=\"488\" onClick=\"aboutClickHandler\">\n\t\t\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"34\" height=\"39\"/></hitArea>\n\t\t\t\t\t<overState><image source=\"btnInfoOver\"/></overState>\n\t\t\t\t\t<downState><image source=\"btnInfoOn\"/></downState>\n\t\t\t\t</button>\n\n\t\t\t\t<button x=\"136\" y=\"488\" onClick=\"helpClickHandler\">\n\t\t\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"34\" height=\"39\"/></hitArea>\n\t\t\t\t\t<overState><image source=\"btnHelpOver\"/></overState>\n\t\t\t\t\t<downState><image source=\"btnHelpOn\"/></downState>\n\t\t\t\t</button>\n\n\t\t\t\t<button x=\"690\" y=\"488\" onClick=\"convertClickHandler\" name=\"convertButton\">\n\t\t\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"144\" height=\"39\"/></hitArea>\n\t\t\t\t\t<overState><image source=\"btnConvertOver\"/></overState>\n\t\t\t\t\t<downState><image source=\"btnConvertDown\"/></downState>\n\t\t\t\t</button>\n\n\t\t\t\t<container name=\"_settingsContainer\">\n\t\t\t\t\t<state name=\"source\">\n\t\t\t\t\t\t<image source=\"tabSource\" x=\"55\" y=\"96\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<rectangle x=\"98\" y=\"194\" width=\"734\" height=\"95\" color=\"0xa6ffffff\"/>\n\t\t\t\t\t\t<rectangle x=\"98\" y=\"289\" width=\"734\" height=\"75\" color=\"0x40ffffff\"/>\n\t\t\t\t\t\t<rectangle x=\"98\" y=\"364\" width=\"734\" height=\"45\" color=\"0xa6ffffff\"/>\n\t\t\t\t\t\t<rectangle x=\"98\" y=\"409\" width=\"734\" height=\"45\" color=\"0x40ffffff\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<label text=\"Input SWFs\" x=\"115\" y=\"226\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<label text=\"Convert an SWF or chain multiple SWFs back-to-back\" x=\"116\" y=\"243\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\n\t\t\t\t\t\t<image x=\"438\" y=\"204\" source=\"listBoxBigBG\"/>\n\t\t\t\t\t\t<listBox x=\"438\" y=\"204\" name=\"_fileListBox\"/>\n\n\t\t\t\t\t\t<button x=\"752\" y=\"204\" onClick=\"addClickHandler\">\n\t\t\t\t\t\t\t<upState><image source=\"btnAddUp\"/></upState>\n\t\t\t\t\t\t\t<overState><image source=\"btnAddOver\"/></overState>\n\t\t\t\t\t\t\t<downState><image source=\"btnAddDown\"/></downState>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<container x=\"761\" y=\"241\" name=\"busySpinner\"  visible=\"false\">\n\t\t\t\t\t\t\t<image x=\"-9\" y=\"-9\" source=\"busySpinner\" />\n\t\t\t\t\t\t</container>\n\n\t\t\t\t\t\t<button x=\"752\" y=\"254\" name=\"removeButton\" onClick=\"removeClickHandler\">\n\t\t\t\t\t\t\t<upState><image source=\"btnRemoveUp\"/></upState>\n\t\t\t\t\t\t\t<overState><image source=\"btnRemoveOver\"/></overState>\n\t\t\t\t\t\t\t<downState><image source=\"btnRemoveDown\"/></downState>\n\t\t\t\t\t\t</button>\n\n\t\t\t\t\t\t<image source=\"dummybar\" x=\"97\" y=\"287\"/>\n\n\t\t\t\t\t\t<container name=\"swfSetupContainer\">\n\t\t\t\t\t\t\t<label text=\"Movie Duration\" x=\"115\" y=\"296\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t\t<label text=\"When to start and stop recording\" x=\"116\" y=\"313\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\n\t\t\t\t\t\t\t<label text=\"Frame Range\" x=\"460\" y=\"303\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"12\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<radioGroup name=\"durationGroup\"/>\n\t\t\t\t\t\t\t<radioButton x=\"438\" y=\"302\" selected=\"true\" group=\"durationGroup\" name=\"frameRangeButton\">\n\t\t\t\t\t\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"100\" height=\"23\"/></hitArea>\n\t\t\t\t\t\t\t\t<upState><image source=\"btnRadioUp\"/></upState>\n\t\t\t\t\t\t\t\t<overState><image source=\"btnRadioOver\"/></overState>\n\t\t\t\t\t\t\t\t<downState><image source=\"btnRadioDown\"/></downState>\n\t\t\t\t\t\t\t\t<selectedUpState><image source=\"btnRadioSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t\t<selectedOverState><image source=\"btnRadioOver\"/></selectedOverState>\n\t\t\t\t\t\t\t\t<selectedDownState><image source=\"btnRadioDown\"/></selectedDownState>\n\t\t\t\t\t\t\t</radioButton>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t<container name=\"frameContainer\">\n\t\t\t\t\t\t\t\t<label text=\"Start:\" x=\"677\" y=\"303\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"12\" bold=\"false\" color=\"0x425137\"/>\n\t\t\t\t\t\t\t\t<numericStepper x=\"715\" y=\"299\" name=\"startFrameStepper\" minimum=\"1\" maximum=\"1\" value=\"1\">\n\t\t\t\t\t\t\t\t\t<image source=\"textFieldSmall\"/>\n\t\t\t\t\t\t\t\t\t\t<textBox width=\"66\" textX=\"8\" textY=\"2\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\t\t\t\t\t\t\t\t\t<incButton>\n\t\t\t\t\t\t\t\t\t\t<button x=\"88\" y=\"0\">\n\t\t\t\t\t\t\t\t\t\t\t<upState><image source=\"btnIncUp\"/></upState>\n\t\t\t\t\t\t\t\t\t\t\t<overState><image source=\"btnIncOver\"/></overState>\n\t\t\t\t\t\t\t\t\t\t\t<downState><image source=\"btnIncDown\"/></downState>\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t</incButton>\n\t\t\t\t\t\t\t\t\t<decButton>\n\t\t\t\t\t\t\t\t\t\t<button x=\"68\" y=\"0\">\n\t\t\t\t\t\t\t\t\t\t\t<upState><image source=\"btnDecUp\"/></upState>\n\t\t\t\t\t\t\t\t\t\t\t<overState><image source=\"btnDecOver\"/></overState>\n\t\t\t\t\t\t\t\t\t\t\t<downState><image source=\"btnDecDown\"/></downState>\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t</decButton>\n\t\t\t\t\t\t\t\t</numericStepper>\n\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t<label text=\"End:\" x=\"685\" y=\"333\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"12\" bold=\"false\" color=\"0x425137\"/>\n\t\t\t\t\t\t\t\t<numericStepper x=\"715\" y=\"329\" name=\"endFrameStepper\" minimum=\"1\" maximum=\"1\" value=\"1\">\n\t\t\t\t\t\t\t\t\t<image source=\"textFieldSmall\"/>\n\t\t\t\t\t\t\t\t\t<textBox width=\"66\" textX=\"8\" textY=\"2\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\">\n\t\t\t\t\t\t\t\t\t</textBox>\n\t\t\t\t\t\t\t\t\t<incButton>\n\t\t\t\t\t\t\t\t\t\t<button x=\"88\" y=\"0\">\n\t\t\t\t\t\t\t\t\t\t\t<upState><image source=\"btnIncUp\"/></upState>\n\t\t\t\t\t\t\t\t\t\t\t<overState><image source=\"btnIncOver\"/></overState>\n\t\t\t\t\t\t\t\t\t\t\t<downState><image source=\"btnIncDown\"/></downState>\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t</incButton>\n\t\t\t\t\t\t\t\t\t<decButton>\n\t\t\t\t\t\t\t\t\t\t<button x=\"68\" y=\"0\">\n\t\t\t\t\t\t\t\t\t\t\t<upState><image source=\"btnDecUp\"/></upState>\n\t\t\t\t\t\t\t\t\t\t\t<overState><image source=\"btnDecOver\"/></overState>\n\t\t\t\t\t\t\t\t\t\t\t<downState><image source=\"btnDecDown\"/></downState>\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t</decButton>\n\t\t\t\t\t\t\t\t</numericStepper>\n\t\t\t\t\t\t\t</container>\n\n\t\t\t\t\t\t\t<image name=\"frameStepperImage\" x=\"285\" y=\"290\" />\n\n\t\t\t\t\t\t\t<label text=\"Manually Start and Stop Recording\" x=\"460\" y=\"333\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"12\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t\t<radioButton x=\"438\" y=\"332\" group=\"durationGroup\" name=\"manualButton\">\n\t\t\t\t\t\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"300\" height=\"23\"/></hitArea>\n\t\t\t\t\t\t\t\t<upState><image source=\"btnRadioUp\"/></upState>\n\t\t\t\t\t\t\t\t<overState><image source=\"btnRadioOver\"/></overState>\n\t\t\t\t\t\t\t\t<downState><image source=\"btnRadioDown\"/></downState>\n\t\t\t\t\t\t\t\t<selectedUpState><image source=\"btnRadioSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t\t<selectedOverState><image source=\"btnRadioOver\"/></selectedOverState>\n\t\t\t\t\t\t\t\t<selectedDownState><image source=\"btnRadioDown\"/></selectedDownState>\n\t\t\t\t\t\t\t</radioButton>\n\n\t\t\t\t\t\t\t<image source=\"dummybar\" x=\"97\" y=\"362\"/>\n\n\t\t\t\t\t\t\t<label text=\"Render Quality\" x=\"115\" y=\"369\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t\t<label text=\"Controls render quality of the stage\" x=\"116\" y=\"386\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<slider x=\"438\" y=\"376\" minimum=\"0\" maximum=\"2\" step=\"1\" labelX=\"211\" labelY=\"0\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"12\" bold=\"true\" color=\"0x425137\" labelFunc=\"qualitySliderFunc\" name=\"qualitySlider\">\n\t\t\t\t\t\t\t\t<image source=\"sliderTrack\"/>\n\t\t\t\t\t\t\t\t<nub property=\"x\"><image source=\"btnSliderNubOver\" y=\"2\"/></nub>\n\t\t\t\t\t\t\t</slider>\n\n\t\t\t\t\t\t\t<image source=\"dummybar\" x=\"97\" y=\"407\"/>\n\n\t\t\t\t\t\t\t<label text=\"Bitmap Smoothing\" x=\"115\" y=\"416\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\" />\n\t\t\t\t\t\t\t<label text=\"Force bitmap smoothing on all bitmaps\" x=\"116\" y=\"433\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\n\t\t\t\t\t\t\t<checkBox x=\"438\" y=\"419\" name=\"bitmapSmoothingCheckBox\">\n\t\t\t\t\t\t\t\t<upState><image source=\"btnCheckUp\"/></upState>\n\t\t\t\t\t\t\t\t<overState><image source=\"btnCheckOver\"/></overState>\n\t\t\t\t\t\t\t\t<downState><image source=\"btnCheckDown\"/></downState>\n\t\t\t\t\t\t\t\t<selectedUpState><image source=\"btnCheckSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t\t<selectedOverState><image source=\"btnCheckOver\"/></selectedOverState>\n\t\t\t\t\t\t\t\t<selectedDownState><image source=\"btnCheckDown\"/></selectedDownState>\n\t\t\t\t\t\t\t</checkBox>\n\t\t\t\t\t\t</container>\n\n\t\t\t\t\t</state>\n\t\t\t\t\n\t\t\t\t\t<state name=\"video\">\n\t\t\t\t\t\t<image source=\"tabVideo\" x=\"55\" y=\"96\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<rectangle x=\"98\" y=\"194\" width=\"734\" height=\"45\" color=\"0xa6ffffff\"/>\n\t\t\t\t\t\t<rectangle x=\"98\" y=\"239\" width=\"734\" height=\"45\" color=\"0x40ffffff\"/>\n\t\t\t\t\t\t<rectangle x=\"98\" y=\"284\" width=\"734\" height=\"45\" color=\"0xa6ffffff\"/>\n\t\t\t\t\t\t<rectangle x=\"98\" y=\"329\" width=\"734\" height=\"45\" color=\"0x40ffffff\"/>\n\t\t\t\t\t\t<rectangle x=\"98\" y=\"374\" width=\"734\" height=\"45\" color=\"0xa6ffffff\"/>\n\t\t\t\t\t\t<rectangle x=\"98\" y=\"419\" width=\"734\" height=\"45\" color=\"0x40ffffff\"/>\n\n\t\t\t\t\t\t<label text=\"Output Video Name\" x=\"115\" y=\"201\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<label text=\"The filename for the final video\" x=\"116\" y=\"218\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<button x=\"752\" y=\"204\" onClick=\"outputBrowseClickHandler\">\n\t\t\t\t\t\t\t<upState><image source=\"btnBrowseUp\"/></upState>\n\t\t\t\t\t\t\t<overState><image source=\"btnBrowseOver\"/></overState>\n\t\t\t\t\t\t\t<downState><image source=\"btnBrowseDown\"/></downState>\n\t\t\t\t\t\t</button>\n\n\t\t\t\t\t\t<image source=\"textFieldBig\" x=\"438\" y=\"204\" />\n\t\t\t\t\t\t<textBox width=\"312\" x=\"438\" y=\"204\" textX=\"8\" textY=\"1\" font=\"AdvoCut_10pt_st\" size=\"10\" bold=\"true\" color=\"0x425137\" name=\"outputFileBox\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<image source=\"dummybar\" x=\"97\" y=\"237\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<label text=\"Video Size\" x=\"115\" y=\"246\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<label text=\"Width and height of the final video in pixels\" x=\"116\" y=\"263\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\n\t\t\t\t\t\t<label text=\"Width:\" x=\"437\" y=\"252\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<numericStepper x=\"480\" y=\"249\" textX=\"8\" textY=\"1\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\" name=\"widthStepper\" minimum=\"8\"  step=\"2\">\n\t\t\t\t\t\t\t<image source=\"textFieldSmall\"/>\n\t\t\t\t\t\t\t<textBox width=\"66\" textX=\"8\" textY=\"2\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\t\t\t\t\t\t\t<incButton>\n\t\t\t\t\t\t\t\t<button x=\"88\" y=\"0\">\n\t\t\t\t\t\t\t\t\t<upState><image source=\"btnIncUp\"/></upState>\n\t\t\t\t\t\t\t\t\t<overState><image source=\"btnIncOver\"/></overState>\n\t\t\t\t\t\t\t\t\t<downState><image source=\"btnIncDown\"/></downState>\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</incButton>\n\t\t\t\t\t\t\t<decButton>\n\t\t\t\t\t\t\t\t<button x=\"68\" y=\"0\">\n\t\t\t\t\t\t\t\t\t<upState><image source=\"btnDecUp\"/></upState>\n\t\t\t\t\t\t\t\t\t<overState><image source=\"btnDecOver\"/></overState>\n\t\t\t\t\t\t\t\t\t<downState><image source=\"btnDecDown\"/></downState>\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</decButton>\n\t\t\t\t\t\t</numericStepper>\n\n\t\t\t\t\t\t<label text=\"Height:\" x=\"632\" y=\"252\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<numericStepper x=\"680\" y=\"249\" textX=\"8\" textY=\"1\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\" name=\"heightStepper\" minimum=\"8\"  step=\"2\">\n\t\t\t\t\t\t\t<image source=\"textFieldSmall\"/>\n\t\t\t\t\t\t\t\t<textBox width=\"66\" textX=\"8\" textY=\"2\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\t\t\t\t\t\t\t<incButton>\n\t\t\t\t\t\t\t\t<button x=\"88\" y=\"0\">\n\t\t\t\t\t\t\t\t\t<upState><image source=\"btnIncUp\"/></upState>\n\t\t\t\t\t\t\t\t\t<overState><image source=\"btnIncOver\"/></overState>\n\t\t\t\t\t\t\t\t\t<downState><image source=\"btnIncDown\"/></downState>\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</incButton>\n\t\t\t\t\t\t\t<decButton>\n\t\t\t\t\t\t\t\t<button x=\"68\" y=\"0\">\n\t\t\t\t\t\t\t\t\t<upState><image source=\"btnDecUp\"/></upState>\n\t\t\t\t\t\t\t\t\t<overState><image source=\"btnDecOver\"/></overState>\n\t\t\t\t\t\t\t\t\t<downState><image source=\"btnDecDown\"/></downState>\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</decButton>\n\t\t\t\t\t\t</numericStepper>\n\n\t\t\t\t\t\t<checkBox x=\"596\" y=\"249\" selected=\"true\" name=\"lockAspectCheckBox\">\n\t\t\t\t\t\t\t<upState><image source=\"btnLockUp\"/></upState>\n\t\t\t\t\t\t\t<overState><image source=\"btnLockOver\"/></overState>\n\t\t\t\t\t\t\t<downState><image source=\"btnLockSelected\"/></downState>\n\t\t\t\t\t\t\t<selectedUpState><image source=\"btnLockSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t<selectedOverState><image source=\"btnLockSelectedOver\"/></selectedOverState>\n\t\t\t\t\t\t\t<selectedDownState><image source=\"btnLockUp\"/></selectedDownState>\n\t\t\t\t\t\t</checkBox>\n\n\t\t\t\t\t\t<image source=\"dummybar\" x=\"97\" y=\"282\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<label text=\"Scale Mode\" x=\"115\" y=\"291\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<label text=\"Adjust how SWFs are scaled to fit the video dimensions\" x=\"116\" y=\"308\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\n\t\t\t\t\t\t<radioGroup name=\"scaleModeGroup\"/>\n\t\t\t\t\t\t<label text=\"Crop\" x=\"464\" y=\"296\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"12\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<radioButton x=\"438\" y=\"294\" group=\"scaleModeGroup\" selected=\"true\" name=\"cropButton\">\n\t\t\t\t\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"100\" height=\"23\"/></hitArea>\n\t\t\t\t\t\t\t<upState><image source=\"btnRadioUp\"/></upState>\n\t\t\t\t\t\t\t<overState><image source=\"btnRadioOver\"/></overState>\n\t\t\t\t\t\t\t<downState><image source=\"btnRadioDown\"/></downState>\n\t\t\t\t\t\t\t<selectedUpState><image source=\"btnRadioSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t<selectedOverState><image source=\"btnRadioOver\"/></selectedOverState>\n\t\t\t\t\t\t\t<selectedDownState><image source=\"btnRadioDown\"/></selectedDownState>\n\t\t\t\t\t\t</radioButton>\n\n\t\t\t\t\t\t<label text=\"Letterbox\" x=\"594\" y=\"296\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"12\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<radioButton x=\"568\" y=\"294\" group=\"scaleModeGroup\" name=\"letterboxButton\">\n\t\t\t\t\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"100\" height=\"23\"/></hitArea>\n\t\t\t\t\t\t\t<upState><image source=\"btnRadioUp\"/></upState>\n\t\t\t\t\t\t\t<overState><image source=\"btnRadioOver\"/></overState>\n\t\t\t\t\t\t\t<downState><image source=\"btnRadioDown\"/></downState>\n\t\t\t\t\t\t\t<selectedUpState><image source=\"btnRadioSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t<selectedOverState><image source=\"btnRadioOver\"/></selectedOverState>\n\t\t\t\t\t\t\t<selectedDownState><image source=\"btnRadioDown\"/></selectedDownState>\n\t\t\t\t\t\t</radioButton>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<label text=\"Stretch to Fit\" x=\"744\" y=\"296\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"12\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<radioButton x=\"718\" y=\"294\" group=\"scaleModeGroup\"  name=\"exactFitButton\">\n\t\t\t\t\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"100\" height=\"23\"/></hitArea>\n\t\t\t\t\t\t\t<upState><image source=\"btnRadioUp\"/></upState>\n\t\t\t\t\t\t\t<overState><image source=\"btnRadioOver\"/></overState>\n\t\t\t\t\t\t\t<downState><image source=\"btnRadioDown\"/></downState>\n\t\t\t\t\t\t\t<selectedUpState><image source=\"btnRadioSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t<selectedOverState><image source=\"btnRadioOver\"/></selectedOverState>\n\t\t\t\t\t\t\t<selectedDownState><image source=\"btnRadioDown\"/></selectedDownState>\n\t\t\t\t\t\t</radioButton>\n\n\t\t\t\t\t\t<image source=\"dummybar\" x=\"97\" y=\"327\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<label text=\"Transparent Background\" x=\"115\" y=\"336\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<label text=\"Render the movie with an alpha channel\" x=\"116\" y=\"353\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<checkBox x=\"438\" y=\"339\" selected=\"false\" name=\"transparentBgCheckBox\">\n\t\t\t\t\t\t\t<upState><image source=\"btnCheckUp\"/></upState>\n\t\t\t\t\t\t\t<overState><image source=\"btnCheckOver\"/></overState>\n\t\t\t\t\t\t\t<downState><image source=\"btnCheckDown\"/></downState>\n\t\t\t\t\t\t\t<selectedUpState><image source=\"btnCheckSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t<selectedOverState><image source=\"btnCheckOver\"/></selectedOverState>\n\t\t\t\t\t\t\t<selectedDownState><image source=\"btnCheckDown\"/></selectedDownState>\n\t\t\t\t\t\t</checkBox>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<image source=\"dummybar\" x=\"97\" y=\"372\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<slider x=\"438\" y=\"432\" minimum=\"262144\" maximum=\"25165824\" step=\"512\" labelX=\"211\" labelY=\"0\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"12\" bold=\"true\" color=\"0x425137\" labelFunc=\"videoBitrateLabelFunc\" name=\"videoBitrateSlider\" value=\"4194304\">\n\t\t\t\t\t\t\t<image source=\"sliderTrack\"/>\n\t\t\t\t\t\t\t<nub property=\"x\"><image source=\"btnSliderNubOver\" y=\"2\"/></nub>\n\t\t\t\t\t\t</slider>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<label text=\"Video Codec\" x=\"115\" y=\"381\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<label text=\"Select video compression\" x=\"116\" y=\"398\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<!--<image x=\"438\" y=\"387\" source=\"listBoxBigBG\"/>\n\t\t\t\t\t\t<listBox x=\"438\" y=\"387\" name=\"codecListBox\" />-->\n\t\t\t\t\t\t<image source=\"dummybar\" x=\"97\" y=\"417\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<selectBox x=\"438\" y=\"384\" name=\"codecSelectBox\" />\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t<label text=\"Video Bitrate\" x=\"115\" y=\"426\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<label text=\"Higher values result in increased quality and file size\" x=\"116\" y=\"443\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t\n\t\t\t\t\t</state>\n\t\t\t\t\t\n\t\t\t\t\t<!--<state name=\"codec\">\n\t\t\t\t\t</state>-->\n\t\t\t\t\t\n\t\t\t\t\t<state name=\"audio\">\n\t\t\t\t\t\t<image source=\"tabAudio\" x=\"55\" y=\"96\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<rectangle x=\"98\" y=\"194\" width=\"734\" height=\"95\" color=\"0xa6ffffff\"/>\n\t\t\t\t\t\t<rectangle x=\"98\" y=\"289\" width=\"734\" height=\"45\" color=\"0x40ffffff\"/>\n\t\t\t\t\t\t<rectangle x=\"98\" y=\"334\" width=\"734\" height=\"45\" color=\"0xa6ffffff\"/>\n\t\t\t\t\t\t<rectangle x=\"98\" y=\"379\" width=\"734\" height=\"45\" color=\"0x40ffffff\"/>\n\t\t\t\t\t\t<rectangle x=\"98\" y=\"424\" width=\"734\" height=\"45\" color=\"0xa6ffffff\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<label text=\"Audio Source\" x=\"115\" y=\"226\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<label text=\"Select the audio source\" x=\"116\" y=\"243\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<radioGroup name=\"audioGroup\"/>\n\t\t\t\t\t\t<label text=\"No Audio\" x=\"464\" y=\"206\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"12\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<radioButton x=\"438\" y=\"204\" group=\"audioGroup\" name=\"noAudioButton\">\n\t\t\t\t\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"300\" height=\"23\"/></hitArea>\n\t\t\t\t\t\t\t<upState><image source=\"btnRadioUp\"/></upState>\n\t\t\t\t\t\t\t<overState><image source=\"btnRadioOver\"/></overState>\n\t\t\t\t\t\t\t<downState><image source=\"btnRadioDown\"/></downState>\n\t\t\t\t\t\t\t<selectedUpState><image source=\"btnRadioSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t<selectedOverState><image source=\"btnRadioOver\"/></selectedOverState>\n\t\t\t\t\t\t\t<selectedDownState><image source=\"btnRadioDown\"/></selectedDownState>\n\t\t\t\t\t\t</radioButton>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<label text=\"Extract from SWF\" x=\"464\" y=\"233\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"12\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<radioButton x=\"438\" y=\"231\" selected=\"true\" group=\"audioGroup\" name=\"swfAudioButton\">\n\t\t\t\t\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"300\" height=\"23\"/></hitArea>\n\t\t\t\t\t\t\t<upState><image source=\"btnRadioUp\"/></upState>\n\t\t\t\t\t\t\t<overState><image source=\"btnRadioOver\"/></overState>\n\t\t\t\t\t\t\t<downState><image source=\"btnRadioDown\"/></downState>\n\t\t\t\t\t\t\t<selectedUpState><image source=\"btnRadioSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t<selectedOverState><image source=\"btnRadioOver\"/></selectedOverState>\n\t\t\t\t\t\t\t<selectedDownState><image source=\"btnRadioDown\"/></selectedDownState>\n\t\t\t\t\t\t</radioButton>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<label text=\"External Audio Track\" x=\"464\" y=\"260\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"12\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<radioButton x=\"438\" y=\"258\" group=\"audioGroup\" name=\"externalAudioButton\">\n\t\t\t\t\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"300\" height=\"23\"/></hitArea>\n\t\t\t\t\t\t\t<upState><image source=\"btnRadioUp\"/></upState>\n\t\t\t\t\t\t\t<overState><image source=\"btnRadioOver\"/></overState>\n\t\t\t\t\t\t\t<downState><image source=\"btnRadioDown\"/></downState>\n\t\t\t\t\t\t\t<selectedUpState><image source=\"btnRadioSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t<selectedOverState><image source=\"btnRadioOver\"/></selectedOverState>\n\t\t\t\t\t\t\t<selectedDownState><image source=\"btnRadioDown\"/></selectedDownState>\n\t\t\t\t\t\t</radioButton>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<image source=\"dummybar\" x=\"97\" y=\"287\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<container name=\"externalAudioContainer\">\n\t\t\t\t\t\t\t<label text=\"External Track\" x=\"115\" y=\"296\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t\t<label text=\"Browse for an audio track for the video\" x=\"116\" y=\"313\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<image source=\"textFieldBig\" x=\"438\" y=\"299\" />\n\t\t\t\t\t\t\t<textBox width=\"312\" x=\"438\" y=\"299\" textX=\"8\" textY=\"1\" font=\"AdvoCut_10pt_st\" size=\"10\" bold=\"true\" color=\"0x425137\" name=\"externalAudioFileBox\" />\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<button x=\"752\" y=\"299\" onClick=\"audioBrowseClickHandler\">\n\t\t\t\t\t\t\t\t<upState><image source=\"btnBrowseUp\"/></upState>\n\t\t\t\t\t\t\t\t<overState><image source=\"btnBrowseOver\"/></overState>\n\t\t\t\t\t\t\t\t<downState><image source=\"btnBrowseDown\"/></downState>\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t</container>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<image source=\"dummybar\" x=\"97\" y=\"332\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<label text=\"Audio Channels\" x=\"115\" y=\"341\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<label text=\"Number of audio channels\" x=\"116\" y=\"358\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<radioGroup name=\"audioChannelGroup\"/>\n\t\t\t\t\t\t<label text=\"Mono\" x=\"464\" y=\"346\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"12\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<radioButton x=\"438\" y=\"344\" group=\"audioChannelGroup\" name=\"monoRadioButton\">\n\t\t\t\t\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"100\" height=\"23\"/></hitArea>\n\t\t\t\t\t\t\t<upState><image source=\"btnRadioUp\"/></upState>\n\t\t\t\t\t\t\t<overState><image source=\"btnRadioOver\"/></overState>\n\t\t\t\t\t\t\t<downState><image source=\"btnRadioDown\"/></downState>\n\t\t\t\t\t\t\t<selectedUpState><image source=\"btnRadioSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t<selectedOverState><image source=\"btnRadioOver\"/></selectedOverState>\n\t\t\t\t\t\t\t<selectedDownState><image source=\"btnRadioDown\"/></selectedDownState>\n\t\t\t\t\t\t</radioButton>\n\n\t\t\t\t\t\t<label text=\"Stereo\" x=\"564\" y=\"346\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"12\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<radioButton x=\"538\" y=\"344\" group=\"audioChannelGroup\" selected=\"true\">\n\t\t\t\t\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"100\" height=\"23\"/></hitArea>\n\t\t\t\t\t\t\t<upState><image source=\"btnRadioUp\"/></upState>\n\t\t\t\t\t\t\t<overState><image source=\"btnRadioOver\"/></overState>\n\t\t\t\t\t\t\t<downState><image source=\"btnRadioDown\"/></downState>\n\t\t\t\t\t\t\t<selectedUpState><image source=\"btnRadioSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t<selectedOverState><image source=\"btnRadioOver\"/></selectedOverState>\n\t\t\t\t\t\t\t<selectedDownState><image source=\"btnRadioDown\"/></selectedDownState>\n\t\t\t\t\t\t</radioButton>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<image source=\"dummybar\" x=\"97\" y=\"379\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<slider x=\"438\" y=\"437\" minimum=\"65536\" maximum=\"327680\" step=\"16384\" labelX=\"211\" labelY=\"0\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"12\" bold=\"true\" color=\"0x425137\" labelFunc=\"audioBitrateLabelFunc\" name=\"audioBitrateSlider\" value=\"131072\">\n\t\t\t\t\t\t\t<image source=\"sliderTrack\"/>\n\t\t\t\t\t\t\t<nub property=\"x\"><image source=\"btnSliderNubOver\" y=\"2\"/></nub>\n\t\t\t\t\t\t</slider>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<label text=\"Audio Codec\" x=\"115\" y=\"388\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<label text=\"Select audio compression\" x=\"116\" y=\"405\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<!--<image x=\"438\" y=\"394\" source=\"listBoxBigBG\"/>\n\t\t\t\t\t\t<listBox x=\"438\" y=\"394\" name=\"audioCodecListBox\" />-->\n\t\t\t\t\t\t\n\t\t\t\t\t\t<image source=\"dummybar\" x=\"97\" y=\"422\"/>\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<selectBox x=\"438\" y=\"389\" name=\"audioCodecSelectBox\" />\n\t\t\t\t\t\t\n\t\t\t\t\t\t<label text=\"Audio Bitrate\" x=\"115\" y=\"431\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<label text=\"Higher values result in increased quality and file size\" x=\"116\" y=\"448\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t</state>\n\t\t\t\t\t\n\t\t\t\t\t<state name=\"overlay\">\n\t\t\t\t\t\t<image source=\"tabOverlay\" x=\"55\" y=\"96\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<rectangle x=\"98\" y=\"194\" width=\"734\" height=\"45\" color=\"0xa6ffffff\"/>\n\t\t\t\t\t\t<rectangle x=\"98\" y=\"239\" width=\"734\" height=\"45\" color=\"0x40ffffff\"/>\n\t\t\t\t\t\t<rectangle x=\"98\" y=\"284\" width=\"734\" height=\"95\" color=\"0xa6ffffff\"/>\n\t\t\t\t\t\t<rectangle x=\"98\" y=\"379\" width=\"734\" height=\"45\" color=\"0x40ffffff\"/>\n\t\t\t\t\t\t<rectangle x=\"98\" y=\"424\" width=\"734\" height=\"45\" color=\"0xa6ffffff\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<label text=\"Enable Watermark\" x=\"115\" y=\"201\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t<label text=\"Display a graphic over top of the video\" x=\"116\" y=\"218\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<checkBox x=\"438\" y=\"204\" name=\"watermarkEnabledCheckBox\">\n\t\t\t\t\t\t\t<upState><image source=\"btnCheckUp\"/></upState>\n\t\t\t\t\t\t\t<overState><image source=\"btnCheckOver\"/></overState>\n\t\t\t\t\t\t\t<downState><image source=\"btnCheckDown\"/></downState>\n\t\t\t\t\t\t\t<selectedUpState><image source=\"btnCheckSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t<selectedOverState><image source=\"btnCheckOver\"/></selectedOverState>\n\t\t\t\t\t\t\t<selectedDownState><image source=\"btnCheckDown\"/></selectedDownState>\n\t\t\t\t\t\t</checkBox>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<image source=\"dummybar\" x=\"97\" y=\"237\"/>\n\t\t\t\t\t\t<container name=\"watermarkSettingsContainer\">\n\t\t\t\t\t\t\t<label text=\"Watermark Image\" x=\"115\" y=\"246\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t\t<label text=\"Browse for an image\" x=\"116\" y=\"263\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<image source=\"textFieldBig\" x=\"438\" y=\"249\" />\n\t\t\t\t\t\t\t<textBox width=\"312\" x=\"438\" y=\"249\" textX=\"8\" textY=\"1\" font=\"AdvoCut_10pt_st\" size=\"10\" bold=\"true\" color=\"0x425137\" name=\"watermarkFileBox\" />\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<button x=\"752\" y=\"249\" onClick=\"overlayBrowseClickHandler\">\n\t\t\t\t\t\t\t\t<upState><image source=\"btnBrowseUp\"/></upState>\n\t\t\t\t\t\t\t\t<overState><image source=\"btnBrowseOver\"/></overState>\n\t\t\t\t\t\t\t\t<downState><image source=\"btnBrowseDown\"/></downState>\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<image source=\"dummybar\" x=\"97\" y=\"282\"/>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<label text=\"Alignment\" x=\"115\" y=\"316\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t\t<label text=\"Position the watermark in the frame\" x=\"116\" y=\"333\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<radioGroup name=\"alignmentGroup\"/>\n\t\t\t\t\t\t\t<radioButton x=\"438\" y=\"299\" group=\"alignmentGroup\">\n\t\t\t\t\t\t\t\t<upState><image source=\"btnAlignUp\"/></upState>\n\t\t\t\t\t\t\t\t<overState><image source=\"btnAlignOver\"/></overState>\n\t\t\t\t\t\t\t\t<downState><image source=\"btnAlignDown\"/></downState>\n\t\t\t\t\t\t\t\t<selectedUpState><image source=\"btnAlignSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t\t<selectedOverState><image source=\"btnAlignOver\"/></selectedOverState>\n\t\t\t\t\t\t\t\t<selectedDownState><image source=\"btnAlignDown\"/></selectedDownState>\n\t\t\t\t\t\t\t</radioButton>\n\t\t\t\t\t\t\t<radioButton x=\"468\" y=\"299\" group=\"alignmentGroup\">\n\t\t\t\t\t\t\t\t<upState><image source=\"btnAlignUp\"/></upState>\n\t\t\t\t\t\t\t\t<overState><image source=\"btnAlignOver\"/></overState>\n\t\t\t\t\t\t\t\t<downState><image source=\"btnAlignDown\"/></downState>\n\t\t\t\t\t\t\t\t<selectedUpState><image source=\"btnAlignSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t\t<selectedOverState><image source=\"btnAlignOver\"/></selectedOverState>\n\t\t\t\t\t\t\t\t<selectedDownState><image source=\"btnAlignDown\"/></selectedDownState>\n\t\t\t\t\t\t\t</radioButton>\n\t\t\t\t\t\t\t<radioButton x=\"498\" y=\"299\" group=\"alignmentGroup\">\n\t\t\t\t\t\t\t\t<upState><image source=\"btnAlignUp\"/></upState>\n\t\t\t\t\t\t\t\t<overState><image source=\"btnAlignOver\"/></overState>\n\t\t\t\t\t\t\t\t<downState><image source=\"btnAlignDown\"/></downState>\n\t\t\t\t\t\t\t\t<selectedUpState><image source=\"btnAlignSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t\t<selectedOverState><image source=\"btnAlignOver\"/></selectedOverState>\n\t\t\t\t\t\t\t\t<selectedDownState><image source=\"btnAlignDown\"/></selectedDownState>\n\t\t\t\t\t\t\t</radioButton>\n\t\t\t\t\t\t\t<radioButton x=\"438\" y=\"321\" group=\"alignmentGroup\">\n\t\t\t\t\t\t\t\t<upState><image source=\"btnAlignUp\"/></upState>\n\t\t\t\t\t\t\t\t<overState><image source=\"btnAlignOver\"/></overState>\n\t\t\t\t\t\t\t\t<downState><image source=\"btnAlignDown\"/></downState>\n\t\t\t\t\t\t\t\t<selectedUpState><image source=\"btnAlignSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t\t<selectedOverState><image source=\"btnAlignOver\"/></selectedOverState>\n\t\t\t\t\t\t\t\t<selectedDownState><image source=\"btnAlignDown\"/></selectedDownState>\n\t\t\t\t\t\t\t</radioButton>\n\t\t\t\t\t\t\t<radioButton x=\"468\" y=\"321\" group=\"alignmentGroup\">\n\t\t\t\t\t\t\t\t<upState><image source=\"btnAlignUp\"/></upState>\n\t\t\t\t\t\t\t\t<overState><image source=\"btnAlignOver\"/></overState>\n\t\t\t\t\t\t\t\t<downState><image source=\"btnAlignDown\"/></downState>\n\t\t\t\t\t\t\t\t<selectedUpState><image source=\"btnAlignSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t\t<selectedOverState><image source=\"btnAlignOver\"/></selectedOverState>\n\t\t\t\t\t\t\t\t<selectedDownState><image source=\"btnAlignDown\"/></selectedDownState>\n\t\t\t\t\t\t\t</radioButton>\n\t\t\t\t\t\t\t<radioButton x=\"498\" y=\"321\" group=\"alignmentGroup\">\n\t\t\t\t\t\t\t\t<upState><image source=\"btnAlignUp\"/></upState>\n\t\t\t\t\t\t\t\t<overState><image source=\"btnAlignOver\"/></overState>\n\t\t\t\t\t\t\t\t<downState><image source=\"btnAlignDown\"/></downState>\n\t\t\t\t\t\t\t\t<selectedUpState><image source=\"btnAlignSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t\t<selectedOverState><image source=\"btnAlignOver\"/></selectedOverState>\n\t\t\t\t\t\t\t\t<selectedDownState><image source=\"btnAlignDown\"/></selectedDownState>\n\t\t\t\t\t\t\t</radioButton>\n\t\t\t\t\t\t\t<radioButton x=\"438\" y=\"343\" group=\"alignmentGroup\" selected=\"true\">\n\t\t\t\t\t\t\t\t<upState><image source=\"btnAlignUp\"/></upState>\n\t\t\t\t\t\t\t\t<overState><image source=\"btnAlignOver\"/></overState>\n\t\t\t\t\t\t\t\t<downState><image source=\"btnAlignDown\"/></downState>\n\t\t\t\t\t\t\t\t<selectedUpState><image source=\"btnAlignSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t\t<selectedOverState><image source=\"btnAlignOver\"/></selectedOverState>\n\t\t\t\t\t\t\t\t<selectedDownState><image source=\"btnAlignDown\"/></selectedDownState>\n\t\t\t\t\t\t\t</radioButton>\n\t\t\t\t\t\t\t<radioButton x=\"468\" y=\"343\" group=\"alignmentGroup\">\n\t\t\t\t\t\t\t\t<upState><image source=\"btnAlignUp\"/></upState>\n\t\t\t\t\t\t\t\t<overState><image source=\"btnAlignOver\"/></overState>\n\t\t\t\t\t\t\t\t<downState><image source=\"btnAlignDown\"/></downState>\n\t\t\t\t\t\t\t\t<selectedUpState><image source=\"btnAlignSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t\t<selectedOverState><image source=\"btnAlignOver\"/></selectedOverState>\n\t\t\t\t\t\t\t\t<selectedDownState><image source=\"btnAlignDown\"/></selectedDownState>\n\t\t\t\t\t\t\t</radioButton>\n\t\t\t\t\t\t\t<radioButton x=\"498\" y=\"343\" group=\"alignmentGroup\">\n\t\t\t\t\t\t\t\t<upState><image source=\"btnAlignUp\"/></upState>\n\t\t\t\t\t\t\t\t<overState><image source=\"btnAlignOver\"/></overState>\n\t\t\t\t\t\t\t\t<downState><image source=\"btnAlignDown\"/></downState>\n\t\t\t\t\t\t\t\t<selectedUpState><image source=\"btnAlignSelected\"/></selectedUpState>\n\t\t\t\t\t\t\t\t<selectedOverState><image source=\"btnAlignOver\"/></selectedOverState>\n\t\t\t\t\t\t\t\t<selectedDownState><image source=\"btnAlignDown\"/></selectedDownState>\n\t\t\t\t\t\t\t</radioButton>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<rectangle name=\"watermarkPreview\" x=\"713\" y=\"301\" width=\"0\" height=\"0\" color=\"0x00000000\" />\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t<image source=\"dummybar\" x=\"97\" y=\"378\"/>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<label text=\"Size\" x=\"115\" y=\"386\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t\t<label text=\"Set the size of the watermark\" x=\"116\" y=\"403\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<slider x=\"438\" y=\"393\" minimum=\"0\" maximum=\"4\" step=\".01\" labelX=\"211\" labelY=\"0\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"12\" bold=\"true\" color=\"0x425137\" labelFunc=\"alphaSliderFunc\" name=\"watermarkSizeSlider\" value=\"1.0\">\n\t\t\t\t\t\t\t\t<image source=\"sliderTrack\"/>\n\t\t\t\t\t\t\t\t<nub property=\"x\"><image source=\"btnSliderNubOver\" y=\"2\"/></nub>\n\t\t\t\t\t\t\t</slider>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<image source=\"dummybar\" x=\"97\" y=\"422\"/>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<label text=\"Transparency\" x=\"115\" y=\"431\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"14\" bold=\"true\" color=\"0x425137\"/>\n\t\t\t\t\t\t\t<label text=\"Set the opacity of the watermark\" x=\"116\" y=\"448\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0x425137\"/>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<slider x=\"438\" y=\"438\" minimum=\"0\" maximum=\"1\" step=\".01\" labelX=\"211\" labelY=\"0\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"12\" bold=\"true\" color=\"0x425137\" labelFunc=\"alphaSliderFunc\" name=\"watermarkAlphaSlider\" value=\"1.0\">\n\t\t\t\t\t\t\t\t<image source=\"sliderTrack\"/>\n\t\t\t\t\t\t\t\t<nub property=\"x\"><image source=\"btnSliderNubOver\" y=\"2\"/></nub>\n\t\t\t\t\t\t\t</slider>\n\t\t\t\t\t\t</container>\n\t\t\t\t\t\t\n\t\t\t\t\t</state>\n\t\t\t\t</container>\n\t\t\t</state>\n\t\t\t\n\t\t\t<state name=\"converting\">\n\t\t\t\t<image source=\"bgConverting\" x=\"0\" y=\"0\"/>\n\t\t\t\t<scaledImage name=\"_previewImage\" x=\"114\" y=\"64\" width=\"702\" height=\"395\" />\n\t\t\t\t\n\t\t\t\t<label x=\"96\" y=\"486\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"13\" bold=\"true\" color=\"0x425137\" name=\"progressText\" />\n\t\t\t\t<progressBar x=\"101\" y=\"509\" minimum=\"0\" maximum=\"1\" step=\"0\" labelX=\"9999\" name=\"progressBar\">\n\t\t\t\t\t<nub property=\"width\"><image source=\"progressBar\"/></nub>\n\t\t\t\t</progressBar>\n\t\t\t\t\n\t\t\t\t<checkBox x=\"385\" y=\"400\" onMouseDown=\"toggleRecordingHandler\" name=\"recordingButton\" visible=\"false\">\n\t\t\t\t\t<upState><image source=\"btnRecordStart\"/></upState>\n\t\t\t\t\t<selectedUpState><image source=\"btnRecordStop\"/></selectedUpState>\n\t\t\t\t</checkBox>\n\t\t\t\t\n\t\t\t\t<button x=\"690\" y=\"488\" onMouseDown=\"cancelClickHandler\" name=\"cancelButton\">\n\t\t\t\t\t<upState><image source=\"btnCancelUp\"/></upState>\n\t\t\t\t\t<overState><image source=\"btnCancelOver\"/></overState>\n\t\t\t\t\t<downState><image source=\"btnCancelDown\"/></downState>\n\t\t\t\t</button>\n\t\t\t</state>\n\t\t\t\n\t\t\t<state name=\"complete\">\n\t\t\t\t<image source=\"bgConverting\" x=\"0\" y=\"0\"/>\n\t\t\t\t\n\t\t\t\t<rectangle x=\"426\" y=\"234\" width=\"2\" height=\"90\" color=\"0x597E9D4F\"/>\n\t\t\t\t\n\t\t\t\t<image source=\"txtComplete\" x=\"312\" y=\"194\"/>\n\n\t\t\t\t<label align=\"right\" width=\"220\" text=\"Your Video:\" x=\"197\" y=\"234\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"13\" bold=\"true\" color=\"0x7E9D4F\"/>\n\t\t\t\t<label x=\"437\" y=\"234\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"13\" bold=\"true\" color=\"0xFF9900\" name=\"videoNameText\" />\n\t\t\t\t<label text=\"Click to open your video\" x=\"438\" y=\"247\" font=\"AdvoCut_10pt_st\" size=\"10\" bold=\"false\" color=\"0x7E9D4F\"/>\n\t\t\t\t<button onClick=\"videoNameClickHandler\">\n\t\t\t\t\t<hitArea><rectangle x=\"437\" y=\"234\" width=\"300\" height=\"40\" depth=\"1\"/></hitArea>\n\t\t\t\t</button>\n\t\t\t\t\n\t\t\t\t<label align=\"right\" width=\"220\" text=\"Size on Disk:\" x=\"197\" y=\"274\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"13\" bold=\"true\" color=\"0x7E9D4F\"/>\n\t\t\t\t<label x=\"437\" y=\"274\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"13\" bold=\"true\" color=\"0xFFFFFF\" name=\"fileSizeText\" />\n\t\t\t\t\n\t\t\t\t<label align=\"right\" width=\"220\" text=\"Conversion Time:\" x=\"197\" y=\"304\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"13\" bold=\"true\" color=\"0x7E9D4F\"/>\n\t\t\t\t<label x=\"437\" y=\"304\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"13\" bold=\"true\" color=\"0xFFFFFF\" name=\"timeText\"/>\n\t\t\t\t\n\t\t\t\t<label x=\"96\" y=\"486\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"13\" bold=\"true\" color=\"0x425137\" text=\"Complete!\"/>\n\n\t\t\t\t<image source=\"progressBar\" x=\"101\" y=\"509\"/>\n\t\t\t\t\n\t\t\t\t<button x=\"690\" y=\"488\" onClick=\"backClickHandler\">\n\t\t\t\t\t<upState><image source=\"btnBackUp\"/></upState>\n\t\t\t\t\t<overState><image source=\"btnBackOver\"/></overState>\n\t\t\t\t\t<downState><image source=\"btnBackDown\"/></downState>\n\t\t\t\t</button>\n\t\t\t</state>\n\t\t\t\n\t\t\t<state name=\"error\">\n\t\t\t\t<image source=\"bgConverting\" x=\"0\" y=\"0\"/>\n\t\t\t\t\n\t\t\t\t<label x=\"120\" y=\"70\" font=\"AdvoCut_10pt_st\" size=\"10\" color=\"0xffffff\" width=\"700\" height=\"400\" wordWrap=\"true\" name=\"errorText\" editable=\"true\" />\n\t\t\t</state>\n\t\t</container>\n\t\t\n\t\t\n\t\t<button onMouseDown=\"dragWindowHandler\"><hitArea><rectangle x=\"0\" y=\"0\" width=\"930\" height=\"40\" depth=\"1\"/></hitArea></button>\n\t\t<button onMouseDown=\"dragWindowHandler\"><hitArea><rectangle x=\"0\" y=\"0\" width=\"80\" height=\"600\" depth=\"1\"/></hitArea></button>\n\t\t<button onMouseDown=\"dragWindowHandler\"><hitArea><rectangle x=\"850\" y=\"0\" width=\"930\" height=\"590\" depth=\"1\"/></hitArea></button>\n\t\t<button onMouseDown=\"dragWindowHandler\"><hitArea><rectangle x=\"0\" y=\"550\" width=\"930\" height=\"590\" depth=\"1\"/></hitArea></button>\n\t\t\t\n\t\t<button onClick=\"minClickHandler\" x=\"854\" y=\"1\" depth=\"1\">\n\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"25\" height=\"17\"/></hitArea>\n\t\t\t<overState><image source=\"btnMinOver\"/></overState>\n\t\t\t<downState><image source=\"btnMinDown\"/></downState>\n\t\t</button>\n\n\t\t<button x=\"884\" y=\"1\" onClick=\"closeClickHandler\" depth=\"1\">\n\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"25\" height=\"17\"/></hitArea>\n\t\t\t<overState><image source=\"btnCloseOver\"/></overState>\n\t\t\t<downState><image source=\"btnCloseDown\"/></downState>\n\t\t</button>\n\t\t\n\t\t<container name=\"aboutBox\" visible=\"false\">\n\t\t\t<image source=\"killBg\" x=\"10\" y=\"10\" />\n\t\t\t<image source=\"aboutBoxLights\" x=\"127\" y=\"117\" />\n\t\t\t<label alpha=\".25\" text=\"Swivel ©2013 Newgrounds.com, Inc.\\nSwivel uses software from the FFmpeg project, licensed under the GPLv3.\\nAll logos and trademarks are the property of their respective owners.\" width=\"800\" height=\"60\" x=\"50\" y=\"496\" color=\"0xffffff\" font=\"Swis721 Cn BT\" letterSpacing=\"1\" size=\"12\" bold=\"true\" align=\"center\" />\n\t\t\t<button onClick=\"aboutCloseHandler\">\n\t\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"920\" height=\"580\"/></hitArea>\n\t\t\t</button>\n\t\t\t<image x=\"127\" y=\"115\" source=\"aboutBox\"/>\n\t\t\t<button onClick=\"contactClickHandler\" x=\"227\" y=\"294\">\n\t\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"90\" height=\"32\"/></hitArea>\n\t\t\t\t<overState><image source=\"btnContactOver\"/></overState>\n\t\t\t</button>\n\t\t\t<button onClick=\"licenseClickHandler\" x=\"318\" y=\"294\">\n\t\t\t\t<hitArea><rectangle x=\"0\" y=\"0\" width=\"90\" height=\"32\"/></hitArea>\n\t\t\t\t<overState><image source=\"btnLicenseOver\"/></overState>\n\t\t\t</button>\n\t\t\t<label name=\"versionText\" x=\"260\" y=\"191\" font=\"AdvoCut_10pt_st\" size=\"10\" bold=\"true\" color=\"0x404D35\" align=\"right\" width=\"150\" />\n\t\t\t<label name=\"creditsText\" x=\"430\" y=\"158\" width=\"270\" height=\"1500\" font=\"AdvoCut_10pt_st\" size=\"10\" bold=\"true\" color=\"0xffffff\" align=\"center\" wordWrap=\"true\"\n\t\t\ttext=\"SWIVEL\\nSWF-to-Video Converter\\n©2012-2017 Newgrounds.com, Inc.\\n\\nDeveloped by Mike Welsh\\nInterface by Stamper\\nVox by Hania Lee\\n\\nDeveloped using Haxe and Adobe AIR\\n\\nThis software utilizes the FFmpeg project with other supporting libraries, including libx264, libtheora, and libvorbis. These projects are property of their respective owners, and are NOT owned by Newgrounds.com, Inc. These projects are licensed under their respective licenses, compatible with the GPLv3. To view the full licenses, click the License button.\\n\\nVery special thanks to the maintainers and contributors of FFmpeg and these projects. This program would not be possible without your awesome work!\\n\\n\\nTesters\\n\\nChris 'Oney' O'Neill\\nChristina 'Jaxxy' Tomar\\nDon Greger\\nMarco 'Evil-Dog' Arsenault\\nHarry Partridge\\nJeff Bandelin\\nJeremy Zaczek\\nJonas Boda\\nMindChamber\\nJosh 'Tomamoto' Tomar\\nLuka Marcetic\\nMark Schneider\\nMatt 'Krinkels' Jolly\\nMick 'RicePirate' Lauer\\nMichael Swain\\nSteve 'SardonicSamurai' V\\nShawn 'Afro-Ninja' Tanner\\nNick Pasto\\nZach 'PsychicPebbles' Hadel\\nRobert Lovelett\\nRyan 'rtil' Miller\\nSpazkid\\nWade Fulp\\nZachary Lew\\nMatt 'Patonion' Paton\\nRyan 'MiddleFingerRings' Maddox\\nAdam Phillips\\nAnyone I forgot\\n\\nVery Special Thanks\\n\\nAshley 'Jellybean' Aberg\\nTom Fulp\\nSushi (the cat)\\nRobotron 2084\\nRob Lovelett\\nDavid Robbins\\ncaptin of cats\\nMike 'Spiked3' Partain\\nJustin Welsh\\nTim Sanker\\nDoylestown 3rd Strike\"/>\n\t\t\t\n\t\t\t\n\t\t</container>\n\t\t\n\t</ui>\n</application>\n"
  },
  {
    "path": "application.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<application xmlns=\"http://ns.adobe.com/air/application/27.0\">\n\t\n\t<id>com.newgrounds.swivel.Swivel</id>\n\t<versionNumber>1.12</versionNumber>\n\t<filename>Swivel</filename>\n\t\n\t<name>Swivel</name>\n\t<description>SWF-to-video converter</description>\n\t<copyright>2013 Newgrounds.com, Inc.</copyright>\n\t<supportedProfiles>extendedDesktop desktop</supportedProfiles>\n\t<icon>\n\t\t<image16x16>assets/icons/SWV_PNG-16.png</image16x16>\n\t\t<image32x32>assets/icons/SWV_PNG-32.png</image32x32>\n\t\t<image128x128>assets/icons/SWV_PNG-128.png</image128x128>\n\t\t<image512x512>assets/icons/SWV_PNG-512.png</image512x512>\n\t</icon>\n\t<initialWindow>\n\t\t<title>Swivel</title>\n\t\t<content>bin/Swivel.swf</content>\n\t\t<systemChrome>none</systemChrome>\n\t\t<transparent>true</transparent>\n\t\t<visible>true</visible>\n\t\t<minimizable>true</minimizable>\n\t\t<maximizable>false</maximizable>\n\t\t<resizable>false</resizable>\n\t</initialWindow>\n</application>\n"
  },
  {
    "path": "assets/inject_swfs/__Swivel.as",
    "content": "﻿package  {\n\timport flash.events.Event;\n\timport flash.events.IEventDispatcher;\n\timport flash.net.LocalConnection;\n\timport flash.net.SharedObject;\n\timport flash.display.MovieClip;\n\timport flash.display.Stage;\n\timport flash.utils.getDefinitionByName;\n\timport flash.display.Shape;\n\timport flash.display.DisplayObject;\n\t\n\tpublic class __Swivel {\n\t\tprivate static var __swivelSharedObj : SharedObject;\n\t\tprivate static var _swivelCon : Object;\n\t\tprivate static var _frame : int = 0;\n\t\tprivate static var _root : MovieClip;\n\t\tprivate static var _s : __SwivelSound;\n\t\tprivate static var _mask : Shape;\n\t\tprivate static var _startFrame : int;\n\t\t\n\t\tpublic static function __swivel(...args) : void {\n\t\t\t//args.unshift(\"__swivel\");\n\t\t\t//__swivelCon.send.apply(__swivelCon, args);\n\t\t\t//trace(\"swivel: \" + args);\n\t\t\t_swivelCon.receiveMessage(args);\n\t\t}\n\t\t\n\t\tpublic static function get frame() : uint {\n\t\t\treturn _frame - 1;\n\t\t}\n\t\t\t\t\n\t\tpublic static function setMask(clip : DisplayObject, margin : Number) : void {\n\t\t\tif(margin < 10) margin = 10;\n\n\t\t\tvar m : Shape = new Shape();\n\t\t\tm.graphics.beginFill(0);\n\t\t\tm.graphics.drawRect(-margin, -margin, stage.stageWidth+margin*2, stage.stageHeight+margin*2);\n\t\t\tm.graphics.endFill();\n\t\t\t// TODO: Dangerous... does this allow GC safely?\n\t\t\tstage.addChild(m);\n\t\t\tm.visible = false;\n\t\t\tclip.mask = m;\n\t\t}\n\t\t\n\t\tpublic static function get stage() : Stage {\n\t\t\ttry {\n\t\t\t\tvar ow : Array = getDefinitionByName(\"flash.desktop.NativeApplication\").nativeApplication.openedWindows;\n\t\t\t\treturn ow[ow.length-1].stage;\n\t\t\t} catch(error:*) { }\n\t\t\treturn null; \n\t\t}\n\t\t\n\t\tpublic static function registerDocument(root : MovieClip, startFrame : int) : void {\n\t\t\t_startFrame = startFrame;\n\t\t\t\n\t\t\t_root = root;\t\t\t\n\t\t\t_root.addEventListener(Event.ENTER_FRAME, __onEnterFrame, false, 999, true)\n\t\t\t_root.addEventListener(Event.ADDED_TO_STAGE, addedToStage, false, 999, true);\n\t\t\t\n\t\t\t__onEnterFrame(null);\n\t\t\t_swivelCon = stage.loaderInfo.applicationDomain.getDefinition(\"com.newgrounds.swivel.swf.AS3SwivelConnection\");\n\t\t}\n\t\t\n\t\tprivate static function addedToStage(e:Event) : void {\n\t\t\t_root.removeEventListener(Event.ADDED_TO_STAGE, addedToStage);\n\t\t\tif(_startFrame > 1) _root.gotoAndPlay(_startFrame);\n\t\t}\n\t\t\n\t\tprivate static function __onEnterFrame(e:Event) : void {\n\t\t\tif(!__swivelSharedObj) {\n\t\t\t\t__swivelSharedObj = SharedObject.getLocal(\"__swivel\");\n\t\t\t\t__swivelSharedObj.clear();\n\t\t\t}\n\t\t\tvar rootFrame : uint = _root.currentFrame;\n\t\t\tfor(var i:int=0; _root.scenes[i].name != _root.currentScene.name && i<_root.scenes.length; i++) {\n\t\t\t\trootFrame += _root.scenes[i].numFrames;\n\t\t\t}\n\t\t\t__swivelSharedObj.data.frame = rootFrame;\n\t\t\t__swivelSharedObj.flush();\n\t\t\t_frame++;\n\t\t}\n\t\t\n\n\t}\n\t\n}\n"
  },
  {
    "path": "assets/inject_swfs/__SwivelSound.as",
    "content": "﻿package  {\n\timport flash.events.Event;\n\timport flash.events.EventDispatcher;\n\timport flash.media.Sound;\n\timport flash.media.SoundChannel;\n\timport flash.media.SoundTransform;\n\timport flash.utils.getQualifiedClassName;\n\timport flash.utils.ByteArray;\n\timport flash.net.URLRequest;\n\timport flash.media.SoundLoaderContext;\n\timport flash.media.ID3Info;\n\t\n\tpublic class __SwivelSound extends EventDispatcher {\n\t\tprivate static var _numInstances : uint = 1;\n\t\t\n\t\tpublic function get bytesLoaded() : uint\t{ return 1; }\n\t\tpublic function get bytesTotal() : uint\t\t{ return 1; }\n\t\tpublic function get id3() : ID3Info\t\t\t{ return null; }\n\t\tpublic function get isBuffering() : Boolean\t{ return false; }\n\t\tpublic function get isURLInaccessible() : Boolean { return false; }\n\t\tpublic function get length() : Number \t\t{ return 1; }\n\t\tpublic function get url() : String\t\t\t{ return null; }\n\t\t\n\t\tpublic function __SwivelSound() {\n\t\t\tsuper();\n\t\t\t_instanceNum = _numInstances++;\n\t\t\t_name = getQualifiedClassName(this);\n\t\t}\n\t\t\n\t\tpublic function close():void {}\n\t\tpublic function extract(target : ByteArray, length : Number, startPosition : Number = -1) : void {}\n\t\tpublic function load(stream : URLRequest, context : SoundLoaderContext = null) : void {}\n\t\tpublic function loadCompressedDataFromByteArray(bytes : ByteArray, bytesLength : uint) : void {}\n\t\tpublic function loadPCMFromByteArray(bytes : ByteArray, samples : uint, format : String = \"float\", stereo : Boolean = true, sampleRate : Number = 44100.0) : void {}\n\t\t\n\t\tpublic function play(startTime : Number = 0, loops : int = 0, soundTransform : SoundTransform = null) : __SwivelSoundChannel {\n\t\t\t__Swivel.__swivel(\"asStart\", __Swivel.frame, _instanceNum, _name, startTime, loops)\n\t\t\treturn new __SwivelSoundChannel(_instanceNum);\n\t\t}\t\t\n\t\t\n\t\tprivate var _instanceNum : uint;\n\t\tprivate var _name : String;\n\t}\n\t\n}\n"
  },
  {
    "path": "assets/inject_swfs/__SwivelSoundChannel.as",
    "content": "﻿package  {\n\timport flash.media.SoundChannel;\n\timport flash.media.SoundTransform;\n\timport flash.events.EventDispatcher;\n\t\n\tpublic class __SwivelSoundChannel extends EventDispatcher {\n\n\t\tpublic function get leftPeak() : Number\t{ return 0; }\n\t\tpublic function get rightPeak() : Number { return 0; }\n\t\tpublic function get position() : Number { return 0; }\n\t\tpublic function get soundTransform() : SoundTransform { return _transform; } // TODO: defensive copy?\n\t\tpublic function set soundTransform(v : SoundTransform) : void {\n\t\t\t_transform = v;\n\t\t\t__Swivel.__swivel(\"asSetVolume\", __Swivel.frame, _instanceNum, _transform.volume);\n\t\t\tif(_transform.rightToLeft > 0 || _transform.leftToRight > 0)\n\t\t\t\t__Swivel.__swivel(\"asSetTransform\", __Swivel.frame, _instanceNum, _transform.leftToLeft, _transform.rightToLeft, _transform.leftToRight, _transform.rightToRight);\n\t\t\telse\n\t\t\t\t__Swivel.__swivel(\"asSetPan\", __Swivel.frame, _instanceNum, _transform.pan);\n\t\t}\n\t\t\n\t\tpublic function __SwivelSoundChannel(instanceNum : uint, soundTransform : SoundTransform = null) {\n\t\t\tsuper();\n\t\t\t_instanceNum = instanceNum;\n\t\t\tif(soundTransform == null) this.soundTransform = new SoundTransform();\n\t\t\telse this.soundTransform = soundTransform;\n\t\t}\n\t\t\n\t\tpublic function stop() : void {\n\t\t\t__Swivel.__swivel(\"asStop\",__Swivel.frame, _instanceNum);\n\t\t}\n\t\t\n\t\tprivate var _instanceNum : uint;\n\t\tprivate var _transform : SoundTransform;\n\t}\n\t\n}\n"
  },
  {
    "path": "bat/CreateCertificate.bat",
    "content": "@echo off\ncd..\nset PAUSE_ERRORS=1\ncall bat\\SetupSDK.bat\ncall bat\\SetupApplication.bat\n\n:: Generate\necho.\necho Generating a self-signed certificate...\ncall adt -certificate -cn %CERT_NAME% -ou Developer -o \"Newgrounds.com, Inc.\" -c US -validityPeriod 20 2048-RSA %CERT_FILE% %CERT_PASS%\nif errorlevel 1 goto failed\n\n:succeed\necho.\necho Certificate created: %CERT_FILE% with password \"%CERT_PASS%\"\necho.\nif \"%CERT_PASS%\" == \"fd\" echo (note: you did not change the default password)\necho.\necho HINTS:\necho - you only need to generate this certificate once,\necho - wait a minute before using this certificate to package your AIR application.\necho.\ngoto end\n\n:failed\necho.\necho Certificate creation FAILED.\necho.\n\n:end\npause"
  },
  {
    "path": "bat/Packager.bat",
    "content": "@echo off\nif not exist %CERT_FILE% goto certificate\n\n:: AIR output\nif not exist %AIR_PATH% md %AIR_PATH%\nset OUTPUT=%AIR_PATH%\\%AIR_NAME%%AIR_TARGET%.air\n\n:: Package\necho.\necho Packaging %AIR_NAME%%AIR_TARGET%.air using certificate %CERT_FILE%...\ncall adt -package -storetype pkcs12 -keystore bat/Swivel.p12 -storepass %CERT_PASS% -target bundle bin/Swivel application.xml bin/Swivel.swf ffmpeg/win32 ffmpeg/licenses assets/icons README.md LICENSE.md\nif errorlevel 1 goto failed\ngoto end\n\n:certificate\necho.\necho Certificate not found: %CERT_FILE%\necho.\necho Troubleshooting:\necho - generate a default certificate using 'bat\\CreateCertificate.bat'\necho.\nif %PAUSE_ERRORS%==1 pause\nexit\n\n:failed\necho AIR setup creation FAILED.\necho.\necho Troubleshooting:\necho - did you build your project in FlashDevelop?\necho - verify AIR SDK target version in %APP_XML%\necho.\nif %PAUSE_ERRORS%==1 pause\nexit\n\n:end\necho."
  },
  {
    "path": "bat/SetupApplication.bat",
    "content": ":user_configuration\n\n:: About AIR application packaging\n:: http://livedocs.adobe.com/flex/3/html/help.html?content=CommandLineTools_5.html#1035959\n:: http://livedocs.adobe.com/flex/3/html/distributing_apps_4.html#1037515\n\n:: NOTICE: all paths are relative to project root\n\n:: Your certificate information\nset CERT_NAME=\"Swivel\"\nset CERT_PASS=ngswivel!430\nset CERT_FILE=\"bat\\Swivel.p12\"\nset SIGNING_OPTIONS=-storetype pkcs12 -keystore %CERT_FILE% -storepass %CERT_PASS%\n\n:: Application descriptor\nset APP_XML=application.xml\n\n:: Files to package\nset APP_DIR=bin\nset FILE_OR_DIR=-C %APP_DIR% .\n\n:: Your application ID (must match <id> of Application descriptor)\nset APP_ID=com.newgrounds.swivel.Swivel\n\n:: Output\nset AIR_PATH=air\nset AIR_NAME=Swivel\n\n\n:validation\n%SystemRoot%\\System32\\find /C \"<id>%APP_ID%</id>\" \"%APP_XML%\" > NUL\nif errorlevel 1 goto badid\ngoto end\n\n:badid\necho.\necho ERROR:\necho   Application ID in 'bat\\SetupApplication.bat' (APP_ID)\necho   does NOT match Application descriptor '%APP_XML%' (id)\necho.\nif %PAUSE_ERRORS%==1 pause\nexit\n\n:end"
  },
  {
    "path": "bat/SetupSDK.bat",
    "content": ":user_configuration\n\n:: Default path to AIR SDK if installed using HaxeDevelop.\nif not defined AIR_SDK (set AIR_SDK=%HOMEDRIVE%%HOMEPATH%\\AppData\\Local\\HaxeDevelop\\Apps\\ascsdk\\27.0.0)\n\n:validation\nif not exist \"%AIR_SDK%\\bin\" goto flexsdk\ngoto succeed\n\n:flexsdk\necho.\necho ERROR: Path to Air SDK not set.\necho Please set the AIR_SDK environment variable, or install the \necho AIR SDK + ASC 2.0 Compiler in HaxeDevelop -> Tools -> Install Software.\necho.\nif %PAUSE_ERRORS%==1 pause\nexit\n\n:succeed\nset PATH=%PATH%;%AIR_SDK%\\bin\n\n"
  },
  {
    "path": "ffmpeg/licenses/bzip2.txt",
    "content": "\n--------------------------------------------------------------------------\n\nThis program, \"bzip2\", the associated library \"libbzip2\", and all\ndocumentation, are copyright (C) 1996-2010 Julian R Seward.  All\nrights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n\n1. Redistributions of source code must retain the above copyright\n   notice, this list of conditions and the following disclaimer.\n\n2. The origin of this software must not be misrepresented; you must \n   not claim that you wrote the original software.  If you use this \n   software in a product, an acknowledgment in the product \n   documentation would be appreciated but is not required.\n\n3. Altered source versions must be plainly marked as such, and must\n   not be misrepresented as being the original software.\n\n4. The name of the author may not be used to endorse or promote \n   products derived from this software without specific prior written \n   permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\nOR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\nGOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\nINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\nNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nJulian Seward, jseward@bzip.org\nbzip2/libbzip2 version 1.0.6 of 6 September 2010\n\n--------------------------------------------------------------------------\n"
  },
  {
    "path": "ffmpeg/licenses/ffmpeg.txt",
    "content": "This is a FFmpeg Win32 static build by Kyle Schwarz.\n\nZeranoe's FFmpeg Builds Home Page: <http://ffmpeg.zeranoe.com/builds/>\n\nThis build was compiled on: Jan 20 2013, at: 23:05:28\n\nFFmpeg version: 1.1.1\n  libavutil      52. 13.100 / 52. 13.100\n  libavcodec     54. 86.100 / 54. 86.100\n  libavformat    54. 59.106 / 54. 59.106\n  libavdevice    54.  3.102 / 54.  3.102\n  libavfilter     3. 32.100 /  3. 32.100\n  libswscale      2.  1.103 /  2.  1.103\n  libswresample   0. 17.102 /  0. 17.102\n  libpostproc    52.  2.100 / 52.  2.100\n\nThis FFmpeg build was configured with:\n  --enable-gpl\n  --enable-version3\n  --disable-w32threads\n  --enable-avisynth\n  --enable-bzlib\n  --enable-fontconfig\n  --enable-frei0r\n  --enable-gnutls\n  --enable-libass\n  --enable-libbluray\n  --enable-libcaca\n  --enable-libfreetype\n  --enable-libgsm\n  --enable-libmp3lame\n  --enable-libopencore-amrnb\n  --enable-libopencore-amrwb\n  --enable-libopenjpeg\n  --enable-libopus\n  --enable-librtmp\n  --enable-libschroedinger\n  --enable-libspeex\n  --enable-libtheora\n  --enable-libtwolame\n  --enable-libvo-aacenc\n  --enable-libvo-amrwbenc\n  --enable-libvorbis\n  --enable-libvpx\n  --enable-libx264\n  --enable-libxavs\n  --enable-libxvid\n  --enable-zlib\n\nThis build was compiled with the following external libraries:\n  bzip2 1.0.6 <http://bzip.org/>\n  Fontconfig 2.10.91 <http://freedesktop.org/wiki/Software/fontconfig>\n  Frei0r 20121203-git-f4bac51 <http://frei0r.dyne.org/>\n  GnuTLS 3.1.6 <http://gnutls.org/>\n  libass 0.10.1 <http://code.google.com/p/libass/>\n  libbluray 0.2.3 <http://videolan.org/developers/libbluray.html>\n  libcaca 0.99.beta18 <http://caca.zoy.org/wiki/libcaca>\n  FreeType 2.4.10 <http://freetype.sourceforge.net/>\n  GSM 1.0.13-4 <http://packages.debian.org/source/squeeze/libgsm>\n  LAME 3.99.5 <http://lame.sourceforge.net/>\n  OpenCORE AMR 0.1.3 <http://sourceforge.net/projects/opencore-amr/>\n  OpenJPEG 1.5.1 <http://www.openjpeg.org/>\n  Opus 1.0.2 <http://opus-codec.org/>\n  RTMPDump 20121209-git-3a1e20c <http://rtmpdump.mplayerhq.hu/>\n  Schroedinger 1.0.11 <http://diracvideo.org/>\n  Speex 1.2rc1 <http://speex.org/>\n  Theora 1.1.1 <http://theora.org/>\n  TwoLAME 0.3.13 <http://twolame.org/>\n  VisualOn AAC 0.1.2 <https://github.com/mstorsjo/vo-aacenc>\n  VisualOn AMR-WB 0.1.2 <https://github.com/mstorsjo/vo-amrwbenc>\n  Vorbis 1.3.3 <http://vorbis.com/>\n  vpx 1.2.0 <http://webmproject.org/>\n  x264 20130108-git-bc13772 <http://videolan.org/developers/x264.html>\n  XAVS svn-r55 <http://xavs.sourceforge.net/>\n  Xvid 1.3.2 <http://xvid.org/>\n  zlib 1.2.7 <http://zlib.net/>\n\nThe source code for this FFmpeg build can be found at: <http://ffmpeg.zeranoe.com/builds/source/>\n\nThis build was compiled on Debian 6.0.6 (64-bit): <http://www.debian.org/>\n\nGCC 4.7.2 was used to compile this FFmpeg build: <http://gcc.gnu.org/>\n\nThis build was compiled using the MinGW-w64 toolchain: <http://mingw-w64.sourceforge.net/>\n\nLicenses for each library can be found in the 'licenses' folder.\n\n                    GNU GENERAL PUBLIC LICENSE\n                       Version 2, June 1991\n\n Copyright (C) 1989, 1991 Free Software Foundation, Inc.,\n 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicense is intended to guarantee your freedom to share and change free\nsoftware--to make sure the software is free for all its users.  This\nGeneral Public License applies to most of the Free Software\nFoundation's software and to any other program whose authors commit to\nusing it.  (Some other Free Software Foundation software is covered by\nthe GNU Lesser General Public License instead.)  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthis service if you wish), that you receive source code or can get it\nif you want it, that you can change the software or use pieces of it\nin new free programs; and that you know you can do these things.\n\n  To protect your rights, we need to make restrictions that forbid\nanyone to deny you these rights or to ask you to surrender the rights.\nThese restrictions translate to certain responsibilities for you if you\ndistribute copies of the software, or if you modify it.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must give the recipients all the rights that\nyou have.  You must make sure that they, too, receive or can get the\nsource code.  And you must show them these terms so they know their\nrights.\n\n  We protect your rights with two steps: (1) copyright the software, and\n(2) offer you this license which gives you legal permission to copy,\ndistribute and/or modify the software.\n\n  Also, for each author's protection and ours, we want to make certain\nthat everyone understands that there is no warranty for this free\nsoftware.  If the software is modified by someone else and passed on, we\nwant its recipients to know that what they have is not the original, so\nthat any problems introduced by others will not reflect on the original\nauthors' reputations.\n\n  Finally, any free program is threatened constantly by software\npatents.  We wish to avoid the danger that redistributors of a free\nprogram will individually obtain patent licenses, in effect making the\nprogram proprietary.  To prevent this, we have made it clear that any\npatent must be licensed for everyone's free use or not licensed at all.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                    GNU GENERAL PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. This License applies to any program or other work which contains\na notice placed by the copyright holder saying it may be distributed\nunder the terms of this General Public License.  The \"Program\", below,\nrefers to any such program or work, and a \"work based on the Program\"\nmeans either the Program or any derivative work under copyright law:\nthat is to say, a work containing the Program or a portion of it,\neither verbatim or with modifications and/or translated into another\nlanguage.  (Hereinafter, translation is included without limitation in\nthe term \"modification\".)  Each licensee is addressed as \"you\".\n\nActivities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning the Program is not restricted, and the output from the Program\nis covered only if its contents constitute a work based on the\nProgram (independent of having been made by running the Program).\nWhether that is true depends on what the Program does.\n\n  1. You may copy and distribute verbatim copies of the Program's\nsource code as you receive it, in any medium, provided that you\nconspicuously and appropriately publish on each copy an appropriate\ncopyright notice and disclaimer of warranty; keep intact all the\nnotices that refer to this License and to the absence of any warranty;\nand give any other recipients of the Program a copy of this License\nalong with the Program.\n\nYou may charge a fee for the physical act of transferring a copy, and\nyou may at your option offer warranty protection in exchange for a fee.\n\n  2. You may modify your copy or copies of the Program or any portion\nof it, thus forming a work based on the Program, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n\n    a) You must cause the modified files to carry prominent notices\n    stating that you changed the files and the date of any change.\n\n    b) You must cause any work that you distribute or publish, that in\n    whole or in part contains or is derived from the Program or any\n    part thereof, to be licensed as a whole at no charge to all third\n    parties under the terms of this License.\n\n    c) If the modified program normally reads commands interactively\n    when run, you must cause it, when started running for such\n    interactive use in the most ordinary way, to print or display an\n    announcement including an appropriate copyright notice and a\n    notice that there is no warranty (or else, saying that you provide\n    a warranty) and that users may redistribute the program under\n    these conditions, and telling the user how to view a copy of this\n    License.  (Exception: if the Program itself is interactive but\n    does not normally print such an announcement, your work based on\n    the Program is not required to print an announcement.)\n\nThese requirements apply to the modified work as a whole.  If\nidentifiable sections of that work are not derived from the Program,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works.  But when you\ndistribute the same sections as part of a whole which is a work based\non the Program, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote it.\n\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Program.\n\nIn addition, mere aggregation of another work not based on the Program\nwith the Program (or with a work based on the Program) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n\n  3. You may copy and distribute the Program (or a work based on it,\nunder Section 2) in object code or executable form under the terms of\nSections 1 and 2 above provided that you also do one of the following:\n\n    a) Accompany it with the complete corresponding machine-readable\n    source code, which must be distributed under the terms of Sections\n    1 and 2 above on a medium customarily used for software interchange; or,\n\n    b) Accompany it with a written offer, valid for at least three\n    years, to give any third party, for a charge no more than your\n    cost of physically performing source distribution, a complete\n    machine-readable copy of the corresponding source code, to be\n    distributed under the terms of Sections 1 and 2 above on a medium\n    customarily used for software interchange; or,\n\n    c) Accompany it with the information you received as to the offer\n    to distribute corresponding source code.  (This alternative is\n    allowed only for noncommercial distribution and only if you\n    received the program in object code or executable form with such\n    an offer, in accord with Subsection b above.)\n\nThe source code for a work means the preferred form of the work for\nmaking modifications to it.  For an executable work, complete source\ncode means all the source code for all modules it contains, plus any\nassociated interface definition files, plus the scripts used to\ncontrol compilation and installation of the executable.  However, as a\nspecial exception, the source code distributed need not include\nanything that is normally distributed (in either source or binary\nform) with the major components (compiler, kernel, and so on) of the\noperating system on which the executable runs, unless that component\nitself accompanies the executable.\n\nIf distribution of executable or object code is made by offering\naccess to copy from a designated place, then offering equivalent\naccess to copy the source code from the same place counts as\ndistribution of the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n\n  4. You may not copy, modify, sublicense, or distribute the Program\nexcept as expressly provided under this License.  Any attempt\notherwise to copy, modify, sublicense or distribute the Program is\nvoid, and will automatically terminate your rights under this License.\nHowever, parties who have received copies, or rights, from you under\nthis License will not have their licenses terminated so long as such\nparties remain in full compliance.\n\n  5. You are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Program or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Program (or any work based on the\nProgram), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Program or works based on it.\n\n  6. Each time you redistribute the Program (or any work based on the\nProgram), the recipient automatically receives a license from the\noriginal licensor to copy, distribute or modify the Program subject to\nthese terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties to\nthis License.\n\n  7. If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Program at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Program by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Program.\n\nIf any portion of this section is held invalid or unenforceable under\nany particular circumstance, the balance of the section is intended to\napply and the section as a whole is intended to apply in other\ncircumstances.\n\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system, which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n\n  8. If the distribution and/or use of the Program is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Program under this License\nmay add an explicit geographical distribution limitation excluding\nthose countries, so that distribution is permitted only in or among\ncountries not thus excluded.  In such case, this License incorporates\nthe limitation as if written in the body of this License.\n\n  9. The Free Software Foundation may publish revised and/or new versions\nof the General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\nEach version is given a distinguishing version number.  If the Program\nspecifies a version number of this License which applies to it and \"any\nlater version\", you have the option of following the terms and conditions\neither of that version or of any later version published by the Free\nSoftware Foundation.  If the Program does not specify a version number of\nthis License, you may choose any version ever published by the Free Software\nFoundation.\n\n  10. If you wish to incorporate parts of the Program into other free\nprograms whose distribution conditions are different, write to the author\nto ask for permission.  For software which is copyrighted by the Free\nSoftware Foundation, write to the Free Software Foundation; we sometimes\nmake exceptions for this.  Our decision will be guided by the two goals\nof preserving the free status of all derivatives of our free software and\nof promoting the sharing and reuse of software generally.\n\n                            NO WARRANTY\n\n  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\nFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN\nOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\nPROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\nOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS\nTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE\nPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\nREPAIR OR CORRECTION.\n\n  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\nREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\nINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\nOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\nTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\nYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\nPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGES.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nconvey the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software; you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation; either version 2 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License along\n    with this program; if not, write to the Free Software Foundation, Inc.,\n    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n\nAlso add information on how to contact you by electronic and paper mail.\n\nIf the program is interactive, make it output a short notice like this\nwhen it starts in an interactive mode:\n\n    Gnomovision version 69, Copyright (C) year name of author\n    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, the commands you use may\nbe called something other than `show w' and `show c'; they could even be\nmouse-clicks or menu items--whatever suits your program.\n\nYou should also get your employer (if you work as a programmer) or your\nschool, if any, to sign a \"copyright disclaimer\" for the program, if\nnecessary.  Here is a sample; alter the names:\n\n  Yoyodyne, Inc., hereby disclaims all copyright interest in the program\n  `Gnomovision' (which makes passes at compilers) written by James Hacker.\n\n  <signature of Ty Coon>, 1 April 1989\n  Ty Coon, President of Vice\n\nThis General Public License does not permit incorporating your program into\nproprietary programs.  If your program is a subroutine library, you may\nconsider it more useful to permit linking proprietary applications with the\nlibrary.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License."
  },
  {
    "path": "ffmpeg/licenses/fontconfig.txt",
    "content": "fontconfig/COPYING\n\nCopyright © 2000,2001,2002,2003,2004,2006,2007 Keith Packard\nCopyright © 2005 Patrick Lam\nCopyright © 2009 Roozbeh Pournader\nCopyright © 2008,2009 Red Hat, Inc.\nCopyright © 2008 Danilo Šegan\n\n\nPermission to use, copy, modify, distribute, and sell this software and its\ndocumentation for any purpose is hereby granted without fee, provided that\nthe above copyright notice appear in all copies and that both that\ncopyright notice and this permission notice appear in supporting\ndocumentation, and that the name of the author(s) not be used in\nadvertising or publicity pertaining to distribution of the software without\nspecific, written prior permission.  The authors make no\nrepresentations about the suitability of this software for any purpose.  It\nis provided \"as is\" without express or implied warranty.\n\nTHE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,\nINCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO\nEVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR\nCONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,\nDATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER\nTORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n\n"
  },
  {
    "path": "ffmpeg/licenses/freetype.txt",
    "content": "                    The FreeType Project LICENSE\n                    ----------------------------\n\n                            2006-Jan-27\n\n                    Copyright 1996-2002, 2006 by\n          David Turner, Robert Wilhelm, and Werner Lemberg\n\n\n\nIntroduction\n============\n\n  The FreeType  Project is distributed in  several archive packages;\n  some of them may contain, in addition to the FreeType font engine,\n  various tools and  contributions which rely on, or  relate to, the\n  FreeType Project.\n\n  This  license applies  to all  files found  in such  packages, and\n  which do not  fall under their own explicit  license.  The license\n  affects  thus  the  FreeType   font  engine,  the  test  programs,\n  documentation and makefiles, at the very least.\n\n  This  license   was  inspired  by  the  BSD,   Artistic,  and  IJG\n  (Independent JPEG  Group) licenses, which  all encourage inclusion\n  and  use of  free  software in  commercial  and freeware  products\n  alike.  As a consequence, its main points are that:\n\n    o We don't promise that this software works. However, we will be\n      interested in any kind of bug reports. (`as is' distribution)\n\n    o You can  use this software for whatever you  want, in parts or\n      full form, without having to pay us. (`royalty-free' usage)\n\n    o You may not pretend that  you wrote this software.  If you use\n      it, or  only parts of it,  in a program,  you must acknowledge\n      somewhere  in  your  documentation  that  you  have  used  the\n      FreeType code. (`credits')\n\n  We  specifically  permit  and  encourage  the  inclusion  of  this\n  software, with  or without modifications,  in commercial products.\n  We  disclaim  all warranties  covering  The  FreeType Project  and\n  assume no liability related to The FreeType Project.\n\n\n  Finally,  many  people  asked  us  for  a  preferred  form  for  a\n  credit/disclaimer to use in compliance with this license.  We thus\n  encourage you to use the following text:\n\n   \"\"\"\n    Portions of this software are copyright  <year> The FreeType\n    Project (www.freetype.org).  All rights reserved.\n   \"\"\"\n\n  Please replace <year> with the value from the FreeType version you\n  actually use.\n\n\nLegal Terms\n===========\n\n0. Definitions\n--------------\n\n  Throughout this license,  the terms `package', `FreeType Project',\n  and  `FreeType  archive' refer  to  the  set  of files  originally\n  distributed  by the  authors  (David Turner,  Robert Wilhelm,  and\n  Werner Lemberg) as the `FreeType Project', be they named as alpha,\n  beta or final release.\n\n  `You' refers to  the licensee, or person using  the project, where\n  `using' is a generic term including compiling the project's source\n  code as  well as linking it  to form a  `program' or `executable'.\n  This  program is  referred to  as  `a program  using the  FreeType\n  engine'.\n\n  This  license applies  to all  files distributed  in  the original\n  FreeType  Project,   including  all  source   code,  binaries  and\n  documentation,  unless  otherwise  stated   in  the  file  in  its\n  original, unmodified form as  distributed in the original archive.\n  If you are  unsure whether or not a particular  file is covered by\n  this license, you must contact us to verify this.\n\n  The FreeType  Project is copyright (C) 1996-2000  by David Turner,\n  Robert Wilhelm, and Werner Lemberg.  All rights reserved except as\n  specified below.\n\n1. No Warranty\n--------------\n\n  THE FREETYPE PROJECT  IS PROVIDED `AS IS' WITHOUT  WARRANTY OF ANY\n  KIND, EITHER  EXPRESS OR IMPLIED,  INCLUDING, BUT NOT  LIMITED TO,\n  WARRANTIES  OF  MERCHANTABILITY   AND  FITNESS  FOR  A  PARTICULAR\n  PURPOSE.  IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS\n  BE LIABLE  FOR ANY DAMAGES CAUSED  BY THE USE OR  THE INABILITY TO\n  USE, OF THE FREETYPE PROJECT.\n\n2. Redistribution\n-----------------\n\n  This  license  grants  a  worldwide, royalty-free,  perpetual  and\n  irrevocable right  and license to use,  execute, perform, compile,\n  display,  copy,   create  derivative  works   of,  distribute  and\n  sublicense the  FreeType Project (in  both source and  object code\n  forms)  and  derivative works  thereof  for  any  purpose; and  to\n  authorize others  to exercise  some or all  of the  rights granted\n  herein, subject to the following conditions:\n\n    o Redistribution of  source code  must retain this  license file\n      (`FTL.TXT') unaltered; any  additions, deletions or changes to\n      the original  files must be clearly  indicated in accompanying\n      documentation.   The  copyright   notices  of  the  unaltered,\n      original  files must  be  preserved in  all  copies of  source\n      files.\n\n    o Redistribution in binary form must provide a  disclaimer  that\n      states  that  the software is based in part of the work of the\n      FreeType Team,  in  the  distribution  documentation.  We also\n      encourage you to put an URL to the FreeType web page  in  your\n      documentation, though this isn't mandatory.\n\n  These conditions  apply to any  software derived from or  based on\n  the FreeType Project,  not just the unmodified files.   If you use\n  our work, you  must acknowledge us.  However, no  fee need be paid\n  to us.\n\n3. Advertising\n--------------\n\n  Neither the  FreeType authors and  contributors nor you  shall use\n  the name of the  other for commercial, advertising, or promotional\n  purposes without specific prior written permission.\n\n  We suggest,  but do not require, that  you use one or  more of the\n  following phrases to refer  to this software in your documentation\n  or advertising  materials: `FreeType Project',  `FreeType Engine',\n  `FreeType library', or `FreeType Distribution'.\n\n  As  you have  not signed  this license,  you are  not  required to\n  accept  it.   However,  as  the FreeType  Project  is  copyrighted\n  material, only  this license, or  another one contracted  with the\n  authors, grants you  the right to use, distribute,  and modify it.\n  Therefore,  by  using,  distributing,  or modifying  the  FreeType\n  Project, you indicate that you understand and accept all the terms\n  of this license.\n\n4. Contacts\n-----------\n\n  There are two mailing lists related to FreeType:\n\n    o freetype@nongnu.org\n\n      Discusses general use and applications of FreeType, as well as\n      future and  wanted additions to the  library and distribution.\n      If  you are looking  for support,  start in  this list  if you\n      haven't found anything to help you in the documentation.\n\n    o freetype-devel@nongnu.org\n\n      Discusses bugs,  as well  as engine internals,  design issues,\n      specific licenses, porting, etc.\n\n  Our home page can be found at\n\n    http://www.freetype.org\n\n\n--- end of FTL.TXT ---\n"
  },
  {
    "path": "ffmpeg/licenses/frei0r.txt",
    "content": "\t\t    GNU GENERAL PUBLIC LICENSE\n\t\t       Version 2, June 1991\n\n Copyright (C) 1989, 1991 Free Software Foundation, Inc.\n     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n\t\t\t    Preamble\n\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicense is intended to guarantee your freedom to share and change free\nsoftware--to make sure the software is free for all its users.  This\nGeneral Public License applies to most of the Free Software\nFoundation's software and to any other program whose authors commit to\nusing it.  (Some other Free Software Foundation software is covered by\nthe GNU Library General Public License instead.)  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthis service if you wish), that you receive source code or can get it\nif you want it, that you can change the software or use pieces of it\nin new free programs; and that you know you can do these things.\n\n  To protect your rights, we need to make restrictions that forbid\nanyone to deny you these rights or to ask you to surrender the rights.\nThese restrictions translate to certain responsibilities for you if you\ndistribute copies of the software, or if you modify it.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must give the recipients all the rights that\nyou have.  You must make sure that they, too, receive or can get the\nsource code.  And you must show them these terms so they know their\nrights.\n\n  We protect your rights with two steps: (1) copyright the software, and\n(2) offer you this license which gives you legal permission to copy,\ndistribute and/or modify the software.\n\n  Also, for each author's protection and ours, we want to make certain\nthat everyone understands that there is no warranty for this free\nsoftware.  If the software is modified by someone else and passed on, we\nwant its recipients to know that what they have is not the original, so\nthat any problems introduced by others will not reflect on the original\nauthors' reputations.\n\n  Finally, any free program is threatened constantly by software\npatents.  We wish to avoid the danger that redistributors of a free\nprogram will individually obtain patent licenses, in effect making the\nprogram proprietary.  To prevent this, we have made it clear that any\npatent must be licensed for everyone's free use or not licensed at all.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\f\n\t\t    GNU GENERAL PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. This License applies to any program or other work which contains\na notice placed by the copyright holder saying it may be distributed\nunder the terms of this General Public License.  The \"Program\", below,\nrefers to any such program or work, and a \"work based on the Program\"\nmeans either the Program or any derivative work under copyright law:\nthat is to say, a work containing the Program or a portion of it,\neither verbatim or with modifications and/or translated into another\nlanguage.  (Hereinafter, translation is included without limitation in\nthe term \"modification\".)  Each licensee is addressed as \"you\".\n\nActivities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning the Program is not restricted, and the output from the Program\nis covered only if its contents constitute a work based on the\nProgram (independent of having been made by running the Program).\nWhether that is true depends on what the Program does.\n\n  1. You may copy and distribute verbatim copies of the Program's\nsource code as you receive it, in any medium, provided that you\nconspicuously and appropriately publish on each copy an appropriate\ncopyright notice and disclaimer of warranty; keep intact all the\nnotices that refer to this License and to the absence of any warranty;\nand give any other recipients of the Program a copy of this License\nalong with the Program.\n\nYou may charge a fee for the physical act of transferring a copy, and\nyou may at your option offer warranty protection in exchange for a fee.\n\n  2. You may modify your copy or copies of the Program or any portion\nof it, thus forming a work based on the Program, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n\n    a) You must cause the modified files to carry prominent notices\n    stating that you changed the files and the date of any change.\n\n    b) You must cause any work that you distribute or publish, that in\n    whole or in part contains or is derived from the Program or any\n    part thereof, to be licensed as a whole at no charge to all third\n    parties under the terms of this License.\n\n    c) If the modified program normally reads commands interactively\n    when run, you must cause it, when started running for such\n    interactive use in the most ordinary way, to print or display an\n    announcement including an appropriate copyright notice and a\n    notice that there is no warranty (or else, saying that you provide\n    a warranty) and that users may redistribute the program under\n    these conditions, and telling the user how to view a copy of this\n    License.  (Exception: if the Program itself is interactive but\n    does not normally print such an announcement, your work based on\n    the Program is not required to print an announcement.)\n\f\nThese requirements apply to the modified work as a whole.  If\nidentifiable sections of that work are not derived from the Program,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works.  But when you\ndistribute the same sections as part of a whole which is a work based\non the Program, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote it.\n\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Program.\n\nIn addition, mere aggregation of another work not based on the Program\nwith the Program (or with a work based on the Program) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n\n  3. You may copy and distribute the Program (or a work based on it,\nunder Section 2) in object code or executable form under the terms of\nSections 1 and 2 above provided that you also do one of the following:\n\n    a) Accompany it with the complete corresponding machine-readable\n    source code, which must be distributed under the terms of Sections\n    1 and 2 above on a medium customarily used for software interchange; or,\n\n    b) Accompany it with a written offer, valid for at least three\n    years, to give any third party, for a charge no more than your\n    cost of physically performing source distribution, a complete\n    machine-readable copy of the corresponding source code, to be\n    distributed under the terms of Sections 1 and 2 above on a medium\n    customarily used for software interchange; or,\n\n    c) Accompany it with the information you received as to the offer\n    to distribute corresponding source code.  (This alternative is\n    allowed only for noncommercial distribution and only if you\n    received the program in object code or executable form with such\n    an offer, in accord with Subsection b above.)\n\nThe source code for a work means the preferred form of the work for\nmaking modifications to it.  For an executable work, complete source\ncode means all the source code for all modules it contains, plus any\nassociated interface definition files, plus the scripts used to\ncontrol compilation and installation of the executable.  However, as a\nspecial exception, the source code distributed need not include\nanything that is normally distributed (in either source or binary\nform) with the major components (compiler, kernel, and so on) of the\noperating system on which the executable runs, unless that component\nitself accompanies the executable.\n\nIf distribution of executable or object code is made by offering\naccess to copy from a designated place, then offering equivalent\naccess to copy the source code from the same place counts as\ndistribution of the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n\f\n  4. You may not copy, modify, sublicense, or distribute the Program\nexcept as expressly provided under this License.  Any attempt\notherwise to copy, modify, sublicense or distribute the Program is\nvoid, and will automatically terminate your rights under this License.\nHowever, parties who have received copies, or rights, from you under\nthis License will not have their licenses terminated so long as such\nparties remain in full compliance.\n\n  5. You are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Program or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Program (or any work based on the\nProgram), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Program or works based on it.\n\n  6. Each time you redistribute the Program (or any work based on the\nProgram), the recipient automatically receives a license from the\noriginal licensor to copy, distribute or modify the Program subject to\nthese terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties to\nthis License.\n\n  7. If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Program at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Program by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Program.\n\nIf any portion of this section is held invalid or unenforceable under\nany particular circumstance, the balance of the section is intended to\napply and the section as a whole is intended to apply in other\ncircumstances.\n\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system, which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n\f\n  8. If the distribution and/or use of the Program is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Program under this License\nmay add an explicit geographical distribution limitation excluding\nthose countries, so that distribution is permitted only in or among\ncountries not thus excluded.  In such case, this License incorporates\nthe limitation as if written in the body of this License.\n\n  9. The Free Software Foundation may publish revised and/or new versions\nof the General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\nEach version is given a distinguishing version number.  If the Program\nspecifies a version number of this License which applies to it and \"any\nlater version\", you have the option of following the terms and conditions\neither of that version or of any later version published by the Free\nSoftware Foundation.  If the Program does not specify a version number of\nthis License, you may choose any version ever published by the Free Software\nFoundation.\n\n  10. If you wish to incorporate parts of the Program into other free\nprograms whose distribution conditions are different, write to the author\nto ask for permission.  For software which is copyrighted by the Free\nSoftware Foundation, write to the Free Software Foundation; we sometimes\nmake exceptions for this.  Our decision will be guided by the two goals\nof preserving the free status of all derivatives of our free software and\nof promoting the sharing and reuse of software generally.\n\n\t\t\t    NO WARRANTY\n\n  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\nFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN\nOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\nPROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\nOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS\nTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE\nPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\nREPAIR OR CORRECTION.\n\n  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\nREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\nINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\nOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\nTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\nYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\nPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGES.\n\n\t\t     END OF TERMS AND CONDITIONS\n\f\n\t    How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nconvey the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software; you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation; either version 2 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program; if not, write to the Free Software\n    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n\n\nAlso add information on how to contact you by electronic and paper mail.\n\nIf the program is interactive, make it output a short notice like this\nwhen it starts in an interactive mode:\n\n    Gnomovision version 69, Copyright (C) year  name of author\n    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, the commands you use may\nbe called something other than `show w' and `show c'; they could even be\nmouse-clicks or menu items--whatever suits your program.\n\nYou should also get your employer (if you work as a programmer) or your\nschool, if any, to sign a \"copyright disclaimer\" for the program, if\nnecessary.  Here is a sample; alter the names:\n\n  Yoyodyne, Inc., hereby disclaims all copyright interest in the program\n  `Gnomovision' (which makes passes at compilers) written by James Hacker.\n\n  <signature of Ty Coon>, 1 April 1989\n  Ty Coon, President of Vice\n\nThis General Public License does not permit incorporating your program into\nproprietary programs.  If your program is a subroutine library, you may\nconsider it more useful to permit linking proprietary applications with the\nlibrary.  If this is what you want to do, use the GNU Library General\nPublic License instead of this License.\n"
  },
  {
    "path": "ffmpeg/licenses/gnutls.txt",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<http://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<http://www.gnu.org/philosophy/why-not-lgpl.html>.\n"
  },
  {
    "path": "ffmpeg/licenses/lame.txt",
    "content": "\t\t  GNU LIBRARY GENERAL PUBLIC LICENSE\n\t\t       Version 2, June 1991\n\n Copyright (C) 1991 Free Software Foundation, Inc.\n    \t\t    59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n[This is the first released version of the library GPL.  It is\n numbered 2 because it goes with version 2 of the ordinary GPL.]\n\n\t\t\t    Preamble\n\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicenses are intended to guarantee your freedom to share and change\nfree software--to make sure the software is free for all its users.\n\n  This license, the Library General Public License, applies to some\nspecially designated Free Software Foundation software, and to any\nother libraries whose authors decide to use it.  You can use it for\nyour libraries, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthis service if you wish), that you receive source code or can get it\nif you want it, that you can change the software or use pieces of it\nin new free programs; and that you know you can do these things.\n\n  To protect your rights, we need to make restrictions that forbid\nanyone to deny you these rights or to ask you to surrender the rights.\nThese restrictions translate to certain responsibilities for you if\nyou distribute copies of the library, or if you modify it.\n\n  For example, if you distribute copies of the library, whether gratis\nor for a fee, you must give the recipients all the rights that we gave\nyou.  You must make sure that they, too, receive or can get the source\ncode.  If you link a program with the library, you must provide\ncomplete object files to the recipients so that they can relink them\nwith the library, after making changes to the library and recompiling\nit.  And you must show them these terms so they know their rights.\n\n  Our method of protecting your rights has two steps: (1) copyright\nthe library, and (2) offer you this license which gives you legal\npermission to copy, distribute and/or modify the library.\n\n  Also, for each distributor's protection, we want to make certain\nthat everyone understands that there is no warranty for this free\nlibrary.  If the library is modified by someone else and passed on, we\nwant its recipients to know that what they have is not the original\nversion, so that any problems introduced by others will not reflect on\nthe original authors' reputations.\n\f\n  Finally, any free program is threatened constantly by software\npatents.  We wish to avoid the danger that companies distributing free\nsoftware will individually obtain patent licenses, thus in effect\ntransforming the program into proprietary software.  To prevent this,\nwe have made it clear that any patent must be licensed for everyone's\nfree use or not licensed at all.\n\n  Most GNU software, including some libraries, is covered by the ordinary\nGNU General Public License, which was designed for utility programs.  This\nlicense, the GNU Library General Public License, applies to certain\ndesignated libraries.  This license is quite different from the ordinary\none; be sure to read it in full, and don't assume that anything in it is\nthe same as in the ordinary license.\n\n  The reason we have a separate public license for some libraries is that\nthey blur the distinction we usually make between modifying or adding to a\nprogram and simply using it.  Linking a program with a library, without\nchanging the library, is in some sense simply using the library, and is\nanalogous to running a utility program or application program.  However, in\na textual and legal sense, the linked executable is a combined work, a\nderivative of the original library, and the ordinary General Public License\ntreats it as such.\n\n  Because of this blurred distinction, using the ordinary General\nPublic License for libraries did not effectively promote software\nsharing, because most developers did not use the libraries.  We\nconcluded that weaker conditions might promote sharing better.\n\n  However, unrestricted linking of non-free programs would deprive the\nusers of those programs of all benefit from the free status of the\nlibraries themselves.  This Library General Public License is intended to\npermit developers of non-free programs to use free libraries, while\npreserving your freedom as a user of such programs to change the free\nlibraries that are incorporated in them.  (We have not seen how to achieve\nthis as regards changes in header files, but we have achieved it as regards\nchanges in the actual functions of the Library.)  The hope is that this\nwill lead to faster development of free libraries.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.  Pay close attention to the difference between a\n\"work based on the library\" and a \"work that uses the library\".  The\nformer contains code derived from the library, while the latter only\nworks together with the library.\n\n  Note that it is possible for a library to be covered by the ordinary\nGeneral Public License rather than by this special one.\n\f\n\t\t  GNU LIBRARY GENERAL PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. This License Agreement applies to any software library which\ncontains a notice placed by the copyright holder or other authorized\nparty saying it may be distributed under the terms of this Library\nGeneral Public License (also called \"this License\").  Each licensee is\naddressed as \"you\".\n\n  A \"library\" means a collection of software functions and/or data\nprepared so as to be conveniently linked with application programs\n(which use some of those functions and data) to form executables.\n\n  The \"Library\", below, refers to any such software library or work\nwhich has been distributed under these terms.  A \"work based on the\nLibrary\" means either the Library or any derivative work under\ncopyright law: that is to say, a work containing the Library or a\nportion of it, either verbatim or with modifications and/or translated\nstraightforwardly into another language.  (Hereinafter, translation is\nincluded without limitation in the term \"modification\".)\n\n  \"Source code\" for a work means the preferred form of the work for\nmaking modifications to it.  For a library, complete source code means\nall the source code for all modules it contains, plus any associated\ninterface definition files, plus the scripts used to control compilation\nand installation of the library.\n\n  Activities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning a program using the Library is not restricted, and output from\nsuch a program is covered only if its contents constitute a work based\non the Library (independent of the use of the Library in a tool for\nwriting it).  Whether that is true depends on what the Library does\nand what the program that uses the Library does.\n  \n  1. You may copy and distribute verbatim copies of the Library's\ncomplete source code as you receive it, in any medium, provided that\nyou conspicuously and appropriately publish on each copy an\nappropriate copyright notice and disclaimer of warranty; keep intact\nall the notices that refer to this License and to the absence of any\nwarranty; and distribute a copy of this License along with the\nLibrary.\n\n  You may charge a fee for the physical act of transferring a copy,\nand you may at your option offer warranty protection in exchange for a\nfee.\n\f\n  2. You may modify your copy or copies of the Library or any portion\nof it, thus forming a work based on the Library, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n\n    a) The modified work must itself be a software library.\n\n    b) You must cause the files modified to carry prominent notices\n    stating that you changed the files and the date of any change.\n\n    c) You must cause the whole of the work to be licensed at no\n    charge to all third parties under the terms of this License.\n\n    d) If a facility in the modified Library refers to a function or a\n    table of data to be supplied by an application program that uses\n    the facility, other than as an argument passed when the facility\n    is invoked, then you must make a good faith effort to ensure that,\n    in the event an application does not supply such function or\n    table, the facility still operates, and performs whatever part of\n    its purpose remains meaningful.\n\n    (For example, a function in a library to compute square roots has\n    a purpose that is entirely well-defined independent of the\n    application.  Therefore, Subsection 2d requires that any\n    application-supplied function or table used by this function must\n    be optional: if the application does not supply it, the square\n    root function must still compute square roots.)\n\nThese requirements apply to the modified work as a whole.  If\nidentifiable sections of that work are not derived from the Library,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works.  But when you\ndistribute the same sections as part of a whole which is a work based\non the Library, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote\nit.\n\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Library.\n\nIn addition, mere aggregation of another work not based on the Library\nwith the Library (or with a work based on the Library) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n\n  3. You may opt to apply the terms of the ordinary GNU General Public\nLicense instead of this License to a given copy of the Library.  To do\nthis, you must alter all the notices that refer to this License, so\nthat they refer to the ordinary GNU General Public License, version 2,\ninstead of to this License.  (If a newer version than version 2 of the\nordinary GNU General Public License has appeared, then you can specify\nthat version instead if you wish.)  Do not make any other change in\nthese notices.\n\f\n  Once this change is made in a given copy, it is irreversible for\nthat copy, so the ordinary GNU General Public License applies to all\nsubsequent copies and derivative works made from that copy.\n\n  This option is useful when you wish to copy part of the code of\nthe Library into a program that is not a library.\n\n  4. You may copy and distribute the Library (or a portion or\nderivative of it, under Section 2) in object code or executable form\nunder the terms of Sections 1 and 2 above provided that you accompany\nit with the complete corresponding machine-readable source code, which\nmust be distributed under the terms of Sections 1 and 2 above on a\nmedium customarily used for software interchange.\n\n  If distribution of object code is made by offering access to copy\nfrom a designated place, then offering equivalent access to copy the\nsource code from the same place satisfies the requirement to\ndistribute the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n\n  5. A program that contains no derivative of any portion of the\nLibrary, but is designed to work with the Library by being compiled or\nlinked with it, is called a \"work that uses the Library\".  Such a\nwork, in isolation, is not a derivative work of the Library, and\ntherefore falls outside the scope of this License.\n\n  However, linking a \"work that uses the Library\" with the Library\ncreates an executable that is a derivative of the Library (because it\ncontains portions of the Library), rather than a \"work that uses the\nlibrary\".  The executable is therefore covered by this License.\nSection 6 states terms for distribution of such executables.\n\n  When a \"work that uses the Library\" uses material from a header file\nthat is part of the Library, the object code for the work may be a\nderivative work of the Library even though the source code is not.\nWhether this is true is especially significant if the work can be\nlinked without the Library, or if the work is itself a library.  The\nthreshold for this to be true is not precisely defined by law.\n\n  If such an object file uses only numerical parameters, data\nstructure layouts and accessors, and small macros and small inline\nfunctions (ten lines or less in length), then the use of the object\nfile is unrestricted, regardless of whether it is legally a derivative\nwork.  (Executables containing this object code plus portions of the\nLibrary will still fall under Section 6.)\n\n  Otherwise, if the work is a derivative of the Library, you may\ndistribute the object code for the work under the terms of Section 6.\nAny executables containing that work also fall under Section 6,\nwhether or not they are linked directly with the Library itself.\n\f\n  6. As an exception to the Sections above, you may also compile or\nlink a \"work that uses the Library\" with the Library to produce a\nwork containing portions of the Library, and distribute that work\nunder terms of your choice, provided that the terms permit\nmodification of the work for the customer's own use and reverse\nengineering for debugging such modifications.\n\n  You must give prominent notice with each copy of the work that the\nLibrary is used in it and that the Library and its use are covered by\nthis License.  You must supply a copy of this License.  If the work\nduring execution displays copyright notices, you must include the\ncopyright notice for the Library among them, as well as a reference\ndirecting the user to the copy of this License.  Also, you must do one\nof these things:\n\n    a) Accompany the work with the complete corresponding\n    machine-readable source code for the Library including whatever\n    changes were used in the work (which must be distributed under\n    Sections 1 and 2 above); and, if the work is an executable linked\n    with the Library, with the complete machine-readable \"work that\n    uses the Library\", as object code and/or source code, so that the\n    user can modify the Library and then relink to produce a modified\n    executable containing the modified Library.  (It is understood\n    that the user who changes the contents of definitions files in the\n    Library will not necessarily be able to recompile the application\n    to use the modified definitions.)\n\n    b) Accompany the work with a written offer, valid for at\n    least three years, to give the same user the materials\n    specified in Subsection 6a, above, for a charge no more\n    than the cost of performing this distribution.\n\n    c) If distribution of the work is made by offering access to copy\n    from a designated place, offer equivalent access to copy the above\n    specified materials from the same place.\n\n    d) Verify that the user has already received a copy of these\n    materials or that you have already sent this user a copy.\n\n  For an executable, the required form of the \"work that uses the\nLibrary\" must include any data and utility programs needed for\nreproducing the executable from it.  However, as a special exception,\nthe source code distributed need not include anything that is normally\ndistributed (in either source or binary form) with the major\ncomponents (compiler, kernel, and so on) of the operating system on\nwhich the executable runs, unless that component itself accompanies\nthe executable.\n\n  It may happen that this requirement contradicts the license\nrestrictions of other proprietary libraries that do not normally\naccompany the operating system.  Such a contradiction means you cannot\nuse both them and the Library together in an executable that you\ndistribute.\n\f\n  7. You may place library facilities that are a work based on the\nLibrary side-by-side in a single library together with other library\nfacilities not covered by this License, and distribute such a combined\nlibrary, provided that the separate distribution of the work based on\nthe Library and of the other library facilities is otherwise\npermitted, and provided that you do these two things:\n\n    a) Accompany the combined library with a copy of the same work\n    based on the Library, uncombined with any other library\n    facilities.  This must be distributed under the terms of the\n    Sections above.\n\n    b) Give prominent notice with the combined library of the fact\n    that part of it is a work based on the Library, and explaining\n    where to find the accompanying uncombined form of the same work.\n\n  8. You may not copy, modify, sublicense, link with, or distribute\nthe Library except as expressly provided under this License.  Any\nattempt otherwise to copy, modify, sublicense, link with, or\ndistribute the Library is void, and will automatically terminate your\nrights under this License.  However, parties who have received copies,\nor rights, from you under this License will not have their licenses\nterminated so long as such parties remain in full compliance.\n\n  9. You are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Library or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Library (or any work based on the\nLibrary), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Library or works based on it.\n\n  10. Each time you redistribute the Library (or any work based on the\nLibrary), the recipient automatically receives a license from the\noriginal licensor to copy, distribute, link with or modify the Library\nsubject to these terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties to\nthis License.\n\f\n  11. If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Library at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Library by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Library.\n\nIf any portion of this section is held invalid or unenforceable under any\nparticular circumstance, the balance of the section is intended to apply,\nand the section as a whole is intended to apply in other circumstances.\n\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n\n  12. If the distribution and/or use of the Library is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Library under this License may add\nan explicit geographical distribution limitation excluding those countries,\nso that distribution is permitted only in or among countries not thus\nexcluded.  In such case, this License incorporates the limitation as if\nwritten in the body of this License.\n\n  13. The Free Software Foundation may publish revised and/or new\nversions of the Library General Public License from time to time.\nSuch new versions will be similar in spirit to the present version,\nbut may differ in detail to address new problems or concerns.\n\nEach version is given a distinguishing version number.  If the Library\nspecifies a version number of this License which applies to it and\n\"any later version\", you have the option of following the terms and\nconditions either of that version or of any later version published by\nthe Free Software Foundation.  If the Library does not specify a\nlicense version number, you may choose any version ever published by\nthe Free Software Foundation.\n\f\n  14. If you wish to incorporate parts of the Library into other free\nprograms whose distribution conditions are incompatible with these,\nwrite to the author to ask for permission.  For software which is\ncopyrighted by the Free Software Foundation, write to the Free\nSoftware Foundation; we sometimes make exceptions for this.  Our\ndecision will be guided by the two goals of preserving the free status\nof all derivatives of our free software and of promoting the sharing\nand reuse of software generally.\n\n\t\t\t    NO WARRANTY\n\n  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO\nWARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.\nEXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR\nOTHER PARTIES PROVIDE THE LIBRARY \"AS IS\" WITHOUT WARRANTY OF ANY\nKIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE\nLIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME\nTHE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN\nWRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY\nAND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU\nFOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR\nCONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE\nLIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING\nRENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A\nFAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF\nSUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\nDAMAGES.\n\n\t\t     END OF TERMS AND CONDITIONS\n\f\n           How to Apply These Terms to Your New Libraries\n\n  If you develop a new library, and you want it to be of the greatest\npossible use to the public, we recommend making it free software that\neveryone can redistribute and change.  You can do so by permitting\nredistribution under these terms (or, alternatively, under the terms of the\nordinary General Public License).\n\n  To apply these terms, attach the following notices to the library.  It is\nsafest to attach them to the start of each source file to most effectively\nconvey the exclusion of warranty; and each file should have at least the\n\"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the library's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This library is free software; you can redistribute it and/or\n    modify it under the terms of the GNU Library General Public\n    License as published by the Free Software Foundation; either\n    version 2 of the License, or (at your option) any later version.\n\n    This library is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n    Library General Public License for more details.\n\n    You should have received a copy of the GNU Library General Public\n    License along with this library; if not, write to the Free Software\n    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n\nAlso add information on how to contact you by electronic and paper mail.\n\nYou should also get your employer (if you work as a programmer) or your\nschool, if any, to sign a \"copyright disclaimer\" for the library, if\nnecessary.  Here is a sample; alter the names:\n\n  Yoyodyne, Inc., hereby disclaims all copyright interest in the\n  library `Frob' (a library for tweaking knobs) written by James Random Hacker.\n\n  <signature of Ty Coon>, 1 April 1990\n  Ty Coon, President of Vice\n\nThat's all there is to it!\n"
  },
  {
    "path": "ffmpeg/licenses/libass.txt",
    "content": "Permission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted, provided that the above\ncopyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\nWITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\nANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\nWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\nACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\nOR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n"
  },
  {
    "path": "ffmpeg/licenses/libbluray.txt",
    "content": "                  GNU LESSER GENERAL PUBLIC LICENSE\n                       Version 2.1, February 1999\n\n Copyright (C) 1991, 1999 Free Software Foundation, Inc.\n 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n[This is the first released version of the Lesser GPL.  It also counts\n as the successor of the GNU Library Public License, version 2, hence\n the version number 2.1.]\n\n                            Preamble\n\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicenses are intended to guarantee your freedom to share and change\nfree software--to make sure the software is free for all its users.\n\n  This license, the Lesser General Public License, applies to some\nspecially designated software packages--typically libraries--of the\nFree Software Foundation and other authors who decide to use it.  You\ncan use it too, but we suggest you first think carefully about whether\nthis license or the ordinary General Public License is the better\nstrategy to use in any particular case, based on the explanations below.\n\n  When we speak of free software, we are referring to freedom of use,\nnot price.  Our General Public Licenses are designed to make sure that\nyou have the freedom to distribute copies of free software (and charge\nfor this service if you wish); that you receive source code or can get\nit if you want it; that you can change the software and use pieces of\nit in new free programs; and that you are informed that you can do\nthese things.\n\n  To protect your rights, we need to make restrictions that forbid\ndistributors to deny you these rights or to ask you to surrender these\nrights.  These restrictions translate to certain responsibilities for\nyou if you distribute copies of the library or if you modify it.\n\n  For example, if you distribute copies of the library, whether gratis\nor for a fee, you must give the recipients all the rights that we gave\nyou.  You must make sure that they, too, receive or can get the source\ncode.  If you link other code with the library, you must provide\ncomplete object files to the recipients, so that they can relink them\nwith the library after making changes to the library and recompiling\nit.  And you must show them these terms so they know their rights.\n\n  We protect your rights with a two-step method: (1) we copyright the\nlibrary, and (2) we offer you this license, which gives you legal\npermission to copy, distribute and/or modify the library.\n\n  To protect each distributor, we want to make it very clear that\nthere is no warranty for the free library.  Also, if the library is\nmodified by someone else and passed on, the recipients should know\nthat what they have is not the original version, so that the original\nauthor's reputation will not be affected by problems that might be\nintroduced by others.\n\n  Finally, software patents pose a constant threat to the existence of\nany free program.  We wish to make sure that a company cannot\neffectively restrict the users of a free program by obtaining a\nrestrictive license from a patent holder.  Therefore, we insist that\nany patent license obtained for a version of the library must be\nconsistent with the full freedom of use specified in this license.\n\n  Most GNU software, including some libraries, is covered by the\nordinary GNU General Public License.  This license, the GNU Lesser\nGeneral Public License, applies to certain designated libraries, and\nis quite different from the ordinary General Public License.  We use\nthis license for certain libraries in order to permit linking those\nlibraries into non-free programs.\n\n  When a program is linked with a library, whether statically or using\na shared library, the combination of the two is legally speaking a\ncombined work, a derivative of the original library.  The ordinary\nGeneral Public License therefore permits such linking only if the\nentire combination fits its criteria of freedom.  The Lesser General\nPublic License permits more lax criteria for linking other code with\nthe library.\n\n  We call this license the \"Lesser\" General Public License because it\ndoes Less to protect the user's freedom than the ordinary General\nPublic License.  It also provides other free software developers Less\nof an advantage over competing non-free programs.  These disadvantages\nare the reason we use the ordinary General Public License for many\nlibraries.  However, the Lesser license provides advantages in certain\nspecial circumstances.\n\n  For example, on rare occasions, there may be a special need to\nencourage the widest possible use of a certain library, so that it becomes\na de-facto standard.  To achieve this, non-free programs must be\nallowed to use the library.  A more frequent case is that a free\nlibrary does the same job as widely used non-free libraries.  In this\ncase, there is little to gain by limiting the free library to free\nsoftware only, so we use the Lesser General Public License.\n\n  In other cases, permission to use a particular library in non-free\nprograms enables a greater number of people to use a large body of\nfree software.  For example, permission to use the GNU C Library in\nnon-free programs enables many more people to use the whole GNU\noperating system, as well as its variant, the GNU/Linux operating\nsystem.\n\n  Although the Lesser General Public License is Less protective of the\nusers' freedom, it does ensure that the user of a program that is\nlinked with the Library has the freedom and the wherewithal to run\nthat program using a modified version of the Library.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.  Pay close attention to the difference between a\n\"work based on the library\" and a \"work that uses the library\".  The\nformer contains code derived from the library, whereas the latter must\nbe combined with the library in order to run.\n\n                  GNU LESSER GENERAL PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. This License Agreement applies to any software library or other\nprogram which contains a notice placed by the copyright holder or\nother authorized party saying it may be distributed under the terms of\nthis Lesser General Public License (also called \"this License\").\nEach licensee is addressed as \"you\".\n\n  A \"library\" means a collection of software functions and/or data\nprepared so as to be conveniently linked with application programs\n(which use some of those functions and data) to form executables.\n\n  The \"Library\", below, refers to any such software library or work\nwhich has been distributed under these terms.  A \"work based on the\nLibrary\" means either the Library or any derivative work under\ncopyright law: that is to say, a work containing the Library or a\nportion of it, either verbatim or with modifications and/or translated\nstraightforwardly into another language.  (Hereinafter, translation is\nincluded without limitation in the term \"modification\".)\n\n  \"Source code\" for a work means the preferred form of the work for\nmaking modifications to it.  For a library, complete source code means\nall the source code for all modules it contains, plus any associated\ninterface definition files, plus the scripts used to control compilation\nand installation of the library.\n\n  Activities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning a program using the Library is not restricted, and output from\nsuch a program is covered only if its contents constitute a work based\non the Library (independent of the use of the Library in a tool for\nwriting it).  Whether that is true depends on what the Library does\nand what the program that uses the Library does.\n\n  1. You may copy and distribute verbatim copies of the Library's\ncomplete source code as you receive it, in any medium, provided that\nyou conspicuously and appropriately publish on each copy an\nappropriate copyright notice and disclaimer of warranty; keep intact\nall the notices that refer to this License and to the absence of any\nwarranty; and distribute a copy of this License along with the\nLibrary.\n\n  You may charge a fee for the physical act of transferring a copy,\nand you may at your option offer warranty protection in exchange for a\nfee.\n\n  2. You may modify your copy or copies of the Library or any portion\nof it, thus forming a work based on the Library, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n\n    a) The modified work must itself be a software library.\n\n    b) You must cause the files modified to carry prominent notices\n    stating that you changed the files and the date of any change.\n\n    c) You must cause the whole of the work to be licensed at no\n    charge to all third parties under the terms of this License.\n\n    d) If a facility in the modified Library refers to a function or a\n    table of data to be supplied by an application program that uses\n    the facility, other than as an argument passed when the facility\n    is invoked, then you must make a good faith effort to ensure that,\n    in the event an application does not supply such function or\n    table, the facility still operates, and performs whatever part of\n    its purpose remains meaningful.\n\n    (For example, a function in a library to compute square roots has\n    a purpose that is entirely well-defined independent of the\n    application.  Therefore, Subsection 2d requires that any\n    application-supplied function or table used by this function must\n    be optional: if the application does not supply it, the square\n    root function must still compute square roots.)\n\nThese requirements apply to the modified work as a whole.  If\nidentifiable sections of that work are not derived from the Library,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works.  But when you\ndistribute the same sections as part of a whole which is a work based\non the Library, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote\nit.\n\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Library.\n\nIn addition, mere aggregation of another work not based on the Library\nwith the Library (or with a work based on the Library) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n\n  3. You may opt to apply the terms of the ordinary GNU General Public\nLicense instead of this License to a given copy of the Library.  To do\nthis, you must alter all the notices that refer to this License, so\nthat they refer to the ordinary GNU General Public License, version 2,\ninstead of to this License.  (If a newer version than version 2 of the\nordinary GNU General Public License has appeared, then you can specify\nthat version instead if you wish.)  Do not make any other change in\nthese notices.\n\n  Once this change is made in a given copy, it is irreversible for\nthat copy, so the ordinary GNU General Public License applies to all\nsubsequent copies and derivative works made from that copy.\n\n  This option is useful when you wish to copy part of the code of\nthe Library into a program that is not a library.\n\n  4. You may copy and distribute the Library (or a portion or\nderivative of it, under Section 2) in object code or executable form\nunder the terms of Sections 1 and 2 above provided that you accompany\nit with the complete corresponding machine-readable source code, which\nmust be distributed under the terms of Sections 1 and 2 above on a\nmedium customarily used for software interchange.\n\n  If distribution of object code is made by offering access to copy\nfrom a designated place, then offering equivalent access to copy the\nsource code from the same place satisfies the requirement to\ndistribute the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n\n  5. A program that contains no derivative of any portion of the\nLibrary, but is designed to work with the Library by being compiled or\nlinked with it, is called a \"work that uses the Library\".  Such a\nwork, in isolation, is not a derivative work of the Library, and\ntherefore falls outside the scope of this License.\n\n  However, linking a \"work that uses the Library\" with the Library\ncreates an executable that is a derivative of the Library (because it\ncontains portions of the Library), rather than a \"work that uses the\nlibrary\".  The executable is therefore covered by this License.\nSection 6 states terms for distribution of such executables.\n\n  When a \"work that uses the Library\" uses material from a header file\nthat is part of the Library, the object code for the work may be a\nderivative work of the Library even though the source code is not.\nWhether this is true is especially significant if the work can be\nlinked without the Library, or if the work is itself a library.  The\nthreshold for this to be true is not precisely defined by law.\n\n  If such an object file uses only numerical parameters, data\nstructure layouts and accessors, and small macros and small inline\nfunctions (ten lines or less in length), then the use of the object\nfile is unrestricted, regardless of whether it is legally a derivative\nwork.  (Executables containing this object code plus portions of the\nLibrary will still fall under Section 6.)\n\n  Otherwise, if the work is a derivative of the Library, you may\ndistribute the object code for the work under the terms of Section 6.\nAny executables containing that work also fall under Section 6,\nwhether or not they are linked directly with the Library itself.\n\n  6. As an exception to the Sections above, you may also combine or\nlink a \"work that uses the Library\" with the Library to produce a\nwork containing portions of the Library, and distribute that work\nunder terms of your choice, provided that the terms permit\nmodification of the work for the customer's own use and reverse\nengineering for debugging such modifications.\n\n  You must give prominent notice with each copy of the work that the\nLibrary is used in it and that the Library and its use are covered by\nthis License.  You must supply a copy of this License.  If the work\nduring execution displays copyright notices, you must include the\ncopyright notice for the Library among them, as well as a reference\ndirecting the user to the copy of this License.  Also, you must do one\nof these things:\n\n    a) Accompany the work with the complete corresponding\n    machine-readable source code for the Library including whatever\n    changes were used in the work (which must be distributed under\n    Sections 1 and 2 above); and, if the work is an executable linked\n    with the Library, with the complete machine-readable \"work that\n    uses the Library\", as object code and/or source code, so that the\n    user can modify the Library and then relink to produce a modified\n    executable containing the modified Library.  (It is understood\n    that the user who changes the contents of definitions files in the\n    Library will not necessarily be able to recompile the application\n    to use the modified definitions.)\n\n    b) Use a suitable shared library mechanism for linking with the\n    Library.  A suitable mechanism is one that (1) uses at run time a\n    copy of the library already present on the user's computer system,\n    rather than copying library functions into the executable, and (2)\n    will operate properly with a modified version of the library, if\n    the user installs one, as long as the modified version is\n    interface-compatible with the version that the work was made with.\n\n    c) Accompany the work with a written offer, valid for at\n    least three years, to give the same user the materials\n    specified in Subsection 6a, above, for a charge no more\n    than the cost of performing this distribution.\n\n    d) If distribution of the work is made by offering access to copy\n    from a designated place, offer equivalent access to copy the above\n    specified materials from the same place.\n\n    e) Verify that the user has already received a copy of these\n    materials or that you have already sent this user a copy.\n\n  For an executable, the required form of the \"work that uses the\nLibrary\" must include any data and utility programs needed for\nreproducing the executable from it.  However, as a special exception,\nthe materials to be distributed need not include anything that is\nnormally distributed (in either source or binary form) with the major\ncomponents (compiler, kernel, and so on) of the operating system on\nwhich the executable runs, unless that component itself accompanies\nthe executable.\n\n  It may happen that this requirement contradicts the license\nrestrictions of other proprietary libraries that do not normally\naccompany the operating system.  Such a contradiction means you cannot\nuse both them and the Library together in an executable that you\ndistribute.\n\n  7. You may place library facilities that are a work based on the\nLibrary side-by-side in a single library together with other library\nfacilities not covered by this License, and distribute such a combined\nlibrary, provided that the separate distribution of the work based on\nthe Library and of the other library facilities is otherwise\npermitted, and provided that you do these two things:\n\n    a) Accompany the combined library with a copy of the same work\n    based on the Library, uncombined with any other library\n    facilities.  This must be distributed under the terms of the\n    Sections above.\n\n    b) Give prominent notice with the combined library of the fact\n    that part of it is a work based on the Library, and explaining\n    where to find the accompanying uncombined form of the same work.\n\n  8. You may not copy, modify, sublicense, link with, or distribute\nthe Library except as expressly provided under this License.  Any\nattempt otherwise to copy, modify, sublicense, link with, or\ndistribute the Library is void, and will automatically terminate your\nrights under this License.  However, parties who have received copies,\nor rights, from you under this License will not have their licenses\nterminated so long as such parties remain in full compliance.\n\n  9. You are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Library or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Library (or any work based on the\nLibrary), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Library or works based on it.\n\n  10. Each time you redistribute the Library (or any work based on the\nLibrary), the recipient automatically receives a license from the\noriginal licensor to copy, distribute, link with or modify the Library\nsubject to these terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties with\nthis License.\n\n  11. If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Library at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Library by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Library.\n\nIf any portion of this section is held invalid or unenforceable under any\nparticular circumstance, the balance of the section is intended to apply,\nand the section as a whole is intended to apply in other circumstances.\n\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n\n  12. If the distribution and/or use of the Library is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Library under this License may add\nan explicit geographical distribution limitation excluding those countries,\nso that distribution is permitted only in or among countries not thus\nexcluded.  In such case, this License incorporates the limitation as if\nwritten in the body of this License.\n\n  13. The Free Software Foundation may publish revised and/or new\nversions of the Lesser General Public License from time to time.\nSuch new versions will be similar in spirit to the present version,\nbut may differ in detail to address new problems or concerns.\n\nEach version is given a distinguishing version number.  If the Library\nspecifies a version number of this License which applies to it and\n\"any later version\", you have the option of following the terms and\nconditions either of that version or of any later version published by\nthe Free Software Foundation.  If the Library does not specify a\nlicense version number, you may choose any version ever published by\nthe Free Software Foundation.\n\n  14. If you wish to incorporate parts of the Library into other free\nprograms whose distribution conditions are incompatible with these,\nwrite to the author to ask for permission.  For software which is\ncopyrighted by the Free Software Foundation, write to the Free\nSoftware Foundation; we sometimes make exceptions for this.  Our\ndecision will be guided by the two goals of preserving the free status\nof all derivatives of our free software and of promoting the sharing\nand reuse of software generally.\n\n                            NO WARRANTY\n\n  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO\nWARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.\nEXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR\nOTHER PARTIES PROVIDE THE LIBRARY \"AS IS\" WITHOUT WARRANTY OF ANY\nKIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE\nLIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME\nTHE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN\nWRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY\nAND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU\nFOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR\nCONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE\nLIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING\nRENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A\nFAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF\nSUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\nDAMAGES.\n\n                     END OF TERMS AND CONDITIONS\n"
  },
  {
    "path": "ffmpeg/licenses/libcaca.txt",
    "content": "            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE\n                    Version 2, December 2004\n\n Copyright (C) 2004 Sam Hocevar\n  14 rue de Plaisance, 75014 Paris, France\n Everyone is permitted to copy and distribute verbatim or modified\n copies of this license document, and changing it is allowed as long\n as the name is changed.\n\n            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. You just DO WHAT THE FUCK YOU WANT TO.\n\n"
  },
  {
    "path": "ffmpeg/licenses/libgsm.txt",
    "content": "Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann,\nTechnische Universitaet Berlin\n\nAny use of this software is permitted provided that this notice is not\nremoved and that neither the authors nor the Technische Universitaet Berlin\nare deemed to have made any representations as to the suitability of this\nsoftware for any purpose nor are held responsible for any defects of\nthis software.  THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.\n\nAs a matter of courtesy, the authors request to be informed about uses\nthis software has found, about bugs in this software, and about any\nimprovements that may be of general interest.\n\nBerlin, 28.11.1994\nJutta Degener\nCarsten Bormann\n\n                                 oOo\n\nSince the original terms of 15 years ago maybe do not make our\nintentions completely clear given today's refined usage of the legal\nterms, we append this additional permission:\n\n      Permission to use, copy, modify, and distribute this software\n      for any purpose with or without fee is hereby granted,\n      provided that this notice is not removed and that neither\n      the authors nor the Technische Universitaet Berlin are\n      deemed to have made any representations as to the suitability\n      of this software for any purpose nor are held responsible\n      for any defects of this software.  THERE IS ABSOLUTELY NO\n      WARRANTY FOR THIS SOFTWARE.\n\nBerkeley/Bremen, 05.04.2009\nJutta Degener\nCarsten Bormann\n"
  },
  {
    "path": "ffmpeg/licenses/libtheora.txt",
    "content": "Copyright (C) 2002-2009 Xiph.org Foundation\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n\n- Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n\n- Redistributions in binary form must reproduce the above copyright\nnotice, this list of conditions and the following disclaimer in the\ndocumentation and/or other materials provided with the distribution.\n\n- Neither the name of the Xiph.org Foundation nor the names of its\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION\nOR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "ffmpeg/licenses/libvorbis.txt",
    "content": "Copyright (c) 2002-2008 Xiph.org Foundation\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n\n- Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n\n- Redistributions in binary form must reproduce the above copyright\nnotice, this list of conditions and the following disclaimer in the\ndocumentation and/or other materials provided with the distribution.\n\n- Neither the name of the Xiph.org Foundation nor the names of its\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION\nOR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "ffmpeg/licenses/libvpx.txt",
    "content": "Copyright (c) 2010, The WebM Project authors. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n  * Redistributions of source code must retain the above copyright\n    notice, this list of conditions and the following disclaimer.\n\n  * Redistributions in binary form must reproduce the above copyright\n    notice, this list of conditions and the following disclaimer in\n    the documentation and/or other materials provided with the\n    distribution.\n\n  * Neither the name of Google, nor the WebM Project, nor the names\n    of its contributors may be used to endorse or promote products\n    derived from this software without specific prior written\n    permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nHOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n"
  },
  {
    "path": "ffmpeg/licenses/opencore-amr.txt",
    "content": "Apache License\nVersion 2.0, January 2004\nhttp://www.apache.org/licenses/\n\nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n1. Definitions.\n\n\"License\" shall mean the terms and conditions for use, reproduction, and\ndistribution as defined by Sections 1 through 9 of this document.\n\n\"Licensor\" shall mean the copyright owner or entity authorized by the\ncopyright owner that is granting the License.\n\n\"Legal Entity\" shall mean the union of the acting entity and all other\nentities that control, are controlled by, or are under common control with\nthat entity. For the purposes of this definition, \"control\" means (i) the\npower, direct or indirect, to cause the direction or management of such\nentity, whether by contract or otherwise, or (ii) ownership of fifty\npercent (50%) or more of the outstanding shares, or (iii) beneficial\nownership of such entity.\n\n\"You\" (or \"Your\") shall mean an individual or Legal Entity exercising\npermissions granted by this License.\n\n\"Source\" form shall mean the preferred form for making modifications,\nincluding but not limited to software source code, documentation source,\nand configuration files.\n\n\"Object\" form shall mean any form resulting from mechanical transformation\nor translation of a Source form, including but not limited to compiled\nobject code, generated documentation, and conversions to other media types.\n\n\"Work\" shall mean the work of authorship, whether in Source or Object form,\nmade available under the License, as indicated by a copyright notice that\nis included in or attached to the work (an example is provided in the\nAppendix below).\n\n\"Derivative Works\" shall mean any work, whether in Source or Object form,\nthat is based on (or derived from) the Work and for which the editorial\nrevisions, annotations, elaborations, or other modifications represent, as\na whole, an original work of authorship. For the purposes of this License,\nDerivative Works shall not include works that remain separable from, or\nmerely link (or bind by name) to the interfaces of, the Work and Derivative\nWorks thereof.\n\n\"Contribution\" shall mean any work of authorship, including the original\nversion of the Work and any modifications or additions to that Work or\nDerivative Works thereof, that is intentionally submitted to Licensor for\ninclusion in the Work by the copyright owner or by an individual or Legal\nEntity authorized to submit on behalf of the copyright owner. For the\npurposes of this definition, \"submitted\" means any form of electronic,\nverbal, or written communication sent to the Licensor or its\nrepresentatives, including but not limited to communication on electronic\nmailing lists, source code control systems, and issue tracking systems that\nare managed by, or on behalf of, the Licensor for the purpose of discussing\nand improving the Work, but excluding communication that is conspicuously\nmarked or otherwise designated in writing by the copyright owner as \"Not a\nContribution.\"\n\n\"Contributor\" shall mean Licensor and any individual or Legal Entity on\nbehalf of whom a Contribution has been received by Licensor and\nsubsequently incorporated within the Work.\n\n2. Grant of Copyright License. Subject to the terms and conditions of this\nLicense, each Contributor hereby grants to You a perpetual, worldwide,\nnon-exclusive, no-charge, royalty-free, irrevocable copyright license to\nreproduce, prepare Derivative Works of, publicly display, publicly perform,\nsublicense, and distribute the Work and such Derivative Works in Source or\nObject form.\n\n3. Grant of Patent License. Subject to the terms and conditions of this\nLicense, each Contributor hereby grants to You a perpetual, worldwide,\nnon-exclusive, no-charge, royalty-free, irrevocable (except as stated in\nthis section) patent license to make, have made, use, offer to sell, sell,\nimport, and otherwise transfer the Work, where such license applies only to\nthose patent claims licensable by such Contributor that are necessarily\ninfringed by their Contribution(s) alone or by combination of their\nContribution(s) with the Work to which such Contribution(s) was submitted.\nIf You institute patent litigation against any entity (including a\ncross-claim or counterclaim in a lawsuit) alleging that the Work or a\nContribution incorporated within the Work constitutes direct or\ncontributory patent infringement, then any patent licenses granted to You\nunder this License for that Work shall terminate as of the date such\nlitigation is filed.\n\n4. Redistribution. You may reproduce and distribute copies of the Work or\nDerivative Works thereof in any medium, with or without modifications, and\nin Source or Object form, provided that You meet the following conditions:\n\n   1. You must give any other recipients of the Work or Derivative Works a\ncopy of this License; and\n\n   2. You must cause any modified files to carry prominent notices stating\nthat You changed the files; and\n\n   3. You must retain, in the Source form of any Derivative Works that You\ndistribute, all copyright, patent, trademark, and attribution notices from\nthe Source form of the Work, excluding those notices that do not pertain to\nany part of the Derivative Works; and\n\n   4. If the Work includes a \"NOTICE\" text file as part of its\ndistribution, then any Derivative Works that You distribute must include a\nreadable copy of the attribution notices contained within such NOTICE file,\nexcluding those notices that do not pertain to any part of the Derivative\nWorks, in at least one of the following places: within a NOTICE text file\ndistributed as part of the Derivative Works; within the Source form or\ndocumentation, if provided along with the Derivative Works; or, within a\ndisplay generated by the Derivative Works, if and wherever such third-party\nnotices normally appear. The contents of the NOTICE file are for\ninformational purposes only and do not modify the License. You may add Your\nown attribution notices within Derivative Works that You distribute,\nalongside or as an addendum to the NOTICE text from the Work, provided that\nsuch additional attribution notices cannot be construed as modifying the\nLicense.\n\nYou may add Your own copyright statement to Your modifications and may\nprovide additional or different license terms and conditions for use,\nreproduction, or distribution of Your modifications, or for any such\nDerivative Works as a whole, provided Your use, reproduction, and\ndistribution of the Work otherwise complies with the conditions stated in\nthis License.\n\n5. Submission of Contributions. Unless You explicitly state otherwise, any\nContribution intentionally submitted for inclusion in the Work by You to\nthe Licensor shall be under the terms and conditions of this License,\nwithout any additional terms or conditions. Notwithstanding the above,\nnothing herein shall supersede or modify the terms of any separate license\nagreement you may have executed with Licensor regarding such Contributions.\n\n6. Trademarks. This License does not grant permission to use the trade\nnames, trademarks, service marks, or product names of the Licensor, except\nas required for reasonable and customary use in describing the origin of\nthe Work and reproducing the content of the NOTICE file.\n\n7. Disclaimer of Warranty. Unless required by applicable law or agreed to\nin writing, Licensor provides the Work (and each Contributor provides its\nContributions) on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, either express or implied, including, without limitation, any\nwarranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or\nFITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for\ndetermining the appropriateness of using or redistributing the Work and\nassume any risks associated with Your exercise of permissions under this\nLicense.\n\n8. Limitation of Liability. In no event and under no legal theory, whether\nin tort (including negligence), contract, or otherwise, unless required by\napplicable law (such as deliberate and grossly negligent acts) or agreed to\nin writing, shall any Contributor be liable to You for damages, including\nany direct, indirect, special, incidental, or consequential damages of any\ncharacter arising as a result of this License or out of the use or\ninability to use the Work (including but not limited to damages for loss of\ngoodwill, work stoppage, computer failure or malfunction, or any and all\nother commercial damages or losses), even if such Contributor has been\nadvised of the possibility of such damages.\n\n9. Accepting Warranty or Additional Liability. While redistributing the\nWork or Derivative Works thereof, You may choose to offer, and charge a fee\nfor, acceptance of support, warranty, indemnity, or other liability\nobligations and/or rights consistent with this License. However, in\naccepting such obligations, You may act only on Your own behalf and on Your\nsole responsibility, not on behalf of any other Contributor, and only if\nYou agree to indemnify, defend, and hold each Contributor harmless for any\nliability incurred by, or claims asserted against, such Contributor by\nreason of your accepting any such warranty or additional liability.\n\nEND OF TERMS AND CONDITIONS\n\nAPPENDIX: How to apply the Apache License to your work\n\nTo apply the Apache License to your work, attach the following boilerplate\nnotice, with the fields enclosed by brackets \"[]\" replaced with your own\nidentifying information. (Don't include the brackets!) The text should be\nenclosed in the appropriate comment syntax for the file format. We also\nrecommend that a file or class name and description of purpose be included\non the same \"printed page\" as the copyright notice for easier\nidentification within third-party archives.\n\n Copyright [yyyy] [name of copyright owner]\n\n Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n not use this file except in compliance with the License. You may obtain a\n copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable\n law or agreed to in writing, software distributed under the License is\n distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n KIND, either express or implied. See the License for the specific language\n governing permissions and limitations under the License.\n"
  },
  {
    "path": "ffmpeg/licenses/openjpeg.txt",
    "content": "/*\n * Copyright (c) 2002-2012, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium\n * Copyright (c) 2002-2012, Professor Benoit Macq\n * Copyright (c) 2003-2012, Antonin Descampe\n * Copyright (c) 2003-2009, Francois-Olivier Devaux\n * Copyright (c) 2005, Herve Drolon, FreeImage Team\n * Copyright (c) 2002-2003, Yannick Verschueren\n * Copyright (c) 2001-2003, David Janssens\n * Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France \n * Copyright (c) 2012, CS Systemes d'Information, France\n *\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n"
  },
  {
    "path": "ffmpeg/licenses/opus.txt",
    "content": "Copyright 2001-2011 Xiph.Org, Skype Limited, Octasic,\n                    Jean-Marc Valin, Timothy B. Terriberry,\n                    CSIRO, Gregory Maxwell, Mark Borgerding,\n                    Erik de Castro Lopo\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n\n- Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n\n- Redistributions in binary form must reproduce the above copyright\nnotice, this list of conditions and the following disclaimer in the\ndocumentation and/or other materials provided with the distribution.\n\n- Neither the name of Internet Society, IETF or IETF Trust, nor the \nnames of specific contributors, may be used to endorse or promote\nproducts derived from this software without specific prior written\npermission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER\nOR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\nEXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\nPROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\nLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\nNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nOpus is subject to the royalty-free patent licenses which are\nspecified at:\n\nXiph.Org Foundation:\nhttps://datatracker.ietf.org/ipr/1524/\n\nMicrosoft Corporation:\nhttps://datatracker.ietf.org/ipr/1914/\n\nBroadcom Corporation:\nhttps://datatracker.ietf.org/ipr/1526/\n"
  },
  {
    "path": "ffmpeg/licenses/rtmpdump.txt",
    "content": "\t\t    GNU GENERAL PUBLIC LICENSE\n\t\t       Version 2, June 1991\n\n Copyright (C) 1989, 1991 Free Software Foundation, Inc.,\n 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n\t\t\t    Preamble\n\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicense is intended to guarantee your freedom to share and change free\nsoftware--to make sure the software is free for all its users.  This\nGeneral Public License applies to most of the Free Software\nFoundation's software and to any other program whose authors commit to\nusing it.  (Some other Free Software Foundation software is covered by\nthe GNU Lesser General Public License instead.)  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthis service if you wish), that you receive source code or can get it\nif you want it, that you can change the software or use pieces of it\nin new free programs; and that you know you can do these things.\n\n  To protect your rights, we need to make restrictions that forbid\nanyone to deny you these rights or to ask you to surrender the rights.\nThese restrictions translate to certain responsibilities for you if you\ndistribute copies of the software, or if you modify it.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must give the recipients all the rights that\nyou have.  You must make sure that they, too, receive or can get the\nsource code.  And you must show them these terms so they know their\nrights.\n\n  We protect your rights with two steps: (1) copyright the software, and\n(2) offer you this license which gives you legal permission to copy,\ndistribute and/or modify the software.\n\n  Also, for each author's protection and ours, we want to make certain\nthat everyone understands that there is no warranty for this free\nsoftware.  If the software is modified by someone else and passed on, we\nwant its recipients to know that what they have is not the original, so\nthat any problems introduced by others will not reflect on the original\nauthors' reputations.\n\n  Finally, any free program is threatened constantly by software\npatents.  We wish to avoid the danger that redistributors of a free\nprogram will individually obtain patent licenses, in effect making the\nprogram proprietary.  To prevent this, we have made it clear that any\npatent must be licensed for everyone's free use or not licensed at all.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n\t\t    GNU GENERAL PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. This License applies to any program or other work which contains\na notice placed by the copyright holder saying it may be distributed\nunder the terms of this General Public License.  The \"Program\", below,\nrefers to any such program or work, and a \"work based on the Program\"\nmeans either the Program or any derivative work under copyright law:\nthat is to say, a work containing the Program or a portion of it,\neither verbatim or with modifications and/or translated into another\nlanguage.  (Hereinafter, translation is included without limitation in\nthe term \"modification\".)  Each licensee is addressed as \"you\".\n\nActivities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning the Program is not restricted, and the output from the Program\nis covered only if its contents constitute a work based on the\nProgram (independent of having been made by running the Program).\nWhether that is true depends on what the Program does.\n\n  1. You may copy and distribute verbatim copies of the Program's\nsource code as you receive it, in any medium, provided that you\nconspicuously and appropriately publish on each copy an appropriate\ncopyright notice and disclaimer of warranty; keep intact all the\nnotices that refer to this License and to the absence of any warranty;\nand give any other recipients of the Program a copy of this License\nalong with the Program.\n\nYou may charge a fee for the physical act of transferring a copy, and\nyou may at your option offer warranty protection in exchange for a fee.\n\n  2. You may modify your copy or copies of the Program or any portion\nof it, thus forming a work based on the Program, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n\n    a) You must cause the modified files to carry prominent notices\n    stating that you changed the files and the date of any change.\n\n    b) You must cause any work that you distribute or publish, that in\n    whole or in part contains or is derived from the Program or any\n    part thereof, to be licensed as a whole at no charge to all third\n    parties under the terms of this License.\n\n    c) If the modified program normally reads commands interactively\n    when run, you must cause it, when started running for such\n    interactive use in the most ordinary way, to print or display an\n    announcement including an appropriate copyright notice and a\n    notice that there is no warranty (or else, saying that you provide\n    a warranty) and that users may redistribute the program under\n    these conditions, and telling the user how to view a copy of this\n    License.  (Exception: if the Program itself is interactive but\n    does not normally print such an announcement, your work based on\n    the Program is not required to print an announcement.)\n\nThese requirements apply to the modified work as a whole.  If\nidentifiable sections of that work are not derived from the Program,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works.  But when you\ndistribute the same sections as part of a whole which is a work based\non the Program, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote it.\n\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Program.\n\nIn addition, mere aggregation of another work not based on the Program\nwith the Program (or with a work based on the Program) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n\n  3. You may copy and distribute the Program (or a work based on it,\nunder Section 2) in object code or executable form under the terms of\nSections 1 and 2 above provided that you also do one of the following:\n\n    a) Accompany it with the complete corresponding machine-readable\n    source code, which must be distributed under the terms of Sections\n    1 and 2 above on a medium customarily used for software interchange; or,\n\n    b) Accompany it with a written offer, valid for at least three\n    years, to give any third party, for a charge no more than your\n    cost of physically performing source distribution, a complete\n    machine-readable copy of the corresponding source code, to be\n    distributed under the terms of Sections 1 and 2 above on a medium\n    customarily used for software interchange; or,\n\n    c) Accompany it with the information you received as to the offer\n    to distribute corresponding source code.  (This alternative is\n    allowed only for noncommercial distribution and only if you\n    received the program in object code or executable form with such\n    an offer, in accord with Subsection b above.)\n\nThe source code for a work means the preferred form of the work for\nmaking modifications to it.  For an executable work, complete source\ncode means all the source code for all modules it contains, plus any\nassociated interface definition files, plus the scripts used to\ncontrol compilation and installation of the executable.  However, as a\nspecial exception, the source code distributed need not include\nanything that is normally distributed (in either source or binary\nform) with the major components (compiler, kernel, and so on) of the\noperating system on which the executable runs, unless that component\nitself accompanies the executable.\n\nIf distribution of executable or object code is made by offering\naccess to copy from a designated place, then offering equivalent\naccess to copy the source code from the same place counts as\ndistribution of the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n\n  4. You may not copy, modify, sublicense, or distribute the Program\nexcept as expressly provided under this License.  Any attempt\notherwise to copy, modify, sublicense or distribute the Program is\nvoid, and will automatically terminate your rights under this License.\nHowever, parties who have received copies, or rights, from you under\nthis License will not have their licenses terminated so long as such\nparties remain in full compliance.\n\n  5. You are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Program or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Program (or any work based on the\nProgram), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Program or works based on it.\n\n  6. Each time you redistribute the Program (or any work based on the\nProgram), the recipient automatically receives a license from the\noriginal licensor to copy, distribute or modify the Program subject to\nthese terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties to\nthis License.\n\n  7. If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Program at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Program by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Program.\n\nIf any portion of this section is held invalid or unenforceable under\nany particular circumstance, the balance of the section is intended to\napply and the section as a whole is intended to apply in other\ncircumstances.\n\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system, which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n\n  8. If the distribution and/or use of the Program is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Program under this License\nmay add an explicit geographical distribution limitation excluding\nthose countries, so that distribution is permitted only in or among\ncountries not thus excluded.  In such case, this License incorporates\nthe limitation as if written in the body of this License.\n\n  9. The Free Software Foundation may publish revised and/or new versions\nof the General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\nEach version is given a distinguishing version number.  If the Program\nspecifies a version number of this License which applies to it and \"any\nlater version\", you have the option of following the terms and conditions\neither of that version or of any later version published by the Free\nSoftware Foundation.  If the Program does not specify a version number of\nthis License, you may choose any version ever published by the Free Software\nFoundation.\n\n  10. If you wish to incorporate parts of the Program into other free\nprograms whose distribution conditions are different, write to the author\nto ask for permission.  For software which is copyrighted by the Free\nSoftware Foundation, write to the Free Software Foundation; we sometimes\nmake exceptions for this.  Our decision will be guided by the two goals\nof preserving the free status of all derivatives of our free software and\nof promoting the sharing and reuse of software generally.\n\n\t\t\t    NO WARRANTY\n\n  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\nFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN\nOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\nPROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\nOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS\nTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE\nPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\nREPAIR OR CORRECTION.\n\n  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\nREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\nINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\nOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\nTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\nYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\nPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGES.\n\n\t\t     END OF TERMS AND CONDITIONS\n\n\t    How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nconvey the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software; you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation; either version 2 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License along\n    with this program; if not, write to the Free Software Foundation, Inc.,\n    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n\nAlso add information on how to contact you by electronic and paper mail.\n\nIf the program is interactive, make it output a short notice like this\nwhen it starts in an interactive mode:\n\n    Gnomovision version 69, Copyright (C) year name of author\n    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, the commands you use may\nbe called something other than `show w' and `show c'; they could even be\nmouse-clicks or menu items--whatever suits your program.\n\nYou should also get your employer (if you work as a programmer) or your\nschool, if any, to sign a \"copyright disclaimer\" for the program, if\nnecessary.  Here is a sample; alter the names:\n\n  Yoyodyne, Inc., hereby disclaims all copyright interest in the program\n  `Gnomovision' (which makes passes at compilers) written by James Hacker.\n\n  <signature of Ty Coon>, 1 April 1989\n  Ty Coon, President of Vice\n\nThis General Public License does not permit incorporating your program into\nproprietary programs.  If your program is a subroutine library, you may\nconsider it more useful to permit linking proprietary applications with the\nlibrary.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.\n"
  },
  {
    "path": "ffmpeg/licenses/schroedinger.txt",
    "content": "\t\t  GNU LIBRARY GENERAL PUBLIC LICENSE\n\t\t       Version 2, June 1991\n\n Copyright (C) 1991 Free Software Foundation, Inc.\n                    675 Mass Ave, Cambridge, MA 02139, USA\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n[This is the first released version of the library GPL.  It is\n numbered 2 because it goes with version 2 of the ordinary GPL.]\n\n\t\t\t    Preamble\n\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicenses are intended to guarantee your freedom to share and change\nfree software--to make sure the software is free for all its users.\n\n  This license, the Library General Public License, applies to some\nspecially designated Free Software Foundation software, and to any\nother libraries whose authors decide to use it.  You can use it for\nyour libraries, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthis service if you wish), that you receive source code or can get it\nif you want it, that you can change the software or use pieces of it\nin new free programs; and that you know you can do these things.\n\n  To protect your rights, we need to make restrictions that forbid\nanyone to deny you these rights or to ask you to surrender the rights.\nThese restrictions translate to certain responsibilities for you if\nyou distribute copies of the library, or if you modify it.\n\n  For example, if you distribute copies of the library, whether gratis\nor for a fee, you must give the recipients all the rights that we gave\nyou.  You must make sure that they, too, receive or can get the source\ncode.  If you link a program with the library, you must provide\ncomplete object files to the recipients so that they can relink them\nwith the library, after making changes to the library and recompiling\nit.  And you must show them these terms so they know their rights.\n\n  Our method of protecting your rights has two steps: (1) copyright\nthe library, and (2) offer you this license which gives you legal\npermission to copy, distribute and/or modify the library.\n\n  Also, for each distributor's protection, we want to make certain\nthat everyone understands that there is no warranty for this free\nlibrary.  If the library is modified by someone else and passed on, we\nwant its recipients to know that what they have is not the original\nversion, so that any problems introduced by others will not reflect on\nthe original authors' reputations.\n\f\n  Finally, any free program is threatened constantly by software\npatents.  We wish to avoid the danger that companies distributing free\nsoftware will individually obtain patent licenses, thus in effect\ntransforming the program into proprietary software.  To prevent this,\nwe have made it clear that any patent must be licensed for everyone's\nfree use or not licensed at all.\n\n  Most GNU software, including some libraries, is covered by the ordinary\nGNU General Public License, which was designed for utility programs.  This\nlicense, the GNU Library General Public License, applies to certain\ndesignated libraries.  This license is quite different from the ordinary\none; be sure to read it in full, and don't assume that anything in it is\nthe same as in the ordinary license.\n\n  The reason we have a separate public license for some libraries is that\nthey blur the distinction we usually make between modifying or adding to a\nprogram and simply using it.  Linking a program with a library, without\nchanging the library, is in some sense simply using the library, and is\nanalogous to running a utility program or application program.  However, in\na textual and legal sense, the linked executable is a combined work, a\nderivative of the original library, and the ordinary General Public License\ntreats it as such.\n\n  Because of this blurred distinction, using the ordinary General\nPublic License for libraries did not effectively promote software\nsharing, because most developers did not use the libraries.  We\nconcluded that weaker conditions might promote sharing better.\n\n  However, unrestricted linking of non-free programs would deprive the\nusers of those programs of all benefit from the free status of the\nlibraries themselves.  This Library General Public License is intended to\npermit developers of non-free programs to use free libraries, while\npreserving your freedom as a user of such programs to change the free\nlibraries that are incorporated in them.  (We have not seen how to achieve\nthis as regards changes in header files, but we have achieved it as regards\nchanges in the actual functions of the Library.)  The hope is that this\nwill lead to faster development of free libraries.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.  Pay close attention to the difference between a\n\"work based on the library\" and a \"work that uses the library\".  The\nformer contains code derived from the library, while the latter only\nworks together with the library.\n\n  Note that it is possible for a library to be covered by the ordinary\nGeneral Public License rather than by this special one.\n\f\n\t\t  GNU LIBRARY GENERAL PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. This License Agreement applies to any software library which\ncontains a notice placed by the copyright holder or other authorized\nparty saying it may be distributed under the terms of this Library\nGeneral Public License (also called \"this License\").  Each licensee is\naddressed as \"you\".\n\n  A \"library\" means a collection of software functions and/or data\nprepared so as to be conveniently linked with application programs\n(which use some of those functions and data) to form executables.\n\n  The \"Library\", below, refers to any such software library or work\nwhich has been distributed under these terms.  A \"work based on the\nLibrary\" means either the Library or any derivative work under\ncopyright law: that is to say, a work containing the Library or a\nportion of it, either verbatim or with modifications and/or translated\nstraightforwardly into another language.  (Hereinafter, translation is\nincluded without limitation in the term \"modification\".)\n\n  \"Source code\" for a work means the preferred form of the work for\nmaking modifications to it.  For a library, complete source code means\nall the source code for all modules it contains, plus any associated\ninterface definition files, plus the scripts used to control compilation\nand installation of the library.\n\n  Activities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning a program using the Library is not restricted, and output from\nsuch a program is covered only if its contents constitute a work based\non the Library (independent of the use of the Library in a tool for\nwriting it).  Whether that is true depends on what the Library does\nand what the program that uses the Library does.\n  \n  1. You may copy and distribute verbatim copies of the Library's\ncomplete source code as you receive it, in any medium, provided that\nyou conspicuously and appropriately publish on each copy an\nappropriate copyright notice and disclaimer of warranty; keep intact\nall the notices that refer to this License and to the absence of any\nwarranty; and distribute a copy of this License along with the\nLibrary.\n\n  You may charge a fee for the physical act of transferring a copy,\nand you may at your option offer warranty protection in exchange for a\nfee.\n\f\n  2. You may modify your copy or copies of the Library or any portion\nof it, thus forming a work based on the Library, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n\n    a) The modified work must itself be a software library.\n\n    b) You must cause the files modified to carry prominent notices\n    stating that you changed the files and the date of any change.\n\n    c) You must cause the whole of the work to be licensed at no\n    charge to all third parties under the terms of this License.\n\n    d) If a facility in the modified Library refers to a function or a\n    table of data to be supplied by an application program that uses\n    the facility, other than as an argument passed when the facility\n    is invoked, then you must make a good faith effort to ensure that,\n    in the event an application does not supply such function or\n    table, the facility still operates, and performs whatever part of\n    its purpose remains meaningful.\n\n    (For example, a function in a library to compute square roots has\n    a purpose that is entirely well-defined independent of the\n    application.  Therefore, Subsection 2d requires that any\n    application-supplied function or table used by this function must\n    be optional: if the application does not supply it, the square\n    root function must still compute square roots.)\n\nThese requirements apply to the modified work as a whole.  If\nidentifiable sections of that work are not derived from the Library,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works.  But when you\ndistribute the same sections as part of a whole which is a work based\non the Library, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote\nit.\n\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Library.\n\nIn addition, mere aggregation of another work not based on the Library\nwith the Library (or with a work based on the Library) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n\n  3. You may opt to apply the terms of the ordinary GNU General Public\nLicense instead of this License to a given copy of the Library.  To do\nthis, you must alter all the notices that refer to this License, so\nthat they refer to the ordinary GNU General Public License, version 2,\ninstead of to this License.  (If a newer version than version 2 of the\nordinary GNU General Public License has appeared, then you can specify\nthat version instead if you wish.)  Do not make any other change in\nthese notices.\n\f\n  Once this change is made in a given copy, it is irreversible for\nthat copy, so the ordinary GNU General Public License applies to all\nsubsequent copies and derivative works made from that copy.\n\n  This option is useful when you wish to copy part of the code of\nthe Library into a program that is not a library.\n\n  4. You may copy and distribute the Library (or a portion or\nderivative of it, under Section 2) in object code or executable form\nunder the terms of Sections 1 and 2 above provided that you accompany\nit with the complete corresponding machine-readable source code, which\nmust be distributed under the terms of Sections 1 and 2 above on a\nmedium customarily used for software interchange.\n\n  If distribution of object code is made by offering access to copy\nfrom a designated place, then offering equivalent access to copy the\nsource code from the same place satisfies the requirement to\ndistribute the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n\n  5. A program that contains no derivative of any portion of the\nLibrary, but is designed to work with the Library by being compiled or\nlinked with it, is called a \"work that uses the Library\".  Such a\nwork, in isolation, is not a derivative work of the Library, and\ntherefore falls outside the scope of this License.\n\n  However, linking a \"work that uses the Library\" with the Library\ncreates an executable that is a derivative of the Library (because it\ncontains portions of the Library), rather than a \"work that uses the\nlibrary\".  The executable is therefore covered by this License.\nSection 6 states terms for distribution of such executables.\n\n  When a \"work that uses the Library\" uses material from a header file\nthat is part of the Library, the object code for the work may be a\nderivative work of the Library even though the source code is not.\nWhether this is true is especially significant if the work can be\nlinked without the Library, or if the work is itself a library.  The\nthreshold for this to be true is not precisely defined by law.\n\n  If such an object file uses only numerical parameters, data\nstructure layouts and accessors, and small macros and small inline\nfunctions (ten lines or less in length), then the use of the object\nfile is unrestricted, regardless of whether it is legally a derivative\nwork.  (Executables containing this object code plus portions of the\nLibrary will still fall under Section 6.)\n\n  Otherwise, if the work is a derivative of the Library, you may\ndistribute the object code for the work under the terms of Section 6.\nAny executables containing that work also fall under Section 6,\nwhether or not they are linked directly with the Library itself.\n\f\n  6. As an exception to the Sections above, you may also compile or\nlink a \"work that uses the Library\" with the Library to produce a\nwork containing portions of the Library, and distribute that work\nunder terms of your choice, provided that the terms permit\nmodification of the work for the customer's own use and reverse\nengineering for debugging such modifications.\n\n  You must give prominent notice with each copy of the work that the\nLibrary is used in it and that the Library and its use are covered by\nthis License.  You must supply a copy of this License.  If the work\nduring execution displays copyright notices, you must include the\ncopyright notice for the Library among them, as well as a reference\ndirecting the user to the copy of this License.  Also, you must do one\nof these things:\n\n    a) Accompany the work with the complete corresponding\n    machine-readable source code for the Library including whatever\n    changes were used in the work (which must be distributed under\n    Sections 1 and 2 above); and, if the work is an executable linked\n    with the Library, with the complete machine-readable \"work that\n    uses the Library\", as object code and/or source code, so that the\n    user can modify the Library and then relink to produce a modified\n    executable containing the modified Library.  (It is understood\n    that the user who changes the contents of definitions files in the\n    Library will not necessarily be able to recompile the application\n    to use the modified definitions.)\n\n    b) Accompany the work with a written offer, valid for at\n    least three years, to give the same user the materials\n    specified in Subsection 6a, above, for a charge no more\n    than the cost of performing this distribution.\n\n    c) If distribution of the work is made by offering access to copy\n    from a designated place, offer equivalent access to copy the above\n    specified materials from the same place.\n\n    d) Verify that the user has already received a copy of these\n    materials or that you have already sent this user a copy.\n\n  For an executable, the required form of the \"work that uses the\nLibrary\" must include any data and utility programs needed for\nreproducing the executable from it.  However, as a special exception,\nthe source code distributed need not include anything that is normally\ndistributed (in either source or binary form) with the major\ncomponents (compiler, kernel, and so on) of the operating system on\nwhich the executable runs, unless that component itself accompanies\nthe executable.\n\n  It may happen that this requirement contradicts the license\nrestrictions of other proprietary libraries that do not normally\naccompany the operating system.  Such a contradiction means you cannot\nuse both them and the Library together in an executable that you\ndistribute.\n\f\n  7. You may place library facilities that are a work based on the\nLibrary side-by-side in a single library together with other library\nfacilities not covered by this License, and distribute such a combined\nlibrary, provided that the separate distribution of the work based on\nthe Library and of the other library facilities is otherwise\npermitted, and provided that you do these two things:\n\n    a) Accompany the combined library with a copy of the same work\n    based on the Library, uncombined with any other library\n    facilities.  This must be distributed under the terms of the\n    Sections above.\n\n    b) Give prominent notice with the combined library of the fact\n    that part of it is a work based on the Library, and explaining\n    where to find the accompanying uncombined form of the same work.\n\n  8. You may not copy, modify, sublicense, link with, or distribute\nthe Library except as expressly provided under this License.  Any\nattempt otherwise to copy, modify, sublicense, link with, or\ndistribute the Library is void, and will automatically terminate your\nrights under this License.  However, parties who have received copies,\nor rights, from you under this License will not have their licenses\nterminated so long as such parties remain in full compliance.\n\n  9. You are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Library or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Library (or any work based on the\nLibrary), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Library or works based on it.\n\n  10. Each time you redistribute the Library (or any work based on the\nLibrary), the recipient automatically receives a license from the\noriginal licensor to copy, distribute, link with or modify the Library\nsubject to these terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties to\nthis License.\n\f\n  11. If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Library at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Library by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Library.\n\nIf any portion of this section is held invalid or unenforceable under any\nparticular circumstance, the balance of the section is intended to apply,\nand the section as a whole is intended to apply in other circumstances.\n\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n\n  12. If the distribution and/or use of the Library is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Library under this License may add\nan explicit geographical distribution limitation excluding those countries,\nso that distribution is permitted only in or among countries not thus\nexcluded.  In such case, this License incorporates the limitation as if\nwritten in the body of this License.\n\n  13. The Free Software Foundation may publish revised and/or new\nversions of the Library General Public License from time to time.\nSuch new versions will be similar in spirit to the present version,\nbut may differ in detail to address new problems or concerns.\n\nEach version is given a distinguishing version number.  If the Library\nspecifies a version number of this License which applies to it and\n\"any later version\", you have the option of following the terms and\nconditions either of that version or of any later version published by\nthe Free Software Foundation.  If the Library does not specify a\nlicense version number, you may choose any version ever published by\nthe Free Software Foundation.\n\f\n  14. If you wish to incorporate parts of the Library into other free\nprograms whose distribution conditions are incompatible with these,\nwrite to the author to ask for permission.  For software which is\ncopyrighted by the Free Software Foundation, write to the Free\nSoftware Foundation; we sometimes make exceptions for this.  Our\ndecision will be guided by the two goals of preserving the free status\nof all derivatives of our free software and of promoting the sharing\nand reuse of software generally.\n\n\t\t\t    NO WARRANTY\n\n  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO\nWARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.\nEXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR\nOTHER PARTIES PROVIDE THE LIBRARY \"AS IS\" WITHOUT WARRANTY OF ANY\nKIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE\nLIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME\nTHE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN\nWRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY\nAND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU\nFOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR\nCONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE\nLIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING\nRENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A\nFAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF\nSUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\nDAMAGES.\n\n\t\t     END OF TERMS AND CONDITIONS\n\n     Appendix: How to Apply These Terms to Your New Libraries\n\n  If you develop a new library, and you want it to be of the greatest\npossible use to the public, we recommend making it free software that\neveryone can redistribute and change.  You can do so by permitting\nredistribution under these terms (or, alternatively, under the terms of the\nordinary General Public License).\n\n  To apply these terms, attach the following notices to the library.  It is\nsafest to attach them to the start of each source file to most effectively\nconvey the exclusion of warranty; and each file should have at least the\n\"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the library's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This library is free software; you can redistribute it and/or\n    modify it under the terms of the GNU Library General Public\n    License as published by the Free Software Foundation; either\n    version 2 of the License, or (at your option) any later version.\n\n    This library is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n    Library General Public License for more details.\n\n    You should have received a copy of the GNU Library General Public\n    License along with this library; if not, write to the Free\n    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n"
  },
  {
    "path": "ffmpeg/licenses/speex.txt",
    "content": "Copyright 2002-2008 \tXiph.org Foundation\nCopyright 2002-2008 \tJean-Marc Valin\nCopyright 2005-2007\tAnalog Devices Inc.\nCopyright 2005-2008\tCommonwealth Scientific and Industrial Research \n                        Organisation (CSIRO)\nCopyright 1993, 2002, 2006 David Rowe\nCopyright 2003 \t\tEpicGames\nCopyright 1992-1994\tJutta Degener, Carsten Bormann\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n\n- Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n\n- Redistributions in binary form must reproduce the above copyright\nnotice, this list of conditions and the following disclaimer in the\ndocumentation and/or other materials provided with the distribution.\n\n- Neither the name of the Xiph.org Foundation nor the names of its\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR\nCONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\nEXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\nPROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\nLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\nNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "ffmpeg/licenses/twolame.txt",
    "content": "\t\t  GNU LESSER GENERAL PUBLIC LICENSE\n\t\t       Version 2.1, February 1999\n\n Copyright (C) 1991, 1999 Free Software Foundation, Inc.\n     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n[This is the first released version of the Lesser GPL.  It also counts\n as the successor of the GNU Library Public License, version 2, hence\n the version number 2.1.]\n\n\t\t\t    Preamble\n\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicenses are intended to guarantee your freedom to share and change\nfree software--to make sure the software is free for all its users.\n\n  This license, the Lesser General Public License, applies to some\nspecially designated software packages--typically libraries--of the\nFree Software Foundation and other authors who decide to use it.  You\ncan use it too, but we suggest you first think carefully about whether\nthis license or the ordinary General Public License is the better\nstrategy to use in any particular case, based on the explanations below.\n\n  When we speak of free software, we are referring to freedom of use,\nnot price.  Our General Public Licenses are designed to make sure that\nyou have the freedom to distribute copies of free software (and charge\nfor this service if you wish); that you receive source code or can get\nit if you want it; that you can change the software and use pieces of\nit in new free programs; and that you are informed that you can do\nthese things.\n\n  To protect your rights, we need to make restrictions that forbid\ndistributors to deny you these rights or to ask you to surrender these\nrights.  These restrictions translate to certain responsibilities for\nyou if you distribute copies of the library or if you modify it.\n\n  For example, if you distribute copies of the library, whether gratis\nor for a fee, you must give the recipients all the rights that we gave\nyou.  You must make sure that they, too, receive or can get the source\ncode.  If you link other code with the library, you must provide\ncomplete object files to the recipients, so that they can relink them\nwith the library after making changes to the library and recompiling\nit.  And you must show them these terms so they know their rights.\n\n  We protect your rights with a two-step method: (1) we copyright the\nlibrary, and (2) we offer you this license, which gives you legal\npermission to copy, distribute and/or modify the library.\n\n  To protect each distributor, we want to make it very clear that\nthere is no warranty for the free library.  Also, if the library is\nmodified by someone else and passed on, the recipients should know\nthat what they have is not the original version, so that the original\nauthor's reputation will not be affected by problems that might be\nintroduced by others.\n\f\n  Finally, software patents pose a constant threat to the existence of\nany free program.  We wish to make sure that a company cannot\neffectively restrict the users of a free program by obtaining a\nrestrictive license from a patent holder.  Therefore, we insist that\nany patent license obtained for a version of the library must be\nconsistent with the full freedom of use specified in this license.\n\n  Most GNU software, including some libraries, is covered by the\nordinary GNU General Public License.  This license, the GNU Lesser\nGeneral Public License, applies to certain designated libraries, and\nis quite different from the ordinary General Public License.  We use\nthis license for certain libraries in order to permit linking those\nlibraries into non-free programs.\n\n  When a program is linked with a library, whether statically or using\na shared library, the combination of the two is legally speaking a\ncombined work, a derivative of the original library.  The ordinary\nGeneral Public License therefore permits such linking only if the\nentire combination fits its criteria of freedom.  The Lesser General\nPublic License permits more lax criteria for linking other code with\nthe library.\n\n  We call this license the \"Lesser\" General Public License because it\ndoes Less to protect the user's freedom than the ordinary General\nPublic License.  It also provides other free software developers Less\nof an advantage over competing non-free programs.  These disadvantages\nare the reason we use the ordinary General Public License for many\nlibraries.  However, the Lesser license provides advantages in certain\nspecial circumstances.\n\n  For example, on rare occasions, there may be a special need to\nencourage the widest possible use of a certain library, so that it becomes\na de-facto standard.  To achieve this, non-free programs must be\nallowed to use the library.  A more frequent case is that a free\nlibrary does the same job as widely used non-free libraries.  In this\ncase, there is little to gain by limiting the free library to free\nsoftware only, so we use the Lesser General Public License.\n\n  In other cases, permission to use a particular library in non-free\nprograms enables a greater number of people to use a large body of\nfree software.  For example, permission to use the GNU C Library in\nnon-free programs enables many more people to use the whole GNU\noperating system, as well as its variant, the GNU/Linux operating\nsystem.\n\n  Although the Lesser General Public License is Less protective of the\nusers' freedom, it does ensure that the user of a program that is\nlinked with the Library has the freedom and the wherewithal to run\nthat program using a modified version of the Library.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.  Pay close attention to the difference between a\n\"work based on the library\" and a \"work that uses the library\".  The\nformer contains code derived from the library, whereas the latter must\nbe combined with the library in order to run.\n\f\n\t\t  GNU LESSER GENERAL PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. This License Agreement applies to any software library or other\nprogram which contains a notice placed by the copyright holder or\nother authorized party saying it may be distributed under the terms of\nthis Lesser General Public License (also called \"this License\").\nEach licensee is addressed as \"you\".\n\n  A \"library\" means a collection of software functions and/or data\nprepared so as to be conveniently linked with application programs\n(which use some of those functions and data) to form executables.\n\n  The \"Library\", below, refers to any such software library or work\nwhich has been distributed under these terms.  A \"work based on the\nLibrary\" means either the Library or any derivative work under\ncopyright law: that is to say, a work containing the Library or a\nportion of it, either verbatim or with modifications and/or translated\nstraightforwardly into another language.  (Hereinafter, translation is\nincluded without limitation in the term \"modification\".)\n\n  \"Source code\" for a work means the preferred form of the work for\nmaking modifications to it.  For a library, complete source code means\nall the source code for all modules it contains, plus any associated\ninterface definition files, plus the scripts used to control compilation\nand installation of the library.\n\n  Activities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning a program using the Library is not restricted, and output from\nsuch a program is covered only if its contents constitute a work based\non the Library (independent of the use of the Library in a tool for\nwriting it).  Whether that is true depends on what the Library does\nand what the program that uses the Library does.\n  \n  1. You may copy and distribute verbatim copies of the Library's\ncomplete source code as you receive it, in any medium, provided that\nyou conspicuously and appropriately publish on each copy an\nappropriate copyright notice and disclaimer of warranty; keep intact\nall the notices that refer to this License and to the absence of any\nwarranty; and distribute a copy of this License along with the\nLibrary.\n\n  You may charge a fee for the physical act of transferring a copy,\nand you may at your option offer warranty protection in exchange for a\nfee.\n\f\n  2. You may modify your copy or copies of the Library or any portion\nof it, thus forming a work based on the Library, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n\n    a) The modified work must itself be a software library.\n\n    b) You must cause the files modified to carry prominent notices\n    stating that you changed the files and the date of any change.\n\n    c) You must cause the whole of the work to be licensed at no\n    charge to all third parties under the terms of this License.\n\n    d) If a facility in the modified Library refers to a function or a\n    table of data to be supplied by an application program that uses\n    the facility, other than as an argument passed when the facility\n    is invoked, then you must make a good faith effort to ensure that,\n    in the event an application does not supply such function or\n    table, the facility still operates, and performs whatever part of\n    its purpose remains meaningful.\n\n    (For example, a function in a library to compute square roots has\n    a purpose that is entirely well-defined independent of the\n    application.  Therefore, Subsection 2d requires that any\n    application-supplied function or table used by this function must\n    be optional: if the application does not supply it, the square\n    root function must still compute square roots.)\n\nThese requirements apply to the modified work as a whole.  If\nidentifiable sections of that work are not derived from the Library,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works.  But when you\ndistribute the same sections as part of a whole which is a work based\non the Library, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote\nit.\n\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Library.\n\nIn addition, mere aggregation of another work not based on the Library\nwith the Library (or with a work based on the Library) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n\n  3. You may opt to apply the terms of the ordinary GNU General Public\nLicense instead of this License to a given copy of the Library.  To do\nthis, you must alter all the notices that refer to this License, so\nthat they refer to the ordinary GNU General Public License, version 2,\ninstead of to this License.  (If a newer version than version 2 of the\nordinary GNU General Public License has appeared, then you can specify\nthat version instead if you wish.)  Do not make any other change in\nthese notices.\n\f\n  Once this change is made in a given copy, it is irreversible for\nthat copy, so the ordinary GNU General Public License applies to all\nsubsequent copies and derivative works made from that copy.\n\n  This option is useful when you wish to copy part of the code of\nthe Library into a program that is not a library.\n\n  4. You may copy and distribute the Library (or a portion or\nderivative of it, under Section 2) in object code or executable form\nunder the terms of Sections 1 and 2 above provided that you accompany\nit with the complete corresponding machine-readable source code, which\nmust be distributed under the terms of Sections 1 and 2 above on a\nmedium customarily used for software interchange.\n\n  If distribution of object code is made by offering access to copy\nfrom a designated place, then offering equivalent access to copy the\nsource code from the same place satisfies the requirement to\ndistribute the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n\n  5. A program that contains no derivative of any portion of the\nLibrary, but is designed to work with the Library by being compiled or\nlinked with it, is called a \"work that uses the Library\".  Such a\nwork, in isolation, is not a derivative work of the Library, and\ntherefore falls outside the scope of this License.\n\n  However, linking a \"work that uses the Library\" with the Library\ncreates an executable that is a derivative of the Library (because it\ncontains portions of the Library), rather than a \"work that uses the\nlibrary\".  The executable is therefore covered by this License.\nSection 6 states terms for distribution of such executables.\n\n  When a \"work that uses the Library\" uses material from a header file\nthat is part of the Library, the object code for the work may be a\nderivative work of the Library even though the source code is not.\nWhether this is true is especially significant if the work can be\nlinked without the Library, or if the work is itself a library.  The\nthreshold for this to be true is not precisely defined by law.\n\n  If such an object file uses only numerical parameters, data\nstructure layouts and accessors, and small macros and small inline\nfunctions (ten lines or less in length), then the use of the object\nfile is unrestricted, regardless of whether it is legally a derivative\nwork.  (Executables containing this object code plus portions of the\nLibrary will still fall under Section 6.)\n\n  Otherwise, if the work is a derivative of the Library, you may\ndistribute the object code for the work under the terms of Section 6.\nAny executables containing that work also fall under Section 6,\nwhether or not they are linked directly with the Library itself.\n\f\n  6. As an exception to the Sections above, you may also combine or\nlink a \"work that uses the Library\" with the Library to produce a\nwork containing portions of the Library, and distribute that work\nunder terms of your choice, provided that the terms permit\nmodification of the work for the customer's own use and reverse\nengineering for debugging such modifications.\n\n  You must give prominent notice with each copy of the work that the\nLibrary is used in it and that the Library and its use are covered by\nthis License.  You must supply a copy of this License.  If the work\nduring execution displays copyright notices, you must include the\ncopyright notice for the Library among them, as well as a reference\ndirecting the user to the copy of this License.  Also, you must do one\nof these things:\n\n    a) Accompany the work with the complete corresponding\n    machine-readable source code for the Library including whatever\n    changes were used in the work (which must be distributed under\n    Sections 1 and 2 above); and, if the work is an executable linked\n    with the Library, with the complete machine-readable \"work that\n    uses the Library\", as object code and/or source code, so that the\n    user can modify the Library and then relink to produce a modified\n    executable containing the modified Library.  (It is understood\n    that the user who changes the contents of definitions files in the\n    Library will not necessarily be able to recompile the application\n    to use the modified definitions.)\n\n    b) Use a suitable shared library mechanism for linking with the\n    Library.  A suitable mechanism is one that (1) uses at run time a\n    copy of the library already present on the user's computer system,\n    rather than copying library functions into the executable, and (2)\n    will operate properly with a modified version of the library, if\n    the user installs one, as long as the modified version is\n    interface-compatible with the version that the work was made with.\n\n    c) Accompany the work with a written offer, valid for at\n    least three years, to give the same user the materials\n    specified in Subsection 6a, above, for a charge no more\n    than the cost of performing this distribution.\n\n    d) If distribution of the work is made by offering access to copy\n    from a designated place, offer equivalent access to copy the above\n    specified materials from the same place.\n\n    e) Verify that the user has already received a copy of these\n    materials or that you have already sent this user a copy.\n\n  For an executable, the required form of the \"work that uses the\nLibrary\" must include any data and utility programs needed for\nreproducing the executable from it.  However, as a special exception,\nthe materials to be distributed need not include anything that is\nnormally distributed (in either source or binary form) with the major\ncomponents (compiler, kernel, and so on) of the operating system on\nwhich the executable runs, unless that component itself accompanies\nthe executable.\n\n  It may happen that this requirement contradicts the license\nrestrictions of other proprietary libraries that do not normally\naccompany the operating system.  Such a contradiction means you cannot\nuse both them and the Library together in an executable that you\ndistribute.\n\f\n  7. You may place library facilities that are a work based on the\nLibrary side-by-side in a single library together with other library\nfacilities not covered by this License, and distribute such a combined\nlibrary, provided that the separate distribution of the work based on\nthe Library and of the other library facilities is otherwise\npermitted, and provided that you do these two things:\n\n    a) Accompany the combined library with a copy of the same work\n    based on the Library, uncombined with any other library\n    facilities.  This must be distributed under the terms of the\n    Sections above.\n\n    b) Give prominent notice with the combined library of the fact\n    that part of it is a work based on the Library, and explaining\n    where to find the accompanying uncombined form of the same work.\n\n  8. You may not copy, modify, sublicense, link with, or distribute\nthe Library except as expressly provided under this License.  Any\nattempt otherwise to copy, modify, sublicense, link with, or\ndistribute the Library is void, and will automatically terminate your\nrights under this License.  However, parties who have received copies,\nor rights, from you under this License will not have their licenses\nterminated so long as such parties remain in full compliance.\n\n  9. You are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Library or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Library (or any work based on the\nLibrary), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Library or works based on it.\n\n  10. Each time you redistribute the Library (or any work based on the\nLibrary), the recipient automatically receives a license from the\noriginal licensor to copy, distribute, link with or modify the Library\nsubject to these terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties with\nthis License.\n\f\n  11. If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Library at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Library by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Library.\n\nIf any portion of this section is held invalid or unenforceable under any\nparticular circumstance, the balance of the section is intended to apply,\nand the section as a whole is intended to apply in other circumstances.\n\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n\n  12. If the distribution and/or use of the Library is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Library under this License may add\nan explicit geographical distribution limitation excluding those countries,\nso that distribution is permitted only in or among countries not thus\nexcluded.  In such case, this License incorporates the limitation as if\nwritten in the body of this License.\n\n  13. The Free Software Foundation may publish revised and/or new\nversions of the Lesser General Public License from time to time.\nSuch new versions will be similar in spirit to the present version,\nbut may differ in detail to address new problems or concerns.\n\nEach version is given a distinguishing version number.  If the Library\nspecifies a version number of this License which applies to it and\n\"any later version\", you have the option of following the terms and\nconditions either of that version or of any later version published by\nthe Free Software Foundation.  If the Library does not specify a\nlicense version number, you may choose any version ever published by\nthe Free Software Foundation.\n\f\n  14. If you wish to incorporate parts of the Library into other free\nprograms whose distribution conditions are incompatible with these,\nwrite to the author to ask for permission.  For software which is\ncopyrighted by the Free Software Foundation, write to the Free\nSoftware Foundation; we sometimes make exceptions for this.  Our\ndecision will be guided by the two goals of preserving the free status\nof all derivatives of our free software and of promoting the sharing\nand reuse of software generally.\n\n\t\t\t    NO WARRANTY\n\n  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO\nWARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.\nEXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR\nOTHER PARTIES PROVIDE THE LIBRARY \"AS IS\" WITHOUT WARRANTY OF ANY\nKIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE\nLIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME\nTHE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN\nWRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY\nAND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU\nFOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR\nCONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE\nLIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING\nRENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A\nFAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF\nSUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\nDAMAGES.\n\n\t\t     END OF TERMS AND CONDITIONS\n\f\n           How to Apply These Terms to Your New Libraries\n\n  If you develop a new library, and you want it to be of the greatest\npossible use to the public, we recommend making it free software that\neveryone can redistribute and change.  You can do so by permitting\nredistribution under these terms (or, alternatively, under the terms of the\nordinary General Public License).\n\n  To apply these terms, attach the following notices to the library.  It is\nsafest to attach them to the start of each source file to most effectively\nconvey the exclusion of warranty; and each file should have at least the\n\"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the library's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This library is free software; you can redistribute it and/or\n    modify it under the terms of the GNU Lesser General Public\n    License as published by the Free Software Foundation; either\n    version 2.1 of the License, or (at your option) any later version.\n\n    This library is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n    Lesser General Public License for more details.\n\n    You should have received a copy of the GNU Lesser General Public\n    License along with this library; if not, write to the Free Software\n    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n\nAlso add information on how to contact you by electronic and paper mail.\n\nYou should also get your employer (if you work as a programmer) or your\nschool, if any, to sign a \"copyright disclaimer\" for the library, if\nnecessary.  Here is a sample; alter the names:\n\n  Yoyodyne, Inc., hereby disclaims all copyright interest in the\n  library `Frob' (a library for tweaking knobs) written by James Random Hacker.\n\n  <signature of Ty Coon>, 1 April 1990\n  Ty Coon, President of Vice\n\nThat's all there is to it!\n\n\n"
  },
  {
    "path": "ffmpeg/licenses/vo-aacenc.txt",
    "content": "Apache License\nVersion 2.0, January 2004\nhttp://www.apache.org/licenses/\n\nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n1. Definitions.\n\n\"License\" shall mean the terms and conditions for use, reproduction, and\ndistribution as defined by Sections 1 through 9 of this document.\n\n\"Licensor\" shall mean the copyright owner or entity authorized by the\ncopyright owner that is granting the License.\n\n\"Legal Entity\" shall mean the union of the acting entity and all other\nentities that control, are controlled by, or are under common control with\nthat entity. For the purposes of this definition, \"control\" means (i) the\npower, direct or indirect, to cause the direction or management of such\nentity, whether by contract or otherwise, or (ii) ownership of fifty\npercent (50%) or more of the outstanding shares, or (iii) beneficial\nownership of such entity.\n\n\"You\" (or \"Your\") shall mean an individual or Legal Entity exercising\npermissions granted by this License.\n\n\"Source\" form shall mean the preferred form for making modifications,\nincluding but not limited to software source code, documentation source,\nand configuration files.\n\n\"Object\" form shall mean any form resulting from mechanical transformation\nor translation of a Source form, including but not limited to compiled\nobject code, generated documentation, and conversions to other media types.\n\n\"Work\" shall mean the work of authorship, whether in Source or Object form,\nmade available under the License, as indicated by a copyright notice that\nis included in or attached to the work (an example is provided in the\nAppendix below).\n\n\"Derivative Works\" shall mean any work, whether in Source or Object form,\nthat is based on (or derived from) the Work and for which the editorial\nrevisions, annotations, elaborations, or other modifications represent, as\na whole, an original work of authorship. For the purposes of this License,\nDerivative Works shall not include works that remain separable from, or\nmerely link (or bind by name) to the interfaces of, the Work and Derivative\nWorks thereof.\n\n\"Contribution\" shall mean any work of authorship, including the original\nversion of the Work and any modifications or additions to that Work or\nDerivative Works thereof, that is intentionally submitted to Licensor for\ninclusion in the Work by the copyright owner or by an individual or Legal\nEntity authorized to submit on behalf of the copyright owner. For the\npurposes of this definition, \"submitted\" means any form of electronic,\nverbal, or written communication sent to the Licensor or its\nrepresentatives, including but not limited to communication on electronic\nmailing lists, source code control systems, and issue tracking systems that\nare managed by, or on behalf of, the Licensor for the purpose of discussing\nand improving the Work, but excluding communication that is conspicuously\nmarked or otherwise designated in writing by the copyright owner as \"Not a\nContribution.\"\n\n\"Contributor\" shall mean Licensor and any individual or Legal Entity on\nbehalf of whom a Contribution has been received by Licensor and\nsubsequently incorporated within the Work.\n\n2. Grant of Copyright License. Subject to the terms and conditions of this\nLicense, each Contributor hereby grants to You a perpetual, worldwide,\nnon-exclusive, no-charge, royalty-free, irrevocable copyright license to\nreproduce, prepare Derivative Works of, publicly display, publicly perform,\nsublicense, and distribute the Work and such Derivative Works in Source or\nObject form.\n\n3. Grant of Patent License. Subject to the terms and conditions of this\nLicense, each Contributor hereby grants to You a perpetual, worldwide,\nnon-exclusive, no-charge, royalty-free, irrevocable (except as stated in\nthis section) patent license to make, have made, use, offer to sell, sell,\nimport, and otherwise transfer the Work, where such license applies only to\nthose patent claims licensable by such Contributor that are necessarily\ninfringed by their Contribution(s) alone or by combination of their\nContribution(s) with the Work to which such Contribution(s) was submitted.\nIf You institute patent litigation against any entity (including a\ncross-claim or counterclaim in a lawsuit) alleging that the Work or a\nContribution incorporated within the Work constitutes direct or\ncontributory patent infringement, then any patent licenses granted to You\nunder this License for that Work shall terminate as of the date such\nlitigation is filed.\n\n4. Redistribution. You may reproduce and distribute copies of the Work or\nDerivative Works thereof in any medium, with or without modifications, and\nin Source or Object form, provided that You meet the following conditions:\n\n   1. You must give any other recipients of the Work or Derivative Works a\ncopy of this License; and\n\n   2. You must cause any modified files to carry prominent notices stating\nthat You changed the files; and\n\n   3. You must retain, in the Source form of any Derivative Works that You\ndistribute, all copyright, patent, trademark, and attribution notices from\nthe Source form of the Work, excluding those notices that do not pertain to\nany part of the Derivative Works; and\n\n   4. If the Work includes a \"NOTICE\" text file as part of its\ndistribution, then any Derivative Works that You distribute must include a\nreadable copy of the attribution notices contained within such NOTICE file,\nexcluding those notices that do not pertain to any part of the Derivative\nWorks, in at least one of the following places: within a NOTICE text file\ndistributed as part of the Derivative Works; within the Source form or\ndocumentation, if provided along with the Derivative Works; or, within a\ndisplay generated by the Derivative Works, if and wherever such third-party\nnotices normally appear. The contents of the NOTICE file are for\ninformational purposes only and do not modify the License. You may add Your\nown attribution notices within Derivative Works that You distribute,\nalongside or as an addendum to the NOTICE text from the Work, provided that\nsuch additional attribution notices cannot be construed as modifying the\nLicense.\n\nYou may add Your own copyright statement to Your modifications and may\nprovide additional or different license terms and conditions for use,\nreproduction, or distribution of Your modifications, or for any such\nDerivative Works as a whole, provided Your use, reproduction, and\ndistribution of the Work otherwise complies with the conditions stated in\nthis License.\n\n5. Submission of Contributions. Unless You explicitly state otherwise, any\nContribution intentionally submitted for inclusion in the Work by You to\nthe Licensor shall be under the terms and conditions of this License,\nwithout any additional terms or conditions. Notwithstanding the above,\nnothing herein shall supersede or modify the terms of any separate license\nagreement you may have executed with Licensor regarding such Contributions.\n\n6. Trademarks. This License does not grant permission to use the trade\nnames, trademarks, service marks, or product names of the Licensor, except\nas required for reasonable and customary use in describing the origin of\nthe Work and reproducing the content of the NOTICE file.\n\n7. Disclaimer of Warranty. Unless required by applicable law or agreed to\nin writing, Licensor provides the Work (and each Contributor provides its\nContributions) on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, either express or implied, including, without limitation, any\nwarranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or\nFITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for\ndetermining the appropriateness of using or redistributing the Work and\nassume any risks associated with Your exercise of permissions under this\nLicense.\n\n8. Limitation of Liability. In no event and under no legal theory, whether\nin tort (including negligence), contract, or otherwise, unless required by\napplicable law (such as deliberate and grossly negligent acts) or agreed to\nin writing, shall any Contributor be liable to You for damages, including\nany direct, indirect, special, incidental, or consequential damages of any\ncharacter arising as a result of this License or out of the use or\ninability to use the Work (including but not limited to damages for loss of\ngoodwill, work stoppage, computer failure or malfunction, or any and all\nother commercial damages or losses), even if such Contributor has been\nadvised of the possibility of such damages.\n\n9. Accepting Warranty or Additional Liability. While redistributing the\nWork or Derivative Works thereof, You may choose to offer, and charge a fee\nfor, acceptance of support, warranty, indemnity, or other liability\nobligations and/or rights consistent with this License. However, in\naccepting such obligations, You may act only on Your own behalf and on Your\nsole responsibility, not on behalf of any other Contributor, and only if\nYou agree to indemnify, defend, and hold each Contributor harmless for any\nliability incurred by, or claims asserted against, such Contributor by\nreason of your accepting any such warranty or additional liability.\n\nEND OF TERMS AND CONDITIONS\n\nAPPENDIX: How to apply the Apache License to your work\n\nTo apply the Apache License to your work, attach the following boilerplate\nnotice, with the fields enclosed by brackets \"[]\" replaced with your own\nidentifying information. (Don't include the brackets!) The text should be\nenclosed in the appropriate comment syntax for the file format. We also\nrecommend that a file or class name and description of purpose be included\non the same \"printed page\" as the copyright notice for easier\nidentification within third-party archives.\n\n Copyright [yyyy] [name of copyright owner]\n\n Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n not use this file except in compliance with the License. You may obtain a\n copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable\n law or agreed to in writing, software distributed under the License is\n distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n KIND, either express or implied. See the License for the specific language\n governing permissions and limitations under the License.\n"
  },
  {
    "path": "ffmpeg/licenses/vo-amrwbenc.txt",
    "content": "Apache License\nVersion 2.0, January 2004\nhttp://www.apache.org/licenses/\n\nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n1. Definitions.\n\n\"License\" shall mean the terms and conditions for use, reproduction, and\ndistribution as defined by Sections 1 through 9 of this document.\n\n\"Licensor\" shall mean the copyright owner or entity authorized by the\ncopyright owner that is granting the License.\n\n\"Legal Entity\" shall mean the union of the acting entity and all other\nentities that control, are controlled by, or are under common control with\nthat entity. For the purposes of this definition, \"control\" means (i) the\npower, direct or indirect, to cause the direction or management of such\nentity, whether by contract or otherwise, or (ii) ownership of fifty\npercent (50%) or more of the outstanding shares, or (iii) beneficial\nownership of such entity.\n\n\"You\" (or \"Your\") shall mean an individual or Legal Entity exercising\npermissions granted by this License.\n\n\"Source\" form shall mean the preferred form for making modifications,\nincluding but not limited to software source code, documentation source,\nand configuration files.\n\n\"Object\" form shall mean any form resulting from mechanical transformation\nor translation of a Source form, including but not limited to compiled\nobject code, generated documentation, and conversions to other media types.\n\n\"Work\" shall mean the work of authorship, whether in Source or Object form,\nmade available under the License, as indicated by a copyright notice that\nis included in or attached to the work (an example is provided in the\nAppendix below).\n\n\"Derivative Works\" shall mean any work, whether in Source or Object form,\nthat is based on (or derived from) the Work and for which the editorial\nrevisions, annotations, elaborations, or other modifications represent, as\na whole, an original work of authorship. For the purposes of this License,\nDerivative Works shall not include works that remain separable from, or\nmerely link (or bind by name) to the interfaces of, the Work and Derivative\nWorks thereof.\n\n\"Contribution\" shall mean any work of authorship, including the original\nversion of the Work and any modifications or additions to that Work or\nDerivative Works thereof, that is intentionally submitted to Licensor for\ninclusion in the Work by the copyright owner or by an individual or Legal\nEntity authorized to submit on behalf of the copyright owner. For the\npurposes of this definition, \"submitted\" means any form of electronic,\nverbal, or written communication sent to the Licensor or its\nrepresentatives, including but not limited to communication on electronic\nmailing lists, source code control systems, and issue tracking systems that\nare managed by, or on behalf of, the Licensor for the purpose of discussing\nand improving the Work, but excluding communication that is conspicuously\nmarked or otherwise designated in writing by the copyright owner as \"Not a\nContribution.\"\n\n\"Contributor\" shall mean Licensor and any individual or Legal Entity on\nbehalf of whom a Contribution has been received by Licensor and\nsubsequently incorporated within the Work.\n\n2. Grant of Copyright License. Subject to the terms and conditions of this\nLicense, each Contributor hereby grants to You a perpetual, worldwide,\nnon-exclusive, no-charge, royalty-free, irrevocable copyright license to\nreproduce, prepare Derivative Works of, publicly display, publicly perform,\nsublicense, and distribute the Work and such Derivative Works in Source or\nObject form.\n\n3. Grant of Patent License. Subject to the terms and conditions of this\nLicense, each Contributor hereby grants to You a perpetual, worldwide,\nnon-exclusive, no-charge, royalty-free, irrevocable (except as stated in\nthis section) patent license to make, have made, use, offer to sell, sell,\nimport, and otherwise transfer the Work, where such license applies only to\nthose patent claims licensable by such Contributor that are necessarily\ninfringed by their Contribution(s) alone or by combination of their\nContribution(s) with the Work to which such Contribution(s) was submitted.\nIf You institute patent litigation against any entity (including a\ncross-claim or counterclaim in a lawsuit) alleging that the Work or a\nContribution incorporated within the Work constitutes direct or\ncontributory patent infringement, then any patent licenses granted to You\nunder this License for that Work shall terminate as of the date such\nlitigation is filed.\n\n4. Redistribution. You may reproduce and distribute copies of the Work or\nDerivative Works thereof in any medium, with or without modifications, and\nin Source or Object form, provided that You meet the following conditions:\n\n   1. You must give any other recipients of the Work or Derivative Works a\ncopy of this License; and\n\n   2. You must cause any modified files to carry prominent notices stating\nthat You changed the files; and\n\n   3. You must retain, in the Source form of any Derivative Works that You\ndistribute, all copyright, patent, trademark, and attribution notices from\nthe Source form of the Work, excluding those notices that do not pertain to\nany part of the Derivative Works; and\n\n   4. If the Work includes a \"NOTICE\" text file as part of its\ndistribution, then any Derivative Works that You distribute must include a\nreadable copy of the attribution notices contained within such NOTICE file,\nexcluding those notices that do not pertain to any part of the Derivative\nWorks, in at least one of the following places: within a NOTICE text file\ndistributed as part of the Derivative Works; within the Source form or\ndocumentation, if provided along with the Derivative Works; or, within a\ndisplay generated by the Derivative Works, if and wherever such third-party\nnotices normally appear. The contents of the NOTICE file are for\ninformational purposes only and do not modify the License. You may add Your\nown attribution notices within Derivative Works that You distribute,\nalongside or as an addendum to the NOTICE text from the Work, provided that\nsuch additional attribution notices cannot be construed as modifying the\nLicense.\n\nYou may add Your own copyright statement to Your modifications and may\nprovide additional or different license terms and conditions for use,\nreproduction, or distribution of Your modifications, or for any such\nDerivative Works as a whole, provided Your use, reproduction, and\ndistribution of the Work otherwise complies with the conditions stated in\nthis License.\n\n5. Submission of Contributions. Unless You explicitly state otherwise, any\nContribution intentionally submitted for inclusion in the Work by You to\nthe Licensor shall be under the terms and conditions of this License,\nwithout any additional terms or conditions. Notwithstanding the above,\nnothing herein shall supersede or modify the terms of any separate license\nagreement you may have executed with Licensor regarding such Contributions.\n\n6. Trademarks. This License does not grant permission to use the trade\nnames, trademarks, service marks, or product names of the Licensor, except\nas required for reasonable and customary use in describing the origin of\nthe Work and reproducing the content of the NOTICE file.\n\n7. Disclaimer of Warranty. Unless required by applicable law or agreed to\nin writing, Licensor provides the Work (and each Contributor provides its\nContributions) on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, either express or implied, including, without limitation, any\nwarranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or\nFITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for\ndetermining the appropriateness of using or redistributing the Work and\nassume any risks associated with Your exercise of permissions under this\nLicense.\n\n8. Limitation of Liability. In no event and under no legal theory, whether\nin tort (including negligence), contract, or otherwise, unless required by\napplicable law (such as deliberate and grossly negligent acts) or agreed to\nin writing, shall any Contributor be liable to You for damages, including\nany direct, indirect, special, incidental, or consequential damages of any\ncharacter arising as a result of this License or out of the use or\ninability to use the Work (including but not limited to damages for loss of\ngoodwill, work stoppage, computer failure or malfunction, or any and all\nother commercial damages or losses), even if such Contributor has been\nadvised of the possibility of such damages.\n\n9. Accepting Warranty or Additional Liability. While redistributing the\nWork or Derivative Works thereof, You may choose to offer, and charge a fee\nfor, acceptance of support, warranty, indemnity, or other liability\nobligations and/or rights consistent with this License. However, in\naccepting such obligations, You may act only on Your own behalf and on Your\nsole responsibility, not on behalf of any other Contributor, and only if\nYou agree to indemnify, defend, and hold each Contributor harmless for any\nliability incurred by, or claims asserted against, such Contributor by\nreason of your accepting any such warranty or additional liability.\n\nEND OF TERMS AND CONDITIONS\n\nAPPENDIX: How to apply the Apache License to your work\n\nTo apply the Apache License to your work, attach the following boilerplate\nnotice, with the fields enclosed by brackets \"[]\" replaced with your own\nidentifying information. (Don't include the brackets!) The text should be\nenclosed in the appropriate comment syntax for the file format. We also\nrecommend that a file or class name and description of purpose be included\non the same \"printed page\" as the copyright notice for easier\nidentification within third-party archives.\n\n Copyright [yyyy] [name of copyright owner]\n\n Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n not use this file except in compliance with the License. You may obtain a\n copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable\n law or agreed to in writing, software distributed under the License is\n distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n KIND, either express or implied. See the License for the specific language\n governing permissions and limitations under the License.\n"
  },
  {
    "path": "ffmpeg/licenses/x264.txt",
    "content": "\t\t    GNU GENERAL PUBLIC LICENSE\n\t\t       Version 2, June 1991\n\n Copyright (C) 1989, 1991 Free Software Foundation, Inc.\n     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n\t\t\t    Preamble\n\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicense is intended to guarantee your freedom to share and change free\nsoftware--to make sure the software is free for all its users.  This\nGeneral Public License applies to most of the Free Software\nFoundation's software and to any other program whose authors commit to\nusing it.  (Some other Free Software Foundation software is covered by\nthe GNU Library General Public License instead.)  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthis service if you wish), that you receive source code or can get it\nif you want it, that you can change the software or use pieces of it\nin new free programs; and that you know you can do these things.\n\n  To protect your rights, we need to make restrictions that forbid\nanyone to deny you these rights or to ask you to surrender the rights.\nThese restrictions translate to certain responsibilities for you if you\ndistribute copies of the software, or if you modify it.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must give the recipients all the rights that\nyou have.  You must make sure that they, too, receive or can get the\nsource code.  And you must show them these terms so they know their\nrights.\n\n  We protect your rights with two steps: (1) copyright the software, and\n(2) offer you this license which gives you legal permission to copy,\ndistribute and/or modify the software.\n\n  Also, for each author's protection and ours, we want to make certain\nthat everyone understands that there is no warranty for this free\nsoftware.  If the software is modified by someone else and passed on, we\nwant its recipients to know that what they have is not the original, so\nthat any problems introduced by others will not reflect on the original\nauthors' reputations.\n\n  Finally, any free program is threatened constantly by software\npatents.  We wish to avoid the danger that redistributors of a free\nprogram will individually obtain patent licenses, in effect making the\nprogram proprietary.  To prevent this, we have made it clear that any\npatent must be licensed for everyone's free use or not licensed at all.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\f\n\t\t    GNU GENERAL PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. This License applies to any program or other work which contains\na notice placed by the copyright holder saying it may be distributed\nunder the terms of this General Public License.  The \"Program\", below,\nrefers to any such program or work, and a \"work based on the Program\"\nmeans either the Program or any derivative work under copyright law:\nthat is to say, a work containing the Program or a portion of it,\neither verbatim or with modifications and/or translated into another\nlanguage.  (Hereinafter, translation is included without limitation in\nthe term \"modification\".)  Each licensee is addressed as \"you\".\n\nActivities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning the Program is not restricted, and the output from the Program\nis covered only if its contents constitute a work based on the\nProgram (independent of having been made by running the Program).\nWhether that is true depends on what the Program does.\n\n  1. You may copy and distribute verbatim copies of the Program's\nsource code as you receive it, in any medium, provided that you\nconspicuously and appropriately publish on each copy an appropriate\ncopyright notice and disclaimer of warranty; keep intact all the\nnotices that refer to this License and to the absence of any warranty;\nand give any other recipients of the Program a copy of this License\nalong with the Program.\n\nYou may charge a fee for the physical act of transferring a copy, and\nyou may at your option offer warranty protection in exchange for a fee.\n\n  2. You may modify your copy or copies of the Program or any portion\nof it, thus forming a work based on the Program, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n\n    a) You must cause the modified files to carry prominent notices\n    stating that you changed the files and the date of any change.\n\n    b) You must cause any work that you distribute or publish, that in\n    whole or in part contains or is derived from the Program or any\n    part thereof, to be licensed as a whole at no charge to all third\n    parties under the terms of this License.\n\n    c) If the modified program normally reads commands interactively\n    when run, you must cause it, when started running for such\n    interactive use in the most ordinary way, to print or display an\n    announcement including an appropriate copyright notice and a\n    notice that there is no warranty (or else, saying that you provide\n    a warranty) and that users may redistribute the program under\n    these conditions, and telling the user how to view a copy of this\n    License.  (Exception: if the Program itself is interactive but\n    does not normally print such an announcement, your work based on\n    the Program is not required to print an announcement.)\n\f\nThese requirements apply to the modified work as a whole.  If\nidentifiable sections of that work are not derived from the Program,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works.  But when you\ndistribute the same sections as part of a whole which is a work based\non the Program, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote it.\n\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Program.\n\nIn addition, mere aggregation of another work not based on the Program\nwith the Program (or with a work based on the Program) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n\n  3. You may copy and distribute the Program (or a work based on it,\nunder Section 2) in object code or executable form under the terms of\nSections 1 and 2 above provided that you also do one of the following:\n\n    a) Accompany it with the complete corresponding machine-readable\n    source code, which must be distributed under the terms of Sections\n    1 and 2 above on a medium customarily used for software interchange; or,\n\n    b) Accompany it with a written offer, valid for at least three\n    years, to give any third party, for a charge no more than your\n    cost of physically performing source distribution, a complete\n    machine-readable copy of the corresponding source code, to be\n    distributed under the terms of Sections 1 and 2 above on a medium\n    customarily used for software interchange; or,\n\n    c) Accompany it with the information you received as to the offer\n    to distribute corresponding source code.  (This alternative is\n    allowed only for noncommercial distribution and only if you\n    received the program in object code or executable form with such\n    an offer, in accord with Subsection b above.)\n\nThe source code for a work means the preferred form of the work for\nmaking modifications to it.  For an executable work, complete source\ncode means all the source code for all modules it contains, plus any\nassociated interface definition files, plus the scripts used to\ncontrol compilation and installation of the executable.  However, as a\nspecial exception, the source code distributed need not include\nanything that is normally distributed (in either source or binary\nform) with the major components (compiler, kernel, and so on) of the\noperating system on which the executable runs, unless that component\nitself accompanies the executable.\n\nIf distribution of executable or object code is made by offering\naccess to copy from a designated place, then offering equivalent\naccess to copy the source code from the same place counts as\ndistribution of the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n\f\n  4. You may not copy, modify, sublicense, or distribute the Program\nexcept as expressly provided under this License.  Any attempt\notherwise to copy, modify, sublicense or distribute the Program is\nvoid, and will automatically terminate your rights under this License.\nHowever, parties who have received copies, or rights, from you under\nthis License will not have their licenses terminated so long as such\nparties remain in full compliance.\n\n  5. You are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Program or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Program (or any work based on the\nProgram), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Program or works based on it.\n\n  6. Each time you redistribute the Program (or any work based on the\nProgram), the recipient automatically receives a license from the\noriginal licensor to copy, distribute or modify the Program subject to\nthese terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties to\nthis License.\n\n  7. If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Program at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Program by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Program.\n\nIf any portion of this section is held invalid or unenforceable under\nany particular circumstance, the balance of the section is intended to\napply and the section as a whole is intended to apply in other\ncircumstances.\n\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system, which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n\f\n  8. If the distribution and/or use of the Program is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Program under this License\nmay add an explicit geographical distribution limitation excluding\nthose countries, so that distribution is permitted only in or among\ncountries not thus excluded.  In such case, this License incorporates\nthe limitation as if written in the body of this License.\n\n  9. The Free Software Foundation may publish revised and/or new versions\nof the General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\nEach version is given a distinguishing version number.  If the Program\nspecifies a version number of this License which applies to it and \"any\nlater version\", you have the option of following the terms and conditions\neither of that version or of any later version published by the Free\nSoftware Foundation.  If the Program does not specify a version number of\nthis License, you may choose any version ever published by the Free Software\nFoundation.\n\n  10. If you wish to incorporate parts of the Program into other free\nprograms whose distribution conditions are different, write to the author\nto ask for permission.  For software which is copyrighted by the Free\nSoftware Foundation, write to the Free Software Foundation; we sometimes\nmake exceptions for this.  Our decision will be guided by the two goals\nof preserving the free status of all derivatives of our free software and\nof promoting the sharing and reuse of software generally.\n\n\t\t\t    NO WARRANTY\n\n  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\nFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN\nOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\nPROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\nOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS\nTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE\nPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\nREPAIR OR CORRECTION.\n\n  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\nREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\nINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\nOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\nTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\nYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\nPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGES.\n\n\t\t     END OF TERMS AND CONDITIONS\n\f\n\t    How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nconvey the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software; you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation; either version 2 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program; if not, write to the Free Software\n    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n\n\nAlso add information on how to contact you by electronic and paper mail.\n\nIf the program is interactive, make it output a short notice like this\nwhen it starts in an interactive mode:\n\n    Gnomovision version 69, Copyright (C) year  name of author\n    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, the commands you use may\nbe called something other than `show w' and `show c'; they could even be\nmouse-clicks or menu items--whatever suits your program.\n\nYou should also get your employer (if you work as a programmer) or your\nschool, if any, to sign a \"copyright disclaimer\" for the program, if\nnecessary.  Here is a sample; alter the names:\n\n  Yoyodyne, Inc., hereby disclaims all copyright interest in the program\n  `Gnomovision' (which makes passes at compilers) written by James Hacker.\n\n  <signature of Ty Coon>, 1 April 1989\n  Ty Coon, President of Vice\n\nThis General Public License does not permit incorporating your program into\nproprietary programs.  If your program is a subroutine library, you may\nconsider it more useful to permit linking proprietary applications with the\nlibrary.  If this is what you want to do, use the GNU Library General\nPublic License instead of this License.\n"
  },
  {
    "path": "ffmpeg/licenses/xavs.txt",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<http://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<http://www.gnu.org/philosophy/why-not-lgpl.html>.\n"
  },
  {
    "path": "ffmpeg/licenses/xvid.txt",
    "content": "\t\t    GNU GENERAL PUBLIC LICENSE\n\t\t       Version 2, June 1991\n\n Copyright (C) 1989, 1991 Free Software Foundation, Inc.\n 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n\t\t\t    Preamble\n\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicense is intended to guarantee your freedom to share and change free\nsoftware--to make sure the software is free for all its users.  This\nGeneral Public License applies to most of the Free Software\nFoundation's software and to any other program whose authors commit to\nusing it.  (Some other Free Software Foundation software is covered by\nthe GNU Library General Public License instead.)  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthis service if you wish), that you receive source code or can get it\nif you want it, that you can change the software or use pieces of it\nin new free programs; and that you know you can do these things.\n\n  To protect your rights, we need to make restrictions that forbid\nanyone to deny you these rights or to ask you to surrender the rights.\nThese restrictions translate to certain responsibilities for you if you\ndistribute copies of the software, or if you modify it.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must give the recipients all the rights that\nyou have.  You must make sure that they, too, receive or can get the\nsource code.  And you must show them these terms so they know their\nrights.\n\n  We protect your rights with two steps: (1) copyright the software, and\n(2) offer you this license which gives you legal permission to copy,\ndistribute and/or modify the software.\n\n  Also, for each author's protection and ours, we want to make certain\nthat everyone understands that there is no warranty for this free\nsoftware.  If the software is modified by someone else and passed on, we\nwant its recipients to know that what they have is not the original, so\nthat any problems introduced by others will not reflect on the original\nauthors' reputations.\n\n  Finally, any free program is threatened constantly by software\npatents.  We wish to avoid the danger that redistributors of a free\nprogram will individually obtain patent licenses, in effect making the\nprogram proprietary.  To prevent this, we have made it clear that any\npatent must be licensed for everyone's free use or not licensed at all.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\f\n\t\t    GNU GENERAL PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. This License applies to any program or other work which contains\na notice placed by the copyright holder saying it may be distributed\nunder the terms of this General Public License.  The \"Program\", below,\nrefers to any such program or work, and a \"work based on the Program\"\nmeans either the Program or any derivative work under copyright law:\nthat is to say, a work containing the Program or a portion of it,\neither verbatim or with modifications and/or translated into another\nlanguage.  (Hereinafter, translation is included without limitation in\nthe term \"modification\".)  Each licensee is addressed as \"you\".\n\nActivities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning the Program is not restricted, and the output from the Program\nis covered only if its contents constitute a work based on the\nProgram (independent of having been made by running the Program).\nWhether that is true depends on what the Program does.\n\n  1. You may copy and distribute verbatim copies of the Program's\nsource code as you receive it, in any medium, provided that you\nconspicuously and appropriately publish on each copy an appropriate\ncopyright notice and disclaimer of warranty; keep intact all the\nnotices that refer to this License and to the absence of any warranty;\nand give any other recipients of the Program a copy of this License\nalong with the Program.\n\nYou may charge a fee for the physical act of transferring a copy, and\nyou may at your option offer warranty protection in exchange for a fee.\n\n  2. You may modify your copy or copies of the Program or any portion\nof it, thus forming a work based on the Program, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n\n    a) You must cause the modified files to carry prominent notices\n    stating that you changed the files and the date of any change.\n\n    b) You must cause any work that you distribute or publish, that in\n    whole or in part contains or is derived from the Program or any\n    part thereof, to be licensed as a whole at no charge to all third\n    parties under the terms of this License.\n\n    c) If the modified program normally reads commands interactively\n    when run, you must cause it, when started running for such\n    interactive use in the most ordinary way, to print or display an\n    announcement including an appropriate copyright notice and a\n    notice that there is no warranty (or else, saying that you provide\n    a warranty) and that users may redistribute the program under\n    these conditions, and telling the user how to view a copy of this\n    License.  (Exception: if the Program itself is interactive but\n    does not normally print such an announcement, your work based on\n    the Program is not required to print an announcement.)\n\f\nThese requirements apply to the modified work as a whole.  If\nidentifiable sections of that work are not derived from the Program,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works.  But when you\ndistribute the same sections as part of a whole which is a work based\non the Program, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote it.\n\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Program.\n\nIn addition, mere aggregation of another work not based on the Program\nwith the Program (or with a work based on the Program) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n\n  3. You may copy and distribute the Program (or a work based on it,\nunder Section 2) in object code or executable form under the terms of\nSections 1 and 2 above provided that you also do one of the following:\n\n    a) Accompany it with the complete corresponding machine-readable\n    source code, which must be distributed under the terms of Sections\n    1 and 2 above on a medium customarily used for software interchange; or,\n\n    b) Accompany it with a written offer, valid for at least three\n    years, to give any third party, for a charge no more than your\n    cost of physically performing source distribution, a complete\n    machine-readable copy of the corresponding source code, to be\n    distributed under the terms of Sections 1 and 2 above on a medium\n    customarily used for software interchange; or,\n\n    c) Accompany it with the information you received as to the offer\n    to distribute corresponding source code.  (This alternative is\n    allowed only for noncommercial distribution and only if you\n    received the program in object code or executable form with such\n    an offer, in accord with Subsection b above.)\n\nThe source code for a work means the preferred form of the work for\nmaking modifications to it.  For an executable work, complete source\ncode means all the source code for all modules it contains, plus any\nassociated interface definition files, plus the scripts used to\ncontrol compilation and installation of the executable.  However, as a\nspecial exception, the source code distributed need not include\nanything that is normally distributed (in either source or binary\nform) with the major components (compiler, kernel, and so on) of the\noperating system on which the executable runs, unless that component\nitself accompanies the executable.\n\nIf distribution of executable or object code is made by offering\naccess to copy from a designated place, then offering equivalent\naccess to copy the source code from the same place counts as\ndistribution of the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n\f\n  4. You may not copy, modify, sublicense, or distribute the Program\nexcept as expressly provided under this License.  Any attempt\notherwise to copy, modify, sublicense or distribute the Program is\nvoid, and will automatically terminate your rights under this License.\nHowever, parties who have received copies, or rights, from you under\nthis License will not have their licenses terminated so long as such\nparties remain in full compliance.\n\n  5. You are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Program or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Program (or any work based on the\nProgram), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Program or works based on it.\n\n  6. Each time you redistribute the Program (or any work based on the\nProgram), the recipient automatically receives a license from the\noriginal licensor to copy, distribute or modify the Program subject to\nthese terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties to\nthis License.\n\n  7. If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Program at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Program by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Program.\n\nIf any portion of this section is held invalid or unenforceable under\nany particular circumstance, the balance of the section is intended to\napply and the section as a whole is intended to apply in other\ncircumstances.\n\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system, which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n\f\n  8. If the distribution and/or use of the Program is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Program under this License\nmay add an explicit geographical distribution limitation excluding\nthose countries, so that distribution is permitted only in or among\ncountries not thus excluded.  In such case, this License incorporates\nthe limitation as if written in the body of this License.\n\n  9. The Free Software Foundation may publish revised and/or new versions\nof the General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\nEach version is given a distinguishing version number.  If the Program\nspecifies a version number of this License which applies to it and \"any\nlater version\", you have the option of following the terms and conditions\neither of that version or of any later version published by the Free\nSoftware Foundation.  If the Program does not specify a version number of\nthis License, you may choose any version ever published by the Free Software\nFoundation.\n\n  10. If you wish to incorporate parts of the Program into other free\nprograms whose distribution conditions are different, write to the author\nto ask for permission.  For software which is copyrighted by the Free\nSoftware Foundation, write to the Free Software Foundation; we sometimes\nmake exceptions for this.  Our decision will be guided by the two goals\nof preserving the free status of all derivatives of our free software and\nof promoting the sharing and reuse of software generally.\n\n\t\t\t    NO WARRANTY\n\n  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\nFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN\nOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\nPROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\nOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS\nTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE\nPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\nREPAIR OR CORRECTION.\n\n  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\nREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\nINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\nOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\nTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\nYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\nPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGES.\n\n\t\t     END OF TERMS AND CONDITIONS\n\f\n\t    How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nconvey the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software; you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation; either version 2 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program; if not, write to the Free Software\n    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n\n\nAlso add information on how to contact you by electronic and paper mail.\n\nIf the program is interactive, make it output a short notice like this\nwhen it starts in an interactive mode:\n\n    Gnomovision version 69, Copyright (C) year name of author\n    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, the commands you use may\nbe called something other than `show w' and `show c'; they could even be\nmouse-clicks or menu items--whatever suits your program.\n\nYou should also get your employer (if you work as a programmer) or your\nschool, if any, to sign a \"copyright disclaimer\" for the program, if\nnecessary.  Here is a sample; alter the names:\n\n  Yoyodyne, Inc., hereby disclaims all copyright interest in the program\n  `Gnomovision' (which makes passes at compilers) written by James Hacker.\n\n  <signature of Ty Coon>, 1 April 1989\n  Ty Coon, President of Vice\n\nThis General Public License does not permit incorporating your program into\nproprietary programs.  If your program is a subroutine library, you may\nconsider it more useful to permit linking proprietary applications with the\nlibrary.  If this is what you want to do, use the GNU Library General\nPublic License instead of this License.\n"
  },
  {
    "path": "ffmpeg/licenses/zlib.txt",
    "content": "/* zlib.h -- interface of the 'zlib' general purpose compression library\n  version 1.2.7, May 2nd, 2012\n\n  Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler\n\n  This software is provided 'as-is', without any express or implied\n  warranty.  In no event will the authors be held liable for any damages\n  arising from the use of this software.\n\n  Permission is granted to anyone to use this software for any purpose,\n  including commercial applications, and to alter it and redistribute it\n  freely, subject to the following restrictions:\n\n  1. The origin of this software must not be misrepresented; you must not\n     claim that you wrote the original software. If you use this software\n     in a product, an acknowledgment in the product documentation would be\n     appreciated but is not required.\n  2. Altered source versions must be plainly marked as such, and must not be\n     misrepresented as being the original software.\n  3. This notice may not be removed or altered from any source distribution.\n\n  Jean-loup Gailly        Mark Adler\n  jloup@gzip.org          madler@alumni.caltech.edu\n\n*/\n\n"
  },
  {
    "path": "huey/src/com/huey/Main.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey;\n\nimport com.huey.assets.Asset;\nimport com.huey.assets.AssetManager;\nimport com.huey.assets.AssetSource;\nimport com.huey.assets.AssetTests;\nimport com.huey.binding.BindingTests;\nimport com.huey.core.Application;\nimport com.huey.core.ApplicationTests;\nimport com.huey.ui.Image;\nimport com.huey.ui.Label;\nimport com.huey.utils.AssertTests;\nimport com.huey.events.EventTests;\nimport com.huey.tests.TestRunner;\nimport com.huey.tests.TestSuite;\nimport com.huey.ui.UITests;\nimport com.huey.macros.MacroTests;\nimport com.huey.utils.WeakRefTest;\nimport flash.display.StageAlign;\nimport flash.display.StageScaleMode;\nimport flash.Lib;\n\nclass Main\n{\n\t\n\tstatic function main()\n\t{\n\t\tvar stage = Lib.current.stage;\n\t\tstage.scaleMode = StageScaleMode.NO_SCALE;\n\t\tstage.align = StageAlign.TOP_LEFT;\n\t\t// entry point\n\t\tvar test : TestSuite = new TestSuite();\n\t\ttest.add(new AssertTests());\n\t\ttest.add(new EventTests());\n\t\ttest.add(new WeakRefTest());\n\t\ttest.add(new MacroTests());\n\t\ttest.add(new BindingTests());\n\t\ttest.add(new UITests());\n\t\ttest.add(new ApplicationTests());\n\t\ttest.add(new AssetTests());\n\t\t\n\t\tvar testRunner : TestRunner = new TestRunner();\n\t\ttestRunner.run(test);\n\t\t\n\t\t//_app = new TestApplication();\n\t}\n\tprivate static var _app : Application;\n}\n\nclass TestApplication extends Application {\n\tpublic function new() {\n\t\tsuper();\n\t\t\n\t\tassetManager.registerAsset( new Asset(\"shadow\", External(\"h:/Swivel/assets/SHADOW.PNG\")) );\n\t\tassetManager.onAssetsLoaded.add(onAssetsLoaded);\n\t\tassetManager.preloadAssets();\n\t}\n\t\n\tpublic function onAssetsLoaded(e) : Void {\n\t\tvar label : Label = uiFactory.createLabel();\n\t\tlabel.text = \"Foo\";\n\t\tui.add(label);\n\t\tlabel.x = 100;\n\t\tlabel.onClick.add(function(e) { trace(\"FOO\"); } );\n\t\t\n\t\tvar image : Image = uiFactory.createImage();\n\t\timage.source = assetManager.getAsset(\"shadow\");\n\t\tui.add(image);\n\t}\n}"
  },
  {
    "path": "huey/src/com/huey/assets/Asset.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.assets;\nimport com.huey.events.Dispatcher;\nimport com.huey.events.Dispatcher;\nimport flash.display.Bitmap;\nimport flash.display.BitmapData;\nimport flash.display.Loader;\nimport flash.events.Event;\nimport flash.events.IOErrorEvent;\nimport flash.net.URLRequest;\n\nclass Asset\n{\n\tpublic var name(default, null) : String;\n\tpublic var source(default, null) : AssetSource;\n\t\n\tpublic var data(default, null) : Dynamic;\n\t\n\tpublic var onLoaded(default, null) : Dispatcher<Dynamic>;\n\t\n\tprivate var _loader : Loader;\n\t\n\tpublic function new(name : String, source : AssetSource) {\n\t\tthis.name = name;\n\t\tthis.source = source;\n\t\t\n\t\tonLoaded = new Dispatcher();\n\t}\n\t\n\tpublic function load() : Void {\n\t\t_loader = new Loader();\n\t\t_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);\n\t\t_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);\n\t\tswitch(source) {\n\t\t\tcase Internal(id):\n\t\t\t\t_loader.loadBytes(haxe.Resource.getBytes(id).getData());\n\t\t\t\t\n\t\t\tcase External(url):\n\t\t\t\t_loader.load(new URLRequest(url));\n\t\t}\n\t}\n\t\n\tprivate function onLoadComplete(event : Event): Void {\n\t\tdata = cast(_loader.content, Bitmap).bitmapData;\n\t\t_loader = null;\n\t\t\n\t\tonLoaded.dispatch();\n\t}\n\t\n\tprivate function ioErrorHandler(_) {\n\t\t\n\t}\n\t\n}"
  },
  {
    "path": "huey/src/com/huey/assets/AssetManager.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.assets;\nimport com.huey.events.Dispatcher;\nimport haxe.ds.StringMap;\n\nclass AssetManager\n{\n\tprivate static var _instance : AssetManager;\n\t\n\tpublic static var instance(get, null) : AssetManager;\n\t\n\tinline private static function get_instance() : AssetManager {\n\t\tif (_instance == null) _instance = new AssetManager();\n\t\treturn _instance;\n\t}\n\t\n\tpublic var onAssetsLoaded : Dispatcher<Dynamic>;\n\t\n\tprivate var _assets : StringMap<Asset>;\n\tprivate var _loaderIterator : Iterator<Asset>;\n\t\n\tpublic function new() {\n\t\t_assets = new StringMap();\n\t\tonAssetsLoaded = new Dispatcher();\n\t}\n\t\n\tpublic function preloadAssets() : Void {\n\t\t_loaderIterator = _assets.iterator();\n\t\tloadNextAsset();\n\t}\n\t\n\tpublic function registerAsset(asset : Asset) : Void {\n\t\t_assets.set(asset.name, asset);\n\t}\n\t\n\tpublic function getAsset(name : String) : Asset {\n\t\treturn _assets.get(name);\n\t}\n\n\tprivate function loadNextAsset() : Void {\n\t\tif (_loaderIterator.hasNext()) {\n\t\t\tvar asset = _loaderIterator.next();\n\t\t\tasset.onLoaded.add( onAssetLoaded );\n\t\t\tasset.load();\n\t\t} else {\n\t\t\t_loaderIterator = null;\n\t\t\tonAssetsLoaded.dispatch();\n\t\t}\n\t}\n\t\n\tprivate function onAssetLoaded(e) : Void {\n\t\tloadNextAsset();\n\t}\n}"
  },
  {
    "path": "huey/src/com/huey/assets/AssetSource.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.assets;\n\nenum AssetSource\n{\n\tInternal(id : String);\n\tExternal(url : String);\n}"
  },
  {
    "path": "huey/src/com/huey/binding/BindableArray.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.binding;\n\nclass BindableArray<T> extends Binding.Bindable {\n\tprivate var _array : Array<T>;\n\n\tpublic static function fromArray<T>(a : Array<T>) : BindableArray<T> {\n\t\tvar ba = new BindableArray();\n\t\tba._array = a;\n\t\tba.dispatchBindings();\n\t\treturn ba;\n\t}\n\n\tpublic function new() {\n\t\tsuper();\n\t\t_array = [];\n\t\tdispatchBinding(\"length\");\n\t\tdispatchBinding(\"_array\");\n\t}\n\n\tpublic var length(get_length, null) : Int;\n\tprivate function get_length() : Int\t\t\t\t\t\t{ return _array.length; }\n\n\tpublic var array(get_array, never) : Array<T>;\n\tpublic function get_array() : Array<T>\t\t\t\t\t{ return _array; }\n\tpublic function concat(a : Array<T>) : Array<T>\t\t\t{ return _array.concat(a); }\n\tpublic function copy() : Array<T>\t\t\t\t\t\t{ return _array.copy(); }\n\tpublic function insert(pos : Int, x : T) : Void\t\t\t{ _array.insert(pos, x); dispatchBindings(); }\n\tpublic function iterator() : Iterator<T>\t\t\t\t{ return _array.iterator(); }\n\tpublic function join(sep : String) : String\t\t\t\t{ return _array.join(sep); }\n\tpublic function pop() : Null<T>\t\t\t\t\t\t\t{ var ret = _array.pop(); dispatchBindings(); return ret; }\n\tpublic function push(x : T) : Int\t\t\t\t\t\t{\n\t\tvar ret = _array.push(x); dispatchBindings(); return ret;\n\t\t}\n\tpublic function remove(x : T) : Bool\t\t\t\t\t{ var ret = _array.remove(x); dispatchBindings(); return ret; }\n\tpublic function reverse() : Void\t\t\t\t\t\t{ _array.reverse(); dispatchBindings(); }\n\tpublic function shift() : Null<T>\t\t\t\t\t\t{ var ret = _array.shift(); dispatchBindings(); return ret; }\n\tpublic function sort(f : T->T->Int) : Void\t\t\t\t{ _array.sort(f); dispatchBindings(); }\n\tpublic function splice(pos : Int, len : Int) : Array<T>\t{ var ret = _array.splice(pos, len); dispatchBindings(); return ret; }\n\tpublic function toString() : String\t\t\t\t\t\t{ return _array.toString(); }\n\tpublic function unshift(x : T) : Void\t\t\t\t\t{ _array.unshift(x); dispatchBindings(); }\n\n\tprivate function dispatchBindings() : Void {\n\t\tdispatchBinding(\"length\");\n\t\tdispatchBinding(\"_array\");\n\t}\n}"
  },
  {
    "path": "huey/src/com/huey/binding/Binding.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.binding;\nimport com.huey.events.Dispatcher;\nimport com.huey.macros.ClassBuilder;\nimport com.huey.macros.FieldInfo;\nimport com.huey.macros.MacroTools;\nimport haxe.ds.StringMap;\nimport haxe.macro.Context;\nimport haxe.macro.Expr;\nusing Lambda;\n\ntypedef BindingInstance = Void -> Void;\n\ntypedef BindingsList = List<BindingInstance>;\n\n// RUN-TIME BINDING MANAGEMENT\n@:autoBuild(com.huey.binding.Binding.bindable())\nclass Bindable\n{\n\tprivate var __bindings : StringMap<BindingsList>;\n\tprivate var __distpatching : Bool;\n\t\n\tpublic function new() {\n\t\t__bindings = new StringMap();\n\t\t__distpatching = false;\n\t}\n\t\n\t\t\n\tpublic function addBinding(field : String, binding : BindingInstance) : Void {\n\t\tvar bindingsList = __bindings.get(field);\n\t\tif (bindingsList == null) {\n\t\t\tbindingsList = new List<BindingInstance>();\n\t\t\t__bindings.set(field, bindingsList);\n\t\t}\n\t\tbindingsList.add(binding);\n\t}\n\t\n\tpublic function removeBinding(field : String, binding : BindingInstance) : Void {\n\t\tvar bindingsList = __bindings.get(field);\n\t\tif (bindingsList != null)\n\t\t\tbindingsList.remove(binding);\n\t}\n\n\tpublic function removeBindings(field : String) : Void {\n\t\t__bindings.set(field, null);\n\t}\n\t\t\n\tprivate function dispatchBinding(field : String) : Void {\n\t\tif (__distpatching) return;\n\t\t\n\t\t__distpatching = true;\n\t\t\n\t\tvar bindingsList : List<BindingInstance> = __bindings.get(field);\n\t\t//var isFieldBindable : Bool = Std.is(value, Bindable);\n\t\tif(bindingsList != null) {\n\t\t\tfor (binding in bindingsList)\n\t\t\t{\n\t\t\t\ttry { binding(); } catch(e:Dynamic) { }\n\t\t\t}\n\t\t}\n\t\t\n\t\t__distpatching = false;\n\t}\n}\n\n/**\n * Binding provides utilities for data binding.\n * @author Newgrounds.com, Inc.\n */\nclass Binding {\n\t#if macro\n\t\n\tprivate static var _cl : ClassBuilder;\n\t\n\tmacro public static function bindable() : Array<Field> {\n\t\t_cl = ClassBuilder.createFromContext();\n\n\t\tfor(field in _cl.getFieldsWithMeta(\"bindable\"))\n\t\t\tmakeFieldBindable(field);\n\n\t\treturn _cl.fields();\n\t}\n\t\t\n\t/** Adds binding dispatches to fields, so that the field can be bound to. */\n\tprivate static function makeFieldBindable(field : FieldInfo) : Void {\n\t\tvar pos = Context.currentPos();\n\t\t\n\t\t// add event dispatcher\n\t\tvar setterField : FieldInfo;\n\t\tvar fieldNameString = {expr:EConst(CString(field.name)), pos: Context.currentPos()};\n\t\tvar fieldNameIdent = {expr:EConst(CIdent(field.name)), pos: Context.currentPos()};\n\n\t\tswitch(field.kind) {\n\t\t\tcase FVar(t, e):\n\t\t\t\tsetterField = new FieldInfo(\"set_\" + field.name);\n\t\t\t\tsetterField.access = [APrivate];\n\t\t\t\tsetterField.kind = FFun({\n\t\t\t\t\tret:\tt,\n\t\t\t\t\tparams:\t[],\n\t\t\t\t\texpr:\tmacro { $fieldNameIdent = v; dispatchBinding($fieldNameString); return v; },\n\t\t\t\t\targs:\t[{name: \"v\", value: null, type: t, opt: false}]\n\t\t\t\t});\n\t\t\t\t_cl.addField(setterField);\n\t\t\t\tfield.kind = FProp(\"default\", setterField.name, t, e);\n\n\t\t\tcase FProp(get, set, t, e):\n\t\t\t\tif(set == \"default\") {\n\t\t\t\t\tsetterField = new FieldInfo(\"set_\" + field.name);\n\t\t\t\t\tsetterField.access = [APrivate];\n\t\t\t\t\tsetterField.kind = FFun({\n\t\t\t\t\t\tret:\tt,\n\t\t\t\t\t\tparams:\t[],\n\t\t\t\t\t\texpr:\tmacro { $fieldNameIdent = v; dispatchBinding($fieldNameString); return v; },\n\t\t\t\t\t\targs:\t[{name: \"v\", value: null, type: t, opt: false}]\n\t\t\t\t\t});\n\t\t\t\t\t_cl.addField(setterField);\n\t\t\t\t\tfield.kind = FProp(get, setterField.name, t, e);\n\t\t\t\t} else {\n\t\t\t\t\tfunction injectNotify(e : ExprDef) : ExprDef {\n\t\t\t\t\t\tvar retExpr : Expr;\n\t\t\t\t\t\treturn switch(e) {\n\t\t\t\t\t\t\tcase EReturn(e):\n\t\t\t\t\t\t\t\t(macro {\n\t\t\t\t\t\t\t\t\tvar ret = $e;\n\t\t\t\t\t\t\t\t\tdispatchBinding($fieldNameString);\n\t\t\t\t\t\t\t\t\treturn ret;\n\t\t\t\t\t\t\t\t}).expr;\n\t\t\t\t\t\t\tdefault:\treturn null;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tvar setter = _cl.getField('set_${field.name}'); // MIKNEW\n\t\t\t\t\tswitch(setter.kind) {\n\t\t\t\t\t\tcase FFun(f):\n\t\t\t\t\t\t\tcom.huey.macros.MacroTools.mapExpr(f.expr, injectNotify);\n\t\t\t\t\t\tdefault: Context.error(\"Unexpected error\", pos);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tContext.error('${field.kind} can not be bindable', pos);\n\t\t}\n\t}\n\t\n\tprivate static function isBindable(obj : Expr) : Bool {\n\t\tswitch(Context.typeof(obj)) {\n\t\t\tcase TInst(t, params):\n\t\t\t\tvar cl = t.get();\n\t\t\t\twhile (cl.superClass != null) {\n\t\t\t\t\tcl = cl.superClass.t.get();\n\t\t\t\t\tif (cl.name == \"Bindable\") return true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\tdefault:\treturn false;\n\t\t}\n\t}\n\t\n\tprivate static function isBindableArray(obj : Expr) : Bool {\n\t\tswitch(Context.typeof(obj)) {\n\t\t\tcase TInst(t, params):\n\t\t\t\tvar cl = t.get();\n\t\t\t\treturn cl.name == \"BindableArray\";\n\t\t\tdefault:\t\treturn false;\n\t\t}\n\t\t\n\t}\n\t#end\n\t\t\n\t/** COMPILE-TIME BINDING GENERATION */\n\t#if !macro macro #end\n\tpublic static function bind<T>(dst : ExprOf<T>, src : ExprOf<T>) : ExprOf<Void> {\n\t\t// determine binding dependencies\n\t\tvar dependencies = [];\n\t\tvar localVars = [];\n\t\tfunction traverseExpr(e : ExprDef) : ExprDef {\n\t\t\tswitch(e) {\n\t\t\t\tcase EConst(c):\n\t\t\t\t\tswitch(c) {\n\t\t\t\t\t\tcase CIdent(s):\n\t\t\t\t\t\t\tif(Lambda.indexOf(localVars, s) == -1)\n\t\t\t\t\t\t\t\tif (isBindable( { expr: EConst(CIdent(\"this\")), pos: Context.currentPos() } )) {\n\t\t\t\t\t\t\t\t\tdependencies.push( { obj: null, field: s } );\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\tcase EField(obj, field):\n\t\t\t\t\tif (isBindable( obj )) {\n\t\t\t\t\t\tdependencies.push( { obj: obj, field: field } );\n\t\t\t\t\t}\n\t\t\t\t\tvar expr = { expr:e, pos: Context.currentPos() };\n\t\t\t\t\tif (isBindableArray(expr))\n\t\t\t\t\t\tdependencies.push( { obj: expr, field: \"_array\" } );\n\t\t\t\t\n\t\t\t\tcase EVars(vars):\n\t\t\t\t\tfor(v in vars)\n\t\t\t\t\t\tlocalVars.push(v.name);\n\t\t\t\t\t\n\t\t\t\tdefault:\n\t\t\t}\n\t\t\t\n\t\t\treturn null;\n\t\t}\n\t\t\n\t\tMacroTools.mapExpr(src, traverseExpr);\n\t\t/*\n\t\t// var oldObj = $obj;\n\t\t// function handler() {\n\t\t//\t\t// for each dependent\n\t\t//\t\tif($obj != oldObj) {\n\t\t//\t\t\toldObj.removeBinding($field, handler);\n\t\t//\t\t\t$obj.addBinding($field, handler);\n\t\t//\t\t\toldObj = $obj;\n\t\t//\t\t}\n\t\t//\t\t$dst = $src;\n\t\t//\t}\n\t\t*/\n\n\t\tvar i : Int = 0;\n\t\tvar vars = [];\n\t\tvar ifExprs : Array<Expr> = [];\n\t\tvar initExprs : Array<Expr> = [];\n\t\tfor(dep in dependencies) {\n\t\t\tvar obj;\n\t\t\tvar isThis;\n\t\t\tif (dep.obj != null) {\n\t\t\t\tobj = dep.obj;\n\t\t\t\tisThis = false;\n\t\t\t} else {\n\t\t\t\tobj = { expr: EConst(CIdent(\"this\")), pos: Context.currentPos() };\n\t\t\t\tisThis = true;\n\t\t\t}\n\t\t\tvar field = { expr: EConst(CString(dep.field)), pos: Context.currentPos() };\n\t\t\tvar oldObj = { expr: EConst(CIdent(\"old\" + i)), pos: Context.currentPos() };\n\t\t\tvar initBinding = macro if($obj != null) $obj.addBinding($field, handler);\n\t\t\tif(!isThis) {\n\t\t\t\tvars.push( {name: \"old\" + i, type: null, expr: obj} );\n\t\t\t\tifExprs.push(\n\t\t\t\t\tmacro if($oldObj != $obj) {\n\t\t\t\t\t\tif($oldObj != null) $oldObj.removeBinding($field, handler);\n\t\t\t\t\t\t$initBinding;\n\t\t\t\t\t\t$oldObj = $obj;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t\tinitExprs.push( macro $initBinding );\n\t\t\ti++;\n\t\t}\n\n\t\tvar varsExpr = {expr: EVars(vars), pos: Context.currentPos()};\n\t\tvar ifExpr = {expr: EBlock(ifExprs), pos: Context.currentPos()};\n\t\tvar initExpr = {expr: EBlock(initExprs), pos: Context.currentPos()};\n\t\tvar bindingExpr = macro { try { $dst = $src; } catch (e:Dynamic) { } };\n\n\t\treturn macro {\n\t\t\t$varsExpr;\n\t\t\tfunction handler() {\n\t\t\t\t$ifExpr;\n\t\t\t\t$bindingExpr;\n\t\t\t}\n\t\t\t$initExpr;\n\t\t\thandler();\n\t\t};\n\t}\n\n\tmacro public static function bindTwoWay<T>(dst : ExprOf<T>, src : ExprOf<T>) : ExprOf<Void> {\n\t\treturn { expr: EBlock([Binding.bind(dst, src), Binding.bind(src, dst)]), pos: Context.currentPos() };\n\t}\n\n}"
  },
  {
    "path": "huey/src/com/huey/core/Application.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.core;\nimport com.huey.assets.*;\nimport com.huey.ui.*;\nimport com.huey.utils.Assert;\nimport com.huey.binding.Binding;\nimport com.huey.utils.Thread;\n\n@:autoBuild(com.huey.core.ApplicationMacros.buildApplication())\nclass Application extends Binding.Bindable\n{\n\tprivate var _thread : Thread;\n\n\tpublic var ui(default, null) : StateContainer;\n\t\n\tpublic var assetManager(default, null) : AssetManager;\n\t\n\tprivate var _appXml : haxe.xml.Fast;\n\n\tprivate function new() {\n\t\tsuper();\n\t\t\t\n\t\tflash.Lib.current.loaderInfo.uncaughtErrorEvents.addEventListener(flash.events.UncaughtErrorEvent.UNCAUGHT_ERROR, uncaughtErrorHandler);\n\t\t#if !debug\n\t\thaxe.Log.trace = function(_, ?_){}\n\t\t#end\n\t\t\n\t\tassetManager = AssetManager.instance;\n\n\t\tui = new StateContainer();\n\t\t\n\t\t#if flash9\n\t\t// TODO\n\t\tuntyped { flash.Lib.current.addChild(ui._implComponent); }\n\t\t#end\n\n\t\t// XML resource name gets set by macro\n\t\t// TODO: pass thru constructor?\n\t\tvar applicationData = haxe.Resource.getString(\"applicationData\");\n\t\tif(applicationData != null) {\n\t\t\t_appXml = new haxe.xml.Fast( Xml.parse(applicationData).firstElement() );\n\t\t}\n\n\t\tregisterAssets();\n\t\t\n\t\tassetManager.onAssetsLoaded.add(assetsLoadedHandler);\n\t\tassetManager.preloadAssets();\n\t}\n\t\n\tprivate function registerAssets() : Void {\n\t\t\n\t}\n\n\tprivate function assetsLoadedHandler(e) : Void {\n\t\tfor(uiData in _appXml.node.ui.elements) {\n\t\t\tvar component = readComponent(uiData);\n\t\t\tif (component != null) ui.add( component );\n\t\t\telse {\n\t\t\t\tif (uiData.name == \"state\") {\n\t\t\t\t\tvar stateComps = readUIList(uiData);\n\t\t\t\t\tfor(comp in stateComps)\n\t\t\t\t\t\tui.addToState(comp, uiData.att.name);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t#if air\n\t\tvar win = flash.desktop.NativeApplication.nativeApplication.openedWindows[0];\n\t\tif(win != null) {\n\t\t\twin.x = (win.stage.fullScreenWidth - win.width) / 2;\n\t\t\twin.y = (win.stage.fullScreenHeight - win.height) / 2;\n\t\t\t\n\t\t\twin.addEventListener(flash.events.Event.CLOSE, function(_) exit());\n\t\t}\n\t\t#end\n\t\t\n\t\tinit();\n\t}\n\t\n\tprivate function readUIList(data : haxe.xml.Fast) : Array<Component> {\n\t\tvar comps : Array<Component> = [];\n\t\tfor(uiData in data.elements) {\n\t\t\tvar component = readComponent(uiData);\n\t\t\tif(component != null) comps.push( component );\n\t\t}\n\t\treturn comps;\n\t}\n\t\n\tprivate function readStateContainer(data : haxe.xml.Fast) : Component {\n\t\tvar container = new StateContainer();\n\t\t\n\t\tfor(uiData in data.elements) {\n\t\t\tvar component = readComponent(uiData);\n\t\t\tif (component != null) container.add( component );\n\t\t\telse {\n\t\t\t\tif (uiData.name == \"state\") {\n\t\t\t\t\tvar stateComps = readUIList(uiData);\n\t\t\t\t\tfor(comp in stateComps)\n\t\t\t\t\t\tcontainer.addToState(comp, uiData.att.name);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn container;\n\t}\n\t\n\tprivate function readComponent(uiData : haxe.xml.Fast) : Component {\n\t\tif(uiData == null) return null;\n\t\tvar comp : Component;\n\t\t\n\t\tswitch(uiData.name) {\n\t\t\tcase \"radioGroup\":\n\t\t\t\tvar radioGroup = new RadioGroup();\n\t\t\t\tReflect.setProperty(this, uiData.att.name, radioGroup);\n\t\t\t\treturn null;\n\t\t\t\t\n\t\t\tcase \"container\":\n\t\t\t\tcomp = readStateContainer(uiData);\n\t\t\t\t\n\t\t\tcase \"image\":\n\t\t\t\tvar source = if(uiData.has.source) assetManager.getAsset(uiData.att.source) else null;\n\t\t\t\tvar image = new Image(source);\n\t\t\t\tcomp = image;\n\t\t\t\t\n\t\t\tcase \"scaledImage\":\n\t\t\t\tvar source = if(uiData.has.source) assetManager.getAsset(uiData.att.source) else null;\n\t\t\t\tvar image = new ScaledImage(source);\n\t\t\t\tcomp = image;\n\n\t\t\tcase \"label\":\n\t\t\t\tvar label = new Label();\n\t\t\t\tif(uiData.has.text) label.text = StringTools.replace(uiData.att.text, \"\\\\n\", \"\\n\");\n\t\t\t\tif(uiData.has.wordWrap) label.wordWrap = uiData.att.wordWrap != \"false\";\n\t\t\t\tlabel.font = uiData.att.font;\n\t\t\t\tif(uiData.has.size) label.size  = Std.parseFloat(uiData.att.size);\n\t\t\t\tif(uiData.has.editable) label.editable = uiData.att.editable != \"false\";\n\t\t\t\tlabel.bold = uiData.has.bold && uiData.att.bold == \"true\";\n\t\t\t\tlabel.color = Std.parseInt(uiData.att.color);\n\t\t\t\tif(uiData.has.width) label.autoSize = false;\n\t\t\t\tif(uiData.has.letterSpacing) label.letterSpacing = Std.parseFloat(uiData.att.letterSpacing);\n\t\t\t\tif(uiData.has.align) label.align = switch(uiData.att.align) {\n\t\t\t\t\tcase \"left\":\tleft;\n\t\t\t\t\tcase \"right\":\tright;\n\t\t\t\t\tcase \"center\":\tcenter;\n\t\t\t\t\tcase \"justify\":\tjustify;\n\t\t\t\t\tdefault:\t\tleft;\n\t\t\t\t}\n\t\t\t\tcomp = label;\n\n\n\t\t\tcase \"button\":\n\t\t\t\tvar button = new Button();\n\t\t\t\tbutton.upState = if(uiData.hasNode.upState) readComponent(uiData.node.upState.elements.next()) else null;\n\t\t\t\tbutton.downState = if(uiData.hasNode.downState) readComponent(uiData.node.downState.elements.next()) else null;\n\t\t\t\tbutton.overState = if(uiData.hasNode.overState) readComponent(uiData.node.overState.elements.next()) else null;\n\t\t\t\tif(uiData.has.onClick) button.onClick.add(Reflect.field(this, uiData.att.onClick));\n\t\t\t\tif(uiData.has.onMouseDown) button.onMouseDown.add(Reflect.field(this, uiData.att.onMouseDown));\n\t\t\t\tcomp = button;\n\t\t\t\t\n\t\t\tcase \"checkBox\":\n\t\t\t\tvar checkBox = new CheckBox();\n\t\t\t\tcheckBox.upState = if(uiData.hasNode.upState) readComponent(uiData.node.upState.elements.next()) else null;\n\t\t\t\tcheckBox.downState = if(uiData.hasNode.downState) readComponent(uiData.node.downState.elements.next()) else null;\n\t\t\t\tcheckBox.overState = if (uiData.hasNode.overState) readComponent(uiData.node.overState.elements.next()) else null;\n\t\t\t\tcheckBox.selectedUpState = if(uiData.hasNode.selectedUpState) readComponent(uiData.node.selectedUpState.elements.next()) else null;\n\t\t\t\tcheckBox.selectedDownState = if(uiData.hasNode.selectedDownState) readComponent(uiData.node.selectedDownState.elements.next()) else null;\n\t\t\t\tcheckBox.selectedOverState = if(uiData.hasNode.selectedOverState) readComponent(uiData.node.selectedOverState.elements.next()) else null;\n\t\t\t\tif(uiData.has.onClick) checkBox.onClick.add(Reflect.field(this, uiData.att.onClick));\n\t\t\t\tif(uiData.has.onMouseDown) checkBox.onMouseDown.add(Reflect.field(this, uiData.att.onMouseDown));\n\t\t\t\tif(uiData.has.selected) checkBox.selected = uiData.att.selected != \"false\";\n\t\t\t\tcomp = checkBox;\n\n\t\t\tcase \"radioButton\":\n\t\t\t\tvar radioButton = new RadioButton();\n\t\t\t\tradioButton.upState = if(uiData.hasNode.upState) readComponent(uiData.node.upState.elements.next()) else null;\n\t\t\t\tradioButton.downState = if(uiData.hasNode.downState) readComponent(uiData.node.downState.elements.next()) else null;\n\t\t\t\tradioButton.overState = if (uiData.hasNode.overState) readComponent(uiData.node.overState.elements.next()) else null;\n\t\t\t\tradioButton.selectedUpState = if(uiData.hasNode.selectedUpState) readComponent(uiData.node.selectedUpState.elements.next()) else null;\n\t\t\t\tradioButton.selectedDownState = if(uiData.hasNode.selectedDownState) readComponent(uiData.node.selectedDownState.elements.next()) else null;\n\t\t\t\tradioButton.selectedOverState = if(uiData.hasNode.selectedOverState) readComponent(uiData.node.selectedOverState.elements.next()) else null;\n\t\t\t\tif(uiData.has.onClick) radioButton.onClick.add(Reflect.field(this, uiData.att.onClick));\n\t\t\t\tif(uiData.has.onMouseDown) radioButton.onMouseDown.add(Reflect.field(this, uiData.att.onMouseDown));\n\t\t\t\tif(uiData.has.selected) radioButton.selected = uiData.att.selected != \"false\";\n\t\t\t\tif(uiData.has.group) {\n\t\t\t\t\tradioButton.group = Reflect.getProperty(this, uiData.att.group);\n\t\t\t\t\tradioButton.group.items.push(radioButton);\n\t\t\t\t\tif(radioButton.selected) radioButton.group.selectedItem = radioButton;\n\t\t\t\t}\n\t\t\t\tcomp = radioButton;\n\n\t\t\tcase \"listBox\":\n\t\t\t\tvar listBox = new ListBox();\n\t\t\t\tcomp = listBox;\n\t\t\t\t\n\t\t\tcase \"selectBox\":\n\t\t\t\tvar selectBox = new SelectBox();\n\t\t\t\tcomp = selectBox;\n\n\t\t\tcase \"textBox\":\n\t\t\t\tvar textBox = new TextBox();\n\t\t\t\tvar comps = readUIList(uiData);\n\t\t\t\tfor (comp in comps) textBox.add(comp);\n\t\t\t\tif (uiData.has.textX) textBox.textX = Std.parseFloat(uiData.att.textX);\n\t\t\t\tif (uiData.has.textY) textBox.textY = Std.parseFloat(uiData.att.textY);\n\t\t\t\ttextBox.font = uiData.att.font;\n\t\t\t\ttextBox.size = Std.parseFloat(uiData.att.size);\n\t\t\t\ttextBox.color = Std.parseInt(uiData.att.color);\n\t\t\t\tcomp = textBox;\n\n\t\t\tcase \"slider\":\n\t\t\t\tvar slider = new Slider();\n\t\t\t\tvar comps = readUIList(uiData);\n\t\t\t\tfor (comp in comps) slider.add(comp);\n\t\t\t\tif (uiData.hasNode.nub) {\n\t\t\t\t\tslider.nub = readComponent(uiData.node.nub.elements.next());\n\t\t\t\t\tslider.add( slider.nub );\n\t\t\t\t}\n\t\t\t\tif (uiData.has.labelX) slider.label.x = Std.parseFloat(uiData.att.labelX);\n\t\t\t\tif (uiData.has.labelY) slider.label.y = Std.parseFloat(uiData.att.labelY);\n\t\t\t\tif (uiData.has.bold) slider.bold = uiData.att.bold != \"false\";\n\t\t\t\tif (uiData.has.step) slider.step = Std.parseFloat(uiData.att.step);\n\t\t\t\tif (uiData.has.minimum) slider.minimum = Std.parseFloat(uiData.att.minimum);\n\t\t\t\tif (uiData.has.maximum) slider.maximum = Std.parseFloat(uiData.att.maximum);\n\t\t\t\tif (uiData.has.labelFunc) slider.labelFunc = Reflect.getProperty(this, uiData.att.labelFunc);\n\t\t\t\tif(uiData.has.value) slider.value = Std.parseFloat(uiData.att.value);\n\t\t\t\tif(uiData.has.font) slider.font = uiData.att.font;\n\t\t\t\tif(uiData.has.size) slider.size = Std.parseFloat(uiData.att.size);\n\t\t\t\tif(uiData.has.color) slider.color = Std.parseInt(uiData.att.color);\n\t\t\t\tcomp = slider;\n\t\t\t\t\n\t\t\t\tcase \"progressBar\":\n\t\t\t\tvar slider = new ProgressBar();\n\t\t\t\tvar comps = readUIList(uiData);\n\t\t\t\tfor (comp in comps) slider.add(comp);\n\t\t\t\tif (uiData.hasNode.nub) {\n\t\t\t\t\tslider.nub = readComponent(uiData.node.nub.elements.next());\n\t\t\t\t\tslider.add( slider.nub );\n\t\t\t\t}\n\t\t\t\tif (uiData.has.labelX) slider.label.x = Std.parseFloat(uiData.att.labelX);\n\t\t\t\tif (uiData.has.labelY) slider.label.y = Std.parseFloat(uiData.att.labelY);\n\t\t\t\tif (uiData.has.bold) slider.bold = uiData.att.bold != \"false\";\n\t\t\t\tif (uiData.has.step) slider.step = Std.parseFloat(uiData.att.step);\n\t\t\t\tif (uiData.has.minimum) slider.minimum = Std.parseFloat(uiData.att.minimum);\n\t\t\t\tif (uiData.has.maximum) slider.maximum = Std.parseFloat(uiData.att.maximum);\n\t\t\t\tif (uiData.has.labelFunc) slider.labelFunc = Reflect.getProperty(this, uiData.att.labelFunc);\n\t\t\t\tif(uiData.has.value) slider.value = Std.parseFloat(uiData.att.value);\n\t\t\t\tif(uiData.has.font) slider.font = uiData.att.font;\n\t\t\t\tif(uiData.has.size) slider.size = Std.parseFloat(uiData.att.size);\n\t\t\t\tif(uiData.has.color) slider.color = Std.parseInt(uiData.att.color);\n\t\t\t\tcomp = slider;\n\t\t\t\n\t\t\tcase \"numericStepper\":\n\t\t\t\tvar numericStepper = new NumericStepper();\n\t\t\t\tvar comps = readUIList(uiData);\n\t\t\t\tfor (comp in comps) {\n\t\t\t\t\tnumericStepper.add(comp);\n\t\t\t\t\tif(Std.is(comp,TextBox)) numericStepper._textBox = cast(comp);\n\t\t\t\t}\n\t\t\t\tif(uiData.hasNode.incButton) numericStepper.incButton = cast(readComponent(uiData.node.incButton.elements.next()));\n\t\t\t\tif(uiData.hasNode.decButton) numericStepper.decButton = cast(readComponent(uiData.node.decButton.elements.next()));\n\t\t\t\tif(uiData.has.minimum) numericStepper.minimum = Std.parseFloat(uiData.att.minimum);\n\t\t\t\tif(uiData.has.maximum) numericStepper.maximum = Std.parseFloat(uiData.att.maximum);\n\t\t\t\tif(uiData.has.value) numericStepper.value = Std.parseFloat(uiData.att.value);\n\t\t\t\tif(uiData.has.step) numericStepper.step = Std.parseFloat(uiData.att.step);\n\t\t\t\tcomp = numericStepper;\n\t\t\t\t\n\t\t\tcase \"rectangle\":\n\t\t\t\tvar rectangle = new Rectangle(Std.parseInt(uiData.att.color), Std.parseFloat(uiData.att.width), Std.parseFloat(uiData.att.height));\n\t\t\t\tcomp = rectangle;\n\t\t\t\t\n\t\t\tdefault:\n\t\t\t\treturn null;\n\t\t}\n\t\t\t\t\n\t\tcomp.x = if(uiData.has.x) Std.parseFloat(uiData.att.x) else 0;\n\t\tcomp.y = if (uiData.has.y) Std.parseFloat(uiData.att.y) else 0;\n\t\tif(uiData.has.alpha) comp.alpha = Std.parseFloat(uiData.att.alpha);\n\t\tif(uiData.has.depth) comp.depth = Std.parseFloat(uiData.att.depth);\n\t\tif(uiData.name != \"rectangle\") {\n\t\t\tif(uiData.has.width) comp.width = Std.parseFloat(uiData.att.width);\n\t\t\tif(uiData.has.height) comp.height = Std.parseFloat(uiData.att.height);\n\t\t}\n\t\tif (uiData.has.enabled) comp.enabled = uiData.att.enabled != \"false\";\n\t\tif(uiData.has.visible) comp.visible = uiData.att.visible != \"false\";\n\t\tif(uiData.hasNode.hitArea) {\n\t\t\tvar hitArea = uiData.node.hitArea;\n\t\t\tif(hitArea.hasNode.rectangle) {\n\t\t\t\tcomp.hitArea = Rectangle(\n\t\t\t\t\tStd.parseFloat(hitArea.node.rectangle.att.x),\n\t\t\t\t\tStd.parseFloat(hitArea.node.rectangle.att.y),\n\t\t\t\t\tStd.parseFloat(hitArea.node.rectangle.att.width),\n\t\t\t\t\tStd.parseFloat(hitArea.node.rectangle.att.height)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tif (uiData.has.name) Reflect.setProperty(this, uiData.att.name, comp);\n\t\t\n\t\treturn comp;\n\t}\n\t\n\tprivate function init() : Void {\n\t\t\n\t}\n\n\tpublic function exit() : Void {\n\t\t#if air\n\t\tflash.desktop.NativeApplication.nativeApplication.exit();\n\t\t#end\n\t}\n\n\tpublic function minimize() : Void {\n\t\t#if air\n\t\tflash.desktop.NativeApplication.nativeApplication.activeWindow.minimize();\n\t\t#end\n\t}\n\t\n\tpublic function orderToFront() {\n\t\t#if air\n\t\tvar win = flash.desktop.NativeApplication.nativeApplication.openedWindows[0];\n\t\tif(win != null) win.orderToFront();\n\t\t#end\n\t}\n\t\n\tprivate function uncaughtErrorHandler(_) {\n\t\t\n\t}\n}"
  },
  {
    "path": "huey/src/com/huey/core/ApplicationMacros.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.core;\nimport com.huey.macros.*;\nimport haxe.macro.Type;\nimport haxe.macro.Context;\nimport haxe.macro.Expr;\n\nusing com.huey.macros.MacroTools;\n\nclass ApplicationMacros\n{\n\n\t@:macro public static function buildApplication() : Array<Field> {\n\t\tvar cl : ClassBuilder = ClassBuilder.createFromContext();\n\t\t\n\t\tvar xml;\n\t\tif(cl.getMeta(\":xml\") != null) {\n\t\t\tvar xmlPath : String = cl.getMeta(\":xml\").params[0].extractString();\n\t\t\tif(xmlPath != null) {\n\t\t\t\txml = new haxe.xml.Fast( Xml.parse(sys.io.File.getContent(xmlPath)).firstElement() );\n\t\t\t\tContext.addResource(\"applicationData\", sys.io.File.getBytes(xmlPath));\n\t\t\t}\n\t\t}\n\n\t\tvar appClass = {pack: [], name: cl.name}; // MIKE: Why doesn't fullClassPath work here?\n\t\tvar field = new FieldInfo(\"main\");\n\t\tfield.pos = Context.currentPos();\n\t\tfield.access = [AStatic, APublic];\n\t\tfield.kind = FFun({\n\t\t\tparams:\t[],\n\t\t\tret:\tnull,\n\t\t\targs:\t[],\n\t\t\texpr:\tmacro {\n\t\t\t\t// If this is a worker thread, run its entry point\n\t\t\t\t// TODO: Should this probably be in Thread class?\n\t\t\t\tvar worker = flash.system.Worker.current;\n\t\t\t\tif(!worker.isPrimordial) {\n\t\t\t\t\tvar entryPoint : String = worker.getSharedProperty(\"entryPoint\");\n\t\t\t\t\tvar i = entryPoint.lastIndexOf(\".\");\n\t\t\t\t\tvar className = entryPoint.substr(0, i);\n\t\t\t\t\tvar methodName = entryPoint.substr(i+1);\n\t\t\t\t\tReflect.field(Type.resolveClass(className), methodName)();\n\t\t\t\t\treturn;\n\t\t\t\t} else {\n\t\t\t\t// else run main application\n\t\t\t\t\t_app = new $appClass();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tcl.addField(field);\n\t\t\n\t\tvar time = Date.now().getTime();\n\t\tfield = new FieldInfo(\"BUILD_TIME\");\n\t\tfield.pos = Context.currentPos();\n\t\tfield.access = [AStatic, APublic];\n\t\tfield.kind = FVar(null, macro Date.fromTime($v{time}));\n\t\tcl.addField(field);\n\t\t\n\t\tif(cl.getMeta(\":version\") != null) {\n\t\t\tfield = new FieldInfo(\"VERSION\");\n\t\t\tfield.pos = Context.currentPos();\n\t\t\tfield.access = [AStatic, APublic, AInline];\n\t\t\tvar version : String = cl.getMeta(\":version\").params[0].extractString();\n\t\t\tfield.kind = FVar(null, {expr: EConst(CString(version)), pos: Context.currentPos()});\n\t\t\tcl.addField(field);\n\t\t}\n\t\t\n\t\tvar es : Array<Expr> = [];\n\t\tfor(assetData in xml.node.assets.nodes.asset) {\n\t\t\tvar assetName = {expr:EConst(CString(assetData.att.name)), pos: Context.currentPos()};\n\t\t\tes.push(macro assetManager.registerAsset( new Asset($assetName, Internal($assetName)) ));\n\t\t\tContext.addResource(assetData.att.name, sys.io.File.getBytes(assetData.att.source));\n\t\t}\n\t\t\n\t\tfield = new FieldInfo(\"registerAssets\");\n\t\tfield.pos = Context.currentPos();\n\t\tfield.access = [APrivate, AOverride];\n\t\tfield.kind = FFun({\n\t\t\tparams: [],\n\t\t\tret:\tnull,\n\t\t\targs:\t[],\n\t\t\texpr:\t{expr: EBlock(es), pos: Context.currentPos()},\n\t\t});\n\t\tcl.addField(field);\n\t\t\n\t\tfield = new FieldInfo(\"_app\");\n\t\tfield.pos = Context.currentPos();\n\t\tfield.access = [AStatic, APrivate];\n\t\tfield.kind = FVar(null);\n\t\tcl.addField(field);\n\t\t\n\t\t/*field = new FieldInfo(\"buildUI\");\n\t\tfield.access = [APrivate, AOverride];\n\t\tfield.kind = FMethod( {\n\t\t\t\n\t\t} );\n\t\tcl.addField(field);*/\n\n\t\treturn cl.fields();\n\t}\n\t\n}"
  },
  {
    "path": "huey/src/com/huey/events/Dispatcher.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.events;\n\n/**\n * The Dispatcher class allows observers to listen for events.\n */\nclass Dispatcher<T>\n{\n\tprivate var _listeners : List<T -> Void>;\n\t\n\tpublic var numListeners(get, null) : Int;\n\tprivate function get_numListeners() : Int {\n\t\treturn _listeners.length;\n\t}\n\t\n\t/**\n\t* Creates a new Dispatcher.\n\t*/\n\tpublic function new() {\n\t\t_listeners = new List();\n\t}\n\t\n\t/**\n\t * Attaches a listener method to this dispatcher.\n\t * The listener will be called when the event is dispatched\n\t * @param\tlistener\n\t */\n\tpublic function add(listener : T -> Void) : Void {\n\t\tif(!Lambda.has(_listeners, listener)) _listeners.add(listener);\n\t}\n\t\n\t/**\n\t * Dispatches the event and calls all registered listeners.\n\t */\n\tpublic function dispatch(?event : T) : Void {\n\t\tfor (listener in _listeners)\n\t\t\tlistener(event);\n\t}\n\t\n\t/**\n\t * Unregisters a listener from this dispatcher.\n\t */\n\tpublic function remove(listener : T -> Void) : Void {\n\t\t_listeners.remove(listener);\n\t}\n\t\n\t/**\n\t * Unregisters all listener from this dispatcher.\n\t */\n\tpublic function removeAll() : Void {\n\t\t_listeners.clear();\n\t}\n\t\n\t/**\n\t * Returns whether a listener is registered to this dispatcher.\n\t */\n\tpublic function has(listener : T -> Void) : Bool {\n\t\treturn Lambda.has(_listeners, listener);\n\t}\n}"
  },
  {
    "path": "huey/src/com/huey/macros/ClassBuilder.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.macros;\nimport haxe.ds.StringMap;\nimport haxe.macro.Context;\nimport haxe.macro.Expr;\nimport haxe.macro.Type;\n\nclass ClassBuilder\n{\n\tpublic static function createFromContext() : ClassBuilder {\n\t\tvar builder : ClassBuilder = new ClassBuilder();\n\t\t#if macro\n\t\t\tvar clazz = Context.getLocalClass().get();\n\t\t\tbuilder.name = clazz.name;\n\t\t\tbuilder.fullClassPath = clazz.module;\n\t\t\tbuilder.meta = clazz.meta.get();\n\t\t\tfor (field in Context.getBuildFields())\n\t\t\t\tbuilder._fields.set(field.name, FieldInfo.fromField(field));\n\t\t#end\n\t\t\n\t\treturn builder;\n\t}\n\t\n\tpublic var _fields : StringMap<FieldInfo>;\n\tpublic var name(default, null) : String;\n\tpublic var fullClassPath(default, null) : String;\n\tpublic var meta : Metadata;\n \n\tpublic function new() {\n\t\t// TODO: name etc.\n\t\t_fields = new StringMap();\n\t\tmeta = [];\n\t}\n\t\n\tinline public function getField(name : String) : Null<FieldInfo> {\n\t\treturn _fields.get(name);\n\t}\n\t\n\tpublic function addField(field : FieldInfo) : Void {\n\t\t_fields.set(field.name, field);\n\t}\n\t\n\tpublic function getFieldsWithMeta(metadata : String) : Array<FieldInfo> {\n\t\tvar results : Array<FieldInfo> = [];\n\t\t\n\t\tfor (f in _fields) {\n\t\t\tvar meta = f.getMeta(metadata);\n\t\t\tif (meta != null) results.push(f);\n\t\t}\n\t\t\n\t\treturn results;\n\t}\n\n\tpublic function getMeta(metadata : String) {\n\t\tfor(m in meta)\n\t\t\tif(m.name == metadata) return m;\n\n\t\treturn null;\n\t}\n\t\n\tpublic function fields() : Array<Field> {\n\t\tvar fields : Array<Field> = [];\n\t\tfor (f in _fields) fields.push(f.toField());\n\t\treturn fields;\n\t}\n}"
  },
  {
    "path": "huey/src/com/huey/macros/FieldInfo.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.macros;\nimport haxe.macro.Expr;\nimport haxe.macro.Context;\n\nclass FieldInfo\n{\n\tpublic static function fromField(field : Field) : FieldInfo {\n\t\tvar f : FieldInfo = new FieldInfo(field.name);\n\t\tf.pos = field.pos;\n\t\tf.meta = field.meta;\n\t\tf.kind = field.kind;\n\t\tf.access = field.access;\n\t\treturn f;\n\t}\n\t\n\tpublic var name : String;\n\tpublic var pos : Position;\n\tpublic var meta(default, null) : Metadata;\n\tpublic var kind : FieldType;\n\tpublic var access : Array<Access>;\n\t\n\tpublic function new(name : String) : Void {\n\t\tthis.name = name;\n\t\tmeta = [];\n\t\taccess = [APublic];\n\t\t#if macro\n\t\t\tpos = Context.currentPos();\n\t\t#end\n\t}\n\t\n\tpublic function toField() : Field {\n\t\treturn {\n\t\t\tname:\tname,\n\t\t\tpos:\tpos,\n\t\t\tmeta:\tmeta,\n\t\t\tkind:\tkind,\n\t\t\taccess:\taccess\n\t\t};\n\t}\n\t\n\tpublic function getMeta(name : String) {\n\t\tfor (m in meta)\n\t\t\tif (m.name == name) return m;\n\t\t\n\t\treturn null;\n\t}\n\t\n\tpublic function addMeta(name : String, ?params : Array<Expr>) : Void {\n\t\t\n\t}\n\t\n\t\n}"
  },
  {
    "path": "huey/src/com/huey/macros/MacroTools.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.macros;\nimport haxe.macro.Context;\nimport haxe.macro.Expr;\n\nclass MacroTools\n{\n\tpublic static function extractString(expr : Expr) : String {\n\t\tswitch(expr.expr) {\n\t\t\tcase EConst(c):\n\t\t\t\tswitch(c) {\n\t\t\t\t\tcase CString(s):\treturn s;\n\t\t\t\t\tdefault:\n\t\t\t\t}\n\t\t\tdefault:\n\t\t}\n\t\treturn null;\n\t}\n\n\tinline public static function extractIdentifier(expr : Expr) : String {\n\t\tswitch(expr.expr) {\n\t\t\tcase EConst(c):\n\t\t\t\tswitch(c) {\n\t\t\t\t\tcase CIdent(s):\t\treturn s;\n\t\t\t\t\tdefault:\n\t\t\t\t}\n\t\t\tdefault:\n\t\t}\n\t\t\n\t\tthrow \"Expression is not an identifier.\";\n\t\treturn null;\n\t}\n\t\n\tinline public static function getVar(fields : Array<Field>, name : String) {\n\t\tfor (field in fields) {\n\t\t\tif (field.name == name) {\n\t\t\t\tswitch(field.kind) {\n\t\t\t\t\tcase FVar(_, _):\treturn field.kind;\n\t\t\t\t\tdefault:\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn null;\n\t}\n\t\n\tinline public static function hasVar(fields : Array<Field>, name : String) : Bool {\n\t\tfor (field in fields) {\n\t\t\tif (field.name == name) {\n\t\t\t\tswitch(field.kind) {\n\t\t\t\t\tcase FVar(_, _):\treturn true;\n\t\t\t\t\tdefault:\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn false;\n\t}\n\t\n\tinline public static function getMeta(field : Field, name : String) : Array<Expr> {\n\t\tvar ret = null;\n\t\tfor (m in field.meta) {\n\t\t\tif (m.name == name) ret = m.params;\n\t\t}\n\t\t\n\t\treturn ret;\n\t}\n\t\n\tinline public static function hasMeta(field : Field, name : String) : Bool {\n\t\treturn getMeta(field, name) != null;\n\t}\n\n\tpublic static function cocnatExpr(e1 : Expr, e2 : Expr) : Expr {\n\t\treturn {expr: EBlock([e1, e2]), pos: e1.pos};\n\t}\n\t\n\tpublic static function mapExpr(expr : Expr, f : ExprDef->ExprDef) : Void {\n\t\tif (expr == null) return;\n\t\tvar replaceExpr : ExprDef = f(expr.expr);\n\n\t\tif(replaceExpr == null) {\n\t\t\tswitch(expr.expr) {\n\t\t\t\tcase EArray(e1, e2):\n\t\t\t\t\tmapExpr(e1, f);\n\t\t\t\t\tmapExpr(e2, f);\n\t\t\t\t\n\t\t\t\tcase EArrayDecl(values):\n\t\t\t\t\tfor (e in values) mapExpr(e, f);\n\t\t\t\t\n\t\t\t\tcase EBinop(op, e1, e2):\n\t\t\t\t\tmapExpr(e1, f);\n\t\t\t\t\tmapExpr(e2, f);\n\t\t\t\t\n\t\t\t\tcase EBlock(es):\n\t\t\t\t\tfor (e in es) mapExpr(e, f);\n\n\t\t\t\tcase EBreak:\n\t\t\t\t\t\n\t\t\t\tcase ECall(e, params):\n\t\t\t\t\tmapExpr(e, f);\n\t\t\t\t\tfor (e in params) mapExpr(e, f);\n\t\t\t\t\n\t\t\t\tcase ECast(e, t):\n\t\t\t\t\tmapExpr(e, f);\n\t\t\t\t\t\n\t\t\t\tcase ECheckType(e, t):\n\t\t\t\t\tmapExpr(e, f);\n\t\t\t\t\t\n\t\t\t\tcase EConst(c):\n\t\t\t\t\n\t\t\t\tcase EContinue:\n\t\t\t\t\n\t\t\t\tcase EDisplay(e, isCall):\n\t\t\t\t\tmapExpr(e, f);\n\t\t\t\t\t\n\t\t\t\tcase EDisplayNew(t):\n\t\t\t\t\n\t\t\t\tcase EField(e, field):\n\t\t\t\t\tmapExpr(e, f);\n\t\t\t\t\n\t\t\t\tcase EFor(it, e):\n\t\t\t\t\tmapExpr(it, f);\n\t\t\t\t\tmapExpr(e, f);\n\t\t\t\t\n\t\t\t\tcase EFunction(name, func):\n\t\t\t\t\tmapExpr(func.expr, f);\n\t\t\t\t\n\t\t\t\tcase EIf(econd, eif, eelse):\n\t\t\t\t\tmapExpr(econd, f);\n\t\t\t\t\tmapExpr(eif, f);\n\t\t\t\t\tmapExpr(eelse, f);\n\t\t\t\t\n\t\t\t\t// Fix for dev build: in Haxe 4, EIn changed to OpIn.\n#if (haxe_ver < \"4\")\n\t\t\t\tcase EIn(e1, e2):\n\t\t\t\t\tmapExpr(e1, f);\n\t\t\t\t\tmapExpr(e2, f);\n#end\n\t\t\t\t\n\t\t\t\tcase ENew(t, params):\n\t\t\t\t\tfor (e in params) mapExpr(e, f);\n\t\t\t\t\t\n\t\t\t\tcase EObjectDecl(fields):\n\t\t\t\t\tfor (field in fields) mapExpr(field.expr, f);\n\t\t\t\t\n\t\t\t\tcase EParenthesis(e):\n\t\t\t\t\tmapExpr(e, f);\n\t\t\t\t\t\n\t\t\t\tcase EReturn(e):\n\t\t\t\t\tif (e != null) mapExpr(e, f);\n\t\t\t\t\t\n\t\t\t\tcase ESwitch(e, cases, edef):\n\t\t\t\t\tmapExpr(e, f);\n\t\t\t\t\tfor (c in cases) mapExpr(c.expr, f);\n\t\t\t\t\tif (edef != null) mapExpr(edef, f);\n\t\t\t\t\t\n\t\t\t\tcase ETernary(econd, eif, eelse):\n\t\t\t\t\tmapExpr(econd, f);\n\t\t\t\t\tmapExpr(eif, f);\n\t\t\t\t\tmapExpr(eelse, f);\n\t\t\t\t\n\t\t\t\tcase EThrow(e):\n\t\t\t\t\tmapExpr(e, f);\n\t\t\t\t\t\n\t\t\t\tcase ETry(e, catches):\n\t\t\t\t\tmapExpr(e, f);\n\t\t\t\t\tfor (c in catches)\n\t\t\t\t\t\tmapExpr(c.expr, f);\n\t\t\t\t\t\n\t\t\t\tcase EUnop(op, postFix, e):\n\t\t\t\t\tmapExpr(e, f);\n\t\t\t\t\t\n\t\t\t\tcase EUntyped(e):\n\t\t\t\t\tmapExpr(e, f);\n\t\t\t\t\t\n\t\t\t\tcase EVars(vars):\n\t\t\t\t\tfor (v in vars)\n\t\t\t\t\t\tif (v.expr != null) mapExpr(v.expr, f);\n\n\t\t\t\tcase EWhile(econd, e, normalWhile):\n\t\t\t\t\tmapExpr(econd, f);\n\t\t\t\t\tmapExpr(e, f);\n\t\t\t\t\t\n\t\t\t\tdefault:\n\t\t\t}\n\t\t} else { expr.expr = replaceExpr; }\n\t}\n\t\n\tpublic static function concatExpr(e1 : Expr, e2 : Expr) : Expr {\n\t\tvar out = switch(e1.expr) {\n\t\t\tcase EBlock(es):\tes;\n\t\t\tdefault:\t\t\t[e1];\n\t\t}\n\t\t\n\t\tout.concat( switch(e2.expr) {\n\t\t\tcase EBlock(es):\tes;\n\t\t\tdefault:\t\t\t[e2];\n\t\t} );\n\t\t\n\t\t// TODO: smarter position?\n\t\treturn {expr: EBlock(out), pos: e1.pos};\n\t}\n\t\n}"
  },
  {
    "path": "huey/src/com/huey/macros/Macros.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.macros;\nimport haxe.macro.Context;\nimport haxe.macro.Expr;\nimport haxe.macro.Type;\n\nusing com.huey.macros.MacroTools;\n\nclass Macros\n{\n\t@:macro public static function build() : Array<Field> {\n\t\tvar cl : ClassBuilder = ClassBuilder.createFromContext();\n\n\t\tfor (field in cl.getFieldsWithMeta(\"forward\")) {\n\t\t\tvar meta = field.getMeta(\"forward\");\n\t\t\t\n\t\t\tif (meta.params.length < 1)\n\t\t\t\tContext.error(\"@forward requires a parameter.\", meta.pos);\n\t\t\t\n\t\t\tvar fieldExpr : Expr = meta.params[0];\n\t\t\t\n\t\t\tswitch(fieldExpr.expr) {\n\t\t\t\tcase EConst(c):\n\t\t\t\t\tswitch(c) {\n\t\t\t\t\t\tcase CIdent(i):\n\t\t\t\t\t\t\tfieldExpr.expr = EField({expr: fieldExpr.expr, pos: fieldExpr.pos}, field.name);\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\tdefault:\n\t\t\t}\n\t\t\t\n\t\t\tvar type;\n\t\t\tswitch(field.kind) {\n\t\t\t\tcase FVar(t, _):\ttype = t;\n\t\t\t\tdefault:\t\t\tContext.error(\"@forward destination field must be a variable, not be a property or function.\", fieldExpr.pos);\n\t\t\t}\n\t\t\t\n\t\t\t// transform into property\n\t\t\tvar getterName = \"get_\" + field.name;\n\t\t\tvar setterName = if (meta.params.length < 2) \"set_\" + field.name else null;\n\t\t\tfield.kind = FProp(\"get\", if( setterName != null ) setterName else \"null\", type);\n\t\t\t\n\t\t\tmeta.params = [];\n\t\t\t\n\t\t\tvar getter = new FieldInfo(getterName);\n\t\t\tgetter.pos = meta.pos;\n\t\t\tgetter.access = [APrivate, AInline];\n\t\t\tgetter.kind = FFun( {\n\t\t\t\tparams:\t\t[],\n\t\t\t\targs:\t\t[],\n\t\t\t\tret:\t\tnull,\n\t\t\t\texpr:\t\tmacro return $fieldExpr\n\t\t\t} );\n\t\t\tcl.addField(getter);\n\t\t\t\n\t\t\tif(setterName != null) {\n\t\t\t\tvar setter = new FieldInfo(setterName);\n\t\t\t\tsetter.pos = meta.pos;\n\t\t\t\tsetter.access = [APrivate, AInline];\n\t\t\t\tsetter.kind = FFun( {\n\t\t\t\t\tparams:\t\t[],\n\t\t\t\t\targs:\t\t[ { name: \"v\", opt: false, type: null, value: null } ],\n\t\t\t\t\tret:\t\tnull,\n\t\t\t\t\texpr:\t\tmacro return $fieldExpr = v\n\t\t\t\t} );\n\t\t\t\tcl.addField(setter);\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn cl.fields();\n\t}\n\n}"
  },
  {
    "path": "huey/src/com/huey/tests/AsyncTestCase.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.tests;\nimport com.huey.events.Dispatcher;\nimport haxe.Stack;\n\nclass AsyncTestCase implements ITest\n{\n\tpublic var onTestComplete(default, null) : Dispatcher<TestStatus>;\n\t\n\tpublic var name(default, null) : String;\n\t\n\tprivate var _testMethod : AsyncTestCase -> Void;\n\tprivate var _timer : haxe.Timer;\n\t\n\tpublic function new(name : String, testMethod : AsyncTestCase -> Void, ?timeout : Int = 1000)\n\t{\n\t\tthis.name = name;\n\t\t_testMethod = testMethod;\n\t\tonTestComplete = new Dispatcher();\n\t\t_timer = new haxe.Timer(timeout);\n\t}\n\t\n\tpublic function accept(visitor : ITestVisitor) : Void\n\t{\n\t\tvisitor.visitAsyncTestCase(this);\n\t}\n\t\n\tpublic function run() : TestStatus {\n\t\t_timer.run = timeout;\n\t\ttry {\n\t\t\t_testMethod(this);\n\t\t} catch (error : Dynamic) {\n\t\t\t_timer.stop();\n\t\t\tif (error != TestStatus.passed)\n\t\t\t\tonTestComplete.dispatch(TestStatus.failed(error, Stack.exceptionStack()));\n\t\t\telse\n\t\t\t\tonTestComplete.dispatch(TestStatus.passed);\n\t\t}\n\t\t\n\t\treturn null;\n\t}\n\t\n\tpublic function wrapAsync(f : Void -> Void) : Void -> Void {\n\t\treturn function() {\n\t\t\ttry {\n\t\t\t\tf();\n\t\t\t} catch (error : Dynamic) {\n\t\t\t\t_timer.stop();\n\t\t\t\tif (error != TestStatus.passed)\n\t\t\t\t\tonTestComplete.dispatch(TestStatus.failed(error, Stack.exceptionStack()));\n\t\t\t\telse\n\t\t\t\t\tonTestComplete.dispatch(TestStatus.passed);\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprivate function timeout() : Void {\n\t\tonTestComplete.dispatch(TestStatus.failed(\"Timed out\", Stack.callStack()));\n\t\t_timer.stop();\n\t}\n}"
  },
  {
    "path": "huey/src/com/huey/tests/AsyncTestVisitor.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.tests;\n\nclass AsyncTestVisitor implements ITestVisitor\n{\n\tprivate var _visitor : ITestVisitor;\n\tprivate var _visits : List<Void -> Void>;\n\t\n\tpublic function new(visitor : ITestVisitor)\n\t{\n\t\t_visitor = visitor;\n\t\t_visits = new List();\n\t}\n\n\tpublic function preVisitTestSuite(suite : TestSuite) : Void {\n\t\t_visits.add( function() _visitor.preVisitTestSuite(suite) );\n\t}\n\t\n\tpublic function postVisitTestSuite(suite : TestSuite) : Void {\n\t\t_visits.add( function() _visitor.postVisitTestSuite(suite) );\n\t}\n\t\n\tpublic function visitTestCase(test : TestCase) : Void {\n\t\t_visits.add( function() _visitor.visitTestCase(test) );\n\t}\n\t\n\tpublic function visitAsyncTestCase(test : AsyncTestCase) : Void {\n\t\t_visits.add( function() _visitor.visitAsyncTestCase(test) );\n\t}\n\t\n\tpublic function hasNext() : Bool {\n\t\treturn !_visits.isEmpty();\n\t}\n\t\n\tpublic function visitNext() : Void {\n\t\tvar f = _visits.pop();\n\t\tf();\n\t}\n\t\n}"
  },
  {
    "path": "huey/src/com/huey/tests/ITest.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.tests;\n\ninterface ITest\n{\n\tvar name(default, null)\t: String;\n\tfunction accept(visitor : ITestVisitor) : Void;\n}"
  },
  {
    "path": "huey/src/com/huey/tests/ITestVisitor.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.tests;\n\ninterface ITestVisitor\n{\n\tfunction preVisitTestSuite(suite : TestSuite) : Void;\n\tfunction postVisitTestSuite(suite : TestSuite) : Void;\n\tfunction visitTestCase(test : TestCase) : Void;\n\tfunction visitAsyncTestCase(test : AsyncTestCase) : Void;\n}"
  },
  {
    "path": "huey/src/com/huey/tests/TestBuilder.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.tests;\nimport com.huey.macros.MacroTools;\nimport haxe.macro.Context;\nimport haxe.macro.Expr;\n\n@:macro class TestBuilder {\n\tpublic static function buildTestSuite() : Array<Field> {\n\t\tvar cl = Context.getLocalClass().get();\n\t\tvar fields : Array<Field> = Context.getBuildFields();\n\t\tvar pos = Context.currentPos();\n\t\t\n\t\tvar testMethods : List<String> = new List();\n\t\tvar asyncTestMethods : List<String> = new List();\n\t\t\n\t\tvar newExprs : Array<Expr>;\n\n\t\tfunction wrapAsync(expr) {\n\t\t\tswitch(expr) {\n\t\t\t\t/*case ECall(e, args):\n\t\t\t\t\tswitch(Context.typeof(e)) {\n\t\t\t\t\t\tcase TFun(_, _):\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\tECall(\n\t\t\t\t\t\t\t\t\t{pos: pos, expr: EField(\n\t\t\t\t\t\t\t\t\t\t{pos: pos, expr: EConst(CIdent(\"async\")) },\n\t\t\t\t\t\t\t\t\t\t\"wrapAsync\")\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t[ e ]);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t}*/\n\t\t\t\t\t\n\t\t\t\tcase EFunction(name, _):\n\t\t\t\t\tif (name == null)\n\t\t\t\t\t\treturn\n\t\t\t\t\t\t\tECall(\n\t\t\t\t\t\t\t\t{pos: pos, expr: EField(\n\t\t\t\t\t\t\t\t\t{pos: pos, expr: EConst(CIdent(\"async\")) },\n\t\t\t\t\t\t\t\t\t\"wrapAsync\")\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t[{expr: expr, pos: pos}]);\n\t\t\t\tdefault:\n\t\t\t}\n\t\t\t\n\t\t\treturn null;\n\t\t}\n\t\n\t\tfor (field in fields) {\n\t\t\tswitch(field.kind) {\n\t\t\t\tcase FFun(f):\n\t\t\t\t\tif (field.name == \"new\") {\n\t\t\t\t\t\tswitch(f.expr.expr) {\n\t\t\t\t\t\t\tcase EBlock(e):\tnewExprs = e;\n\t\t\t\t\t\t\tdefault:\t\tContext.error(\"Expected EBlock for constructor\", pos);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfor (meta in field.meta) {\n\t\t\t\t\t\t\tif (meta.name == \"test\") testMethods.add(field.name);\n\t\t\t\t\t\t\telse if (meta.name == \"asyncTest\") {\n\t\t\t\t\t\t\t\tf.args.push( { name: \"async\", opt: false, type: null, value: null } );\n\t\t\t\t\t\t\t\tasyncTestMethods.add(field.name);\n\t\t\t\t\t\t\t\tMacroTools.mapExpr(f.expr, wrapAsync);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (newExprs == null) {\n\t\t\tnewExprs = [ Context.parse(\"super()\", pos) ];\n\t\t\t\n\t\t\tfields.push( {\n\t\t\t\tpos:\tpos,\n\t\t\t\tname:\t\"new\",\n\t\t\t\tmeta:\t[],\n\t\t\t\taccess:\t[APublic],\n\t\t\t\tdoc:\tnull,\n\t\t\t\tkind:\tFFun( { ret: null, params: [], args: [], expr: { expr: EBlock(newExprs), pos: pos } } )\n\t\t\t} );\n\t\t}\n\n\t\tfor(method in testMethods)\n\t\t\tnewExprs.push( Context.parse(Std.format('_tests.add(new com.huey.tests.TestCase(\"$method\", $method))'), pos) );\n\t\tfor(method in asyncTestMethods)\n\t\t\tnewExprs.push( Context.parse(Std.format('_tests.add(new com.huey.tests.AsyncTestCase(\"$method\", $method))'), pos) );\n\t\t\n\t\t/*for (meta in cl.meta) {\n\t\t\tif (meta.name == \"childSuites\") {\n\t\t\t\tfor (child in meta.params) {\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}*/\n\t\t\n\t\treturn fields;\n\t}\n}"
  },
  {
    "path": "huey/src/com/huey/tests/TestCase.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.tests;\nimport haxe.Stack;\n\nclass TestCase implements ITest\n{\n\tpublic var name(default, null) : String;\n\t\n\tprivate var _testMethod : Void -> Void;\n\t\n\tpublic function new(name : String, testMethod : Void -> Void)\n\t{\n\t\tthis.name = name;\n\t\t_testMethod = testMethod;\n\t}\n\t\n\tpublic function accept(visitor : ITestVisitor) : Void\n\t{\n\t\tvisitor.visitTestCase(this);\n\t}\n\t\n\tpublic function run() : TestStatus {\n\t\ttry {\n\t\t\t_testMethod();\n\t\t} catch (error : Dynamic) {\n\t\t\tif (error != TestStatus.passed) return TestStatus.failed(error, Stack.exceptionStack());\n\t\t}\n\t\t\n\t\treturn TestStatus.passed;\n\t}\n}"
  },
  {
    "path": "huey/src/com/huey/tests/TestRunner.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.tests;\nimport haxe.Stack;\n\nclass TestRunner implements ITestVisitor\n{\n\tpublic var numTestsRun(default, null)\t\t: Int;\n\tpublic var numTestsPassed(default, null)\t: Int;\n\tpublic var numTestsFailed(default, null)\t: Int;\n\tpublic var numSuitesRun(default, null)\t\t: Int;\n\t\n\tprivate var _asyncAdapter : AsyncTestVisitor;\n\tprivate var _waiting : Bool;\n\t\n\tpublic function new() {\n\t\tnumTestsRun = numTestsPassed = numTestsFailed = numSuitesRun = 0;\n\t\t_asyncAdapter = new AsyncTestVisitor(this);\n\t\t_waiting = false;\n\t}\n\t\n\tpublic function run(test : ITest) : Void {\n\t\ttest.accept(_asyncAdapter);\n\t\trunLoop();\n\t}\n\t\n\tprivate function runLoop() : Void {\n\t\t_waiting = false;\n\t\twhile (_asyncAdapter.hasNext()) {\n\t\t\tif (_waiting) return;\n\t\t\t_asyncAdapter.visitNext();\n\t\t}\n\t\t\t\n\t\tcomplete();\n\t}\n\t\n\tpublic function preVisitTestSuite(suite : TestSuite) : Void {\n\t\tlog(Std.format(\"Running test suite ${suite.name}...\"));\n\t\tnumSuitesRun++;\n\t\t\n\t\tsuite.setUp();\n\t}\n\t\n\tpublic function postVisitTestSuite(suite : TestSuite) : Void {\n\t\tsuite.tearDown();\n\t\t\n\t\tlog(Std.format(\"Finished test suite ${suite.name}.\"));\n\t}\n\t\n\tpublic function visitTestCase(test : TestCase) : Void {\n\t\tlog(Std.format(\"Running test ${test.name}...\"));\n\t\tnumTestsRun++;\n\t\t\t\t\t\n\t\tswitch(test.run()) {\n\t\t\tcase passed:\n\t\t\t\tlog(\"Passed!\");\n\t\t\t\tnumTestsPassed++;\n\t\t\t\t\n\t\t\tcase failed(message, stack):\n\t\t\t\tlog(Std.format(\"Failed! $message\\n$stack\"));\n\t\t\t\t//_failedTests.add(test);\n\t\t\t\tnumTestsFailed++;\n\t\t\t\t\n\t\t\tdefault:\n\t\t}\n\t}\n\t\n\tpublic function visitAsyncTestCase(test : AsyncTestCase) : Void {\n\t\tlog(Std.format(\"Running test ${test.name}...\"));\n\t\tnumTestsRun++;\n\t\ttest.onTestComplete.add(onAsyncTestCompleted);\n\t\ttest.run();\n\t\t\n\t\t_waiting = true;\n\t}\n\t\n\tprivate function onAsyncTestCompleted(status : TestStatus) : Void {\n\t\tswitch(status) {\n\t\t\tcase passed:\n\t\t\t\tlog(\"Passed!\");\n\t\t\t\tnumTestsPassed++;\n\t\t\t\t\n\t\t\tcase failed(message, stack):\n\t\t\t\tlog(Std.format(\"Failed! $message\\n$stack\"));\n\t\t\t\t//_failedTests.add(test);\n\t\t\t\tnumTestsFailed++;\n\t\t\t\t\n\t\t\tdefault:\n\t\t}\n\t\t\n\t\trunLoop();\n\t}\n\t\n\t\n\tprivate function complete() : Void {\n\t\tlog(\"Testing complete.\");\n\t\tlog(Std.format(\"$numTestsPassed / $numTestsRun tests passed.\"));\n\t\tlog(Std.format(\"$numTestsFailed / $numTestsRun tests failed.\"));\n\t}\n\t\n\tpublic dynamic function log(message : String) : Void {\n\t\ttrace(message);\n\t}\n}"
  },
  {
    "path": "huey/src/com/huey/tests/TestStatus.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.tests;\nimport haxe.Stack;\n\nenum TestStatus\n{\n\tpassed;\n\tfailed(message : String, stackTrace : Array<StackItem>);\n}"
  },
  {
    "path": "huey/src/com/huey/tests/TestSuite.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.tests;\nimport com.huey.events.Dispatcher;\nimport com.huey.utils.Assert;\nimport haxe.macro.Expr;\nimport haxe.Stack;\n\n/**\n * TestSuite groups test cases together.\n */\n@:autoBuild(com.huey.tests.TestBuilder.buildTestSuite())\nclass TestSuite implements ITest {\n\t\n\tpublic var name(default, null)\t\t: String;\n\t\n\tprivate var _tests\t\t\t\t\t: List<ITest>;\n\n\tpublic function new() {\n\t\tname = Type.getClassName( Type.getClass(this) );\n\t\t_tests = new List<ITest>();\n\t}\n\t\t\n\tpublic function add(test : ITest) : Void {\n\t\t_tests.add(test);\n\t}\n\t\t\n\tpublic function accept(visitor : ITestVisitor) : Void {\n\t\tvisitor.preVisitTestSuite(this);\n\t\t\t\n\t\tfor (test in _tests)\n\t\t\ttest.accept(visitor);\n\t\t\n\t\tvisitor.postVisitTestSuite(this);\n\t}\n\n\tpublic function iterator() : Iterator<ITest> {\n\t\treturn _tests.iterator();\n\t}\n\t\n\tpublic function setUp() : Void {\n\t\t\n\t}\n\n\tpublic function tearDown() : Void {\n\t\t\n\t}\n\t\n\tinline private function assertNull<T>(v : T, ?message : String) : Void {\n\t\tAssert.assertNull(v, message);\n\t}\n\t\n\tinline private function assertNotNull<T>(v : T, ?message : String) : Void {\n\t\tAssert.assertNotNull(v, message);\n\t}\n\t\n\tinline private function assertTrue(b : Bool, ?message : String) : Void {\n\t\tAssert.assertTrue(b, message);\n\t}\n\t\n\tinline private function assertFalse(b : Bool, ?message : String) : Void {\n\t\tAssert.assertFalse(b, message);\n\t}\n\t\n\tinline private function assertEqual<T>(expected : T, actual : T, ?message : String) : Void {\n\t\tAssert.assertEqual(expected, actual, message);\n\t}\n\t\n\tinline private function assertNotEqual<T>(unexpected : T, actual : T, ?message : String = \"\") : Void {\n\t\tAssert.assertNotEqual(unexpected, actual, message);\n\t}\n\t\n\tprivate function pass() : Void {\n\t\tthrow TestStatus.passed;\n\t}\n\t\n\tprivate function fail(error : Dynamic) : Void {\n\t\tthrow error;\n\t}\n}"
  },
  {
    "path": "huey/src/com/huey/ui/Button.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.ui;\n\nclass Button extends StateContainer\n{\n\tpublic var label : String;\n\t\t\n\tpublic var upState(default, set) : Component;\n\tpublic var overState(default, set) : Component;\n\tpublic var downState(default, set) : Component;\n\t\n\tprivate var _isOver : Bool;\n\n\tinline private function set_upState(v : Component) : Component {\n\t\t_states.set(\"up\", []);\n\t\tif(v != null) addToState(v, \"up\");\n\t\treturn upState = v;\n\t}\n\n\tinline private function set_overState(v : Component) : Component {\n\t\tif(v != null) {\n\t\t\t_states.set(\"over\", []);\n\t\t\taddToState(v, \"over\");\n\t\t}\n\t\treturn overState = v;\n\t}\n\n\tinline private function set_downState(v : Component) : Component {\n\t\tif(v != null) {\n\t\t\t_states.set(\"down\", []);\n\t\t\taddToState(v, \"down\");\n\t\t}\n\t\treturn downState = v;\n\t}\n\t\n\tpublic function new() {\n\t\tsuper();\n\t\t\n\t\t_implContainer.buttonMode = true;\n\t\t_isOver = false;\n\t\tstate = \"up\";\n\n\t\tonMouseOver.add(mouseOverHandler);\n\t\tonMouseDown.add(mouseDownHandler);\n\t\tonMouseUp.add(mouseUpHandler);\n\t\tonMouseOut.add(mouseOutHandler);\n\t}\n\t\n\tprivate function mouseOverHandler(e) : Void {\n\t\tif (state != \"down\") {\n\t\t\tif(_states.exists(\"over\")) state = \"over\";\n\t\t}\n\n\t\t_isOver = true;\n\t}\n\t\n\tprivate function mouseOutHandler(e) : Void {\n\t\tif(state != \"down\") {\n\t\t\tstate = \"up\";\n\t\t}\n\t\t\n\t\t_isOver = false;\n\t}\n\t\n\tprivate function mouseDownHandler(e) : Void {\n\t\tif(_states.exists(\"down\")) state = \"down\";\n\t}\n\t\n\tprivate function mouseUpHandler(e) : Void {\n\t\tif (_isOver && _states.exists(\"over\"))\n\t\t\tstate = \"over\";\n\t\telse\n\t\t\tstate = \"up\";\n\t}\n}"
  },
  {
    "path": "huey/src/com/huey/ui/CheckBox.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.ui;\n\nclass CheckBox extends Button\n{\n\t@bindable public var selected(default, set) : Bool;\n\tprivate function set_selected(v : Bool) : Bool {\n\t\tselected = v;\n\t\tupdateState();\n\t\treturn selected;\n\t}\n\n\tpublic var selectedUpState(default, set) : Component;\n\tpublic var selectedOverState(default, set) : Component;\n\tpublic var selectedDownState(default, set) : Component;\n\n\tinline private function set_selectedUpState(v : Component) : Component {\n\t\tif(v != null)\n\t\t\t_states.set(\"selectedUp\", [v]);\n\t\treturn v;\n\t}\n\n\tinline private function set_selectedOverState(v : Component) : Component {\n\t\tif(v != null)\n\t\t\t_states.set(\"selectedOver\", [v]);\n\t\treturn v;\n\t}\n\n\tinline private function set_selectedDownState(v : Component) : Component {\n\t\tif(v != null)\n\t\t\t_states.set(\"selectedDown\", [v]);\n\t\treturn v;\n\t}\n\n\tpublic function new() {\n\t\tsuper();\n\t\tonClick.add(clickHandler);\n\t}\n\n\toverride private function mouseOverHandler(e) : Void {\n\t\tif (state != \"down\" && state != \"selectedDown\") {\n\t\t\tif(selected) {\n\t\t\t\tif (_states.exists(\"selectedOver\")) state = \"selectedOver\";\n\t\t\t} else {\n\t\t\t\tif (_states.exists(\"over\")) state = \"over\";\n\t\t\t}\n\t\t}\n\n\t\t_isOver = true;\n\t}\n\t\n\toverride private function mouseOutHandler(e) : Void {\n\t\tif(state != \"down\" && state != \"selectedDown\") {\n\t\t\tstate = if(selected) \"selectedUp\" else \"up\";\n\t\t}\n\t\t\n\t\t_isOver = false;\n\t}\n\t\n\toverride private function mouseDownHandler(e) : Void {\n\t\tif(selected) {\n\t\t\tif (_states.exists(\"selectedDown\")) state = \"selectedDown\";\n\t\t} else {\n\t\t\tif (_states.exists(\"down\")) state = \"down\";\n\t\t}\n\t}\n\t\n\toverride private function mouseUpHandler(e) : Void {\n\t\tif (_isOver) {\n\t\t\tif (!selected) {\n\t\t\t\tif (_states.exists(\"over\")) state = \"over\";\n\t\t\t} else {\n\t\t\t\tif (_states.exists(\"selectedOver\")) state = \"selectedOver\";\n\t\t\t}\n\t\t} else {\n\t\t\tstate = if (selected) \"selectedUp\" else \"up\";\n\t\t}\n\t}\n\t\n\tprivate function updateState() : Void {\n\t\tif (_isOver) {\n\t\t\tif (!selected) {\n\t\t\t\tif (_states.exists(\"over\")) state = \"over\";\n\t\t\t} else {\n\t\t\t\tif (_states.exists(\"selectedOver\")) state = \"selectedOver\";\n\t\t\t\telse state = \"selectedUp\";\n\t\t\t}\n\t\t} else {\n\t\t\tstate = if (selected) \"selectedUp\" else \"up\";\n\t\t}\n\t}\n\t\n\tprivate function clickHandler(e) : Void {\n\t\tselected = !selected;\n\t}\n}"
  },
  {
    "path": "huey/src/com/huey/ui/Component.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.ui;\nimport com.huey.events.Dispatcher;\nimport com.huey.binding.Binding;\n\n@:autoBuild(com.huey.macros.Macros.build())\ninterface UIBase {\n\t\n}\n\nclass Component extends Binding.Bindable implements UIBase {\n\tpublic var parent(default, null) : Container;\n\tpublic var root(get_root, null) : Container;\n\tprivate function get_root() {\n\t\tvar c = this;\n\t\twhile (c.parent != null) c = c.parent;\n\t\treturn c.root;\n\t}\n\t\n\t@bindable public var enabled(default, set_enabled) : Bool;\n\tprivate function set_enabled(v) {\n\t\tif (Std.is(_implComponent, flash.display.InteractiveObject)) {\n\t\t\tuntyped _implComponent.mouseEnabled = v;\n\t\t\tuntyped _implComponent.tabEnabled = v;\n\t\t\tuntyped _implComponent.mouseChildren = v;\n\t\t}\n\n\t\t_implComponent.alpha = if (v) 1.0 else 0.5;\n\t\treturn enabled = v;\n\t}\n\t\n\t@forward(_implComponent) public var visible : Bool;\n\t\t\n\t@forward(_implComponent) public var x : Float;\n\t\n\t@forward(_implComponent) public var y : Float;\n\t\n\t@forward(_implComponent) public var alpha : Float;\n\t\n\tpublic var depth(default, set_depth) : Float;\n\tprivate function set_depth(v) {\n\t\tdepth = v;\n\t\t//if(parent != null) parent.needDepthSort();\n\t\treturn depth;\n\t}\n\n\tpublic var hitArea(default, set_hitArea) : HitArea;\n\tpublic function set_hitArea(v) {\n\t\thitArea = v;\n\t\tif(Std.is(_implComponent, flash.display.Sprite))\n\t\t{\n\t\t\tuntyped { _implComponent.graphics.clear(); }\n\t\t\tswitch(hitArea) {\n\t\t\t\tcase Self:\n\t\t\t\t\t\tuntyped{ _implComponent.hitArea = null; }\n\n\t\t\t\tcase Rectangle(x, y, width, height):\n\t\t\t\t\tuntyped {\n\t\t\t\t\t\t_implComponent.graphics.beginFill(0, 0);\n\t\t\t\t\t\t_implComponent.graphics.drawRect(x, y, width, height);\n\t\t\t\t\t\t_implComponent.graphics.endFill();\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn hitArea;\n\t}\n\n\tpublic var width(get_width, set_width) : Float;\n\tprivate function get_width() return _implComponent.width;\n\tprivate function set_width(v) return _implComponent.width = v;\n\t\n\tpublic var height(get_height, set_height) : Float;\n\tprivate function get_height() return _implComponent.height;\n\tprivate function set_height(v) return _implComponent.height = v;\n\t\n\t\n\t// ===== EVENTS =====\n\tpublic var onClick : Dispatcher<UIEvent>;\n\tpublic var onMouseOver : Dispatcher<UIEvent>;\n\tpublic var onMouseOut : Dispatcher<UIEvent>;\n\tpublic var onMouseDown(default, null) : Dispatcher<UIEvent>;\n\tpublic var onMouseUp(default, null) : Dispatcher<UIEvent>;\n\t\n\tpublic function new(implComponent : flash.display.DisplayObject) {\n\t\tsuper();\n\t\t_implComponent = implComponent;\n\t\t\n\t\tvisible = true;\n\t\tx = 0.0;\n\t\ty = 0.0;\n\t\tdepth = 0.0;\n\n\t\thitArea = Self;\n\t\t\n\t\tonClick = new Dispatcher();\n\t\t_implComponent.addEventListener(flash.events.MouseEvent.CLICK, function(_) onClick.dispatch( { source: this } ) );\n\t\t\n\t\tonMouseOver = new Dispatcher();\n\t\t_implComponent.addEventListener(flash.events.MouseEvent.ROLL_OVER, function(e) {\n\t\t\tonMouseOver.dispatch( { source: this } );\n\t\t\te.updateAfterEvent();\n\t\t} );\n\t\t\n\t\tonMouseOut = new Dispatcher();\n\t\t_implComponent.addEventListener(flash.events.MouseEvent.ROLL_OUT, function(e) {\n\t\t\tonMouseOut.dispatch( { source: this } );\n\t\t\te.updateAfterEvent();\n\t\t} );\n\t\t\n\t\tonMouseDown = new Dispatcher();\n\t\t_implComponent.addEventListener(flash.events.MouseEvent.MOUSE_DOWN, mouseDownInternalHandler );\n\t\t\n\t\tonMouseUp = new Dispatcher();\n\t}\n\t\n\tprivate var _implComponent : flash.display.DisplayObject;\n\t\n\tprivate function mouseDownInternalHandler(e) {\n\t\tflash.Lib.current.stage.addEventListener(flash.events.MouseEvent.MOUSE_UP, mouseUpInternalHandler, false, 0, true);\n\t\tonMouseDown.dispatch({source: this});\n\t//\te.updateAfterEvent();\n\t}\n\t\n\tprivate function mouseUpInternalHandler(e) {\n\t\tflash.Lib.current.stage.removeEventListener(flash.events.MouseEvent.MOUSE_UP, mouseUpInternalHandler);\n\t\tonMouseUp.dispatch({source: this});\n\t\t//e.updateAfterEvent();\n\t}\n}\n\n\nenum HitArea {\n\tSelf;\n\tRectangle(x : Float, y : Float, width : Float, height : Float);\n}"
  },
  {
    "path": "huey/src/com/huey/ui/Container.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.ui;\n\nclass Container extends Component\n{\n\tpublic var numChildren(get, never) : Int;\n\n\tprivate var _children : List<Component>;\n\tprivate var _implContainer : flash.display.Sprite;\n\t\n\tprivate var _needsDepthSorting : Bool;\n\t\n\tpublic function new() {\n\t\t_implContainer = new flash.display.Sprite();\n\t\tsuper(_implContainer);\n\t\t_children = new List();\n\t}\n\t\n\tpublic function add(child : Component) : Void {\n\n\t\t_children.add(child);\n\t\tchild.parent = this;\n\t\t_implContainer.addChild(child._implComponent);\n\t}\n\t\n\tpublic function remove(child : Component) : Bool {\n\t\tvar removed : Bool = _children.remove(child);\n\t\t_implContainer.removeChild(child._implComponent);\n\t\tchild.parent = null;\n\t\treturn removed;\n\t}\n\n\tpublic function removeAll() : Void {\n\t\tfor(child in _children) {\n\t\t\t_implContainer.removeChild(child._implComponent);\n\t\t\tchild.parent = null;\n\t\t}\n\t\t_children.clear();\n\t}\n\t\n\tprivate function get_numChildren() : Int {\n\t\treturn _children.length;\n\t}\n\t\n\tpublic function needDepthSort() : Void {\n\t\t_needsDepthSorting = true;\n\t\tflash.Lib.current.stage.addEventListener(flash.events.Event.EXIT_FRAME, depthSort, false, 0, true);\n\t}\n\t\n\tprivate function depthSort(_) {\n\t\t// TODO: merge sort linked list\n\t\tif(_needsDepthSorting) {\n\t\t\tflash.Lib.current.stage.removeEventListener(flash.events.Event.EXIT_FRAME, depthSort);\n\t\t\tvar a = [];\n\t\t\tfor (child in _children) a.push(child);\n\t\t\ta.sort( function(a, b) { return if (a.depth < b.depth) -1 else if(a.depth > b.depth) 1 else 0; } );\n\t\t\tvar i = 0;\n\t\t\tfor (child in a) _implContainer.setChildIndex(child._implComponent, i++);\n\t\t\t_needsDepthSorting = false;\n\t\t}\n\t}\n\n}"
  },
  {
    "path": "huey/src/com/huey/ui/Image.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.ui;\nimport com.huey.assets.Asset;\n\nclass Image extends Component {\n\tpublic function new(source : Asset) {\n\t\t_implImage = if(source != null) source.data else null;\n\t\tsuper(new flash.display.Bitmap(_implImage, flash.display.PixelSnapping.AUTO, true));\n\t}\n\t\n\tprivate var _implImage : flash.display.BitmapData;\n}"
  },
  {
    "path": "huey/src/com/huey/ui/Label.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.ui;\nimport com.huey.events.Dispatcher;\nimport flash.text.TextFormat;\n\nclass Label extends Component {\n\tpublic var text(default, set_text) : String;\n\tprivate function set_text(v : String) : String {\n\t\tif (v == null) v = \"\";\n\t\ttext = _implText.text = v;\n\t\treturn v;\n\t}\n\t\n\t@forward(_implText) public var wordWrap : Bool;\n\t\n\tpublic var color(get_color, set_color) : Int;\n\tprivate function get_color() return _textFormat.color;\n\tprivate function set_color(v) {\n\t\t_textFormat.color = v;\n\t\tupdateTextFormat();\n\t\treturn v;\n\t}\n\t\n\tpublic var font(get_font, set_font) : String;\n\tprivate function get_font() return _textFormat.font;\n\tprivate function set_font(v) {\n\t\t_textFormat.font = v;\n\t\tupdateTextFormat();\n\t\treturn v;\n\t}\n\t\n\tpublic var size(get_size, set_size) : Float;\n\tprivate function get_size() return _textFormat.size;\n\tprivate function set_size(v) {\n\t\t_textFormat.size = v;\n\t\tupdateTextFormat();\n\t\treturn v;\n\t}\n\t\n\tpublic var bold(get_bold, set_bold) : Bool;\n\tprivate function get_bold() return _textFormat.bold;\n\tprivate function set_bold(v) {\n\t\t_textFormat.bold = v;\n\t\tupdateTextFormat();\n\t\treturn v;\n\t}\n\t\n\tpublic var editable(get_editable, set_editable) : Bool;\n\tprivate function get_editable() return _implText.type == flash.text.TextFieldType.INPUT;\n\tprivate function set_editable(v) {\n\t\t_implText.selectable = v;\n\t\t_implText.type = v ? flash.text.TextFieldType.INPUT : flash.text.TextFieldType.DYNAMIC;\n\t\treturn v;\n\t}\n\t\n\tpublic var autoSize(get_autoSize, set_autoSize) : Bool;\n\tprivate function get_autoSize() return _implText.autoSize != flash.text.TextFieldAutoSize.NONE;\n\tprivate function set_autoSize(v) {\n\t\t_implText.autoSize = if(v) flash.text.TextFieldAutoSize.LEFT else flash.text.TextFieldAutoSize.NONE;\n\t\tif(v == false) {\n\t\t\t_implText.width = 100;\n\t\t\t_implText.height = 20;\n\t\t}\n\t\treturn v;\n\t}\n\t\n\tpublic var align(get_align, set_align) : TextAlign;\n\tprivate function get_align() {\n\t\treturn switch(_textFormat.align) {\n\t\t\tcase flash.text.TextFormatAlign.LEFT:\t\tTextAlign.left;\n\t\t\tcase flash.text.TextFormatAlign.CENTER:\t\tTextAlign.center;\n\t\t\tcase flash.text.TextFormatAlign.RIGHT:\t\tTextAlign.right;\n\t\t\tcase flash.text.TextFormatAlign.JUSTIFY:\tTextAlign.justify;\n\t\t\tdefault:\t\t\t\t\t\t\t\t\tTextAlign.left;\n\t\t}\n\t}\n\tprivate function set_align(v) {\n\t\t_textFormat.align = switch(v) {\n\t\t\tcase TextAlign.left:\tflash.text.TextFormatAlign.LEFT;\n\t\t\tcase TextAlign.center:\tflash.text.TextFormatAlign.CENTER;\n\t\t\tcase TextAlign.right:\tflash.text.TextFormatAlign.RIGHT;\n\t\t\tcase TextAlign.justify:\tflash.text.TextFormatAlign.JUSTIFY;\n\t\t}\n\t\tupdateTextFormat();\n\t\treturn v;\n\t}\n\t\n\tpublic var letterSpacing(get_letterSpacing, set_letterSpacing) : Float;\n\tprivate function get_letterSpacing() return _textFormat.letterSpacing;\n\tprivate function set_letterSpacing(v) {\n\t\t_textFormat.letterSpacing = v;\n\t\tupdateTextFormat();\n\t\treturn v;\n\t}\n\t\n\t@forward(_implText.restrict) public var allowedCharacters : String;\n\t\n\tpublic var onUserEdited(default, null) : Dispatcher<UIEvent>;\n\n\tpublic function new(?text = \"\") {\n\t\tonUserEdited = new Dispatcher();\n\t\t_implText = new flash.text.TextField();\n\t\t_implText.width = 100;\n\t\t_implText.height = 20;\n\t\t_implText.addEventListener(flash.events.Event.CHANGE, textChangeHandler);\n\t\t_implText.addEventListener(flash.events.FocusEvent.FOCUS_OUT, function(_) dispatchChange());\n\t\t\n\t\tautoSize = true;\n\t\t_implText.embedFonts = true;\n\t\t_implText.selectable = false;\n\t\t_textFormat = new TextFormat(\"Arial\", 12, 0x000000, false, false, false);\n\t\tupdateTextFormat();\n\t\tsuper(_implText);\n\t\tthis.text = text;\n\t}\n\n\tprivate var _implText : flash.text.TextField;\n\tprivate var _textFormat : flash.text.TextFormat;\n\tprivate var _changeTimer : haxe.Timer;\n\t\n\tprivate inline function updateTextFormat() {\n\t\t_implText.defaultTextFormat = _textFormat;\n\t\t_implText.setTextFormat(_textFormat);\n\t}\n\t\n\tprivate function textChangeHandler(_) {\n\t\tif(_changeTimer != null) {\n\t\t\t_changeTimer.stop();\n\t\t}\n\t\t\n\t\t_changeTimer = new haxe.Timer(750);\n\t\t_changeTimer.run = dispatchChange;\n\t}\n\t\n\tprivate function dispatchChange() {\n\t\tif(this.text != _implText.text) {\n\t\t\tthis.text = _implText.text;\n\t\t\tonUserEdited.dispatch({source: this});\n\t\t}\n\t\tif(_changeTimer != null) {\n\t\t\t_changeTimer.stop();\n\t\t\t_changeTimer = null;\n\t\t}\n\t}\n}"
  },
  {
    "path": "huey/src/com/huey/ui/ListBox.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.ui;\nimport com.huey.events.Dispatcher;\n\nclass ListBox extends Container {\n\t@bindable public var selectedItem(get_selectedItem, set_selectedItem) : Dynamic;\n\tprivate function get_selectedItem() : Dynamic {\n\t\treturn if(selectedIndex >= 0) _items[selectedIndex].data else null;\n\t}\n\tprivate function set_selectedItem(v : Dynamic) : Dynamic {\n\t\tvar i = 0;\n\t\tfor (item in _items) {\n\t\t\tif ( item.data == v ) {\n\t\t\t\tset_selectedIndex(i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\t\n\t\treturn selectedItem;\n\t}\n\t\n\tpublic var onChange(default, null) : Dispatcher<UIEvent>;\n\t\n\t@bindable public var selectedIndex(default, set_selectedIndex) : Int = -1;\n\tprivate function set_selectedIndex(v : Int) : Int {\n\t\t_selectedRect.visible = false;\n\t\t\n\t\tselectedIndex = v;\n\t\t\n\t\tif (selectedIndex < 0) selectedIndex = -1;\n\t\tif (selectedIndex > _items.length - 1) selectedIndex = _items.length - 1;\n\t\t\n\t\tif (selectedIndex >= 0) {\n\t\t\t_selectedRect.visible = true;\n\t\t\t_selectedRect.y = _items[selectedIndex].view.y + 4;\n\t\t}\n\t\t\n\t\tdispatchBinding(\"selectedItem\");\n\t\tonChange.dispatch({source: this});\n\t\treturn selectedIndex;\n\t}\n\t\n\tpublic function new() {\n\t\tonChange = new Dispatcher();\n\t\t\n\t\tsuper();\n\t\t_items = new Array();\n\t\t\n\t\t_scrollRect = new flash.geom.Rectangle(0, 0, 290, 70);\n\t\t_itemContainer = new Container();\n\t\t_itemContainer.x = 9;\n\t\t_itemContainer.y = 2;\n\t\t_itemContainer._implComponent.scrollRect = _scrollRect;\n\t\tadd(_itemContainer);\n\t\t\n\t\t_selectedRect = new Rectangle(0xccf3e728, 287, 15);\n\t\t_itemContainer.add(_selectedRect);\n\t\t_selectedRect.x = -2;\n\t\t_selectedRect.visible = false;\n\t\t\n\t\t_scrollButton = new Button();\n\t\t_scrollButton.add(new Image(com.huey.assets.AssetManager.instance.getAsset(\"btnDragger\")));\n\t\t_scrollButton.x = 295;\n\t\t_scrollButton.y = 5;\n\t\t_scrollButton.visible = false;\n\t\t_scrollButton.onMouseDown.add(function(_) {\n\t\t\tflash.Lib.current.stage.addEventListener(flash.events.MouseEvent.MOUSE_MOVE, mouseMoveHandler, false, 0, true);\n\t\t\tmouseMoveHandler(null);\n\t\t});\n\t\t_scrollButton.onMouseUp.add(function(_) {\n\t\t\tflash.Lib.current.stage.removeEventListener(flash.events.MouseEvent.MOUSE_MOVE, mouseMoveHandler);\n\t\t});\n\t\t_implComponent.addEventListener(flash.events.MouseEvent.MOUSE_WHEEL, mouseWheelHandler);\n\t\tadd(_scrollButton);\n\t}\n\t\n\tprivate function mouseWheelHandler(e) {\n\t\tif(_items.length <= 4) return;\n\t\t_scrollButton.y -= e.delta;\n\t\tupdateScrollRect();\n\t\te.updateAfterEvent();\n\t}\n\t\n\tprivate function mouseMoveHandler(e) {\n\t\t_scrollButton.y = _implComponent.mouseY;\n\t\tupdateScrollRect();\n\t\tif(e != null) e.updateAfterEvent();\n\t}\n\n\tprivate function updateScrollRect() {\n\t\tif(_scrollButton.y < 5) _scrollButton.y = 5;\n\t\tif(_scrollButton.y > 55) _scrollButton.y = 55;\n\t\t_scrollRect.y = 16 * (_items.length - 4) * (_scrollButton.y - 4) / 50;\n\t\t_itemContainer._implComponent.scrollRect = _scrollRect;\n\t}\n\t\n\tprivate function updateScroll() {\n\t\t_scrollButton.visible = _items.length > 4;\n\t\t_scrollButton.y = 5 + (_scrollRect.y * 50) / (16 * (_items.length - 4));\n\t\tif(_scrollButton.y < 5) _scrollButton.y = 5;\n\t\tif(_scrollButton.y > 55) { _scrollButton.y = 55; updateScrollRect(); }\n\t}\n\t\n\tpublic function addItem(item : Dynamic, ?label : String) : Void {\n\t\tvar comp = new Container();\n\t\tvar labelComp = new Label();\n\t\tlabelComp.text = if(Reflect.hasField(item, \"label\")) Reflect.getProperty(item, \"label\") else Std.string(item);\n\t\tcomp.x = 0;\n\t\tcomp.y = _items.length * 14;\n\t\t// TODO\n\t\tlabelComp.x = 15;\n\t\tlabelComp.font = \"AdvoCut_10pt_st\";\n\t\tlabelComp.size = 10;\n\t\tlabelComp.color = 0x425137;\n\t\tlabelComp.autoSize = false;\n\t\tlabelComp.width = 266;\n\t\tcomp.add(labelComp);\n\t\tuntyped comp._implComponent.buttonMode = true;\n\t\tuntyped comp._implComponent.mouseChildren = false;\n\t\tcomp.onClick.add( function(i) {return function(e) selectedIndex = i;}(_items.length) );\n\t\tvar str = Std.string(_items.length + 1);\n\t\tif(str.length < 2) str = \"0\" + str;\n\t\tlabelComp = new Label(str);\n\t\tlabelComp.font = \"AdvoCut_10pt_st\";\n\t\tlabelComp.size = 10;\n\t\tlabelComp.color = 0xD16436;\n\t\tlabelComp.width = 20;\n\t\tlabelComp.x = 0;\n\t\tcomp.add(labelComp);\n\t\t_itemContainer.add(comp);\n\t\t_items.push( { data : item, label: comp, view: comp, number: labelComp} );\n\t\t\n\t\tupdateScroll();\n\t}\n\n\tpublic function removeItemAt(i : Int) : Void {\n\t\tvar item = _items[i];\n\t\tif(item != null) {\n\t\t\t_itemContainer.remove(item.label);\n\t\t\t_items.splice(i, 1);\n\t\t\titems.splice(i, 1);\n\t\t\t\n\t\t\tfor(j in i..._items.length) {\n\t\t\t\tvar str = Std.string(j + 1);\n\t\t\t\tif(str.length < 2) str = \"0\" + str;\n\t\t\t\t_items[j].view.y = j * 14;\n\t\t\t\t_items[j].number.text = str;\n\t\t\t}\n\t\t\t\n\t\t\tif(i == selectedIndex) {\n\t\t\t\tif(i > _items.length - 1) i = _items.length - 1;\n\t\t\t\tselectedIndex = i;\n\t\t\t}\n\t\t\t\n\t\t\tupdateScroll();\n\t\t}\n\t}\n\n\tpublic var items(default, set) : Array<Dynamic>;\n\tprivate function set_items( v : Array<Dynamic> ) : Array<Dynamic> {\n\t\tfor (item in _items)\n\t\t\t_itemContainer.remove(item.label);\n\t\t\n\t\t_items = [];\n\t\t\n\t\tfor (item in v)\n\t\t\taddItem(item);\n\t\t\t\n\t\tif (selectedIndex >= _items.length) {\n\t\t\tselectedIndex = _items.length - 1;\n\t\t}\n\t\t\t\n\t\treturn items = v;\n\t}\n\t\n\tprivate var _items : Array<ListItem>;\n\tprivate var _selectedRect : Rectangle;\n\tprivate var _itemContainer : Container;\n\tprivate var _scrollRect : flash.geom.Rectangle;\n\tprivate var _scrollButton : Button;\n}\n\ntypedef ListItem = { label : Container, data : Dynamic, view : Container, number : Label };"
  },
  {
    "path": "huey/src/com/huey/ui/NumericStepper.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.ui;\nimport com.huey.events.Dispatcher;\n\nclass NumericStepper extends Container {\n\t@forward(_textBox) public var font : String;\n\t@forward(_textBox) public var size : Float;\n\t@forward(_textBox) public var color : Int;\n\t\n\tpublic var minimum : Float;\n\tpublic var maximum : Float;\n\tpublic var step : Float = 1;\n\n\tpublic var onChange(default, null) : Dispatcher<UIEvent>;\n\tpublic var onUserChange(default, null) : Dispatcher<UIEvent>;\n\t\n\t@bindable public var value(default, set) : Float;\n\tprivate function set_value(v : Float) : Float {\n\t\tvalue = v;\n\t\tif(Math.isNaN(value)) value = 0;\n\t\t\n\t\tif(value < minimum) value = minimum;\n\t\telse if(value > maximum) value = maximum;\n\n\t\tif(_textBox != null) _textBox.text = Std.string(value);\n\t\t\n\t\tonChange.dispatch({source: this});\n\t\t\n\t\treturn value;\n\t}\n\t\n\tpublic function new() {\n\t\tsuper();\n\t\tonChange = new Dispatcher();\n\t\tonUserChange = new Dispatcher();\n\t\tvalue = 0;\n\t\tminimum = Math.NEGATIVE_INFINITY;\n\t\tmaximum = Math.POSITIVE_INFINITY;\n\t}\n\n\tpublic var textX(default, set) : Float;\n\tprivate function set_textX(v : Float) : Float { return _textBox.x = v; }\n\t\n\tpublic var textY(default, set) : Float;\n\tprivate function set_textY(v : Float) : Float { return _textBox.y = v; }\n\t\n\tpublic var _textBox(default, set) : TextBox;\n\tprivate function set__textBox(v) {\n\t\t_textBox = v;\n\t\t_textBox.onUserEdited.add(function(_) { value = Std.parseFloat(_textBox.text); onUserChange.dispatch({source: this});});\n\t\tvalue = value;\n\t\t_textBox.allowedCharacters = \"0123456789\";\n\t\t\n\t\treturn _textBox;\n\t}\n\n\tpublic var incButton(default, set) : Button;\n\tprivate function set_incButton(v : Button) : Button {\n\t\tadd(v);\n\t\tv.onClick.add(function(_) {value+=step; onUserChange.dispatch({source: this});} );\n\t\treturn incButton = v;\n\t}\n\tpublic var decButton(default, set) : Button;\n\tprivate function set_decButton(v : Button) : Button {\n\t\tadd(v);\n\t\tv.onClick.add(function(_) {value-=step; onUserChange.dispatch({source: this});} );\n\t\treturn decButton = v;\n\t}\n}"
  },
  {
    "path": "huey/src/com/huey/ui/ProgressBar.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.ui;\n\nclass ProgressBar extends Slider {\n\tpublic function new()  {\n\t\tsuper();\n\t\tminimum = 0;\n\t\tmaximum = 100;\n\t\tuntyped _implComponent.mouseEnabled = _implComponent.tabEnabled = false;\n\t}\n\t\n\toverride private function updateNub() : Void {\n\t\tuntyped {\n\t\t\t_implComponent.scrollRect = new flash.geom.Rectangle(0, 0, 567 * (value - minimum) / (maximum - minimum), 13);\n\t\t}\n\t}\n\n\t\n}"
  },
  {
    "path": "huey/src/com/huey/ui/RadioButton.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.ui;\n\nclass RadioButton extends CheckBox {\n\tpublic var group : RadioGroup;\n\t\n\tpublic function new() {\n\t\tsuper();\n\t}\n\t\n\tprivate override function clickHandler(e) : Void {\n\t\tif(group != null && group.selectedItem != null) group.selectedItem.selected = false;\n\t\tselected = true;\n\t\tif(group != null) group.selectedItem = this;\n\t\tupdateState();\n\t}\n}"
  },
  {
    "path": "huey/src/com/huey/ui/RadioGroup.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.ui;\nimport com.huey.events.Dispatcher;\n\nclass RadioGroup extends com.huey.binding.Binding.Bindable {\n\tpublic function new() {\n\t\tonChange = new Dispatcher();\n\t\tsuper();\n\t\titems = new Array();\n\t}\n\t\n\tpublic var onChange : Dispatcher<Dynamic>;\n\t\n\tpublic var items : Array<RadioButton>;\n\t@bindable public var selectedItem(default, set_selectedItem) : Null<RadioButton> = null;\n\tprivate inline function set_selectedItem(v) {\n\t\tselectedItem = v;\n\t\tonChange.dispatch(null);\n\t\treturn v;\n\t}\n}"
  },
  {
    "path": "huey/src/com/huey/ui/Rectangle.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.ui;\n\nclass Rectangle extends Component {\n\tpublic function new(color : Int, width : Float, height : Float) {\n\t\tvar shape = new flash.display.Shape();\n\t\tshape.graphics.beginFill(color, (color >>> 24) / 255.0);\n\t\tshape.graphics.drawRect(0, 0, width, height);\n\t\tshape.graphics.endFill();\n\t\tsuper(shape);\n\t}\n}"
  },
  {
    "path": "huey/src/com/huey/ui/ScaledImage.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.ui;\n\nclass ScaledImage extends Container {\n\tpublic var scaleMode(default, set_scaleMode) : ScaleMode;\n\tprivate function set_scaleMode(v) {\n\t\tscaleMode = v;\n\t\tupdateSize();\n\t\treturn v;\n\t}\n\t\n\tprivate var _width : Int;\n\tprivate var _height : Int;\n\t\n\tprivate function updateSize() {\n\t\tif((untyped _image._implImage) == null) return;\n\t\t_implComponent.scrollRect = new flash.geom.Rectangle(0, 0, _width, _height);\n\t\tvar desiredAspect = _width / _height;\n\t\tvar actualAspect = untyped _image._implImage.width / _image._implImage.height;\n\t\tswitch(scaleMode) {\n\t\t\tcase crop:\n\t\t\t\tif(actualAspect > desiredAspect) {\n\t\t\t\t\t_image.height = _height;\n\t\t\t\t\t_image.width = _height * actualAspect;\n\t\t\t\t\t_image.x = (_height * actualAspect - _width)/2;\n\t\t\t\t\t_image.y = 0;\n\t\t\t\t} else {\n\t\t\t\t\t_image.width = _width;\n\t\t\t\t\t_image.height = _implComponent.width / actualAspect;\n\t\t\t\t\t_image.x = 0;\n\t\t\t\t\t_image.y = (_width / actualAspect - _height)/2;\n\t\t\t\t}\n\t\t\tcase letterbox:\n\t\t\t\tif(actualAspect > desiredAspect) {\n\t\t\t\t\t_image.width = _width;\n\t\t\t\t\t_image.height = _width / actualAspect;\n\t\t\t\t\t_image.x = 0;\n\t\t\t\t\t_image.y = (_height - _width / actualAspect)/2;\n\t\t\t\t} else {\n\t\t\t\t\t_image.height = _height;\n\t\t\t\t\t_image.width = _height * actualAspect;\n\t\t\t\t\t_image.x = (_width - _height * actualAspect)/2;\n\t\t\t\t\t_image.y = 0;\n\t\t\t\t}\n\t\t\tcase stretch:\n\t\t\t\t_image.width = _width;\n\t\t\t\t_image.height = _height;\n\t\t\t\t_image.x = _image.y = 0;\n\t\t}\n\t}\n\t\n\tprivate var _width : Float;\n\tprivate var _height : Float;\n\t\n\toverride  private function set_width(v) {\n\t\t_width = v;\n\t\tupdateSize();\n\t\treturn v;\n\t}\n\toverride private function set_height(v) {\n\t\t_height = v;\n\t\tupdateSize();\n\t\treturn v;\n\t}\n\t\n\tpublic function new(source : com.huey.assets.Asset) {\n\t\tsuper();\n\t\t_image = new Image(source);\n\t\tadd(_image);\n\t\tscaleMode = letterbox;\n\t}\n\t\n\tprivate var _image : Image;\n}\n\nenum ScaleMode {\n\tcrop;\n\tletterbox;\n\tstretch;\n}"
  },
  {
    "path": "huey/src/com/huey/ui/SelectBox.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.ui;\nimport com.huey.assets.AssetManager;\nimport com.huey.events.Dispatcher;\nimport com.huey.events.Dispatcher;\nimport com.huey.ui.Image;\n\nclass SelectBox extends Container {\n\t@forward(_listBox) public var items : Array<Dynamic>;\n\t@forward(_listBox) public var selectedItem : Dynamic;\n\t@forward(_listBox) public var selectedIndex : Dynamic;\n\t\n\tpublic var onChange(default, null) : Dispatcher<UIEvent>;\n\t\n\tpublic function new() {\n\t\tsuper();\n\t\t\n\t\tvar assetManager = AssetManager.instance;\n\t\t_listBoxBg = new Image(assetManager.getAsset(\"listBoxBigBG\"));\n\t\t_listBoxBg.visible = false;\n\t\t_listBoxBg.y = 22;\n\t\tadd(_listBoxBg);\n\t\t\n\t\t_listBox = new ListBox();\n\t\t_listBox.visible = false;\n\t\t_listBox.y = 22;\n\t\t_listBox.onChange.add(listBoxChangeHandler);\n\t\tadd(_listBox);\n\t\t\n\t\t_textBoxBg = new Image(assetManager.getAsset(\"textFieldBig\"));\n\t\tadd(_textBoxBg);\n\t\t_textBox = new Label();\n\t\t_textBox.width = 312;\n\t\t_textBox.x = 8;\n\t\t_textBox.y = 1;\n\t\t_textBox.font = \"AdvoCut_10pt_st\";\n\t\t_textBox.size = 10;\n\t\t_textBox.bold = true;\n\t\t_textBox.color = 0x425137;\n\t\tadd(_textBox);\n\t\t\n\t\t_showButton = new Button();\n\t\t_showButton.upState = new Image(assetManager.getAsset(\"btnDecUp\"));\n\t\t_showButton.overState = new Image(assetManager.getAsset(\"btnDecOver\"));\n\t\t_showButton.downState = new Image(assetManager.getAsset(\"btnDecDown\"));\n\t\t_showButton.x = 309;\n\t\t_showButton.hitArea = Rectangle(-309, 0, 329, 25);\n\t\t_textBoxBg.onClick.add(showButtonClickHandler);\n\t\t_showButton.onClick.add(showButtonClickHandler);\n\t\tadd(_showButton);\n\t\t\n\t\tonChange = new Dispatcher();\n\t\t_listBox.onChange.add(function(_) onChange.dispatch({source: this}));\n\t}\n\t\n\tprivate var _textBoxBg : Image;\n\tprivate var _textBox : Label;\n\tprivate var _listBoxBg : Image;\n\tprivate var _listBox : ListBox;\n\tprivate var _showButton : Button;\n\n\tprivate function showButtonClickHandler(_) {\n\t\t_listBox.visible = !_listBox.visible;\n\t\t_listBoxBg.visible = _listBox.visible;\n\t\tif(_listBox.visible) {\n\t\t\tflash.Lib.current.stage.addEventListener(flash.events.MouseEvent.CLICK, stageClickHandler, false, 0, false);\n\t\t} else {\n\t\t\tflash.Lib.current.stage.removeEventListener(flash.events.MouseEvent.CLICK, stageClickHandler);\n\t\t}\n\t}\n\t\n\tprivate function listBoxChangeHandler(_) {\n\t\t_listBox.visible = _listBoxBg.visible = false;\n\t\t_textBox.text = Std.string(_listBox.selectedItem.label);\n\t\tflash.Lib.current.stage.removeEventListener(flash.events.MouseEvent.CLICK, stageClickHandler);\n\t}\n\t\n\tprivate function stageClickHandler(_) {\n\t\tvar c = flash.Lib.current.stage.focus;\n\t\twhile(c != null) {\n\t\t\tif(c == _implComponent) return;\n\t\t\tc = c.parent;\n\t\t}\n\t\t\n\t\t_listBox.visible = _listBoxBg.visible = false;\n\t\tflash.Lib.current.stage.removeEventListener(flash.events.MouseEvent.CLICK, stageClickHandler);\n\t}\n}"
  },
  {
    "path": "huey/src/com/huey/ui/Slider.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.ui;\n\nclass Slider extends Container {\n\t@bindable public var value(default, set) : Float;\n\tprivate function set_value(v : Float) : Float {\n\t\tif (step != 0) v = Math.round(v / step) * step;\n\t\tif (v < minimum) v = minimum;\n\t\tif (v > maximum) v = maximum;\n\t\tvalue = v;\n\t\tlabel.text = if(labelFunc != null) labelFunc(value) else Std.string(value);\n\t\tupdateNub();\n\t\treturn value;\n\t}\n\t\n\tpublic var minimum(default, set) : Float;\n\tprivate inline function set_minimum(v : Float) : Float {\n\t\tminimum = v;\n\t\tset_value( value );\n\t\treturn minimum;\n\t}\n\t\n\tpublic var maximum(default, set) : Float;\n\tprivate inline function set_maximum(v : Float) : Float {\n\t\tmaximum = v;\n\t\tset_value( value );\n\t\treturn maximum;\n\t}\n\t\n\tpublic var step(default, set) : Float;\n\tprivate inline function set_step(v : Float) : Float {\n\t\tif (v < 0 || Math.isNaN(v)) v = 0;\n\t\tstep = v;\n\t\tset_value( value );\n\t\treturn step;\n\t}\n\t\n\t@forward(label) public var font : String;\n\t@forward(label) public var size : Float;\n\t@forward(label) public var color : Int;\n\t@forward(label) public var bold : Bool;\n\t\n\tpublic var nubMinimum : Float = 5.0;\n\tpublic var nubMaximum : Float = 200.0;\n\t\n\tpublic var nub : Component;\n\t\n\tpublic var label : Label;\n\t\n\tpublic var labelFunc(default, set) : Float -> String;\n\tprivate function set_labelFunc(v) {\n\t\tlabelFunc = v;\n\t\tlabel.text = if (labelFunc != null) labelFunc(value) else Std.string(value);\n\t\treturn labelFunc;\n\t}\n\t\n\tpublic function new() {\n\t\tsuper();\n\t\tlabel = new Label();\n\t\tadd(label);\n\t\t\n\t\tvalue = minimum = 0.0;\n\t\tmaximum = 1.0;\n\t\tstep = 0;\n\t\t\n\t\tonMouseDown.add(mouseDownHandler);\n\t\tonMouseUp.add(mouseUpHandler);\n\t\t\n\t\tuntyped _implComponent.buttonMode = true;\n\t}\n\t\n\tprivate function updateNub() : Void {\n\t\tif(nub != null) nub.x = (nubMaximum - nubMinimum) * (value - minimum) / (maximum - minimum) + nubMinimum - nub.width / 2;\n\t}\n\t\n\tprivate function mouseDownHandler(_) : Void {\n\t\tflash.Lib.current.stage.addEventListener(flash.events.MouseEvent.MOUSE_MOVE, mouseMoveHandler, false, 0, true);\n\t\tmouseMoveHandler(null);\n\t}\n\t\n\tprivate function mouseUpHandler(_) : Void {\n\t\tflash.Lib.current.stage.removeEventListener(flash.events.MouseEvent.MOUSE_MOVE, mouseMoveHandler, false);\n\t}\n\t\n\tprivate function mouseMoveHandler(e) : Void {\n\t\tvalue = untyped { minimum + (maximum - minimum) * (_implComponent.mouseX - nubMinimum) / (nubMaximum-nubMinimum); };\n\t\tif(e != null) e.updateAfterEvent();\n\t}\n}"
  },
  {
    "path": "huey/src/com/huey/ui/StateContainer.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.ui;\nimport haxe.ds.StringMap;\n\nclass StateContainer extends Container {\n\tpublic var state(default, set) : String;\n\tprivate function set_state(v : String) : String {\n\t\tvar oldState = _states.get(state);\n\t\tif (oldState != null) {\n\t\t\tfor(child in oldState)\n\t\t\t\tremove(child);\n\t\t}\n\t\t\n\t\tvar newState = _states.get(v);\n\t\tif (newState != null) {\n\t\t\tfor (comp in newState) add(comp);\n\t\t}\n\n\t\treturn state = v;\n\t}\n\t\n\t\n\tprivate var _states : StringMap<UIState>;\n\t\n\tpublic function addToState(component : Component, state : String) : Void {\n\t\tif (!_states.exists(state)) _states.set(state, new UIState());\n\t\t_states.get(state).push(component);\n\t\tif (this.state == null) this.state = state;\n\t\telse if (state == this.state) add(component);\n\t}\n\n\tpublic function new() {\n\t\tsuper();\n\t\t_states = new StringMap();\n\t}\n}\n\ntypedef UIState = Array<Component>;"
  },
  {
    "path": "huey/src/com/huey/ui/TextAlign.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.ui;\n\nenum TextAlign {\n\tleft;\n\tcenter;\n\tright;\n\tjustify;\n}"
  },
  {
    "path": "huey/src/com/huey/ui/TextBox.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.ui;\nimport com.huey.events.Dispatcher;\n\nclass TextBox extends Container {\n\t@forward(_text) public var text : String;\n\t@forward(_text) public var font : String;\n\t@forward(_text) public var size : Float;\n\t@forward(_text) public var color : Int;\n\t@forward(_text) public var allowedCharacters : String;\n\t\n\tpublic var textX(default, set_textX) : Float;\n\tprivate function set_textX(v : Float) : Float {\n\t\treturn textX = _text.x = v;\n\t}\n\n\tpublic var textY(default, set_textY) : Float;\n\tprivate function set_textY(v : Float) : Float {\n\t\treturn textY = _text.y = v;\n\t}\n\t\n\toverride private function set_width(v : Float) {\n\t\t_text.width = v - textX*2;\n\t\treturn v;\n\t}\n\t\n\toverride private function set_height(v : Float) {\n\t\t_text.height = v - textY*2;\n\t\treturn v;\n\t}\n\t\n\tpublic var onUserEdited(default, null) : Dispatcher<UIEvent>;\n\t\n\tpublic function new() {\n\t\tonUserEdited = new Dispatcher();\n\t\tsuper();\n\t\t_text = new Label();\n\t\t_text.autoSize = false;\n\t\t_text.editable = true;\n\t\tadd(_text);\n\t\t_text.onUserEdited.add(function(_) onUserEdited.dispatch());\n\t}\n\t\n\tprivate var _text : Label;\n}"
  },
  {
    "path": "huey/src/com/huey/ui/UIEvent.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.ui;\n\ntypedef UIEvent = {\n\tvar source : Component;\n};"
  },
  {
    "path": "huey/src/com/huey/ui/UIMacros.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.ui;\nimport haxe.macro.Context;\nimport haxe.macro.Expr;\nimport haxe.macro.Type;\n\n@:macro class UIMacros\n{\n\n\tpublic static function buildComponent() : Array<Field> {\n\t\tvar cl : ClassType = Context.getLocalClass();\n\t\tvar fields : Array<Field> = Context.getBuildFields();\n\t}\n\t\n}"
  },
  {
    "path": "huey/src/com/huey/utils/Assert.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.utils;\n\nclass Assert\n{\n\tinline public static function assertNull<T>(v : T, ?message : String) : Void {\n\t\tif (v != null) {\n\t\t\tthrow 'assertNull failed!\\n$message';\n\t\t}\n\t}\n\t\n\tinline public static function assertNotNull<T>(v : T, ?message : String) : Void {\n\t\tif (v == null) {\n\t\t\tthrow 'assertNotNull failed!\\n$message';\n\t\t}\n\t}\n\t\n\tinline public static function assertTrue(b : Bool, ?message : String) : Void {\n\t\tif (!b) {\n\t\t\tthrow 'assertTrue failed! $message';\n\t\t}\n\t}\n\t\n\tinline public static function assertFalse(b : Bool, ?message : String) : Void {\n\t\tif (b) {\n\t\t\tthrow 'assertFalse failed! $message';\n\t\t}\n\t}\n\t\n\tinline public static function assertEqual<T>(expected : T, actual : T, ?message : String) : Void {\n\t\tif (expected != actual) {\n\t\t\tthrow 'assertEqual failed! $expected != $actual\\n$message';\n\t\t}\n\t}\n\t\n\tinline public static function assertNotEqual<T>(expected : T, actual : T, ?message : String) : Void {\n\t\tif (expected == actual) {\n\t\t\tthrow 'assertNotEqual failed! $expected == $actual\\n$message';\n\t\t}\n\t}\n}"
  },
  {
    "path": "huey/src/com/huey/utils/Logger.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.utils;\nimport flash.filesystem.File;\nimport flash.filesystem.FileMode;\nimport flash.filesystem.FileStream;\nimport haxe.ds.StringMap;\nimport haxe.macro.Expr;\n\nclass Logger {\n\tinline public static function log(name : String, msg : String) {\n\t\tLogger.getInstance(name).logMessage(msg);\n\t}\n\t\n\tinline public static function getLog(name : String) : String {\n\t\treturn Logger.getInstance(name).get();\n\t}\n\t\n\tprivate static var loggers : StringMap<Logger> = new StringMap();\n\tinline public static function getInstance(name : String) {\n\t\tvar logger = loggers.get(name);\n\t\tif(logger == null) {\n\t\t\tlogger = new Logger(name, File.applicationStorageDirectory.resolvePath('$name.txt').nativePath);\n\t\t\tloggers.set(name, logger);\n\t\t}\n\t\treturn logger;\n\t}\n\t\n\tprivate var name : String;\n\tprivate var logFile : File;\n\tprivate var outputStream : FileStream;\n\t\n\tprivate function new(name : String, outputFile : String) {\n\t\tthis.name = name;\n\t\tlogFile = new File(outputFile);\n\t\t\n\t\ttry {\n\t\t\tif(logFile.exists) logFile.deleteFile();\n\t\t\toutputStream = new FileStream();\n\t\t\toutputStream.open(logFile, FileMode.UPDATE);\n\t\t} catch(_ : Dynamic) {\n\t\t\toutputStream = null;\n\t\t}\n\t}\n\t\n\tpublic function logMessage(msg : String) {\n\t\t#if debug\n\t\t\ttrace('$msg');\n\t\t#end\n\t\tif(outputStream != null) {\n\t\t\ttry outputStream.writeUTFBytes(msg) catch(_ : Dynamic) {}\n\t\t}\n\t}\n\t\n\tpublic function get() : String {\n\t\t//var inputStream = new FileStream();\n\t\ttry {\n\t\t\t//inputStream.open(logFile, FileMode.READ);\n\t\t\toutputStream.position = 0;\n\t\t\tvar data = outputStream.readUTFBytes(outputStream.bytesAvailable);\n\t\t\t//inputStream.close();\n\t\t\treturn data;\n\t\t} catch(_ : Dynamic) return \"\";\n\t}\n\t\n}"
  },
  {
    "path": "huey/src/com/huey/utils/Thread.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.utils;\n\nimport flash.events.Event;\nimport flash.system.Worker;\nimport flash.system.WorkerDomain;\nimport flash.system.WorkerState;\n\n#if flash9\nclass Thread {\n\tpublic var state(default, null) : ThreadState;\n\n\tprivate var _worker : Worker;\n\n\t// MIKE: swf width and height for flash only\n\tpublic static function spawn(entryPoint : String) : Thread {\n\t\tvar thread = new Thread(WorkerDomain.current.createWorker(flash.Lib.current.loaderInfo.bytes, true));\n\t\tthread.setProperty(\"entryPoint\", entryPoint);\n\t\treturn thread;\n\t}\n\n\tpublic static var current(get, null) : Thread;\n\tprivate static function get_current() : Thread {\n\t\tif(current == null) {\n\t\t\tcurrent = new Thread(Worker.current);\n\t\t}\n\t\treturn current;\n\t}\n\n\tprivate function new(worker : flash.system.Worker) {\n\t\t_worker = worker;\n\t\tworkerStateHandler(null);\n\t\t_worker.addEventListener(Event.WORKER_STATE, workerStateHandler);\n\t}\n\n\tpublic function start() : Void {\n\t\t_worker.start();\n\t}\n\n\tpublic function getProperty(key : String) : Dynamic {\n\t\treturn _worker.getSharedProperty(key);\n\t}\n\n\tpublic function setProperty(key : String, value : Dynamic) : Void {\n\t\t_worker.setSharedProperty(key, value);\n\t}\n\n\tprivate function workerStateHandler(e : Event) : Void {\n\t\tstate = switch(_worker.state) {\n\t\t\tcase NEW:\t\t\tstopped;\n\t\t\tcase RUNNING:\t\trunning;\n\t\t\tcase TERMINATED:\tterminated;\n\t\t}\n\t}\n}\n\n#else\n\n#error Threads not implemented on this platform\n\n#end\n\nenum ThreadState {\n\tstopped;\n\trunning;\n\tterminated;\n}"
  },
  {
    "path": "huey/src/com/huey/utils/WeakRef.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.utils;\n\n#if flash9\n\nclass WeakRef<T>\n{\n\tprivate var _dictionary : flash.utils.TypedDictionary<T, Int>;\n\t\n\tpublic function new(object : T) {\n\t\t_dictionary = new flash.utils.TypedDictionary(true);\n\t\tif (object != null)\n\t\t\t_dictionary.set(object, 1);\n\t}\n\t\n\tpublic function get() : Null<T> {\n\t\tfor (key in _dictionary.keys())\n\t\t\tif (key != null) return key;\n\t\treturn null;\n\t}\n}\n\n#else\n\nclass WeakRef<T>\n{\n\tprivate var _object : T;\n\t\n\tpublic function new(object : T) {\n\t\t_object = t;\n\t}\n\t\n\tinline public function get() : Null<T> {\n\t\treturn _object;\n\t}\n}\n\n#end"
  },
  {
    "path": "huey/test/com/huey/assets/AssetTests.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.assets;\nimport com.huey.tests.TestSuite;\n\nclass AssetTests extends TestSuite\n{\n\t@test public function testAsset() : Void {\n\t\tvar asset : Asset = new Asset(\"myAsset\", Internal(\"Foo\"));\n\t}\n\t\n\t@test public function testAssetManager() : Void {\n\t\tvar assetManager : AssetManager = new AssetManager();\n\t\tassetManager.registerAsset( new Asset(\"myAsset\", Internal(\"Foo\")) );\n\t}\n\t\n\t/** Tests AssetSource. */\n\t@test public function testInternalAssetSource() {\n\t\tvar asset : AssetSource;\n\t\tasset = Internal(\"Foo\");\n\t}\n\t\n\t@test public function testExternalAssetSource() {\n\t\tvar asset : AssetSource;\n\t\tasset = External(\"Foo\");\n\t}\n}"
  },
  {
    "path": "huey/test/com/huey/binding/BindingTests.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.binding;\nimport com.huey.tests.TestSuite;\nimport com.huey.binding.Binding;\n\n/**\n * Tests the data binding framework.\n * @author Newgrounds.com, Inc.\n */\nclass BindingTests extends TestSuite\n{\n\t/** Tests binding to a member variable. */\n\t@test public function testBindingVariable() {\n\t\tvar a = new BindObject();\n\t\tvar b = new BindObject();\n\t\tBinding.bind(b.foo, a.foo);\n\t\ta.foo = 10;\n\t\tassertEqual(10, b.foo, \"Variable change did not propogate.\");\n\t}\n\t\n\t/** Tests binding to a property. */\n\t@test public function testBindingProperty() {\n\t\tvar a = new BindObject();\n\t\tvar b = new BindObject();\n\t\tBinding.bind(b.bar, a.bar);\n\t\ta.bar = \"blah\";\n\t\tassertEqual(\"blah\", b.bar, \"Property change did not propogate.\");\n\t}\n\t\n\t/** Tests binding to a property with a setter. */\n\t@test public function testBindingPropertySetter() {\n\t\tvar a = new BindObject();\n\t\tvar b = new BindObject();\n\t\tBinding.bind(b.baz, a.baz);\n\t\ta.baz = 2.1;\n\t\tassertEqual(2.1, b.baz, \"Property change with setter did not propogate.\");\n\t\tassertTrue(b.setterCalled, \"Setter was not called on property change.\");\n\t}\n\t\n\t/**\n\t * Tests two-way binding to a variable.\n\t * Watch out for infinite recursions here.\n\t */\n\t@test public function testTwoWayBindingVariable() {\n\t\tvar a = new BindObject();\n\t\tvar b = new BindObject();\n\t\tBinding.bindTwoWay(b.foo, a.foo);\n\t\t\n\t\ta.foo = 10;\n\t\tassertEqual(10, b.foo, \"Variable change did not propogate.\");\n\n\t\tb.foo = 20;\n\t\tassertEqual(20, a.foo, \"Variable change did not propogate.\");\n\t}\n\t\n\t@test public function textExpressionBinding() {\n\t\tvar a = new BindObject();\n\t\tvar b = new BindObject();\n\t\tBinding.bind(b.foo, a.foo * 2);\n\t\t\n\t\ta.foo = 2;\n\t\tassertEqual(4, b.foo, \"Variable change did not propogate\");\n\t}\n\t\n\t/** Test deep binding. */\n\t@test public function testDeepBinding() {\n\t\tvar a = new BindObject();\n\t\tvar b = new BindObject();\n\t\tBinding.bindTwoWay(b.baz, a.child.x);\n\t\t\n\t\ta.child.x = -1.0;\n\t\ta.child = new BindObject2();\n\t\tassertEqual(0.0, b.baz, \"Subcomponent variable change did not propogate.\");\n\t\ta.child.x = 1.0;\n\t\tassertEqual(1.0, b.baz, \"Subcomponent variable change did not propogate.\");\n\t}\n\n\t/** Test bindable arrays. */\n\t@test public function testBindableArray() {\n\t\tvar a = new BindObject();\n\t\tvar b = new BindObject2();\n\t\tBinding.bind(b.array, a.array);\n\t\ta.array = BindableArray.fromArray([1, 2]);\n\t\tassertEqual(1, b.array.array[0]);\n\t\tassertEqual(2, b.array.array[1]);\n\t\tassertEqual(2, b.array.length);\n\t\tassertEqual(3, b.sum);\n\t\t\n\t\ta.array.push(3);\n\t\tassertEqual(3, b.array.array[2]);\n\t\tassertEqual(3, b.array.length);\n\t\tassertEqual(6, b.sum);\n\t}\n}\n\nprivate class BindObject extends Binding.Bindable\n{\n\t@bindable public var foo : Int;\n\t@bindable public var bar(default, default) : String;\n\t@bindable public var baz(getBaz, setBaz) : Float;\n\t@bindable public var child : BindObject2;\n\t@bindable public var array : BindableArray<Int>;\n\t\n\tpublic var setterCalled : Bool;\n\t\n\tpublic function new() {\n\t\tsuper();\n\t\tchild = new BindObject2();\n\t\tsetterCalled = false;\n\t}\n\t\n\tprivate function getBaz()\t{ return baz; }\n\tprivate function setBaz(x)\t{ setterCalled = true;  return baz = x; }\n}\n\nprivate class BindObject2 extends Binding.Bindable\n{\n\tpublic var array(default, set_array) : BindableArray<Int>;\n\tprivate function set_array(v) {\n\t\tarray = v;\n\t\tsum = 0;\n\t\tif (array != null)\n\t\t\tfor (i in array) sum += i;\n\t\treturn array;\n\t}\n\t\n\tpublic function new() {\n\t\tsuper();\n\t\tx = 0.0;\n\t}\n\t\n\t@bindable public var x : Float;\n\tpublic var sum : Int;\n}"
  },
  {
    "path": "huey/test/com/huey/core/ApplicationTests.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.core;\nimport com.huey.tests.TestSuite;\nimport com.huey.core.Application;\n\nclass ApplicationTests extends TestSuite\n{\n\t@test private function testApplication() : Void {\n\t\tvar app : Application = new SimpleApplication();\n\t\t\n\t\tassertNotNull(app.buildTime);\n\t\tassertNotNull(app.ui, \"UI should be initialized.\");\n\t}\n}\n\n@layout(\"layout.xml\")\nprivate class SimpleApplication extends Application {\n\tpublic function new() {\n\t\tsuper();\n\t}\n}"
  },
  {
    "path": "huey/test/com/huey/events/EventTests.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.events;\nimport com.huey.tests.TestSuite;\nimport com.huey.events.Dispatcher;\n\n/**\n * Tests the event handling system.\n */\nclass EventTests extends TestSuite {\n\t\n\t/** Tests dispatch instantiation and default values. */\n\t@test public function testDispatcher() {\n\t\tvar dispatcher = new Dispatcher();\n\t\tassertEqual(0, dispatcher.numListeners, \"A dispatcher should start with 0 listeners.\");\n\t}\n\t\n\t/**\n\t * Tests listener registration and dispatch.\n\t * Verifies that the listener is called when an event is dispatched.\n\t */\n\t@test public function testDispatch() {\n\t\tvar dispatcher = new Dispatcher();\n\t\tvar called = false;\n\t\tvar eventArg = { x: 3 };\n\t\tfunction listener(e) {\n\t\t\tcalled = true;\n\t\t\tassertEqual(eventArg, e, \"Event parameter was not dispatched\");\n\t\t}\n\t\t\n\t\tdispatcher.add(listener);\n\t\tdispatcher.dispatch(eventArg);\n\t\tassertTrue(called, \"Listener was not called after dispatch().\");\n\t}\n\t\n\t/** Tests removal of a listener */\n\t@test public function testRemove() {\n\t\tvar dispatcher = new Dispatcher();\n\t\tvar calls = 0;\n\t\tfunction listener(e) { throw \"Listener remains after remove().\"; }\n\t\tdispatcher.add(listener);\n\t\tdispatcher.remove(listener);\n\t\t\n\t\tdispatcher.dispatch();\n\t\tassertEqual(calls, 0);\n\t}\n\t\n\t/** Test numListeners count */\n\t@test public function testNumListeners() {\n\t\tvar dispatcher = new Dispatcher();\n\t\t\n\t\tfunction listener(e) { }\n\t\tassertEqual(0, dispatcher.numListeners);\n\t\tdispatcher.add(listener);\n\t\tassertEqual(1, dispatcher.numListeners);\n\t\tdispatcher.remove(listener);\n\t\tassertEqual(0, dispatcher.numListeners);\n\t\t\n\t\tdispatcher.add(listener);\n\t\tdispatcher.add(function (event) { } );\n\t\tassertEqual(2, dispatcher.numListeners);\n\t}\n\t\n\t/**\n\t * Tests that a listener may only be added once\n\t * Subsequent adds fail silently\n\t */\n\t@test public function testAddOnlyOnce() {\n\t\tvar dispatcher = new Dispatcher();\n\t\tvar calls = 0;\n\t\tfunction listener(e) { calls++; }\n\t\t\n\t\tdispatcher.add(listener);\n\t\tdispatcher.add(listener);\n\t\tdispatcher.dispatch();\n\t\tassertEqual(1, calls, \"A listener should not be added to a dispatcher twice.\");\n\t}\n\t\n\t/** Tests dispatcher.removeAll(). */\n\t@test public function testRemoveAll() {\n\t\tfunction listener1(e) { throw \"Listener remains after removeAll().\"; }\n\t\tfunction listener2(e) { throw \"Listener remains after removeAll().\"; }\n\t\tvar dispatcher = new Dispatcher();\n\t\tdispatcher.add(listener1);\n\t\tdispatcher.add(listener2);\n\t\tdispatcher.removeAll();\n\t\tdispatcher.dispatch();\n\t}\n\t\n\t/** Tests dispathcer.has(). */\n\t@test public function testHas() {\n\t\tfunction listener(e) { }\n\t\t\n\t\tvar dispatcher = new Dispatcher();\n\t\tassertFalse( dispatcher.has(listener) );\n\t\tdispatcher.add( listener );\n\t\tassertTrue( dispatcher.has(listener) );\n\t}\n}"
  },
  {
    "path": "huey/test/com/huey/macros/MacroTests.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.macros;\nimport com.huey.tests.TestSuite;\nimport haxe.macro.Expr;\n\nclass MacroTests extends TestSuite\n{\n\tprivate var _builder : ClassBuilder;\n\t\n\toverride public function setUp() {\n\t\t_builder = new ClassBuilder();\n\t\t\n\t\tvar pos : Position = { min: 0, max: 1, file: \"Test.hx\" };\n\t\t\n\t\tvar field = new FieldInfo(\"field1\");\n\t\tfield.addMeta(\"meta1\");\n\t\t\n\t\t_builder.addField( field );\n\t}\n\t\n\t@test private function testMetaHelpers() : Void {\n\t\tassertNotNull( _builder.getField(\"foo\") );\n\t\t\n\t\tvar fields = _builder.getFieldsWithMeta(\"meta1\");\n\t\tassertEqual(1, fields.length);\n\t\tassertEqual(fields[0].name, \"foo\");\n\t}\n\t\n\t@test private function testForward() : Void {\n\t\tvar obj = new BuildTest();\n\t\tassertEqual(obj.x, 1, \"Property forwarding getter failed.\");\n\t\tobj.x = 2;\n\t\tassertEqual(obj.sub.x, 2, \"Property forwarding setter failed.\");\n\t\t\n\t\tassertEqual(obj.y, 1, \"Property forwarding getter failed.\");\n\t\tobj.y = 2;\n\t\tassertEqual(obj.sub.x, 2, \"Property forwarding setter failed.\");\n\t}\n\t\n\t\n\t/*@test private function testInjectMethod() : Void {\n\t\tvar test = new BuildTest2();\n\t\tassertEqual(1, test.x, \"Method injection failed.\");\n\t\ttest.foo();\n\t\tassertEqual(2, test.x, \"Method injection failed.\");\n\t}*/\n\n}\n\n\n@:build(com.huey.macros.Macros.build())\nprivate class BuildTest\n{\n\tpublic var sub : Subcomponent;\n\tpublic var sub2 : Subcomponent;\n\t\n\t@forward(sub) public var x : Int;\n\t@forward(sub2.x) public var y : Int;\n\t\n\tpublic function new() {\n\t\tsub = new Subcomponent();\n\t\tsub2 = new Subcomponent();\n\t}\n}\n\nprivate class Subcomponent\n{\n\tpublic var x : Int = 1;\n\t\n\tpublic function new() { }\n}"
  },
  {
    "path": "huey/test/com/huey/ui/UITests.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.ui;\nimport com.huey.tests.TestSuite;\nimport com.huey.ui.Component;\nimport com.huey.ui.UIContainer;\nimport com.huey.ui.UIFactory;\n\nclass UITests extends TestSuite\n{\n\tprivate var _factory : UIFactory;\n\t\n\toverride public function setUp() {\n\t\t_factory = new UIFactory();\n\t}\n\t\n\t/** Tests Component instantiation and interface. */\n\tpublic function testComponentDefaults(component : Component) {\n\t\tassertNull(component.parent, \"Parent should be null on instantiation.\");\n\t\tassertTrue(component.visible, \"Component should default to visible.\");\n\t\tassertEqual(0.0, component.x, \"Position should default to (0, 0).\");\n\t\tassertEqual(0.0, component.y, \"Position should default to (0, 0).\");\n\t\tassertEqual(0.0, component.depth, \"Depth should default to 0.\");\n\t}\n\t\n\t/** Tests UIContainer instantiation and add/remove children. */\n\t@test public function testUIContainer() {\n\t\tvar parent : UIContainer = _factory.createContainer();\n\t\ttestComponentDefaults(parent);\n\t\t\n\t\tvar child : Component = _factory.createContainer();\n\t\ttestComponentDefaults(child);\n\t\t\n\t\tassertEqual(0, parent.numChildren, \"Parent should start with no children.\");\n\t\tparent.add(child);\n\t\tassertEqual(1, parent.numChildren, \"numChildren did not update after add.\");\n\t\tassertEqual(parent, child.parent, \"Child's parent was not updated after add.\");\n\t\t\n\t\tvar removed = parent.remove(child);\n\t\tassertTrue(removed, \"Child was not successfully removed.\");\n\t\tassertEqual(0, parent.numChildren, \"numChildren did not update after remove.\");\n\t}\n\t\n\t/** Tests Label control instantiation and properties. */\n\t@test public function testLabel() {\n\t\tvar label = _factory.createLabel();\n\t\tassertEqual(\"\", label.text, \"Label text should default to ''.\");\n\t}\n\t\n\t/** Tests Image control instantiation and properties. */\n\t@test public function testImage() {\n\t\tvar button = _factory.createImage();\n\t}\n}"
  },
  {
    "path": "huey/test/com/huey/utils/AssertTests.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.utils;\nimport com.huey.tests.TestSuite;\n\nclass AssertTests extends TestSuite\n{\n\t#if debug\n\t\n\t@test public function testAssertNull() : Void {\n\t\tvar threw : Bool;\n\t\tvar msg : String = \"msg\";\n\t\t\n\t\tthrew = false;\n\t\ttry Assert.assertNull(null) catch (_ : Dynamic) threw = true;\n\t\tif (threw) throw \"assertNull threw for null.\";\n\t\t\n\t\tthrew = false;\n\t\ttry Assert.assertNull(true) catch (_ : Dynamic) threw = true;\n\t\tif (!threw) throw \"assertNull didn't throw for non-null.\";\n\t\t\n\t\tthrew = false;\n\t\ttry Assert.assertNull(0) catch (_ : Dynamic) threw = true;\n\t\tif (!threw) throw \"assertNull didn't throw for 0.\";\n\t\t\n\t\tthrew = false;\n\t\ttry Assert.assertNull(false, msg) catch (error : Dynamic) {\n\t\t\tthrew = true;\n\t\t\tif (Std.string(error).indexOf(msg) == -1) throw \"assertNull didn't throw with the supplied message.\";\n\t\t}\n\t\tif (!threw) throw \"assertNull didn't throw for false.\";\n\t}\n\t\n\t@test public function testAssertNotNull() : Void {\n\t\tvar threw : Bool;\n\t\tvar msg : String = \"msg\";\n\t\t\n\t\tthrew = false;\n\t\ttry Assert.assertNotNull(null, msg) catch (error : Dynamic) {\n\t\t\tthrew = true;\n\t\t\tif (Std.string(error).indexOf(msg) == -1) throw \"assertNotNull didn't throw with the supplied message.\";\n\t\t}\n\t\tif (!threw) throw \"assertNotNull didn't throw for null.\";\n\t\t\n\t\tthrew = false;\n\t\ttry Assert.assertNotNull(true) catch (_ : Dynamic) threw = true;\n\t\tif (threw) throw \"assertNotNull threw for non-null.\";\n\t\t\n\t\tthrew = false;\n\t\ttry Assert.assertNotNull(0) catch (_ : Dynamic) threw = true;\n\t\tif (threw) throw \"assertNotNull threw for 0.\";\n\t\t\n\t\tthrew = false;\n\t\ttry Assert.assertNotNull(false, msg) catch (_ : Dynamic) threw = true;\n\t\tif (threw) throw \"assertNotNull threw for false.\";\n\t}\n\t\n\t@test public function testAssertTrue() : Void {\n\t\tvar threw : Bool;\n\t\tvar msg : String = \"msg\";\n\t\t\n\t\tthrew = false;\n\t\ttry Assert.assertTrue(false, msg) catch (error : Dynamic) {\n\t\t\tthrew = true;\n\t\t\tif (Std.string(error).indexOf(msg) == -1) throw \"assertTrue didn't throw with the supplied message.\";\n\t\t}\n\t\tif (!threw) throw \"assertTrue didn't throw for false.\";\n\t\t\n\t\tthrew = false;\n\t\ttry Assert.assertTrue(true) catch (_ : Dynamic) threw = true;\n\t\tif (threw) throw \"assertTrue threw for true.\";\n\t}\n\t\n\t@test public function testAssertFalse() : Void {\n\t\tvar threw : Bool;\n\t\tvar msg : String = \"msg\";\n\t\t\n\t\tthrew = false;\n\t\ttry Assert.assertFalse(false) catch (_ : Dynamic) threw = true;\n\t\tif (threw) throw \"assertFalse threw for true.\";\n\t\t\n\t\tthrew = false;\n\t\ttry Assert.assertFalse(true, msg) catch (error : Dynamic) {\n\t\t\tthrew = true;\n\t\t\tif (Std.string(error).indexOf(msg) == -1) throw \"assertFalse didn't throw with the supplied message.\";\n\t\t}\n\t\tif (!threw) throw \"assertFalse didn't throw for false.\";\n\t}\n\t\n\t@test public function testAssertEqual() : Void {\n\t\tvar threw : Bool;\n\t\tvar msg : String = \"msg\";\n\t\t\n\t\tthrew = false;\n\t\ttry Assert.assertEqual(0, 0) catch (_ : Dynamic) threw = true;\n\t\tif (threw) throw \"assertEqual threw with equal ints.\";\n\t\t\n\t\tthrew = false;\n\t\ttry Assert.assertEqual(0, 1) catch (_ : Dynamic) threw = true;\n\t\tif (!threw) throw \"assertEqual didn't throw with non-equal ints.\";\n\t\t\n\t\tvar a = {x: 1};\n\t\t\n\t\tthrew = false;\n\t\ttry Assert.assertEqual(a, a) catch (_ : Dynamic) threw = true;\n\t\tif (threw) throw \"assertEqual threw with equal objects.\";\n\t\t\n\t\tthrew = false;\n\t\ttry Assert.assertEqual(a, {x: 1}, msg) catch (error : Dynamic) {\n\t\t\tthrew = true;\n\t\t\tif (Std.string(error).indexOf(msg) == -1) throw \"assertEqual didn't throw with the supplied message.\";\n\t\t}\n\t\tif (!threw) throw \"assertEqual didn't throw with different objects.\";\n\t}\n\t\n\t@test public function testAssertNotEqual() : Void {\n\t\tvar threw : Bool;\n\t\tvar msg : String = \"msg\";\n\t\t\n\t\tthrew = false;\n\t\ttry Assert.assertNotEqual(0, 0) catch (_ : Dynamic) threw = true;\n\t\tif (!threw) throw \"assertNotEqual didn't throw with equal ints.\";\n\t\t\n\t\tthrew = false;\n\t\ttry Assert.assertNotEqual(0, 1) catch (_ : Dynamic) threw = true;\n\t\tif (threw) throw \"assertNotEqual threw with non-equal ints.\";\n\t\t\n\t\tvar a = {x: 1};\n\t\t\n\t\tthrew = false;\n\t\ttry Assert.assertNotEqual(a, a, msg) catch (error : Dynamic) {\n\t\t\tthrew = true;\n\t\t\tif (Std.string(error).indexOf(msg) == -1) throw \"assertNotEqual didn't throw with the supplied message.\";\n\t\t}\n\t\tif (!threw) throw \"assertNotEqual did not throw with equal objects.\";\n\t\t\t\t\n\t\tthrew = false;\n\t\ttry Assert.assertNotEqual(a, {x: 1}, msg) catch (_ : Dynamic) threw = true;\n\t\tif (threw) throw \"assertNotEqual threw with different objects.\";\n\t}\n\t\n\t#end\n}"
  },
  {
    "path": "huey/test/com/huey/utils/WeakRefTest.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.huey.utils;\nimport com.huey.tests.TestSuite;\nimport com.huey.utils.WeakRef;\n\nclass WeakRefTest extends TestSuite\n{\n\t@test public function testWeakRef() {\n\t\tvar ref = new WeakRef<Dynamic>( {foo: 1, bar: 2} );\n\t\tassertEqual(1, ref.get().foo);\n\t}\n\t\n\t#if flash9\n\t@asyncTest public function testWeakRefGC() {\n\t\tvar ref = new WeakRef<Dynamic>( {foo: 1, bar: 2} );\n\t\tflash.system.System.gc();\n\n\t\thaxe.Timer.delay(\n\t\t\tfunction() {\n\t\t\t\tassertNull(ref.get(), \"Weak reference was not garbage collected.\");\n\t\t\t\tpass();\n\t\t\t},\n\t\t\t100\n\t\t);\n\t}\n\t#end\n}"
  },
  {
    "path": "mac-installer.json",
    "content": "{\n  \"title\": \"Swivel\",\n  \"icon\": \"bin/Swivel.app/Contents/Resources/Icon.icns\",\n  \"background\": \"assets/bgMAC.jpg\",\n  \"icon-size\": 128,\n  \"contents\": [\n    { \"x\": 200, \"y\": 210, \"type\": \"file\", \"path\": \"bin/Swivel.app\" },\n    { \"x\": 500, \"y\": 210, \"type\": \"link\", \"path\": \"/Applications\" }\n  ]\n}\n"
  },
  {
    "path": "redirecter/redirecter/main.cpp",
    "content": "#include <windows.h> \n#include <tchar.h>\n#include <stdio.h> \n#include <strsafe.h>\n#include <string>\n\n#define BUFSIZE 1920*1080*4*4\n \nHANDLE g_hProcess = NULL;\nHANDLE g_hChildStd_IN_Rd = NULL;\nHANDLE g_hChildStd_IN_Wr = NULL;\nHANDLE g_hChildStd_ERR_Rd = NULL;\nHANDLE g_hChildStd_ERR_Wr = NULL;\nDWORD g_dwExitCode = NULL;\n\nHANDLE hStderrThread = NULL;\ntypedef struct {\n\tHANDLE parentStdErr;\n\tHANDLE childStdErr;\n\tHANDLE childStdIn;\n} StderrThreadData;\nStderrThreadData stderrThreadData;\n\nvoid CreateChildProcess(void);\nvoid StartStderrThread(void);\nDWORD WINAPI StderrThreadMain( LPVOID lpParam );\nvoid WriteToPipe(void); \nvoid ReadFromPipe(void); \nvoid ErrorExit(PTSTR); \n \nint _tmain(int argc, TCHAR *argv[]) \n{ \n   SECURITY_ATTRIBUTES saAttr; \n \n// Set the bInheritHandle flag so pipe handles are inherited. \n \n   saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); \n   saAttr.bInheritHandle = TRUE; \n   saAttr.lpSecurityDescriptor = NULL; \n\n// Create a pipe for the child process's STDOUT. \n \n   if ( ! CreatePipe(&g_hChildStd_ERR_Rd, &g_hChildStd_ERR_Wr, &saAttr, 0) ) \n      ErrorExit(TEXT(\"StdoutRd CreatePipe\")); \n\n// Ensure the read handle to the pipe for STDOUT is not inherited.\n\n   if ( ! SetHandleInformation(g_hChildStd_ERR_Rd, HANDLE_FLAG_INHERIT, 0) )\n      ErrorExit(TEXT(\"Stdout SetHandleInformation\")); \n\n// Create a pipe for the child process's STDIN. \n \n   if (! CreatePipe(&g_hChildStd_IN_Rd, &g_hChildStd_IN_Wr, &saAttr, 0)) \n      ErrorExit(TEXT(\"Stdin CreatePipe\")); \n\n// Ensure the write handle to the pipe for STDIN is not inherited. \n \n   if ( ! SetHandleInformation(g_hChildStd_IN_Wr, HANDLE_FLAG_INHERIT, 0) )\n      ErrorExit(TEXT(\"Stdin SetHandleInformation\")); \n \n// Create the child process. \n   \n   CreateChildProcess();\n\n// Get a handle to an input file for the parent. \n// This example assumes a plain text file and uses string output to verify data flow. \n \n \n// Write to the pipe that is the standard input for a child process. \n// Data is written to the pipe's buffers, so it is not necessary to wait\n// until the child process is running before writing data.\n \n   //WriteToPipe(); \n \n   StartStderrThread();\n\n// Read from pipe that is the standard output for child process. \n   ReadFromPipe(); \n\n   CloseHandle(hStderrThread);\n\n// The remaining open handles are cleaned up when this process terminates. \n// To avoid resource leaks in a larger application, close handles explicitly. \n\n\n   return (int)g_dwExitCode; \n} \n \nvoid StartStderrThread()\n{\n\tstderrThreadData.parentStdErr = GetStdHandle(STD_ERROR_HANDLE);\n\tstderrThreadData.childStdErr = g_hChildStd_ERR_Rd;\n\tstderrThreadData.childStdIn = g_hChildStd_IN_Wr;\n\thStderrThread = CreateThread(NULL, 0, StderrThreadMain, &stderrThreadData, 0, NULL);\n}\n\n\nDWORD WINAPI StderrThreadMain( LPVOID lpParam )\n{\n\tStderrThreadData data = *(StderrThreadData*)lpParam;\n\tconst int STDERR_BUF_SIZE = 4096;\n\tchar stderrBuf[4096];\n\tDWORD dwRead, dwWritten; \n\tBOOL bSuccess;\n\n\tfor(;;) {\n\t  // read output from stderr\n      bSuccess = ReadFile( data.childStdErr, stderrBuf, STDERR_BUF_SIZE, &dwRead, NULL);\n\t  if( ! bSuccess || dwRead == 0 ) break;\n\t   //printf(\"stderr: %i\", dwRead);\n\t  // fflush(stdout);\n      bSuccess = WriteFile(data.parentStdErr, stderrBuf, \n                           dwRead, &dwWritten, NULL);\n\t  FlushFileBuffers(data.parentStdErr);\n\t  if (! bSuccess ) break;\n\t}\n\n\tCloseHandle(data.childStdIn);\n\n\tExitThread(0);\n}\n\nvoid\nArgvQuote (\n    const std::wstring& Argument,\n    std::wstring& CommandLine,\n    bool Force\n    )\n    \n/*++\n    \nRoutine Description:\n    \n    This routine appends the given argument to a command line such\n    that CommandLineToArgvW will return the argument string unchanged.\n    Arguments in a command line should be separated by spaces; this\n    function does not add these spaces.\n    \nArguments:\n    \n    Argument - Supplies the argument to encode.\n\n    CommandLine - Supplies the command line to which we append the encoded argument string.\n\n    Force - Supplies an indication of whether we should quote\n            the argument even if it does not contain any characters that would\n            ordinarily require quoting.\n    \nReturn Value:\n    \n    None.\n    \nEnvironment:\n    \n    Arbitrary.\n    \n--*/\n    \n{\n    //\n    // Unless we're told otherwise, don't quote unless we actually\n    // need to do so --- hopefully avoid problems if programs won't\n    // parse quotes properly\n    //\n    \n    if (Force == false &&\n        Argument.empty () == false &&\n        Argument.find_first_of (L\" \\t\\n\\v\\\"\") == Argument.npos)\n    {\n        CommandLine.append (Argument);\n    }\n    else {\n        CommandLine.push_back (L'\"');\n        \n        for (auto It = Argument.begin () ; ; ++It) {\n            unsigned NumberBackslashes = 0;\n        \n            while (It != Argument.end () && *It == L'\\\\') {\n                ++It;\n                ++NumberBackslashes;\n            }\n        \n            if (It == Argument.end ()) {\n                \n                //\n                // Escape all backslashes, but let the terminating\n                // double quotation mark we add below be interpreted\n                // as a metacharacter.\n                //\n                \n                CommandLine.append (NumberBackslashes * 2, L'\\\\');\n                break;\n            }\n            else if (*It == L'\"') {\n\n                //\n                // Escape all backslashes and the following\n                // double quotation mark.\n                //\n                \n                CommandLine.append (NumberBackslashes * 2 + 1, L'\\\\');\n                CommandLine.push_back (*It);\n            }\n            else {\n                \n                //\n                // Backslashes aren't special here.\n                //\n                \n                CommandLine.append (NumberBackslashes, L'\\\\');\n                CommandLine.push_back (*It);\n            }\n        }\n    \n        CommandLine.push_back (L'\"');\n    }\n\n\tCommandLine.push_back (L' ');\n}\n\nvoid CreateChildProcess()\n// Create a child process that uses the previously created pipes for STDIN and STDOUT.\n{ \n   //TCHAR zaName[]=TEXT(\"ffmpeg.exe\");\n\n   int nArgs;\n   LPWSTR* cmdLineArgs = CommandLineToArgvW(GetCommandLine(), &nArgs);\n\n   std::wstring cmdLine;\n   ArgvQuote(L\"ffmpeg.exe\", cmdLine, false);\n   for(int i=1; i<nArgs; i++) {\n\t\tArgvQuote(cmdLineArgs[i], cmdLine, false);\n   }\n   LocalFree(cmdLineArgs);\n\n   PROCESS_INFORMATION piProcInfo; \n   STARTUPINFO siStartInfo;\n   BOOL bSuccess = FALSE; \n \n// Set up members of the PROCESS_INFORMATION structure. \n \n   ZeroMemory( &piProcInfo, sizeof(PROCESS_INFORMATION) );\n \n// Set up members of the STARTUPINFO structure. \n// This structure specifies the STDIN and STDOUT handles for redirection.\n \n   ZeroMemory( &siStartInfo, sizeof(STARTUPINFO) );\n   siStartInfo.cb = sizeof(STARTUPINFO); \n   siStartInfo.hStdError = g_hChildStd_ERR_Wr;\n   siStartInfo.hStdOutput = g_hChildStd_ERR_Wr;\n   siStartInfo.hStdInput = g_hChildStd_IN_Rd;\n   siStartInfo.dwFlags |= STARTF_USESTDHANDLES;\n \n// Create the child process. \n    \n   bSuccess = CreateProcess(NULL, \n\t  (LPWSTR)(cmdLine.c_str()),     // command line \n      NULL,          // process security attributes \n      NULL,          // primary thread security attributes \n      TRUE,          // handles are inherited \n      0,             // creation flags \n      NULL,          // use parent's environment \n      NULL,          // use parent's current directory \n      &siStartInfo,  // STARTUPINFO pointer \n      &piProcInfo);  // receives PROCESS_INFORMATION \n   \n   CloseHandle(g_hChildStd_ERR_Wr);\n\n   // If an error occurs, exit the application. \n   if ( ! bSuccess ) \n      ErrorExit(TEXT(\"CreateProcess\"));\n   else \n   {\n      // Close handles to the child process and its primary thread.\n      // Some applications might keep these handles to monitor the status\n      // of the child process, for example. \n\t   g_hProcess = piProcInfo.hProcess;\n      CloseHandle(piProcInfo.hThread);\n   }\n}\n \nvoid ReadFromPipe(void) \n\n// Read output from the child process's pipe for STDOUT\n// and write to the parent process's pipe for STDOUT. \n// Stop when there is no more data. \n{ \n   DWORD dwRead, dwWritten; \n   void* buf;\n   buf = malloc(BUFSIZE);\n   BOOL bSuccess = FALSE;\n   HANDLE hParentStdErr = GetStdHandle(STD_ERROR_HANDLE);\n   HANDLE hParentStdOut = GetStdHandle(STD_OUTPUT_HANDLE);\n   HANDLE hParentStdIn = GetStdHandle(STD_INPUT_HANDLE);\n\n   for (;;) \n   { \n\t  // write input to ffmpeg\n\t  bSuccess = ReadFile(hParentStdIn, buf, BUFSIZE, &dwRead, NULL);\n      if ( ! bSuccess ) break; \n\n\t  if(dwRead > 0) {\n\t\tbSuccess = WriteFile(g_hChildStd_IN_Wr, buf, dwRead, &dwWritten, NULL);\n\t\tif ( ! bSuccess ) break; \n\t  }\n\n\t  printf(\"!\");\n\t  fflush(stdout);\n   }\n\n   free(buf);\n   CloseHandle(g_hChildStd_IN_Wr);\n   CloseHandle(g_hChildStd_ERR_Rd);\n\n   WaitForSingleObject(g_hProcess, INFINITE);\n\n   GetExitCodeProcess(g_hProcess, &g_dwExitCode);\n} \n \nvoid ErrorExit(PTSTR lpszFunction) \n\n// Format a readable error message, display a message box, \n// and exit from the application.\n{ \n    LPVOID lpMsgBuf;\n    LPVOID lpDisplayBuf;\n    DWORD dw = GetLastError(); \n\n    FormatMessage(\n        FORMAT_MESSAGE_ALLOCATE_BUFFER | \n        FORMAT_MESSAGE_FROM_SYSTEM |\n        FORMAT_MESSAGE_IGNORE_INSERTS,\n        NULL,\n        dw,\n        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),\n        (LPTSTR) &lpMsgBuf,\n        0, NULL );\n\n    lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT, \n        (lstrlen((LPCTSTR)lpMsgBuf)+lstrlen((LPCTSTR)lpszFunction)+40)*sizeof(TCHAR)); \n    StringCchPrintf((LPTSTR)lpDisplayBuf, \n        LocalSize(lpDisplayBuf) / sizeof(TCHAR),\n        TEXT(\"%s failed with error %d: %s\"), \n        lpszFunction, dw, lpMsgBuf); \n    MessageBox(NULL, (LPCTSTR)lpDisplayBuf, TEXT(\"Error\"), MB_OK); \n\n    LocalFree(lpMsgBuf);\n    LocalFree(lpDisplayBuf);\n    ExitProcess(1);\n}\n"
  },
  {
    "path": "redirecter/redirecter/redirecter.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release|Win32\">\n      <Configuration>Release</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{6F30F38B-35CD-4F18-A8B4-C88E42077C00}</ProjectGuid>\n    <Keyword>Win32Proj</Keyword>\n    <RootNamespace>redirecter</RootNamespace>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n    </ClCompile>\n    <Link>\n      <SubSystem>Console</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n    </ClCompile>\n    <Link>\n      <SubSystem>Console</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemGroup>\n    <ClCompile Include=\"main.cpp\" />\n  </ItemGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "redirecter/redirecter/redirecter.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"main.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "redirecter/redirecter.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 11.00\n# Visual C++ Express 2010\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"redirecter\", \"redirecter\\redirecter.vcxproj\", \"{6F30F38B-35CD-4F18-A8B4-C88E42077C00}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Win32 = Debug|Win32\n\t\tRelease|Win32 = Release|Win32\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{6F30F38B-35CD-4F18-A8B4-C88E42077C00}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{6F30F38B-35CD-4F18-A8B4-C88E42077C00}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{6F30F38B-35CD-4F18-A8B4-C88E42077C00}.Release|Win32.ActiveCfg = Release|Win32\n\t\t{6F30F38B-35CD-4F18-A8B4-C88E42077C00}.Release|Win32.Build.0 = Release|Win32\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "src/com/newgrounds/swivel/PreviewGenerator.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel;\nimport com.huey.events.Dispatcher;\nimport com.newgrounds.swivel.swf.SWFRecorder;\nimport com.newgrounds.swivel.swf.SwfUtils;\nimport com.newgrounds.swivel.swf.SwivelSwf;\nimport format.abc.Context;\n\nusing com.newgrounds.swivel.swf.AbcUtils;\n\nclass PreviewGenerator {\n\n\tpublic var onPreviewReady(default, null) : Dispatcher<flash.display.BitmapData>;\n\n\tpublic function new() {\n\t\tonPreviewReady = new Dispatcher();\n\t\t\n\t\t_recorder = new SWFRecorder();\n\t\t_recorder.outputWidth = 133;\n\t\t_recorder.outputHeight = 75;\n\t\t_recorder.renderQuality = High;\n\t\t_recorder.scaleMode = letterbox;\n\t\t_recorder.onFrameCaptured.add( frameCapturedHandler );\n\t}\n\t\n\tpublic function getPreview(swf : SwivelSwf, frame : Int) {\n\t\tstop();\n\t\t\n\t\tvar previewSwf = swf.clone();\n\t\tpreviewSwf.compression = SCUncompressed;\n\t\tswf.prepend(SwfUtils.getAs2Tag(\"AS2Basics\", {width: swf.width, height: swf.height, frameRate: swf.frameRate}));\n\t\tif(swf.version < 5) swf.version = 5;\n\t\tpreviewSwf.avmVersion = AVM1;\t// TODO: allow AS3 support\n\t\tswitch(previewSwf.avmVersion) {\n\t\t\tcase AVM1:\n\t\t\t\tpreviewSwf.prepend( TDoActions( SwivelSwf.getAvm1Bytes( [\n\t\t\t\t\tAPush( [PString(\"__swivelInit\")] ),\n\t\t\t\t\tAEval,\n\t\t\t\t\tACondJump(5),\n\t\t\t\t\tAGotoFrame(frame+1),\n\t\t\t\t\tAStop,\n\t\t\t\t\tAStopSounds,\n\t\t\t\t\tAPush( [PString(\"__swivelInit\"), PInt(1)] ),\n\t\t\t\t\tASet,\n\t\t\t\t] ) ) );\n\t\t\t\tpreviewSwf.prepend( TShowFrame );\n\t\t\t\tpreviewSwf.prepend( TShowFrame );\n\t\t\t\n\t\t\tcase AVM2:\n\t\t\t\tvar context = new Context();\n\t\t\t\tvar cl = context.beginClass(\"__SwivelPreview\");\n\t\t\t\tcl.isSealed = false;\n\t\t\t\tcl.superclass = context.type(\"flash.display.MovieClip\");\n\t\t\t\tvar f = context.beginConstructor([]);\n\t\t\t\tf.maxStack = f.maxScope = 4;\n\t\t\t\tcontext.ops([\n\t\t\t\t\tOThis,\n\t\t\t\t\tOConstructSuper(0),\n\t\t\t\t\tOThis,\n\t\t\t\t\tOInt(frame),\n\t\t\t\t\tOCallPropVoid( context.type(\"gotoAndPlay\"), 1),\n\t\t\t\t\tORetVoid,\n\t\t\t\t]);\n\t\t\t\tcontext.finalize();\n\t\t\t\t\n\t\t\t\tvar o = new haxe.io.BytesOutput();\n\t\t\t\tnew format.abc.Writer(o).write(context.getData());\n\t\t\t\t\n\t\t\t\tpreviewSwf.prepend(TActionScript3(o.getBytes(), null));\n\t\t\t\tpreviewSwf.prepend(TSymbolClass([{className: \"__SwivelPreview\", cid: 0}] ));\n\t\t}\n\n\t\tflash.media.SoundMixer.soundTransform = new flash.media.SoundTransform(0);\n\t\t\n\t\t_recorder.startPlayback(previewSwf);\n\t\t_recorder.startRecording();\n\t}\n\t\n\tpublic function stop() {\n\t\t_recorder.stop();\n\t}\n\n\tprivate var _recorder : SWFRecorder;\n\t\n\tprivate function frameCapturedHandler(frame : flash.display.BitmapData) {\n\t\tonPreviewReady.dispatch(frame);\n\t\tflash.media.SoundMixer.soundTransform = new flash.media.SoundTransform(1.0);\n\t\tstop();\n\t}\n\t\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/SplashScreen.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel;\nimport com.huey.ui.Component;\nimport flash.display.MovieClip;\nimport flash.events.MouseEvent;\nimport flash.Lib;\nimport flash.net.URLRequest;\n\nclass SplashScreen extends Component {\n\tpublic function new() {\n\t\t_anim = new SplashAnim();\n\t\t_anim.addEventListener(flash.events.Event.ENTER_FRAME, enterFrameHandler);\n\t\t_anim.addEventListener(flash.events.Event.ADDED_TO_STAGE, addedToStageHandler, true);\n\t\tsuper(_anim);\n\t}\n\t\n\tprivate var _anim : MovieClip;\n\t\n\tprivate function enterFrameHandler(e) {\n\t\tif (_anim.currentFrame == _anim.totalFrames) {\n\t\t\t_anim.stop();\n\t\t\t_anim.removeEventListener(flash.events.Event.ENTER_FRAME, enterFrameHandler);\n\t\t\tif (parent != null) parent.remove(this);\n\t\t}\n\t}\n\t\n\tprivate function addedToStageHandler(e) {\n\t\tvar url =\n\t\tswitch(e.target.name) {\n\t\t\tcase \"swivelButton\":\t\"http://www.newgrounds.com/swivel\";\n\t\t\tcase \"ngButton\":\t\t\"http://www.newgrounds.com\";\n\t\t\tcase \"haxeButton\":\t\t\"http://www.haxe.org\";\n\t\t\tcase \"ffmpegButton\":\t\"http://www.ffmpeg.org\";\n\t\t\tdefault:\t\t\t\tnull;\n\t\t}\n\t\tif (url != null) {\n\t\t\te.target.addEventListener(MouseEvent.CLICK, function(e) Lib.getURL(new URLRequest(url)) );\n\t\t}\n\t}\n\t\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/Swivel.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel;\n\nimport com.newgrounds.swivel.ffmpeg.AudioCodec;\nimport com.newgrounds.swivel.ffmpeg.VideoPreset;\nimport com.newgrounds.swivel.swf.Watermark;\nimport com.newgrounds.swivel.SwivelController.SwivelTask;\nimport com.newgrounds.swivel.SwivelController.SwivelProgressEvent;\nimport com.newgrounds.swivel.SwivelJob.RecordingDuration;\nimport com.huey.assets.Asset;\nimport com.huey.assets.AssetSource;\nimport com.huey.core.Application;\nimport com.huey.binding.Binding;\nimport com.huey.binding.BindableArray;\nimport com.huey.utils.Thread;\nimport com.huey.ui.Component.HitArea;\nimport com.huey.ui.*;\nimport com.newgrounds.swivel.SwivelController.AudioSource;\nimport com.newgrounds.swivel.swf.SwivelSwf;\nimport com.newgrounds.swivel.swf.RenderQuality;\nimport com.newgrounds.swivel.swf.SWFRecorder.ScaleMode;\nimport com.newgrounds.swivel.swf.Watermark.WatermarkAlign;\nimport flash.desktop.NativeApplication;\nimport flash.display.BitmapData;\nimport flash.display.Sprite;\nimport flash.events.Event;\nimport flash.events.InvokeEvent;\nimport flash.events.MouseEvent;\nimport flash.filesystem.File;\nimport flash.Lib;\nimport flash.net.FileFilter;\nimport flash.system.Capabilities;\nimport flash.system.System;\nimport flash.text.TextField;\nimport format.swf.Reader;\nimport format.swf.Data;\nimport haxe.io.Bytes;\nimport haxe.io.BytesInput;\nimport haxe.io.Input;\n\n@:xml(\"SwivelHuey.xml\") @:version(\"1.11\")\nclass Swivel extends Application\n{\n\t@bindable private var _controller : SwivelController;\n\tprivate var _browseFile : File;\n\t\n\tprivate var _fileListBox : ListBox;\n\t\t\n\tprivate var _settingsContainer : StateContainer;\n\n\tprivate var _previewImage : ScaledImage;\n\tpublic var busySpinner : Component;\n\t\n\tpublic var sourceButton : Button;\n\tpublic var videoButton : Button;\n\tpublic var audioButton : Button;\n\tpublic var overlayButton : Button;\n\t\n\tpublic var outputFileBox : TextBox;\n\n\tpublic var removeButton : Button;\n\tpublic var convertButton : Button;\n\tpublic var cancelButton : Button;\n\t\n\tpublic var qualitySlider : Slider;\n\n\tpublic var widthStepper : NumericStepper;\n\tpublic var heightStepper : NumericStepper;\n\t\n\tprivate var _aspectRatio : Null<Float>\t= 16.0 / 9.0;\n\tpublic var lockAspectCheckBox : CheckBox;\n\t\n\tpublic var frameStepperImage : Image;\n\tpublic var startFrameStepper : NumericStepper;\n\tpublic var endFrameStepper : NumericStepper;\n\t\n\tprivate var _previewGenerator : PreviewGenerator;\n\t\n\tpublic var setupGroup : RadioGroup;\n\t@bindable public var durationGroup : RadioGroup;\n\t\n\tpublic var scaleModeGroup : RadioGroup;\n\tpublic var cropButton : RadioButton;\n\tpublic var letterboxButton : RadioButton;\n\tpublic var exactFitButton : RadioButton;\n\tpublic var transparentBgCheckBox : CheckBox;\n\tpublic var codecSelectBox : SelectBox;\n\tpublic var videoBitrateSlider : Slider;\n\t\n\t@bindable public var audioGroup : RadioGroup;\n\t\n\tpublic var frameRangeButton : RadioButton;\n\tpublic var manualButton : RadioButton;\n\t\n\tpublic var noAudioButton : RadioButton;\n\tpublic var swfAudioButton : RadioButton;\n\tpublic var externalAudioButton : RadioButton;\n\tpublic var externalAudioFileBox : TextBox;\n\tpublic var externalAudioContainer : Component;\n\tpublic var externalAudioFile : File;\n\tpublic var audioChannelGroup : RadioGroup;\n\tpublic var monoRadioButton : RadioButton;\n\tpublic var audioCodecSelectBox : SelectBox;\n\tpublic var audioBitrateSlider : Slider;\n\n\tprivate var _watermark : Watermark;\n\tprivate var _watermarkFile : File;\n\tpublic var watermarkEnabledCheckBox : CheckBox;\n\tpublic var watermarkFileBox : TextBox;\n\tpublic var watermarkAlphaSlider : Slider;\n\tpublic var watermarkSizeSlider : Slider;\n\tpublic var watermarkSettingsContainer : Component;\n\t@bindable private var bitmapSmoothingCheckBox : CheckBox;\n\t\n\tprivate var progressText : Label;\n\t\n\tprivate var timeText : Label;\n\tprivate var videoNameText : Label;\n\tprivate var videoNameButton : Button;\n\tprivate var fileSizeText : Label;\n\t\n\tprivate var aboutBox : Container;\n\tpublic var versionText : Label;\n\tpublic var creditsText : Label;\n\t\n\tprivate var swfSetupContainer : Container;\n\tprivate var frameContainer : Container;\n\tprivate var mainContainer : StateContainer;\n\t\n\tpublic var progressBar : Slider;\n\t\n\tpublic var alignmentGroup : RadioGroup;\n\n\tpublic var watermarkPreview : Component;\n\tpublic var recordingButton : CheckBox;\n\tpublic var errorText : Label;\n\t\n\tprivate var cmdLineArguments : Array<String>;\n\t\n\tpublic function new() : Void {\n\t\tsuper();\n\t\t\n\t\t_controller = new SwivelController();\n\t\t_watermarkFile = new File();\n\t\t_watermark = {image : null, alpha: 1.0, scale: 1.0, align: bottomLeft};\n\t\t\n\t\tNativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, function(e : InvokeEvent) {\n\t\t\tif(!_isCmdLine && e.arguments != null && e.arguments.length > 0) {\n\t\t\t\t_isCmdLine = true;\n\t\t\t\tcmdLineArguments = e.arguments;\n\t\t\t\t_cmdLineDirectory = e.currentDirectory;\n\t\t\t}\n\t\t});\n\t\t\n\t\t/*_isCmdLine = true;\n\t\tcmdLineArguments = ([\"dealer-warranty.swf\",\"-s\",\"640x480\",\"-o\",\"cmd.mp4\",\"-ab\",\"64k\",\"-vb\",\"1.5M\"]);\n\t\t_cmdLineDirectory = new File(\"d:\\\\Swiveltest\");*/\n\t}\n\t\n\tprivate var _isCmdLine : Bool;\n\tprivate var _cmdLineFile : File;\n\tprivate var _cmdLineParams : Dynamic;\n\tprivate var _cmdLineDirectory : File;\n\t\n\tprivate function handleCommandLineArguments(args : Array<String>) {\n\t\tif(args.length == 0) return;\n\t\t\n\t\twhile(args.length > 0) parseNextArgument(args);\n\t\t\n\t\tif(_cmdLineFile == null) throw(\"No input file specified\");\n\t\tif(!_cmdLineFile.exists) throw('${_cmdLineFile.nativePath} does not exist');\n\t\t\n\t\tif(_controller.outputFile == null) {\n\t\t\t_controller.outputFile = _cmdLineFile.parent.resolvePath( _cmdLineFile.name.split(\".\")[0] + \".mp4\" );\n\t\t}\n\t\t\n\t\t_cmdLineFile.addEventListener(Event.COMPLETE, function(_) {\n\t\t\tvar job = new SwivelJob(_cmdLineFile, new SwivelSwf(Bytes.ofData(_cmdLineFile.data)) );\n\t\t\tjob.parameters = _cmdLineParams;\n\t\t\t_controller.jobs.push( job );\n\t\t\tconvertClickHandler(null);\n\t\t} );\n\t\t_cmdLineFile.load();\n\t}\n\t\n\tprivate function parseNextArgument(args : Array<String>) {\n\t\tvar arg = StringTools.trim(args.shift());\n\t\tif(arg.charAt(0) == \"-\") {\n\t\t\tvar sw = arg.substr(1);\n\t\t\tswitch(sw) {\n\t\t\t\tcase \"s\":\n\t\t\t\t\tvar parts = args.shift().split(\"x\");\n\t\t\t\t\t_controller.outputWidth = Std.parseInt(parts[0]);\n\t\t\t\t\t_controller.outputHeight = Std.parseInt(parts[1]);\n\t\t\t\t\n\t\t\t\tcase \"vb\":\n\t\t\t\t\tvar arg = StringTools.trim(args.shift());\n\t\t\t\t\tvar bitRate : Null<Float> = switch( arg.charAt(arg.length-1).toLowerCase() ) {\n\t\t\t\t\t\tcase \"k\":\t1024 * Std.parseFloat( arg.substr(0,arg.length-1) );\n\t\t\t\t\t\tcase \"m\":\t1024 * 1024 * Std.parseFloat( arg.substr(0,arg.length-1) );\n\t\t\t\t\t\tdefault:\tStd.parseFloat( arg.substr(0,arg.length-1) );\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif(bitRate != null && bitRate > 0) _controller.videoBitRate = Std.int(bitRate);\n\t\t\t\t\n\t\t\t\tcase \"ab\":\n\t\t\t\t\tvar arg = StringTools.trim(args.shift());\n\t\t\t\t\tvar bitRate : Null<Float> = switch( arg.charAt(arg.length-1).toLowerCase() ) {\n\t\t\t\t\t\tcase \"k\":\t1024 * Std.parseFloat( arg.substr(0,arg.length-1) );\n\t\t\t\t\t\tcase \"m\":\t1024 * 1024 * Std.parseFloat( arg.substr(0,arg.length-1) );\n\t\t\t\t\t\tdefault:\tStd.parseFloat( arg );\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif(bitRate != null && bitRate > 0) _controller.audioBitRate = Std.int(bitRate);\n\t\t\t\t\t\n\t\t\t\tcase \"sm\":\n\t\t\t\t\tswitch(args.shift()) {\n\t\t\t\t\t\tcase \"letterbox\": _controller.scaleMode = letterbox;\n\t\t\t\t\t\tcase \"crop\": _controller.scaleMode = crop;\n\t\t\t\t\t\tcase \"stretch\": _controller.scaleMode = stretchToFit;\n\t\t\t\t\t\tdefault: throw(\"Invalid scale mode\");\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\tcase \"a\":\n\t\t\t\t\tvar arg = StringTools.trim(args.shift());\n\t\t\t\t\tswitch(arg) {\n\t\t\t\t\t\tcase \"none\":\t_controller.audioSource = none;\n\t\t\t\t\t\tcase \"swf\":\t\t_controller.audioSource = swf;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tvar audioFile = _cmdLineDirectory.resolvePath(arg);\n\t\t\t\t\t\t\tif(!audioFile.exists) throw(\"Audio file ${audioFile.nativePath} does not exist\");\n\t\t\t\t\t\t\t_controller.audioSource = external( audioFile );\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\tcase \"t\":\n\t\t\t\t\t_controller.transparentBackground = true;\n\t\t\t\t\t\n\t\t\t\tcase \"o\":\n\t\t\t\t\t_controller.outputFile = _cmdLineDirectory.resolvePath( StringTools.trim(args.shift()) );\n\t\t\t\t\t\n\t\t\t\tdefault: throw('Invalid switch $sw');\n\t\t\t}\n\t\t} else {\n\t\t\tif(_cmdLineFile != null) {\n\t\t\t\tthrow(\"Only one input file may be specified\");\n\t\t\t}\n\t\t\t\n\t\t\tvar fileParts = arg.split(\"?\");\n\t\t\tif(fileParts.length > 1) {\n\t\t\t\t_cmdLineParams = {};\n\t\t\t\tfor(param in StringTools.urlDecode(fileParts[1]).split(\"&\")) {\n\t\t\t\t\tvar paramParts = param.split(\"=\");\n\t\t\t\t\tReflect.setField(_cmdLineParams, paramParts[0], paramParts[1]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t_cmdLineFile = _cmdLineDirectory.resolvePath(fileParts[0]);\n\t\t}\n\t}\n\n\tprivate override function init() : Void {\n\t\t#if !debug\n\t\t\tif(!_isCmdLine) ui.add(new SplashScreen());\n\t\t#end\n\n\t\t_previewGenerator = new PreviewGenerator();\n\t\t_previewGenerator.onPreviewReady.add(previewReadyHandler);\n\t\t\t\t\n\t\t// SOURCE\n\t\tBinding.bind( removeButton.enabled, _controller.jobs.length > 0 );\n\t\tBinding.bind( convertButton.enabled, _controller.jobs.length > 0 && _controller.outputFile != null);\n\t\tBinding.bind( swfSetupContainer.enabled, _fileListBox.selectedItem != null );\n\t\tBinding.bind( _fileListBox.items, _controller.jobs.array );\n\t\tBinding.bind( qualitySlider.value, _fileListBox.selectedItem.renderQuality.getIndex());\n\t\tuntyped qualitySlider._implComponent.addEventListener(MouseEvent.MOUSE_DOWN, qualitySecretHandler );\n\t\tBinding.bind( _fileListBox.selectedItem.renderQuality, Type.createEnumIndex(RenderQuality, Std.int(qualitySlider.value)) );\n\t\tBinding.bind( outputFileBox.text, _controller.outputFile.nativePath );\n\t\toutputFileBox.onUserEdited.add(outputFileEditHandler);\n\t\t\n\t\tBinding.bind( frameContainer.enabled, !swfSetupContainer.enabled || durationGroup.selectedItem == frameRangeButton  );\n\t\t\n\t\tBinding.bindTwoWay( bitmapSmoothingCheckBox.selected, _fileListBox.selectedItem.forceBitmapSmoothing );\n\t\t_fileListBox.onChange.add(fileChangedHandler);\n\t\tBinding.bind( startFrameStepper.maximum, _fileListBox.selectedItem.swf.numFrames );\n\t\tBinding.bind( endFrameStepper.maximum, _fileListBox.selectedItem.swf.numFrames );\n\t\tstartFrameStepper.onUserChange.add(showPreview);\n\t\tendFrameStepper.onUserChange.add(showPreview);\n\t\tstartFrameStepper.onChange.add(function(_) changeDuration(false));\n\t\tendFrameStepper.onChange.add(function(_) changeDuration(true));\n\t\tdurationGroup.onChange.add(function(_) changeDuration(false));\n\t\t\n\t\tcodecSelectBox.items = com.newgrounds.swivel.ffmpeg.FfmpegProcess.FfmpegEncoder.PRESETS;\n\t\tcodecSelectBox.selectedIndex = 0;\n\t\tcodecSelectBox.onChange.add(codecChangeHandler);\n\t\t\n\t\t// VIDEO\n\t\tBinding.bind( widthStepper.value, _controller.outputWidth );\n\t\tBinding.bind( heightStepper.value, _controller.outputHeight );\n\t\tBinding.bind( widthStepper.step, if(lockAspectCheckBox.selected) Std.int(Math.max(Math.round(widthStepper.value/heightStepper.value)*2,2)) else 2 );\n\t\tBinding.bind( heightStepper.step, if(lockAspectCheckBox.selected) Std.int(Math.max(Math.round(heightStepper.value/widthStepper.value)*2,2)) else 2 );\n\t\twidthStepper.onUserChange.add(function(_) updateOutputSize(Std.int(widthStepper.value), null));\n\t\theightStepper.onUserChange.add(function(_) updateOutputSize(null, Std.int(heightStepper.value)));\n\t\tlockAspectCheckBox.onClick.add(function(_) {\n\t\t\t_aspectRatio = if(lockAspectCheckBox.selected) widthStepper.value / heightStepper.value else null;\n\t\t\tupdateOutputSize(null, null);\n\t\t});\n\t\t\n\t\tBinding.bind( _controller.scaleMode, {\n\t\t\tif(lockAspectCheckBox.selected || scaleModeGroup.selectedItem == cropButton) crop;\n\t\t\telse if(scaleModeGroup.selectedItem == letterboxButton) letterbox;\n\t\t\telse stretchToFit;\n\t\t} );\n\t\t\n\t\tBinding.bindTwoWay( _controller.transparentBackground, transparentBgCheckBox.selected );\n\t\ttransparentBgCheckBox.onClick.add( function(_) {\n\t\t\tif(transparentBgCheckBox.selected) {\n\t\t\t\tcodecSelectBox.items = com.newgrounds.swivel.ffmpeg.FfmpegProcess.FfmpegEncoder.TRANSPARENT_PRESETS;\n\t\t\t\tcodecSelectBox.selectedIndex = 0;\n\t\t\t} else {\n\t\t\t\tcodecSelectBox.items = com.newgrounds.swivel.ffmpeg.FfmpegProcess.FfmpegEncoder.PRESETS;\n\t\t\t\tcodecSelectBox.selectedIndex = 1;\n\t\t\t}\n\t\t} );\n\t\t\n\t\t// AUDIO\n\t\tBinding.bind( _controller.audioSource, {\n\t\t\tif(audioGroup.selectedItem == noAudioButton) none;\n\t\t\telse if(audioGroup.selectedItem == swfAudioButton) swf;\n\t\t\telse external(externalAudioFile);\n\t\t} );\n\t\tBinding.bind( externalAudioContainer.enabled, externalAudioButton.selected );\n\t\taudioCodecSelectBox.items = com.newgrounds.swivel.ffmpeg.FfmpegProcess.FfmpegEncoder.AUDIO_CODECS;\n\t\taudioCodecSelectBox.selectedIndex = 0;\n\t\taudioCodecSelectBox.onChange.add(audioCodecChangeHandler);\n\t\tBinding.bind( _controller.stereoAudio, {!monoRadioButton.selected;} );\n\t\t\n\t\tcodecChangeHandler(null);\n\n\t\t// WATERMARK\n\t\twatermarkFileBox.onUserEdited.add(watermarkFileEditHandler);\n\t\tBinding.bind( _controller.watermark, if(watermarkEnabledCheckBox.selected) _watermark else null );\n\t\tBinding.bind( _watermark.alpha, {drawWatermarkPreview(); watermarkAlphaSlider.value;} );\n\t\tBinding.bind( _watermark.scale, {drawWatermarkPreview(); watermarkSizeSlider.value;} );\n\t\tBinding.bind( watermarkSettingsContainer.enabled, watermarkEnabledCheckBox.selected );\n\t\tBinding.bind( _watermark.align, {\n\t\t\tdrawWatermarkPreview();\n\t\t\tif(alignmentGroup.selectedItem.y == 299) {\n\t\t\t\tif(alignmentGroup.selectedItem.x == 438)\t\ttopLeft;\n\t\t\t\telse if(alignmentGroup.selectedItem.x == 468)\ttopCenter;\n\t\t\t\telse\t\t\t\t\t\t\t\t\t\t\ttopRight;\n\t\t\t} else if(alignmentGroup.selectedItem.y == 321) {\n\t\t\t\tif(alignmentGroup.selectedItem.x == 438)\t\tmiddleLeft;\n\t\t\t\telse if(alignmentGroup.selectedItem.x == 468)\tcenter;\n\t\t\t\telse \t\t\t\t\t\t\t\t\t\t\tmiddleRight;\n\t\t\t} else {\n\t\t\t\tif(alignmentGroup.selectedItem.x == 438)\t\tbottomLeft;\n\t\t\t\telse if(alignmentGroup.selectedItem.x == 468)\tbottomCenter;\n\t\t\t\telse\t\t\t\t\t\t\t\t\t\t\tbottomRight;\n\t\t\t}\n\t\t} );\n\t\t\n\t\tversionText.text = 'v$VERSION - $BUILD_TIME';\n\t\t\n\t\tif(!flash.system.Capabilities.isDebugger) {\n\t\t\tmainContainer.state = \"error\";\n\t\t\terrorText.text = 'Please restart your computer before using Swivel for the first time.\\n\\nIf this error persists, please e-mail mike@newgrounds.com.';\n\t\t} else if(_isCmdLine) handleCommandLineArguments(cmdLineArguments);\n\t}\n\t\n\n\tprivate function dragWindowHandler(e) NativeApplication.nativeApplication.activeWindow.startMove();\n\tprivate function closeClickHandler(e) if(aboutBox.visible) aboutCloseHandler(null) else exit();\n\tprivate function minClickHandler(e) minimize();\n\tprivate function aboutClickHandler(_) {\n\t\taboutBox.visible = true;\n\t\tuntyped creditsText._implComponent.scrollRect = new flash.geom.Rectangle(0, -230, 300, 225);\n\t\tflash.Lib.current.stage.frameRate = 25;\n\t\tflash.Lib.current.addEventListener(flash.events.Event.ENTER_FRAME, aboutFrameHandler);\n\t}\n\tprivate function aboutFrameHandler(_) {\n\t\tuntyped creditsText._implComponent.scrollRect = new flash.geom.Rectangle(0, creditsText._implComponent.scrollRect.y+1, 300, 225);\n\t}\n\t\n\tprivate function helpClickHandler(_) flash.Lib.getURL(new flash.net.URLRequest(\"http://www.newgrounds.com/swivel\"));\n\tprivate function ngUpsellClickHandler(_) flash.Lib.getURL(new flash.net.URLRequest(\"http://www.newgrounds.com/projects/movies/submit\"));\n\t\n\tprivate function addClickHandler(e) : Void {\n\t\t// TODO: create File class\n\t\t_browseFile = new File();\n\t\t_browseFile.addEventListener(flash.events.Event.SELECT, fileSelectHandler);\n\t\t_browseFile.browseForOpen(\"Import SWF\", [new FileFilter(\"SWF Files (*.swf)\", \"*.swf\")]);\n\t}\n\n\tprivate function removeClickHandler(e) : Void {\n\t\t_controller.jobs.splice(_fileListBox.selectedIndex, 1);\n\t}\n\n\tprivate function spinBusyIcon() untyped busySpinner._implComponent.rotation -= 40;\n\tprivate function fileSelectHandler(e) {\n\t\tbusySpinner.visible = true;\n\t\tflash.Lib.current.mouseChildren = flash.Lib.current.tabEnabled = false;\n\t\tvar spinTimer = new haxe.Timer(33);\n\t\tspinTimer.run = spinBusyIcon;\n\t\t\n\t\t_browseFile.addEventListener(flash.events.Event.COMPLETE, function(e) {\n\t\t\ttry {\n\t\t\t\tvar swf = new SwivelSwf(Bytes.ofData(_browseFile.data));\n\t\t\t\tvar job = new SwivelJob( _browseFile, swf );\n\t\t\t\t_controller.jobs.push(job);\n\t\t\t\tif(_controller.jobs.length == 1) {\n\t\t\t\t\t_controller.outputFile = _browseFile.parent.resolvePath( _browseFile.name.split(\".\")[0] + \".mp4\" );\n\t\t\t\t\t\n\t\t\t\t\t_fileListBox.selectedIndex = 0;\n\t\t\t\t\t\n\t\t\t\t\tvar swfAspectRatio = swf.width / swf.height;\n\t\t\t\t\tif(_aspectRatio != null) _aspectRatio = swfAspectRatio;\n\t\t\t\t\t\n\t\t\t\t\tvar w : Float = 1920.0;\n\t\t\t\t\tvar h : Float = 1080.0;\n\t\t\t\t\tif(swfAspectRatio > w/h)\n\t\t\t\t\t\th = swf.height * (w/swf.width);\n\t\t\t\t\telse\n\t\t\t\t\t\tw = swf.width * (h/swf.height);\n\t\t\t\t\t\t\n\t\t\t\t\tupdateOutputSize(Std.int(w), Std.int(h));\n\t\t\t\t}\n\t\t\t} catch(error : Dynamic) {}\n\t\t\tbusySpinner.visible = false;\n\t\t\tflash.Lib.current.mouseChildren = flash.Lib.current.tabEnabled = true;\n\t\t\tspinTimer.stop();\n\t\t\tspinTimer = null;\n\t\t});\n\t\t_browseFile.load();\n\t}\n\t\n\tprivate function fileChangedHandler(_) {\n\t\tvar job : SwivelJob = _fileListBox.selectedItem;\n\t\tif(job != null) {\n\t\t\tswitch(job.duration) {\n\t\t\t\tcase frameRange(s,e):\n\t\t\t\t\tstartFrameStepper.value = s;\n\t\t\t\t\tendFrameStepper.value = e;\n\t\t\t\t\tmanualButton.selected = false;\n\t\t\t\t\tframeRangeButton.selected = true;\n\t\t\t\t\tdurationGroup.selectedItem = frameRangeButton;\n\t\t\t\tcase manual:\n\t\t\t\t\tstartFrameStepper.value = 1;\n\t\t\t\t\tendFrameStepper.value = _fileListBox.selectedItem.swf.numFrames;\n\t\t\t\t\tmanualButton.selected = true;\n\t\t\t\t\tframeRangeButton.selected = false;\n\t\t\t\t\tdurationGroup.selectedItem = manualButton;\n\t\t\t}\n\t\t}\n\t\tshowPreview();\n\t}\n\t\n\tprivate function changeDuration(isEndFrame : Bool) : Void {\n\t\tif(startFrameStepper.value > endFrameStepper.value)\n\t\t\tif(isEndFrame) startFrameStepper.value = endFrameStepper.value;\n\t\t\telse endFrameStepper.value = startFrameStepper.value;\n\t\t\t\n\t\t_fileListBox.selectedItem.duration =\n\t\t\tif(durationGroup.selectedItem == frameRangeButton)\n\t\t\t\tframeRange(Std.int(startFrameStepper.value), Std.int(endFrameStepper.value));\n\t\telse\n\t\t\tmanual;\n\t}\n\t\n\tprivate function showPreview(?e : UIEvent) {\n\t\tif(_fileListBox.selectedItem != null) {\n\t\t\tvar swf : SwivelSwf = _fileListBox.selectedItem.swf;\n\t\t\tif(swf != null) {\n\t\t\t\tvar frame = if(e != null) untyped(e.source).value else Std.int(startFrameStepper.value);\n\t\t\t\t_previewGenerator.getPreview(swf, frame);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function previewReadyHandler(frame) {\n\t\tframeStepperImage.visible = true;\n\t\tuntyped frameStepperImage._implComponent.smoothing = true;\n\t\tuntyped frameStepperImage._implComponent.bitmapData = frame;\n\t\tuntyped frameStepperImage._implImage = frame;\n\t}\n\t\n\tprivate function convertClickHandler(e) : Void {\n\t\tmainContainer.state = \"converting\";\n\n\t\tif(e != null) {\n\t\t\tvar videoCodec : VideoPreset = codecSelectBox.selectedItem;\n\t\t\tif(videoCodec.supportsBitRate && videoBitrateSlider.value != videoBitrateSlider.maximum) {\n\t\t\t\t_controller.videoBitRate = Std.int(videoBitrateSlider.value);\n\t\t\t} else {\n\t\t\t\t_controller.videoBitRate = null;\n\t\t\t}\n\t\t\t\n\t\t\tvar audioCodec : AudioCodec = audioCodecSelectBox.selectedItem;\n\t\t\t_controller.audioBitRate = if(audioCodec.supportsBitRate) Std.int(audioBitrateSlider.value) else null;\n\t\t}\n\t\t\n\t\t_recording = false;\n\t\trecordingButton.selected = false;\n\t\trecordingButton.visible = false;\n\t\t\n\t\t_controller.onProgress.add(convertProgressHandler);\n\t\t_controller.onComplete.add(convertCompleteHandler);\n\t\t_controller.start();\n\t\t\n\t\tcancelButton.visible = false;\n\t\thaxe.Timer.delay( function() cancelButton.visible = true, 2000);\n\t}\n\t\t\n\t// VIDEO tab\n\tprivate function outputBrowseClickHandler(e) : Void {\n\t\tvar outputFile = new File();\n\t\toutputFile.addEventListener(flash.events.Event.SELECT, function(_) _controller.outputFile = outputFile );\n\t\toutputFile.browseForSave(\"Set Output Video File\");\n\t}\n\t\n\tprivate function outputFileEditHandler(_) {\n\t\ttry _controller.outputFile = new File(outputFileBox.text)\n\t\tcatch(error:Dynamic) _controller.outputFile = null;\n\t}\n\t\n\tprivate function updateOutputSize(w : Null<Int>, h : Null<Int>) : Void {\n\t\tvar _w : Float = if(w != null) w else _controller.outputWidth;\n\t\tvar _h : Float = if(h != null) h else _controller.outputHeight;\n\t\t\n\t\tif(_aspectRatio != null) {\n\t\t\tif(w == null) _w = _h * _aspectRatio;\n\t\t\telse if(h == null) _h = _w / _aspectRatio;\n\t\t}\n\t\t\t\t\n\t\tvar forceEven = true;\n\t\tif(forceEven) {\n\t\t\t_w = Std.int(_w/2)*2;\n\t\t\t_h = Std.int(_h/2)*2;\n\t\t}\n\t\t\t\t\n\t\tif(_w < 2) _w = 2;\n\t\tif(_h < 2) _h = 2;\n\t\t\n\t\t_controller.outputWidth = Std.int(_w);\n\t\t_controller.outputHeight = Std.int(_h);\n\t}\n\t\n\tprivate function codecChangeHandler(_) {\n\t\tvar preset : VideoPreset = codecSelectBox.selectedItem;\n\t\t\n\t\tif(_controller.outputFile != null) {\n\t\t\tvar nameParts = _controller.outputFile.name.split(\".\");\n\t\t\tnameParts.pop();\n\t\t\tnameParts.push( preset.fileFormat );\n\t\t\t_controller.outputFile = _controller.outputFile.parent.resolvePath( nameParts.join(\".\") );\n\t\t}\n\t\t\n\t\t_controller.videoPreset = preset;\n\t\t\n\t\tif(preset.supportsBitRate) {\n\t\t\tvideoBitrateSlider.enabled = true;\n\t\t} else {\n\t\t\tvideoBitrateSlider.enabled = false;\n\t\t\tvideoBitrateSlider.value = videoBitrateSlider.maximum;\n\t\t}\n\t\t\n\t\taudioCodecSelectBox.items = if(preset.supportedAudioCodecs != null) preset.supportedAudioCodecs else com.newgrounds.swivel.ffmpeg.FfmpegProcess.FfmpegEncoder.AUDIO_CODECS;\n\t\taudioCodecSelectBox.selectedIndex = 0;\n\t}\n\t\n\tprivate function videoBitrateLabelFunc(v : Float) {\n\t\tif(codecSelectBox != null && codecSelectBox.selectedItem != null && v == videoBitrateSlider.maximum) return \"Lossless\";\n\t\tif(v < 1024*1024) return Math.round(v/1024*10)/10 + \" kbps\";\n\t\telse return Math.round(v/1024/1024*10)/10 + \" Mbps\";\n\t}\n\t\n\tprivate function audioBitrateLabelFunc(v : Float) {\n\t\tif(v < 1024*1024) return Math.round(v/1024*10)/10 + \" kbps\";\n\t\telse return Math.round(v/1024/1024*10)/10 + \" Mbps\";\n\t}\n\t\n\t// === AUDIO ===\n\tprivate function audioBrowseClickHandler(e) : Void {\n\t\texternalAudioFile = new File();\n\t\texternalAudioFile.addEventListener(flash.events.Event.SELECT, function(_) {\n\t\t\t_controller.audioSource = external(externalAudioFile);\n\t\t\texternalAudioFileBox.text = externalAudioFile.nativePath;\n\t\t} );\n\t\texternalAudioFile.browseForOpen(\"Set Audio Track\", [new FileFilter(\"Audio Files (*.mp3, *.wav, *.ogg, *.aac)\", \"*.mp3;*.wav;*.ogg;*.aac\")]);\n\t}\n\t\n\tprivate var _bitmap : flash.display.Bitmap;\n\t\n\tprivate var _recording : Bool;\n\tprivate function convertProgressHandler(progress : SwivelProgressEvent) {\n\t\t// TODO\n\t\tprogressBar.value = progress.progress;\n\t\tvar text;\n\t\ttext = switch(progress.task) {\n\t\t\tcase StartEncoder(_, _):\t\"Starting video encoder...\";\n\t\t\tcase ParseSwf(job):\t\t\t'Parsing SWF... (${job.file.name})';\n\t\t\tcase MutateSwf(job):\t\t'Tweaking SWF... (${job.file.name})';\n\t\t\tcase EncodeSwf(job):\n\t\t\t\trecordingButton.visible = Type.enumEq(progress.job.duration,manual);\n\t\t\t\t'Encoding SWF to video... (${job.file.name})';\n\t\t\tcase DecodeAudio:\t\t\t'Decoding audio clips...';\n\t\t\tcase MixAudio:\t\t\t\t'Mixing audio track...';\n\t\t\tcase StopEncoder:\t\t\t'Finishing video encode...';\n\t\t\tcase EncodeAudio:\t\t\t'Encoding audio track...';\n\t\t\tcase DeleteTempFiles:\t\t'Cleaning up temporary files...';\n\t\t}\n\t\tprogressText.text = text;\n\t\t\n\t\tif(progress.frame != null) {\n\t\t\tuntyped {\n\t\t\t\t_previewImage._image._implComponent.bitmapData = progress.frame;\n\t\t\t\t_previewImage._image._implImage = progress.frame;\n\t\t\t\t//_previewImage._implComponent.width = 702;\n\t\t\t\t//_previewImage._implComponent.height = 395;\n\t\t\t\tif(_previewImage.visible == false) {\n\t\t\t\t\t_previewImage.visible = true;\n\t\t\t\t\t_previewImage.updateSize();\n\t\t\t\t}\n\t\t\t}\n\t\t} else _previewImage.visible = false;\n\t}\n\t\n\tprivate function audioCodecChangeHandler(_) {\n\t\tvar codec : AudioCodec = audioCodecSelectBox.selectedItem;\n\t\t\n\t\t_controller.audioCodec = codec;\n\t\t\n\t\tif(codec.supportsBitRate) {\n\t\t\taudioBitrateSlider.enabled = true;\n\t\t} else {\n\t\t\taudioBitrateSlider.enabled = false;\n\t\t\taudioBitrateSlider.value = audioBitrateSlider.maximum;\n\t\t}\n\t}\n\t\n\tprivate function toggleRecordingHandler(_) {\n\t\tif(!_recording) {\n\t\t\t_controller.startRecording();\n\t\t\t_recording = true;\n\t\t} else {\n\t\t\t_controller.stopRecording();\n\t\t\t_recording = false;\n\t\t\trecordingButton.visible = false;\n\t\t}\n\t}\n\t\n\t// === OVERLAY TAB ===\n\tprivate function alphaSliderFunc(v : Float) return Std.string(Std.int(v * 100)) + \"%\";\n\t\n\tprivate function overlayBrowseClickHandler(e) : Void {\n\t\t_watermarkFile = new File();\n\t\t_watermarkFile.addEventListener(flash.events.Event.SELECT, watermarkSelectHandler );\n\t\t_watermarkFile.browseForOpen(\"Choose Watermark\", [new FileFilter(\"Image Files (*.png, *.jpg, *.jpeg, *.gif)\", \"*.png;*.jpg;*.jpeg;*.gif\")]);\n\t}\n\t\n\tprivate function watermarkFileEditHandler(_) {\n\t\t_watermark.image = null;\n\t\ttry {\n\t\t\t_watermarkFile = new File(watermarkFileBox.text);\n\t\t\twatermarkSelectHandler(null);\n\t\t}\n\t\tcatch(error:Dynamic) _watermarkFile = null;\n\t}\n\t\n\tprivate function watermarkSelectHandler(_) {\n\t\t_watermark.image = null;\n\t\tdrawWatermarkPreview();\n\t\twatermarkFileBox.text = _watermarkFile.nativePath;\n\t\tvar asset = new com.huey.assets.Asset(\"watermark\", External(_watermarkFile.nativePath));\n\t\tasset.onLoaded.add(function(_) { _watermark.image = asset.data; asset.onLoaded.removeAll(); drawWatermarkPreview(); asset = null; } );\n\t\tasset.load();\n\t}\n\t\t\n\tprivate function drawWatermarkPreview() {\n\t\tif(_settingsContainer.state != \"overlay\") return;\n\t\tvar g : flash.display.Graphics = untyped watermarkPreview._implComponent.graphics;\n\t\tg.clear();\n\n\t\tvar w : Float = 108.0;\n\t\tvar h : Float = 61.0;\n\t\tvar scale : Float;\n\t\tvar aspect = _controller.outputWidth / _controller.outputHeight;\n\t\tif(aspect > w/h){\n\t\t\tscale = w/_controller.outputWidth;\n\t\t\th = w / aspect;\n\t\t} else {\n\t\t\tscale = h/_controller.outputHeight;\n\t\t\tw = h * aspect;\n\t\t}\n\t\t\n\t\tg.lineStyle();\n\t\tg.beginFill(0x425137, .35);\n\t\tg.drawRect(-2, -2, w+2, h+2);\n\t\tg.endFill();\n\t\tg.beginFill(0x425137);\n\t\tg.drawRect(0, 0, w, h);\n\t\tg.endFill();\n\t\tg.lineStyle(1, 0, 0.5);\n\t\tg.moveTo(0, 0);\n\t\tg.lineTo(w, h);\n\t\tg.moveTo(w, 0);\n\t\tg.lineTo(0, h);\n\t\tg.lineStyle();\n\t\t\n\t\tif(_watermark.image == null) return;\n\t\tvar iw : Float = _watermark.image.width * _watermark.scale * scale;\n\t\tvar ih : Float = _watermark.image.height * _watermark.scale * scale;\n\t\tvar m = 2.0 * scale;\n\t\tg.beginFill(0xe98a4b, _watermark.alpha);\n\t\tswitch(_watermark.align) {\n\t\t\tcase topLeft:\t\tg.drawRect(m, m, iw, ih);\n\t\t\tcase topCenter:\t\tg.drawRect((w-iw)/2, m, iw, ih);\n\t\t\tcase topRight:\t\tg.drawRect(w-iw-m, m, iw, ih);\n\t\t\tcase middleLeft:\tg.drawRect(m, (h-ih)/2, iw, ih);\n\t\t\tcase center:\t\tg.drawRect((w-iw)/2, (h-ih)/2, iw, ih);\n\t\t\tcase middleRight:\tg.drawRect(w-iw-m, (h-ih)/2, iw, ih);\n\t\t\tcase bottomLeft:\tg.drawRect(m, h-ih-m, iw, ih);\n\t\t\tcase bottomCenter:\tg.drawRect((w-iw)/2, h-ih-m, iw, ih);\n\t\t\tcase bottomRight:\tg.drawRect(w-iw-m, h-ih-m, iw, ih);\n\t\t}\n\t\tg.endFill();\n\t\tuntyped watermarkPreview._implComponent.scrollRect = new flash.geom.Rectangle(0, 0, w, h);\n\t}\n\t\n\t// === ABOUT BOX ===\n\tprivate function aboutCloseHandler(_) {\n\t\taboutBox.visible = false;\n\t\tflash.Lib.current.removeEventListener(flash.events.Event.ENTER_FRAME, aboutFrameHandler);\n\t\tflash.Lib.current.stage.frameRate = 30;\n\t}\n\tprivate function contactClickHandler(_) flash.Lib.getURL(new flash.net.URLRequest(\"mailto:mike@newgrounds.com\"));\n\tprivate function licenseClickHandler(_) File.applicationDirectory.resolvePath(\"license.txt\").openWithDefaultApplication();\n\t\n\t// === ENCODING ===\n\t\n\tprivate function convertCompleteHandler(e) : Void {\n\t\t_controller.onProgress.removeAll();\t// TODO: add once\n\t\t_controller.onComplete.removeAll();\n\t\t\n\t\tif(!_isCmdLine) {\n\t\t\tmainContainer.state = \"complete\";\n\t\t\tvar time : Int = Std.int(e.time);\n\t\t\tvar secs = Std.string(time % 60);\n\t\t\ttime = Std.int(time/60);\n\t\t\tvar mins = Std.string(time % 60);\n\t\t\ttime = Std.int(time/60);\n\t\t\tvar hours = Std.string(time);\n\t\t\tif(hours.length < 2) hours = \"0\" + hours;\n\t\t\tif(mins.length < 2) mins = \"0\" + mins;\n\t\t\tif(secs.length < 2) secs = \"0\" + secs;\n\t\t\ttimeText.text = hours + \":\" + mins + \":\" + secs;\n\t\t\tfileSizeText.text = (Std.int(e.fileSize / (1024*1024) * 10)/ 10) + \" MB\";\n\t\t\tvideoNameText.text = e.outputFile.name;\n\t\t\t\n\t\t\tnew CompleteSound().play();\n\t\t\torderToFront();\n\t\t} else {\n\t\t\tNativeApplication.nativeApplication.exit(0);\n\t\t}\n\t}\n\t\n\tprivate function navClickHandler(e) : Void {\n\t\tif(e.source==sourceButton) _settingsContainer.state = \"source\";\n\t\telse if(e.source==videoButton) _settingsContainer.state = \"video\";\n\t\telse if(e.source==audioButton) _settingsContainer.state = \"audio\";\n\t\telse if(e.source==overlayButton) {\n\t\t\t_settingsContainer.state = \"overlay\";\n\t\t\tdrawWatermarkPreview();\n\t\t}\n\t}\n\t\n\tprivate function qualitySecretHandler(e) {\n\t\tif(e.controlKey) qualitySlider.maximum = 4;\n\t\tuntyped qualitySlider.mouseMoveHandler(null);\n\t}\n\t\n\tprivate function qualitySliderFunc(v : Float) return [\"Low\", \"Medium\", \"High\", \"Higher\", \"Highest\"][Std.int(v)];\n\t\n\tprivate function cancelClickHandler(e) : Void {\n\t\tif(Type.enumConstructor(_controller.currentTask) == \"EncodeSwf\") {\n\t\t\t_controller.stopRecording();\n\t\t\t_recording = false;\n\t\t\trecordingButton.visible = false;\n\t\t} else {\n\t\t\t_controller.stop();\n\t\t\tmainContainer.state = \"setup\";\n\t\t\t\n\t\t\tconvertButton.visible = false;\n\t\t\thaxe.Timer.delay( function() convertButton.visible = true, 2000);\n\t\t\t\n\t\t\tif(_isCmdLine) NativeApplication.nativeApplication.exit(-1);\n\t\t}\n\t}\n\t\n\t// === ENCODING COMPLETE ===\n\tprivate function videoNameClickHandler(_) _controller.outputFile.openWithDefaultApplication();\n\tprivate function backClickHandler(_) mainContainer.state = \"setup\";\n\t\n\toverride private function uncaughtErrorHandler(e) {\n\t\te.preventDefault();\n\t\tif(!_isCmdLine ) {\n\t\t\tmainContainer.state = \"error\";\n\t\t\terrorText.text = 'Whoa! Something bad happened, and the program blew up. Sorry about that!\\nPlease copy and paste this junk and send it to mike@newgrounds.com along with the SWF you were converting:\\n\\n${Std.string(e.error)}\\n${haxe.CallStack.exceptionStack().join(\"\\n\")}';\n\t\t} else {\n\t\t\tNativeApplication.nativeApplication.exit(-1);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/com/newgrounds/swivel/SwivelController.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel;\nimport com.huey.binding.BindableArray;\nimport com.huey.events.Dispatcher;\nimport com.huey.utils.Logger;\nimport com.newgrounds.swivel.audio.AudioTracker;\nimport com.newgrounds.swivel.ffmpeg.FfmpegProcess;\nimport com.newgrounds.swivel.ffmpeg.VideoPreset;\nimport com.newgrounds.swivel.ffmpeg.AudioCodec;\nimport com.newgrounds.swivel.swf.*;\nimport com.newgrounds.swivel.swf.SWFRecorder.ScaleMode;\nimport flash.display.BitmapData;\nimport flash.filesystem.File;\nimport flash.filesystem.FileMode;\nimport flash.filesystem.FileStream;\nimport format.swf.Reader;\nimport haxe.io.Bytes;\nimport haxe.io.BytesInput;\nimport com.newgrounds.swivel.swf.SwivelConnection.ISwivelConnection;\n\n@:autoBuild(com.huey.macros.Macros.build())\ninterface ControllerBase { }\n\nclass SwivelController extends com.huey.binding.Binding.Bindable implements ControllerBase {\n\tpublic var onProgress(default, null)\t\t: Dispatcher<SwivelProgressEvent>;\n\tpublic var onStateChange(default, null) \t: Dispatcher<Dynamic>;\n\tpublic var onComplete(default, null)\t\t: Dispatcher<Dynamic>;\n\t\n\t@bindable public var jobs : BindableArray<SwivelJob>; // TODO\n\n\tprivate var _recorder : SWFRecorder;\n\n\t@bindable @forward(_recorder) public var outputWidth : Int;\n\t@bindable @forward(_recorder) public var outputHeight : Int;\n\t@bindable @forward(_recorder) public var scaleMode : ScaleMode;\n\t@bindable @forward(_recorder) public var transparentBackground : Bool;\n\n\tpublic var stereoAudio : Bool = true;\n\tpublic var audioSource : AudioSource;\n\t\n\t@forward(_recorder) public var watermark : Null<Watermark>;\n\n\tprivate var _videoFile : File;\n\tprivate var _audioFile : File;\n\tprivate var _audioOutput : FileStream;\n\t@bindable public var outputFile : File;\n\t@bindable public var videoPreset : VideoPreset;\n\tpublic var videoBitRate : Null<Int>;\n\t@bindable public var audioCodec : AudioCodec;\n\tpublic var audioBitRate : Null<Int>;\n\t\n\tprivate var _parsedSwf : SwivelSwf;\n\t\t\n\tprivate var _ffmpeg : FfmpegProcess;\n\tprivate var _connection : ISwivelConnection;\n\t\n\tprivate var _recordingStartFrame : Int;\n\tprivate var _recordingNumFrames : Int;\n\tprivate var _totalNumFrames : Int;\n\t\n\tprivate var _audioTracker : AudioTracker;\n\n\tprivate var _startTime : Float;\n\t\n\tprivate var _taskList : List<SwivelTask>;\n\tpublic var currentTask(default, null) : SwivelTask;\n\tprivate var _currentJob : SwivelJob;\n\t\n\tpublic function new() {\n\t\tsuper();\n\t\tjobs = new BindableArray();\n\t\t\n\t\tonProgress = new Dispatcher();\n\t\tonStateChange = new Dispatcher();\n\t\tonComplete = new Dispatcher();\n\t\n\t\t_recorder = new SWFRecorder();\n\t\t_recorder.onFrameCaptured.add(onFrameCaptured);\n\t\t\n\t\taudioSource = swf;\n\t\t\n\t\tvideoPreset = com.newgrounds.swivel.ffmpeg.FfmpegProcess.FfmpegEncoder.PRESETS[0];\n\t\taudioCodec = com.newgrounds.swivel.ffmpeg.FfmpegProcess.FfmpegEncoder.AUDIO_CODECS[0];\n\t}\n\t\n\tpublic function start() : Void {\n\t\t_startTime = haxe.Timer.stamp();\n\t\t\n\t\t_progress = 0;\n\t\t_totalNumFrames = 0;\n\t\t\n\t\tflash.Lib.current.addEventListener(flash.events.Event.ENTER_FRAME, dispatchProgress);\n\t\t\n\t\tif(outputFile.name.split(\".\").length < 2) outputFile = outputFile.resolvePath('../${outputFile.name}.mp4');\n\t\t\n\t\tvar usesSwfAudio = switch(audioSource) {\n\t\t\tcase swf:\n\t\t\t\t_audioFile = File.applicationStorageDirectory.resolvePath(\"temp_audio.raw\");\n\t\t\t\tif(_audioFile.exists) try _audioFile.deleteFile() catch(e:Dynamic) {}\n\t\t\t\ttrue;\n\t\t\t\t\n\t\t\tcase external(source):\n\t\t\t\t_audioFile = source;\n\t\t\t\tfalse;\n\t\t\t\t\n\t\t\tdefault:\n\t\t\t\t_audioFile = null;\n\t\t\t\tfalse;\n\t\t}\n\t\t\n\t\t_videoFile = if(usesSwfAudio) {\n\t\t\tvar nameParts = outputFile.name.split(\".\");\n\t\t\tvar name = if(nameParts.length > 1) \"temp_video.\" + nameParts[nameParts.length-1] else \"temp_video.mp4\";\n\t\t\tFile.applicationStorageDirectory.resolvePath(name);\n\t\t} else {\n\t\t\toutputFile;\n\t\t}\n\t\t\t\t\n\t\t_taskList = new List();\n\t\t_taskList.add( StartEncoder(_videoFile, if(!usesSwfAudio) _audioFile else null) );\n\t\tfor(job in jobs) {\n\t\t\t_taskList.add( ParseSwf(job) );\n\t\t\t_taskList.add( MutateSwf(job) );\n\t\t\tif(usesSwfAudio) {\n\t\t\t\t_taskList.add( EncodeSwf(job) );\n\t\t\t\t_taskList.add( DecodeAudio );\n\t\t\t\t_taskList.add( MixAudio );\n\t\t\t} else {\n\t\t\t\t_taskList.add( EncodeSwf(job) );\n\t\t\t}\n\t\t}\n\t\t_taskList.add( StopEncoder );\n\t\tif(usesSwfAudio) {\n\t\t\t_taskList.add( EncodeAudio );\n\t\t}\n\t\t_taskList.add( DeleteTempFiles );\n\t\t\n\t\trunNextTask();\n\t}\n\t\n\tprivate function runNextTask() {\n\t\tcurrentTask = _taskList.pop();\n\t\tif(currentTask == null) {\n\t\t\tfinish();\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tflash.ui.Mouse.show();\n\t\t\n\t\t_frame = null;\n\t\t\n\t\t_waitCount = 0;\n\t\tflash.Lib.current.addEventListener(flash.events.Event.ENTER_FRAME, runTaskDelay);\n\t}\n\t\n\tprivate function runTaskDelay(_) {\n\t\t_waitCount++;\n\t\tif(_waitCount >= 2) {\n\t\t\tflash.Lib.current.removeEventListener(flash.events.Event.ENTER_FRAME, runTaskDelay);\n\t\t\trunTask(currentTask);\n\t\t}\n\t}\n\t\n\tprivate function runTask(task : SwivelTask) {\n\t\t_currentJob = null;\n\t\tswitch(task) {\n\t\t\tcase StartEncoder(outputFile, inputAudioFile):\n\t\t\t\tvar ffmpeg = new FfmpegEncoder(videoPreset, videoBitRate, outputFile, _recorder.outputWidth, _recorder.outputHeight, jobs.array[0].swf.frameRate, if(inputAudioFile != null) inputAudioFile.nativePath else null, audioCodec, audioBitRate, if(stereoAudio) 2 else 1);\n\t\t\t\tffmpeg.onComplete.add(onEncodingComplete);\n\t\t\t\t_ffmpeg = ffmpeg;\n\t\t\t\trunNextTask();\n\t\t\t\t\n\t\t\tcase ParseSwf(job):\n\t\t\t\t_currentJob = job;\n\t\t\t\tjob.swf.parseSwf();\n\t\t\t\t_parsedSwf = job.swf;\n\t\t\t\trunNextTask();\n\n\t\t\tcase MutateSwf(job):\n\t\t\t\t_currentJob = job;\n\t\t\t\t_swfMutators = new List();\n\t\t\t\t\n\t\t\t\tvar startFrame = switch( job.duration ) {\n\t\t\t\t\tcase frameRange(start,_): start - 1;\n\t\t\t\t\tdefault: 0;\n\t\t\t\t}\n\n\t\t\t\t_swfMutators.add( new SwivelMutator(startFrame) );\n\t\t\t\tif(job.forceBitmapSmoothing) _swfMutators.add( new BitmapSmoothingMutator() );\n\t\t\t\tif(job.swf.version >= 8) _swfMutators.add( new ScaleFilterMutator(_recorder.outputWidth / job.swf.width) );\n\t\t\t\tif(Type.enumEq(audioSource, swf)) { // TODO\n\t\t\t\t\t_audioTracker = new AudioTracker();\n\t\t\t\t\tswitch(_parsedSwf.avmVersion) {\n\t\t\t\t\t\tcase AVM1: _swfMutators.add( new SoundConnectionMutator(\"__swivel\", _audioTracker) );\n\t\t\t\t\t\tcase AVM2: _swfMutators.add( new AS3SoundConnectionMutator(\"__swivel\", _audioTracker) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t_swfMutators.add( new SilenceSoundMutator() );\n\t\t\t\tfor (mutator in _swfMutators) mutator.mutate(job.swf);\n\t\t\t\trunNextTask();\n\n\t\t\tcase EncodeSwf(job):\n\t\t\t\t_currentJob = job;\n\t\t\t\t\n\t\t\t\tif(_connection != null) _connection.close();\n\t\t\t\tif(Type.enumEq(audioSource, swf)) {\n\t\t\t\t\tif(Type.enumEq(_currentJob.swf.avmVersion, AVM1)) {\n\t\t\t\t\t\t_connection = new SwivelConnection();\n\t\t\t\t\t} else _connection = new AS3SwivelConnection();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t_recordingStartFrame = 0;\n\t\t\t\t_recordingNumFrames = 0;\n\t\t\t\t_recorder.showWindow = Type.enumEq(job.duration, manual);\n\t\t\t\t_recorder.renderQuality = _currentJob.renderQuality;\n\n\t\t\t\t_recorder.startPlayback(_parsedSwf, _currentJob.parameters);\n\t\t\t\tif(!_recorder.showWindow) startRecording();\n\t\t\t\t\n\t\t\t\t_parsedSwf.disposeTags();\n\t\t\t\tflash.system.System.gc();\n\t\t\t\t\n\t\t\tcase DecodeAudio:\n\t\t\t\t_audioTracker.onSoundsDecoded.add( function(_) runNextTask() );\n\t\t\t\t_audioTracker.decodeSounds();\n\t\t\t\t\n\t\t\tcase MixAudio:\n\t\t\t\t_audioOutput = new FileStream();\n\t\t\t\t_audioOutput.endian = flash.utils.Endian.LITTLE_ENDIAN;\n\t\t\t\t_audioOutput.open(_audioFile, FileMode.APPEND);\n\t\t\n\t\t\t\t_audioTracker.onMixingComplete.add(audioMixCompleteHandler);\n\t\t\t\t_audioTracker.mixTrack(_audioOutput, _parsedSwf.frameRate, _recordingStartFrame, _recordingNumFrames);\n\t\t\t\t\n\t\t\tcase StopEncoder:\n\t\t\t\tif(_ffmpeg != null) {\n\t\t\t\t\t_ffmpeg.close();\n\t\t\t\t}\n\t\t\t\tif(_connection != null) _connection.close();\n\t\t\t\n\t\t\tcase EncodeAudio:\n\t\t\t\tvar params = [\n\t\t\t\t\t\"-y\",\n\t\t\t\t\t\n\t\t\t\t\t\"-i\",\t\t_videoFile.nativePath,\n\t\t\t\t\t\n\t\t\t\t\t\"-c:a\", \t\"pcm_s16le\",\n\t\t\t\t\t\"-f\",\t\t\"s16le\",\n\t\t\t\t\t\"-ar\",\t\t\"44100\",\n\t\t\t\t\t\"-ac\",\t\t\"2\",\n\t\t\t\t\t\"-i\",\t\t_audioFile.nativePath,\n\n\t\t\t\t\t\"-c:v\",\t\t\"copy\",\n\t\t\t\t\t\"-c:a\",\t\taudioCodec.codec,\n\t\t\t\t\t\"-strict\",\n\t\t\t\t\t\"-2\",\n\t\t\t\t\t\"-ar\",\t\t\"44100\",\n\t\t\t\t\t\"-ac\",\t\tif(stereoAudio) \"2\" else \"1\",\n\t\t\t\t];\n\t\t\t\tif(audioBitRate != null) {\n\t\t\t\t\tparams.push(\"-b:a\");\n\t\t\t\t\tparams.push(Std.string(audioBitRate));\n\t\t\t\t}\n\t\t\t\tparams.push( outputFile.nativePath );\n\t\t\t\t\n\t\t\t\t_ffmpeg =  new FfmpegProcess(params);\n\t\t\t\t_ffmpeg.onComplete.add(onEncodingComplete);\n\t\t\t\t\n\t\t\tcase DeleteTempFiles:\n\t\t\t\tvar dirList = File.applicationStorageDirectory.getDirectoryListing();\n\t\t\t\tfor(f in dirList) {\n\t\t\t\t\tif(StringTools.startsWith(f.name, \"temp_\")) {\n\t\t\t\t\t\ttry f.deleteFile() catch(e:Dynamic) {}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trunNextTask();\n\t\t}\n\t}\n\t\n\tpublic function startRecording() {\n\t\t_recordingStartFrame = _recorder.currentFrame;\n\t\t_recorder.startRecording();\n\t\tif(_audioTracker != null) _audioTracker.listen(_connection);\n\t}\n\t\n\tpublic function stopRecording() {\n\t\t_recorder.stop();\n\t\trunNextTask();\n\t}\n\t\n\tprivate var _waitCount : Int = 0;\n\t\t\t\n\tprivate var _swfMutators : List<ISWFMutator>;\n\t\n\tpublic function audioMixCompleteHandler(_) {\n\t\t_audioOutput.close();\n\t\trunNextTask();\n\t}\n\t\n\tpublic function stop() : Void {\n\t\tif(_ffmpeg != null) {\n\t\t\t_ffmpeg.onComplete.removeAll();\n\t\t\t_ffmpeg.close(true);\n\t\t\t_ffmpeg = null;\n\t\t}\n\t\t\n\t\tif(_connection != null) {\n\t\t\t_connection.close();\n\t\t\t_connection = null;\n\t\t}\n\t\t\n\t\tif(_recorder != null) {\n\t\t\t_recorder.stop();\n\t\t}\n\t\t\n\t\tif(_audioTracker != null) {\n\t\t\t_audioTracker.onSoundsDecoded.removeAll();\n\t\t\t_audioTracker.onMixingComplete.removeAll();\n\t\t\t_audioTracker.stop();\n\t\t\t_audioTracker = null;\n\t\t}\n\t\t\n\t\ttry _audioOutput.close() catch(error:Dynamic) {}\n\t\t\n\t\t_taskList = null;\n\t\t\n\t\tflash.Lib.current.removeEventListener(flash.events.Event.ENTER_FRAME, dispatchProgress);\n\t\tflash.Lib.current.removeEventListener(flash.events.Event.ENTER_FRAME, runTaskDelay);\n\t}\n\n\tprivate function onEncodingComplete(exitCode) : Void {\n\t\tif(exitCode != 0) {\n\t\t\tvar log = Logger.getLog(\"FfmpegLog\");\n\t\t\tif(~/Permission denied/.match(log)) {\n\t\t\t\tthrow('The output file ${outputFile.nativePath} cannot be accessed.\\n\\nIf it is open in another program, please close the program before converting.\\n\\nIf the problem persists, reboot your computer and try saving the output video in a different folder.');\n\t\t\t} else {\n\t\t\t\tthrow('FFmpeg exited with exit code $exitCode\\n\\n$log');\n\t\t\t}\n\t\t}\n\t\trunNextTask();\n\t}\n\t\n\tprivate var _progress : Float;\n\tprivate var _frame : flash.display.BitmapData;\n\t\n\tprivate function onFrameCaptured(frame : flash.display.BitmapData) {\n\t\tif(_ffmpeg != null) _ffmpeg.send( frame.getPixels(frame.rect) );\n\t\n\t\t_recordingNumFrames++;\n\t\t_totalNumFrames++;\n\t\t_frame = frame;\n\t\t_progress = 0;\n\t\tswitch(_currentJob.duration) {\n\t\t\tcase frameRange(startFrame, endFrame):\n\t\t\t\tvar currentFrame = try Std.int(flash.net.SharedObject.getLocal(\"__swivel\").data.frame) catch(e:Dynamic) 0;\n\t\t\t\t_progress =  (currentFrame - startFrame) / (endFrame - startFrame + 1);\n\t\t\t\tif (currentFrame == endFrame) {\n\t\t\t\t\t_recorder.stop();\n\t\t\t\t\trunNextTask();\n\t\t\t\t}\n\t\t\t\t\n\t\t\tcase manual:\n\t\t\t\t\n\t\t\tdefault:\n\t\t}\n\t}\n\t\n\tprivate function dispatchProgress(_) {\n\t\tonProgress.dispatch({\n\t\t\tframe:\t\t_frame,\n\t\t\tprogress:\tif(Type.enumEq(currentTask, MixAudio)) _audioTracker.sample / _audioTracker.numSamples else _progress,\n\t\t\ttask:\t\tcurrentTask,\n\t\t\tjob:\t\t_currentJob,\n\t\t});\n\t}\n\t\n\tprivate function finish() {\n\t\tvar time = haxe.Timer.stamp() - _startTime;\n\t\tstop();\n\t\tonComplete.dispatch( {\n\t\t\ttime:\t\t\ttime,\n\t\t\toutputFile:\t\toutputFile,\n\t\t\tfileSize:\t\toutputFile.size,\n\t\t} );\n\t}\n}\n\ntypedef SwivelProgressEvent = {\n\tvar frame : Null<BitmapData>;\n\tvar progress : Float;\n\tvar task : SwivelTask;\n\tvar job : SwivelJob;\n};\n\ntypedef FileData = {\n\tvar file : File;\n\tvar swf : SwivelSwf;\n}\n\nenum SwivelTask {\n\tStartEncoder(outputVideo : File, ?inputAudio : File);\n\tParseSwf(job : SwivelJob);\n\tMutateSwf(swf : SwivelJob);\n\tEncodeSwf(swf : SwivelJob);\n\tDecodeAudio;\n\tMixAudio;\n\tEncodeAudio;\n\tStopEncoder;\n\tDeleteTempFiles;\n}\n\nenum AudioSource {\n\tnone;\n\tswf;\n\texternal(source : File);\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/SwivelJob.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel;\nimport com.huey.binding.Binding;\nimport com.newgrounds.swivel.swf.SwivelSwf;\nimport com.newgrounds.swivel.swf.RenderQuality;\nimport flash.filesystem.File;\n\nclass SwivelJob extends Binding.Bindable\n{\n\t@bindable public var swf : SwivelSwf;\n\tpublic var file : File;\n\n\t@bindable public var duration : RecordingDuration;\n\t@bindable public var renderQuality : RenderQuality;\n\t@bindable public var forceBitmapSmoothing : Bool;\n\tpublic var parameters : Dynamic;\n\t\n\tpublic function new(file : File, swf : SwivelSwf) {\n\t\tsuper();\n\t\trenderQuality = High;\n\t\tforceBitmapSmoothing = true;\n\t\tthis.file = file;\n\t\tthis.swf = swf;\n\t\tduration = frameRange(1,swf.numFrames);\n\t}\n\t\n\tpublic function toString() : String { return file.nativePath; }\n}\n\n\nenum RecordingDuration {\n\tframeRange(startFrame : Int, endFrame : Int);\n\tmanual;\n}\n"
  },
  {
    "path": "src/com/newgrounds/swivel/audio/ActionScriptSoundInstance.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.audio;\n\nclass ActionScriptSoundInstance extends SoundInstance {\n\tpublic function new(sound : SoundClip, instance : Int, inPoint : Int, loops : Int) : Void {\n\t\tsuper(sound, inPoint, null, loops);\n\t\tthis.instance = instance;\n\t}\n\t\n\tpublic var instance(default, null) : Int;\n\t\n\tpublic var volume : Float\t\t\t= 1.0;\n\tpublic var leftToLeft : Float\t\t= 1.0;\n\tpublic var leftToRight : Float\t\t= 0.0;\n\tpublic var rightToLeft : Float\t\t= 0.0;\n\tpublic var rightToRight : Float\t\t= 1.0;\n\t\n\toverride private function applyTransforms(sample : SoundSample) {\n\t\tvar l : Float = sample.left;\n\t\tvar r : Float = sample.right;\n\t\tsample.left = volume * (leftToLeft * l + rightToLeft * r);\n\t\tsample.right = volume * (leftToRight * l + rightToRight * r);\n\t}\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/audio/AudioTracker.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.audio;\n\nimport com.huey.events.Dispatcher;\nimport com.huey.utils.Logger;\nimport flash.filesystem.FileStream;\nimport haxe.Int32;\nimport haxe.ds.IntMap;\nimport haxe.ds.StringMap;\nimport haxe.io.Bytes;\nimport haxe.io.BytesInput;\nimport haxe.io.BytesOutput;\nimport com.newgrounds.swivel.swf.SwivelConnection.ISwivelConnection;\nimport haxe.io.Eof;\nimport format.swf.Data;\nimport com.newgrounds.swivel.audio.SoundClip.SoundClipId;\n\nclass AudioTracker\n{\n\tpublic var onSoundsDecoded : Dispatcher<Dynamic>;\n\tpublic var onMixingComplete : Dispatcher<Dynamic>;\n\t\t\n\tprivate var _sounds : List<SoundClip>;\n\tprivate var _eventSounds : IntMap<SoundClip>;\n\tprivate var _streamSounds : IntMap<SoundClip>;\n\tprivate var _asSounds : StringMap<SoundClip>;\n\tprivate var _decodeIterator : Iterator<SoundClip>;\n\t\n\tprivate var _soundLog : Array<SoundLogEntry>;\n\tprivate var _activeStreams : IntMap<SoundLogEntry>;\n\t\n\tprivate var _soundInstances : List<SoundInstance>;\n\tprivate var _asSoundInstances : List<ActionScriptSoundInstance>;\n\tprivate var _as2Transforms : IntMap<SoundTransform>;\n\tprivate var _globalTransform : SoundTransform;\n\tpublic function new() {\n\t\t_sounds = new List();\n\t\t\n\t\t_eventSounds = new IntMap();\n\t\t_streamSounds = new IntMap();\n\t\t_asSounds = new StringMap();\n\t\t\n\t\t_soundLog = new Array();\n\t\t_activeStreams = new IntMap();\n\t\t\n\t\t_soundInstances = new List();\n\t\t_asSoundInstances = new List();\n\t\t_as2Transforms = new IntMap();\n\t\t_globalTransform = {\n\t\t\tvolume:\t\t\t1.0,\n\t\t\tleftToLeft:\t\t1.0,\n\t\t\tleftToRight:\t0.0,\n\t\t\trightToLeft:\t0.0,\n\t\t\trightToRight:\t1.0,\n\t\t};\n\t\t\n\t\tonSoundsDecoded = new Dispatcher();\n\t\tonMixingComplete = new Dispatcher();\n\t\t\n\t\t_sample = {left: 0, right: 0};\n\t}\n\t\n\tpublic function listen(connection : ISwivelConnection) : Void {\n\t\tconnection.client = {\n\t\t\tstartSound:\t\tstartSoundHandler,\n\t\t\tstreamSound:\tstreamSoundHandler,\n\t\t\tasStart:\t\tasStartHandler,\n\t\t\tasStop:\t\t\tasStopHandler,\n\t\t\tasSetVolume:\tasSetVolumeHandler,\n\t\t\tasSetPan:\t\tasSetPanHandler,\n\t\t\tasSetTransform:\tasSetTransformHandler,\n\t\t};\n\t}\n\t\n\tpublic function registerSound(clip : SoundClip) : Void {\n\t\t_sounds.push(clip);\n\t\tswitch(clip.id) {\n\t\t\tcase SoundClipId.event(id):\t\t\t\t_eventSounds.set(id, clip);\n\t\t\tcase SoundClipId.stream(id):\t\t\t_streamSounds.set(id, clip);\n\t\t\tcase SoundClipId.actionScript(name):\t_asSounds.set(name, clip);\n\t\t}\n\t}\n\n\tpublic function decodeSounds() {\n\t\t_decodeIterator = _sounds.iterator();\n\t\tdecodeNextSound();\n\t}\n\t\n\tfunction decodeNextSound() {\n\t\tif (_decodeIterator.hasNext()) {\n\t\t\tvar clip = _decodeIterator.next();\n\t\t\tvar decoder = new Decoder(clip);\n\t\t\tswitch(clip.id) {\n\t\t\t\t//case SoundClipId.actionScript(_):\n//\t\t\t\t\t\tdecodeNextSound();\n\t\t\t\tdefault:\n\t\t\t\tdecoder.onComplete.add( function(e) decodeNextSound() );\n\t\t\t\tdecoder.start();\n\t\t\t}\n\t\t} else {\n\t\t\t_decodeIterator = null;\n\t\t\tonSoundsDecoded.dispatch();\n\t\t}\n\t}\n\n\tprivate function startSoundHandler(frame : Int, soundId : Int, sync : Int, ?startPos : Int32, ?endPos: Int32, ?numLoops : Int, ?envelopeData : Array<Dynamic>) : Void {\n\t\tLogger.log(\"AudioTrackLog\", '$frame: StartSound id: $soundId\\n');\n\t\tvar envelope = null;\n\t\tif (envelopeData != null && envelopeData.length > 0) {\n\t\t\tenvelope = [];\n\t\t\tvar i = 0;\n\t\t\twhile (i < envelopeData.length) {\n\t\t\t\tenvelope.push( {\n\t\t\t\t\tpos: envelopeData[i],\n\t\t\t\t\tleftVolume: envelopeData[i + 1],\n\t\t\t\t\trightVolume: envelopeData[i+2]\n\t\t\t\t} );\n\t\t\t\ti += 3;\n\t\t\t}\n\t\t}\n\n\t\t_soundLog.push( {\n\t\t\tsoundId:\tevent(soundId),\n\t\t\tframe:\t\tframe,\n\t\t\ttype:\t\tevent({\n\t\t\t\tstop:\t\tsync == 2,\n\t\t\t\tnoMultiple:\tsync == 1,\n\t\t\t\tenvelope:\tenvelope,\n\t\t\t\tnumLoops:\tnumLoops,\n\t\t\t\tstartPos:\tstartPos,\n\t\t\t\tendPos:\t\tendPos,\n\t\t\t}),\n\t\t} );\n\t}\n\n\tprivate function streamSoundHandler(movieFrame : Int, streamId : Int, streamFrame : Int) : Void {\n\t\tLogger.log(\"AudioTrackLog\", '$movieFrame: StreamSound id: $streamId streamFrame: $streamFrame\\n');\n\t\tvar streamLog = _activeStreams.get(streamId);\n\t\tif (streamLog != null) {\n\t\t\tswitch(streamLog.type) {\n\t\t\t\tcase stream(frames):\n\t\t\t\t\tif (frames.endFrame == streamFrame - 1 && streamLog.frame + (frames.endFrame - frames.startFrame) == movieFrame - 1)\n\t\t\t\t\t\tframes.endFrame = streamFrame;\n\t\t\t\t\telse\n\t\t\t\t\t\tstreamLog = null;\n\t\t\t\t\t\t\n\t\t\t\tdefault: throw(\"Event sound in activeStreams\");\n\t\t\t}\n\t\t}\n\n\t\tif (streamLog == null) {\n\t\t\tstreamLog = {\n\t\t\t\tsoundId:\tstream(streamId),\n\t\t\t\tframe:\t\tmovieFrame,\n\t\t\t\ttype:\t\tstream({startFrame: streamFrame, endFrame: streamFrame})\n\t\t\t}\n\t\t\t_activeStreams.set(streamId, streamLog);\n\t\t\t_soundLog.push(streamLog);\n\t\t}\n\t}\n\t\n\tprivate function asStartHandler(movieFrame : Int, instanceNum : Int, soundName : String, offsetSeconds : Null<Float>, loops : Null<Int>) {\n\t\tvar soundId = SoundClipId.actionScript(soundName);\n\t\tvar sound = getSound(soundId);\n\t\t_soundLog.push( {\n\t\t\tsoundId:\tsoundId,\n\t\t\tframe:\t\tmovieFrame,\n\t\t\ttype:\t\tasStart(instanceNum, if(offsetSeconds != null) Std.int(offsetSeconds*SAMPLE_RATE) else null, if(loops != null) loops else 1),\n\t\t} );\n\t}\n\t\n\tprivate function asStopHandler(movieFrame : Int, instanceNum : Int) {\n\t\t_soundLog.push( {\n\t\t\tsoundId:\tnull,\n\t\t\tframe:\t\tmovieFrame,\n\t\t\ttype:\t\tasStop(instanceNum),\n\t\t} );\n\t}\n\t\n\tprivate function asSetVolumeHandler(movieFrame : Int, instanceNum : Int, volume : Float) {\n\t\t_soundLog.push( {\n\t\t\tsoundId:\tnull,\n\t\t\tframe:\t\tmovieFrame,\n\t\t\ttype:\t\tasSetVolume(instanceNum, volume),\n\t\t} );\n\t}\n\t\n\tprivate function asSetPanHandler(movieFrame : Int, instanceNum : Int, pan : Float) {\n\t\t_soundLog.push( {\n\t\t\tsoundId:\tnull,\n\t\t\tframe:\t\tmovieFrame,\n\t\t\ttype:\t\tasSetPan(instanceNum, pan),\n\t\t} );\n\t}\n\t\n\tprivate function asSetTransformHandler(movieFrame : Int, instanceNum : Int, ll : Float, lr : Float, rr : Float, rl : Float) {\n\t\t_soundLog.push( {\n\t\t\tsoundId:\tnull,\n\t\t\tframe:\t\tmovieFrame,\n\t\t\ttype:\t\tasSetTransform(instanceNum, ll, lr, rl, rr),\n\t\t} );\n\t}\n\t\n\tpublic function getSound(id : SoundClipId) : SoundClip {\n\t\tif(id == null) return null;\n\t\t\n\t\treturn switch(id) {\n\t\t\tcase SoundClipId.event(soundId):\t\t_eventSounds.get(soundId);\n\t\t\tcase SoundClipId.stream(clipId):\t\t_streamSounds.get(clipId);\n\t\t\tcase SoundClipId.actionScript(name):\t_asSounds.get(name);\n\t\t}\n\t}\n\t\n\tprivate static inline var TIME_SLICE : Float = 0.25;\n\tpublic var sample : Int;\n\tprivate var _audioOutput : FileStream;\n\tprivate var frameRate : Float;\n\tprivate var startFrame : Int;\n\tpublic  var numFrames : Int;\n\tpublic var numSamples : Int;\n\t\n\tprivate var _sample : SoundSample;\n\t\n\tprivate static inline var BYTES_PER_SAMPLE = 4;\n\tprivate static inline var SAMPLE_RATE = 44100;\n\t\n\tpublic function mixTrack(output : FileStream, frameRate : Float, startFrame : Int, numFrames : Int) {\n\t\tsample = 0;\n\t\tthis.startFrame = startFrame;\n\t\tthis.numFrames = numFrames;\n\t\tthis.frameRate = frameRate;\n\t\tnumSamples = Std.int(numFrames * SAMPLE_RATE / frameRate);\n\t\t_audioOutput = output;\n\t\tflash.Lib.current.addEventListener(flash.events.Event.ENTER_FRAME, mixTrackWork);\n\t}\n\t\n\tprivate function mixTrackWork(_) {\n\t\tvar samplesPerFrame : Int = Std.int(frameRate * BYTES_PER_SAMPLE);\n\t\tvar length : Int32;// = 1;// Int32.ofInt(numFrames).mul(samplesPerFrame);\n\t\t\n\t\tvar startTime = haxe.Timer.stamp();\n\t\twhile(sample < numSamples && haxe.Timer.stamp() - startTime < TIME_SLICE) {\n\t\t\tvar frame = sample * frameRate / SAMPLE_RATE + startFrame;\n\n\t\t\t// check if any new sound logs occurred this frame\n\t\t\twhile (_soundLog.length > 0 && _soundLog[0].frame <= frame) {\n\t\t\t\tvar e = _soundLog.shift();\n\t\t\t\tvar soundClip : SoundClip = getSound(e.soundId);\n\t\t\t\t\n\t\t\t\tswitch(e.type) {\n\t\t\t\t\tcase event(info):\n\t\t\t\t\t\tif (soundClip == null) continue;\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Sync: \"event\"\n\t\t\t\t\t\tvar play = true;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( info.stop ) {\n\t\t\t\t\t\t\t// Sync: \"stop\"\n\t\t\t\t\t\t\t// Stop any active instances of this sound.\n\t\t\t\t\t\t\tfor(sound in _soundInstances) {\n\t\t\t\t\t\t\t\tif (Type.enumEq(sound.id, e.soundId))\n\t\t\t\t\t\t\t\t\t_soundInstances.remove(sound);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tplay = false;\n\t\t\t\t\t\t} else if ( info.noMultiple ) {\n\t\t\t\t\t\t\t// Sync: \"start\"\n\t\t\t\t\t\t\t// Only play if there are no instances of this sound already playing.\n\t\t\t\t\t\t\tvar found = false;\n\t\t\t\t\t\t\tfor (sound in _soundInstances) {\n\t\t\t\t\t\t\t\tif (Type.enumEq(sound.id, e.soundId)) {\n\t\t\t\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tplay = !found;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (play) {\n\t\t\t\t\t\t\t_soundInstances.add( new EventSoundInstance(soundClip, info) );\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\tcase stream(frames):\n\t\t\t\t\t\tif(soundClip == null) continue;\n\t\t\t\t\t\t_soundInstances.add( new SoundInstance(soundClip, Std.int(frames.startFrame * SAMPLE_RATE / frameRate), Std.int(frames.endFrame * SAMPLE_RATE / frameRate), 0) );\n\t\t\t\t\t\t\n\t\t\t\t\tcase asStart(i, secs, loops):\n\t\t\t\t\t\tif(soundClip == null) continue;\n\t\t\t\t\t\tvar soundInst = new ActionScriptSoundInstance(soundClip, i, secs * SAMPLE_RATE, loops);\n\t\t\t\t\t\tvar transform = _as2Transforms.get(i);\n\t\t\t\t\t\tif(transform == null) {\n\t\t\t\t\t\t\ttransform = {volume: _globalTransform.volume, leftToLeft: _globalTransform.leftToLeft, leftToRight: _globalTransform.leftToRight, rightToLeft: _globalTransform.rightToLeft, rightToRight: _globalTransform.rightToRight};\n\t\t\t\t\t\t\t_as2Transforms.set(i, transform);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsoundInst.volume = transform.volume;\n\t\t\t\t\t\tsoundInst.leftToLeft = transform.leftToLeft;\n\t\t\t\t\t\tsoundInst.leftToRight = transform.leftToRight;\n\t\t\t\t\t\tsoundInst.rightToRight = transform.rightToRight;\n\t\t\t\t\t\tsoundInst.rightToLeft = transform.rightToLeft;\n\t\t\t\t\t\t_asSoundInstances.add(soundInst);\n\t\t\t\t\t\n\t\t\t\t\tcase asStop(i):\n\t\t\t\t\t\tfor (sound in _asSoundInstances)\n\t\t\t\t\t\t\tif(sound.instance == i) _asSoundInstances.remove(sound);\n\t\t\t\t\t\t\t\n\t\t\t\t\tcase asSetVolume(i, v):\n\t\t\t\t\t\tvar transform;\n\t\t\t\t\t\tif(i==-1) {\n\t\t\t\t\t\t\ttransform = _globalTransform;\n\t\t\t\t\t\t\t_as2Transforms = new IntMap();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttransform = _as2Transforms.get(i);\n\t\t\t\t\t\t\tif(transform == null) {\n\t\t\t\t\t\t\t\ttransform = {volume: _globalTransform.volume, leftToLeft: _globalTransform.leftToLeft, leftToRight: _globalTransform.leftToRight, rightToLeft: _globalTransform.rightToLeft, rightToRight: _globalTransform.rightToRight};\n\t\t\t\t\t\t\t\t_as2Transforms.set(i, transform);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\ttransform.volume = v;\n\t\t\t\t\t\tfor (sound in _asSoundInstances)\n\t\t\t\t\t\t\tif(i == -1 || sound.instance == i) sound.volume = v;\n\t\t\t\t\t\t\t\n\t\t\t\t\tcase asSetPan(i, p):\n\t\t\t\t\t\tvar transform;\n\t\t\t\t\t\tif(i==-1) {\n\t\t\t\t\t\t\ttransform = _globalTransform;\n\t\t\t\t\t\t\t_as2Transforms = new IntMap();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttransform = _as2Transforms.get(i);\n\t\t\t\t\t\t\tif(transform == null) {\n\t\t\t\t\t\t\t\ttransform = {volume: _globalTransform.volume, leftToLeft: _globalTransform.leftToLeft, leftToRight: _globalTransform.leftToRight, rightToLeft: _globalTransform.rightToLeft, rightToRight: _globalTransform.rightToRight};\n\t\t\t\t\t\t\t\t_as2Transforms.set(i, transform);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttransform.leftToRight = 0;\n\t\t\t\t\t\ttransform.rightToLeft = 0;\n\t\t\t\t\t\ttransform.leftToLeft = 1.0 - p;\n\t\t\t\t\t\ttransform.rightToRight = 1.0 + p;\n\t\t\t\t\t\tif(transform.leftToLeft > 1.0) transform.leftToLeft = 1.0;\n\t\t\t\t\t\tif(transform.rightToRight > 1.0) transform.rightToRight = 1.0;\n\t\t\t\t\t\tfor (sound in _asSoundInstances)\n\t\t\t\t\t\t\tif(i==-1 || sound.instance == i) {\n\t\t\t\t\t\t\t\tsound.leftToRight = 0;\n\t\t\t\t\t\t\t\tsound.rightToLeft = 0;\n\t\t\t\t\t\t\t\tsound.leftToLeft = transform.leftToLeft;\n\t\t\t\t\t\t\t\tsound.rightToRight = transform.rightToRight;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\n\t\t\t\t\tcase asSetTransform(i, ll, lr, rr, rl):\n\t\t\t\t\t\tvar transform;\n\t\t\t\t\t\tif(i==-1) {\n\t\t\t\t\t\t\ttransform = _globalTransform;\n\t\t\t\t\t\t\t_as2Transforms = new IntMap();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttransform = _as2Transforms.get(i);\n\t\t\t\t\t\t\tif(transform == null) {\n\t\t\t\t\t\t\t\ttransform = {volume: _globalTransform.volume, leftToLeft: _globalTransform.leftToLeft, leftToRight: _globalTransform.leftToRight, rightToLeft: _globalTransform.rightToLeft, rightToRight: _globalTransform.rightToRight};\n\t\t\t\t\t\t\t\t_as2Transforms.set(i, transform);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttransform.leftToRight = rl;\n\t\t\t\t\t\ttransform.rightToRight = rr;\n\t\t\t\t\t\ttransform.leftToLeft = ll;\n\t\t\t\t\t\ttransform.rightToLeft = lr;\n\t\t\t\t\t\tfor (sound in _asSoundInstances)\n\t\t\t\t\t\t\tif(i==-1 || sound.instance == i) {\n\t\t\t\t\t\t\t\tsound.leftToLeft = ll;\n\t\t\t\t\t\t\t\tsound.rightToLeft = lr;\n\t\t\t\t\t\t\t\tsound.leftToRight = rl;\n\t\t\t\t\t\t\t\tsound.rightToRight = rr;\n\t\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// mix all active sounds together\n\t\t\t_sample.left = 0;\n\t\t\t_sample.right = 0;\n\t\t\tfor (sound in _soundInstances) {\n\t\t\t\tif( sound.step(_sample) ) {\n\t\t\t\t\t_soundInstances.remove(sound);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (sound in _asSoundInstances) {\n\t\t\t\tif( sound.step(_sample) ) {\n\t\t\t\t\t_soundInstances.remove(sound);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// clamp result\n\t\t\tif (_sample.left > 32767) _sample.left = 32767;\n\t\t\tif (_sample.left < -32768) _sample.left = -32768;\n\t\t\tif (_sample.right > 32767) _sample.right = 32767;\n\t\t\tif (_sample.right < -32768) _sample.right = -32768;\n\t\t\t\n\t\t\t// output\n\t\t\t_audioOutput.writeShort(Std.int(_sample.left));\n\t\t\t_audioOutput.writeShort(Std.int(_sample.right));\n\t\t\t\n\t\t\tsample++;\n\t\t}\n\t\t\n\t\tif(sample >= numSamples) {\n\t\t\tstop();\n\t\t\tonMixingComplete.dispatch();\n\t\t}\n\t}\n\t\n\tpublic function stop() {\n\t\tflash.Lib.current.removeEventListener(flash.events.Event.ENTER_FRAME, mixTrackWork);\n\t}\n}\n\n// TODO: this nomenclature is getting confusing...\nenum SoundLogType {\n\tevent(info : StartSoundInfo);\n\tstream(frames : {startFrame : Int, endFrame : Int});\n\tasStart(instance : Int, offsetSeconds : Null<Int>, loops : Int);\n\tasSetVolume(instance : Int, volume : Float);\n\tasSetPan(instance : Int, pan : Float);\n\tasSetTransform(instance : Int, ll : Float, lr : Float, rl : Float, rr : Float);\n\tasStop(instance : Int);\n}\n\ntypedef SoundLogEntry = {\n\tvar frame : Int;\n\tvar soundId : SoundClipId;\n\tvar type : SoundLogType;\n}\n\ntypedef SoundTransform = {\n\tvar volume : Float;\n\tvar leftToLeft : Float;\n\tvar leftToRight : Float;\n\tvar rightToLeft : Float;\n\tvar rightToRight : Float;\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/audio/Decoder.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.audio;\nimport com.huey.events.Dispatcher;\nimport com.newgrounds.swivel.ffmpeg.FfmpegProcess;\nimport flash.filesystem.File;\nimport flash.filesystem.FileMode;\nimport flash.filesystem.FileStream;\nimport flash.utils.ByteArray;\nimport haxe.io.Bytes;\nimport haxe.io.BytesOutput;\n\nclass Decoder\n{\n\tpublic var onComplete(default, null) : Dispatcher<Dynamic>;\n\t\n\tprivate var _clip : SoundClip;\n\tprivate var _ffmpeg : FfmpegProcess;\n\t\n\tprivate var _outFile : File;\n\t\n\tpublic function new(clip : SoundClip) {\n\t\tonComplete = new Dispatcher();\n\t\t_clip = clip;\n\t}\n\t\n\tpublic function start() : Void {\n\t\t// TODO: sometiems we are getting 0 length streams\n\t\tif(_clip.data[0].length == 0) {\n\t\t\tonComplete.dispatch();\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tvar inFile : File = File.applicationStorageDirectory.resolvePath(\"temp_clipIn\");\n\t\t_outFile = File.applicationStorageDirectory.resolvePath(\"temp_clipOut\");\n\t\tvar fileStream : FileStream = new FileStream();\n\t\t\n\t\tvar useFlv = false;\n\t\t\n\t\tvar args = [\"-y\", \"-f\"];\n\t\t\n\t\targs.push( switch(_clip.format) {\n\t\t\tcase SFNativeEndianUncompressed,SFLittleEndianUncompressed:\n\t\t\t\tif (_clip.is16bit) \"s16le\" else \"u8\";\n\t\t\tcase SFNellymoser,SFNellymoser16k,SFNellymoser8k,SFADPCM,SFSpeex:\n\t\t\t\tuseFlv = true; \"flv\";\n\t\t\tcase SFMP3:\n\t\t\t\t\"mp3\";\n\t\t} );\n\t\t\n\t\tswitch(_clip.format) {\n\t\t\tcase SFNativeEndianUncompressed,SFLittleEndianUncompressed:\n\t\t\t\targs = args.concat([\n\t\t\t\t\t\"-ac\",\t_clip.isStereo ? \"2\" : \"1\",\n\t\t\t\t\t\"-ar\",\n\t\t\t\t\tswitch(_clip.sampleRate) {\n\t\t\t\t\t\tcase SR5k:\t\"5512\";\n\t\t\t\t\t\tcase SR11k:\t\"11025\";\n\t\t\t\t\t\tcase SR22k:\t\"22050\";\n\t\t\t\t\t\tcase SR44k:\t\"44100\";\n\t\t\t\t\t}\n\t\t\t\t]);\n\t\t\tdefault:\n\t\t}\n\t\t\n\t\targs = args.concat([\"-i\", inFile.nativePath]);\n\t\t\n\t\targs = args.concat( [\n\t\t\t\"-f\",\t\"s16le\",\n\t\t\t\"-ac\",  \"2\",\n\t\t\t\"-ar\",\t\"44100\",\n\t\t\t_outFile.nativePath\n\t\t] );\n\t\t\n\t\tfileStream.open( inFile, FileMode.WRITE );\n\t\tif (useFlv) writeFlvData(_clip, fileStream);\n\t\telse writeAudioData(_clip, fileStream);\n\t\tfileStream.close();\n\t\t\n\t\ttrace(args);\n\n\t\t_ffmpeg = new FfmpegProcess(args);\n\t\t\n\t\t_ffmpeg.onComplete.add(onDecodeComplete);\n\t}\n\n\tprivate function writeAudioData(sound : SoundClip, out : FileStream) : Void {\n\t\tout.writeBytes(sound.data[0].getData());\n\t}\n\t\n\tprivate function writeFlvData(sound : SoundClip, out : FileStream) : Void {\n\t\tout.endian = flash.utils.Endian.BIG_ENDIAN;\n\t\t\t\n\t\tout.writeUTFBytes(\"FLV\");\n\t\tout.writeByte(1);\n\t\tout.writeByte(0x4);\t\t\t// audio only\n\t\tout.writeUnsignedInt(0x9);\t// header size\n\t\t\t\t\t\n\t\t// tag size\n\t\tout.writeUnsignedInt(0);\n\t\t\n\t\tfor(packet in sound.data) {\n\t\t\tvar pos = out.position;\n\t\t\t\n\t\t\tout.writeByte(0x8);\t\t\t// audio\n\t\t\t\n\t\t\t// data size\n\t\t\tvar dataSize: Int = packet.length + 1;\n\t\t\tout.writeByte((dataSize >> 16) & 0xff);\n\t\t\tout.writeByte((dataSize >> 8) & 0xff);\n\t\t\tout.writeByte(dataSize & 0xff);\n\t\t\t\n\t\t\tout.writeByte(0);\t\t// timestamp TODO: write an actual value here? seems to work ok regardless\n\t\t\tout.writeShort(0);\n\t\t\tout.writeByte(0);\t\t// timestamp ext.\n\t\t\t\n\t\t\tout.writeByte(0);\t\t// stream id\n\t\t\tout.writeShort(0);\n\t\t\t\n\t\t\t// audio tag header\n\t\t\tvar tagHeader : Int = 0x2;\n\t\t\ttagHeader |= switch(sound.format) {\n\t\t\t\tcase SFADPCM:\t\t\t\t0x10;\n\t\t\t\tcase SFNellymoser16k:\t\t0x40;\n\t\t\t\tcase SFNellymoser8k:\t\t0x50;\n\t\t\t\tcase SFNellymoser:\t\t\t0x60;\n\t\t\t\tcase SFSpeex:\t\t\t\t0xb0;\n\t\t\t\tdefault:\t\t\t\t\tthrow(\"FlvDecoder does not support codec \" + sound.format);\n\t\t\t}\n\t\t\t\n\t\t\ttagHeader |= switch(sound.sampleRate) {\n\t\t\t\tcase SR5k:\t\t0;\n\t\t\t\tcase SR11k:\t\t0x4;\n\t\t\t\tcase SR22k:\t\t0x8;\n\t\t\t\tcase SR44k:\t\t0xc;\n\t\t\t}\n\t\t\t\n\t\t\tif (sound.isStereo) tagHeader |= 0x1;\n\t\t\tout.writeByte(tagHeader);\n\t\t\t\n\t\t\tout.writeBytes(packet.getData());\n\t\t\t\n\t\t\tout.writeUnsignedInt( Std.int(out.position - pos) );\n\t\t}\n\t}\n\t\n\tprivate function onDecodeComplete(exitCode) : Void {\n\t\ttry {\n\t\t\tif(exitCode == 0) {\n\t\t\t\tvar fileStream : FileStream = new FileStream();\n\t\t\t\tfileStream.open( _outFile, FileMode.READ );\n\t\t\t\t\n\t\t\t\tvar byteArray : ByteArray = new ByteArray();\n\t\t\t\tvar skipCount = _clip.latencySeek * 4;\n\t\t\t\tvar scale = switch(_clip.sampleRate) {\n\t\t\t\t\tcase SR5k:\t\t8;\n\t\t\t\t\tcase SR11k:\t\t4;\n\t\t\t\t\tcase SR22k:\t\t2;\n\t\t\t\t\tcase SR44k:\t\t1;\n\t\t\t\t}\n\n\t\t\t\tfileStream.position += skipCount * scale;\n\t\t\t\tvar len = if(_clip.numSamples != null) _clip.numSamples * 4 * scale else fileStream.bytesAvailable;\n\t\t\t\tif(len > Std.int(fileStream.bytesAvailable)) len = Std.int(fileStream.bytesAvailable);\n\t\t\t\tfileStream.readBytes(byteArray, 0, len);\n\t\t\t\tfileStream.close();\n\t\t\t\t\n\t\t\t\t_clip.data = [Bytes.ofData(byteArray)];\n\t\t\t} else {\n\t\t\t\t_clip.data = [Bytes.alloc(0)];\n\t\t\t}\n\t\t} catch(_ : Dynamic) {\n\t\t\t_clip.data = [Bytes.alloc(0)];\n\t\t}\n\t\t\n\t\tonComplete.dispatch();\n\t}\n}\n"
  },
  {
    "path": "src/com/newgrounds/swivel/audio/EventSoundInstance.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.audio;\nimport format.swf.Data.SoundEnvelopePoint;\nimport format.swf.Data.StartSoundInfo;\nimport haxe.Int32;\n\nclass EventSoundInstance extends SoundInstance {\n\tprivate static inline var MAX_VOLUME : Int = 32768;\n\t\t\n\tpublic function new(sound : SoundClip, info : StartSoundInfo) {\n\t\tsuper(\n\t\t\tsound,\n\t\t\tif (info.startPos != null) info.startPos else null,\n\t\t\tif (info.endPos != null) info.endPos else null,\n\t\t\tif (info.numLoops != null) info.numLoops else 1\n\t\t);\n\t\t_envelope = if(info.envelope != null) info.envelope else new Array();\n\t}\n\t\n\toverride private function applyTransforms(sample : SoundSample) {\n\t\tif(_envelopeIndex < _envelope.length) {\n\t\t\t_volumeLeft += _dVolumeLeft;\n\t\t\t_volumeRight += _dVolumeRight;\n\t\t\n\t\t\tvar point : SoundEnvelopePoint = _envelope[_envelopeIndex];\n\t\t\tif(_sampleCount >= point.pos) {\n\t\t\t\t_volumeLeft = point.leftVolume / MAX_VOLUME;\n\t\t\t\t_volumeRight = point.rightVolume / MAX_VOLUME;\n\t\t\t\t\n\t\t\t\t_envelopeIndex++;\n\t\t\t\tif(_envelopeIndex < _envelope.length) {\n\t\t\t\t\tpoint = _envelope[_envelopeIndex];\n\t\t\t\t\tvar dp : Int = point.pos - _sampleCount;\n\t\t\t\t\t_dVolumeLeft = (point.leftVolume / MAX_VOLUME - _volumeLeft) / dp;\n\t\t\t\t\t_dVolumeRight = (point.rightVolume / MAX_VOLUME - _volumeRight) / dp;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tsample.left *= _volumeLeft;\n\t\tsample.right *= _volumeRight;\n\t}\n\t\n\tprivate var _dVolumeLeft : Float\t= 0.0;\n\tprivate var _dVolumeRight : Float\t= 0.0;\n\tprivate var _volumeLeft : Float\t\t= 1.0;\n\tprivate var _volumeRight : Float\t= 1.0;\n\tprivate var _envelope : Array<SoundEnvelopePoint>;\n\tprivate var _envelopeIndex : Int;\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/audio/SoundClip.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.audio;\nimport haxe.io.Bytes;\nimport format.swf.Data;\n\ntypedef SoundClip = {\n\tvar id : SoundClipId;\n\tvar format : SoundFormat;\n\tvar isStereo : Bool;\n\tvar is16bit : Bool;\n\tvar sampleRate : SoundRate;\n\tvar latencySeek : Int;\n\tvar numSamples : Null<Int>;\n\tvar data : Array<Bytes>;\n};\n\nenum SoundClipId {\n\tevent(soundId : Int);\n\tstream(clipId : Int);\n\tactionScript(soundName : String);\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/audio/SoundInstance.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.audio;\nimport com.newgrounds.swivel.audio.AudioTracker;\nimport format.swf.Data;\nimport haxe.Int32;\nimport haxe.io.Bytes;\nimport haxe.io.BytesInput;\nimport haxe.io.Eof;\nimport com.newgrounds.swivel.audio.SoundClip.SoundClipId;\n\nclass SoundInstance {\n\tprivate static var _workSample : SoundSample = {left: 0, right: 0};\n\n\tpublic var id(default, null) : SoundClipId;\n\t\n\tpublic function new(sound : SoundClip, inPoint : Null<Int>, outPoint : Null<Int>, loops : Int) {\n\t\t_bytes = sound.data[0];\n\t\tid = sound.id;\n\t\t_input = new BytesInput(_bytes);\n\t\t\n\t\t_inPosition = if(inPoint != null) inPoint*4 else 0;\n\t\t_outPosition = if(outPoint != null) outPoint*4 else _bytes.length;\n\t\t_loops = loops;\n\t\t\n\t\t_dataPosition = _inPosition;\n\t\t_sampleCount = 0;\n\t}\n\t\n\tinline public function step(sample : SoundSample) : Bool {\n\t\tvar done = false;\n\t\t\t\t\n\t\ttry {\n\t\t\t_bytes.getData().position = _dataPosition;\n\t\t\t_workSample.left = _input.readInt16();\n\t\t\t_workSample.right = _input.readInt16();\n\t\t\t\n\t\t\tapplyTransforms(_workSample);\n\t\t\t\n\t\t\tsample.left += _workSample.left;\n\t\t\tsample.right += _workSample.right;\n\t\t\t\n\t\t\t_dataPosition += 4;\n\t\t\t_sampleCount++;\n\t\t\t\n\t\t\tif(_dataPosition >= _outPosition) {\n\t\t\t\t_loops--;\n\t\t\t\tif(_loops > 0) _dataPosition = _inPosition;\n\t\t\t\telse done = true;\n\t\t\t}\n\t\t} catch(e : Eof) {\n\t\t\tdone = true;\n\t\t}\n\t\t\n\t\treturn done;\n\t}\n\t\n\tprivate var _bytes : Bytes;\n\tprivate var _input : BytesInput;\n\tprivate var _dataPosition : Int;\n\tprivate var _sampleCount : Int;\n\t\n\tprivate var _inPosition : Int;\n\tprivate var _outPosition : Int;\n\tprivate var _loops : Int;\n\t\n\tprivate function applyTransforms(sample : SoundSample) {\n\t\t\n\t}\n}\n"
  },
  {
    "path": "src/com/newgrounds/swivel/audio/SoundSample.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.audio;\n\ntypedef SoundSample = {\n\tvar left : Float;\n\tvar right : Float;\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/ffmpeg/AudioCodec.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.ffmpeg;\n\ntypedef AudioCodec = {\n\tvar label : String;\n\tvar codec : String;\n\tvar supportsBitRate : Bool;\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/ffmpeg/FfmpegProcess.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.ffmpeg;\nimport com.huey.events.Dispatcher;\nimport com.huey.events.Dispatcher;\nimport com.huey.utils.Logger;\nimport flash.desktop.NativeProcess;\nimport flash.desktop.NativeProcessStartupInfo;\nimport flash.events.IOErrorEvent;\nimport flash.events.NativeProcessExitEvent;\nimport flash.events.ProgressEvent;\nimport flash.filesystem.File;\nimport flash.Lib;\nimport flash.utils.ByteArray;\n\nclass FfmpegProcess\n{\n\tpublic var onComplete(default, null) : Dispatcher<Dynamic>;\n\t\n\tprivate static var _ffmpegFolder : File;\n\t\n\tprivate var _closed : Bool;\n\tprivate var _ffmpeg : NativeProcess;\n\t\n\tpublic function new(args : Array<String>) {\n\t\tonComplete = new Dispatcher();\n\t\t\n\t\tif (_ffmpegFolder == null) {\n\t\t\ttry {\n\t\t\t\tvar xmlData = flash.desktop.NativeApplication.nativeApplication.applicationDescriptor.toString();\n\t\t\t\txmlData = StringTools.replace(xmlData, \"xmlns\", \"x\");\n\t\t\t\tvar xml = Xml.parse(xmlData).firstElement();\n\t\t\t\tvar fast = new haxe.xml.Fast( xml );\n\t\t\t\t_ffmpegFolder = File.applicationDirectory.resolvePath( fast.node.ffmpegPath.innerData );\n\t\t\t} catch (e:Dynamic) {\n\t\t\t\t_ffmpegFolder = File.applicationDirectory.resolvePath(\"ffmpeg/win32\");\n\t\t\t}\n\t\t}\n\t\t_closed = false;\n\t\t\n\t\t\n\t\tvar ffmpegFile : File = getFfmpegExecutable();\n\t\t\n\t\tvar startupInfo = new NativeProcessStartupInfo();\n\t\tstartupInfo.executable = ffmpegFile;\n\t\tstartupInfo.workingDirectory = ffmpegFile.parent;\n\t\t\n\t\tstartupInfo.arguments = flash.Vector.ofArray(args);\n\t\tLogger.log(\"FfmpegLog\", Std.string(args) + \"\\n\");\n\t\t\n\t\t_ffmpeg = new NativeProcess();\n\t\t\n\t\t_ffmpeg.addEventListener(ProgressEvent.STANDARD_INPUT_PROGRESS, onStdinProgress);\n\t\t_ffmpeg.addEventListener(IOErrorEvent.STANDARD_INPUT_IO_ERROR, onStdinError);\n\t\t_ffmpeg.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, onStderr);\n\t\t_ffmpeg.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onStdOutData);\n\t\t_ffmpeg.addEventListener(NativeProcessExitEvent.EXIT, onFfmpegExit);\n\t\t_ffmpeg.start(startupInfo);\n\t}\n\t\n\tprivate function getFfmpegExecutable() : File {\n\t\tvar ffmpegFile = _ffmpegFolder;\n\t\tswitch( flash.system.Capabilities.os.split(\" \")[0] ) {\n\t\t\tcase \"Windows\":\n\t\t\t\t#if win32\n\t\t\t\t\tffmpegFile = ffmpegFile.resolvePath(\"ffmpeg.exe\");\n\t\t\t\t#else\n\t\t\t\t\tffmpegFile = ffmpegFile.resolvePath(\"ffmpeg.exe\");\n\t\t\t\t#end\n\t\t\tcase \"Mac\":\n\t\t\t\t#if mac32\n\t\t\t\t\tffmpegFile = ffmpegFile.resolvePath(\"ffmpeg\");\n\t\t\t\t#else\n\t\t\t\t\tffmpegFile = ffmpegFile.resolvePath(\"ffmpeg\");\n\t\t\t\t#end\n\t\t\tdefault:\t\t\tthrow \"Unsupported OS\";\n\t\t}\n\t\treturn ffmpegFile;\n\t}\n\t\n\tpublic function send(data) : Void {\n\t\t_ffmpeg.standardInput.writeBytes( data );\n\t}\n\t\n\tpublic function close(?force : Bool = false) : Void {\n\t\t_closed = true;\n\t\t_ffmpeg.closeInput();\n\t\tif(force) _ffmpeg.exit(true);\n\t}\n\t\n\tprivate function onStdinProgress(_) : Void {\n\t}\n\t\n\tprivate function onStdinError(event) : Void {\n\t\tLogger.log(\"FfmpegLog\", Std.string(event));\n\t\tevent.preventDefault();\n\t}\n\t\n\tprivate function onStdOutData(_) : Void {\n\t\tLogger.log(\"FfmpegLog\", _ffmpeg.standardOutput.readUTFBytes(_ffmpeg.standardOutput.bytesAvailable) );\n\t}\n\t\n\tprivate function onStderr(_) : Void {\n\t\tvar output : String = _ffmpeg.standardError.readUTFBytes(_ffmpeg.standardError.bytesAvailable);\n\t\tLogger.log(\"FfmpegLog\", output);\n\t}\n\t\n\tprivate function onFfmpegExit(e) : Void {\n\t\tflash.system.System.resume();\n\t\tonComplete.dispatch(e.exitCode);\n\t}\n\t\n}\n\n\nclass FfmpegEncoder extends FfmpegProcess\n{\n\t\n\tpublic static var AUDIO_CODECS : Array<AudioCodec> = [\n\t\t{label: \"AAC\", codec: \"aac\", supportsBitRate: true},\n\t\t{label: \"Raw PCM 16-bit\", codec: \"pcm_s16le\", supportsBitRate: false},\n\t\t{label: \"MP3\", codec: \"mp3\", supportsBitRate: true},\n\t\t{label: \"Vorbis\", codec: \"libvorbis\", supportsBitRate: true},\n\t\t{label: \"Windows Media Audio\", codec: \"wmav2\", supportsBitRate: true},\n\t];\n\t\n\tpublic static var PRESETS : Array<VideoPreset> = [\n\t\t{label: \"H.264 High\", fileFormat: \"mp4\", codec: \"libx264\", supportsBitRate: true, extraParameters: [\"-preset\",\"slow\",\"-pix_fmt\",\"yuv420p\"], supportedAudioCodecs: [AUDIO_CODECS[0], AUDIO_CODECS[2]]},\n\t\t{label: \"H.264 Main\", fileFormat: \"mp4\", codec: \"libx264\", supportsBitRate: true, extraParameters: [\"-preset\",\"slow\",\"-profile:v\",\"main\",\"-pix_fmt\",\"yuv420p\"], supportedAudioCodecs: [AUDIO_CODECS[0], AUDIO_CODECS[2]]},\n\t\t{label: \"H.264 Baseline\", fileFormat: \"mp4\", codec: \"libx264\", supportsBitRate: true, extraParameters: [\"-preset\",\"slow\",\"-profile:v\",\"baseline\",\"-pix_fmt\",\"yuv420p\"], supportedAudioCodecs: [AUDIO_CODECS[0], AUDIO_CODECS[2]]},\n\t\t{label: \"MPEG-2 Video\", fileFormat: \"mpg\", codec: \"mpeg2video\", supportsBitRate: true, extraParameters: [\"-preset\",\"slow\"], supportedAudioCodecs: [AUDIO_CODECS[0], AUDIO_CODECS[2]]},\n\t\t{label: \"Theora\", fileFormat: \"ogg\", codec: \"theora\", supportsBitRate: true, extraParameters: [\"-preset\",\"slow\"], supportedAudioCodecs: [AUDIO_CODECS[3]]},\n\t\t{label: \"QuickTime Animation\", fileFormat: \"mov\", codec: \"qtrle\", supportsBitRate: false, extraParameters: null,supportedAudioCodecs: [AUDIO_CODECS[0], AUDIO_CODECS[1], AUDIO_CODECS[2]]},\n\t\t{label: \"Uncompressed AVI\", fileFormat: \"avi\", codec: \"rawvideo\", supportsBitRate: false, extraParameters: [\"-pix_fmt\",\"bgr24\"], supportedAudioCodecs: [AUDIO_CODECS[1], AUDIO_CODECS[2]]},\n\t\t{label: \"VP8\", fileFormat: \"webm\", codec: \"vp8\", supportsBitRate: true, extraParameters: [\"-preset\",\"slow\"], supportedAudioCodecs: [AUDIO_CODECS[3]]},\n\t\t{label: \"Windows Media Video\", fileFormat: \"wmv\", codec: \"wmv2\", supportsBitRate: true, extraParameters: [\"-preset\",\"slow\"], supportedAudioCodecs: [AUDIO_CODECS[4]]},\n\t\t{label: \"Xvid (MPEG-4 part 2)\", fileFormat: \"mp4\", codec: \"mpeg4\", supportsBitRate: true, extraParameters: [\"-preset\",\"slow\"], supportedAudioCodecs: [AUDIO_CODECS[0], AUDIO_CODECS[2]]},\n\t];\n\tpublic static var TRANSPARENT_PRESETS : Array<VideoPreset> = [\n\t\tPRESETS[3],\n\t];\n\t//private var _proc : FfmpegProcess;\n\t\n\tprivate var _framesSent : Int;\n\tprivate var _framesReceived : Int;\n\tprivate var _framesEncoded : Int;\n\t\n\tprivate var _isWindows : Bool;\n\n\tprivate var _frameQueue : Array<ByteArray>;\n\tinline private static var FRAME_QUEUE_SIZE : Int = 2;\n\t\n\tpublic var onFrameReceived(default, null) : Dispatcher<Dynamic>;\n\t\n\tpublic function new(preset : VideoPreset, videoBitRate : Null<Int>, outputFile : File, width : UInt, height : UInt, frameRate : Float, ?audioFile : String, ?audioCodec : AudioCodec, ?audioBitRate : Null<Int>, ?numChannels : Int) {\n\t\t_framesSent = _framesReceived = _framesEncoded = 0;\n\t\t_frameQueue = new Array();\n\t\t\t\n\t\tonFrameReceived = new Dispatcher();\n\t\tvar params = [\n\t\t\t\"-threads\",\t\"0\",\t\t\t// multithreading\n\t\t\t\"-y\",\t\t\t\t\t\t// overwrite output silently\n\t\t\t\t\t\t\n\t\t\t// read video from stdin\n\t\t\t\"-f\", \"rawvideo\",\n\t\t\t\"-pix_fmt\", \"argb\",\n\t\t\t\"-s\", width + \"x\" + height,\n\t\t\t\"-r\", Std.string(frameRate),\n\t\t\t\"-i\", \"-\",\n\t\t];\n\t\t\n\t\tif(audioFile == null) params.push(\"-an\");\n\t\telse {\n\t\t\tparams.push(\"-i\");\n\t\t\tparams.push(audioFile);\n\t\t\tparams.push(\"-c:a\");\n\t\t\tif(audioCodec == null) {\n\t\t\t\tparams.push(\"copy\");\n\t\t\t} else {\n\t\t\t\tparams.push(audioCodec.codec);\n\t\t\t\tif(audioBitRate != null) {\n\t\t\t\t\tparams.push(\"-b:a\");\n\t\t\t\t\tparams.push(Std.string(audioBitRate));\n\t\t\t\t}\n\t\t\t\tparams.push(\"-ac\");\n\t\t\t\tparams.push(Std.string(numChannels));\n\t\t\t}\n\t\t}\n\t\t\n\t\tparams.push(\"-c:v\");\n\t\tparams.push(preset.codec);\n\t\t\n\t\tif(videoBitRate != null) {\n\t\t\tparams.push(\"-b:v\");\n\t\t\tparams.push(Std.string(videoBitRate));\n\t\t} else if(preset.supportsBitRate) {\n\t\t\tparams.push(\"-q\");\n\t\t\tparams.push(\"0\");\n\t\t}\n\t\t\n\t\tif(preset.extraParameters != null) {\n\t\t\tfor(p in preset.extraParameters) params.push(p);\n\t\t}\n\t\t\n\t\tparams.push(\"-aspect\");\n\t\tparams.push(width + \":\" + height);\n\n\t\tparams.push(\"-strict\");\n\t\tparams.push(\"-2\");\n\t\t\n\t\tparams.push(outputFile.nativePath);\n\t\t\n\t\tsuper( params );\n\t}\n\t\n\tprivate override function getFfmpegExecutable() : File {\n\t\tvar ffmpegFile = FfmpegProcess._ffmpegFolder;\n\t\tswitch( flash.system.Capabilities.os.split(\" \")[0] ) {\n\t\t\tcase \"Windows\":\n\t\t\t\t_isWindows = true;\n\t\t\t\t#if win32\n\t\t\t\t\tffmpegFile = ffmpegFile.resolvePath(\"redirecter.exe\");\n\t\t\t\t#else\n\t\t\t\t\tffmpegFile = ffmpegFile.resolvePath(\"redirecter.exe\");\n\t\t\t\t#end\n\t\t\tcase \"Mac\":\n\t\t\t\t_isWindows = false;\n\t\t\t\t#if mac32\n\t\t\t\t\tffmpegFile = ffmpegFile.resolvePath(\"ffmpeg\");\n\t\t\t\t#else\n\t\t\t\t\tffmpegFile = ffmpegFile.resolvePath(\"ffmpeg\");\n\t\t\t\t#end\n\t\t\tdefault:\t\t\tthrow \"Unsupported OS\";\n\t\t}\n\t\treturn ffmpegFile;\n\t}\n\t\n\tpublic override function send(frame : ByteArray) {\n\t\t//if(_closed) return;\n\t\t\n\t\t_frameQueue.push(frame);\n\t\t_framesSent++;\n\n\t\tif(_frameQueue.length == 1) sendNextFrame();\n\t\tif(_frameQueue.length >= FRAME_QUEUE_SIZE) flash.system.System.pause();\n\t}\n\t\n\tprivate function sendNextFrame() {\n\t\tif(_frameQueue.length > 0) {\n\t\t\tsuper.send(_frameQueue[0]);\n\t\t}\n\t\t\n\t\tif(_frameQueue.length < FRAME_QUEUE_SIZE) flash.system.System.resume();\n\t}\n\t\n\tpublic override function close(?force : Bool = false) : Void {\n\t\t_closed = true;\n\t\tif (_framesReceived >= _framesSent)\n\t\t\t_ffmpeg.closeInput();\n\t\tif(force) _ffmpeg.exit(true);\n\t}\n\t\t\n\tprivate override function onStderr(_) : Void {\n\t\tvar output : String = _ffmpeg.standardError.readUTFBytes(_ffmpeg.standardError.bytesAvailable);\n\t\tLogger.log(\"FfmpegLog\", output);\n\t\t\t\t\t\t\n\t\tvar frameRegex : EReg = ~/frame=\\s*(\\d+).*/;\n\t\tif ( frameRegex.match(output) ) {\n\t\t\t_framesEncoded = Std.parseInt( frameRegex.matched(1) );\n\t\t}\n\t}\n\t\n\tprivate override function onStdinError(event) : Void {\n\t\tLogger.log(\"FfmpegLog\", Std.string(event));\n\t\tevent.preventDefault();\n\t\t\n\t\t_framesReceived++;\n\t\t//trace(\"Ercvd: \" + _framesReceived);\n\t\tif (_closed && _framesReceived >= _framesSent) _ffmpeg.closeInput();\n\t\tif(!_isWindows) { _frameQueue.shift(); sendNextFrame(); }\n\t}\n\t\n\tprivate override function onStdinProgress(_) : Void {\n\t\t_framesReceived++;\n\t\t//trace(\"Prcvd: \" + _framesReceived);\n\t\tif (_closed && _framesReceived >= _framesSent) _ffmpeg.closeInput();\n\t\tif(!_isWindows) { _frameQueue.shift(); sendNextFrame(); }\n\t}\n\t\n\tprivate override function onStdOutData(_) : Void {\n\t\tif(_isWindows) { _frameQueue.shift(); sendNextFrame(); }\n\t}\n}\n"
  },
  {
    "path": "src/com/newgrounds/swivel/ffmpeg/VideoPreset.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.ffmpeg;\n\ntypedef VideoPreset = {\n\tvar label : String;\n\tvar fileFormat : String;\n\tvar codec : String;\n\tvar supportsBitRate : Bool;\n\tvar extraParameters : Null<Array<String>>;\n\tvar supportedAudioCodecs : Null<Array<AudioCodec>>;\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/swf/AS3SoundConnectionMutator.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\n/**\n * ...\n * @author Newgrounds.com, Inc.\n * Tracks sound events over LocalConnection\n */\n\npackage com.newgrounds.swivel.swf;\nimport com.newgrounds.swivel.audio.AudioTracker;\nimport com.newgrounds.swivel.audio.SoundClip;\nimport com.newgrounds.swivel.swf.SwivelSwf.ABCStuff;\nimport format.abc.Context;\nimport format.abc.Data;\nimport format.abc.OpReader;\nimport format.as1.Data;\nimport format.swf.Data;\nimport haxe.Int32;\nimport haxe.ds.IntMap;\nimport haxe.io.Bytes;\nimport haxe.io.BytesInput;\nimport haxe.io.BytesOutput;\n\nusing com.newgrounds.swivel.swf.AbcUtils;\n\ntypedef ClipFrameSounds = IntMap< Array<SoundLogEntry> >;\n\nclass AS3SoundConnectionMutator extends SoundConnectionMutator {\n\tpublic function new(connectionName : String, audioTracker : AudioTracker) {\n\t\tsuper(connectionName, audioTracker);\n\t\t_clipsWithSound = new IntMap();\n\t}\n\t\n\toverride public function mutate(swf : SwivelSwf) : Void {\n\t\tfor(i in 0...swf.tags.length) {\n\t\t\tvar tag = swf.tags[i];\n\t\t\tswitch(tag) {\n\t\t\t\tcase TActionScript3(data, c):\n\t\t\t\t\tvar abc = new format.abc.Reader(new BytesInput(data)).read();\n\t\t\t\t\t\n\t\t\t\t\tvar altered = false;\n\t\t\t\t\tfor(j in 0...abc.names.length) {\n\t\t\t\t\t\tvar clName = abc.getNamePath(Idx(j+1));\n\t\t\t\t\t\tif(clName == \"flash.media.Sound\") {\n\t\t\t\t\t\t\tabc.names[j] = NName( abc.string(\"__SwivelSound\"), abc.namespace(NPublic(abc.string(\"\"))) );\n\t\t\t\t\t\t\taltered = true;\n\t\t\t\t\t\t} else if(clName == \"flash.media.SoundChannel\") {\n\t\t\t\t\t\t\tabc.names[j] = NName( abc.string(\"Object\"), abc.namespace(NPublic(abc.string(\"\"))) );\n\t\t\t\t\t\t\taltered = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif(altered) {\n\t\t\t\t\t\tvar o = new BytesOutput();\n\t\t\t\t\t\tnew format.abc.Writer(o).write(abc);\n\t\t\t\t\t\tswf.tags[i] = TActionScript3(o.getBytes(), c);\n\t\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t\t\n\t\tsuper.mutate(swf);\n\t}\n\t\n\tprivate var _clipsWithSound : IntMap<ClipFrameSounds>;\n\t\n\toverride private function handleStartSound(clipId : Int, frame : Int, soundId : Int, infos : StartSoundInfo) : SWFTag {\n\t\tvar sounds = getClip(clipId, frame);\n\t\tsounds.push({\n\t\t\tframe: frame,\n\t\t\tsoundId: event(soundId),\n\t\t\ttype: event(infos),\n\t\t});\n\t\treturn null;\n\t}\n\t\n\toverride private function handleStreamFrame(clipId : Int, clipFrame : Int, streamId : Int, streamFrame : Int) : SWFTag {\n\t\tvar sounds = getClip(clipId, clipFrame);\n\t\tsounds.push({\n\t\t\tframe: clipFrame,\n\t\t\tsoundId: SoundClipId.stream(streamId),\n\t\t\ttype: SoundLogType.stream({startFrame: streamFrame, endFrame: streamFrame}),\n\t\t});\n\t\treturn null;\n\t}\n\t\n\tprivate function getClip(id : Int, frame : Int) : Array<SoundLogEntry> {\n\t\tvar sounds = _clipsWithSound.get(id);\n\t\tif(sounds == null) {\n\t\t\tsounds = new IntMap();\n\t\t\t_clipsWithSound.set(id, sounds);\n\t\t}\n\t\t\n\t\tvar frameSounds = sounds.get(frame);\n\t\tif(frameSounds == null) {\n\t\t\tframeSounds = new Array();\n\t\t\tsounds.set(frame, frameSounds);\n\t\t}\n\t\treturn frameSounds;\n\t}\n\t\n\tinline private function name(ctx : Context, name : String) {\n\t\treturn ctx.name( NName(ctx.string(name), ctx.nsPublic) );\n\t}\n\t\n\tprivate var _currentSounds : ClipFrameSounds;\n\t\n\toverride private function finalize(swf : SwivelSwf) {\n\t\tfor(clipId in _clipsWithSound.keys()) {\n\t\t\t_currentSounds = _clipsWithSound.get(clipId);\n\t\t\tswf.hoistClip(clipId, injectSoundMethods);\n\t\t}\n\t}\n\t\n\tfunction injectSoundMethods(abcStuff : ABCStuff) {\n\t\tvar abc = abcStuff.abc;\n\t\tvar cl = abcStuff.cl;\n\t\t\t\t\n\t\tvar addFrameScriptName = abc.publicName( \"addFrameScript\" );\n\t\tvar publicNs = abc.namespace( NPublic(abc.string(\"\")) );\n\t\tvar voidName = abc.publicName(\"void\");\n\t\tvar swivelClName = abc.publicName(\"__Swivel\");\n\t\tvar startSoundStr = abc.string(\"startSound\");\n\t\tvar frameName = abc.publicName(\"frame\");\n\t\tvar streamSoundStr = abc.string(\"streamSound\");\n\t\tvar swivelName = abc.publicName(\"__swivel\");\n\t\t//var traceName = abc.publicName(\"trace\");\n\t\t\n\t\tvar oldFrameScripts = new IntMap<Function>();\n\t\tfor(f in cl.fields) {\n\t\t\tvar name = abc.getName(f.name);\n\t\t\tswitch(name) {\n\t\t\t\tcase NName(n,_):\n\t\t\t\t\tvar name = abc.getString(n);\n\t\t\t\t\tif(name.substr(0,5) == \"frame\") {\n\t\t\t\t\t\tvar oldMethod = switch(f.kind) {\n\t\t\t\t\t\tcase FMethod(t,_,_,_): abc.getFunction(t);\n\t\t\t\t\t\t\tdefault: throw(\"Unexpected frame method\");\n\t\t\t\t\t\t};\n\t\t\t\t\n\t\t\t\t\t\tvar frameNum = Std.parseInt(name.substr(5));\n\t\t\t\t\t\tif(frameNum != null) oldFrameScripts.set( frameNum-1, oldMethod );\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t\t\t\n\t\tvar ctorOps = [\n\t\t\tOThis,\n\t\t\tOScope,\n\t\t];\n\t\t\n\t\tvar j = 0;\n\t\tfor(frame in _currentSounds.keys()) {\n\t\t\tvar methodName = abc.pushName( NName(abc.pushString('__snd$j'), publicNs) );\n\t\t\tvar oldMethod = oldFrameScripts.get(frame);\n\t\t\t\n\t\t\tif(oldMethod == null) {\n\t\t\t\tctorOps = ctorOps.concat([\n\t\t\t\t\tOFindPropStrict(addFrameScriptName),\n\t\t\t\t\tabc.opInt(frame),\n\t\t\t\t\tOThis,\n\t\t\t\t\tOGetProp(methodName),\n\t\t\t\t\tOCallPropVoid(addFrameScriptName, 2),\n\t\t\t\t]);\n\t\t\t} else {\n\t\t\t\tif(oldMethod.maxStack < 2) oldMethod.maxStack = 2;\n\t\t\t\toldMethod.prependOps([\n\t\t\t\t\tOThis,\n\t\t\t\t\tOScope,\n\t\t\t\t\tOFindPropStrict(methodName),\n\t\t\t\t\tOCallPropVoid(methodName, 0),\n\t\t\t\t\tOPopScope,\n\t\t\t\t]);\n\t\t\t}\n\t\t\t\n\t\t\tvar methodOps = [\n\t\t\t\tOThis,\n\t\t\t\tOScope,\n\t\t\t];\n\t\t\t\n\t\t\tfor(e in _currentSounds.get(frame)) {\n\t\t\t\tvar soundId : Int = switch(e.soundId) {\n\t\t\t\t\tcase event(i):\ti;\n\t\t\t\t\tcase stream(i):\ti;\n\t\t\t\t\tdefault:\t\tthrow(\"Bad sound id\"); -1;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tswitch(e.type) {\n\t\t\t\t\tcase event(info):\n\t\t\t\t\t\tmethodOps = methodOps.concat([\n\t\t\t\t\t\t\tOGetLex( swivelClName ),\n\t\t\t\t\t\t\tOString( startSoundStr ),\n\t\t\t\t\t\t\tOGetLex( swivelClName ),\n\t\t\t\t\t\t\tOGetProp( frameName ),\n\t\t\t\t\t\t\tOInt(soundId),\n\t\t\t\t\t\t\tOInt(if(info.noMultiple) 1 else if(info.stop) 2 else 0),\n\t\t\t\t\t\t\tif(info.startPos!= null) abc.opInt(info.startPos) else ONull,\n\t\t\t\t\t\t\tif(info.endPos != null) abc.opInt(info.endPos) else ONull,\n\t\t\t\t\t\t\tif(info.numLoops != null) abc.opInt(info.numLoops) else ONull,\n\t\t\t\t\t\t]);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(info.envelope != null) {\n\t\t\t\t\t\t\tfor(p in info.envelope) {\n\t\t\t\t\t\t\t\tmethodOps = methodOps.concat([\n\t\t\t\t\t\t\t\t\tabc.opInt(p.pos),\n\t\t\t\t\t\t\t\t\tabc.opInt(p.leftVolume),\n\t\t\t\t\t\t\t\t\tabc.opInt(p.rightVolume),\n\t\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmethodOps.push(OArray(info.envelope.length * 3));\n\t\t\t\t\t\t} else methodOps.push( ONull );\n\t\t\t\t\t\tmethodOps.push( OCallPropVoid(swivelName, 8) );\n\t\t\t\t\t\t\n\t\t\t\t\tcase stream(frames):\n\t\t\t\t\t\tmethodOps = methodOps.concat([\n\t\t\t\t\t\t\tOGetLex( swivelClName ),\n\t\t\t\t\t\t\tOString( streamSoundStr ),\n\t\t\t\t\t\t\tOGetLex( swivelClName ),\n\t\t\t\t\t\t\tOGetProp( frameName ), // movie frame\n\t\t\t\t\t\t\tOInt(soundId), // stream id\n\t\t\t\t\t\t\tabc.opInt(frames.startFrame), // stream frame\n\t\t\t\t\t\t\tOCallPropVoid(swivelName, 4),\n\t\t\t\t\t\t]);\n\t\t\t\t\t\t\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow(\"Bad sound type in AS3SoundConnectionMutator\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tmethodOps.push(OPopScope);\n\t\t\tmethodOps.push(ORetVoid);\n\t\t\t\n\t\t\tabc.quickMethod(cl, methodName, methodOps, KNormal, null, voidName);\n\t\t\tj++;\n\t\t}\n\t\t\n\t\tctorOps.push(OPopScope);\n\t\t\n\t\tvar ctor = abc.getFunction(cl.constructor);\n\t\tif(ctor.maxStack < 4) ctor.maxStack = 4;\n\t\tif(ctor.maxScope < 4) ctor.maxScope = 4;\n\t\tctor.prependOps(ctorOps);\n\t}\n}\n"
  },
  {
    "path": "src/com/newgrounds/swivel/swf/AS3SwivelConnection.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.swf;\nimport com.newgrounds.swivel.swf.SwivelConnection.ISwivelConnection;\n\nclass AS3SwivelConnection implements ISwivelConnection\n{\n\tprivate static var _instance : AS3SwivelConnection;\n\t\n\tprivate var _client : Dynamic;\n\tpublic var client(get,set) : Dynamic;\n\tprivate function get_client() : Dynamic\t\t\t\t{ return _client; }\n\tprivate function set_client(v : Dynamic ) : Dynamic\t{ return _client = v; }\n\t\n\tpublic function new() {\n\t\t_instance = this;\n\t}\n\t\n\tpublic static function receiveMessage(args : Array<Dynamic>) {\n\t\ttry {\n\t\t\tif(_instance != null && _instance.client != null) {\n\t\t\t\tvar methodName = args.shift();\n\t\t\t\tvar method : Dynamic = Reflect.getProperty(_instance.client, methodName);\n\t\t\t\tif(args.length == 0) method();\n\t\t\t\telse if(args.length == 1) method(args[0]);\n\t\t\t\telse if(args.length == 2) method(args[0],args[1]);\n\t\t\t\telse if(args.length == 3) method(args[0],args[1],args[2]);\n\t\t\t\telse if(args.length == 4) method(args[0],args[1],args[2],args[3]);\n\t\t\t\telse if(args.length == 5) method(args[0],args[1],args[2],args[3],args[4]);\n\t\t\t\telse if(args.length == 6) method(args[0],args[1],args[2],args[3],args[4],args[5]);\n\t\t\t\telse if(args.length == 7) method(args[0],args[1],args[2],args[3],args[4],args[5],args[6]);\n\t\t\t\t\n\t\t\t\t//Reflect.callMethod(_instance.client, args.shift(), args);\n\t\t\t}\n\t\t} catch(e:Dynamic) {  }\n\t}\n\t\n\tpublic function tick() {\n\t\t\n\t}\n\t\n\tpublic function close() {\n\t\tclient = null;\n\t}\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/swf/AbcUtils.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.swf;\n\nimport format.abc.Data;\nimport format.abc.OpWriter;\nimport format.abc.Reader;\nimport format.abc.Writer;\nimport format.swf.Data;\nimport haxe.io.BytesInput;\nimport haxe.io.BytesOutput;\n\nclass AbcUtils {\n\tprivate static function lookup<T>( arr : Array<T>, n : T ) : Index<T> {\n\t\tfor( i in 0...arr.length )\n\t\t\tif( arr[i] == n )\n\t\t\t\treturn Idx(i + 1);\n\t\tarr.push(n);\n\t\treturn Idx(arr.length);\n\t}\n\t\n\tprivate static function elookup<T>( arr : Array<T>, n : T ) : Index<T> {\n\t\tfor( i in 0...arr.length )\n\t\t\tif( Type.enumEq(arr[i],n) )\n\t\t\t\treturn Idx(i + 1);\n\t\tarr.push(n);\n\t\treturn Idx(arr.length);\n\t}\n\n\tinline public static function opInt(abc : ABCData, v) : OpCode {\n\t\treturn\n\t\t\tif(v < 32768) OInt(v);\n\t\t\telse OIntRef( int(abc, v) );\n\t}\n\t\n\tpublic static function int(abc : ABCData, v)\t\t\t\t\t\t\t\treturn lookup(abc.ints, v);\n\tpublic static function uint(abc : ABCData, v)\t\t\t\t\t\t\t\treturn lookup(abc.uints, v);\n\tpublic static function float(abc : ABCData, v : Float)\t\t\t\t\t\treturn lookup(abc.floats, v);\n\tpublic static function string(abc : ABCData, v : String)\t\t\t\t\treturn lookup(abc.strings, v);\n\tpublic static function pushString(abc : ABCData, v : String) : Index<String> {\n\t\tabc.strings.push(v);\n\t\treturn Idx(abc.strings.length);\n\t}\n\tpublic static function name(abc : ABCData, v : Name)\t\t\t\t\t\treturn elookup(abc.names, v);\n\tinline public static function pushName(abc : ABCData, v : Name) : IName {\n\t\tabc.names.push(v);\n\t\treturn Idx(abc.names.length);\n\t}\n\tpublic static function publicName(abc : ABCData, v : String)\t\t\t\treturn elookup(abc.names, NName( string(abc, v), namespace(abc, NPublic(string(abc, \"\"))) ) );\n\tpublic static function namespace(abc : ABCData, v : Namespace)\t\t\t\treturn elookup(abc.namespaces, v);\n\tpublic static function namespaceSet(abc : ABCData, v : NamespaceSet)\t\treturn elookup(abc.nssets, v);\n\tpublic static function methodType(abc : ABCData, v : MethodType)\t\t\t{ abc.methodTypes.push(v); return Idx(abc.methodTypes.length - 1); }\n\tpublic static function type(abc : ABCData, path) : Null<Index<Name>> {\n\t\tif( path == \"*\" )\n\t\t\treturn null;\n\t\tvar path = path.split(\".\");\n\t\tvar cname = path.pop();\n\t\tvar pid = string(abc,path.join(\".\"));\n\t\tvar nameid = string(abc,cname);\n\t\tvar pid = namespace(abc,NPublic(pid));\n\t\tvar tid = name(abc,NName(nameid,pid));\n\t\treturn tid;\n\t}\n\t\n\tpublic static function replaceName(abc : ABCData, i : IName, name : Name) {\n\t\tvar _i = switch(i) {\n\t\t\tcase Idx(i): i-1;\n\t\t};\n\t\t\n\t\tabc.names[_i] = name;\n\t}\n\t\n\tpublic static function getInt(abc : ABCData, i)\t\t\t\t\t\t\t\treturn abc.get(abc.ints, i);\n\tpublic static function getUInt(abc : ABCData, i)\t\t\t\t\t\t\treturn abc.get(abc.uints, i);\n\tpublic static function getFloat(abc : ABCData, i : Index<Float>)\t\t\treturn abc.get(abc.floats, i);\n\tpublic static function getString(abc : ABCData, i : Index<String>)\t\t\treturn abc.get(abc.strings, i);\n\tpublic static function getClass(abc : ABCData, i : Index<ClassDef>)\t\t\treturn abc.get(abc.classes, i);\n\tpublic static function getName(abc : ABCData, i : IName)\t\t\t\t\treturn abc.get(abc.names, i);\n\tpublic static function getNamespace(abc : ABCData, i : Index<Namespace>)\treturn abc.get(abc.namespaces, i);\n\tpublic static function getNamespaceSet(abc : ABCData, i : Index<NamespaceSet>) return abc.get(abc.nssets, i);\n\tpublic static function getMethodType(abc : ABCData, i : Index<MethodType>)\t{\n\t\treturn switch( i ) { case Idx(n): abc.methodTypes[n]; };\n\t}\n\tpublic static function getFunction(abc : ABCData, i : Index<MethodType>) {\n\t\tfor (f in abc.functions)\n\t\t\tif (Type.enumEq(f.type, i)) return f;\n\t\treturn null;\n\t}\n\t\n\tpublic static function getNamespaceStr(abc : ABCData, i : Index<Namespace>) : String {\n\t\tswitch(i) { case Idx(n): if(n==0) return null; }\n\t\t\n\t\treturn switch( getNamespace(abc, i) ) {\n\t\t\tcase NPublic(ns):\t\t\tgetString(abc, ns);\n\t\t\tcase NNamespace(ns):\t\tgetString(abc, ns);\n\t\t\tcase NPrivate(ns):\t\t\tgetString(abc, ns);\n\t\t\tcase NInternal(ns):\t\t\tgetString(abc, ns);\n\t\t\tcase NProtected(ns):\t\tgetString(abc, ns);\n\t\t\tcase NExplicit(ns):\t\t\tgetString(abc, ns);\n\t\t\tcase NStaticProtected(ns):\tgetString(abc, ns);\n\t\t}\n\t}\n\t\n\t/*public static function quickClass(name : String) : ABCData {\n\t\tdata = new ABCData();\n\t\tdata.ints = new Array();\n\t\tdata.uints = new Array();\n\t\tdata.floats = new Array();\n\t\tdata.strings = new Array();\n\t\tdata.namespaces = new Array();\n\t\tdata.nssets = new Array();\n\t\tdata.metadatas = new Array();\n\t\tdata.methodTypes = new Array();\n\t\tdata.names = new Array();\n\t\tdata.classes = new Array();\n\t\tdata.functions = new Array();\n\t}*/\n\t\n\tpublic static function dumpFunc(abc : ABCData, f : Function) : String {\n\t\tvar ops = format.abc.OpReader.decode(new BytesInput(f.code));\n\t\tvar str = \"\";\n\t\tfor(op in ops) {\n\t\t\tstr += switch(op) {\n\t\t\t\tcase OGetLex(n):\t\t\t'OGetLex(${getNamePath(abc,n)})';\n\t\t\t\tcase OFindProp(n):\t\t\t'OFindProp(${getNamePath(abc,n)})';\n\t\t\t\tcase OFindPropStrict(n):\t'OFindPropStrict(${getNamePath(abc,n)})';\n\t\t\t\tcase OGetProp(n):\t\t\t'OGetProp(${getNamePath(abc,n)})';\n\t\t\t\tcase OInitProp(n):\t\t\t'OInitProp(${getNamePath(abc,n)})';\n\t\t\t\tcase OString(s):\t\t\t'OString(${getString(abc,s)})';\n\t\t\t\tcase OCallProperty(n,i):\t'OCallProperty(${getNamePath(abc,n)},$i)';\n\t\t\t\tcase OCallPropVoid(n,i):\t'OCallPropVoid(${getNamePath(abc,n)},$i)';\n\t\t\t\tcase OConstructProperty(n,i):'OConstructProperty(${getNamePath(abc,n)},$i)';\n\t\t\t\tcase OSetProp(n):\t\t\t'OSetProp(${getNamePath(abc,n)})';\n\t\t\t\t//case OClassDef(c):\t\t\t'OClassDef(${getNamePath(abc,getClass(abc,c).name)})';\n\t\t\t\t\n\t\t\t\tdefault:\tStd.string(op);\n\t\t\t}\n\t\t\tstr += \"\\n\";\n\t\t}\n\t\treturn str;\n\t}\n\t\n\tpublic static function dumpAbc(abc : ABCData) {\n\t\tvar str = \"\";\n\t\t/*var str = \"init fields:\";\n\t\tfor(init in abc.inits) {\n\t\t\tfor(field in init.fields)\n\t\t\t\tstr += \"  \" + getNamePath(abc, field.name) + \"\\n\";\n\t\t}\n\t\tstr += \"\\n\";*/\n\t\tfor(f in abc.functions) {\n\t\t\tstr += dumpFunc(abc, f);\n\t\t\tstr += \"-----------------\\n\\n\";\n\t\t}\n\t\t/*\n\t\tstr += \"\\nclasses:\\n\";\n\t\tfor(cl in abc.classes)\n\t\t\tstr += \"  \" + getNamePath(abc, cl.name) + \" extends \" + getNamePath(abc, cl.superclass) + \"\\n\";\n\t\tstr += \"\\n\";*/\n\t\t\n\t\tstr += \"\\nstrings:\\n\";\n\t\tfor(i in 0...abc.strings.length)\n\t\t\tif(abc.strings[i].substr(0,5) != \"frame\") str += \"  \" + (i+1) + \".\\t\" + abc.strings[i] + \"\\n\";\n\t\t\t\n\t\t/*str += \"\\nnames:\\n\";\n\t\tfor(i in 1...abc.names.length+1)\n\t\t\tstr += \"  \" + i + \".\\t\" + getNamePath(abc, Idx(i)) + \"\\n\";*/\n\t\t\t\n\t\tstr += \"\\n\";\n\t\treturn str;\n\t}\n\n\t/*inline private static function mergeMap<T>(abc : ABCData, arr : Array<Index<T>>, i : Index<T> ) : T {\n\t\tswitch(i) {\n\t\t\tcase Idx(j): return arr[j];\n\t\t}\n\t}\n\t\n\tinline private static function nullMergeMap<T>(abc : ABCData, arr : Array<Index<T>>, i : Null<Index<T>> ) : T {\n\t\treturn if(i != null) mergeMap(abc,arr,i) else null;\n\t}\n\t\n\tpublic static function merge(dst : ABCData, src : ABCData) {\n\t\tvar intMap = new Array();\n\t\tvar uintMap = new Array();\n\t\tvar floatMap = new Array();\n\t\tvar namespaceMap = new Array();\n\t\tvar nssetMap = new Array();\n\t\tvar nameMap = new Array();\n\t\n\t\tvar classMap = new Array();\n\t\t\n\t\tfor(i in 0...src.ints.length) intMap[i] = dst.int(src.ints[i]);\n\t\tfor(i in 0...src.uints.length) uintMap[i] = dst.uint(src.uints[i]);\n\t\tfor(i in 0...src.floats.length) floatMap[i] = dst.float(src.uints[i]);\n\t\tfor(i in 0...src.strings.length) stringMap[i] = dst.string(src.strings[i]);\n\t\t\n\t\tfor(i in 0...src.namespaces.length) {\n\t\t\tnamespaceMap[i] = switch(src.namespaces[i]) {\n\t\t\t\tcase NPrivate(ns):\t\t\tdst.namespace( NPrivate(mergeMap(dst,stringMap,ns)) );\n\t\t\t\tcase NNamespace(ns):\t\tdst.namespace( NNamespace(mergeMap(dst,stringMap,ns)) );\n\t\t\t\tcase NPublic(ns):\t\t\tdst.namespace( NPublic(mergeMap(dst,stringMap,ns)) );\n\t\t\t\tcase NInternal(ns):\t\t\tdst.namespace( NInternal(mergeMap(dst,stringMap,ns)) );\n\t\t\t\tcase NProtected(ns):\t\tdst.namespace( NProtected(mergeMap(dst,stringMap,ns)) );\n\t\t\t\tcase NExplicit(ns):\t\t\tdst.namespace( NExplicit(mergeMap(dst,stringMap,ns)) );\n\t\t\t\tcase NStaticProtected(ns):\tdst.namespace( NStaticProtected(mergeMap(dst,stringMap,ns)) );\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(i in 0...src.nssets.length) {\n\t\t\tvar nsset = src.nssets[i];\n\t\t\tvar newNsset = new Array();\n\t\t\tfor(ns in nsset) newNsset.push( mergeMap(dst,namespaceMap,ns) );\n\t\t\tnssetMap[i] = dst.namespaceSet( newNsset );\n\t\t}\n\t\t\n\t\tfor(i in 0...src.names.length) {\n\t\t\tnameMap[i] = switch(src.names[i]) {\n\t\t\t\tcase NName(n,ns):\t\t\tdst.name( NName( mergeMap(dst,stringMap,n), mergeMap(dst,namespaceMap,ns) ) );\n\t\t\t\tcase NMulti(n,nsset):\t\tdst.name( NMulti( mergeMap(dst,stringMap,n), mergeMap(dst,nssetMap,nsset) ) );\n\t\t\t\tcase Runtime(n):\t\t\tdst.name( NRuntime( mergeMap(dst,stringMap,n) ) );\n\t\t\t\tcase NRuntimeLate:\t\t\tdst.name( NRuntimeLate );\n\t\t\t\tcase NMultiLate(nsset):\t\tdst.name( NMultiLate( mergeMap(dst,nssetMap,nsset) ) );\n\t\t\t\tcase NAttrib(n):\t\t\tdst.name( NAttrib(n) );\n\t\t\t\tcase NParams(n, params):\n\t\t\t\t\tthrow(\"TODO???\");\n\t\t\t}\n\t\t}\n\t\t\n\t\t// TODO: method types???\n\t\t\n\t\t// TODO this\n\t\tfor(i in 0...src.metadatas.length) {\n\t\t\tvar metadata = src.metadatas[i];\n\t\t\tvar newData = {\n\t\t\t\tn: if(metadata.n != null) mergeMap(dst,stringMap,metadata.n) else null,\n\t\t\t\tv: mergeMap(dst,stringMap,metadata.v)\n\t\t\t};\n\t\t\tmetadataMap[i] = dst.metadata( {name: mergeMap(dst,stringMap,metadata.name), data: newData} );\n\t\t}\n\t\t\n\t\tfor(i in 0...src.classes.length) {\n\t\t\tvar cl = src.classes[i];\n\t\t\tvar newClass = {\n\t\t\t\tname: mergeMap(dst,stringMap,cl.name),\n\t\t\t\tsuperclass: nullMergeMap(dst,stringMap,cl.superclass),\n\t\t\t\tinterfaces: new Array(),\n\t\t\t\tconstructor: mergeMap(dst,methodTypeMap,cl.constructor),\n\t\t\t\tfields: new Array(),\n\t\t\t\tnamespace: nullMergeMap(dst,namespaceMap,cl.namespace),\n\t\t\t\tisSealed: cl.isSealed,\n\t\t\t\tisFinal: cl.isFinal,\n\t\t\t\tisInterface: cl.isInterface,\n\t\t\t\tstatics: mergeMap(dst,methodTypeMap,cl.statics),\n\t\t\t\tstaticFields: new Array(),\n\t\t\t};\n\t\t\t\n\t\t\tdst.classes.push(cl);\n\t\t\tclassMap[i] = dst.classes.length;\n\t\t}\n\t\t\n\t\tfor(i in 0...src.inits.length) {\n\t\t\tvar init = src.inits[i];\n\t\t\tvar newInit = {\n\t\t\t\tmethod: mergeMap(dst,methodTypeMap,init.method),\n\t\t\t\tfields: new Array(),\n\t\t\t};\n\t\t\tdst.inits.push(newInit);\n\t\t}\n\t\t\n\t\tfor(i in 0...src.functions.length) {\n\t\t\tvar f = src.functions[i];\n\t\t\tvar newF = {\n\t\t\t\ttype: mergeMap(dst,methodTypeMap,f.type),\n\t\t\t\tmaxStack: f.maxStack,\n\t\t\t\tnRegs: f.nRegs,\n\t\t\t\tinitScope: f.initScope,\n\t\t\t\tmaxScope: f.maxScope,\n\t\t\t\tmaxStack: f.maxStack,\n\t\t\t\tcode: null,\n\t\t\t\ttrys: new Array(),\n\t\t\t\tlocals: new Array(),\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tvar ops = format.abc.OReader.decode(new BytesInput(f.code));\n\t\t\tfor(i in 0...ops.length) {\n\t\t\t\tops[i] = switch(ops[i]) {\n\t\t\t\t\tcase OGetSuper(n):\t\t\t\tOGetSuper( mergeMap(dst,nameMap,n) );\n\t\t\t\t\tcase OSetSuper(n):\t\t\t\tOSetSuper( mergeMap(dst,nameMap,n) );\n\t\t\t\t\tcase ODxNs(s):\t\t\t\t\tODxNs( mergeMap(dst,stringMap,s) );\n\t\t\t\t\tcase OString(s):\t\t\t\tOString( mergeMap(dst,stringMap,s) );\n\t\t\t\t\tcase OIntRef(i):\t\t\t\tOIntRef( mergeMap(dst,intMap,i) );\n\t\t\t\t\tcase OUIntRef(i):\t\t\t\tOUIntRef( mergeMap(dst,uintMap,i) );\n\t\t\t\t\tcase OFloat(f):\t\t\t\t\tOFloat( mergeMap(dst,floatMap,f) );\n\t\t\t\t\tcase ONamespace(ns):\t\t\tONamespace( mergeMap(dst,namespaceMap,ns) );\n\t\t\t\t\tcase OFunction(m):\t\t\t\tOFunction( mergeMap(dst,methodTypeMap,m) );\n\t\t\t\t\tcase OCallStatic(m,i): \t\t\tOCallStatic( mergeMap(dst,methodTypeMap,m), i);\n\t\t\t\t\tcase OCallSuper(n,i):\t\t\tOCallSuper( mergeMap(dst,nameMap,n), i );\n\t\t\t\t\tcase OCallProperty(n,i):\t\tOCallProperty( mergeMap(dst,nameMap,n), i );\n\t\t\t\t\tcase OConstructProperty(n,i):\tOConstructProperty( mergeMap(dst,nameMap,n), i );\n\t\t\t\t\tcase OCallPropLex(n,i):\t\t\tOCallPropLex( mergeMap(dst,nameMap,n), i );\n\t\t\t\t\tcase OCallSuperVoid(n,i):\t\tOCallSuperVoid( mergeMap(dst,nameMap,n), i );\n\t\t\t\t\tcase OCallPropVoid(n,i):\t\tOCallPropVoid( mergeMap(dst,nameMap,n), i );\n\t\t\t\t\t// OClassDef\n\t\t\t\t\tcase OGetDescendants(n):\t\tOGetDescendants( mergeMap(dst,nameMap,n) );\n\t\t\t\t\tcase OFindPropStrict(n):\t\tOFindPropStrict( mergeMap(dst,nameMap,n) );\n\t\t\t\t\tcase OFindDefinition(n):\t\tOFindDefinition( mergeMap(dst,nameMap,n) );\n\t\t\t\t\tcase OGetLex(n):\t\t\t\tOGetLex( mergeMap(dst,nameMap,n) );\n\t\t\t\t\tcase OSetProp(n):\t\t\t\tOSetProp( mergeMap(dst,nameMap,n) );\n\t\t\t\t\tcase OGetProp(n):\t\t\t\tOGetProp( mergeMap(dst,nameMap,n) );\n\t\t\t\t\tcase OInitProp(n):\t\t\t\tOInitProp( mergeMap(dst,nameMap,n) );\n\t\t\t\t\tcase ODeleteProp(n):\t\t\tODeleteProp( mergeMap(dst,nameMap,n) );\n\t\t\t\t\tcase OCast(n):\t\t\t\t\tOCast( mergeMap(dst,nameMap,n) );\n\t\t\t\t\tcase OAsType(n):\t\t\t\tOAsType( mergeMap(dst,nameMap,n) );\n\t\t\t\t\tcase OIsType(n):\t\t\t\tOIsType( mergeMap(dst,nameMap,n) );\n\t\t\t\t\tcase ODebugReg(s,r,l):\t\t\tODebugReg( mergeMap(dst,stringMap,s), r, l );\n\t\t\t\t\tcase ODebugFile(s):\t\t\t\tODebugFile( mergeMap(dst,stringMap,s) );\n\t\t\t\t\tdefault: ops[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar o = new BytesOutput();\n\t\t\tformat.abc.OReader.encode(o, ops);\n\t\t\tnewF.code = o.getBytes();\n\t\t\tdst.functions.push(newF);\n\t\t}\n\t}*/\n\t\n\tprivate static var _mergeI : Int = 0;\n\tpublic static function mergeClass(dst : ABCData, dstCl : ClassDef, src : ABCData, srcCl : ClassDef) {\n\t\ttrace(dumpAbc(dst));\n\t\ttrace( dumpAbc(src) );\n\t\t//trace( countSlots(src, srcCl) );\n\t\tvar slotOffset = countSlots(dst, dstCl);\n\t\t//trace( slotOffset );\n\t\t\n\t\tvar srcClassName : String = getNamePath(src, srcCl.name);\n\t\tvar dstClassName : String = getNamePath(dst, dstCl.name);\n\t\tfor(i in 0...src.strings.length) {\n\t\t\tif(src.strings[i] == srcClassName) {\n\t\t\t\tsrc.strings[i] = dstClassName;\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(field in srcCl.fields) {\n\t\t\tdstCl.fields.push(mergeField(dst,src,field, slotOffset));\n\t\t}\n\t\t\n\t\tvar theName = null;\n\t\tfor(field in srcCl.staticFields) {\n\t\t\tdstCl.staticFields.push(mergeField(dst,src,field, slotOffset));\n\t\t\tvar newField = dstCl.staticFields[dstCl.staticFields.length-1];\n\t\t\ttheName = newField.name;\n\t\t}\n\t\t\t\t\n\t\tvar srcCtor = getFunction(src,srcCl.constructor);\n\t\tvar ctorF = mergeFunction(dst,src,srcCtor);\n\t\t\n\t\tvar consField = {\n\t\t\tname:\tpublicName(dst, '__cons$_mergeI'),\n\t\t\tslot:\t0,\n\t\t\tkind:\tFMethod(\n\t\t\t\tctorF.type,\n\t\t\t\tKNormal,\n\t\t\t\tfalse,\n\t\t\t\tfalse\n\t\t\t),\n\t\t\tmetadatas:\tnull,\n\t\t};\n\t\t_mergeI++;\n\t\t\n\t\tdstCl.fields.push(consField);\n\t\t\n\t\t\n\t\t/*var sField = {\n\t\t\tname: publicName(dst, \"__a\"),\n\t\t\tslot: 1,\n\t\t\tkind: FVar( publicName(dst, \"Object\") ),\n\t\t\tmetadatas: null,\n\t\t};\n\t\tdstCl.staticFields.push(sField);*/\n\t\t\n\t\tvar dstCtor = getFunction(dst,dstCl.constructor);\n\t\tvar o = new BytesOutput();\n\t\tencodeOps(o, [\n\t\t\tOThis,\n\t\t\tOCallPropVoid(consField.name, 0),\n\t\t\t/*OThis,\n\t\t\tOScope,\n\t\t\tOFindPropStrict(publicName(dst, \"trace\")),\n\t\t\tOString(string(dst, \"InjectCtor\")),\n\t\t\tOCallPropVoid(publicName(dst,\"trace\"),1),\n\t\t\tOPopScope,*/\n\t\t]);\n\t\to.write(dstCtor.code);\n\t\tdstCtor.code = o.getBytes();\n\t\t\n\t\t//trace(\"NEW\");\n\t\t//trace( dumpAbc(dst) );\n\t}\n\t\n\tprivate static function countSlots(abc : ABCData, cl : ClassDef) {\n\t\tvar maxSlot = 0;\n\t\tfor(field in cl.staticFields) {\n\t\t\tif(field.slot > maxSlot) maxSlot = field.slot;\n\t\t}\n\t\t\n\t\tfor(field in cl.fields) {\n\t\t\tif(field.slot > maxSlot) maxSlot = field.slot;\n\t\t}\n\t\t\n\t\treturn maxSlot;\n\t}\n\t\n\tprivate static function mergeField(dst : ABCData, src : ABCData, srcField : Field, ?slotOffset : Int = 0) {\n\t\tvar newKind = switch(srcField.kind) {\n\t\t\tcase FVar(type, value, const):\n\t\t\t\tFVar(\n\t\t\t\t\tif(type != null) mergeName(dst,src,type) else null,\n\t\t\t\t\tif(value != null) mergeValue(dst,src,value) else null,\n\t\t\t\t\tconst\n\t\t\t\t);\n\t\t\t\t\n\t\t\tcase FMethod(type, kind, isFinal, isOverride):\n\t\t\t\tvar newF = mergeFunction(dst,src,getFunction(src,type));\n\t\t\t\tFMethod(\n\t\t\t\t\tnewF.type,\n\t\t\t\t\tkind,\n\t\t\t\t\tisFinal,\n\t\t\t\t\tisOverride\n\t\t\t\t);\n\t\t\t\t\n\t\t\tcase FClass(_):\n\t\t\t\tthrow(\"TODO FClass\");\n\t\t\t\n\t\t\tcase FFunction(_):\n\t\t\t\tthrow(\"TODO FFunction\");\n\t\t\t\n\t\t}\n\t\t\n\t\tvar newField = {\n\t\t\tname: mergeName(dst,src,srcField.name),\n\t\t\tslot: if(srcField.slot > 0) srcField.slot + slotOffset else 0,\n\t\t\tkind: newKind,\n\t\t\tmetadatas: null,\n\t\t};\n\t\t\n\t\treturn newField;\n\t}\n\t\n\tprivate static function mergeValue(dst : ABCData, src : ABCData, v : Value ) : Value {\n\t\treturn switch(v) {\n\t\t\tcase VNull:\t\t\tVNull;\n\t\t\tcase VBool(b):\t\tVBool(b);\n\t\t\tcase VString(s):\tVString( mergeString(dst,src,s) );\n\t\t\tcase VInt(i):\t\tVInt( mergeInt(dst,src,i) );\n\t\t\tcase VUInt(i):\t\tVUInt( mergeUInt(dst,src,i) );\n\t\t\tcase VFloat(f):\t\tVFloat( mergeFloat(dst,src,f) );\n\t\t\tcase VNamespace(k,ns): VNamespace(k, mergeNamespace(dst,src,ns));\n\t\t};\n\t}\n\t\n\tprivate static function mergeInt(dst : ABCData, src : ABCData, i) {\n\t\tif(Type.enumEq(i,Idx(0))) return i;\n\t\treturn int(dst, getInt(src, i));\n\t}\n\t\n\tprivate static function mergeUInt(dst : ABCData, src : ABCData, i) {\n\t\tif(Type.enumEq(i,Idx(0))) return i;\n\t\treturn uint(dst, getUInt(src, i));\n\t}\n\t\n\tprivate static function mergeFloat(dst : ABCData, src : ABCData, i : Index<Float>) : Index<Float> {\n\t\tif(Type.enumEq(i,Idx(0))) return i;\n\t\treturn float(dst, getFloat(src, i));\n\t}\n\t\n\tprivate static function mergeFunction(dst : ABCData, src : ABCData, srcF : Function) : Function {\n\t\tvar newLocals = new Array();\n\t\tfor(field in srcF.locals) {\n\t\t\tnewLocals.push( mergeField(dst,src,field) );\n\t\t}\n\t\t\n\t\tvar newTrys = new Array();\n\t\tfor(i in 0...srcF.trys.length) {\n\t\t\tvar t = srcF.trys[i];\n\t\t\tnewTrys.push({\n\t\t\t\tstart:\tt.start,\n\t\t\t\tend:\tt.end,\n\t\t\t\thandle:\tt.handle,\n\t\t\t\ttype:\tif(t.type != null) mergeName(dst, src, t.type) else null,\n\t\t\t\tvariable: if(t.variable != null) mergeName(dst, src, t.variable) else null,\n\t\t\t});\n\t\t}\n\t\t\n\t\tvar ops = format.abc.OpReader.decode(new BytesInput(srcF.code));\n\t\tfor(i in 0...ops.length) {\n\t\t\tops[i] = switch(ops[i]) {\n\t\t\t\tcase OGetSuper(n):\t\t\t\tOGetSuper( mergeName(dst,src,n) );\n\t\t\t\tcase OSetSuper(n):\t\t\t\tOSetSuper( mergeName(dst,src,n) );\n\t\t\t\tcase ODxNs(s):\t\t\t\t\tODxNs( mergeString(dst,src,s) );\n\t\t\t\tcase OString(s):\t\t\t\tOString( mergeString(dst,src,s) );\n\t\t\t\tcase OIntRef(i):\t\t\t\tOIntRef( mergeInt(dst,src,i) );\n\t\t\t\tcase OUIntRef(i):\t\t\t\tOUIntRef( mergeUInt(dst,src,i) );\n\t\t\t\tcase OFloat(f):\t\t\t\t\tOFloat( mergeFloat(dst,src,f) );\n\t\t\t\tcase ONamespace(ns):\t\t\tONamespace( mergeNamespace(dst,src,ns) );\n\t\t\t\tcase OFunction(m):\t\t\t\tOFunction( mergeMethodType(dst,src,m) );\n\t\t\t\tcase OCallStatic(m,i): \t\t\tOCallStatic( mergeMethodType(dst,src,m), i);\n\t\t\t\tcase OCallSuper(n,i):\t\t\tOCallSuper( mergeName(dst,src,n), i );\n\t\t\t\tcase OCallProperty(n,i):\t\tOCallProperty( mergeName(dst,src,n), i );\n\t\t\t\tcase OConstructProperty(n,i):\tOConstructProperty( mergeName(dst,src,n), i );\n\t\t\t\tcase OCallPropLex(n,i):\t\t\tOCallPropLex( mergeName(dst,src,n), i );\n\t\t\t\tcase OCallSuperVoid(n,i):\t\tOCallSuperVoid( mergeName(dst,src,n), i );\n\t\t\t\tcase OCallPropVoid(n,i):\t\tOCallPropVoid( mergeName(dst,src,n), i );\n\t\t\t\tcase OClassDef(c):\t\t\t\tthrow(\"TODO OClassDef\"); null;\n\t\t\t\tcase OGetDescendants(n):\t\tOGetDescendants( mergeName(dst,src,n) );\n\t\t\t\tcase OFindPropStrict(n):\t\tOFindPropStrict( mergeName(dst,src,n) );\n\t\t\t\tcase OFindProp(n):\t\t\t\tOFindProp( mergeName(dst,src,n) );\n\t\t\t\tcase OFindDefinition(n):\t\tOFindDefinition( mergeName(dst,src,n) );\n\t\t\t\tcase OGetLex(n):\t\t\t\tOGetLex( mergeName(dst,src,n) );\n\t\t\t\tcase OSetProp(n):\t\t\t\tOSetProp( mergeName(dst,src,n) );\n\t\t\t\tcase OGetProp(n):\t\t\t\tOGetProp( mergeName(dst,src,n) );\n\t\t\t\tcase OInitProp(n):\t\t\t\tOInitProp( mergeName(dst,src,n) );\n\t\t\t\tcase ODeleteProp(n):\t\t\tODeleteProp( mergeName(dst,src,n) );\n\t\t\t\tcase OCast(n):\t\t\t\t\tOCast( mergeName(dst,src,n) );\n\t\t\t\tcase OAsType(n):\t\t\t\tOAsType( mergeName(dst,src,n) );\n\t\t\t\tcase OIsType(n):\t\t\t\tOIsType( mergeName(dst,src,n) );\n\t\t\t\tcase ODebugReg(s,r,l):\t\t\tODebugReg( mergeString(dst,src,s), r, l );\n\t\t\t\tcase ODebugFile(s):\t\t\t\tODebugFile( mergeString(dst,src,s) );\n\t\t\t\tdefault: ops[i];\n\t\t\t}\n\t\t}\n\t\tvar o = new BytesOutput();\n\t\tencodeOps(o, ops);\n\t\t\n\t\tvar newF = {\n\t\t\ttype:\t\tmergeMethodType(dst, src, srcF.type),\n\t\t\tmaxStack:\tsrcF.maxStack,\n\t\t\tnRegs:\t\tsrcF.nRegs,\n\t\t\tinitScope:\tsrcF.initScope,\n\t\t\tmaxScope:\tsrcF.maxScope,\n\t\t\tcode:\t\to.getBytes(),\n\t\t\tlocals:\t\tnewLocals,\n\t\t\ttrys:\t\tnewTrys,\n\t\t}\n\t\t\n\t\tdst.functions.push(newF);\n\t\treturn newF;\n\t}\n\t\n\tprivate static function mergeMethodType(dst : ABCData, src : ABCData, i : Index<MethodType>) : Index<MethodType> {\n\t\tvar m = getMethodType(src,i);\n\t\tvar newArgs = new Array();\n\t\tfor(arg in m.args) {\n\t\t\tnewArgs.push( if(arg != null) mergeName(dst,src,arg) else null );\n\t\t}\n\t\t\n\t\tvar newExtra = null;\n\t\tif(m.extra != null) {\n\t\t\tvar newDParams = null;\n\t\t\tif(m.extra.defaultParameters != null) {\n\t\t\t\tnewDParams = new Array();\n\t\t\t\tfor(v in m.extra.defaultParameters) {\n\t\t\t\t\tnewDParams.push( mergeValue(dst,src,v) );\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tvar newParamNames = null;\n\t\t\tif(m.extra.paramNames != null) {\n\t\t\t\tnewParamNames = new Array();\n\t\t\t\tfor(p in m.extra.paramNames) {\n\t\t\t\t\tnewParamNames.push( if(p != null) mergeString(dst,src,p) else null );\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tnewExtra = {\n\t\t\t\tnative:\t\t\t\tm.extra.native,\n\t\t\t\tvariableArgs:\t\tm.extra.variableArgs,\n\t\t\t\targumentsDefined:\tm.extra.native,\n\t\t\t\tusesDXNS:\t\t\tm.extra.usesDXNS,\n\t\t\t\tnewBlocK:\t\t\tm.extra.newBlock,\n\t\t\t\tunused:\t\t\t\tm.extra.unused,\n\t\t\t\tdebugName:\t\t\tif(m.extra.debugName != null) mergeString(dst,src,m.extra.debugName) else null,\n\t\t\t\tdefaultParameters:\tnewDParams,\n\t\t\t\tparamNames:\t\t\tnewParamNames,\n\t\t\t};\n\t\t}\n\t\t\n\t\treturn methodType(dst,{\n\t\t\targs:\tnewArgs,\n\t\t\tret:\tif(m.ret != null) mergeName(dst,src,m.ret) else null,\n\t\t\textra:\tnull,\n\t\t});\n\t}\n\t\n\tprivate static function mergeName(dst : ABCData, src : ABCData, i : IName) : IName {\n\t\tif(Type.enumEq(i,Idx(0))) return i;\n\t\treturn switch(getName(src,i)) {\n\t\t\tcase NName(n,ns):\t\t\tname( dst, NName( mergeString(dst,src,n), mergeNamespace(dst,src,ns) ) );\n\t\t\tcase NMulti(n,nsset):\t\tname( dst, NMulti( mergeString(dst,src,n), mergeNamespaceSet(dst,src,nsset) ) );\n\t\t\tcase NRuntime(n):\t\t\tname( dst, NRuntime( mergeString(dst,src,n) ) );\n\t\t\tcase NRuntimeLate:\t\t\tname( dst, NRuntimeLate );\n\t\t\tcase NMultiLate(nsset):\t\tname( dst, NMultiLate( mergeNamespaceSet(dst,src,nsset) ) );\n\t\t\tcase NAttrib(n):\t\t\tname( dst, NAttrib(n) ); throw(\"TODO\");\n\t\t\tcase NParams(n, params):\n\t\t\t\tthrow(\"TODO???\");\n\t\t}\n\t}\n\t\n\tprivate static function mergeNamespace(dst : ABCData, src : ABCData, i : Index<Namespace>) : Index<Namespace> {\n\t\tif(Type.enumEq(i,Idx(0))) return i;\n\t\treturn switch(getNamespace(src,i)) {\n\t\t\tcase NPrivate(ns):\t\t\tnamespace( dst, NPrivate(mergeString(dst,src,ns)) );\n\t\t\tcase NNamespace(ns):\t\tnamespace( dst, NNamespace(mergeString(dst,src,ns)) );\n\t\t\tcase NPublic(ns):\t\t\tnamespace( dst, NPublic(mergeString(dst,src,ns)) );\n\t\t\tcase NInternal(ns):\t\t\tnamespace( dst, NInternal(mergeString(dst,src,ns)) );\n\t\t\tcase NProtected(ns):\t\tnamespace( dst, NProtected(mergeString(dst,src,ns)) );\n\t\t\tcase NExplicit(ns):\t\t\tnamespace( dst, NExplicit(mergeString(dst,src,ns)) );\n\t\t\tcase NStaticProtected(ns):\tnamespace( dst, NStaticProtected(mergeString(dst,src,ns)) );\n\t\t}\n\t}\n\t\n\tprivate static function mergeNamespaceSet(dst : ABCData, src : ABCData, i : Index<NamespaceSet>) : Index<NamespaceSet> {\n\t\tif(Type.enumEq(i,Idx(0))) return i;\n\t\tvar nsset = getNamespaceSet(src,i);\n\t\tvar newNsset = new Array();\n\t\tfor(ns in nsset) newNsset.push( mergeNamespace(dst,src,ns) );\n\t\treturn namespaceSet( dst,newNsset );\n\t}\n\t\n\tprivate static function mergeString(dst : ABCData, src : ABCData, s : Index<String>) : Index<String> {\n\t\tif(Type.enumEq(s,Idx(0))) return s;\n\t\treturn string(dst, getString(src,s));\n\t}\n\t\n\tpublic static function getNamePath(abc : ABCData, i : IName) : String {\n\t\tvar multiname = getName(abc, i);\n\t\treturn switch( multiname ) {\n\t\t\tcase NName(n, ns):\n\t\t\t\tvar p = getNamespaceStr(abc, ns);\n\t\t\t\treturn (p != null && p != \"\" ? p + \".\" : \"\") + getString(abc, n);\n\t\t\t\n\t\t\tcase NMulti(n, nsset):\n\t\t\t\tvar nses = getNamespaceSet(abc, nsset);\n\t\t\t\tvar str=\"NMulti: [\";\n\t\t\t\tfor(ns in nses) {\n\t\t\t\t\tvar p = getNamespaceStr(abc, ns);\n\t\t\t\t\tstr+=p+\",\";\n\t\t\t\t}\n\t\t\t\tstr += \"].\" + getString(abc, n);\n\t\t\t\treturn str;\n\t\t\t\t\n\t\t\tdefault:\n\t\t\t\t//throw(\"Unexpected name\");\n\t\t\t\treturn Std.string(multiname);\n\t\t}\n\t}\n\t\n\tpublic static function publicToInternalNs(abc : ABCData, i : IName) : Index<Namespace> {\n\t\treturn switch( getName(abc, i) ) {\n\t\t\tcase NName(_, ns):\n\t\t\t\tswitch(getNamespace(abc, ns)) {\n\t\t\t\t\tcase NPublic(ns):\treturn namespace(abc, NInternal(ns));\n\t\t\t\t\tdefault:\t\t\tthrow(\"Unexpected namespace\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\tdefault:\n\t\t\t\tthrow(\"Unexpected name\");\n\t\t}\n\t}\n\t\n\tpublic static function prependOps(f : Function, ops : Array<OpCode>) {\n\t\tvar oldLength = f.code.length;\n\t\tvar o = new haxe.io.BytesOutput();\n\t\tencodeOps(o, ops);\n\t\to.write(f.code);\n\t\tf.code = o.getBytes();\n\t\tvar offset = f.code.length - oldLength;\n\t\tfor(t in f.trys) {\n\t\t\tt.start += offset;\n\t\t\tt.end += offset;\n\t\t\tt.handle += offset;\n\t\t}\n\t}\n\t\n\tpublic static function appendOps(f : Function, ops : Array<OpCode>) {\n\t\tvar o = new haxe.io.BytesOutput();\n\t\to.writeBytes(f.code, 0, f.code.length-1);\n\t\tencodeOps(o, ops);\n\t\tf.code = o.getBytes();\n\t}\n\t\n\tpublic static function encodeOps( o : haxe.io.BytesOutput, ops : Array<OpCode> ) {\n\t\tvar opWriter = new OpWriter(o);\n\t\tfor( op in ops ) opWriter.write(op);\n\t}\n\t\n\tpublic static function getClassPath(abc : ABCData, classPath : String) {\n\t\tvar pack = classPath.split(\".\");\n\t\tvar className = pack.pop();\n\t\tfor (cl in abc.classes) {\n\t\t\tif (getNamePath(abc, cl.name) == classPath) return cl;\n\t\t}\n\t\treturn null;\n\t}\n\t\n\tpublic static function quickMethod(abc : ABCData, cl : ClassDef, methodName : IName, ops : Array<OpCode>, ?kind : MethodKind, ?args : Null<Array<IName>>, ?ret : Null<IName>, ?isOverride : Bool = false) : Function {\n\t\tvar o = new haxe.io.BytesOutput();\n\t\t// MIKE NEW:\n\t\tvar opWriter = new OpWriter(o);\n\t\tfor(op in ops) opWriter.write(op);\n\t\t\n\t\tvar f = {\n\t\t\ttype:\t\tmethodType(abc, { args : args == null ? [] : args, ret : ret, extra : null }),\n\t\t\tnRegs:\t\tif(args != null) args.length + 1 else 1,\n\t\t\tinitScope:\t0,\n\t\t\tmaxScope:\t255,\n\t\t\tmaxStack:\t255,\n\t\t\tcode:\t\to.getBytes(),\n\t\t\ttrys:\t\t[],\n\t\t\tlocals:\t\t[]\n\t\t};\n\t\t\n\t\tabc.functions.push(f);\n\t\t\n\t\tvar field = {\n\t\t\tname: methodName,\n\t\t\tslot: 0,\n\t\t\tkind: FMethod(f.type, if(kind != null) kind else KNormal, false, isOverride),\n\t\t\tmetadatas: null,\n\t\t};\n\t\t\n\t\tcl.fields.push(field);\n\t\t\n\t\treturn f;\n\t}\n\t\n\t\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/swf/BitmapSmoothingMutator.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.swf;\n\nimport format.swf.Data;\n\nclass BitmapSmoothingMutator implements ISWFMutator\n{\n\n\tpublic function new()\n\t{\n\t\t\n\t}\n\t\n\tpublic function mutate(swf : SwivelSwf) {\n\t\tswf.mapTags( forceBitmapSmoothing );\n\t}\n\t\n\tprivate function setSmoothInStyles( fillStyles : Array<FillStyle> ) {\n\t\tfor(i in 0...fillStyles.length) {\n\t\t\tswitch(fillStyles[i]) {\n\t\t\t\tcase FSBitmap(id, matrix, smooth, repeat):\n\t\t\t\t\tif(smooth == false)\n\t\t\t\t\t\tfillStyles[i] = FSBitmap(id, matrix, true, repeat);\n\n\t\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function forceBitmapSmoothing( tag : SWFTag ) : SWFTag {\n\t\tswitch(tag) {\n\t\t\tcase TShape(id, SHDShape1(_, data)) |\n\t\t\t\tTShape(id, SHDShape2(_, data)) |\n\t\t\t\tTShape(id, SHDShape3(_, data)):\n\t\t\t\tsetSmoothInStyles( data.fillStyles );\n\t\t\t\t\n\t\t\t\tfor(sr in data.shapeRecords) {\n\t\t\t\t\tswitch(sr) {\n\t\t\t\t\t\tcase SHRChange((change)):\n\t\t\t\t\t\t\tif((change).newStyles != null) setSmoothInStyles( change.newStyles.fillStyles );\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\tcase TShape(id, SHDShape4(data)):\n\t\t\t\tsetSmoothInStyles( data.shapes.fillStyles );\n\t\t\t\t\n\t\t\t\tfor(sr in data.shapes.shapeRecords) {\n\t\t\t\t\tswitch(sr) {\n\t\t\t\t\t\tcase SHRChange(change):\n\t\t\t\t\t\t\tif(change.newStyles != null) setSmoothInStyles( change.newStyles.fillStyles );\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\tdefault:\n\t\t}\n\n\t\treturn tag;\n\t}\n\t\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/swf/ISWFMutator.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.swf;\n\ninterface ISWFMutator\n{\n\tfunction mutate(swf : SwivelSwf) : Void;\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/swf/RenderQuality.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.swf;\n\nenum RenderQuality {\n\tLow;\n\tMedium;\n\tHigh;\n\tHigher;\n\tHighest;\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/swf/SWFRecorder.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.swf;\nimport com.huey.events.Dispatcher;\nimport flash.display.Bitmap;\nimport flash.display.BitmapData;\nimport flash.display.Loader;\nimport flash.display.NativeWindow;\nimport flash.display.NativeWindowInitOptions;\nimport flash.display.StageAlign;\nimport flash.display.StageQuality;\nimport flash.display.StageScaleMode;\nimport flash.events.Event;\nimport flash.events.UncaughtErrorEvent;\nimport flash.geom.ColorTransform;\nimport flash.geom.Matrix;\nimport flash.geom.Rectangle;\nimport flash.system.LoaderContext;\nimport flash.system.System;\n\nclass SWFRecorder {\n\tprivate static inline var DEFAULT_WIDTH : Int\t= 1920;\n\tprivate static inline var DEFAULT_HEIGHT : Int\t= 1080;\n\t\n\tprivate static inline var WATERMARK_MARGIN : Int = 2;\n\t\n\tpublic var outputWidth\t: Int;\n\tpublic var outputHeight\t: Int;\n\tpublic var scaleMode \t: ScaleMode;\n\t\n\tpublic var transparentBackground : Bool;\n\t\n\tpublic var renderQuality : RenderQuality;\n\t\n\tpublic var watermark : Null<Watermark>;\n\tpublic var showWindow : Bool = false;\n\t\n\tpublic var currentFrame(default, null) : Int;\n\t\n\tpublic var onFrameCaptured : Dispatcher<BitmapData>;\n\t\n\tpublic var recording(default, null) : Bool;\n\t\n\tpublic function new() {\n\t\toutputWidth = DEFAULT_WIDTH;\n\t\toutputHeight = DEFAULT_HEIGHT;\n\t\tscaleMode = crop;\n\t\trenderQuality = High;\n\t\t\n\t\trecording = false;\n\t\t\n\t\ttransparentBackground = false;\n\t\t\n\t\tonFrameCaptured = new Dispatcher();\n\t\t\n\t\t_maxFrameRate = switch( flash.system.Capabilities.os.split(\" \")[0] ) {\n\t\t\tcase \"Windows\":\t1000;\n\t\t\tdefault:\t\t30;\n\t\t}\n\t}\n\t\n\tprivate var _swf\t\t\t: SwivelSwf;\n\tprivate var _window\t\t\t: NativeWindow;\n\tprivate var _loader\t\t\t: Loader;\n\tprivate var _mask\t\t\t: Bitmap;\n\t\n\tprivate var _drawMatrix \t: Matrix;\n\tprivate var _watermarkMatrix: Matrix;\n\tprivate var _watermarkColorTransform : ColorTransform;\n\tprivate var _letterBoxRect0\t: Rectangle;\n\tprivate var _letterBoxRect1\t: Rectangle;\n\t\n\tprivate var _frame\t\t\t: BitmapData;\n\t\n\t// TODO:\n\tprivate var _maxFrameRate\t: Int;\n\t\n\tprivate function createWindow() {\n\t\tvar opts = new NativeWindowInitOptions();\n\t\topts.maximizable = false;\n\t\topts.resizable = false;\n\t\t_window = new NativeWindow(opts);\n\t\t_window.addEventListener(flash.events.Event.CLOSING, function(e) e.preventDefault());\n\t\t_window.stage.align = StageAlign.TOP_LEFT;\n\t\t_window.stage.scaleMode = StageScaleMode.NO_SCALE;\n\t\t_window.title = \"Swivel Interactive Window\";\n\t}\n\t\n\tpublic function startPlayback(swf : SwivelSwf, ?parameters : Dynamic) : Void {\n\t\tcurrentFrame = 0;\n\t\t\t\t\n\t\tcreateWindow();\n\t\t_swf = swf;\n\t\t_window.width = _swf.width;\n\t\t_window.height = _swf.height;\n\t\t_window.stage.stageWidth = _swf.width;\n\t\t_window.stage.stageHeight = _swf.height;\n\t\t_window.stage.frameRate = if(showWindow) _swf.frameRate else _maxFrameRate;\n\n\t\t_frame = new BitmapData(outputWidth, outputHeight, transparentBackground);\n\t\t\n\t\tvar scaleX = outputWidth / _swf.width;\n\t\tvar scaleY = outputHeight / _swf.height;\n\t\t\n\t\t// create scaling matrix and letterboxes for drawing SWF\n\t\t_drawMatrix = new Matrix();\n\t\t_letterBoxRect0 = _letterBoxRect1 = null;\n\t\tswitch(scaleMode) {\n\t\t\tcase stretchToFit:\n\t\t\t\t_drawMatrix.scale(scaleX, scaleY);\n\t\t\t\t\n\t\t\tcase crop:\n\t\t\t\tif (scaleX > scaleY) {\n\t\t\t\t\t_drawMatrix.scale(scaleX, scaleX);\n\t\t\t\t\t_drawMatrix.translate(0, (outputHeight - scaleX * _swf.height) / 2);\n\t\t\t\t} else if (scaleY > scaleX) {\n\t\t\t\t\t_drawMatrix.scale(scaleY, scaleY);\n\t\t\t\t\t_drawMatrix.translate((outputWidth - scaleY * _swf.width) / 2, 0);\n\t\t\t\t} else _drawMatrix.scale(scaleX, scaleY);\n\t\t\t\t\n\t\t\tcase letterbox:\n\t\t\t\tif (scaleX < scaleY) {\n\t\t\t\t\t_drawMatrix.scale(scaleX, scaleX);\n\t\t\t\t\tvar letterBoxSize = (outputHeight - scaleX * _swf.height) / 2;\n\t\t\t\t\t_drawMatrix.translate(0, letterBoxSize);\n\t\t\t\t\t_letterBoxRect0 = new Rectangle(0, 0, outputWidth, letterBoxSize);\n\t\t\t\t\t_letterBoxRect1 = new Rectangle(0, outputHeight-letterBoxSize, outputWidth, letterBoxSize);\n\t\t\t\t} else if (scaleY < scaleX) {\n\t\t\t\t\t_drawMatrix.scale(scaleY, scaleY);\n\t\t\t\t\tvar letterBoxSize = (outputWidth - scaleY * _swf.width) / 2;\n\t\t\t\t\t_drawMatrix.translate(letterBoxSize, 0);\n\t\t\t\t\tif(!transparentBackground) {\n\t\t\t\t\t\t_letterBoxRect0 = new Rectangle(0, 0, letterBoxSize, outputHeight);\n\t\t\t\t\t\t_letterBoxRect1 = new Rectangle(outputWidth-letterBoxSize, 0, letterBoxSize, outputHeight);\n\t\t\t\t\t}\n\t\t\t\t} else _drawMatrix.scale(scaleX, scaleY);\n\t\t}\n\t\t\n\t\tif(watermark != null && watermark.image != null) {\n\t\t\t_watermarkMatrix = new Matrix();\n\t\t\tvar watermarkW = watermark.scale * watermark.image.width;\n\t\t\tvar watermarkH = watermark.scale * watermark.image.height;\n\t\t\t_watermarkMatrix.translate(-watermark.image.width/2, -watermark.image.height/2);\n\t\t\t_watermarkMatrix.scale(watermark.scale, watermark.scale);\n\t\t\t_watermarkMatrix.translate(watermarkW/2, watermarkH/2);\n\t\t\tswitch(watermark.align) {\n\t\t\t\tcase bottomLeft:\t_watermarkMatrix.translate(WATERMARK_MARGIN, outputHeight - watermarkH - WATERMARK_MARGIN);\n\t\t\t\tcase bottomCenter:\t_watermarkMatrix.translate(outputWidth/2 - watermarkW/2, outputHeight - watermarkH - WATERMARK_MARGIN);\n\t\t\t\tcase bottomRight:\t_watermarkMatrix.translate(outputWidth - watermarkW - WATERMARK_MARGIN, outputHeight - watermarkH - WATERMARK_MARGIN);\n\t\t\t\tcase middleLeft:\t_watermarkMatrix.translate(WATERMARK_MARGIN, (outputHeight - watermarkH)/2);\n\t\t\t\tcase center:\t\t_watermarkMatrix.translate((outputWidth - watermarkW)/2, (outputHeight - watermarkH)/2);\n\t\t\t\tcase middleRight:\t_watermarkMatrix.translate(outputWidth - watermarkW - WATERMARK_MARGIN, (outputHeight - watermarkH)/2);\n\t\t\t\tcase topLeft:\t\t_watermarkMatrix.translate(WATERMARK_MARGIN, WATERMARK_MARGIN);\n\t\t\t\tcase topCenter:\t\t_watermarkMatrix.translate((outputWidth - watermarkW)/2, WATERMARK_MARGIN);\n\t\t\t\tcase topRight:\t\t_watermarkMatrix.translate(outputWidth - watermarkW - WATERMARK_MARGIN, WATERMARK_MARGIN);\n\t\t\t}\n\t\t\t\n\t\t\t_watermarkColorTransform = new ColorTransform(1, 1, 1, watermark.alpha);\n\t\t}\n\t\t\t\t\n\t\tvar loaderContext : LoaderContext = new LoaderContext();\n\t\tloaderContext.allowCodeImport = true;\n\t\tif(parameters != null) loaderContext.parameters = parameters;\n\t\t\n\t\t_loader = new Loader();\n\t\t// start recording after Event.INIT (first frame is loaded)\n\t\t_loader.contentLoaderInfo.addEventListener(Event.INIT, onSWFLoaded);\n\t\t_loader.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, function(e) {\n\t\t\ttrace(e.error);\n\t\t\te.preventDefault();\n\t\t});\n\t\t_loader.loadBytes(_swf.getBytes().getData(), loaderContext);\n\t\t_window.stage.addChild(_loader);\n\t\t\n\t\t// Flash would crash from exceptionally large frames/filters\n\t\t// Masking the loader to output dimensions seems to fix the problem\n\t\t_mask = new Bitmap( new BitmapData(_swf.width, _swf.height, false, 0) );\n\t\t_window.stage.addChild(_mask);\n\t\t\n\t\t_window.x = (_window.stage.fullScreenWidth-_window.width)/2;\n\t\t_window.y = 0;\n\t\tif(showWindow) _window.activate();\n\t}\n\t\n\tpublic function startRecording() {\n\t\trecording = true;\n\t}\n\n\tpublic function stop() : Void {\n\t\trecording = false;\n\t\t\t\t\n\t\tif (_loader != null) {\n\t\t\t_loader.content.mask = null;\n\t\t\t_loader.contentLoaderInfo.removeEventListener(flash.events.Event.INIT, onSWFLoaded);\n\t\t\t_loader.removeEventListener(flash.events.Event.RENDER, onSWFRender);\n\t\t\t_loader.removeEventListener(flash.events.Event.ENTER_FRAME, onSWFFrame);\n\t\t\t_loader.unloadAndStop(true);\n\t\t\tif (_loader.parent != null) _window.stage.removeChild(_loader);\n\t\t\t_loader = null;\n\t\t}\n\t\t\n\t\tif(_mask != null && _mask.parent != null) _mask.parent.removeChild(_mask);\n\t\t_mask = null;\n\t\t\n\t\tif(_window != null) {\n\t\t\twhile(_window.stage.numChildren > 0) _window.stage.removeChildAt(0);\n\t\t\t\n\t\t\tif(showWindow) _window.close();\n\t\t\t_window.stage.frameRate = 30;\n\t\t\t_window = null;\n\t\t}\n\n\t\t_frame = null;\n\t}\n\t\n\tprivate function onSWFLoaded(event : Dynamic) : Void {\n\t\t_loader.content.mask = _mask;\n\t\t\n\t\t_loader.contentLoaderInfo.removeEventListener(flash.events.Event.INIT, onSWFLoaded);\n\t\t_loader.addEventListener(flash.events.Event.ENTER_FRAME, onSWFFrame);\n\t\t_loader.addEventListener(flash.events.Event.RENDER, onSWFRender);\n\t\t\n\t\t// The first frame of the movie is already visible, and the events above won't fire\n\t\t// until next frame, so manually trigger a render immediately (#2).\n\t\tonSWFFrame(null);\n\t}\n\t\n\tfunction onSWFFrame(_) _window.stage.invalidate();\n\t\n\tprivate function onSWFRender(_) : Void {\n\t\t_window.stage.align = StageAlign.TOP_LEFT;\n\t\t_window.stage.scaleMode = StageScaleMode.NO_SCALE;\n\n\t\tif(recording) {\n\t\t\tonFrameCaptured.dispatch( drawFrame() );\n\t\t}\n\t\tcurrentFrame++;\n\t}\n\t\n\tprivate function drawFrame() : BitmapData {\n\t\tif (_loader == null) throw \"F\";\n\n\t\t_frame.lock();\n\t\t_frame.fillRect(_frame.rect, transparentBackground ? 0x00000000 : _swf.backgroundColor);\n\t\t\n\t\t// There are some weird bugs in Flash causing artifacts when drawing at high resolutions\n\t\t// Readding loader to stage seems to fix it (forces redraw???)\n\t\t_window.stage.addChild(_loader);\n\t\t\n\t\t// TODO: StageQuality.HIGH_8X8/16X16 and better seems to cause artifacts on some content. :(\n\t\t// If they fix this in the Flash Player, readd them to settings screen\n\t\tvar quality = switch(renderQuality) {\n\t\t\tcase Low:\t\t\tStageQuality.LOW;\n\t\t\tcase Medium:\t\tStageQuality.MEDIUM;\n\t\t\tcase High:\t\t\tStageQuality.BEST;\n\t\t\tcase Higher:\t\tStageQuality.HIGH_8X8_LINEAR;\n\t\t\tcase Highest:\t\tStageQuality.HIGH_16X16_LINEAR;\n\t\t}\n\t\t// this might need to draw loader instead of _window.stage\n\t\t_frame.drawWithQuality(_window.stage, _drawMatrix, null, null, null, true, quality);\n\t\t\n\t\tif (_letterBoxRect0 != null) _frame.fillRect(_letterBoxRect0, 0xff000000);\n\t\tif (_letterBoxRect1 != null) _frame.fillRect(_letterBoxRect1, 0xff000000);\n\t\t\n\t\t// draw watermark\n\t\tif(watermark != null && watermark.image != null)\n\t\t\t_frame.draw(watermark.image, _watermarkMatrix, _watermarkColorTransform, null, null, true);\n\t\t_frame.unlock();\n\t\treturn _frame;\n\t}\n}\n\nenum ScaleMode\n{\n\tcrop;\n\tstretchToFit;\n\tletterbox;\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/swf/ScaleFilterMutator.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.swf;\n\nimport format.swf.Data;\nimport haxe.ds.IntMap;\nusing com.newgrounds.swivel.swf.AbcUtils;\n\n/**\n * Scales all filters to match the output video size.\n */\nclass ScaleFilterMutator implements ISWFMutator\n{\n\tpublic function new(scale : Float) {\n\t\tthis.scale = scale;\n\t}\n\n\tpublic var scale : Float;\n\tprivate var _filteredClips : IntMap<Float>;\n\tprivate var _maskClips : IntMap<Bool>;\n\tprivate var _isAS3 : Bool;\n\t\n\tpublic function mutate(swf : SwivelSwf) {\n\t\t_isAS3 = switch(swf.avmVersion) {\n\t\t\tcase AVM1:\tfalse;\n\t\t\tcase AVM2:\n\t\t\t\t_filteredClips = new IntMap();\n\t\t\t\t_maskClips = new IntMap();\n\t\t\t\ttrue;\n\t\t}\n\t\t\n\t\tswf.mapClips( tweakFilters );\n\n\t\tif(_isAS3) {\n\t\t\tfor (id in _filteredClips.keys()) {\n\t\t\t\tif (_maskClips.get(id)) continue;\n\t\t\t\tswf.hoistClip(id, function(abcStuff) {\n\t\t\t\t\tvar abc = abcStuff.abc;\n\t\t\t\t\tvar cl = abcStuff.cl;\n\t\t\t\t\tvar ctor = abc.getFunction(cl.constructor);\n\t\t\t\t\tif(ctor.maxStack < 4) ctor.maxStack = 4;\n\t\t\t\t\tif(ctor.maxScope < 4) ctor.maxScope = 4;\n\t\t\t\t\n\t\t\t\t\tctor.prependOps([\n\t\t\t\t\t\tOGetLex( abc.publicName(\"__Swivel\") ),\n\t\t\t\t\t\tOThis,\n\t\t\t\t\t\tOFloat( abc.float( _filteredClips.get(id) ) ),\n\t\t\t\t\t\tOCallPropVoid( abc.publicName(\"setMask\"), 2 )\n\t\t\t\t\t]);\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprivate function tweakFilters(id : Int, tags : Array<SWFTag>) : Array<SWFTag> {\n\t\tvar curClips = new IntMap<Int>();\n\t\t\n\t\tfor(i in 0...tags.length) {\n\t\t\tvar tag = tags[i];\n\t\t\tswitch(tag) {\n\t\t\t\tcase TPlaceObject2(po):\n\t\t\t\t\tif (po.cid != null) curClips.set(po.depth, po.cid);\n\t\t\t\t\tif (po.clipDepth != null) _maskClips.set(po.cid, true);\n\t\t\t\t\t\n\t\t\t\tcase TPlaceObject3(po):\n\t\t\t\t\tif (po.cid != null) curClips.set(po.depth, po.cid);\n\t\t\t\t\tif (po.clipDepth != null) _maskClips.set(po.cid, true);\n\t\t\t\t\t\n\t\t\t\t\tif (po.filters != null || po.bitmapCache != null) {\n\t\t\t\t\t\tvar margin = 0.0;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(po.filters != null) {\n\t\t\t\t\t\t\tfor (filter in po.filters) {\n\t\t\t\t\t\t\t\tswitch (filter) {\n\t\t\t\t\t\t\t\t\tcase FBlur(data):\n\t\t\t\t\t\t\t\t\t\tdata.blurX = Std.int(data.blurX * scale);\n\t\t\t\t\t\t\t\t\t\tdata.blurY = Std.int(data.blurY * scale);\n\t\t\t\t\t\t\t\t\t\t//data.passes = 3;\n\t\t\t\t\t\t\t\t\t\tmargin = Math.max(margin, data.blurX/0x00010000+1);\n\t\t\t\t\t\t\t\t\t\tmargin = Math.max(margin, data.blurY/0x00010000+1);\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tcase FGradientGlow(data), FGradientBevel(data):\n\t\t\t\t\t\t\t\t\t\tdata.data.blurX = Std.int(data.data.blurX * scale);\n\t\t\t\t\t\t\t\t\t\tdata.data.blurY = Std.int(data.data.blurY * scale);\n\t\t\t\t\t\t\t\t\t\tdata.data.distance = Std.int(data.data.distance * scale);\n\t\t\t\t\t\t\t\t\t\t//data.data.flags.passes = 3;\n\t\t\t\t\t\t\t\t\t\tvar dist = Math.abs(data.data.distance/0x00010000) + 1;\n\t\t\t\t\t\t\t\t\t\tmargin = Math.max(margin, data.data.blurX + dist);\n\t\t\t\t\t\t\t\t\t\tmargin = Math.max(margin, data.data.blurY + dist);\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tcase FDropShadow(data), FGlow(data), FBevel(data):\n\t\t\t\t\t\t\t\t\t\tdata.blurX = Std.int(data.blurX * scale);\n\t\t\t\t\t\t\t\t\t\tdata.blurY = Std.int(data.blurY * scale);\n\t\t\t\t\t\t\t\t\t\tdata.distance = Std.int(data.distance * scale);\n\t\t\t\t\t\t\t\t\t\t//data.strength = Std.int(data.strength * scale);\n\t\t\t\t\t\t\t\t\t\t//data.flags.passes = 3;\n\t\t\t\t\t\t\t\t\t\tvar dist = Math.abs(data.distance/0x00010000) + 1;\n\t\t\t\t\t\t\t\t\t\tmargin = Math.max(margin, data.blurX/0x00010000 + dist);\n\t\t\t\t\t\t\t\t\t\tmargin = Math.max(margin, data.blurY/0x00010000 + dist);\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(_isAS3) {\n\t\t\t\t\t\t\t_filteredClips.set(curClips.get(po.depth), margin);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif(po.events == null) po.events = new Array();\n\t\t\t\t\t\t\tpo.events.push( {\n\t\t\t\t\t\t\t\teventsFlags: 1,\n\t\t\t\t\t\t\t\tdata: com.newgrounds.swivel.swf.SwivelSwf.getAvm1Bytes([\n\t\t\t\t\t\t\t\t\tAPush( [PFloat(margin), PString(\"this\")] ),\n\t\t\t\t\t\t\t\t\tAEval,\n\t\t\t\t\t\t\t\t\tAPush( [PInt(2), PString(\"__createMask\")] ),\n\t\t\t\t\t\t\t\t\tACall,\n\t\t\t\t\t\t\t\t\tAPop,\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn tags;\n\t}\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/swf/SilenceSoundMutator.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.swf;\nimport format.swf.Data;\n\nclass SilenceSoundMutator implements ISWFMutator\n{\n\n\tpublic function new() {\n\t}\n\t\n\tpublic function mutate(swf : SwivelSwf) : Void {\n\t\tswf.mapTags(removeSounds);\n\t}\n\t\n\tprivate function removeSounds(tag : SWFTag) : SWFTag {\n\t\tswitch(tag) {\n\t\t\tcase TStartSound(_,_), TSoundStream(_), TSoundStreamBlock(_):\n\t\t\t\treturn null;\n\t\t\tdefault:\n\t\t\t\treturn tag;\n\t\t}\n\t}\n\t\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/swf/SoundConnectionMutator.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.swf;\nimport com.newgrounds.swivel.audio.AudioTracker;\nimport format.as1.Data;\nimport format.swf.Data;\nimport haxe.Int32;\nimport haxe.ds.IntMap;\nimport haxe.io.Bytes;\nimport haxe.io.BytesOutput;\n\n/**\n * Tracks sounds playing in an SWF using LocalConnection.\n */\nclass SoundConnectionMutator implements ISWFMutator\n{\n\tpublic var connectionName : String;\n\t\n\tprivate var _audioTracker : AudioTracker;\n\tprivate var _streamId : Int;\n\tprivate var _clipClasses : IntMap<String>;\n\t\n\tpublic function new(connectionName : String, audioTracker : AudioTracker) {\n\t\tthis.connectionName = connectionName;\n\t\t_audioTracker = audioTracker;\n\t\t_streamId = 0;\n\t\t_clipClasses = new IntMap();\n\t}\n\t\n\tpublic function mutate(swf : SwivelSwf) : Void {\n\t\tswf.mapClips(injectSoundLogging);\n\t\tfinalize(swf);\n\t}\n\t\n\tprivate function injectSoundLogging(id : Int, tags : Array<SWFTag>) : Array<SWFTag> {\n\t\tvar stream : SoundStream = null;\n\t\tvar streamFrame : Int = 0;\n\t\tvar i : Int = 0;\n\t\t\n\t\tvar streamData : Array<Bytes> = null;\n\t\tvar currentStreamPacket : BytesOutput = null;\n\t\tvar frame : Int = 0;\n\t\tvar lastStreamData : Int = 0;\n\t\t\n\t\t\n\t\tfunction finalizeStream() {\n\t\t\tif(stream == null || streamData == null) return;\n\t\t\t\n\t\t\tif (currentStreamPacket != null) streamData.push(currentStreamPacket.getBytes());\n\n\t\t\t// FIX for dolphinn.swf\n\t\t\tif(streamData[0].length > 0) {\n\t\t\t\t_audioTracker.registerSound({\n\t\t\t\t\tid:\t\t\t\tcom.newgrounds.swivel.audio.SoundClip.SoundClipId.stream(_streamId),\n\t\t\t\t\tformat:\t\t\tstream.streamFormat,\n\t\t\t\t\tis16bit:\t\tstream.streamIs16bit,\n\t\t\t\t\tisStereo:\t\tstream.streamIsStereo,\n\t\t\t\t\tsampleRate:\t\tstream.streamRate,\n\t\t\t\t\tnumSamples:\t\tnull, // stream.samples, MIKE: stream sounds were getting truncated weirdly!?\n\t\t\t\t\tlatencySeek: \tstream.seek,\n\t\t\t\t\tdata:\t\t\tstreamData\n\t\t\t\t});\n\t\t\t}\n\t\t\t\n\t\t\t_streamId++;\n\t\t\tcurrentStreamPacket = null;\n\t\t\tstreamData = null;\n\t\t\tstreamFrame = 0;\n\t\t}\n\t\n\t\twhile(i < tags.length) {\n\t\t\tvar tag = tags[i];\n\t\t\tswitch(tag) {\n\t\t\t\tcase TSound(sound):\n\t\t\t\t\t_audioTracker.registerSound( {\n\t\t\t\t\t\tid:\t\t\t\tevent(sound.sid),\n\t\t\t\t\t\tformat:\t\t\tsound.format,\n\t\t\t\t\t\tis16bit:\t\tsound.is16bit,\n\t\t\t\t\t\tisStereo:\t\tsound.isStereo,\n\t\t\t\t\t\tsampleRate:\t\tsound.rate,\n\t\t\t\t\t\tnumSamples:\t\tsound.samples,\n\t\t\t\t\t\tlatencySeek: \tswitch(sound.data) {\n\t\t\t\t\t\t\tcase SDMp3(seek, _):\tseek;\n\t\t\t\t\t\t\tdefault:\t\t\t\t0;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdata:\t\t\tswitch(sound.data) {\n\t\t\t\t\t\t\tcase SDMp3(_, d):\t[d];\n\t\t\t\t\t\t\tcase SDRaw(d):\t\t[d];\n\t\t\t\t\t\t\tcase SDOther(d):\t[d];\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\t\n\t\t\t\tcase TStartSound(soundId, infos):\n\t\t\t\t\tvar newTag = handleStartSound(id, frame, soundId, infos);\n\t\t\t\t\tif(newTag != null) tags[i] = newTag;\n\t\t\t\t\n\t\t\t\tcase TSoundStream(streamInfo):\n\t\t\t\t\tstream = streamInfo;\n\n\t\t\t\tcase TSymbolClass(links):\n\t\t\t\t\tfor(link in links) {\n\t\t\t\t\t\t_clipClasses.set(link.cid, link.className);\n\t\t\t\t\t\tvar sound = _audioTracker.getSound(event(link.cid));\n\t\t\t\t\t\tif(sound != null) {\n\t\t\t\t\t\t\t_audioTracker.registerSound({\n\t\t\t\t\t\t\t\tid:\t\t\t\tactionScript(link.className),\n\t\t\t\t\t\t\t\tformat:\t\t\tsound.format,\n\t\t\t\t\t\t\t\tis16bit:\t\tsound.is16bit,\n\t\t\t\t\t\t\t\tisStereo:\t\tsound.isStereo,\n\t\t\t\t\t\t\t\tsampleRate:\t\tsound.sampleRate,\n\t\t\t\t\t\t\t\tlatencySeek: \tsound.latencySeek,\n\t\t\t\t\t\t\t\tnumSamples:\t\tsound.numSamples,\n\t\t\t\t\t\t\t\tdata:\t\t\tsound.data,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\tcase TExport(exports):\n\t\t\t\t\tfor(e in exports) {\n\t\t\t\t\t\tvar sound = _audioTracker.getSound(event(e.cid));\n\t\t\t\t\t\tif(sound != null) {\n\t\t\t\t\t\t\t_audioTracker.registerSound({\n\t\t\t\t\t\t\t\tid:\t\t\t\tactionScript(e.name),\n\t\t\t\t\t\t\t\tformat:\t\t\tsound.format,\n\t\t\t\t\t\t\t\tis16bit:\t\tsound.is16bit,\n\t\t\t\t\t\t\t\tisStereo:\t\tsound.isStereo,\n\t\t\t\t\t\t\t\tsampleRate:\t\tsound.sampleRate,\n\t\t\t\t\t\t\t\tlatencySeek: \tsound.latencySeek,\n\t\t\t\t\t\t\t\tnumSamples:\t\tsound.numSamples,\n\t\t\t\t\t\t\t\tdata:\t\t\tsound.data,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\tcase TShowFrame:\n\t\t\t\t\tif(stream != null && streamData != null && lastStreamData >= frame-4) {\n\t\t\t\t\t\tvar newTag = handleStreamFrame(id, frame, _streamId, streamFrame);\n\t\t\t\t\t\tif(newTag != null) {\n\t\t\t\t\t\t\ttags.insert(i, newTag);\n\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstreamFrame++;\n\t\t\t\t\t}\n\t\t\t\t\tframe++;\n\n\t\t\t\tcase TSoundStreamBlock(data):\n\t\t\t\t\tif(streamData == null || lastStreamData < frame-1) {\n\t\t\t\t\t\tfinalizeStream();\n\t\t\t\t\t\tstreamData = [];\n\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\tlastStreamData = frame;\n\t\t\t\t\t\n\t\t\t\t\tswitch(stream.streamFormat) {\n\t\t\t\t\t\tcase SFMP3:\t\tif (currentStreamPacket == null) currentStreamPacket = new BytesOutput();  if(data.length >= 4) currentStreamPacket.writeBytes(data, 4, data.length - 4);\n\t\t\t\t\t\tcase SFADPCM:\tstreamData.push(data);\n\t\t\t\t\t\tdefault:\t\tif (currentStreamPacket == null) currentStreamPacket = new BytesOutput(); currentStreamPacket.write(data);\n\t\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t};\n\n\t\ti++;\n\t\t}\n\t\t\n\t\tfinalizeStream();\n\t\t\n\t\treturn tags;\n\t}\n\t\n\tprivate function handleStartSound(clipId : Int, frame : Int, soundId : Int, infos : StartSoundInfo) : SWFTag {\n\t\tvar envelope = [];\n\t\tvar len = 0;\n\t\tif(infos.envelope != null) {\n\t\t\tfor (point in infos.envelope) {\n\t\t\t\tenvelope.push( PInt(point.pos) );\n\t\t\t\tenvelope.push( PInt(point.leftVolume) );\n\t\t\t\tenvelope.push( PInt(point.rightVolume) );\n\t\t\t\tlen += 3;\n\t\t\t}\n\t\t}\n\t\tenvelope.reverse();\n\t\tenvelope.push( PInt( len ) );\n\t\t\n\t\tvar sync = if( infos.stop ) 2 else if( infos.noMultiple ) 1 else 0;\n\t\treturn TDoActions( SwivelSwf.getAvm1Bytes([\n\t\t\tAPush( envelope ),\n\t\t\tAInitArray,\n\t\t\tAPush([\n\t\t\t\tPInt( infos.numLoops ),\n\t\t\t\tif( infos.endPos != null ) PInt( infos.endPos ) else PNull,\n\t\t\t\tif( infos.startPos != null ) PInt( infos.startPos ) else PNull,\n\t\t\t\tPInt( sync ),\n\t\t\t\tPInt( soundId ),\n\t\t\t\tPInt( 0 ),\n\t\t\t\tPString(\"__getFrame\"),\n\t\t\t]),\n\t\t\tACall,\n\t\t\tAPush( [PString(\"startSound\"), PInt(8), PString(\"__swivel\")] ),\n\t\t\tACall,\n\t\t\tAPop\n\t\t]) );\n\t}\n\n\tprivate function handleStreamFrame(clipId : Int, clipFrame : Int, streamId : Int, streamFrame : Int) : SWFTag {\n\t\treturn TDoActions( SwivelSwf.getAvm1Bytes([\n\t\t\tAPush([\n\t\t\t\tPInt( streamFrame ),\n\t\t\t\tPInt( streamId ),\n\t\t\t\tPInt( 0 ),\n\t\t\t\tPString(\"__getFrame\"),\n\t\t\t]),\n\t\t\tACall,\n\t\t\tAPush( [PString(\"streamSound\"), PInt(4), PString(\"__swivel\")] ),\n\t\t\tACall,\n\t\t\tAPop,\n\t\t]) );\n\t}\n\t\n\tprivate function finalize(swf : SwivelSwf) {\n\t\tswf.prepend(SwfUtils.getAs2Tag(\"AS2SoundLogger\"));\n\t}\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/swf/SwfUtils.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.swf;\nimport format.abc.Data;\nimport format.as1.Data;\nimport format.swf.Data;\nimport haxe.ds.IntMap;\nimport haxe.io.BytesInput;\nimport haxe.io.BytesOutput;\nimport haxe.Resource;\nimport haxe.macro.Expr;\n\nclass SwfUtils\n{\n\tmacro public static function getAs2Tag(resourceName, ?params) {\n\t\tvar name = switch(resourceName.expr) {\n\t\t\tcase EConst(c):\n\t\t\t\tswitch(c) {\n\t\t\t\t\tcase CString(s): s;\n\t\t\t\t\tdefault: null;\n\t\t\t\t}\n\t\t\tdefault: null;\n\t\t}\n\t\thaxe.macro.Context.addResource(name, sys.io.File.getBytes('assets/inject_swfs/$name.swf'));\n\t\treturn macro com.newgrounds.swivel.swf.SwfUtils._getAs2Tag($resourceName, $params);\n\t}\n\t\n\tmacro public static function getAs3Tag(resourceName, ?i) {\n\t\tvar name = switch(resourceName.expr) {\n\t\t\tcase EConst(c):\n\t\t\t\tswitch(c) {\n\t\t\t\t\tcase CString(s): s;\n\t\t\t\t\tdefault: null;\n\t\t\t\t}\n\t\t\tdefault: null;\n\t\t}\n\t\thaxe.macro.Context.addResource(name, sys.io.File.getBytes('assets/inject_swfs/$name.swf'));\n\t\treturn macro com.newgrounds.swivel.swf.SwfUtils._getAs3Tag($resourceName, $i);\n\t}\n\t\n\tmacro public static function getClip(resourceName, clipName) {\n\t\tvar name = switch(resourceName.expr) {\n\t\t\tcase EConst(c):\n\t\t\t\tswitch(c) {\n\t\t\t\t\tcase CString(s): s;\n\t\t\t\t\tdefault: null;\n\t\t\t\t}\n\t\t\tdefault: null;\n\t\t}\n\t\thaxe.macro.Context.addResource(name, sys.io.File.getBytes('assets/inject_swfs/$name.swf'));\n\t\treturn macro com.newgrounds.swivel.swf.SwfUtils._getClip($resourceName, $clipName);\n\t}\n\t\n\t#if !macro\n\tprivate static function getSwf(resourceName : String) : SWF {\n\t\tvar bytes = Resource.getBytes(resourceName);\n\t\tif(bytes == null) throw(\"Could not find resource \" + resourceName);\n\t\tvar i = new BytesInput(bytes);\n\t\tvar swf = new format.swf.Reader(i).read();\n\t\treturn swf;\n\t}\n\t\n\tpublic static function _getAs2Tag(resourceName, ?params : Null<Dynamic>) : SWFTag {\n\t\tvar swf = getSwf(resourceName);\n\t\tfor(tag in swf.tags) {\n\t\t\tswitch(tag) {\n\t\t\t\tcase TDoActions(data):\n\t\t\t\t\tif(params != null) {\n\t\t\t\t\t\tvar i = new BytesInput(data);\n\t\t\t\t\t\tvar as1 = new format.as1.Reader(i).read();\n\n\t\t\t\t\t\tfor(key in Reflect.fields(params)) {\n\t\t\t\t\t\t\tas1 = [\n\t\t\t\t\t\t\t\tAPush( [PString(\"_global\")] ),\n\t\t\t\t\t\t\t\tAEval,\n\t\t\t\t\t\t\t\tAPush( [PString(\"$\"+key), PFloat( Reflect.field(params, key) )] ),\n\t\t\t\t\t\t\t\tAObjSet,\n\t\t\t\t\t\t\t].concat(as1);\n\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\tvar o = new BytesOutput();\n\t\t\t\t\t\tnew format.as1.Writer(o).write(as1);\n\t\t\t\t\t\treturn TDoActions(o.getBytes());\n\t\t\t\t\t} else return tag;\n\t\t\t\t\t\n\t\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t\t\n\t\tthrow(\"AS2 Data not found in \" + resourceName);\n\t}\n\t\n\tpublic static function _getClip(resourceName : String, clipName : String) : SWFTag {\n\t\tvar swf = getSwf(resourceName);\n\t\tvar clips = new IntMap<SWFTag>();\n\t\t\n\t\tfor(tag in swf.tags) {\n\t\t\tswitch(tag) {\n\t\t\t\tcase TClip(id, frames, tags):\n\t\t\t\t\tclips.set(id, tag);\n\t\t\t\t\t\n\t\t\t\tcase TExport(links):\n\t\t\t\t\tfor(link in links)\n\t\t\t\t\t\tif(link.name == clipName)\n\t\t\t\t\t\t\treturn clips.get(link.cid);\n\t\t\t\t\t\t\t\n\t\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn null;\n\t}\n\t\n\tpublic static function _getAs3Tag(resourceName : String, ?i : Int = 0)  {\n\t\tvar swf = getSwf(resourceName);\n\t\tfor(tag in swf.tags) {\n\t\t\tswitch(tag) {\n\t\t\t\tcase TActionScript3(data, _):\n\t\t\t\t\tif(i > 0) {\n\t\t\t\t\t\ti--;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tvar reader = new format.abc.Reader(new BytesInput(data));\n\t\t\t\t\t\n\t\t\t\t\treturn {tag: tag, abc: reader.read()};\n\t\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t\t\n\t\tthrow(\"AS3 Data not found in \" + resourceName);\n\t\treturn null;\n\t}\n\t#end\n\t/*public function mutateAs3(tag : SWFTag, f : ABCData -> Void) : SWFTag {\n\t\tswitch(tag) {\n\t\t\tcase TActionScript3(data):\n\t\t\t\tvar abc = new format.abc.Reader( new BytesInput(data) ).read();\n\t\t\t\tf(abc);\n\t\t\t\tvar o = new BytesOutput();\n\t\t\t\tnew format.abc.Writer(o).write(abc);\n\t\t\t\treturn TActionScript3(o.getBytes());\n\t\t\t\n\t\tdefault:\n\t\t\tthrow(\"Not an AS3 tag\");\n\t\t}\n\t}*/\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/swf/SwivelAbcContext.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.swf;\nimport format.abc.Context;\n\n/*\nclass SwivelAbcContext extends Context {\n\tpublic static function fromData(d : ABCData) {\n\t\tvar context = new SwivelAbcContext();\n\t\tcontext.bytepos = new NullOutput();\n\t\tcontextopw = new OpWriter(bytepos);\n\t\thstrings = new Hash();\n\t\tdata = new ABCData();\n\t\tdata.ints = new Array();\n\t\tdata.uints = new Array();\n\t\tdata.floats = new Array();\n\t\tdata.strings = new Array();\n\t\tdata.namespaces = new Array();\n\t\tdata.nssets = new Array();\n\t\tdata.metadatas = new Array();\n\t\tdata.methodTypes = new Array();\n\t\tdata.names = new Array();\n\t\tdata.classes = new Array();\n\t\tdata.functions = new Array();\n\t\temptyString = string(\"\");\n\t\tnsPublic = namespace(NPublic(emptyString));\n\t\tarrayProp = name(NMultiLate(nsset([nsPublic])));\n\t\tbeginFunction([],null);\n\t\tops([OThis,OScope]);\n\t\tinit = curFunction;\n\t\tinit.f.maxStack = 2;\n\t\tinit.f.maxScope = 2;\n\t\tclasses = new Array();\n\t\tdata.inits = [{ method : init.f.type, fields : classes }];\n\t}\n\t\n\tpublic var replaceMode : ReplaceMode;\n\t\n\tpublic function new() {\n\t\treplaceMode = overwrite;\n\t\tsuper();\n\t}\n\t\n\tpublic function beginStatics() {\n\t\tif (curClass.statics != null) replaceFunction( data.get(data.functions, cast(curClass.statics))  );\n\t\telse {\n\t\t\tbeginFunction([], null);\n\t\t\tcurClass.statics = curFunction.f.type;\n\t\t}\n\t\treturn curFunction.f;\n\t}\n\t\n\toverride public function beginClass( path : String ) {\n\t\tendClass();\n\t\tvar tpath = this.type(path);\n\t\t\n\t\tfor (cl in data.classes) {\n\t\t\tif (Type.enumEq(tpath, cl.name)) {\n\t\t\t\tcurClass = cl;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (curClass != null) {\n\t\t\tfieldSlot = curClass.fields.length + curClass.staticFields.length + 1;\n\t\t} else {\n\t\t\tbeginFunction([],null);\n\t\t\tvar st = curFunction.f.type;\n\t\t\top(ORetVoid);\n\t\t\tendFunction();\n\t\t\tbeginFunction([],null);\n\t\t\tvar cst = curFunction.f.type;\n\t\t\tcurFunction.f.maxStack = 1;\n\t\t\top(OThis);\n\t\t\top(OConstructSuper(0));\n\t\t\top(ORetVoid);\n\t\t\tendFunction();\n\t\t\tfieldSlot = 1;\n\t\t\tcurClass = {\n\t\t\t\tname : tpath,\n\t\t\t\tsuperclass : this.type(\"Object\"),\n\t\t\t\tinterfaces : [],\n\t\t\t\tisSealed : false,\n\t\t\t\tisInterface : false,\n\t\t\t\tisFinal : false,\n\t\t\t\tnamespace : null,\n\t\t\t\tconstructor : cst,\n\t\t\t\tstatics : st,\n\t\t\t\tfields : [],\n\t\t\t\tstaticFields : [],\n\t\t\t};\n\t\t\tdata.classes.push(curClass);\n\t\t\tclasses.push({\n\t\t\t\tname: tpath,\n\t\t\t\tslot: 0,\n\t\t\t\tkind: FClass(Idx(data.classes.length - 1)),\n\t\t\t\tmetadatas: null,\n\t\t\t});\n\t\t}\n\t\t\n\t\tcurFunction = null;\n\t\treturn curClass;\n\t}\n\t\n\toverride public function endClass() {\n\t\tif( curClass == null )\n\t\t\treturn;\n\t\tendFunction();\n\t\tcurFunction = null;\n\t\tcurClass = null;\n\t}\n\t\n\tpublic override function finalize() {\n\t\tendClass();\n\n\t\treplaceMode = overwrite;\n\t\t\n\t\tif (init == null) beginFunction([], null);\n\t\telse replaceFunction( init.f );\n\t\t\n\t\tinit = curFunction;\n\t\tinit.f.maxStack = 2;\n\t\tinit.f.maxScope = 2;\n\t\t\n\t\tops([OThis, OScope]);\n\t\t\n\t\tfor (cl in data.classes) {\n\t\t\tops([\n\t\t\t\tOGetGlobalScope,\n\t\t\t\tOGetLex( curClass.superclass ),\n\t\t\t\tOScope,\n\t\t\t\tOGetLex( curClass.superclass ),\n\t\t\t\tOClassDef( Idx(data.classes.length - 1) ),\n\t\t\t\tOPopScope,\n\t\t\t\tOInitProp( curClass.name ),\n\t\t\t]);\n\t\t}\n\t\t\n\t\top(ORetVoid);\n\t\t\n\t\tendFunction();\n\t\tcurClass = null;\n\t}\n\t\n\toverride public function beginConstructor(args) {\n\t\tif (curClass.constructor != null)\n\t\t\treplaceFunction( data.get(data.functions, cast(curClass.constructor)) );\n\t\telse {\n\t\t\tbeginFunction(args, null);\n\t\t\tcurClass.constructor = curFunction.f.type;\n\t\t}\n\t\treturn curFunction.f;\n\t}\n\t\n\toverride public function beginMethod( mname : String, targs, tret, ?isStatic, ?isOverride, ?isFinal ) {\n\t\tvar fl = if ( isStatic ) curClass.staticFields else curClass.fields;\n\t\tfor (field in fl) {\n\t\t\tswitch( data.get(data.names, field.name) ) {\n\t\t\t\tcase NName(n, _):\n\t\t\t\t\tif (data.get(data.strings, n) == mname) {\n\t\t\t\t\t\tswitch(field.kind) {\n\t\t\t\t\t\t\tcase FMethod(type,_,_,_):\n\t\t\t\t\t\t\t\treplaceFunction( data.get(data.functions, cast(type)) );\n\t\t\t\t\t\t\t\treturn curFunction.f;\n\t\t\t\t\t\t\tdefault: throw(\"Unexpected field!\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\tdefault:\n\t\t\t\t\tthrow(\"Unexpected field name!\");\n\t\t\t}\n\t\t}\n\t\t\n\t\tvar m = beginFunction(targs,tret);\n\t\tfl.push({\n\t\t\tname : property(mname),\n\t\t\tslot : 0,\n\t\t\tkind : FMethod(curFunction.f.type,KNormal,isFinal,isOverride),\n\t\t\tmetadatas : null,\n\t\t});\n\t\treturn curFunction.f;\n\t}\n\n\tfunction replaceFunction(f) {\n\t\tendFunction();\n\t\tcurFunction = { f : f, ops : [] };\n\t\tregisters = new Array();\n\t\tfor( x in 0...f.nRegs )\n\t\t\tregisters.push(true);\n\t\treturn f;\n\t}\n\t\n\toverride function endFunction() {\n\t\tif( curFunction == null )\n\t\t\treturn;\n\t\tvar old = opw.o;\n\t\tvar bytes = new haxe.io.BytesOutput();\n\t\topw.o = bytes;\n\t\tfor( op in curFunction.ops )\n\t\t\topw.write(op);\n\t\tswitch(replaceMode) {\n\t\t\tcase overwrite:\n\t\t\t\tcurFunction.f.code = bytes.getBytes();\n\t\t\t\t\n\t\t\tcase prepend:\n\t\t\t\tif (curFunction.f.code != null) bytes.write(curFunction.f.code);\n\t\t\t\tcurFunction.f.code = bytes.getBytes();\n\t\t\t\t\n\t\t\tcase append:\n\t\t\t\tvar newBytes = new haxe.io.BytesOutput();\n\t\t\t\t\n\t\t\t\tif (curFunction.f.code != null) newBytes.write(curFunction.f.code);\n\t\t\t\tnewBytes.write(bytes.getBytes());\n\t\t\t\tcurFunction.f.code = newBytes.getBytes();\n\t\t}\n\t\topw.o = old;\n\t\tcurFunction = null;\n\t}\n}\n\nenum ReplaceMode {\n\toverwrite;\n\tprepend;\n\tappend;\n}*/"
  },
  {
    "path": "src/com/newgrounds/swivel/swf/SwivelConnection.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.swf;\nimport com.huey.events.Dispatcher;\nimport com.newgrounds.swivel.audio.AudioTracker;\nimport flash.net.LocalConnection;\nimport flash.net.SharedObject;\nimport haxe.Int32;\n\ninterface ISwivelConnection {\n\tpublic var client(get, set) : Dynamic;\n\tpublic function tick() : Void;\n\tpublic function close() : Void;\n }\n\nclass SwivelConnection implements ISwivelConnection\n{\n\tpublic static inline var CONNECTION_NAME : String = \"__swivel\";\n\t\n\tprivate var _inConnection : LocalConnection;\n\t\n\tpublic var client(get, set) : Dynamic;\n\tprivate function get_client() : Dynamic\t\t\t\t{ return _inConnection.client; }\n\tprivate function set_client(v : Dynamic) : Dynamic\t{ return _inConnection.client = v; }\n\n\tpublic function new() {\n\t\t_inConnection = new LocalConnection();\n\t\t// TODO: output better error msg here\n\t\t_inConnection.addEventListener(flash.events.AsyncErrorEvent.ASYNC_ERROR,\n\t\t\tfunction(e) {}\n\t\t);\n\t\t_inConnection.connect(CONNECTION_NAME);\n\t}\n\t\n\tpublic function tick() : Void {\n\t\t\n\t}\n\t\n\tpublic function close() : Void {\n\t\ttry { _inConnection.close(); }\n\t\tcatch(_ : Dynamic) { }\n\t}\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/swf/SwivelMutator.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.swf;\nimport format.abc.Context;\nimport format.abc.Data;\nimport format.swf.Data;\nimport format.as1.Data;\nimport haxe.Int32;\n\nusing com.newgrounds.swivel.swf.AbcUtils;\n\nclass SwivelMutator implements ISWFMutator\n{\n\t\n\tpublic function new(?startFrame : Int = 0) {\n\t\t_startFrame = startFrame;\n\t\t\n\t}\n\t\n\tpublic function mutate(swf : SwivelSwf) : Void {\n\t\tswf.compression = SCUncompressed;\n\n\t\t// Set our SWF version is at least version 6 so that our various AS will work\n\t\t// (maybe this could break some things, since AS2 is case-sensitive, but AS1 isn't?)\n\t\tif (swf.version < 6) swf.version = 6;\n\n\t\tif(Type.enumEq(swf.avmVersion, AVM1)) {\n\t\t\tswf.prepend(SwfUtils.getAs2Tag(\"AS2Basics\", {width: swf.width, height: swf.height, frameRate: swf.frameRate}));\n\t\t\t\n\t\t\tvar clip = SwfUtils.getClip(\"AS2Basics\", \"__FrameCounter\");\n\n\t\t\tvar clipDepth = 9999;\n\t\t\tswitch(clip) {\n\t\t\t\tcase TClip(_, frames, tags): clip = TClip(clipDepth, frames, tags);\n\t\t\t\tdefault: throw(\"Bad clip\");\n\t\t\t}\n\t\t\t\n\n\t\t\tswf.prepend(clip);\n\t\t\t\n\t\t\tvar po = new PlaceObject();\n\t\t\tpo.cid = clipDepth;\n\t\t\tswf.prepend( TPlaceObject2(po) );\n\t\t\tvar i=0;\n\t\t\t//swf.prepend(TDoActions( SwivelSwf.getAvm1Bytes([AGotoFrame(_startFrame), APlay])));\n\t\t\tvar f = 0;\n\t\t\twhile(i < swf.tags.length) {\n\t\t\t\tswitch(swf.tags[i]) {\n\t\t\t\t\tcase TUnknown(id, _):\n\t\t\t\t\t\t// get rid of debug tags... causing super weird problems in AS2 movies\n\t\t\t\t\t\tif(id == 63 || id == 64) {\n\t\t\t\t\t\t\tswf.tags.splice(i,1);\n\t\t\t\t\t\t\ti--;\n\t\t\t\t\t\t}\n\t\t\t\t\tcase TShowFrame:\n\t\t\t\t\t\tif(_startFrame == 0) break;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(f==0) {\n\t\t\t\t\t\t\tswf.tags.insert(i, TDoActions( SwivelSwf.getAvm1Bytes([AGotoFrame(_startFrame), APlay])) );\n\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t} else if(f==_startFrame) {\n\t\t\t\t\t\t\tswf.tags.insert(i, TDoActions( SwivelSwf.getAvm1Bytes([APlay])) );\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tf++;\n\t\t\t\t\tdefault:\n\t\t\t\t}\n\t\t\t\ti++;\n\t\t\t}\n\t\t} else {\n\t\t\tfor(i in 0...swf.tags.length) {\n\t\t\t\tvar tag = swf.tags[i];\n\t\t\t\tswitch(tag) {\n\t\t\t\t\tcase TActionScript3(data, c):\n\t\t\t\t\t\tvar abc = new format.abc.Reader(new haxe.io.BytesInput(data)).read();\n\t\t\t\t\t\t\n\t\t\t\t\t\tvar altered = false;\n\t\t\t\t\t\tfor(j in 0...abc.strings.length) {\n\t\t\t\t\t\t\tvar str = abc.strings[j];\n\t\t\t\t\t\t\tif(str == \"exactFit\" || str == \"noBorder\" || str == \"showAll\") {\n\t\t\t\t\t\t\t\tabc.strings[j] = \"noScale\";\n\t\t\t\t\t\t\t\taltered = true;\n\t\t\t\t\t\t\t} else if(str == \"EXACT_FIT\" || str == \"NO_BORDER\" || str == \"SHOW_ALL\") {\n\t\t\t\t\t\t\t\tabc.strings[j] = \"NO_SCALE\";\n\t\t\t\t\t\t\t\taltered = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(altered) {\n\t\t\t\t\t\t\tvar o = new haxe.io.BytesOutput();\n\t\t\t\t\t\t\tnew format.abc.Writer(o).write(abc);\n\t\t\t\t\t\t\tswf.tags[i] = TActionScript3(o.getBytes(), c);\n\t\t\t\t\t\t}\n\n\t\t\t\t\tdefault:\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t\tswf.prepend( SwfUtils.getAs3Tag(\"AS3Core\", 0).tag );\n\t\t\tswf.hoistClip(0, function(abcStuff) {\n\t\t\t\tvar abc = abcStuff.abc;\n\t\t\t\tvar cl = abcStuff.cl;\n\t\t\t\tvar ctor = abc.getFunction(cl.constructor);\n\t\t\t\tif(ctor.maxStack < 4) ctor.maxStack = 4;\n\t\t\t\tif(ctor.maxScope < 4) ctor.maxScope = 4;\n\n\t\t\t\t\n\t\t\t\t/*if(_startFrame != 0) {\n\t\t\t\t\tctor.appendOps([\n\t\t\t\t\t\tOThis,\n\t\t\t\t\t\tOInt(_startFrame),\n\t\t\t\t\t\tOCallPropVoid( abc.publicName(\"gotoAndPlay\"), 1),\n\t\t\t\t\t\tORetVoid,\n\t\t\t\t\t]);\n\t\t\t\t}*/\n\t\t\t\t\n\t\t\t\tctor.prependOps([\n\t\t\t\t\tOGetLex( abc.publicName(\"__Swivel\") ),\n\t\t\t\t\tOThis,\n\t\t\t\t\tOInt( _startFrame+1 ),\n\t\t\t\t\tOCallPropVoid( abc.publicName(\"registerDocument\"), 2)\n\t\t\t\t]);\n\n\t\t\t\tabc.quickMethod(cl, abc.publicName(\"stage\"), [\n\t\t\t\t\tOGetLex( abc.publicName(\"__Swivel\") ),\n\t\t\t\t\tOGetProp( abc.publicName(\"stage\") ),\n\t\t\t\t\tORet,\n\t\t\t\t], KGetter, null, abc.type(\"flash.display.Stage\"), true);\n\t\t\t});\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t}\n\n\tprivate var _startFrame : Int;\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/swf/SwivelSwf.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.swf;\n\nimport format.abc.Data;\nimport format.as1.Data;\nimport format.swf.Data;\nimport format.swf.Reader;\nimport format.swf.Writer;\nimport haxe.io.Bytes;\nimport haxe.io.BytesInput;\nimport haxe.io.BytesOutput;\n\nusing com.newgrounds.swivel.swf.AbcUtils;\n\ntypedef ABCStuff = {abc : ABCData, cl : ClassDef, tagIndex : Int, extra : AS3Context};\n\nclass SwivelSwf {\n\tpublic static function getAvm1Bytes( actions : AS1 ) : Bytes {\n\t\tvar o = new BytesOutput();\n\t\tvar writer = new format.as1.Writer(o);\n\t\twriter.write(actions);\n\t\treturn o.getBytes();\n\t}\n\n\tpublic var version(get_version, set_version) : Int;\n\tinline private function get_version()\t\t\t\t\t{ return _header.version; }\n\tinline private function set_version(v)\t\t\t\t\t{ return _header.version = v; }\n\t\n\tpublic var avmVersion(default, set_avmVersion) : AVM;\n\tprivate function set_avmVersion(v) {\n\t\tif(version < 8 || _fileAttributesIndex < 0) {\n\t\t\treturn avmVersion = v;\n\t\t}\n\t\t\n\t\tif(version < 9 && Type.enumEq(v, AVM2)) throw(\"AVM2 requires SWF version 9 or higher\");\n\t\t\n\t\t// MIKNEW\n\t\t_headerTags[_fileAttributesIndex] = switch(_headerTags[_fileAttributesIndex]) {\n\t\t\tcase TSandBox(useDirectBlit, useGpu, hasMeta, useAs3, useNetwork):\n\t\t\t\tTSandBox(useDirectBlit, useGpu, hasMeta, v == AVM2, useNetwork);\n\t\t\tdefault: throw(\"Unexpected tag\");\n\t\t}\n\t\t\n\t\treturn avmVersion = v;\n\t}\n\t\n\tpublic var abcData(default, null) : ABCData;\n\n\tpublic var compression(get, set) : SWFCompression;\n\tinline private function get_compression()\t\t\t\t{ return _header.compression; }\n\tinline private function set_compression(v)\t\t\t\t{ return _header.compression = v; }\n\t\n\tpublic var width(get, set) : Int;\n\tinline private function get_width()\t\t\t\t\t\t{ return _header.width; }\n\tinline private function set_width(v)\t \t\t\t\t{ return _header.width = v; }\n\t\n\tpublic var height(get, set) : Int;\n\tinline private function get_height()\t\t\t\t\t{ return _header.height; }\n\tinline private function set_height(v)\t\t\t\t\t{ return _header.height = v; }\n\t\n\tpublic var frameRate(get, set) : Float;\n\tinline private function get_frameRate()\t\t\t\t\t{ return _header.fps / 256.0; }\n\tinline private function set_frameRate(v : Float)\t\t\t\t{ _header.fps = Std.int(v * 256.0); return v;  }\n\t\n\t@:isVar public var backgroundColor(get, set) : Int;\n\tinline private function get_backgroundColor()\t\t\t{ return backgroundColor; }\n\tinline private function set_backgroundColor(v)\t\t\t{ return backgroundColor = v; }\n\t\n\t@bindable public var numFrames(default, set) : Int;\n\tinline private function set_numFrames(v)\t\t\t\t{ return numFrames = _header.nframes = v; }\n\t\n\tprivate var _header : SWFHeader;\n\tprivate var _data: Bytes;\n\tprivate var _headerTags : Array<SWFTag>;\n\tpublic var tags : Array<SWFTag>;\n\tprivate var _parsed : Bool = false;\n\n\tprivate var _startIndex : Int;\t// index after SetBackground tag\n\tprivate var _fileAttributesIndex :  Int = -1;\n\n\tpublic function new(data : Bytes) {\n\t\tvar partialSwf = new SwivelSwfReader( new BytesInput(data) ).readPartial();\n\t\t_header = partialSwf.header;\n\t\tnumFrames = _header.nframes;\n\t\t_headerTags = partialSwf.tags;\n\t\ttags = [];\n\t\t_data = partialSwf.data;\n\n\t\tavmVersion = AVM1;\n\t\tvar i = 0;\n\t\tfor (t in _headerTags) {\n\t\t\tswitch(t) {\n\t\t\t\tcase TSandBox(_, _, _, useAs3, _): // MIKENEW\n\t\t\t\t\t_fileAttributesIndex = i;\n\t\t\t\t\tavmVersion = if(useAs3) AVM2 else AVM1;\n\n\t\t\t\tcase TBackgroundColor(color):\n\t\t\t\t\tbackgroundColor = color;\n\t\t\t\t\t\n\t\t\t\tdefault:\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\t_startIndex = 0;\n\t}\n\t\n\tpublic function parseSwf() {\n\t\tvar reader = new SwivelSwfReader( new BytesInput(_data) );\n\t\tuntyped reader.version = _header.version;\n\t\tvar newTags = reader.readTagList();\n\t\t_startIndex = _headerTags.length;\n\t\ttags = _headerTags.concat(newTags);\n\t\t_parsed = true;\n\t}\n\t\n\tprivate var _clipNum : Int = 0;\n\t\n\tpublic function hoistClip(clipId : Int, f : ABCStuff -> Void) {\n\t\tvar clipIndex = 0;\n\t\tvar i = 0;\n\t\tfor(tag in tags) {\n\t\t\tswitch(tag) {\n\t\t\t\tcase TSymbolClass(links):\n\t\t\t\t\tfor(link in links) {\n\t\t\t\t\t\tif(link.cid == clipId) {\n\t\t\t\t\t\t\tvar clipStuff = getAbcWithClass(link.className);\n\t\t\t\t\t\t\tvar clipAbc = clipStuff.abc;\n\t\t\t\t\t\t\tf(clipStuff);\n\n\t\t\t\t\t\t\tvar o = new BytesOutput();\n\t\t\t\t\t\t\tnew format.abc.Writer(o).write(clipAbc);\n\t\t\t\t\t\t\ttags[clipStuff.tagIndex] = TActionScript3(o.getBytes(), clipStuff.extra);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\tcase TClip(id,_,_):\n\t\t\t\t\tif(clipId == id)\n\t\t\t\t\t\tclipIndex = i+1;\n\t\t\t\t\t\n\t\t\t\tdefault:\n\t\t\t}\n\t\t\t\n\t\t\ti++;\n\t\t}\n\t\t\n\t\tvar ctx = new format.abc.Context();\n\t\tvar className = '__SwivelClip$_clipNum';\n\t\tvar cl = ctx.beginClass(className);\n\t\tcl.isSealed = false;\n\t\tcl.superclass = ctx.type(\"flash.display.MovieClip\");\n\t\t_clipNum++;\n\t\tctx.endClass();\n\t\tctx.finalize();\n\t\t\n\t\tvar abc = ctx.getData();\n\t\tf({abc:ctx.getData(), cl:abc.classes[0], tagIndex:0, extra:null});\n\t\t\n\t\tvar o = new BytesOutput();\n\t\tnew format.abc.Writer(o).write(abc);\n\t\tvar tag = TActionScript3(o.getBytes(), null);\n\t\t\n\t\t// insert new AS3 tag in proper location\n\t\t//prepend(tag);\n\t\tif(clipId == 0) {\n\t\t\tclipIndex = _startIndex;\n\t\t\t_startIndex+=2;\n\t\t} else if(clipIndex == 0) return;\n\t\t\n\t\t//tags.insert(clipIndex, TSymbolClass([ {cid: clipId, className: className} ]));\n\t\ttags.insert(clipIndex, tag);\n\t\ttags.insert(clipIndex+1, TSymbolClass([ {cid: clipId, className: className} ]));\n\t}\n\t\n\t/*public function hoistClip2(clipId : Int, f : ABCStuff -> Void) {\n\t\tvar newClassName = '__SwivelClip$_clipNum';\n\t\t_clipNum++;\n\t\t\n\t\tvar ctx = new format.abc.Context();\n\t\tvar cl = ctx.beginClass(className);\n\t\tcl.isSealed = false;\n\t\tcl.superclass = ctx.type(\"flash.display.MovieClip\");\n\t\tctx.endClass();\n\t\tctx.finalize();\n\t\tvar abc = ctx.getData();\n\t\t\n\t\tf({abc:ctx.getData(), cl:abc.classes[0], tagIndex:0, extra:null});\n\n\t\tvar clipIndex = 0;\n\t\tvar i = 0;\n\t\tfor(tag in tags) {\n\t\t\tswitch(tag) {\n\t\t\t\tcase TSymbolClass(links):\n\t\t\t\t\tfor(link in links) {\n\t\t\t\t\t\tif(link.cid == clipId) {\n\t\t\t\t\t\t\tvar clipStuff = getAbcWithClass(link.className);\n\t\t\t\t\t\t\tvar clipAbc = clipStuff.abc;\n\t\t\t\t\t\t\tcl.superclass = ctx.type(clipStuff.cl.name);\n\t\t\t\t\t\t\tclipStuff.cl.name = clipAbc.publicName(newClassName);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tf(clipStuff);\n\n\t\t\t\t\t\t\tvar o = new BytesOutput();\n\t\t\t\t\t\t\tnew format.abc.Writer(o).write(clipAbc);\n\t\t\t\t\t\t\ttags[clipStuff.tagIndex] = TActionScript3(o.getBytes(), clipStuff.extra);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\tcase TClip(id,_,_):\n\t\t\t\t\tif(clipId == id)\n\t\t\t\t\t\tclipIndex = i+1;\n\t\t\t\t\t\n\t\t\t\tdefault:\n\t\t\t}\n\t\t\t\n\t\t\ti++;\n\t\t}\n\t\t\n\t\tvar o = new BytesOutput();\n\t\tnew format.abc.Writer(o).write(abc);\n\t\tvar tag = TActionScript3(o.getBytes(), null);\n\t\t\n\t\t// insert new AS3 tag in proper location\n\t\t//prepend(tag);\n\t\tif(clipId == 0) {\n\t\t\tclipIndex = _startIndex;\n\t\t\t_startIndex+=2;\n\t\t} else if(clipIndex == 0) return;\n\t\t\n\t\t//tags.insert(clipIndex, TSymbolClass([ {cid: clipId, className: className} ]));\n\t\ttags.insert(clipIndex, tag);\n\t\ttags.insert(clipIndex+1, TSymbolClass([ {cid: clipId, className: className} ]));\n\t}*/\n\t\n\tprivate function getAbcWithClass(className : String) : ABCStuff {\n\t\tvar i = 0;\n\t\tfor(tag in tags) {\n\t\t\tswitch(tag) {\n\t\t\t\tcase TActionScript3(data, extra):\n\t\t\t\t\tvar abc = new format.abc.Reader(new BytesInput(data)).read();\n\t\t\t\t\tfor(cl in abc.classes) {\n\t\t\t\t\t\tif(abc.getNamePath(cl.name) == className) {\n\t\t\t\t\t\t\treturn {abc: abc, cl: cl, tagIndex: i, extra: extra};\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\n\t\t\t\tdefault:\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\treturn null;\n\t}\n\t\n\tpublic function prepend(tag : SWFTag) : Void {\n\t\ttags.insert(_startIndex++, tag);\n\t}\n\t\n\tpublic function mapTags(f : SWFTag -> SWFTag) : Void {\n\t\ttags = _mapTags(f, tags);\n\t}\n\t\n\tprivate function _mapTags(f : SWFTag -> SWFTag, tags : Array<SWFTag>) : Array<SWFTag> {\n\t\tvar newTags = new Array();\n\t\tfor (tag in tags) {\n\t\t\tswitch(tag) {\n\t\t\t\tcase TClip(id, frames, tags):\n\t\t\t\t\tvar t = f(tag);\n\t\t\t\t\tif (t != null) {\n\t\t\t\t\t\tif (Type.enumEq(t, tag)) newTags.push( TClip(id, frames, _mapTags(f, tags)) );\n\t\t\t\t\t\telse newTags.push(t);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\tdefault:\n\t\t\t\t\tvar t = f(tag);\n\t\t\t\t\tif (t != null) newTags.push(t);\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn newTags;\n\t}\n\t\n\tpublic function mapClips(f : Int -> Array<SWFTag> -> Array<SWFTag>) : Void {\n\t\tf(0, tags);\n\t\t\n\t\tfor (tag in tags) {\n\t\t\tswitch(tag) {\n\t\t\t\tcase TClip(id, _, tags):\n\t\t\t\t\tf(id, tags);\n\t\t\t\t\t\n\t\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t}\n\t\n\tpublic function getBytes() : Bytes {\n\t\tvar o = new haxe.io.BytesOutput();\n\t\tvar writer = new Writer( o );\n\t\tif(_parsed) writer.write( {header: _header, tags: tags} );\n\t\telse {\n\t\t\twriter.writeHeader(_header);\n\t\t\tfor(t in _headerTags)\n\t\t\t\twriter.writeTag(t);\n\t\t\tfor(t in tags)\n\t\t\t\twriter.writeTag(t);\n\t\t\tuntyped writer.o.write(_data);\n\t\t\twriter.writeEnd();\n\t\t}\n\t\treturn o.getBytes();\n\t}\n\t\n\tpublic function disposeTags() {\n\t\t_parsed = false;\n\t\ttags = [];\n\t\t_startIndex = 0;\n\t}\n\t\n\tpublic function clone() : SwivelSwf {\n\t\tvar swf = Type.createEmptyInstance(SwivelSwf);\n\t\tswf.tags = [];\n\t\tswf._headerTags = _headerTags.copy();\n\t\tswf._header = {\n\t\t\tversion:\t_header.version,\n\t\t\tcompression:\t_header.compression,\n\t\t\twidth:\t\t_header.width,\n\t\t\theight:\t\t_header.height,\n\t\t\tfps:\t\t_header.fps,\n\t\t\tnframes:\t_header.nframes,\n\t\t}\n\t\tswf.backgroundColor = backgroundColor;\n\t\tswf._data = _data;\n\t\tswf._parsed = false;\n\t\tswf._startIndex = _startIndex;\n\t\tswf._fileAttributesIndex = _fileAttributesIndex;\n\t\t\n\t\treturn swf;\n\t}\n}\n\nenum AVM\n{\n\tAVM1;\n\tAVM2;\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/swf/SwivelSwfReader.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.swf;\nimport format.swf.Constants;\nimport format.swf.Data;\nimport format.swf.Reader;\nimport haxe.io.BytesInput;\n\nclass SwivelSwfReader extends format.swf.Reader {\n\n\tpublic function new(i : BytesInput) {\n\t\tbits = new format.tools.BitsInput(i);\n\t\tsuper(i);\n\t}\n\t\t\n\tpublic function readPartial() {\n\t\tvar header = readHeader();\n\t\tvar tags = new Array();\n\t\twhile(true) {\n\t\t\tvar tag = readTag();\n\t\t\ttags.push(tag);\n\t\t\tswitch(tag) {\n\t\t\tcase TSandBox(_):\n\t\t\tcase TBackgroundColor(_): break;\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\n\t\treturn {header: header, tags: tags, data: i.readAll() };\n\t}\n\n\t// TODO: repeated from SWFReader, to not throw on some incorrect-ish SWF files\n\t// Is there a way we can avoid repeating this?\n\t/* MIKE TODO 2017: Reintegrate the below, or just change it directly in our format fork.\n\toverride public function readHeader() : SWFHeader {\n\t\tvar tag = i.readString(3);\n\t\tvar compression;\n\t\tif( tag == \"ZWS\" )\n\t\t\tcompression = SCLZMA;\n\t\telse if( tag == \"CWS\" )\n\t\t\tcompression = SCDeflate;\n\t\telse if( tag == \"FWS\" )\n\t\t\tcompression = SCUncompressed;\n\t\telse\n\t\t\tthrow error();\n\t\tversion = i.readByte();\n\t\tvar size = readInt();\n\t\t\n\t\tswitch( compression ) {\n\t\tcase SCLZMA:\n\t\t\tthrow \"LZMA is unsupported\";\n\t\t\n\t\tcase SCDeflate:\n\t\t\tvar bytes = format.tools.Inflate.run(i.readAll());\n\t\t\tif( bytes.length + 8 != size ) trace(\"Compressed data length is incorrect\");\n\t\t\ti = new haxe.io.BytesInput(bytes);\n\t\t\t\n\t\tcase SCUncompressed:\n\t\t}\n\t\t\n\t\tbits = new format.tools.BitsInput(i);\n\t\tvar r = readRect();\n\t\tif( r.left != 0 || r.top != 0 )\n\t\t\tthrow error();\n\t\tvar fps = readFixed8();\n\t\tvar nframes = i.readUInt16();\n\t\treturn {\n\t\t\tversion : version,\n\t\t\tcompression : compression,\n\t\t\twidth : Std.int(r.right/20),\n\t\t\theight : Std.int(r.bottom/20),\n\t\t\tfps : fps,\n\t\t\tnframes : nframes,\n\t\t};\n\t}\n\t\n\toverride private function readTagData(id,len) : SWFTag {\n\t\tvar startPos = untyped i.b.position;\n\n\t\tvar tag = super.readTagData(id, len);\n\n\t\t// Assert here\n\t\tvar endPos = untyped i.b.position;\n\t\tif(len != endPos - startPos) {\n\t\t\t#if debug\n\t\t\ttrace(\"Bad tag!\");\n\t\t\t#end\n\t\t\tuntyped i.b.position = startPos + len;\n\t\t}\n\t\t\n\t\treturn tag;\n\t}\n\t*/\n}"
  },
  {
    "path": "src/com/newgrounds/swivel/swf/Watermark.hx",
    "content": "/*\n * Swivel\n * Copyright (C) 2012-2017, Newgrounds.com, Inc.\n * https://github.com/Herschel/Swivel\n *\n * Swivel is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * \n * Swivel is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with Swivel.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage com.newgrounds.swivel.swf;\n\ntypedef Watermark = {\n\tvar image : flash.display.BitmapData;\n\tvar align : WatermarkAlign;\n\tvar alpha : Float;\n\tvar scale : Float;\n}\n\nenum WatermarkAlign {\n\ttopLeft;\n\ttopCenter;\n\ttopRight;\n\tmiddleLeft;\n\tcenter;\n\tmiddleRight;\n\tbottomLeft;\n\tbottomCenter;\n\tbottomRight;\n}"
  },
  {
    "path": "win-installer.nsi",
    "content": ";NSIS Modern User Interface\n;Welcome/Finish Page Example Script\n;Written by Joost Verburg\n\n;--------------------------------\n;Include Modern UI\n\n  !include \"MUI2.nsh\"\n\n;--------------------------------\n;General\n\n  ;Name and file\n  Name \"Swivel\"\n  OutFile \"swivel-win32.exe\"\n\n  ;Default installation folder\n  InstallDir \"$PROGRAMFILES\\Swivel\"\n\n  ;Get installation folder from registry if available\n  InstallDirRegKey HKCU \"Software\\Swivel\" \"\"\n\n  ;Request application privileges for Windows Vista\n  RequestExecutionLevel admin\n\n  SetCompressor /SOLID /FINAL lzma\n\n;--------------------------------\n;Variables\n\n  Var StartMenuFolder\n\nFunction createDestkopIcon\n  CreateShortcut \"$DESKTOP\\Swivel.lnk\" \"$INSTDIR\\Swivel.exe\"\nFunctionEnd\n\n;--------------------------------\n;Interface Settings\n\n  !define MUI_HEADERIMAGE\n  !define MUI_HEADERIMAGE_BITMAP \"assets\\WinInstallerHeader.bmp\"\n  !define MUI_ABORTWARNING\n\n;--------------------------------\n;Pages\n\n  !insertmacro MUI_PAGE_WELCOME\n  !insertmacro MUI_PAGE_LICENSE \"LICENSE.md\"\n  !insertmacro MUI_PAGE_COMPONENTS\n  !insertmacro MUI_PAGE_DIRECTORY\n  !define MUI_STARTMENUPAGE_REGISTRY_ROOT \"HKCU\"\n  !define MUI_STARTMENUPAGE_REGISTRY_KEY \"Software\\Swivel\"\n  !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME \"Start Menu Folder\"\n  !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder\n  !insertmacro MUI_PAGE_INSTFILES\n  !define MUI_FINISHPAGE_RUN \"$INSTDIR\\Swivel.exe\"\n  !define MUI_FINISHPAGE_SHOWREADME \"\"\n  !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED\n  !define MUI_FINISHPAGE_SHOWREADME_TEXT \"Create Desktop Shortcut\"\n  !define MUI_FINISHPAGE_SHOWREADME_FUNCTION createDestkopIcon\n  !insertmacro MUI_PAGE_FINISH\n\n  !insertmacro MUI_UNPAGE_WELCOME\n  !insertmacro MUI_UNPAGE_CONFIRM\n  !insertmacro MUI_UNPAGE_INSTFILES\n  !insertmacro MUI_UNPAGE_FINISH\n\n;--------------------------------\n;Languages\n\n  !insertmacro MUI_LANGUAGE \"English\"\n\n;--------------------------------\n;Installer Sections\n\nSection \"Swivel\" SecSwivel\n\n  SetOutPath \"$INSTDIR\"\n\n  File /r bin\\Swivel\\*\n\n  ;Store installation folder\n  WriteRegStr HKCU \"Software\\Swivel\" \"\" $INSTDIR\n\n  ;Create uninstaller\n  WriteUninstaller \"$INSTDIR\\Uninstall.exe\"\n\n  !insertmacro MUI_STARTMENU_WRITE_BEGIN Application\n  SetShellVarContext all\n  ;Create shortcuts\n  CreateDirectory \"$SMPROGRAMS\\$StartMenuFolder\"\n  CreateShortCut \"$SMPROGRAMS\\$StartMenuFolder\\Swivel.lnk\" \"$INSTDIR\\Swivel.exe\"\n  CreateShortCut \"$SMPROGRAMS\\$StartMenuFolder\\Uninstall.lnk\" \"$INSTDIR\\Uninstall.exe\"\n\t\t\t\t\n  !insertmacro MUI_STARTMENU_WRITE_END\n\n  ;Add/Remove Programs\n  WriteRegStr HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Swivel\" \\\n                 \"DisplayName\" \"Swivel\"\n  WriteRegStr HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Swivel\" \\\n                 \"UninstallString\" \"$\\\"$INSTDIR\\uninstall.exe$\\\"\"\n  WriteRegStr HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Swivel\" \\\n                 \"QuietUninstallString\" \"$\\\"$INSTDIR\\uninstall.exe$\\\" /S\"\n  WriteRegStr HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Swivel\" \\\n                 \"DisplayIcon\" \"$\\\"$INSTDIR\\Swivel.exe$\\\"\"\n  WriteRegStr HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Swivel\" \\\n                 \"Publisher\" \"Newgrounds.com, Inc.\"\n  WriteRegStr HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Swivel\" \\\n                 \"HelpLink\" \"http://www.newgrounds.com\"\n  WriteRegStr HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Swivel\" \\\n                 \"DisplayVersion\" \"1.11\"\n  WriteRegStr HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Swivel\" \\\n                 \"VersionMajor\" \"1\"\n  WriteRegStr HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Swivel\" \\\n                 \"VersionMinor\" \"11\"\n  WriteRegStr HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Swivel\" \\\n                 \"NoModify\" \"1\"\n  WriteRegStr HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Swivel\" \\\n                 \"NoRepair\" \"1\"\n  WriteRegStr HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Swivel\" \\\n                 \"EstimatedSize\" \"61440\"\n  WriteRegStr HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Swivel\" \\\n                 \"Comments\" \"SWF to video convertor\"\nSectionEnd\n\n;--------------------------------\n;Descriptions\n\n  ;Language strings\n  LangString DESC_SecSwivel ${LANG_ENGLISH} \"Swivel\"\n\n  ;Assign language strings to sections\n  !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN\n    !insertmacro MUI_DESCRIPTION_TEXT ${SecSwivel} $(DESC_SecSwivel)\n  !insertmacro MUI_FUNCTION_DESCRIPTION_END\n\n;--------------------------------\n;Uninstaller Section\n\nSection \"Uninstall\"\n\n  ;ADD YOUR OWN FILES HERE...\n\n  Delete \"$INSTDIR\\Uninstall.exe\"\n\n  RMDir /r \"$INSTDIR\"\n\n  !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder\n  SetShellVarContext all\n  Delete \"$SMPROGRAMS\\$StartMenuFolder\\Uninstall.lnk\"\n  Delete \"$SMPROGRAMS\\$StartMenuFolder\\Swivel.lnk\"\n  RMDir /r \"$SMPROGRAMS\\$StartMenuFolder\"\n\n  DeleteRegKey /ifempty HKCU \"Software\\Swivel\"\n  DeleteRegKey  HKLM \"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Swivel\"\n\nSectionEnd"
  }
]