Index: /extensions/piwigo_videojs/CHANGELOG
===================================================================
--- /extensions/piwigo_videojs/CHANGELOG	(revision 24676)
+++ /extensions/piwigo_videojs/CHANGELOG	(revision 24676)
@@ -0,0 +1,54 @@
+Changes from v1.0.1 to v1.0.1
+- Improve Batch Manager
+- Improve install/active method
+- Update Videojs player to version 4.1.0
+
+Changes from v0.9 to v1.0.0
+- Add new options
+- Improve Thumbnail creation
+- Update Videojs player to version 4.0.4
+
+Changes from v0.8 to v0.9
+- Add support for batch manager
+- Improve Thumbnail creation
+
+Changes from v0.7 to v0.8
+- Add video metadata synchronization
+- Add video thumbnail creation
+- Update getid3 library to version 1.9.5-20130220
+- Improve documentaion
+
+Changes from v0.6 to v0.7
+- Improve options handling
+- Improve translation
+
+Changes from v0.5 to v0.6
+- Update: Videojs player to version 4.0.3
+- Export documentation to github wiki
+
+Changes from v0.4 to v0.5
+- Update: Videojs player to version 4.0.2
+- Removed: Tube skin (Not complatible with new version)
+- Added: 'darkfunk' and 'redsheen' skin
+- Added: Admin panel option for Customized CSS
+
+Changes from v0.3 to v0.4
+- Improve poster detection
+- Update language files
+- Fixed: undefined variable on upgrade
+
+Changes from v0.2 to v0.3
+- Removed: Windows CLR
+- Changed: Tabulation layout in all files
+- Improve: poster handling
+- Add: mimetype support
+- Add: Admin panel option for MAX_WIDTH and HTML5 video tags (Controls, Autoplay, Loop, preload)
+- Add: translation support
+
+Changes from v0.1 to v0.2
+- Fixed: Packaging
+
+Initial Release v0.1
+- Initial release
+- Initial documentation
+
Index: /extensions/piwigo_videojs/LICENSE
===================================================================
--- /extensions/piwigo_videojs/LICENSE	(revision 24676)
+++ /extensions/piwigo_videojs/LICENSE	(revision 24676)
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Index: /extensions/piwigo_videojs/README.md
===================================================================
--- /extensions/piwigo_videojs/README.md	(revision 24676)
+++ /extensions/piwigo_videojs/README.md	(revision 24676)
@@ -0,0 +1,65 @@
+piwigo-videojs
+==============
+
+Extend Piwigo with video support. [Videojs](http://videojs.com/) port for piwigo. Play your videos in the HTML5 video tag on your web gallery!
+
+Piwigo-videojs is a [plugin](http://piwigo.org/ext/extension_view.php?eid=610) for the [Piwigo](http://piwigo.org/) web gallery that allows you to render various video files within your piwigo install.
+
+Installation
+------------
+
+Upload this in ``your-gallery/plugins/`` dir.
+
+* download the archive from github
+
+        wget -O piwigo-videojs.zip https://github.com/xbgmsharp/piwigo-videojs/archive/master.zip
+
+        unzip piwigo-videojs.zip
+
+* or clone the project 
+
+        git clone git://github.com/xbgmsharp/piwigo-videojs.git
+
+Then, go to the admin site, in the plugin section and activate it.
+
+Supported formats
+-----------------
+
+### Videos ###
+
+* webm,webmv
+* ogg,ogv
+* mp4,m4v
+
+Usage
+-----
+
+Basically, medias will be inserted in a same way as standard pictures.
+
+Please refer to the [wiki](https://github.com/xbgmsharp/piwigo-videojs/wiki) for additional information.
+
+Support
+-----
+
+To get support, please create new [issue](https://github.com/xbgmsharp/piwigo-videojs/issues)
+
+Help me improve the plugin, rate my [plugin](http://piwigo.org/ext/extension_view.php?eid=610), and if possible please send a greeting message to me ;)
+
+Credit
+------
+
+* [videojs](http://videojs.com/)
+* [getid3](http://getid3.sourceforge.net/)
+* [piwigo-jplayer](https://github.com/d-matt/piwigo-jplayer)
+
+Licence
+-------
+The piwigo-videojs plugin for Piwigo is free software:  you can redistribute it
+and/or  modify  it under  the  terms  of the  GNU  General  Public License  as
+published by the Free Software Foundation.
+
+This program  is distributed in the hope  that it will be  useful, but WITHOUT
+ANY WARRANTY; without even the  implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+See <http://www.gnu.org/licenses/gpl.html>.
Index: /extensions/piwigo_videojs/admin/admin.php
===================================================================
--- /extensions/piwigo_videojs/admin/admin.php	(revision 24676)
+++ /extensions/piwigo_videojs/admin/admin.php	(revision 24676)
@@ -0,0 +1,66 @@
+<?php
+/***********************************************
+* File      :   admin.php
+* Project   :   piwigo-videojs
+* Descr     :   Generate the admin panel
+*
+* Created   :   24.06.2012
+*
+* Copyright 2012-2013 <xbgmsharp@gmail.com>
+*
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+************************************************/
+
+// Check whether we are indeed included by Piwigo.
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+// Check access and exit when user status is not ok
+check_status(ACCESS_ADMINISTRATOR);
+
+// Setup plugin Language
+load_language('plugin.lang', VIDEOJS_PATH);
+
+// Fetch the template.
+global $template, $conf, $lang;
+
+include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
+
+// Add the template to the global template
+$template->set_filename('plugin_admin_content', dirname(__FILE__).'/admin.tpl');
+
+if (!isset($_GET['tab']))
+  $page['tab'] = 'config';
+else
+  $page['tab'] = $_GET['tab'];
+
+$my_base_url = get_admin_plugin_menu_link(__FILE__);
+
+$tabsheet = new tabsheet();
+$tabsheet->add( 'config', l10n('Configuration'), add_url_params( $my_base_url, array('tab'=>'config') ) );
+$tabsheet->add( 'sync', l10n('Synchronize'), add_url_params( $my_base_url, array('tab'=>'sync') ) );
+//$tabsheet->add( 'tech', l10n('Add video'), add_url_params( $my_base_url, array('tab'=>'tech') ) );
+$tabsheet->select($page['tab']);
+
+$tabsheet->assign();
+
+$my_base_url = $tabsheet->sheets[ $page['tab'] ]['url'];
+$template->set_filename( 'tab_data', dirname(__FILE__).'/admin_'.$page['tab'].'.tpl' );
+include_once( dirname(__FILE__).'/admin_'.$page['tab'].'.php');
+$template->assign_var_from_handle( 'TAB_DATA', 'tab_data');
+// Assign the template contents to ADMIN_CONTENT
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+
+?>
Index: /extensions/piwigo_videojs/admin/admin.tpl
===================================================================
--- /extensions/piwigo_videojs/admin/admin.tpl	(revision 24676)
+++ /extensions/piwigo_videojs/admin/admin.tpl	(revision 24676)
@@ -0,0 +1,5 @@
+<div class="titrePage">
+  <h2>VideoJS plugin {$TABSHEET_TITLE}</h2>
+</div>
+
+{$TAB_DATA}
Index: /extensions/piwigo_videojs/admin/admin_batchmanager.php
===================================================================
--- /extensions/piwigo_videojs/admin/admin_batchmanager.php	(revision 24676)
+++ /extensions/piwigo_videojs/admin/admin_batchmanager.php	(revision 24676)
@@ -0,0 +1,201 @@
+<?php
+/***********************************************
+* File      :   admin_batchmanager.php
+* Project   :   piwigo-videojs
+* Descr     :   handle batch manager
+*
+* Created   :   4.06.2013
+*
+* Copyright 2012-2013 <xbgmsharp@gmail.com>
+*
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+************************************************/
+
+// Check whether we are indeed included by Piwigo.
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+// Hook to add a new filter in the batch mode
+add_event_handler('get_batch_manager_prefilters', 'vjs_get_batch_manager_prefilters');
+function vjs_get_batch_manager_prefilters($prefilters)
+{
+	$prefilters[] = array('ID' => 'videojs0', 'NAME' => l10n('All videos'));
+	$prefilters[] = array('ID' => 'videojs1', 'NAME' => l10n('All videos with poster'));
+	$prefilters[] = array('ID' => 'videojs2', 'NAME' => l10n('All videos without poster'));
+	return $prefilters;
+}
+
+// Hook to perfom the filter in the batch mode
+add_event_handler('perform_batch_manager_prefilters', 'vjs_perform_batch_manager_prefilters', 50, 2);
+function vjs_perform_batch_manager_prefilters($filter_sets, $prefilter)
+{
+	if ($prefilter==="videojs0")
+		$filter = "";
+	else if ($prefilter==="videojs1")
+		$filter = "AND `representative_ext` IS NOT NULL";
+	else if ($prefilter==="videojs2")
+		$filter = "AND `representative_ext` IS NULL";
+
+	if ( isset($filter) )
+	{
+		$query = "SELECT id FROM ".IMAGES_TABLE." WHERE ".SQL_VIDEOS." ".$filter;
+		$filter_sets[] = array_from_query($query, 'id');
+	}
+	return $filter_sets;
+}
+
+// Hook to show action when selected
+add_event_handler('loc_end_element_set_global', 'vjs_loc_end_element_set_global');
+function vjs_loc_end_element_set_global()
+{
+	global $template;
+	$template->append('element_set_global_plugins_actions',
+		array('ID' => 'videojs', 'NAME'=>l10n('Videos'), 'CONTENT' => '
+    <ul>
+      <li>
+	<label><input type="checkbox" name="vjs_metadata" value="1" checked="checked" /> filesize, width, height, latitude, longitude</label>
+	<br/><small>Will overwrite the information in the database with the metadata from the video.</small>
+	<br/><small><strong>Support of latitude, longitude required <a href="http://piwigo.org/ext/extension_view.php?eid=701" target="_blanck">\'OpenStreetMap\'</a> or \'RV Maps & Earth\' plugin.</strong></small>
+      </li>
+      <li>
+	<label><input type="checkbox" name="vjs_thumb" value="1" checked="checked" /> Create thumbnail at position in second:</label>
+	<!-- <input type="range" name="vjs_thumbsec" value="4" min="0" max="60" step="1"/> -->
+	<input type="text" name="vjs_thumbsec" value="4" size="2" required/>
+	<br/><small>Create a thumbnail from the video at specify position, it will overwrite any existing poster.</small>
+      </li>
+      <li>
+	<label><span class="property">Output format : </span></label>
+	<label><input type="radio" name="vjs_thumbouput" value="jpg" checked="checked"/> JPG</label>
+	<label><input type="radio" name="vjs_thumbouput" value="png" /> PNG</label>
+	<br/><small>Select the output format for the thumbnail</small>
+      </li>
+      <li>
+	<label><input type="checkbox" name="vjs_thumboverlay" value="1" > Add film effect</label>
+	<br/><small>Apply an overlay on the poster creation.</small>
+      </li>
+    </ul>
+'));
+}
+
+// Hook to perform the action on in global mode
+add_event_handler('element_set_global_action', 'vjs_element_set_global_action', 50, 2);
+function vjs_element_set_global_action($action, $collection)
+{
+	if ($action!=="videojs")
+		return;
+
+	global $page;
+
+	$query = "SELECT `id`, `file`, `path`
+			FROM ".IMAGES_TABLE."
+			WHERE id IN (".implode(',',$collection).")";
+
+	// Override default value from the form
+	$sync_options = array(
+		'metadata' 	=> isset($_POST['vjs_metadata']),
+		'thumb' 	=> isset($_POST['vjs_thumb']),
+		'thumbsec' 	=> $_POST['vjs_thumbsec'],
+		'thumbouput'    => $_POST['vjs_thumbouput'],
+		'thumboverlay'  => isset($_POST['vjs_thumboverlay']),
+		'simulate' 	=> false,
+		'sync_gps' 	=> true,
+	);
+
+	// Do the work, share with batch manager
+	require_once(dirname(__FILE__).'/../include/function_sync.php');
+
+	$page['errors'] = $errors;
+	$page['infos'] = $infos;
+}
+
+// Hook to perform the action on in single mode
+add_event_handler('loc_begin_element_set_unit', 'vjs_loc_begin_element_set_unit');
+function vjs_loc_begin_element_set_unit()
+{
+	global $page;
+	
+	if (!isset($_POST['submit']))
+	      return;
+
+	$collection = explode(',', $_POST['element_ids']);
+	foreach ($collection as $id)
+	{
+		if (!isset($_POST['vjs_thumbsec-'.$id]))
+			return;
+
+		// Override default value from the form
+		$sync_options = array(
+			'metadata'	=> isset($_POST['vjs_metadata-'.$id]),
+			'thumb'		=> isset($_POST['vjs_thumb-'.$id]),
+			'thumbsec'	=> $_POST['vjs_thumbsec-'.$id],
+			'thumbouput'    => $_POST['vjs_thumbouput-'.$id],
+			'thumboverlay'  => isset($_POST['vjs_thumboverlay-'.$id]),
+			'simulate'	=> false,
+			'sync_gps'	=> true,
+		);
+
+		$query = "SELECT `id`, `file`, `path`
+				FROM ".IMAGES_TABLE."
+				WHERE `id`='".$id."';";
+
+		// Do the work, share with batch manager
+		include(dirname(__FILE__).'/../include/function_sync.php');
+
+		$page['errors'] = array_merge($page['errors'], $errors);
+		$page['infos'] = array_merge($page['infos'], $infos);
+	}
+}
+
+// Hoook for batch manager in single mode
+add_event_handler('loc_end_element_set_unit', 'vjs_loc_end_element_set_unit');
+function vjs_loc_end_element_set_unit()
+{
+	global $template, $conf, $page, $is_category, $category_info;
+	$template->set_prefilter('batch_manager_unit', 'vjs_prefilter_batch_manager_unit');
+}
+
+function vjs_prefilter_batch_manager_unit($content)
+{
+	$needle = '</table>';
+	$pos = strpos($content, $needle);
+	if ($pos!==false)
+	{
+		$add = '<tr><td><strong>{\'VideoJS\'|@translate}</strong></td>
+		  <td>
+		    <label><input type="checkbox" name="vjs_metadata-{$element.id}" value="1" checked="checked" /> filesize, width, height, latitude, longitude</label>
+		    <br/><small>Will overwrite the information in the database with the metadata from the video.</small>
+		    <br/><small><strong>Support of latitude, longitude required <a href="http://piwigo.org/ext/extension_view.php?eid=701" target="_blanck">\'OpenStreetMap\'</a> or \'RV Maps & Earth\' plugin.</strong></small>
+		    <br/>
+		    <label><input type="checkbox" name="vjs_thumb-{$element.id}" value="1" checked="checked" /> Create thumbnail at position in second:</label>
+		    <!-- <input type="range" name="vjs_thumbsec" value="4" min="0" max="60" step="1"/> -->
+		    <input type="text" name="vjs_thumbsec-{$element.id}" value="4" size="2" required/>
+		    <br/><small>Create a thumbnail from the video at specify position, it will overwrite any existing poster.</small>
+		    <br/>
+		    <label><span class="property">Output format : </span></label>
+		    <label><input type="radio" name="vjs_thumbouput-{$element.id}" value="jpg" checked="checked"/> JPG</label>
+		    <label><input type="radio" name="vjs_thumbouput-{$element.id}" value="png" /> PNG</label>
+		    <br/><small>Select the output format for the thumbnail</small>
+		    <br/>
+		    <label><input type="checkbox" name="vjs_thumboverlay-{$element.id}" value="1" > Add film effect</label>
+		    <br/><small>Apply an overlay on the poster creation.</small>
+		    <br/>
+		  </td>
+		</tr>';
+		$content = substr_replace($content, $add, $pos, 0);
+	}
+	return $content;
+}
+
+?>
Index: /extensions/piwigo_videojs/admin/admin_boot.php
===================================================================
--- /extensions/piwigo_videojs/admin/admin_boot.php	(revision 24676)
+++ /extensions/piwigo_videojs/admin/admin_boot.php	(revision 24676)
@@ -0,0 +1,51 @@
+<?php
+/***********************************************
+* File      :   admin_boot.php
+* Project   :   piwigo-videojs
+* Descr     :   Generate the admin panel
+*
+* Created   :   6.06.2013
+*
+* Copyright 2012-2013 <xbgmsharp@gmail.com>
+*
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+************************************************/
+
+// Check whether we are indeed included by Piwigo.
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+// Define all videos with supported extensions
+define('SQL_VIDEOS', "(LOWER(`file`) LIKE '%.ogg' OR LOWER(`file`) LIKE '%.ogv' OR
+                LOWER(`file`) LIKE '%.mp4' OR LOWER(`file`) LIKE '%.m4v' OR
+                LOWER(`file`) LIKE '%.webm' OR LOWER(`file`) LIKE '%.webmv')");
+
+// Hook to add an admin config page
+add_event_handler('get_admin_plugin_menu_links', 'vjs_admin_menu');
+function vjs_admin_menu($menu)
+{
+	array_push($menu,
+		array(
+			'NAME' => 'VideoJS',
+			'URL'  => get_admin_plugin_menu_link(dirname(__FILE__).'/admin.php')
+		)
+	);
+	return $menu;
+}
+
+// Batch_manager support
+include_once(dirname(__FILE__).'/admin_batchmanager.php');
+
+?>
Index: /extensions/piwigo_videojs/admin/admin_config.php
===================================================================
--- /extensions/piwigo_videojs/admin/admin_config.php	(revision 24676)
+++ /extensions/piwigo_videojs/admin/admin_config.php	(revision 24676)
@@ -0,0 +1,100 @@
+<?php
+/***********************************************
+* File      :   admin_config.php
+* Project   :   piwigo-videojs
+* Descr     :   Generate the admin panel
+*
+* Created   :   24.06.2012
+*
+* Copyright 2012-2013 <xbgmsharp@gmail.com>
+*
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+************************************************/
+
+// Check whether we are indeed included by Piwigo.
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+// Load parameter
+$customcss = $conf['vjs_customcss'] ? $conf['vjs_customcss'] : '';
+
+// Available skins
+$available_skins = array(
+	'vjs-default-skin' => 'default',
+	'vjs-darkfunk-skin' => 'darkfunk',
+	'vjs-redsheen-skin' => 'redsheen',
+);
+
+// Available preload value
+$available_preload = array(
+	'auto' => 'Auto',
+	'none' => 'None',
+);
+
+// Available width value
+$available_width = array(
+	'480' => 'EDTV: (720x480) ie: 480p',
+	'720' => 'HDReady: (1280x720) ie: 720p',
+	'1080' => 'FullHD: (1920x1080) ie: 1080p',
+);
+
+// Update conf if submitted in admin site
+if (isset($_POST['submit']) && !empty($_POST['vjs_skin']))
+{
+	// keep the value in the admin form
+	$conf['vjs_conf'] = array(
+		'skin'          => $_POST['vjs_skin'],
+		'max_width'     => $_POST['vjs_max_width'],
+		'preload'       => $_POST['vjs_preload'],
+		'controls'      => get_boolean($_POST['vjs_controls']),
+		'autoplay'      => get_boolean($_POST['vjs_autoplay']),
+		'loop'          => get_boolean($_POST['vjs_loop']),
+	);
+	$customcss = $_POST['vjs_customcss'];
+
+	// Update config to DB
+	conf_update_param('vjs_conf', serialize($conf['vjs_conf']));
+	$query = "UPDATE ". CONFIG_TABLE ." SET value='". $_POST['vjs_customcss'] ."' WHERE param='vjs_customcss'";
+	pwg_query($query);
+
+	// the prefilter changes, we must delete compiled templatess
+	$template->delete_compiled_templates();
+
+	array_push($page['infos'], l10n('Your configuration settings are saved'));
+}
+
+/* Get statistics */
+// All videos with supported extensions by VideoJS
+$query = "SELECT COUNT(*) FROM ".IMAGES_TABLE." WHERE ".SQL_VIDEOS.";";
+list($nb_videos) = pwg_db_fetch_array( pwg_query($query) );
+
+// All videos with supported extensions by VideoJS and thumb
+$query = "SELECT COUNT(*) FROM ".IMAGES_TABLE." WHERE `representative_ext` IS NOT NULL AND ".SQL_VIDEOS.";";
+list($nb_videos_thumb) = pwg_db_fetch_array( pwg_query($query) );
+
+// send value to template
+$template->assign($conf['vjs_conf']);
+$template->assign(
+	array(
+            'AVAILABLE_SKINS'       => $available_skins,
+            'AVAILABLE_PRELOAD'     => $available_preload,
+            'AVAILABLE_WIDTH'       => $available_width,
+            'CUSTOM_CSS'            => htmlspecialchars($customcss),
+            'NB_VIDEOS'             => $nb_videos,
+            'NB_VIDEOS_THUMB'       => $nb_videos_thumb,
+	)
+);
+
+?>
Index: /extensions/piwigo_videojs/admin/admin_config.tpl
===================================================================
--- /extensions/piwigo_videojs/admin/admin_config.tpl	(revision 24676)
+++ /extensions/piwigo_videojs/admin/admin_config.tpl	(revision 24676)
@@ -0,0 +1,87 @@
+{html_head}
+<style>
+  {literal}
+    .vjs_layout {
+      text-align: left;
+      border: 2px solid rgb(221, 221, 221);
+      padding: 1em;
+      margin: 1em;
+    }
+    FORM.properties SPAN.property {
+      width:100px;
+    }
+  {/literal}
+</style>
+{/html_head}
+
+This plugin add the open source HTML5 video player <a href="http://www.videojs.com/" target="_blank">VideoJS</a>.
+<br/><br/>
+Please read the <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki" target="_blanck">plugin documentation</a> for additional information.
+
+<div class="vjs_layout">
+  <legend>{'Statistics'|@translate}</legend>
+  <ul>
+    <li class="update_summary_new">{$NB_VIDEOS} {'videos in your gallery'|@translate}</li>
+    <li class="update_summary_new">{$NB_VIDEOS_THUMB} {'videos with poster and thumbnail'|@translate}</li>
+  </ul>
+</div>
+
+<form method="post" action="" class="properties">
+	<fieldset>
+		<legend>{'HTML5'|@translate}</legend>
+		<ul>
+			<li>
+				<label><span class="property">{'PRELOAD'|@translate} : </span></label>
+				<select name="vjs_preload">
+					{html_options options=$AVAILABLE_PRELOAD selected=$preload}
+				</select>
+				<br/><small>{'PRELOAD_DESC'|@translate}</small>
+			</li>
+			<li>
+				<label><span class="property">{'CONTROLS'|@translate} : </span></label>
+				<label><input type="radio" name="vjs_controls" value="true" {if $controls}checked="checked"{/if}/> {'Yes'|@translate}</label>
+				<label><input type="radio" name="vjs_controls" value="false" {if not $controls}checked="checked"{/if}/> {'No'|@translate}</label>
+				<br/><small>{'CONTROLS_DESC'|@translate}</small>
+			</li>
+			<li>
+				<label><span class="property">{'AUTOPLAY'|@translate} : </span></label>
+				<label><input type="radio" name="vjs_autoplay" value="true" {if $autoplay}checked="checked"{/if}/> {'Yes'|@translate}</label>
+				<label><input type="radio" name="vjs_autoplay" value="false" {if not $autoplay}checked="checked"{/if}/> {'No'|@translate}</label>
+				<br/><small>{'AUTOPLAY_DESC'|@translate}</small>
+			</li>
+			<li>
+				<label><span class="property">{'LOOP'|@translate} : </span></label>
+				<label><input type="radio" name="vjs_loop" value="true" {if $loop}checked="checked"{/if}/> {'Yes'|@translate}</label>
+				<label><input type="radio" name="vjs_loop" value="false" {if not $loop}checked="checked"{/if}/> {'No'|@translate}</label>
+				<br/><small>{'LOOP_DESC'|@translate}</small>
+			</li>
+		</ul>
+	</fieldset>
+	<fieldset>
+		<legend>{'PLUGIN'|@translate}</legend>
+		<ul>
+			<li>
+				<label><span class="property">{'SKIN'|@translate} : </span></label>
+				<select name="vjs_skin">
+					{html_options options=$AVAILABLE_SKINS selected=$skin}
+				</select>
+				<br/><small>{'SKIN_DESC'|@translate}</small>
+			</li>
+			<li>
+				<label><span class="property">{'CUSTOMCSS'|@translate} : </span></label>
+				<textarea rows="5" cols="90" class="description" name="vjs_customcss" id="vjs_customcss">{$CUSTOM_CSS}</textarea>
+				<br/><small>{'CUSTOMCSS_DESC'|@translate}</small>
+			</li>
+			<li>
+				<label><span class="property">{'WIDTH'|@translate} : </span></label>
+				<select name="vjs_max_width">
+					{html_options options=$AVAILABLE_WIDTH selected=$max_width}
+				</select>
+				<br/><small>{'WIDTH_DESC'|@translate}</small>
+			</li>
+		<ul>
+	</fieldset>
+	<p>
+		<input class="submit" type="submit" value="{'Save Settings'|@translate}" name="submit"/>
+	</p>
+</form>
Index: /extensions/piwigo_videojs/admin/admin_sync.php
===================================================================
--- /extensions/piwigo_videojs/admin/admin_sync.php	(revision 24676)
+++ /extensions/piwigo_videojs/admin/admin_sync.php	(revision 24676)
@@ -0,0 +1,155 @@
+<?php
+/***********************************************
+* File      :   admin_sync.php
+* Project   :   piwigo-videojs
+* Descr     :   Generate the admin panel
+*
+* Created   :   4.06.2013
+*
+* Copyright 2012-2013 <xbgmsharp@gmail.com>
+*
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+************************************************/
+
+// Check whether we are indeed included by Piwigo.
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+// Geneate default value
+$sync_options = array(
+    'metadata'          => true,
+    'thumb'             => true,
+    'thumbsec'          => 1,
+    'thumbouput'        => 'jpg',
+    'thumboverlay'      => false,
+    'simulate'          => true,
+    'cat_id'            => 0,
+    'subcats_included'  => true,
+    'sync_gps'          => true,
+);
+
+if ( isset($_POST['submit']) and isset($_POST['thumbsec']) )
+{
+    // Override default value from the form
+    $sync_options = array(
+        'metadata'          => isset($_POST['metadata']),
+        'thumb'             => isset($_POST['thumb']),
+        'thumbsec'          => $_POST['thumbsec'],
+        'thumbouput'        => $_POST['thumbouput'],
+        'thumboverlay'      => isset($_POST['thumboverlay']),
+        'thumboverwrite'    => isset($_POST['thumboverwrite']),
+        'simulate'          => isset($_POST['simulate']),
+        'cat_id'            => isset($_POST['cat_id']) ? (int)$_POST['cat_id'] : 0,
+        'subcats_included'  => isset($_POST['subcats_included']),
+        'sync_gps'          => true,
+    );
+
+    // Filter on existing thumbnail
+    $OVERWRITE = "";
+    if (!$sync_options['thumboverwrite'])
+    {
+        $OVERWRITE = " AND `representative_ext` IS NULL ";
+    }
+
+    // Filter on selected ablum
+    if ( $sync_options['cat_id'] != 0 )
+    {
+        $query='
+            SELECT id FROM '.CATEGORIES_TABLE.'
+            WHERE ';
+            if ( $sync_options['subcats_included'])
+                $query .= 'uppercats REGEXP \'(^|,)'.$sync_options['cat_id'].'(,|$)\'';
+            else
+                $query .= 'id='.$sync_options['cat_id'];
+        $cat_ids = array_from_query($query, 'id');
+        $query="
+            SELECT `id`, `file`, `path`
+            FROM ".IMAGES_TABLE." INNER JOIN ".IMAGE_CATEGORY_TABLE." ON id=image_id
+            WHERE ". SQL_VIDEOS ." ". $OVERWRITE ."
+            AND category_id IN (".implode(',', $cat_ids).")
+            GROUP BY id";
+    }
+    else
+    {
+        $query = "SELECT `id`, `file`, `path`
+            FROM ".IMAGES_TABLE."
+            WHERE ". SQL_VIDEOS ." ". $OVERWRITE .";";
+    }
+
+    // Do the work, share with batch manager
+    require_once(dirname(__FILE__).'/../include/function_sync.php');
+
+    // Send sync result to template
+    $template->assign('sync_errors', $errors );
+    $template->assign('sync_infos', $infos );
+
+    // Send result to templates
+    $template->assign(
+        'update_result',
+        array(
+            'NB_ELEMENTS_THUMB'         => $thumbs,
+            'NB_ELEMENTS_EXIF'          => $metadata,
+            'NB_ELEMENTS_CANDIDATES'    => $videos,
+            'NB_ERRORS'                 => count($errors),
+    ));
+}
+
+// Check the presence of the DB schema
+$sync_options['sync_gps'] = true;
+$q = 'SELECT COUNT(*) as nb FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = "'.IMAGES_TABLE.'" AND COLUMN_NAME = "lat" OR COLUMN_NAME = "lon"';
+$result = pwg_db_fetch_array( pwg_query($q) );
+if($result['nb'] != 2)
+{
+    $sync_options['sync_gps'] = false;
+}
+
+/* Get statistics */
+// All videos with supported extensions by VideoJS
+$query = "SELECT COUNT(*) FROM ".IMAGES_TABLE." WHERE ".SQL_VIDEOS.";";
+list($nb_videos) = pwg_db_fetch_array( pwg_query($query) );
+
+// All videos with supported extensions by VideoJS and thumb
+$query = "SELECT COUNT(*) FROM ".IMAGES_TABLE." WHERE `representative_ext` IS NOT NULL AND ".SQL_VIDEOS.";";
+list($nb_videos_thumb) = pwg_db_fetch_array( pwg_query($query) );
+
+// All videos with supported extensions by VideoJS and with GPS data
+if ($sync_options['sync_gps'])
+{
+    $query = "SELECT COUNT(*) FROM ".IMAGES_TABLE." WHERE `lat` IS NOT NULL and `lon` IS NOT NULL AND ".SQL_VIDEOS.";";
+    list($nb_videos_geotagged) = pwg_db_fetch_array( pwg_query($query) );
+}
+else
+{
+    $nb_videos_geotagged = 0;
+}
+
+$query = 'SELECT id, CONCAT(name, IF(dir IS NULL, " (V)", "") ) AS name, uppercats, global_rank  FROM '.CATEGORIES_TABLE;
+display_select_cat_wrapper($query,
+                           array( $sync_options['cat_id'] ),
+                           'categories',
+                           false);
+
+// Send value to templates
+$template->assign(
+    array(
+        'SUBCATS_INCLUDED_CHECKED'  => $sync_options['subcats_included'] ? 'checked="checked"' : '',
+        'NB_VIDEOS'                 => $nb_videos,
+        'NB_VIDEOS_GEOTAGGED'       => $nb_videos_geotagged,
+        'NB_VIDEOS_THUMB'           => $nb_videos_thumb,
+        'VIDEOJS_PATH'              => VIDEOJS_PATH,
+    )
+);
+
+?>
Index: /extensions/piwigo_videojs/admin/admin_sync.tpl
===================================================================
--- /extensions/piwigo_videojs/admin/admin_sync.tpl	(revision 24676)
+++ /extensions/piwigo_videojs/admin/admin_sync.tpl	(revision 24676)
@@ -0,0 +1,144 @@
+{html_head}
+<style>
+  {literal}
+    .vjs_layout {
+      text-align: left;
+      border: 2px solid rgb(221, 221, 221);
+      padding: 1em;
+      margin: 1em;
+    }
+    .showInfo {
+      position:static;
+      display:inline-block;
+      padding:1px 7px;
+      width:4px;
+      height:16px;
+      line-height:16px;
+      font-size:0.8em;
+    }
+  {/literal}
+</style>
+{/html_head}
+
+{footer_script}{literal}
+jQuery(".showInfo").tipTip({
+  delay: 0,
+  fadeIn: 200,
+  fadeOut: 200,
+  maxWidth: '300px',
+  defaultPosition: 'right'
+});
+{/literal}{/footer_script}
+
+Synchronization of metadata information and thumbnail creation for videos.
+<br/><br/>
+Please read the <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki" target="_blanck">plugin documentation</a> for additional information.
+
+<div class="vjs_layout">
+  <legend>{'Statistics'|@translate}</legend>
+  <ul>
+    <li class="update_summary_new">{$NB_VIDEOS} {'videos in your gallery'|@translate}</li>
+    <li class="update_summary_new">{$NB_VIDEOS_GEOTAGGED} {'geotagged videos'|@translate}</li>
+    <li class="update_summary_new">{$NB_VIDEOS_THUMB} {'videos with poster and thumbnail'|@translate}</li>
+  </ul>
+</div>
+
+{if isset($update_result)}
+<div class="vjs_layout">
+  <legend>Synchronization results</legend>
+  <ul>
+    <li class="update_summary_new">{$update_result.NB_ELEMENTS_CANDIDATES} {'video(s) in your gallery'|@translate}</li>
+    <li class="update_summary_new">{$update_result.NB_ELEMENTS_EXIF} {'video(s) with metadata added'|@translate}</li>
+    <li class="update_summary_new">{$update_result.NB_ELEMENTS_THUMB} {'thumbnail(s) created'|@translate}</li>
+    <li class="update_summary_err">{$update_result.NB_ERRORS} {'errors during synchronization'|@translate}</li>
+  </ul>
+
+{if not empty($sync_errors)}
+  <h3>{'Error list'|@translate}</h3>
+  <div class="errors">
+    <ul>
+      {foreach from=$sync_errors item=error}
+      <li>{$error}</li>
+      {/foreach}
+    </ul>
+  </div>
+{/if}
+
+{if not empty($sync_infos)}
+  <h3>{'Detailed informations'|@translate}</h3>
+  <div class="infos">
+    <ul>
+      {foreach from=$sync_infos item=info}
+      <li>{$info}</li>
+      {/foreach}
+    </ul>
+  </div>
+{/if}
+
+</div>
+{/if}
+
+<form action="" method="post" id="update">
+
+  <fieldset id="syncMeta">
+    <legend>{'Synchronize metadata'|@translate}</legend>
+    <ul>
+      <li>
+	<label><input type="checkbox" name="metadata" value="1" checked="checked" /> filesize, width, height, latitude, longitude</label>
+	<br/><small>Will overwrite the information in the database with the metadata from the video.</small>
+	<br/><small><strong>Support of latitude, longitude required <a href="http://piwigo.org/ext/extension_view.php?eid=701" target="_blanck">'OpenStreetMap'</a> or 'RV Maps & Earth' plugin.</strong></small>
+      </li>
+    </ul>
+  </fieldset>
+
+  <fieldset id="syncthumb">
+    <legend>{'Create thumbnail'|@translate}</legend>
+    <ul>
+      <li>
+	<label><input type="checkbox" name="thumb" value="1" checked="checked" /> Create poster at position in second:</label>
+	<!-- <input type="range" name="thumbsec" value="4" min="0" max="60" step="1"/> -->
+	<input type="text" name="thumbsec" value="4" size="2" required/>
+	<br/><small>Create a thumbnail from the video at specify position.</small>
+      </li>
+      <li>
+	<label><input type="checkbox" name="thumboverwrite" value="1" checked="checked"> Overwrite existing posters</label>
+	<br/><small>Overwrite existing thumbnails with new ones.</small>
+      </li>
+      <li>
+	<label><span class="property">Output format : </span></label>
+	<label><input type="radio" name="thumbouput" value="jpg" checked="checked"/> JPG</label>
+	<label><input type="radio" name="thumbouput" value="png" /> PNG</label>
+	<br/><small>Select the output format for the thumbnail.</small>
+      </li>
+      <li>
+	<label><input type="checkbox" name="thumboverlay" value="1" > Add film effect</label>
+	<a class="showInfo" title="<img src='{$VIDEOJS_PATH}admin/example-frame.jpg'>">i</a>
+	<br/><small>Apply an overlay on the poster creation.</small>
+      </li>
+    </ul>
+  </fieldset>
+
+  <fieldset id="syncOptions">
+    <legend>{'Simulation'|@translate}</legend>
+    <ul>
+      <li><label><input type="checkbox" name="simulate" value="1" checked="checked" /> {'only perform a simulation (no change in database will be made)'|@translate}</label></li>
+    </ul>
+  </fieldset>
+
+  <fieldset id="catSubset">
+    <legend>{'reduce to single existing albums'|@translate}</legend>
+    <ul>
+    <li>
+    <select class="categoryList" name="cat_id" size="10">
+    	{html_options options=$categories selected=$categories_selected}
+    </select>
+    </li>
+
+    <li><label><input type="checkbox" name="subcats_included" value="1" {$SUBCATS_INCLUDED_CHECKED} /> {'Search in sub-albums'|@translate}</label></li>
+    </ul>
+  </fieldset>
+
+  <p>
+    <input type="submit" value="{'Submit'|@translate}" name="submit">
+  </p>
+</form>
Index: /extensions/piwigo_videojs/admin/admin_tech.php
===================================================================
--- /extensions/piwigo_videojs/admin/admin_tech.php	(revision 24676)
+++ /extensions/piwigo_videojs/admin/admin_tech.php	(revision 24676)
@@ -0,0 +1,35 @@
+<?php
+/***********************************************
+* File      :   admin_tech.php
+* Project   :   piwigo-videojs
+* Descr     :   Generate the admin panel
+*
+* Created   :   4.06.2013
+*
+* Copyright 2012-2013 <xbgmsharp@gmail.com>
+*
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+************************************************/
+
+// Check whether we are indeed included by Piwigo.
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+// categories
+$query = 'SELECT id,name,uppercats,global_rank FROM '.CATEGORIES_TABLE.';';
+display_select_cat_wrapper($query, array(), 'category_parent_options');
+
+
+?>
Index: /extensions/piwigo_videojs/admin/admin_tech.tpl
===================================================================
--- /extensions/piwigo_videojs/admin/admin_tech.tpl	(revision 24676)
+++ /extensions/piwigo_videojs/admin/admin_tech.tpl	(revision 24676)
@@ -0,0 +1,40 @@
+{html_head}
+<style>
+  {literal}
+FORM.properties SPAN.property {
+  width:100px;
+}
+  {/literal}
+</style>
+{/html_head}
+
+Play YouTube video inside the open source HTML5 video player <a href="http://www.videojs.com/" target="_blank">VideoJS</a>.
+<br/><br/>
+Please read the <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki" target="_blanck">plugin documentation</a> for additional information.
+
+<form method="post" action="" class="properties">
+
+	<fieldset id="addTech">
+		<legend>{'YouTube'|@translate}</legend>
+		<ul>
+		  <li>
+		    <label>
+		      <span class="property">{'Album'|@translate}</span>
+		      <select style="width:400px" name="category" id="albumSelect" size="1">
+			{html_options options=$category_parent_options selected=$POST.category}
+		      </select>
+		    </label>
+		    {'... or '|@translate}<a href="#" class="addAlbumOpen" title="{'create a new album'|@translate}">{'create a new album'|@translate}</a>
+		  </li>
+		  <li>
+		    <label>
+		      <span class="property">{'Video URL'|@translate}</span>
+		      <input type="text" name="url" value="{$POST.url}" style="width:400px;" placeholder="http://www.youtube.com/watch?v=7IYJORmvNjY">
+		    </label>
+		  </li>
+	</fieldset>
+
+	<p>
+		<input class="submit" type="submit" value="{'Save Settings'|@translate}" name="submit"/>
+	</p>
+</form>
Index: /extensions/piwigo_videojs/admin/index.php
===================================================================
--- /extensions/piwigo_videojs/admin/index.php	(revision 24676)
+++ /extensions/piwigo_videojs/admin/index.php	(revision 24676)
@@ -0,0 +1,7 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/piwigo_videojs/include/README.md
===================================================================
--- /extensions/piwigo_videojs/include/README.md	(revision 24676)
+++ /extensions/piwigo_videojs/include/README.md	(revision 24676)
@@ -0,0 +1,17 @@
+As advised in getid3's doc, we only need to keep 
+
+* getid3.lib.php
+* getid3.php
+* module.audio.flac.php
+* module.audio.mp3.php
+* module.audio.ogg.php
+* module.audio-video.flv.php
+* module.audio-video.matroska.php
+* module.audio-video.quicktime.php
+* module.tag.apetag.php
+* module.tag.id3v1.php
+* module.tag.id3v2.php
+* module.tag.lyrics3.php
+
+and thus :
+rm extension.* module.archive.* write.* module.graphic.* module.tag.xmp.php module.audio.voc.php module.audio.vqf.php module.audio.wavpack.php module.audio.tta.php module.audio.shorten.php module.audio.rkau.php module.audio.optimfrog.php module.audio.mpc.php module.audio.monkey.php module.audio.mod.php module.audio.midi.php module.audio.lpac.php module.audio.la.php module.audio.dts.php module.audio.dss.php module.audio.bonk.php module.audio.avr.php module.audio.au.php module.audio.ac3.php module.audio.aa.php module.audio.aac.php module.audio-video.asf.php module.audio-video.bink.php module.audio-video.nsv.php module.audio-video.real.php module.audio-video.mpeg.php module.audio-video.riff.php module.audio-video.swf.php module.misc.*
Index: /extensions/piwigo_videojs/include/function_frame.php
===================================================================
--- /extensions/piwigo_videojs/include/function_frame.php	(revision 24676)
+++ /extensions/piwigo_videojs/include/function_frame.php	(revision 24676)
@@ -0,0 +1,134 @@
+<?php
+/***********************************************
+* File      :   function_frame.php
+* Project   :   piwigo-videojs
+* Descr     :   Generate the thumbnail with frame
+* Base on   :   Embedded Videos plugin
+*
+* Created   :   21.06.2013
+*
+* Copyright 2012-2013 <xbgmsharp@gmail.com>
+*
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+************************************************/
+
+// Check whether we are indeed included by Piwigo.
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+/**
+ * add movie frame to an image (need GD library)
+ * @param: string source
+ * @param: string destination (if null, the source is modified)
+ * @return: void
+ */
+function add_movie_frame($src, $dest=null)
+{
+  if (empty($dest))
+  {
+    $dest = $src;
+  }
+  
+  // we need gd library
+  if (!function_exists('imagecreatetruecolor'))
+  {
+    if ($dest != $src) copy($src, $dest);
+    return;
+  }
+  
+  // open source image
+  switch (strtolower(get_extension($src)))
+  {
+    case 'jpg':
+    case 'jpeg':
+      $srcImage = imagecreatefromjpeg($src);
+      break;
+    case 'png':
+      $srcImage = imagecreatefrompng($src);
+      break;
+    case 'gif':
+      $srcImage = imagecreatefromgif($src);
+      break;
+    default:
+      if ($dest != $src) copy($src, $dest);
+      return;
+  }
+  
+  // source properties
+  $srcWidth = imagesx($srcImage);
+  $srcHeight = imagesy($srcImage);
+  $const = intval($srcWidth * 0.04);
+  $bandRadius = floor($const/8);
+
+  // band properties
+  $imgBand = imagecreatetruecolor($srcWidth + 6*$const, $srcHeight + 3*$const);
+  
+  $black = imagecolorallocate($imgBand, 0, 0, 0);
+  $white = imagecolorallocate($imgBand, 245, 245, 245);
+  
+  // and dots
+  $y_start = intval(($srcHeight + 3*$const) / 2);
+  $aug = intval($y_start / 5) + 1;
+  $i = 0;
+
+  while ($y_start + $i*$aug < $srcHeight + 3*$const)
+  {
+    imagefilledroundrectangle($imgBand, (3/4)*$const, $y_start + $i*$aug - $const/2, (9/4)*$const - 1, $y_start + $i*$aug + $const/2 - 1, $white, $bandRadius);
+    imagefilledroundrectangle($imgBand, (3/4)*$const, $y_start - $i*$aug - $const/2, (9/4)*$const - 1, $y_start - $i*$aug + $const/2 - 1, $white, $bandRadius);
+
+    imagefilledroundrectangle($imgBand, $srcWidth + (15/4)*$const, $y_start + $i*$aug - $const/2, $srcWidth + (21/4)*$const - 1, $y_start + $i*$aug + $const/2 - 1, $white, $bandRadius);
+    imagefilledroundrectangle($imgBand, $srcWidth + (15/4)*$const, $y_start - $i*$aug - $const/2, $srcWidth + (21/4)*$const - 1, $y_start - $i*$aug + $const/2 - 1, $white, $bandRadius);
+
+    ++$i;
+  }
+
+  // add source to band
+  imagecopy($imgBand, $srcImage, 3*$const, (3/2)*$const, 0, 0, $srcWidth, $srcHeight);
+  
+  // save image
+  switch (strtolower(get_extension($dest)))
+  {
+    case 'jpg':
+    case 'jpeg':
+      imagejpeg($imgBand, $dest, 85);
+      break;
+    case 'png':
+      imagepng($imgBand, $dest);
+      break;
+    case 'gif':
+      imagegif($imgBand, $dest);
+      break;
+  }
+}
+
+/**
+ * create a rectangle with round corners
+ * http://www.php.net/manual/fr/function.imagefilledrectangle.php#42815
+ */
+function imagefilledroundrectangle(&$img, $x1, $y1, $x2, $y2, $color, $radius)
+{
+  imagefilledrectangle($img, $x1+$radius, $y1, $x2-$radius, $y2, $color);
+  
+  if ($radius > 0)
+  {
+    imagefilledrectangle($img, $x1, $y1+$radius, $x2, $y2-$radius, $color);
+    imagefilledellipse($img, $x1+$radius, $y1+$radius, $radius*2, $radius*2, $color);
+    imagefilledellipse($img, $x2-$radius, $y1+$radius, $radius*2, $radius*2, $color);
+    imagefilledellipse($img, $x1+$radius, $y2-$radius, $radius*2, $radius*2, $color);
+    imagefilledellipse($img, $x2-$radius, $y2-$radius, $radius*2, $radius*2, $color);
+  }
+}
+
+?>
Index: /extensions/piwigo_videojs/include/function_sync.php
===================================================================
--- /extensions/piwigo_videojs/include/function_sync.php	(revision 24676)
+++ /extensions/piwigo_videojs/include/function_sync.php	(revision 24676)
@@ -0,0 +1,218 @@
+<?php
+/***********************************************
+* File      :   function_sync.php
+* Project   :   piwigo-videojs
+* Descr     :   Generate the admin panel
+*
+* Created   :   9.06.2013
+*
+* Copyright 2012-2013 <xbgmsharp@gmail.com>
+*
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+************************************************/
+
+// Check whether we are indeed included by Piwigo.
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+include_once("function_frame.php");
+
+/***************
+ *
+ * Start the sync work
+ *
+ */
+
+// Check the presence of the DB schema
+$sync_options['sync_gps'] = true;
+$q = 'SELECT COUNT(*) as nb FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = "'.IMAGES_TABLE.'" AND COLUMN_NAME = "lat" OR COLUMN_NAME = "lon"';
+$result = pwg_db_fetch_array( pwg_query($q) );
+if($result['nb'] != 2)
+{
+    $sync_options['sync_gps'] = false;
+}
+
+// Init value for result table
+$videos = 0;
+$metadata = 0;
+$thumbs = 0;
+$errors = array();
+$infos = array();
+
+if (!$sync_options['sync_gps'])
+{
+    $errors[] = "latitude and longitude disable because the require plugin is not present, eg: 'OpenStreetMap'.";
+}
+
+/*
+if ($sync_options['thumb'])
+    $log = system("ffmpeg -version", $retval);
+    if (($retval != 0) and $sync_options['thumb'])
+    {
+        $errors[] = "Thumbnail creation disable because ffmpeg is not installed on the system, eg: '/usr/bin/ffmpeg'.";
+        $sync_options['thumb'] = false;
+    }
+}
+*/
+
+if (!$sync_options['metadata'] and !$sync_options['thumb'])
+{
+    $errors[] = "You ask me to do nothing, are you sure?";
+}
+
+// Avoid Conflict with other plugin using getID3
+if( !class_exists('getID3')){
+    // Get video infos with getID3 lib
+    require_once(dirname(__FILE__) . '/../include/getid3/getid3.php');
+}
+$getID3 = new getID3;
+// Do the job
+$result = pwg_query($query);
+while ($row = pwg_db_fetch_assoc($result))
+{
+    //print_r($row);
+    $filename = $row['path'];
+    if (is_file($filename))
+    {
+        $videos++;
+        //echo $filename;
+        $fileinfo = $getID3->analyze($filename);
+        //print_r($fileinfo);
+        $exif = array();
+        if (isset($fileinfo['filesize']))
+        {
+                $exif['filesize'] = $fileinfo['filesize'];
+        }
+        /*
+        if (isset($fileinfo['playtime_string']))
+        {
+                $exif['playtime_string'] = $fileinfo['playtime_string'];
+        }
+        */
+        if (isset($fileinfo['video']['resolution_x']))
+        {
+                $exif['width'] = $fileinfo['video']['resolution_x'];
+        }
+        if (isset($fileinfo['video']['resolution_y']))
+        {
+                $exif['height'] = $fileinfo['video']['resolution_y'];
+        }
+        if (isset($fileinfo['tags']['quicktime']['gps_latitude'][0]) and $sync_options['sync_gps'])
+        {
+                $exif['lat'] = $fileinfo['tags']['quicktime']['gps_latitude'][0];
+        }
+        if (isset($fileinfo['tags']['quicktime']['gps_longitude'][0]) and $sync_options['sync_gps'])
+        {
+                $exif['lon'] = $fileinfo['tags']['quicktime']['gps_longitude'][0];
+        }
+        if (isset($fileinfo['tags']['quicktime']['model'][0]))
+        {
+                $exif['Model'] = substr($fileinfo['tags']['quicktime']['model'][0], 2);
+        }
+        if (isset($fileinfo['tags']['quicktime']['software'][0]))
+        {
+                $exif['Model'] .= " ". substr($fileinfo['tags']['quicktime']['software'][0], 2);
+        }
+        if (isset($fileinfo['tags']['quicktime']['make'][0]))
+        {
+                $exif['Make'] = $fileinfo['tags']['quicktime']['make'][0];
+        }
+        if (isset($fileinfo['tags']['quicktime']['creation_date'][0]))
+        {
+                // ?2013-03-25T09:46:54+0900
+                $exif['DateTimeOriginal'] = substr($fileinfo['tags']['quicktime']['creation_date'][0], 1);
+        }
+        //print_r($exif);
+        if (isset($exif) and $sync_options['metadata'])
+        {
+            $metadata++;
+            $infos[] = $filename. ' metadata: '.implode(",", array_keys($exif));
+            if ($sync_options['metadata'] and !$sync_options['simulate'])
+            {
+                $dbfields = explode(",", "filesize,width,height,lat,lon");
+                $query = "UPDATE ".IMAGES_TABLE." SET ".vjs_dbSet($dbfields, $exif).", `date_metadata_update`=CURDATE() WHERE `id`=".$row['id'].";";
+                pwg_query($query);
+            }
+        }
+
+        if ($sync_options['thumb'])
+        {
+            $thumbs++;
+            /* Init value */
+            $file_wo_ext = pathinfo($row['file']);
+            $output_dir = dirname($row['path']) . '/pwg_representative/';
+            $in = $filename;
+            $out = $output_dir.$file_wo_ext['filename'].'.'.$sync_options['thumbouput'];
+            /* report it */
+            $infos[] = $filename. ' thumbnail: '.$out;
+
+            if (!is_dir($output_dir) or !is_writable($output_dir))
+            {
+                $errors[] = "Directory ".$output_dir." doesn't exist or wrong permission";
+            }
+            else if ($sync_options['thumbsec'] and !$sync_options['simulate'])
+            {
+                if (isset($fileinfo['playtime_seconds']) and $sync_options['thumbsec'] > $fileinfo['playtime_seconds'])
+                {
+                    $errors[] = "Movie ". $filename." is shorter than ". $sync_options['thumbsec'] ." secondes, fallback to 1 secondes";
+                    $sync_options['thumbsec'] = 1;
+                }
+                $ffmpeg = "ffmpeg -itsoffset -".$sync_options['thumbsec']." -i ".$in." -vcodec mjpeg -vframes 1 -an -f rawvideo -y ".$out;
+                if ($sync_options['thumbouput'] == "png")
+                {
+                    $ffmpeg = "ffmpeg -itsoffset -".$sync_options['thumbsec']." -i ".$in." -vcodec png -vframes 1 -an -f rawvideo -y ".$out;
+                }
+                //echo $ffmpeg;
+                $log = system($ffmpeg, $retval);
+                //$infos[] = $filename. ' thumbnail : retval:'. $retval. ", log:". print_r($log, True);
+                if($retval != 0 or !file_exists($out))
+                {
+                    $errors[] = "Error running ffmpeg, try it manually:\n<br/>". $ffmpeg;
+                }
+		else
+		{
+                    /* Update DB */
+                    $query = "UPDATE ".IMAGES_TABLE." SET `representative_ext`='".$sync_options['thumbouput']."' WHERE `id`=".$row['id'].";";
+                    pwg_query($query);
+
+                    /* Delete any previous square or thumbnail or small images */
+                    $idata = "_data/i/".dirname($row['path']).'/pwg_representative/';
+                    $extensions = array('-th.jpg', '-sq.jpg', '-th.png', '-sq.png', '-sm.png', '-sm.png');
+                    foreach ($extensions as $extension)
+                    {
+                        $ifile = $idata.$file_wo_ext['filename'].$extension;
+                        if(is_file($ifile))
+                        {
+                            unlink($ifile);
+                        }
+                    }
+
+                    /* Generate the overlay */
+                    if($sync_options['thumboverlay'])
+                    {
+                        add_movie_frame($out);
+                        $infos[] = $filename. ' overlay: '.$out;
+                    }
+		}
+            }
+        }
+    }
+}
+
+/***************
+ *
+ * End the sync work
+ *
+ */
Index: /extensions/piwigo_videojs/include/getid3/getid3.lib.php
===================================================================
--- /extensions/piwigo_videojs/include/getid3/getid3.lib.php	(revision 24676)
+++ /extensions/piwigo_videojs/include/getid3/getid3.lib.php	(revision 24676)
@@ -0,0 +1,1342 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// getid3.lib.php - part of getID3()                           //
+// See readme.txt for more details                             //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+
+class getid3_lib
+{
+
+	public static function PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8') {
+		$returnstring = '';
+		for ($i = 0; $i < strlen($string); $i++) {
+			if ($hex) {
+				$returnstring .= str_pad(dechex(ord($string{$i})), 2, '0', STR_PAD_LEFT);
+			} else {
+				$returnstring .= ' '.(preg_match("#[\x20-\x7E]#", $string{$i}) ? $string{$i} : '¤');
+			}
+			if ($spaces) {
+				$returnstring .= ' ';
+			}
+		}
+		if (!empty($htmlencoding)) {
+			if ($htmlencoding === true) {
+				$htmlencoding = 'UTF-8'; // prior to getID3 v1.9.0 the function's 4th parameter was boolean
+			}
+			$returnstring = htmlentities($returnstring, ENT_QUOTES, $htmlencoding);
+		}
+		return $returnstring;
+	}
+
+	public static function trunc($floatnumber) {
+		// truncates a floating-point number at the decimal point
+		// returns int (if possible, otherwise float)
+		if ($floatnumber >= 1) {
+			$truncatednumber = floor($floatnumber);
+		} elseif ($floatnumber <= -1) {
+			$truncatednumber = ceil($floatnumber);
+		} else {
+			$truncatednumber = 0;
+		}
+		if (self::intValueSupported($truncatednumber)) {
+			$truncatednumber = (int) $truncatednumber;
+		}
+		return $truncatednumber;
+	}
+
+
+	public static function safe_inc(&$variable, $increment=1) {
+		if (isset($variable)) {
+			$variable += $increment;
+		} else {
+			$variable = $increment;
+		}
+		return true;
+	}
+
+	public static function CastAsInt($floatnum) {
+		// convert to float if not already
+		$floatnum = (float) $floatnum;
+
+		// convert a float to type int, only if possible
+		if (self::trunc($floatnum) == $floatnum) {
+			// it's not floating point
+			if (self::intValueSupported($floatnum)) {
+				// it's within int range
+				$floatnum = (int) $floatnum;
+			}
+		}
+		return $floatnum;
+	}
+
+	public static function intValueSupported($num) {
+		// check if integers are 64-bit
+		static $hasINT64 = null;
+		if ($hasINT64 === null) { // 10x faster than is_null()
+			$hasINT64 = is_int(pow(2, 31)); // 32-bit int are limited to (2^31)-1
+			if (!$hasINT64 && !defined('PHP_INT_MIN')) {
+				define('PHP_INT_MIN', ~PHP_INT_MAX);
+			}
+		}
+		// if integers are 64-bit - no other check required
+		if ($hasINT64 || (($num <= PHP_INT_MAX) && ($num >= PHP_INT_MIN))) {
+			return true;
+		}
+		return false;
+	}
+
+	public static function DecimalizeFraction($fraction) {
+		list($numerator, $denominator) = explode('/', $fraction);
+		return $numerator / ($denominator ? $denominator : 1);
+	}
+
+
+	public static function DecimalBinary2Float($binarynumerator) {
+		$numerator   = self::Bin2Dec($binarynumerator);
+		$denominator = self::Bin2Dec('1'.str_repeat('0', strlen($binarynumerator)));
+		return ($numerator / $denominator);
+	}
+
+
+	public static function NormalizeBinaryPoint($binarypointnumber, $maxbits=52) {
+		// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html
+		if (strpos($binarypointnumber, '.') === false) {
+			$binarypointnumber = '0.'.$binarypointnumber;
+		} elseif ($binarypointnumber{0} == '.') {
+			$binarypointnumber = '0'.$binarypointnumber;
+		}
+		$exponent = 0;
+		while (($binarypointnumber{0} != '1') || (substr($binarypointnumber, 1, 1) != '.')) {
+			if (substr($binarypointnumber, 1, 1) == '.') {
+				$exponent--;
+				$binarypointnumber = substr($binarypointnumber, 2, 1).'.'.substr($binarypointnumber, 3);
+			} else {
+				$pointpos = strpos($binarypointnumber, '.');
+				$exponent += ($pointpos - 1);
+				$binarypointnumber = str_replace('.', '', $binarypointnumber);
+				$binarypointnumber = $binarypointnumber{0}.'.'.substr($binarypointnumber, 1);
+			}
+		}
+		$binarypointnumber = str_pad(substr($binarypointnumber, 0, $maxbits + 2), $maxbits + 2, '0', STR_PAD_RIGHT);
+		return array('normalized'=>$binarypointnumber, 'exponent'=>(int) $exponent);
+	}
+
+
+	public static function Float2BinaryDecimal($floatvalue) {
+		// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html
+		$maxbits = 128; // to how many bits of precision should the calculations be taken?
+		$intpart   = self::trunc($floatvalue);
+		$floatpart = abs($floatvalue - $intpart);
+		$pointbitstring = '';
+		while (($floatpart != 0) && (strlen($pointbitstring) < $maxbits)) {
+			$floatpart *= 2;
+			$pointbitstring .= (string) self::trunc($floatpart);
+			$floatpart -= self::trunc($floatpart);
+		}
+		$binarypointnumber = decbin($intpart).'.'.$pointbitstring;
+		return $binarypointnumber;
+	}
+
+
+	public static function Float2String($floatvalue, $bits) {
+		// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee-expl.html
+		switch ($bits) {
+			case 32:
+				$exponentbits = 8;
+				$fractionbits = 23;
+				break;
+
+			case 64:
+				$exponentbits = 11;
+				$fractionbits = 52;
+				break;
+
+			default:
+				return false;
+				break;
+		}
+		if ($floatvalue >= 0) {
+			$signbit = '0';
+		} else {
+			$signbit = '1';
+		}
+		$normalizedbinary  = self::NormalizeBinaryPoint(self::Float2BinaryDecimal($floatvalue), $fractionbits);
+		$biasedexponent    = pow(2, $exponentbits - 1) - 1 + $normalizedbinary['exponent']; // (127 or 1023) +/- exponent
+		$exponentbitstring = str_pad(decbin($biasedexponent), $exponentbits, '0', STR_PAD_LEFT);
+		$fractionbitstring = str_pad(substr($normalizedbinary['normalized'], 2), $fractionbits, '0', STR_PAD_RIGHT);
+
+		return self::BigEndian2String(self::Bin2Dec($signbit.$exponentbitstring.$fractionbitstring), $bits % 8, false);
+	}
+
+
+	public static function LittleEndian2Float($byteword) {
+		return self::BigEndian2Float(strrev($byteword));
+	}
+
+
+	public static function BigEndian2Float($byteword) {
+		// ANSI/IEEE Standard 754-1985, Standard for Binary Floating Point Arithmetic
+		// http://www.psc.edu/general/software/packages/ieee/ieee.html
+		// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee.html
+
+		$bitword = self::BigEndian2Bin($byteword);
+		if (!$bitword) {
+			return 0;
+		}
+		$signbit = $bitword{0};
+
+		switch (strlen($byteword) * 8) {
+			case 32:
+				$exponentbits = 8;
+				$fractionbits = 23;
+				break;
+
+			case 64:
+				$exponentbits = 11;
+				$fractionbits = 52;
+				break;
+
+			case 80:
+				// 80-bit Apple SANE format
+				// http://www.mactech.com/articles/mactech/Vol.06/06.01/SANENormalized/
+				$exponentstring = substr($bitword, 1, 15);
+				$isnormalized = intval($bitword{16});
+				$fractionstring = substr($bitword, 17, 63);
+				$exponent = pow(2, self::Bin2Dec($exponentstring) - 16383);
+				$fraction = $isnormalized + self::DecimalBinary2Float($fractionstring);
+				$floatvalue = $exponent * $fraction;
+				if ($signbit == '1') {
+					$floatvalue *= -1;
+				}
+				return $floatvalue;
+				break;
+
+			default:
+				return false;
+				break;
+		}
+		$exponentstring = substr($bitword, 1, $exponentbits);
+		$fractionstring = substr($bitword, $exponentbits + 1, $fractionbits);
+		$exponent = self::Bin2Dec($exponentstring);
+		$fraction = self::Bin2Dec($fractionstring);
+
+		if (($exponent == (pow(2, $exponentbits) - 1)) && ($fraction != 0)) {
+			// Not a Number
+			$floatvalue = false;
+		} elseif (($exponent == (pow(2, $exponentbits) - 1)) && ($fraction == 0)) {
+			if ($signbit == '1') {
+				$floatvalue = '-infinity';
+			} else {
+				$floatvalue = '+infinity';
+			}
+		} elseif (($exponent == 0) && ($fraction == 0)) {
+			if ($signbit == '1') {
+				$floatvalue = -0;
+			} else {
+				$floatvalue = 0;
+			}
+			$floatvalue = ($signbit ? 0 : -0);
+		} elseif (($exponent == 0) && ($fraction != 0)) {
+			// These are 'unnormalized' values
+			$floatvalue = pow(2, (-1 * (pow(2, $exponentbits - 1) - 2))) * self::DecimalBinary2Float($fractionstring);
+			if ($signbit == '1') {
+				$floatvalue *= -1;
+			}
+		} elseif ($exponent != 0) {
+			$floatvalue = pow(2, ($exponent - (pow(2, $exponentbits - 1) - 1))) * (1 + self::DecimalBinary2Float($fractionstring));
+			if ($signbit == '1') {
+				$floatvalue *= -1;
+			}
+		}
+		return (float) $floatvalue;
+	}
+
+
+	public static function BigEndian2Int($byteword, $synchsafe=false, $signed=false) {
+		$intvalue = 0;
+		$bytewordlen = strlen($byteword);
+		if ($bytewordlen == 0) {
+			return false;
+		}
+		for ($i = 0; $i < $bytewordlen; $i++) {
+			if ($synchsafe) { // disregard MSB, effectively 7-bit bytes
+				//$intvalue = $intvalue | (ord($byteword{$i}) & 0x7F) << (($bytewordlen - 1 - $i) * 7); // faster, but runs into problems past 2^31 on 32-bit systems
+				$intvalue += (ord($byteword{$i}) & 0x7F) * pow(2, ($bytewordlen - 1 - $i) * 7);
+			} else {
+				$intvalue += ord($byteword{$i}) * pow(256, ($bytewordlen - 1 - $i));
+			}
+		}
+		if ($signed && !$synchsafe) {
+			// synchsafe ints are not allowed to be signed
+			if ($bytewordlen <= PHP_INT_SIZE) {
+				$signMaskBit = 0x80 << (8 * ($bytewordlen - 1));
+				if ($intvalue & $signMaskBit) {
+					$intvalue = 0 - ($intvalue & ($signMaskBit - 1));
+				}
+			} else {
+				throw new Exception('ERROR: Cannot have signed integers larger than '.(8 * PHP_INT_SIZE).'-bits ('.strlen($byteword).') in self::BigEndian2Int()');
+				break;
+			}
+		}
+		return self::CastAsInt($intvalue);
+	}
+
+
+	public static function LittleEndian2Int($byteword, $signed=false) {
+		return self::BigEndian2Int(strrev($byteword), false, $signed);
+	}
+
+
+	public static function BigEndian2Bin($byteword) {
+		$binvalue = '';
+		$bytewordlen = strlen($byteword);
+		for ($i = 0; $i < $bytewordlen; $i++) {
+			$binvalue .= str_pad(decbin(ord($byteword{$i})), 8, '0', STR_PAD_LEFT);
+		}
+		return $binvalue;
+	}
+
+
+	public static function BigEndian2String($number, $minbytes=1, $synchsafe=false, $signed=false) {
+		if ($number < 0) {
+			throw new Exception('ERROR: self::BigEndian2String() does not support negative numbers');
+		}
+		$maskbyte = (($synchsafe || $signed) ? 0x7F : 0xFF);
+		$intstring = '';
+		if ($signed) {
+			if ($minbytes > PHP_INT_SIZE) {
+				throw new Exception('ERROR: Cannot have signed integers larger than '.(8 * PHP_INT_SIZE).'-bits in self::BigEndian2String()');
+			}
+			$number = $number & (0x80 << (8 * ($minbytes - 1)));
+		}
+		while ($number != 0) {
+			$quotient = ($number / ($maskbyte + 1));
+			$intstring = chr(ceil(($quotient - floor($quotient)) * $maskbyte)).$intstring;
+			$number = floor($quotient);
+		}
+		return str_pad($intstring, $minbytes, "\x00", STR_PAD_LEFT);
+	}
+
+
+	public static function Dec2Bin($number) {
+		while ($number >= 256) {
+			$bytes[] = (($number / 256) - (floor($number / 256))) * 256;
+			$number = floor($number / 256);
+		}
+		$bytes[] = $number;
+		$binstring = '';
+		for ($i = 0; $i < count($bytes); $i++) {
+			$binstring = (($i == count($bytes) - 1) ? decbin($bytes[$i]) : str_pad(decbin($bytes[$i]), 8, '0', STR_PAD_LEFT)).$binstring;
+		}
+		return $binstring;
+	}
+
+
+	public static function Bin2Dec($binstring, $signed=false) {
+		$signmult = 1;
+		if ($signed) {
+			if ($binstring{0} == '1') {
+				$signmult = -1;
+			}
+			$binstring = substr($binstring, 1);
+		}
+		$decvalue = 0;
+		for ($i = 0; $i < strlen($binstring); $i++) {
+			$decvalue += ((int) substr($binstring, strlen($binstring) - $i - 1, 1)) * pow(2, $i);
+		}
+		return self::CastAsInt($decvalue * $signmult);
+	}
+
+
+	public static function Bin2String($binstring) {
+		// return 'hi' for input of '0110100001101001'
+		$string = '';
+		$binstringreversed = strrev($binstring);
+		for ($i = 0; $i < strlen($binstringreversed); $i += 8) {
+			$string = chr(self::Bin2Dec(strrev(substr($binstringreversed, $i, 8)))).$string;
+		}
+		return $string;
+	}
+
+
+	public static function LittleEndian2String($number, $minbytes=1, $synchsafe=false) {
+		$intstring = '';
+		while ($number > 0) {
+			if ($synchsafe) {
+				$intstring = $intstring.chr($number & 127);
+				$number >>= 7;
+			} else {
+				$intstring = $intstring.chr($number & 255);
+				$number >>= 8;
+			}
+		}
+		return str_pad($intstring, $minbytes, "\x00", STR_PAD_RIGHT);
+	}
+
+
+	public static function array_merge_clobber($array1, $array2) {
+		// written by kcØhireability*com
+		// taken from http://www.php.net/manual/en/function.array-merge-recursive.php
+		if (!is_array($array1) || !is_array($array2)) {
+			return false;
+		}
+		$newarray = $array1;
+		foreach ($array2 as $key => $val) {
+			if (is_array($val) && isset($newarray[$key]) && is_array($newarray[$key])) {
+				$newarray[$key] = self::array_merge_clobber($newarray[$key], $val);
+			} else {
+				$newarray[$key] = $val;
+			}
+		}
+		return $newarray;
+	}
+
+
+	public static function array_merge_noclobber($array1, $array2) {
+		if (!is_array($array1) || !is_array($array2)) {
+			return false;
+		}
+		$newarray = $array1;
+		foreach ($array2 as $key => $val) {
+			if (is_array($val) && isset($newarray[$key]) && is_array($newarray[$key])) {
+				$newarray[$key] = self::array_merge_noclobber($newarray[$key], $val);
+			} elseif (!isset($newarray[$key])) {
+				$newarray[$key] = $val;
+			}
+		}
+		return $newarray;
+	}
+
+
+	public static function ksort_recursive(&$theArray) {
+		ksort($theArray);
+		foreach ($theArray as $key => $value) {
+			if (is_array($value)) {
+				self::ksort_recursive($theArray[$key]);
+			}
+		}
+		return true;
+	}
+
+	public static function fileextension($filename, $numextensions=1) {
+		if (strstr($filename, '.')) {
+			$reversedfilename = strrev($filename);
+			$offset = 0;
+			for ($i = 0; $i < $numextensions; $i++) {
+				$offset = strpos($reversedfilename, '.', $offset + 1);
+				if ($offset === false) {
+					return '';
+				}
+			}
+			return strrev(substr($reversedfilename, 0, $offset));
+		}
+		return '';
+	}
+
+
+	public static function PlaytimeString($seconds) {
+		$sign = (($seconds < 0) ? '-' : '');
+		$seconds = round(abs($seconds));
+		$H = (int) floor( $seconds                            / 3600);
+		$M = (int) floor(($seconds - (3600 * $H)            ) /   60);
+		$S = (int) round( $seconds - (3600 * $H) - (60 * $M)        );
+		return $sign.($H ? $H.':' : '').($H ? str_pad($M, 2, '0', STR_PAD_LEFT) : intval($M)).':'.str_pad($S, 2, 0, STR_PAD_LEFT);
+	}
+
+
+	public static function DateMac2Unix($macdate) {
+		// Macintosh timestamp: seconds since 00:00h January 1, 1904
+		// UNIX timestamp:      seconds since 00:00h January 1, 1970
+		return self::CastAsInt($macdate - 2082844800);
+	}
+
+
+	public static function FixedPoint8_8($rawdata) {
+		return self::BigEndian2Int(substr($rawdata, 0, 1)) + (float) (self::BigEndian2Int(substr($rawdata, 1, 1)) / pow(2, 8));
+	}
+
+
+	public static function FixedPoint16_16($rawdata) {
+		return self::BigEndian2Int(substr($rawdata, 0, 2)) + (float) (self::BigEndian2Int(substr($rawdata, 2, 2)) / pow(2, 16));
+	}
+
+
+	public static function FixedPoint2_30($rawdata) {
+		$binarystring = self::BigEndian2Bin($rawdata);
+		return self::Bin2Dec(substr($binarystring, 0, 2)) + (float) (self::Bin2Dec(substr($binarystring, 2, 30)) / pow(2, 30));
+	}
+
+
+	public static function CreateDeepArray($ArrayPath, $Separator, $Value) {
+		// assigns $Value to a nested array path:
+		//   $foo = self::CreateDeepArray('/path/to/my', '/', 'file.txt')
+		// is the same as:
+		//   $foo = array('path'=>array('to'=>'array('my'=>array('file.txt'))));
+		// or
+		//   $foo['path']['to']['my'] = 'file.txt';
+		$ArrayPath = ltrim($ArrayPath, $Separator);
+		if (($pos = strpos($ArrayPath, $Separator)) !== false) {
+			$ReturnedArray[substr($ArrayPath, 0, $pos)] = self::CreateDeepArray(substr($ArrayPath, $pos + 1), $Separator, $Value);
+		} else {
+			$ReturnedArray[$ArrayPath] = $Value;
+		}
+		return $ReturnedArray;
+	}
+
+	public static function array_max($arraydata, $returnkey=false) {
+		$maxvalue = false;
+		$maxkey = false;
+		foreach ($arraydata as $key => $value) {
+			if (!is_array($value)) {
+				if ($value > $maxvalue) {
+					$maxvalue = $value;
+					$maxkey = $key;
+				}
+			}
+		}
+		return ($returnkey ? $maxkey : $maxvalue);
+	}
+
+	public static function array_min($arraydata, $returnkey=false) {
+		$minvalue = false;
+		$minkey = false;
+		foreach ($arraydata as $key => $value) {
+			if (!is_array($value)) {
+				if ($value > $minvalue) {
+					$minvalue = $value;
+					$minkey = $key;
+				}
+			}
+		}
+		return ($returnkey ? $minkey : $minvalue);
+	}
+
+	public static function XML2array($XMLstring) {
+		if (function_exists('simplexml_load_string')) {
+			if (function_exists('get_object_vars')) {
+				$XMLobject = simplexml_load_string($XMLstring);
+				return self::SimpleXMLelement2array($XMLobject);
+			}
+		}
+		return false;
+	}
+
+	public static function SimpleXMLelement2array($XMLobject) {
+		if (!is_object($XMLobject) && !is_array($XMLobject)) {
+			return $XMLobject;
+		}
+		$XMLarray = (is_object($XMLobject) ? get_object_vars($XMLobject) : $XMLobject);
+		foreach ($XMLarray as $key => $value) {
+			$XMLarray[$key] = self::SimpleXMLelement2array($value);
+		}
+		return $XMLarray;
+	}
+
+
+	// Allan Hansen <ahØartemis*dk>
+	// self::md5_data() - returns md5sum for a file from startuing position to absolute end position
+	public static function hash_data($file, $offset, $end, $algorithm) {
+		static $tempdir = '';
+		if (!self::intValueSupported($end)) {
+			return false;
+		}
+		switch ($algorithm) {
+			case 'md5':
+				$hash_function = 'md5_file';
+				$unix_call     = 'md5sum';
+				$windows_call  = 'md5sum.exe';
+				$hash_length   = 32;
+				break;
+
+			case 'sha1':
+				$hash_function = 'sha1_file';
+				$unix_call     = 'sha1sum';
+				$windows_call  = 'sha1sum.exe';
+				$hash_length   = 40;
+				break;
+
+			default:
+				throw new Exception('Invalid algorithm ('.$algorithm.') in self::hash_data()');
+				break;
+		}
+		$size = $end - $offset;
+		while (true) {
+			if (GETID3_OS_ISWINDOWS) {
+
+				// It seems that sha1sum.exe for Windows only works on physical files, does not accept piped data
+				// Fall back to create-temp-file method:
+				if ($algorithm == 'sha1') {
+					break;
+				}
+
+				$RequiredFiles = array('cygwin1.dll', 'head.exe', 'tail.exe', $windows_call);
+				foreach ($RequiredFiles as $required_file) {
+					if (!is_readable(GETID3_HELPERAPPSDIR.$required_file)) {
+						// helper apps not available - fall back to old method
+						break 2;
+					}
+				}
+				$commandline  = GETID3_HELPERAPPSDIR.'head.exe -c '.$end.' '.escapeshellarg(str_replace('/', DIRECTORY_SEPARATOR, $file)).' | ';
+				$commandline .= GETID3_HELPERAPPSDIR.'tail.exe -c '.$size.' | ';
+				$commandline .= GETID3_HELPERAPPSDIR.$windows_call;
+
+			} else {
+
+				$commandline  = 'head -c'.$end.' '.escapeshellarg($file).' | ';
+				$commandline .= 'tail -c'.$size.' | ';
+				$commandline .= $unix_call;
+
+			}
+			if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) {
+				//throw new Exception('PHP running in Safe Mode - backtick operator not available, using slower non-system-call '.$algorithm.' algorithm');
+				break;
+			}
+			return substr(`$commandline`, 0, $hash_length);
+		}
+
+		if (empty($tempdir)) {
+			// yes this is ugly, feel free to suggest a better way
+			require_once(dirname(__FILE__).'/getid3.php');
+			$getid3_temp = new getID3();
+			$tempdir = $getid3_temp->tempdir;
+			unset($getid3_temp);
+		}
+		// try to create a temporary file in the system temp directory - invalid dirname should force to system temp dir
+		if (($data_filename = tempnam($tempdir, 'gI3')) === false) {
+			// can't find anywhere to create a temp file, just fail
+			return false;
+		}
+
+		// Init
+		$result = false;
+
+		// copy parts of file
+		try {
+			self::CopyFileParts($file, $data_filename, $offset, $end - $offset);
+			$result = $hash_function($data_filename);
+		} catch (Exception $e) {
+			throw new Exception('self::CopyFileParts() failed in getid_lib::hash_data(): '.$e->getMessage());
+		}
+		unlink($data_filename);
+		return $result;
+	}
+
+	public static function CopyFileParts($filename_source, $filename_dest, $offset, $length) {
+		if (!self::intValueSupported($offset + $length)) {
+			throw new Exception('cannot copy file portion, it extends beyond the '.round(PHP_INT_MAX / 1073741824).'GB limit');
+		}
+		if (is_readable($filename_source) && is_file($filename_source) && ($fp_src = fopen($filename_source, 'rb'))) {
+			if (($fp_dest = fopen($filename_dest, 'wb'))) {
+				if (fseek($fp_src, $offset, SEEK_SET) == 0) {
+					$byteslefttowrite = $length;
+					while (($byteslefttowrite > 0) && ($buffer = fread($fp_src, min($byteslefttowrite, getID3::FREAD_BUFFER_SIZE)))) {
+						$byteswritten = fwrite($fp_dest, $buffer, $byteslefttowrite);
+						$byteslefttowrite -= $byteswritten;
+					}
+					return true;
+				} else {
+					throw new Exception('failed to seek to offset '.$offset.' in '.$filename_source);
+				}
+				fclose($fp_dest);
+			} else {
+				throw new Exception('failed to create file for writing '.$filename_dest);
+			}
+			fclose($fp_src);
+		} else {
+			throw new Exception('failed to open file for reading '.$filename_source);
+		}
+		return false;
+	}
+
+	public static function iconv_fallback_int_utf8($charval) {
+		if ($charval < 128) {
+			// 0bbbbbbb
+			$newcharstring = chr($charval);
+		} elseif ($charval < 2048) {
+			// 110bbbbb 10bbbbbb
+			$newcharstring  = chr(($charval >>   6) | 0xC0);
+			$newcharstring .= chr(($charval & 0x3F) | 0x80);
+		} elseif ($charval < 65536) {
+			// 1110bbbb 10bbbbbb 10bbbbbb
+			$newcharstring  = chr(($charval >>  12) | 0xE0);
+			$newcharstring .= chr(($charval >>   6) | 0xC0);
+			$newcharstring .= chr(($charval & 0x3F) | 0x80);
+		} else {
+			// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
+			$newcharstring  = chr(($charval >>  18) | 0xF0);
+			$newcharstring .= chr(($charval >>  12) | 0xC0);
+			$newcharstring .= chr(($charval >>   6) | 0xC0);
+			$newcharstring .= chr(($charval & 0x3F) | 0x80);
+		}
+		return $newcharstring;
+	}
+
+	// ISO-8859-1 => UTF-8
+	public static function iconv_fallback_iso88591_utf8($string, $bom=false) {
+		if (function_exists('utf8_encode')) {
+			return utf8_encode($string);
+		}
+		// utf8_encode() unavailable, use getID3()'s iconv_fallback() conversions (possibly PHP is compiled without XML support)
+		$newcharstring = '';
+		if ($bom) {
+			$newcharstring .= "\xEF\xBB\xBF";
+		}
+		for ($i = 0; $i < strlen($string); $i++) {
+			$charval = ord($string{$i});
+			$newcharstring .= self::iconv_fallback_int_utf8($charval);
+		}
+		return $newcharstring;
+	}
+
+	// ISO-8859-1 => UTF-16BE
+	public static function iconv_fallback_iso88591_utf16be($string, $bom=false) {
+		$newcharstring = '';
+		if ($bom) {
+			$newcharstring .= "\xFE\xFF";
+		}
+		for ($i = 0; $i < strlen($string); $i++) {
+			$newcharstring .= "\x00".$string{$i};
+		}
+		return $newcharstring;
+	}
+
+	// ISO-8859-1 => UTF-16LE
+	public static function iconv_fallback_iso88591_utf16le($string, $bom=false) {
+		$newcharstring = '';
+		if ($bom) {
+			$newcharstring .= "\xFF\xFE";
+		}
+		for ($i = 0; $i < strlen($string); $i++) {
+			$newcharstring .= $string{$i}."\x00";
+		}
+		return $newcharstring;
+	}
+
+	// ISO-8859-1 => UTF-16LE (BOM)
+	public static function iconv_fallback_iso88591_utf16($string) {
+		return self::iconv_fallback_iso88591_utf16le($string, true);
+	}
+
+	// UTF-8 => ISO-8859-1
+	public static function iconv_fallback_utf8_iso88591($string) {
+		if (function_exists('utf8_decode')) {
+			return utf8_decode($string);
+		}
+		// utf8_decode() unavailable, use getID3()'s iconv_fallback() conversions (possibly PHP is compiled without XML support)
+		$newcharstring = '';
+		$offset = 0;
+		$stringlength = strlen($string);
+		while ($offset < $stringlength) {
+			if ((ord($string{$offset}) | 0x07) == 0xF7) {
+				// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
+				$charval = ((ord($string{($offset + 0)}) & 0x07) << 18) &
+						   ((ord($string{($offset + 1)}) & 0x3F) << 12) &
+						   ((ord($string{($offset + 2)}) & 0x3F) <<  6) &
+							(ord($string{($offset + 3)}) & 0x3F);
+				$offset += 4;
+			} elseif ((ord($string{$offset}) | 0x0F) == 0xEF) {
+				// 1110bbbb 10bbbbbb 10bbbbbb
+				$charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) &
+						   ((ord($string{($offset + 1)}) & 0x3F) <<  6) &
+							(ord($string{($offset + 2)}) & 0x3F);
+				$offset += 3;
+			} elseif ((ord($string{$offset}) | 0x1F) == 0xDF) {
+				// 110bbbbb 10bbbbbb
+				$charval = ((ord($string{($offset + 0)}) & 0x1F) <<  6) &
+							(ord($string{($offset + 1)}) & 0x3F);
+				$offset += 2;
+			} elseif ((ord($string{$offset}) | 0x7F) == 0x7F) {
+				// 0bbbbbbb
+				$charval = ord($string{$offset});
+				$offset += 1;
+			} else {
+				// error? throw some kind of warning here?
+				$charval = false;
+				$offset += 1;
+			}
+			if ($charval !== false) {
+				$newcharstring .= (($charval < 256) ? chr($charval) : '?');
+			}
+		}
+		return $newcharstring;
+	}
+
+	// UTF-8 => UTF-16BE
+	public static function iconv_fallback_utf8_utf16be($string, $bom=false) {
+		$newcharstring = '';
+		if ($bom) {
+			$newcharstring .= "\xFE\xFF";
+		}
+		$offset = 0;
+		$stringlength = strlen($string);
+		while ($offset < $stringlength) {
+			if ((ord($string{$offset}) | 0x07) == 0xF7) {
+				// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
+				$charval = ((ord($string{($offset + 0)}) & 0x07) << 18) &
+						   ((ord($string{($offset + 1)}) & 0x3F) << 12) &
+						   ((ord($string{($offset + 2)}) & 0x3F) <<  6) &
+							(ord($string{($offset + 3)}) & 0x3F);
+				$offset += 4;
+			} elseif ((ord($string{$offset}) | 0x0F) == 0xEF) {
+				// 1110bbbb 10bbbbbb 10bbbbbb
+				$charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) &
+						   ((ord($string{($offset + 1)}) & 0x3F) <<  6) &
+							(ord($string{($offset + 2)}) & 0x3F);
+				$offset += 3;
+			} elseif ((ord($string{$offset}) | 0x1F) == 0xDF) {
+				// 110bbbbb 10bbbbbb
+				$charval = ((ord($string{($offset + 0)}) & 0x1F) <<  6) &
+							(ord($string{($offset + 1)}) & 0x3F);
+				$offset += 2;
+			} elseif ((ord($string{$offset}) | 0x7F) == 0x7F) {
+				// 0bbbbbbb
+				$charval = ord($string{$offset});
+				$offset += 1;
+			} else {
+				// error? throw some kind of warning here?
+				$charval = false;
+				$offset += 1;
+			}
+			if ($charval !== false) {
+				$newcharstring .= (($charval < 65536) ? self::BigEndian2String($charval, 2) : "\x00".'?');
+			}
+		}
+		return $newcharstring;
+	}
+
+	// UTF-8 => UTF-16LE
+	public static function iconv_fallback_utf8_utf16le($string, $bom=false) {
+		$newcharstring = '';
+		if ($bom) {
+			$newcharstring .= "\xFF\xFE";
+		}
+		$offset = 0;
+		$stringlength = strlen($string);
+		while ($offset < $stringlength) {
+			if ((ord($string{$offset}) | 0x07) == 0xF7) {
+				// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
+				$charval = ((ord($string{($offset + 0)}) & 0x07) << 18) &
+						   ((ord($string{($offset + 1)}) & 0x3F) << 12) &
+						   ((ord($string{($offset + 2)}) & 0x3F) <<  6) &
+							(ord($string{($offset + 3)}) & 0x3F);
+				$offset += 4;
+			} elseif ((ord($string{$offset}) | 0x0F) == 0xEF) {
+				// 1110bbbb 10bbbbbb 10bbbbbb
+				$charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) &
+						   ((ord($string{($offset + 1)}) & 0x3F) <<  6) &
+							(ord($string{($offset + 2)}) & 0x3F);
+				$offset += 3;
+			} elseif ((ord($string{$offset}) | 0x1F) == 0xDF) {
+				// 110bbbbb 10bbbbbb
+				$charval = ((ord($string{($offset + 0)}) & 0x1F) <<  6) &
+							(ord($string{($offset + 1)}) & 0x3F);
+				$offset += 2;
+			} elseif ((ord($string{$offset}) | 0x7F) == 0x7F) {
+				// 0bbbbbbb
+				$charval = ord($string{$offset});
+				$offset += 1;
+			} else {
+				// error? maybe throw some warning here?
+				$charval = false;
+				$offset += 1;
+			}
+			if ($charval !== false) {
+				$newcharstring .= (($charval < 65536) ? self::LittleEndian2String($charval, 2) : '?'."\x00");
+			}
+		}
+		return $newcharstring;
+	}
+
+	// UTF-8 => UTF-16LE (BOM)
+	public static function iconv_fallback_utf8_utf16($string) {
+		return self::iconv_fallback_utf8_utf16le($string, true);
+	}
+
+	// UTF-16BE => UTF-8
+	public static function iconv_fallback_utf16be_utf8($string) {
+		if (substr($string, 0, 2) == "\xFE\xFF") {
+			// strip BOM
+			$string = substr($string, 2);
+		}
+		$newcharstring = '';
+		for ($i = 0; $i < strlen($string); $i += 2) {
+			$charval = self::BigEndian2Int(substr($string, $i, 2));
+			$newcharstring .= self::iconv_fallback_int_utf8($charval);
+		}
+		return $newcharstring;
+	}
+
+	// UTF-16LE => UTF-8
+	public static function iconv_fallback_utf16le_utf8($string) {
+		if (substr($string, 0, 2) == "\xFF\xFE") {
+			// strip BOM
+			$string = substr($string, 2);
+		}
+		$newcharstring = '';
+		for ($i = 0; $i < strlen($string); $i += 2) {
+			$charval = self::LittleEndian2Int(substr($string, $i, 2));
+			$newcharstring .= self::iconv_fallback_int_utf8($charval);
+		}
+		return $newcharstring;
+	}
+
+	// UTF-16BE => ISO-8859-1
+	public static function iconv_fallback_utf16be_iso88591($string) {
+		if (substr($string, 0, 2) == "\xFE\xFF") {
+			// strip BOM
+			$string = substr($string, 2);
+		}
+		$newcharstring = '';
+		for ($i = 0; $i < strlen($string); $i += 2) {
+			$charval = self::BigEndian2Int(substr($string, $i, 2));
+			$newcharstring .= (($charval < 256) ? chr($charval) : '?');
+		}
+		return $newcharstring;
+	}
+
+	// UTF-16LE => ISO-8859-1
+	public static function iconv_fallback_utf16le_iso88591($string) {
+		if (substr($string, 0, 2) == "\xFF\xFE") {
+			// strip BOM
+			$string = substr($string, 2);
+		}
+		$newcharstring = '';
+		for ($i = 0; $i < strlen($string); $i += 2) {
+			$charval = self::LittleEndian2Int(substr($string, $i, 2));
+			$newcharstring .= (($charval < 256) ? chr($charval) : '?');
+		}
+		return $newcharstring;
+	}
+
+	// UTF-16 (BOM) => ISO-8859-1
+	public static function iconv_fallback_utf16_iso88591($string) {
+		$bom = substr($string, 0, 2);
+		if ($bom == "\xFE\xFF") {
+			return self::iconv_fallback_utf16be_iso88591(substr($string, 2));
+		} elseif ($bom == "\xFF\xFE") {
+			return self::iconv_fallback_utf16le_iso88591(substr($string, 2));
+		}
+		return $string;
+	}
+
+	// UTF-16 (BOM) => UTF-8
+	public static function iconv_fallback_utf16_utf8($string) {
+		$bom = substr($string, 0, 2);
+		if ($bom == "\xFE\xFF") {
+			return self::iconv_fallback_utf16be_utf8(substr($string, 2));
+		} elseif ($bom == "\xFF\xFE") {
+			return self::iconv_fallback_utf16le_utf8(substr($string, 2));
+		}
+		return $string;
+	}
+
+	public static function iconv_fallback($in_charset, $out_charset, $string) {
+
+		if ($in_charset == $out_charset) {
+			return $string;
+		}
+
+		// iconv() availble
+		if (function_exists('iconv')) {
+			if ($converted_string = @iconv($in_charset, $out_charset.'//TRANSLIT', $string)) {
+				switch ($out_charset) {
+					case 'ISO-8859-1':
+						$converted_string = rtrim($converted_string, "\x00");
+						break;
+				}
+				return $converted_string;
+			}
+
+			// iconv() may sometimes fail with "illegal character in input string" error message
+			// and return an empty string, but returning the unconverted string is more useful
+			return $string;
+		}
+
+
+		// iconv() not available
+		static $ConversionFunctionList = array();
+		if (empty($ConversionFunctionList)) {
+			$ConversionFunctionList['ISO-8859-1']['UTF-8']    = 'iconv_fallback_iso88591_utf8';
+			$ConversionFunctionList['ISO-8859-1']['UTF-16']   = 'iconv_fallback_iso88591_utf16';
+			$ConversionFunctionList['ISO-8859-1']['UTF-16BE'] = 'iconv_fallback_iso88591_utf16be';
+			$ConversionFunctionList['ISO-8859-1']['UTF-16LE'] = 'iconv_fallback_iso88591_utf16le';
+			$ConversionFunctionList['UTF-8']['ISO-8859-1']    = 'iconv_fallback_utf8_iso88591';
+			$ConversionFunctionList['UTF-8']['UTF-16']        = 'iconv_fallback_utf8_utf16';
+			$ConversionFunctionList['UTF-8']['UTF-16BE']      = 'iconv_fallback_utf8_utf16be';
+			$ConversionFunctionList['UTF-8']['UTF-16LE']      = 'iconv_fallback_utf8_utf16le';
+			$ConversionFunctionList['UTF-16']['ISO-8859-1']   = 'iconv_fallback_utf16_iso88591';
+			$ConversionFunctionList['UTF-16']['UTF-8']        = 'iconv_fallback_utf16_utf8';
+			$ConversionFunctionList['UTF-16LE']['ISO-8859-1'] = 'iconv_fallback_utf16le_iso88591';
+			$ConversionFunctionList['UTF-16LE']['UTF-8']      = 'iconv_fallback_utf16le_utf8';
+			$ConversionFunctionList['UTF-16BE']['ISO-8859-1'] = 'iconv_fallback_utf16be_iso88591';
+			$ConversionFunctionList['UTF-16BE']['UTF-8']      = 'iconv_fallback_utf16be_utf8';
+		}
+		if (isset($ConversionFunctionList[strtoupper($in_charset)][strtoupper($out_charset)])) {
+			$ConversionFunction = $ConversionFunctionList[strtoupper($in_charset)][strtoupper($out_charset)];
+			return self::$ConversionFunction($string);
+		}
+		throw new Exception('PHP does not have iconv() support - cannot convert from '.$in_charset.' to '.$out_charset);
+	}
+
+
+	public static function MultiByteCharString2HTML($string, $charset='ISO-8859-1') {
+		$string = (string) $string; // in case trying to pass a numeric (float, int) string, would otherwise return an empty string
+		$HTMLstring = '';
+
+		switch ($charset) {
+			case '1251':
+			case '1252':
+			case '866':
+			case '932':
+			case '936':
+			case '950':
+			case 'BIG5':
+			case 'BIG5-HKSCS':
+			case 'cp1251':
+			case 'cp1252':
+			case 'cp866':
+			case 'EUC-JP':
+			case 'EUCJP':
+			case 'GB2312':
+			case 'ibm866':
+			case 'ISO-8859-1':
+			case 'ISO-8859-15':
+			case 'ISO8859-1':
+			case 'ISO8859-15':
+			case 'KOI8-R':
+			case 'koi8-ru':
+			case 'koi8r':
+			case 'Shift_JIS':
+			case 'SJIS':
+			case 'win-1251':
+			case 'Windows-1251':
+			case 'Windows-1252':
+				$HTMLstring = htmlentities($string, ENT_COMPAT, $charset);
+				break;
+
+			case 'UTF-8':
+				$strlen = strlen($string);
+				for ($i = 0; $i < $strlen; $i++) {
+					$char_ord_val = ord($string{$i});
+					$charval = 0;
+					if ($char_ord_val < 0x80) {
+						$charval = $char_ord_val;
+					} elseif ((($char_ord_val & 0xF0) >> 4) == 0x0F  &&  $i+3 < $strlen) {
+						$charval  = (($char_ord_val & 0x07) << 18);
+						$charval += ((ord($string{++$i}) & 0x3F) << 12);
+						$charval += ((ord($string{++$i}) & 0x3F) << 6);
+						$charval +=  (ord($string{++$i}) & 0x3F);
+					} elseif ((($char_ord_val & 0xE0) >> 5) == 0x07  &&  $i+2 < $strlen) {
+						$charval  = (($char_ord_val & 0x0F) << 12);
+						$charval += ((ord($string{++$i}) & 0x3F) << 6);
+						$charval +=  (ord($string{++$i}) & 0x3F);
+					} elseif ((($char_ord_val & 0xC0) >> 6) == 0x03  &&  $i+1 < $strlen) {
+						$charval  = (($char_ord_val & 0x1F) << 6);
+						$charval += (ord($string{++$i}) & 0x3F);
+					}
+					if (($charval >= 32) && ($charval <= 127)) {
+						$HTMLstring .= htmlentities(chr($charval));
+					} else {
+						$HTMLstring .= '&#'.$charval.';';
+					}
+				}
+				break;
+
+			case 'UTF-16LE':
+				for ($i = 0; $i < strlen($string); $i += 2) {
+					$charval = self::LittleEndian2Int(substr($string, $i, 2));
+					if (($charval >= 32) && ($charval <= 127)) {
+						$HTMLstring .= chr($charval);
+					} else {
+						$HTMLstring .= '&#'.$charval.';';
+					}
+				}
+				break;
+
+			case 'UTF-16BE':
+				for ($i = 0; $i < strlen($string); $i += 2) {
+					$charval = self::BigEndian2Int(substr($string, $i, 2));
+					if (($charval >= 32) && ($charval <= 127)) {
+						$HTMLstring .= chr($charval);
+					} else {
+						$HTMLstring .= '&#'.$charval.';';
+					}
+				}
+				break;
+
+			default:
+				$HTMLstring = 'ERROR: Character set "'.$charset.'" not supported in MultiByteCharString2HTML()';
+				break;
+		}
+		return $HTMLstring;
+	}
+
+
+
+	public static function RGADnameLookup($namecode) {
+		static $RGADname = array();
+		if (empty($RGADname)) {
+			$RGADname[0] = 'not set';
+			$RGADname[1] = 'Track Gain Adjustment';
+			$RGADname[2] = 'Album Gain Adjustment';
+		}
+
+		return (isset($RGADname[$namecode]) ? $RGADname[$namecode] : '');
+	}
+
+
+	public static function RGADoriginatorLookup($originatorcode) {
+		static $RGADoriginator = array();
+		if (empty($RGADoriginator)) {
+			$RGADoriginator[0] = 'unspecified';
+			$RGADoriginator[1] = 'pre-set by artist/producer/mastering engineer';
+			$RGADoriginator[2] = 'set by user';
+			$RGADoriginator[3] = 'determined automatically';
+		}
+
+		return (isset($RGADoriginator[$originatorcode]) ? $RGADoriginator[$originatorcode] : '');
+	}
+
+
+	public static function RGADadjustmentLookup($rawadjustment, $signbit) {
+		$adjustment = $rawadjustment / 10;
+		if ($signbit == 1) {
+			$adjustment *= -1;
+		}
+		return (float) $adjustment;
+	}
+
+
+	public static function RGADgainString($namecode, $originatorcode, $replaygain) {
+		if ($replaygain < 0) {
+			$signbit = '1';
+		} else {
+			$signbit = '0';
+		}
+		$storedreplaygain = intval(round($replaygain * 10));
+		$gainstring  = str_pad(decbin($namecode), 3, '0', STR_PAD_LEFT);
+		$gainstring .= str_pad(decbin($originatorcode), 3, '0', STR_PAD_LEFT);
+		$gainstring .= $signbit;
+		$gainstring .= str_pad(decbin($storedreplaygain), 9, '0', STR_PAD_LEFT);
+
+		return $gainstring;
+	}
+
+	public static function RGADamplitude2dB($amplitude) {
+		return 20 * log10($amplitude);
+	}
+
+
+	public static function GetDataImageSize($imgData, &$imageinfo=array()) {
+		static $tempdir = '';
+		if (empty($tempdir)) {
+			// yes this is ugly, feel free to suggest a better way
+			require_once(dirname(__FILE__).'/getid3.php');
+			$getid3_temp = new getID3();
+			$tempdir = $getid3_temp->tempdir;
+			unset($getid3_temp);
+		}
+		$GetDataImageSize = false;
+		if ($tempfilename = tempnam($tempdir, 'gI3')) {
+			if (is_writable($tempfilename) && is_file($tempfilename) && ($tmp = fopen($tempfilename, 'wb'))) {
+				fwrite($tmp, $imgData);
+				fclose($tmp);
+				$GetDataImageSize = @getimagesize($tempfilename, $imageinfo);
+			}
+			unlink($tempfilename);
+		}
+		return $GetDataImageSize;
+	}
+
+	public static function ImageExtFromMime($mime_type) {
+		// temporary way, works OK for now, but should be reworked in the future
+		return str_replace(array('image/', 'x-', 'jpeg'), array('', '', 'jpg'), $mime_type);
+	}
+
+	public static function ImageTypesLookup($imagetypeid) {
+		static $ImageTypesLookup = array();
+		if (empty($ImageTypesLookup)) {
+			$ImageTypesLookup[1]  = 'gif';
+			$ImageTypesLookup[2]  = 'jpeg';
+			$ImageTypesLookup[3]  = 'png';
+			$ImageTypesLookup[4]  = 'swf';
+			$ImageTypesLookup[5]  = 'psd';
+			$ImageTypesLookup[6]  = 'bmp';
+			$ImageTypesLookup[7]  = 'tiff (little-endian)';
+			$ImageTypesLookup[8]  = 'tiff (big-endian)';
+			$ImageTypesLookup[9]  = 'jpc';
+			$ImageTypesLookup[10] = 'jp2';
+			$ImageTypesLookup[11] = 'jpx';
+			$ImageTypesLookup[12] = 'jb2';
+			$ImageTypesLookup[13] = 'swc';
+			$ImageTypesLookup[14] = 'iff';
+		}
+		return (isset($ImageTypesLookup[$imagetypeid]) ? $ImageTypesLookup[$imagetypeid] : '');
+	}
+
+	public static function CopyTagsToComments(&$ThisFileInfo) {
+
+		// Copy all entries from ['tags'] into common ['comments']
+		if (!empty($ThisFileInfo['tags'])) {
+			foreach ($ThisFileInfo['tags'] as $tagtype => $tagarray) {
+				foreach ($tagarray as $tagname => $tagdata) {
+					foreach ($tagdata as $key => $value) {
+						if (!empty($value)) {
+							if (empty($ThisFileInfo['comments'][$tagname])) {
+
+								// fall through and append value
+
+							} elseif ($tagtype == 'id3v1') {
+
+								$newvaluelength = strlen(trim($value));
+								foreach ($ThisFileInfo['comments'][$tagname] as $existingkey => $existingvalue) {
+									$oldvaluelength = strlen(trim($existingvalue));
+									if (($newvaluelength <= $oldvaluelength) && (substr($existingvalue, 0, $newvaluelength) == trim($value))) {
+										// new value is identical but shorter-than (or equal-length to) one already in comments - skip
+										break 2;
+									}
+								}
+
+							} elseif (!is_array($value)) {
+
+								$newvaluelength = strlen(trim($value));
+								foreach ($ThisFileInfo['comments'][$tagname] as $existingkey => $existingvalue) {
+									$oldvaluelength = strlen(trim($existingvalue));
+									if (($newvaluelength > $oldvaluelength) && (substr(trim($value), 0, strlen($existingvalue)) == $existingvalue)) {
+										$ThisFileInfo['comments'][$tagname][$existingkey] = trim($value);
+										break 2;
+									}
+								}
+
+							}
+							if (is_array($value) || empty($ThisFileInfo['comments'][$tagname]) || !in_array(trim($value), $ThisFileInfo['comments'][$tagname])) {
+								$value = (is_string($value) ? trim($value) : $value);
+								$ThisFileInfo['comments'][$tagname][] = $value;
+							}
+						}
+					}
+				}
+			}
+
+			// Copy to ['comments_html']
+			foreach ($ThisFileInfo['comments'] as $field => $values) {
+				if ($field == 'picture') {
+					// pictures can take up a lot of space, and we don't need multiple copies of them
+					// let there be a single copy in [comments][picture], and not elsewhere
+					continue;
+				}
+				foreach ($values as $index => $value) {
+					if (is_array($value)) {
+						$ThisFileInfo['comments_html'][$field][$index] = $value;
+					} else {
+						$ThisFileInfo['comments_html'][$field][$index] = str_replace('&#0;', '', self::MultiByteCharString2HTML($value, $ThisFileInfo['encoding']));
+					}
+				}
+			}
+		}
+		return true;
+	}
+
+
+	public static function EmbeddedLookup($key, $begin, $end, $file, $name) {
+
+		// Cached
+		static $cache;
+		if (isset($cache[$file][$name])) {
+			return (isset($cache[$file][$name][$key]) ? $cache[$file][$name][$key] : '');
+		}
+
+		// Init
+		$keylength  = strlen($key);
+		$line_count = $end - $begin - 7;
+
+		// Open php file
+		$fp = fopen($file, 'r');
+
+		// Discard $begin lines
+		for ($i = 0; $i < ($begin + 3); $i++) {
+			fgets($fp, 1024);
+		}
+
+		// Loop thru line
+		while (0 < $line_count--) {
+
+			// Read line
+			$line = ltrim(fgets($fp, 1024), "\t ");
+
+			// METHOD A: only cache the matching key - less memory but slower on next lookup of not-previously-looked-up key
+			//$keycheck = substr($line, 0, $keylength);
+			//if ($key == $keycheck)  {
+			//	$cache[$file][$name][$keycheck] = substr($line, $keylength + 1);
+			//	break;
+			//}
+
+			// METHOD B: cache all keys in this lookup - more memory but faster on next lookup of not-previously-looked-up key
+			//$cache[$file][$name][substr($line, 0, $keylength)] = trim(substr($line, $keylength + 1));
+			$explodedLine = explode("\t", $line, 2);
+			$ThisKey   = (isset($explodedLine[0]) ? $explodedLine[0] : '');
+			$ThisValue = (isset($explodedLine[1]) ? $explodedLine[1] : '');
+			$cache[$file][$name][$ThisKey] = trim($ThisValue);
+		}
+
+		// Close and return
+		fclose($fp);
+		return (isset($cache[$file][$name][$key]) ? $cache[$file][$name][$key] : '');
+	}
+
+	public static function IncludeDependency($filename, $sourcefile, $DieOnFailure=false) {
+		global $GETID3_ERRORARRAY;
+
+		if (file_exists($filename)) {
+			if (include_once($filename)) {
+				return true;
+			} else {
+				$diemessage = basename($sourcefile).' depends on '.$filename.', which has errors';
+			}
+		} else {
+			$diemessage = basename($sourcefile).' depends on '.$filename.', which is missing';
+		}
+		if ($DieOnFailure) {
+			throw new Exception($diemessage);
+		} else {
+			$GETID3_ERRORARRAY[] = $diemessage;
+		}
+		return false;
+	}
+
+	public static function trimNullByte($string) {
+		return trim($string, "\x00");
+	}
+
+	public static function getFileSizeSyscall($path) {
+		$filesize = false;
+
+		if (GETID3_OS_ISWINDOWS) {
+			if (class_exists('COM')) { // From PHP 5.3.15 and 5.4.5, COM and DOTNET is no longer built into the php core.you have to add COM support in php.ini:
+				$filesystem = new COM('Scripting.FileSystemObject');
+				$file = $filesystem->GetFile($path);
+				$filesize = $file->Size();
+				unset($filesystem, $file);
+			} else {
+				$commandline = 'for %I in ('.escapeshellarg($path).') do @echo %~zI';
+			}
+		} else {
+			$commandline = 'ls -l '.escapeshellarg($path).' | awk \'{print $5}\'';
+		}
+		if (isset($commandline)) {
+			$output = trim(`$commandline`);
+			if (ctype_digit($output)) {
+				$filesize = (float) $output;
+			}
+		}
+		return $filesize;
+	}
+
+}
Index: /extensions/piwigo_videojs/include/getid3/getid3.php
===================================================================
--- /extensions/piwigo_videojs/include/getid3/getid3.php	(revision 24676)
+++ /extensions/piwigo_videojs/include/getid3/getid3.php	(revision 24676)
@@ -0,0 +1,1776 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// Please see readme.txt for more information                  //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+// define a constant rather than looking up every time it is needed
+if (!defined('GETID3_OS_ISWINDOWS')) {
+	define('GETID3_OS_ISWINDOWS', (stripos(PHP_OS, 'WIN') === 0));
+}
+// Get base path of getID3() - ONCE
+if (!defined('GETID3_INCLUDEPATH')) {
+	define('GETID3_INCLUDEPATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
+}
+
+// attempt to define temp dir as something flexible but reliable
+$temp_dir = ini_get('upload_tmp_dir');
+if ($temp_dir && (!is_dir($temp_dir) || !is_readable($temp_dir))) {
+	$temp_dir = '';
+}
+if (!$temp_dir && function_exists('sys_get_temp_dir')) {
+	// PHP v5.2.1+
+	// sys_get_temp_dir() may give inaccessible temp dir, e.g. with open_basedir on virtual hosts
+	$temp_dir = sys_get_temp_dir();
+}
+$temp_dir = realpath($temp_dir);
+$open_basedir = ini_get('open_basedir');
+if ($open_basedir) {
+	// e.g. "/var/www/vhosts/getid3.org/httpdocs/:/tmp/"
+	$temp_dir     = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $temp_dir);
+	$open_basedir = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $open_basedir);
+	if (substr($temp_dir, -1, 1) != DIRECTORY_SEPARATOR) {
+		$temp_dir .= DIRECTORY_SEPARATOR;
+	}
+	$found_valid_tempdir = false;
+	$open_basedirs = explode(PATH_SEPARATOR, $open_basedir);
+	foreach ($open_basedirs as $basedir) {
+		if (substr($basedir, -1, 1) != DIRECTORY_SEPARATOR) {
+			$basedir .= DIRECTORY_SEPARATOR;
+		}
+		if (preg_match('#^'.preg_quote($basedir).'#', $temp_dir)) {
+			$found_valid_tempdir = true;
+			break;
+		}
+	}
+	if (!$found_valid_tempdir) {
+		$temp_dir = '';
+	}
+	unset($open_basedirs, $found_valid_tempdir, $basedir);
+}
+if (!$temp_dir) {
+	$temp_dir = '*'; // invalid directory name should force tempnam() to use system default temp dir
+}
+// $temp_dir = '/something/else/';  // feel free to override temp dir here if it works better for your system
+define('GETID3_TEMP_DIR', $temp_dir);
+unset($open_basedir, $temp_dir);
+
+// End: Defines
+
+
+class getID3
+{
+	// public: Settings
+	public $encoding        = 'UTF-8';        // CASE SENSITIVE! - i.e. (must be supported by iconv()). Examples:  ISO-8859-1  UTF-8  UTF-16  UTF-16BE
+	public $encoding_id3v1  = 'ISO-8859-1';   // Should always be 'ISO-8859-1', but some tags may be written in other encodings such as 'EUC-CN' or 'CP1252'
+
+	// public: Optional tag checks - disable for speed.
+	public $option_tag_id3v1         = true;  // Read and process ID3v1 tags
+	public $option_tag_id3v2         = true;  // Read and process ID3v2 tags
+	public $option_tag_lyrics3       = true;  // Read and process Lyrics3 tags
+	public $option_tag_apetag        = true;  // Read and process APE tags
+	public $option_tags_process      = true;  // Copy tags to root key 'tags' and encode to $this->encoding
+	public $option_tags_html         = true;  // Copy tags to root key 'tags_html' properly translated from various encodings to HTML entities
+
+	// public: Optional tag/comment calucations
+	public $option_extra_info        = true;  // Calculate additional info such as bitrate, channelmode etc
+
+	// public: Optional handling of embedded attachments (e.g. images)
+	public $option_save_attachments  = true; // defaults to true (ATTACHMENTS_INLINE) for backward compatibility
+
+	// public: Optional calculations
+	public $option_md5_data          = false; // Get MD5 sum of data part - slow
+	public $option_md5_data_source   = false; // Use MD5 of source file if availble - only FLAC and OptimFROG
+	public $option_sha1_data         = false; // Get SHA1 sum of data part - slow
+	public $option_max_2gb_check     = null;  // Check whether file is larger than 2GB and thus not supported by 32-bit PHP (null: auto-detect based on PHP_INT_MAX)
+
+	// public: Read buffer size in bytes
+	public $option_fread_buffer_size = 32768;
+
+	// Public variables
+	public $filename;                         // Filename of file being analysed.
+	public $fp;                               // Filepointer to file being analysed.
+	public $info;                             // Result array.
+	public $tempdir = GETID3_TEMP_DIR;
+
+	// Protected variables
+	protected $startup_error   = '';
+	protected $startup_warning = '';
+	protected $memory_limit    = 0;
+
+	const VERSION           = '1.9.5-20130220';
+	const FREAD_BUFFER_SIZE = 32768;
+
+	const ATTACHMENTS_NONE   = false;
+	const ATTACHMENTS_INLINE = true;
+
+	// public: constructor
+	public function __construct() {
+
+		// Check for PHP version
+		$required_php_version = '5.0.5';
+		if (version_compare(PHP_VERSION, $required_php_version, '<')) {
+			$this->startup_error .= 'getID3() requires PHP v'.$required_php_version.' or higher - you are running v'.PHP_VERSION;
+			return false;
+		}
+
+		// Check memory
+		$this->memory_limit = ini_get('memory_limit');
+		if (preg_match('#([0-9]+)M#i', $this->memory_limit, $matches)) {
+			// could be stored as "16M" rather than 16777216 for example
+			$this->memory_limit = $matches[1] * 1048576;
+		} elseif (preg_match('#([0-9]+)G#i', $this->memory_limit, $matches)) { // The 'G' modifier is available since PHP 5.1.0
+			// could be stored as "2G" rather than 2147483648 for example
+			$this->memory_limit = $matches[1] * 1073741824;
+		}
+		if ($this->memory_limit <= 0) {
+			// memory limits probably disabled
+		} elseif ($this->memory_limit <= 4194304) {
+			$this->startup_error .= 'PHP has less than 4MB available memory and will very likely run out. Increase memory_limit in php.ini';
+		} elseif ($this->memory_limit <= 12582912) {
+			$this->startup_warning .= 'PHP has less than 12MB available memory and might run out if all modules are loaded. Increase memory_limit in php.ini';
+		}
+
+		// Check safe_mode off
+		if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) {
+			$this->warning('WARNING: Safe mode is on, shorten support disabled, md5data/sha1data for ogg vorbis disabled, ogg vorbos/flac tag writing disabled.');
+		}
+
+		if (intval(ini_get('mbstring.func_overload')) > 0) {
+			$this->warning('WARNING: php.ini contains "mbstring.func_overload = '.ini_get('mbstring.func_overload').'", this may break things.');
+		}
+
+		// Check for magic_quotes_runtime
+		if (function_exists('get_magic_quotes_runtime')) {
+			if (get_magic_quotes_runtime()) {
+				return $this->startup_error('magic_quotes_runtime must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_runtime(0) and set_magic_quotes_runtime(1).');
+			}
+		}
+
+		// Check for magic_quotes_gpc
+		if (function_exists('magic_quotes_gpc')) {
+			if (get_magic_quotes_gpc()) {
+				return $this->startup_error('magic_quotes_gpc must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_gpc(0) and set_magic_quotes_gpc(1).');
+			}
+		}
+
+		// Load support library
+		if (!include_once(GETID3_INCLUDEPATH.'getid3.lib.php')) {
+			$this->startup_error .= 'getid3.lib.php is missing or corrupt';
+		}
+
+		if ($this->option_max_2gb_check === null) {
+			$this->option_max_2gb_check = (PHP_INT_MAX <= 2147483647);
+		}
+
+
+		// Needed for Windows only:
+		// Define locations of helper applications for Shorten, VorbisComment, MetaFLAC
+		//   as well as other helper functions such as head, tail, md5sum, etc
+		// This path cannot contain spaces, but the below code will attempt to get the
+		//   8.3-equivalent path automatically
+		// IMPORTANT: This path must include the trailing slash
+		if (GETID3_OS_ISWINDOWS && !defined('GETID3_HELPERAPPSDIR')) {
+
+			$helperappsdir = GETID3_INCLUDEPATH.'..'.DIRECTORY_SEPARATOR.'helperapps'; // must not have any space in this path
+
+			if (!is_dir($helperappsdir)) {
+				$this->startup_warning .= '"'.$helperappsdir.'" cannot be defined as GETID3_HELPERAPPSDIR because it does not exist';
+			} elseif (strpos(realpath($helperappsdir), ' ') !== false) {
+				$DirPieces = explode(DIRECTORY_SEPARATOR, realpath($helperappsdir));
+				$path_so_far = array();
+				foreach ($DirPieces as $key => $value) {
+					if (strpos($value, ' ') !== false) {
+						if (!empty($path_so_far)) {
+							$commandline = 'dir /x '.escapeshellarg(implode(DIRECTORY_SEPARATOR, $path_so_far));
+							$dir_listing = `$commandline`;
+							$lines = explode("\n", $dir_listing);
+							foreach ($lines as $line) {
+								$line = trim($line);
+								if (preg_match('#^([0-9/]{10}) +([0-9:]{4,5}( [AP]M)?) +(<DIR>|[0-9,]+) +([^ ]{0,11}) +(.+)$#', $line, $matches)) {
+									list($dummy, $date, $time, $ampm, $filesize, $shortname, $filename) = $matches;
+									if ((strtoupper($filesize) == '<DIR>') && (strtolower($filename) == strtolower($value))) {
+										$value = $shortname;
+									}
+								}
+							}
+						} else {
+							$this->startup_warning .= 'GETID3_HELPERAPPSDIR must not have any spaces in it - use 8dot3 naming convention if neccesary. You can run "dir /x" from the commandline to see the correct 8.3-style names.';
+						}
+					}
+					$path_so_far[] = $value;
+				}
+				$helperappsdir = implode(DIRECTORY_SEPARATOR, $path_so_far);
+			}
+			define('GETID3_HELPERAPPSDIR', $helperappsdir.DIRECTORY_SEPARATOR);
+		}
+
+		return true;
+	}
+
+	public function version() {
+		return self::VERSION;
+	}
+
+	public function fread_buffer_size() {
+		return $this->option_fread_buffer_size;
+	}
+
+
+	// public: setOption
+	public function setOption($optArray) {
+		if (!is_array($optArray) || empty($optArray)) {
+			return false;
+		}
+		foreach ($optArray as $opt => $val) {
+			if (isset($this->$opt) === false) {
+				continue;
+			}
+			$this->$opt = $val;
+		}
+		return true;
+	}
+
+
+	public function openfile($filename) {
+		try {
+			if (!empty($this->startup_error)) {
+				throw new getid3_exception($this->startup_error);
+			}
+			if (!empty($this->startup_warning)) {
+				$this->warning($this->startup_warning);
+			}
+
+			// init result array and set parameters
+			$this->filename = $filename;
+			$this->info = array();
+			$this->info['GETID3_VERSION']   = $this->version();
+			$this->info['php_memory_limit'] = $this->memory_limit;
+
+			// remote files not supported
+			if (preg_match('/^(ht|f)tp:\/\//', $filename)) {
+				throw new getid3_exception('Remote files are not supported - please copy the file locally first');
+			}
+
+			$filename = str_replace('/', DIRECTORY_SEPARATOR, $filename);
+			$filename = preg_replace('#(.+)'.preg_quote(DIRECTORY_SEPARATOR).'{2,}#U', '\1'.DIRECTORY_SEPARATOR, $filename);
+
+			// open local file
+			if (is_readable($filename) && is_file($filename) && ($this->fp = fopen($filename, 'rb'))) {
+				// great
+			} else {
+				throw new getid3_exception('Could not open "'.$filename.'" (does not exist, or is not a file)');
+			}
+
+			$this->info['filesize'] = filesize($filename);
+			// set redundant parameters - might be needed in some include file
+			$this->info['filename']     = basename($filename);
+			$this->info['filepath']     = str_replace('\\', '/', realpath(dirname($filename)));
+			$this->info['filenamepath'] = $this->info['filepath'].'/'.$this->info['filename'];
+
+
+			// option_max_2gb_check
+			if ($this->option_max_2gb_check) {
+				// PHP (32-bit all, and 64-bit Windows) doesn't support integers larger than 2^31 (~2GB)
+				// filesize() simply returns (filesize % (pow(2, 32)), no matter the actual filesize
+				// ftell() returns 0 if seeking to the end is beyond the range of unsigned integer
+				$fseek = fseek($this->fp, 0, SEEK_END);
+				if (($fseek < 0) || (($this->info['filesize'] != 0) && (ftell($this->fp) == 0)) ||
+					($this->info['filesize'] < 0) ||
+					(ftell($this->fp) < 0)) {
+						$real_filesize = getid3_lib::getFileSizeSyscall($this->info['filenamepath']);
+
+						if ($real_filesize === false) {
+							unset($this->info['filesize']);
+							fclose($this->fp);
+							throw new getid3_exception('Unable to determine actual filesize. File is most likely larger than '.round(PHP_INT_MAX / 1073741824).'GB and is not supported by PHP.');
+						} elseif (getid3_lib::intValueSupported($real_filesize)) {
+							unset($this->info['filesize']);
+							fclose($this->fp);
+							throw new getid3_exception('PHP seems to think the file is larger than '.round(PHP_INT_MAX / 1073741824).'GB, but filesystem reports it as '.number_format($real_filesize, 3).'GB, please report to info@getid3.org');
+						}
+						$this->info['filesize'] = $real_filesize;
+						$this->error('File is larger than '.round(PHP_INT_MAX / 1073741824).'GB (filesystem reports it as '.number_format($real_filesize, 3).'GB) and is not properly supported by PHP.');
+				}
+			}
+
+			// set more parameters
+			$this->info['avdataoffset']        = 0;
+			$this->info['avdataend']           = $this->info['filesize'];
+			$this->info['fileformat']          = '';                // filled in later
+			$this->info['audio']['dataformat'] = '';                // filled in later, unset if not used
+			$this->info['video']['dataformat'] = '';                // filled in later, unset if not used
+			$this->info['tags']                = array();           // filled in later, unset if not used
+			$this->info['error']               = array();           // filled in later, unset if not used
+			$this->info['warning']             = array();           // filled in later, unset if not used
+			$this->info['comments']            = array();           // filled in later, unset if not used
+			$this->info['encoding']            = $this->encoding;   // required by id3v2 and iso modules - can be unset at the end if desired
+
+			return true;
+
+		} catch (Exception $e) {
+			$this->error($e->getMessage());
+		}
+		return false;
+	}
+
+	// public: analyze file
+	public function analyze($filename) {
+		try {
+			if (!$this->openfile($filename)) {
+				return $this->info;
+			}
+
+			// Handle tags
+			foreach (array('id3v2'=>'id3v2', 'id3v1'=>'id3v1', 'apetag'=>'ape', 'lyrics3'=>'lyrics3') as $tag_name => $tag_key) {
+				$option_tag = 'option_tag_'.$tag_name;
+				if ($this->$option_tag) {
+					$this->include_module('tag.'.$tag_name);
+					try {
+						$tag_class = 'getid3_'.$tag_name;
+						$tag = new $tag_class($this);
+						$tag->Analyze();
+					}
+					catch (getid3_exception $e) {
+						throw $e;
+					}
+				}
+			}
+			if (isset($this->info['id3v2']['tag_offset_start'])) {
+				$this->info['avdataoffset'] = max($this->info['avdataoffset'], $this->info['id3v2']['tag_offset_end']);
+			}
+			foreach (array('id3v1'=>'id3v1', 'apetag'=>'ape', 'lyrics3'=>'lyrics3') as $tag_name => $tag_key) {
+				if (isset($this->info[$tag_key]['tag_offset_start'])) {
+					$this->info['avdataend'] = min($this->info['avdataend'], $this->info[$tag_key]['tag_offset_start']);
+				}
+			}
+
+			// ID3v2 detection (NOT parsing), even if ($this->option_tag_id3v2 == false) done to make fileformat easier
+			if (!$this->option_tag_id3v2) {
+				fseek($this->fp, 0, SEEK_SET);
+				$header = fread($this->fp, 10);
+				if ((substr($header, 0, 3) == 'ID3') && (strlen($header) == 10)) {
+					$this->info['id3v2']['header']        = true;
+					$this->info['id3v2']['majorversion']  = ord($header{3});
+					$this->info['id3v2']['minorversion']  = ord($header{4});
+					$this->info['avdataoffset']          += getid3_lib::BigEndian2Int(substr($header, 6, 4), 1) + 10; // length of ID3v2 tag in 10-byte header doesn't include 10-byte header length
+				}
+			}
+
+			// read 32 kb file data
+			fseek($this->fp, $this->info['avdataoffset'], SEEK_SET);
+			$formattest = fread($this->fp, 32774);
+
+			// determine format
+			$determined_format = $this->GetFileFormat($formattest, $filename);
+
+			// unable to determine file format
+			if (!$determined_format) {
+				fclose($this->fp);
+				return $this->error('unable to determine file format');
+			}
+
+			// check for illegal ID3 tags
+			if (isset($determined_format['fail_id3']) && (in_array('id3v1', $this->info['tags']) || in_array('id3v2', $this->info['tags']))) {
+				if ($determined_format['fail_id3'] === 'ERROR') {
+					fclose($this->fp);
+					return $this->error('ID3 tags not allowed on this file type.');
+				} elseif ($determined_format['fail_id3'] === 'WARNING') {
+					$this->warning('ID3 tags not allowed on this file type.');
+				}
+			}
+
+			// check for illegal APE tags
+			if (isset($determined_format['fail_ape']) && in_array('ape', $this->info['tags'])) {
+				if ($determined_format['fail_ape'] === 'ERROR') {
+					fclose($this->fp);
+					return $this->error('APE tags not allowed on this file type.');
+				} elseif ($determined_format['fail_ape'] === 'WARNING') {
+					$this->warning('APE tags not allowed on this file type.');
+				}
+			}
+
+			// set mime type
+			$this->info['mime_type'] = $determined_format['mime_type'];
+
+			// supported format signature pattern detected, but module deleted
+			if (!file_exists(GETID3_INCLUDEPATH.$determined_format['include'])) {
+				fclose($this->fp);
+				return $this->error('Format not supported, module "'.$determined_format['include'].'" was removed.');
+			}
+
+			// module requires iconv support
+			// Check encoding/iconv support
+			if (!empty($determined_format['iconv_req']) && !function_exists('iconv') && !in_array($this->encoding, array('ISO-8859-1', 'UTF-8', 'UTF-16LE', 'UTF-16BE', 'UTF-16'))) {
+				$errormessage = 'iconv() support is required for this module ('.$determined_format['include'].') for encodings other than ISO-8859-1, UTF-8, UTF-16LE, UTF16-BE, UTF-16. ';
+				if (GETID3_OS_ISWINDOWS) {
+					$errormessage .= 'PHP does not have iconv() support. Please enable php_iconv.dll in php.ini, and copy iconv.dll from c:/php/dlls to c:/windows/system32';
+				} else {
+					$errormessage .= 'PHP is not compiled with iconv() support. Please recompile with the --with-iconv switch';
+				}
+				return $this->error($errormessage);
+			}
+
+			// include module
+			include_once(GETID3_INCLUDEPATH.$determined_format['include']);
+
+			// instantiate module class
+			$class_name = 'getid3_'.$determined_format['module'];
+			if (!class_exists($class_name)) {
+				return $this->error('Format not supported, module "'.$determined_format['include'].'" is corrupt.');
+			}
+			$class = new $class_name($this);
+			$class->Analyze();
+			unset($class);
+
+			// close file
+			fclose($this->fp);
+
+			// process all tags - copy to 'tags' and convert charsets
+			if ($this->option_tags_process) {
+				$this->HandleAllTags();
+			}
+
+			// perform more calculations
+			if ($this->option_extra_info) {
+				$this->ChannelsBitratePlaytimeCalculations();
+				$this->CalculateCompressionRatioVideo();
+				$this->CalculateCompressionRatioAudio();
+				$this->CalculateReplayGain();
+				$this->ProcessAudioStreams();
+			}
+
+			// get the MD5 sum of the audio/video portion of the file - without ID3/APE/Lyrics3/etc header/footer tags
+			if ($this->option_md5_data) {
+				// do not calc md5_data if md5_data_source is present - set by flac only - future MPC/SV8 too
+				if (!$this->option_md5_data_source || empty($this->info['md5_data_source'])) {
+					$this->getHashdata('md5');
+				}
+			}
+
+			// get the SHA1 sum of the audio/video portion of the file - without ID3/APE/Lyrics3/etc header/footer tags
+			if ($this->option_sha1_data) {
+				$this->getHashdata('sha1');
+			}
+
+			// remove undesired keys
+			$this->CleanUp();
+
+		} catch (Exception $e) {
+			$this->error('Caught exception: '.$e->getMessage());
+		}
+
+		// return info array
+		return $this->info;
+	}
+
+
+	// private: error handling
+	public function error($message) {
+		$this->CleanUp();
+		if (!isset($this->info['error'])) {
+			$this->info['error'] = array();
+		}
+		$this->info['error'][] = $message;
+		return $this->info;
+	}
+
+
+	// private: warning handling
+	public function warning($message) {
+		$this->info['warning'][] = $message;
+		return true;
+	}
+
+
+	// private: CleanUp
+	private function CleanUp() {
+
+		// remove possible empty keys
+		$AVpossibleEmptyKeys = array('dataformat', 'bits_per_sample', 'encoder_options', 'streams', 'bitrate');
+		foreach ($AVpossibleEmptyKeys as $dummy => $key) {
+			if (empty($this->info['audio'][$key]) && isset($this->info['audio'][$key])) {
+				unset($this->info['audio'][$key]);
+			}
+			if (empty($this->info['video'][$key]) && isset($this->info['video'][$key])) {
+				unset($this->info['video'][$key]);
+			}
+		}
+
+		// remove empty root keys
+		if (!empty($this->info)) {
+			foreach ($this->info as $key => $value) {
+				if (empty($this->info[$key]) && ($this->info[$key] !== 0) && ($this->info[$key] !== '0')) {
+					unset($this->info[$key]);
+				}
+			}
+		}
+
+		// remove meaningless entries from unknown-format files
+		if (empty($this->info['fileformat'])) {
+			if (isset($this->info['avdataoffset'])) {
+				unset($this->info['avdataoffset']);
+			}
+			if (isset($this->info['avdataend'])) {
+				unset($this->info['avdataend']);
+			}
+		}
+
+		// remove possible duplicated identical entries
+		if (!empty($this->info['error'])) {
+			$this->info['error'] = array_values(array_unique($this->info['error']));
+		}
+		if (!empty($this->info['warning'])) {
+			$this->info['warning'] = array_values(array_unique($this->info['warning']));
+		}
+
+		// remove "global variable" type keys
+		unset($this->info['php_memory_limit']);
+
+		return true;
+	}
+
+
+	// return array containing information about all supported formats
+	public function GetFileFormatArray() {
+		static $format_info = array();
+		if (empty($format_info)) {
+			$format_info = array(
+
+				// Audio formats
+
+				// AC-3   - audio      - Dolby AC-3 / Dolby Digital
+				'ac3'  => array(
+							'pattern'   => '^\x0B\x77',
+							'group'     => 'audio',
+							'module'    => 'ac3',
+							'mime_type' => 'audio/ac3',
+						),
+
+				// AAC  - audio       - Advanced Audio Coding (AAC) - ADIF format
+				'adif' => array(
+							'pattern'   => '^ADIF',
+							'group'     => 'audio',
+							'module'    => 'aac',
+							'mime_type' => 'application/octet-stream',
+							'fail_ape'  => 'WARNING',
+						),
+
+/*
+				// AA   - audio       - Audible Audiobook
+				'aa'   => array(
+							'pattern'   => '^.{4}\x57\x90\x75\x36',
+							'group'     => 'audio',
+							'module'    => 'aa',
+							'mime_type' => 'audio/audible',
+						),
+*/
+				// AAC  - audio       - Advanced Audio Coding (AAC) - ADTS format (very similar to MP3)
+				'adts' => array(
+							'pattern'   => '^\xFF[\xF0-\xF1\xF8-\xF9]',
+							'group'     => 'audio',
+							'module'    => 'aac',
+							'mime_type' => 'application/octet-stream',
+							'fail_ape'  => 'WARNING',
+						),
+
+
+				// AU   - audio       - NeXT/Sun AUdio (AU)
+				'au'   => array(
+							'pattern'   => '^\.snd',
+							'group'     => 'audio',
+							'module'    => 'au',
+							'mime_type' => 'audio/basic',
+						),
+
+				// AVR  - audio       - Audio Visual Research
+				'avr'  => array(
+							'pattern'   => '^2BIT',
+							'group'     => 'audio',
+							'module'    => 'avr',
+							'mime_type' => 'application/octet-stream',
+						),
+
+				// BONK - audio       - Bonk v0.9+
+				'bonk' => array(
+							'pattern'   => '^\x00(BONK|INFO|META| ID3)',
+							'group'     => 'audio',
+							'module'    => 'bonk',
+							'mime_type' => 'audio/xmms-bonk',
+						),
+
+				// DSS  - audio       - Digital Speech Standard
+				'dss'  => array(
+							'pattern'   => '^[\x02-\x03]ds[s2]',
+							'group'     => 'audio',
+							'module'    => 'dss',
+							'mime_type' => 'application/octet-stream',
+						),
+
+				// DTS  - audio       - Dolby Theatre System
+				'dts'  => array(
+							'pattern'   => '^\x7F\xFE\x80\x01',
+							'group'     => 'audio',
+							'module'    => 'dts',
+							'mime_type' => 'audio/dts',
+						),
+
+				// FLAC - audio       - Free Lossless Audio Codec
+				'flac' => array(
+							'pattern'   => '^fLaC',
+							'group'     => 'audio',
+							'module'    => 'flac',
+							'mime_type' => 'audio/x-flac',
+						),
+
+				// LA   - audio       - Lossless Audio (LA)
+				'la'   => array(
+							'pattern'   => '^LA0[2-4]',
+							'group'     => 'audio',
+							'module'    => 'la',
+							'mime_type' => 'application/octet-stream',
+						),
+
+				// LPAC - audio       - Lossless Predictive Audio Compression (LPAC)
+				'lpac' => array(
+							'pattern'   => '^LPAC',
+							'group'     => 'audio',
+							'module'    => 'lpac',
+							'mime_type' => 'application/octet-stream',
+						),
+
+				// MIDI - audio       - MIDI (Musical Instrument Digital Interface)
+				'midi' => array(
+							'pattern'   => '^MThd',
+							'group'     => 'audio',
+							'module'    => 'midi',
+							'mime_type' => 'audio/midi',
+						),
+
+				// MAC  - audio       - Monkey's Audio Compressor
+				'mac'  => array(
+							'pattern'   => '^MAC ',
+							'group'     => 'audio',
+							'module'    => 'monkey',
+							'mime_type' => 'application/octet-stream',
+						),
+
+// has been known to produce false matches in random files (e.g. JPEGs), leave out until more precise matching available
+//				// MOD  - audio       - MODule (assorted sub-formats)
+//				'mod'  => array(
+//							'pattern'   => '^.{1080}(M\\.K\\.|M!K!|FLT4|FLT8|[5-9]CHN|[1-3][0-9]CH)',
+//							'group'     => 'audio',
+//							'module'    => 'mod',
+//							'option'    => 'mod',
+//							'mime_type' => 'audio/mod',
+//						),
+
+				// MOD  - audio       - MODule (Impulse Tracker)
+				'it'   => array(
+							'pattern'   => '^IMPM',
+							'group'     => 'audio',
+							'module'    => 'mod',
+							//'option'    => 'it',
+							'mime_type' => 'audio/it',
+						),
+
+				// MOD  - audio       - MODule (eXtended Module, various sub-formats)
+				'xm'   => array(
+							'pattern'   => '^Extended Module',
+							'group'     => 'audio',
+							'module'    => 'mod',
+							//'option'    => 'xm',
+							'mime_type' => 'audio/xm',
+						),
+
+				// MOD  - audio       - MODule (ScreamTracker)
+				's3m'  => array(
+							'pattern'   => '^.{44}SCRM',
+							'group'     => 'audio',
+							'module'    => 'mod',
+							//'option'    => 's3m',
+							'mime_type' => 'audio/s3m',
+						),
+
+				// MPC  - audio       - Musepack / MPEGplus
+				'mpc'  => array(
+							'pattern'   => '^(MPCK|MP\+|[\x00\x01\x10\x11\x40\x41\x50\x51\x80\x81\x90\x91\xC0\xC1\xD0\xD1][\x20-37][\x00\x20\x40\x60\x80\xA0\xC0\xE0])',
+							'group'     => 'audio',
+							'module'    => 'mpc',
+							'mime_type' => 'audio/x-musepack',
+						),
+
+				// MP3  - audio       - MPEG-audio Layer 3 (very similar to AAC-ADTS)
+				'mp3'  => array(
+							'pattern'   => '^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\x0B\x10-\x1B\x20-\x2B\x30-\x3B\x40-\x4B\x50-\x5B\x60-\x6B\x70-\x7B\x80-\x8B\x90-\x9B\xA0-\xAB\xB0-\xBB\xC0-\xCB\xD0-\xDB\xE0-\xEB\xF0-\xFB]',
+							'group'     => 'audio',
+							'module'    => 'mp3',
+							'mime_type' => 'audio/mpeg',
+						),
+
+				// OFR  - audio       - OptimFROG
+				'ofr'  => array(
+							'pattern'   => '^(\*RIFF|OFR)',
+							'group'     => 'audio',
+							'module'    => 'optimfrog',
+							'mime_type' => 'application/octet-stream',
+						),
+
+				// RKAU - audio       - RKive AUdio compressor
+				'rkau' => array(
+							'pattern'   => '^RKA',
+							'group'     => 'audio',
+							'module'    => 'rkau',
+							'mime_type' => 'application/octet-stream',
+						),
+
+				// SHN  - audio       - Shorten
+				'shn'  => array(
+							'pattern'   => '^ajkg',
+							'group'     => 'audio',
+							'module'    => 'shorten',
+							'mime_type' => 'audio/xmms-shn',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				// TTA  - audio       - TTA Lossless Audio Compressor (http://tta.corecodec.org)
+				'tta'  => array(
+							'pattern'   => '^TTA',  // could also be '^TTA(\x01|\x02|\x03|2|1)'
+							'group'     => 'audio',
+							'module'    => 'tta',
+							'mime_type' => 'application/octet-stream',
+						),
+
+				// VOC  - audio       - Creative Voice (VOC)
+				'voc'  => array(
+							'pattern'   => '^Creative Voice File',
+							'group'     => 'audio',
+							'module'    => 'voc',
+							'mime_type' => 'audio/voc',
+						),
+
+				// VQF  - audio       - transform-domain weighted interleave Vector Quantization Format (VQF)
+				'vqf'  => array(
+							'pattern'   => '^TWIN',
+							'group'     => 'audio',
+							'module'    => 'vqf',
+							'mime_type' => 'application/octet-stream',
+						),
+
+				// WV  - audio        - WavPack (v4.0+)
+				'wv'   => array(
+							'pattern'   => '^wvpk',
+							'group'     => 'audio',
+							'module'    => 'wavpack',
+							'mime_type' => 'application/octet-stream',
+						),
+
+
+				// Audio-Video formats
+
+				// ASF  - audio/video - Advanced Streaming Format, Windows Media Video, Windows Media Audio
+				'asf'  => array(
+							'pattern'   => '^\x30\x26\xB2\x75\x8E\x66\xCF\x11\xA6\xD9\x00\xAA\x00\x62\xCE\x6C',
+							'group'     => 'audio-video',
+							'module'    => 'asf',
+							'mime_type' => 'video/x-ms-asf',
+							'iconv_req' => false,
+						),
+
+				// BINK - audio/video - Bink / Smacker
+				'bink' => array(
+							'pattern'   => '^(BIK|SMK)',
+							'group'     => 'audio-video',
+							'module'    => 'bink',
+							'mime_type' => 'application/octet-stream',
+						),
+
+				// FLV  - audio/video - FLash Video
+				'flv' => array(
+							'pattern'   => '^FLV\x01',
+							'group'     => 'audio-video',
+							'module'    => 'flv',
+							'mime_type' => 'video/x-flv',
+						),
+
+				// MKAV - audio/video - Mastroka
+				'matroska' => array(
+							'pattern'   => '^\x1A\x45\xDF\xA3',
+							'group'     => 'audio-video',
+							'module'    => 'matroska',
+							'mime_type' => 'video/x-matroska', // may also be audio/x-matroska
+						),
+
+				// MPEG - audio/video - MPEG (Moving Pictures Experts Group)
+				'mpeg' => array(
+							'pattern'   => '^\x00\x00\x01(\xBA|\xB3)',
+							'group'     => 'audio-video',
+							'module'    => 'mpeg',
+							'mime_type' => 'video/mpeg',
+						),
+
+				// NSV  - audio/video - Nullsoft Streaming Video (NSV)
+				'nsv'  => array(
+							'pattern'   => '^NSV[sf]',
+							'group'     => 'audio-video',
+							'module'    => 'nsv',
+							'mime_type' => 'application/octet-stream',
+						),
+
+				// Ogg  - audio/video - Ogg (Ogg-Vorbis, Ogg-FLAC, Speex, Ogg-Theora(*), Ogg-Tarkin(*))
+				'ogg'  => array(
+							'pattern'   => '^OggS',
+							'group'     => 'audio',
+							'module'    => 'ogg',
+							'mime_type' => 'application/ogg',
+							'fail_id3'  => 'WARNING',
+							'fail_ape'  => 'WARNING',
+						),
+
+				// QT   - audio/video - Quicktime
+				'quicktime' => array(
+							'pattern'   => '^.{4}(cmov|free|ftyp|mdat|moov|pnot|skip|wide)',
+							'group'     => 'audio-video',
+							'module'    => 'quicktime',
+							'mime_type' => 'video/quicktime',
+						),
+
+				// RIFF - audio/video - Resource Interchange File Format (RIFF) / WAV / AVI / CD-audio / SDSS = renamed variant used by SmartSound QuickTracks (www.smartsound.com) / FORM = Audio Interchange File Format (AIFF)
+				'riff' => array(
+							'pattern'   => '^(RIFF|SDSS|FORM)',
+							'group'     => 'audio-video',
+							'module'    => 'riff',
+							'mime_type' => 'audio/x-wave',
+							'fail_ape'  => 'WARNING',
+						),
+
+				// Real - audio/video - RealAudio, RealVideo
+				'real' => array(
+							'pattern'   => '^(\\.RMF|\\.ra)',
+							'group'     => 'audio-video',
+							'module'    => 'real',
+							'mime_type' => 'audio/x-realaudio',
+						),
+
+				// SWF - audio/video - ShockWave Flash
+				'swf' => array(
+							'pattern'   => '^(F|C)WS',
+							'group'     => 'audio-video',
+							'module'    => 'swf',
+							'mime_type' => 'application/x-shockwave-flash',
+						),
+
+				// TS - audio/video - MPEG-2 Transport Stream
+				'ts' => array(
+							'pattern'   => '^(\x47.{187}){10,}', // packets are 188 bytes long and start with 0x47 "G".  Check for at least 10 packets matching this pattern
+							'group'     => 'audio-video',
+							'module'    => 'ts',
+							'mime_type' => 'video/MP2T',
+						),
+
+
+				// Still-Image formats
+
+				// BMP  - still image - Bitmap (Windows, OS/2; uncompressed, RLE8, RLE4)
+				'bmp'  => array(
+							'pattern'   => '^BM',
+							'group'     => 'graphic',
+							'module'    => 'bmp',
+							'mime_type' => 'image/bmp',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				// GIF  - still image - Graphics Interchange Format
+				'gif'  => array(
+							'pattern'   => '^GIF',
+							'group'     => 'graphic',
+							'module'    => 'gif',
+							'mime_type' => 'image/gif',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				// JPEG - still image - Joint Photographic Experts Group (JPEG)
+				'jpg'  => array(
+							'pattern'   => '^\xFF\xD8\xFF',
+							'group'     => 'graphic',
+							'module'    => 'jpg',
+							'mime_type' => 'image/jpeg',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				// PCD  - still image - Kodak Photo CD
+				'pcd'  => array(
+							'pattern'   => '^.{2048}PCD_IPI\x00',
+							'group'     => 'graphic',
+							'module'    => 'pcd',
+							'mime_type' => 'image/x-photo-cd',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+
+				// PNG  - still image - Portable Network Graphics (PNG)
+				'png'  => array(
+							'pattern'   => '^\x89\x50\x4E\x47\x0D\x0A\x1A\x0A',
+							'group'     => 'graphic',
+							'module'    => 'png',
+							'mime_type' => 'image/png',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+
+				// SVG  - still image - Scalable Vector Graphics (SVG)
+				'svg'  => array(
+							'pattern'   => '(<!DOCTYPE svg PUBLIC |xmlns="http:\/\/www\.w3\.org\/2000\/svg")',
+							'group'     => 'graphic',
+							'module'    => 'svg',
+							'mime_type' => 'image/svg+xml',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+
+				// TIFF - still image - Tagged Information File Format (TIFF)
+				'tiff' => array(
+							'pattern'   => '^(II\x2A\x00|MM\x00\x2A)',
+							'group'     => 'graphic',
+							'module'    => 'tiff',
+							'mime_type' => 'image/tiff',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+
+				// EFAX - still image - eFax (TIFF derivative)
+				'efax'  => array(
+							'pattern'   => '^\xDC\xFE',
+							'group'     => 'graphic',
+							'module'    => 'efax',
+							'mime_type' => 'image/efax',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+
+				// Data formats
+
+				// ISO  - data        - International Standards Organization (ISO) CD-ROM Image
+				'iso'  => array(
+							'pattern'   => '^.{32769}CD001',
+							'group'     => 'misc',
+							'module'    => 'iso',
+							'mime_type' => 'application/octet-stream',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+							'iconv_req' => false,
+						),
+
+				// RAR  - data        - RAR compressed data
+				'rar'  => array(
+							'pattern'   => '^Rar\!',
+							'group'     => 'archive',
+							'module'    => 'rar',
+							'mime_type' => 'application/octet-stream',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				// SZIP - audio/data  - SZIP compressed data
+				'szip' => array(
+							'pattern'   => '^SZ\x0A\x04',
+							'group'     => 'archive',
+							'module'    => 'szip',
+							'mime_type' => 'application/octet-stream',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				// TAR  - data        - TAR compressed data
+				'tar'  => array(
+							'pattern'   => '^.{100}[0-9\x20]{7}\x00[0-9\x20]{7}\x00[0-9\x20]{7}\x00[0-9\x20\x00]{12}[0-9\x20\x00]{12}',
+							'group'     => 'archive',
+							'module'    => 'tar',
+							'mime_type' => 'application/x-tar',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				// GZIP  - data        - GZIP compressed data
+				'gz'  => array(
+							'pattern'   => '^\x1F\x8B\x08',
+							'group'     => 'archive',
+							'module'    => 'gzip',
+							'mime_type' => 'application/x-gzip',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				// ZIP  - data         - ZIP compressed data
+				'zip'  => array(
+							'pattern'   => '^PK\x03\x04',
+							'group'     => 'archive',
+							'module'    => 'zip',
+							'mime_type' => 'application/zip',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+
+				// Misc other formats
+
+				// PAR2 - data        - Parity Volume Set Specification 2.0
+				'par2' => array (
+							'pattern'   => '^PAR2\x00PKT',
+							'group'     => 'misc',
+							'module'    => 'par2',
+							'mime_type' => 'application/octet-stream',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				// PDF  - data        - Portable Document Format
+				'pdf'  => array(
+							'pattern'   => '^\x25PDF',
+							'group'     => 'misc',
+							'module'    => 'pdf',
+							'mime_type' => 'application/pdf',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				// MSOFFICE  - data   - ZIP compressed data
+				'msoffice' => array(
+							'pattern'   => '^\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1', // D0CF11E == DOCFILE == Microsoft Office Document
+							'group'     => 'misc',
+							'module'    => 'msoffice',
+							'mime_type' => 'application/octet-stream',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				 // CUE  - data       - CUEsheet (index to single-file disc images)
+				 'cue' => array(
+							'pattern'   => '', // empty pattern means cannot be automatically detected, will fall through all other formats and match based on filename and very basic file contents
+							'group'     => 'misc',
+							'module'    => 'cue',
+							'mime_type' => 'application/octet-stream',
+						   ),
+
+			);
+		}
+
+		return $format_info;
+	}
+
+
+
+	public function GetFileFormat(&$filedata, $filename='') {
+		// this function will determine the format of a file based on usually
+		// the first 2-4 bytes of the file (8 bytes for PNG, 16 bytes for JPG,
+		// and in the case of ISO CD image, 6 bytes offset 32kb from the start
+		// of the file).
+
+		// Identify file format - loop through $format_info and detect with reg expr
+		foreach ($this->GetFileFormatArray() as $format_name => $info) {
+			// The /s switch on preg_match() forces preg_match() NOT to treat
+			// newline (0x0A) characters as special chars but do a binary match
+			if (!empty($info['pattern']) && preg_match('#'.$info['pattern'].'#s', $filedata)) {
+				$info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php';
+				return $info;
+			}
+		}
+
+
+		if (preg_match('#\.mp[123a]$#i', $filename)) {
+			// Too many mp3 encoders on the market put gabage in front of mpeg files
+			// use assume format on these if format detection failed
+			$GetFileFormatArray = $this->GetFileFormatArray();
+			$info = $GetFileFormatArray['mp3'];
+			$info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php';
+			return $info;
+		} elseif (preg_match('/\.cue$/i', $filename) && preg_match('#FILE "[^"]+" (BINARY|MOTOROLA|AIFF|WAVE|MP3)#', $filedata)) {
+			// there's not really a useful consistent "magic" at the beginning of .cue files to identify them
+			// so until I think of something better, just go by filename if all other format checks fail
+			// and verify there's at least one instance of "TRACK xx AUDIO" in the file
+			$GetFileFormatArray = $this->GetFileFormatArray();
+			$info = $GetFileFormatArray['cue'];
+			$info['include']   = 'module.'.$info['group'].'.'.$info['module'].'.php';
+			return $info;
+		}
+
+		return false;
+	}
+
+
+	// converts array to $encoding charset from $this->encoding
+	public function CharConvert(&$array, $encoding) {
+
+		// identical encoding - end here
+		if ($encoding == $this->encoding) {
+			return;
+		}
+
+		// loop thru array
+		foreach ($array as $key => $value) {
+
+			// go recursive
+			if (is_array($value)) {
+				$this->CharConvert($array[$key], $encoding);
+			}
+
+			// convert string
+			elseif (is_string($value)) {
+				$array[$key] = trim(getid3_lib::iconv_fallback($encoding, $this->encoding, $value));
+			}
+		}
+	}
+
+
+	public function HandleAllTags() {
+
+		// key name => array (tag name, character encoding)
+		static $tags;
+		if (empty($tags)) {
+			$tags = array(
+				'asf'       => array('asf'           , 'UTF-16LE'),
+				'midi'      => array('midi'          , 'ISO-8859-1'),
+				'nsv'       => array('nsv'           , 'ISO-8859-1'),
+				'ogg'       => array('vorbiscomment' , 'UTF-8'),
+				'png'       => array('png'           , 'UTF-8'),
+				'tiff'      => array('tiff'          , 'ISO-8859-1'),
+				'quicktime' => array('quicktime'     , 'UTF-8'),
+				'real'      => array('real'          , 'ISO-8859-1'),
+				'vqf'       => array('vqf'           , 'ISO-8859-1'),
+				'zip'       => array('zip'           , 'ISO-8859-1'),
+				'riff'      => array('riff'          , 'ISO-8859-1'),
+				'lyrics3'   => array('lyrics3'       , 'ISO-8859-1'),
+				'id3v1'     => array('id3v1'         , $this->encoding_id3v1),
+				'id3v2'     => array('id3v2'         , 'UTF-8'), // not according to the specs (every frame can have a different encoding), but getID3() force-converts all encodings to UTF-8
+				'ape'       => array('ape'           , 'UTF-8'),
+				'cue'       => array('cue'           , 'ISO-8859-1'),
+				'matroska'  => array('matroska'      , 'UTF-8'),
+				'flac'      => array('vorbiscomment' , 'UTF-8'),
+				'divxtag'   => array('divx'          , 'ISO-8859-1'),
+			);
+		}
+
+		// loop through comments array
+		foreach ($tags as $comment_name => $tagname_encoding_array) {
+			list($tag_name, $encoding) = $tagname_encoding_array;
+
+			// fill in default encoding type if not already present
+			if (isset($this->info[$comment_name]) && !isset($this->info[$comment_name]['encoding'])) {
+				$this->info[$comment_name]['encoding'] = $encoding;
+			}
+
+			// copy comments if key name set
+			if (!empty($this->info[$comment_name]['comments'])) {
+				foreach ($this->info[$comment_name]['comments'] as $tag_key => $valuearray) {
+					foreach ($valuearray as $key => $value) {
+						if (is_string($value)) {
+							$value = trim($value, " \r\n\t"); // do not trim nulls from $value!! Unicode characters will get mangled if trailing nulls are removed!
+						}
+						if ($value) {
+							$this->info['tags'][trim($tag_name)][trim($tag_key)][] = $value;
+						}
+					}
+					if ($tag_key == 'picture') {
+						unset($this->info[$comment_name]['comments'][$tag_key]);
+					}
+				}
+
+				if (!isset($this->info['tags'][$tag_name])) {
+					// comments are set but contain nothing but empty strings, so skip
+					continue;
+				}
+
+				if ($this->option_tags_html) {
+					foreach ($this->info['tags'][$tag_name] as $tag_key => $valuearray) {
+						foreach ($valuearray as $key => $value) {
+							if (is_string($value)) {
+								//$this->info['tags_html'][$tag_name][$tag_key][$key] = getid3_lib::MultiByteCharString2HTML($value, $encoding);
+								$this->info['tags_html'][$tag_name][$tag_key][$key] = str_replace('&#0;', '', trim(getid3_lib::MultiByteCharString2HTML($value, $encoding)));
+							} else {
+								$this->info['tags_html'][$tag_name][$tag_key][$key] = $value;
+							}
+						}
+					}
+				}
+
+				$this->CharConvert($this->info['tags'][$tag_name], $encoding);           // only copy gets converted!
+			}
+
+		}
+
+		// pictures can take up a lot of space, and we don't need multiple copies of them
+		// let there be a single copy in [comments][picture], and not elsewhere
+		if (!empty($this->info['tags'])) {
+			$unset_keys = array('tags', 'tags_html');
+			foreach ($this->info['tags'] as $tagtype => $tagarray) {
+				foreach ($tagarray as $tagname => $tagdata) {
+					if ($tagname == 'picture') {
+						foreach ($tagdata as $key => $tagarray) {
+							$this->info['comments']['picture'][] = $tagarray;
+							if (isset($tagarray['data']) && isset($tagarray['image_mime'])) {
+								if (isset($this->info['tags'][$tagtype][$tagname][$key])) {
+									unset($this->info['tags'][$tagtype][$tagname][$key]);
+								}
+								if (isset($this->info['tags_html'][$tagtype][$tagname][$key])) {
+									unset($this->info['tags_html'][$tagtype][$tagname][$key]);
+								}
+							}
+						}
+					}
+				}
+				foreach ($unset_keys as $unset_key) {
+					// remove possible empty keys from (e.g. [tags][id3v2][picture])
+					if (empty($this->info[$unset_key][$tagtype]['picture'])) {
+						unset($this->info[$unset_key][$tagtype]['picture']);
+					}
+					if (empty($this->info[$unset_key][$tagtype])) {
+						unset($this->info[$unset_key][$tagtype]);
+					}
+					if (empty($this->info[$unset_key])) {
+						unset($this->info[$unset_key]);
+					}
+				}
+				// remove duplicate copy of picture data from (e.g. [id3v2][comments][picture])
+				if (isset($this->info[$tagtype]['comments']['picture'])) {
+					unset($this->info[$tagtype]['comments']['picture']);
+				}
+				if (empty($this->info[$tagtype]['comments'])) {
+					unset($this->info[$tagtype]['comments']);
+				}
+				if (empty($this->info[$tagtype])) {
+					unset($this->info[$tagtype]);
+				}
+			}
+		}
+		return true;
+	}
+
+
+	public function getHashdata($algorithm) {
+		switch ($algorithm) {
+			case 'md5':
+			case 'sha1':
+				break;
+
+			default:
+				return $this->error('bad algorithm "'.$algorithm.'" in getHashdata()');
+				break;
+		}
+
+		if (!empty($this->info['fileformat']) && !empty($this->info['dataformat']) && ($this->info['fileformat'] == 'ogg') && ($this->info['audio']['dataformat'] == 'vorbis')) {
+
+			// We cannot get an identical md5_data value for Ogg files where the comments
+			// span more than 1 Ogg page (compared to the same audio data with smaller
+			// comments) using the normal getID3() method of MD5'ing the data between the
+			// end of the comments and the end of the file (minus any trailing tags),
+			// because the page sequence numbers of the pages that the audio data is on
+			// do not match. Under normal circumstances, where comments are smaller than
+			// the nominal 4-8kB page size, then this is not a problem, but if there are
+			// very large comments, the only way around it is to strip off the comment
+			// tags with vorbiscomment and MD5 that file.
+			// This procedure must be applied to ALL Ogg files, not just the ones with
+			// comments larger than 1 page, because the below method simply MD5's the
+			// whole file with the comments stripped, not just the portion after the
+			// comments block (which is the standard getID3() method.
+
+			// The above-mentioned problem of comments spanning multiple pages and changing
+			// page sequence numbers likely happens for OggSpeex and OggFLAC as well, but
+			// currently vorbiscomment only works on OggVorbis files.
+
+			if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) {
+
+				$this->warning('Failed making system call to vorbiscomment.exe - '.$algorithm.'_data is incorrect - error returned: PHP running in Safe Mode (backtick operator not available)');
+				$this->info[$algorithm.'_data'] = false;
+
+			} else {
+
+				// Prevent user from aborting script
+				$old_abort = ignore_user_abort(true);
+
+				// Create empty file
+				$empty = tempnam(GETID3_TEMP_DIR, 'getID3');
+				touch($empty);
+
+				// Use vorbiscomment to make temp file without comments
+				$temp = tempnam(GETID3_TEMP_DIR, 'getID3');
+				$file = $this->info['filenamepath'];
+
+				if (GETID3_OS_ISWINDOWS) {
+
+					if (file_exists(GETID3_HELPERAPPSDIR.'vorbiscomment.exe')) {
+
+						$commandline = '"'.GETID3_HELPERAPPSDIR.'vorbiscomment.exe" -w -c "'.$empty.'" "'.$file.'" "'.$temp.'"';
+						$VorbisCommentError = `$commandline`;
+
+					} else {
+
+						$VorbisCommentError = 'vorbiscomment.exe not found in '.GETID3_HELPERAPPSDIR;
+
+					}
+
+				} else {
+
+					$commandline = 'vorbiscomment -w -c "'.$empty.'" "'.$file.'" "'.$temp.'" 2>&1';
+					$commandline = 'vorbiscomment -w -c '.escapeshellarg($empty).' '.escapeshellarg($file).' '.escapeshellarg($temp).' 2>&1';
+					$VorbisCommentError = `$commandline`;
+
+				}
+
+				if (!empty($VorbisCommentError)) {
+
+					$this->info['warning'][]         = 'Failed making system call to vorbiscomment(.exe) - '.$algorithm.'_data will be incorrect. If vorbiscomment is unavailable, please download from http://www.vorbis.com/download.psp and put in the getID3() directory. Error returned: '.$VorbisCommentError;
+					$this->info[$algorithm.'_data']  = false;
+
+				} else {
+
+					// Get hash of newly created file
+					switch ($algorithm) {
+						case 'md5':
+							$this->info[$algorithm.'_data'] = md5_file($temp);
+							break;
+
+						case 'sha1':
+							$this->info[$algorithm.'_data'] = sha1_file($temp);
+							break;
+					}
+				}
+
+				// Clean up
+				unlink($empty);
+				unlink($temp);
+
+				// Reset abort setting
+				ignore_user_abort($old_abort);
+
+			}
+
+		} else {
+
+			if (!empty($this->info['avdataoffset']) || (isset($this->info['avdataend']) && ($this->info['avdataend'] < $this->info['filesize']))) {
+
+				// get hash from part of file
+				$this->info[$algorithm.'_data'] = getid3_lib::hash_data($this->info['filenamepath'], $this->info['avdataoffset'], $this->info['avdataend'], $algorithm);
+
+			} else {
+
+				// get hash from whole file
+				switch ($algorithm) {
+					case 'md5':
+						$this->info[$algorithm.'_data'] = md5_file($this->info['filenamepath']);
+						break;
+
+					case 'sha1':
+						$this->info[$algorithm.'_data'] = sha1_file($this->info['filenamepath']);
+						break;
+				}
+			}
+
+		}
+		return true;
+	}
+
+
+	public function ChannelsBitratePlaytimeCalculations() {
+
+		// set channelmode on audio
+		if (!empty($this->info['audio']['channelmode']) || !isset($this->info['audio']['channels'])) {
+			// ignore
+		} elseif ($this->info['audio']['channels'] == 1) {
+			$this->info['audio']['channelmode'] = 'mono';
+		} elseif ($this->info['audio']['channels'] == 2) {
+			$this->info['audio']['channelmode'] = 'stereo';
+		}
+
+		// Calculate combined bitrate - audio + video
+		$CombinedBitrate  = 0;
+		$CombinedBitrate += (isset($this->info['audio']['bitrate']) ? $this->info['audio']['bitrate'] : 0);
+		$CombinedBitrate += (isset($this->info['video']['bitrate']) ? $this->info['video']['bitrate'] : 0);
+		if (($CombinedBitrate > 0) && empty($this->info['bitrate'])) {
+			$this->info['bitrate'] = $CombinedBitrate;
+		}
+		//if ((isset($this->info['video']) && !isset($this->info['video']['bitrate'])) || (isset($this->info['audio']) && !isset($this->info['audio']['bitrate']))) {
+		//	// for example, VBR MPEG video files cannot determine video bitrate:
+		//	// should not set overall bitrate and playtime from audio bitrate only
+		//	unset($this->info['bitrate']);
+		//}
+
+		// video bitrate undetermined, but calculable
+		if (isset($this->info['video']['dataformat']) && $this->info['video']['dataformat'] && (!isset($this->info['video']['bitrate']) || ($this->info['video']['bitrate'] == 0))) {
+			// if video bitrate not set
+			if (isset($this->info['audio']['bitrate']) && ($this->info['audio']['bitrate'] > 0) && ($this->info['audio']['bitrate'] == $this->info['bitrate'])) {
+				// AND if audio bitrate is set to same as overall bitrate
+				if (isset($this->info['playtime_seconds']) && ($this->info['playtime_seconds'] > 0)) {
+					// AND if playtime is set
+					if (isset($this->info['avdataend']) && isset($this->info['avdataoffset'])) {
+						// AND if AV data offset start/end is known
+						// THEN we can calculate the video bitrate
+						$this->info['bitrate'] = round((($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['playtime_seconds']);
+						$this->info['video']['bitrate'] = $this->info['bitrate'] - $this->info['audio']['bitrate'];
+					}
+				}
+			}
+		}
+
+		if ((!isset($this->info['playtime_seconds']) || ($this->info['playtime_seconds'] <= 0)) && !empty($this->info['bitrate'])) {
+			$this->info['playtime_seconds'] = (($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['bitrate'];
+		}
+
+		if (!isset($this->info['bitrate']) && !empty($this->info['playtime_seconds'])) {
+			$this->info['bitrate'] = (($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['playtime_seconds'];
+		}
+		if (isset($this->info['bitrate']) && empty($this->info['audio']['bitrate']) && empty($this->info['video']['bitrate'])) {
+			if (isset($this->info['audio']['dataformat']) && empty($this->info['video']['resolution_x'])) {
+				// audio only
+				$this->info['audio']['bitrate'] = $this->info['bitrate'];
+			} elseif (isset($this->info['video']['resolution_x']) && empty($this->info['audio']['dataformat'])) {
+				// video only
+				$this->info['video']['bitrate'] = $this->info['bitrate'];
+			}
+		}
+
+		// Set playtime string
+		if (!empty($this->info['playtime_seconds']) && empty($this->info['playtime_string'])) {
+			$this->info['playtime_string'] = getid3_lib::PlaytimeString($this->info['playtime_seconds']);
+		}
+	}
+
+
+	public function CalculateCompressionRatioVideo() {
+		if (empty($this->info['video'])) {
+			return false;
+		}
+		if (empty($this->info['video']['resolution_x']) || empty($this->info['video']['resolution_y'])) {
+			return false;
+		}
+		if (empty($this->info['video']['bits_per_sample'])) {
+			return false;
+		}
+
+		switch ($this->info['video']['dataformat']) {
+			case 'bmp':
+			case 'gif':
+			case 'jpeg':
+			case 'jpg':
+			case 'png':
+			case 'tiff':
+				$FrameRate = 1;
+				$PlaytimeSeconds = 1;
+				$BitrateCompressed = $this->info['filesize'] * 8;
+				break;
+
+			default:
+				if (!empty($this->info['video']['frame_rate'])) {
+					$FrameRate = $this->info['video']['frame_rate'];
+				} else {
+					return false;
+				}
+				if (!empty($this->info['playtime_seconds'])) {
+					$PlaytimeSeconds = $this->info['playtime_seconds'];
+				} else {
+					return false;
+				}
+				if (!empty($this->info['video']['bitrate'])) {
+					$BitrateCompressed = $this->info['video']['bitrate'];
+				} else {
+					return false;
+				}
+				break;
+		}
+		$BitrateUncompressed = $this->info['video']['resolution_x'] * $this->info['video']['resolution_y'] * $this->info['video']['bits_per_sample'] * $FrameRate;
+
+		$this->info['video']['compression_ratio'] = $BitrateCompressed / $BitrateUncompressed;
+		return true;
+	}
+
+
+	public function CalculateCompressionRatioAudio() {
+		if (empty($this->info['audio']['bitrate']) || empty($this->info['audio']['channels']) || empty($this->info['audio']['sample_rate']) || !is_numeric($this->info['audio']['sample_rate'])) {
+			return false;
+		}
+		$this->info['audio']['compression_ratio'] = $this->info['audio']['bitrate'] / ($this->info['audio']['channels'] * $this->info['audio']['sample_rate'] * (!empty($this->info['audio']['bits_per_sample']) ? $this->info['audio']['bits_per_sample'] : 16));
+
+		if (!empty($this->info['audio']['streams'])) {
+			foreach ($this->info['audio']['streams'] as $streamnumber => $streamdata) {
+				if (!empty($streamdata['bitrate']) && !empty($streamdata['channels']) && !empty($streamdata['sample_rate'])) {
+					$this->info['audio']['streams'][$streamnumber]['compression_ratio'] = $streamdata['bitrate'] / ($streamdata['channels'] * $streamdata['sample_rate'] * (!empty($streamdata['bits_per_sample']) ? $streamdata['bits_per_sample'] : 16));
+				}
+			}
+		}
+		return true;
+	}
+
+
+	public function CalculateReplayGain() {
+		if (isset($this->info['replay_gain'])) {
+			if (!isset($this->info['replay_gain']['reference_volume'])) {
+				$this->info['replay_gain']['reference_volume'] = (double) 89.0;
+			}
+			if (isset($this->info['replay_gain']['track']['adjustment'])) {
+				$this->info['replay_gain']['track']['volume'] = $this->info['replay_gain']['reference_volume'] - $this->info['replay_gain']['track']['adjustment'];
+			}
+			if (isset($this->info['replay_gain']['album']['adjustment'])) {
+				$this->info['replay_gain']['album']['volume'] = $this->info['replay_gain']['reference_volume'] - $this->info['replay_gain']['album']['adjustment'];
+			}
+
+			if (isset($this->info['replay_gain']['track']['peak'])) {
+				$this->info['replay_gain']['track']['max_noclip_gain'] = 0 - getid3_lib::RGADamplitude2dB($this->info['replay_gain']['track']['peak']);
+			}
+			if (isset($this->info['replay_gain']['album']['peak'])) {
+				$this->info['replay_gain']['album']['max_noclip_gain'] = 0 - getid3_lib::RGADamplitude2dB($this->info['replay_gain']['album']['peak']);
+			}
+		}
+		return true;
+	}
+
+	public function ProcessAudioStreams() {
+		if (!empty($this->info['audio']['bitrate']) || !empty($this->info['audio']['channels']) || !empty($this->info['audio']['sample_rate'])) {
+			if (!isset($this->info['audio']['streams'])) {
+				foreach ($this->info['audio'] as $key => $value) {
+					if ($key != 'streams') {
+						$this->info['audio']['streams'][0][$key] = $value;
+					}
+				}
+			}
+		}
+		return true;
+	}
+
+	public function getid3_tempnam() {
+		return tempnam($this->tempdir, 'gI3');
+	}
+
+	public function include_module($name) {
+		//if (!file_exists($this->include_path.'module.'.$name.'.php')) {
+		if (!file_exists(GETID3_INCLUDEPATH.'module.'.$name.'.php')) {
+			throw new getid3_exception('Required module.'.$name.'.php is missing.');
+		}
+		include_once(GETID3_INCLUDEPATH.'module.'.$name.'.php');
+		return true;
+	}
+
+}
+
+
+abstract class getid3_handler
+{
+	protected $getid3;                       // pointer
+
+	protected $data_string_flag     = false; // analyzing filepointer or string
+	protected $data_string          = '';    // string to analyze
+	protected $data_string_position = 0;     // seek position in string
+	protected $data_string_length   = 0;     // string length
+
+	private $dependency_to = null;
+
+
+	public function __construct(getID3 $getid3, $call_module=null) {
+		$this->getid3 = $getid3;
+
+		if ($call_module) {
+			$this->dependency_to = str_replace('getid3_', '', $call_module);
+		}
+	}
+
+
+	// Analyze from file pointer
+	abstract public function Analyze();
+
+
+	// Analyze from string instead
+	public function AnalyzeString($string) {
+		// Enter string mode
+	    $this->setStringMode($string);
+
+		// Save info
+		$saved_avdataoffset = $this->getid3->info['avdataoffset'];
+		$saved_avdataend    = $this->getid3->info['avdataend'];
+		$saved_filesize     = (isset($this->getid3->info['filesize']) ? $this->getid3->info['filesize'] : null); // may be not set if called as dependency without openfile() call
+
+		// Reset some info
+		$this->getid3->info['avdataoffset'] = 0;
+		$this->getid3->info['avdataend']    = $this->getid3->info['filesize'] = $this->data_string_length;
+
+		// Analyze
+		$this->Analyze();
+
+		// Restore some info
+		$this->getid3->info['avdataoffset'] = $saved_avdataoffset;
+		$this->getid3->info['avdataend']    = $saved_avdataend;
+		$this->getid3->info['filesize']     = $saved_filesize;
+
+		// Exit string mode
+		$this->data_string_flag = false;
+	}
+
+	public function setStringMode($string) {
+		$this->data_string_flag   = true;
+		$this->data_string        = $string;
+		$this->data_string_length = strlen($string);
+	}
+
+	protected function ftell() {
+		if ($this->data_string_flag) {
+			return $this->data_string_position;
+		}
+		return ftell($this->getid3->fp);
+	}
+
+	protected function fread($bytes) {
+		if ($this->data_string_flag) {
+			$this->data_string_position += $bytes;
+			return substr($this->data_string, $this->data_string_position - $bytes, $bytes);
+		}
+	    $pos = $this->ftell() + $bytes;
+	    if (!getid3_lib::intValueSupported($pos)) {
+			throw new getid3_exception('cannot fread('.$bytes.' from '.$this->ftell().') because beyond PHP filesystem limit', 10);
+	    }
+		return fread($this->getid3->fp, $bytes);
+	}
+
+	protected function fseek($bytes, $whence=SEEK_SET) {
+		if ($this->data_string_flag) {
+			switch ($whence) {
+				case SEEK_SET:
+					$this->data_string_position = $bytes;
+					break;
+
+				case SEEK_CUR:
+					$this->data_string_position += $bytes;
+					break;
+
+				case SEEK_END:
+					$this->data_string_position = $this->data_string_length + $bytes;
+					break;
+			}
+			return 0;
+	    } else {
+	    	$pos = $bytes;
+	    	if ($whence == SEEK_CUR) {
+				$pos = $this->ftell() + $bytes;
+	    	} elseif ($whence == SEEK_END) {
+				$pos = $this->info['filesize'] + $bytes;
+	    	}
+	    	if (!getid3_lib::intValueSupported($pos)) {
+				throw new getid3_exception('cannot fseek('.$pos.') because beyond PHP filesystem limit', 10);
+			}
+		}
+		return fseek($this->getid3->fp, $bytes, $whence);
+	}
+
+	protected function feof() {
+		if ($this->data_string_flag) {
+			return $this->data_string_position >= $this->data_string_length;
+		}
+		return feof($this->getid3->fp);
+	}
+
+	final protected function isDependencyFor($module) {
+		return $this->dependency_to == $module;
+	}
+
+	protected function error($text)
+	{
+		$this->getid3->info['error'][] = $text;
+
+		return false;
+	}
+
+	protected function warning($text)
+	{
+		return $this->getid3->warning($text);
+	}
+
+	protected function notice($text)
+	{
+		// does nothing for now
+	}
+
+	public function saveAttachment($name, $offset, $length, $image_mime=null) {
+		try {
+
+			// do not extract at all
+			if ($this->getid3->option_save_attachments === getID3::ATTACHMENTS_NONE) {
+
+				$attachment = null; // do not set any
+
+			// extract to return array
+			} elseif ($this->getid3->option_save_attachments === getID3::ATTACHMENTS_INLINE) {
+
+				$this->fseek($offset);
+				$attachment = $this->fread($length); // get whole data in one pass, till it is anyway stored in memory
+				if ($attachment === false || strlen($attachment) != $length) {
+					throw new Exception('failed to read attachment data');
+				}
+
+			// assume directory path is given
+			} else {
+
+				// set up destination path
+				$dir = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->getid3->option_save_attachments), DIRECTORY_SEPARATOR);
+				if (!is_dir($dir) || !is_writable($dir)) { // check supplied directory
+					throw new Exception('supplied path ('.$dir.') does not exist, or is not writable');
+				}
+				$dest = $dir.DIRECTORY_SEPARATOR.$name.($image_mime ? '.'.getid3_lib::ImageExtFromMime($image_mime) : '');
+
+				// create dest file
+				if (($fp_dest = fopen($dest, 'wb')) == false) {
+					throw new Exception('failed to create file '.$dest);
+				}
+
+				// copy data
+				$this->fseek($offset);
+				$buffersize = ($this->data_string_flag ? $length : $this->getid3->fread_buffer_size());
+				$bytesleft = $length;
+				while ($bytesleft > 0) {
+					if (($buffer = $this->fread(min($buffersize, $bytesleft))) === false || ($byteswritten = fwrite($fp_dest, $buffer)) === false || ($byteswritten === 0)) {
+						throw new Exception($buffer === false ? 'not enough data to read' : 'failed to write to destination file, may be not enough disk space');
+					}
+					$bytesleft -= $byteswritten;
+				}
+
+				fclose($fp_dest);
+				$attachment = $dest;
+
+			}
+
+		} catch (Exception $e) {
+
+			// close and remove dest file if created
+			if (isset($fp_dest) && is_resource($fp_dest)) {
+				fclose($fp_dest);
+				unlink($dest);
+			}
+
+			// do not set any is case of error
+			$attachment = null;
+			$this->warning('Failed to extract attachment '.$name.': '.$e->getMessage());
+
+		}
+
+		// seek to the end of attachment
+		$this->fseek($offset + $length);
+
+		return $attachment;
+	}
+
+}
+
+
+class getid3_exception extends Exception
+{
+	public $message;
+}
Index: /extensions/piwigo_videojs/include/getid3/module.audio-video.flv.php
===================================================================
--- /extensions/piwigo_videojs/include/getid3/module.audio-video.flv.php	(revision 24676)
+++ /extensions/piwigo_videojs/include/getid3/module.audio-video.flv.php	(revision 24676)
@@ -0,0 +1,729 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+//                                                             //
+//  FLV module by Seth Kaufman <sethØwhirl-i-gig*com>          //
+//                                                             //
+//  * version 0.1 (26 June 2005)                               //
+//                                                             //
+//                                                             //
+//  * version 0.1.1 (15 July 2005)                             //
+//  minor modifications by James Heinrich <info@getid3.org>    //
+//                                                             //
+//  * version 0.2 (22 February 2006)                           //
+//  Support for On2 VP6 codec and meta information             //
+//    by Steve Webster <steve.websterØfeaturecreep*com>        //
+//                                                             //
+//  * version 0.3 (15 June 2006)                               //
+//  Modified to not read entire file into memory               //
+//    by James Heinrich <info@getid3.org>                      //
+//                                                             //
+//  * version 0.4 (07 December 2007)                           //
+//  Bugfixes for incorrectly parsed FLV dimensions             //
+//    and incorrect parsing of onMetaTag                       //
+//    by Evgeny Moysevich <moysevichØgmail*com>                //
+//                                                             //
+//  * version 0.5 (21 May 2009)                                //
+//  Fixed parsing of audio tags and added additional codec     //
+//    details. The duration is now read from onMetaTag (if     //
+//    exists), rather than parsing whole file                  //
+//    by Nigel Barnes <ngbarnesØhotmail*com>                   //
+//                                                             //
+//  * version 0.6 (24 May 2009)                                //
+//  Better parsing of files with h264 video                    //
+//    by Evgeny Moysevich <moysevichØgmail*com>                //
+//                                                             //
+//  * version 0.6.1 (30 May 2011)                              //
+//    prevent infinite loops in expGolombUe()                  //
+//                                                             //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// module.audio-video.flv.php                                  //
+// module for analyzing Shockwave Flash Video files            //
+// dependencies: NONE                                          //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+define('GETID3_FLV_TAG_AUDIO',          8);
+define('GETID3_FLV_TAG_VIDEO',          9);
+define('GETID3_FLV_TAG_META',          18);
+
+define('GETID3_FLV_VIDEO_H263',         2);
+define('GETID3_FLV_VIDEO_SCREEN',       3);
+define('GETID3_FLV_VIDEO_VP6FLV',       4);
+define('GETID3_FLV_VIDEO_VP6FLV_ALPHA', 5);
+define('GETID3_FLV_VIDEO_SCREENV2',     6);
+define('GETID3_FLV_VIDEO_H264',         7);
+
+define('H264_AVC_SEQUENCE_HEADER',          0);
+define('H264_PROFILE_BASELINE',            66);
+define('H264_PROFILE_MAIN',                77);
+define('H264_PROFILE_EXTENDED',            88);
+define('H264_PROFILE_HIGH',               100);
+define('H264_PROFILE_HIGH10',             110);
+define('H264_PROFILE_HIGH422',            122);
+define('H264_PROFILE_HIGH444',            144);
+define('H264_PROFILE_HIGH444_PREDICTIVE', 244);
+
+class getid3_flv extends getid3_handler
+{
+	public $max_frames = 100000; // break out of the loop if too many frames have been scanned; only scan this many if meta frame does not contain useful duration
+
+	public function Analyze() {
+		$info = &$this->getid3->info;
+
+		fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
+
+		$FLVdataLength = $info['avdataend'] - $info['avdataoffset'];
+		$FLVheader = fread($this->getid3->fp, 5);
+
+		$info['fileformat'] = 'flv';
+		$info['flv']['header']['signature'] =                           substr($FLVheader, 0, 3);
+		$info['flv']['header']['version']   = getid3_lib::BigEndian2Int(substr($FLVheader, 3, 1));
+		$TypeFlags                          = getid3_lib::BigEndian2Int(substr($FLVheader, 4, 1));
+
+		$magic = 'FLV';
+		if ($info['flv']['header']['signature'] != $magic) {
+			$info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($info['flv']['header']['signature']).'"';
+			unset($info['flv']);
+			unset($info['fileformat']);
+			return false;
+		}
+
+		$info['flv']['header']['hasAudio'] = (bool) ($TypeFlags & 0x04);
+		$info['flv']['header']['hasVideo'] = (bool) ($TypeFlags & 0x01);
+
+		$FrameSizeDataLength = getid3_lib::BigEndian2Int(fread($this->getid3->fp, 4));
+		$FLVheaderFrameLength = 9;
+		if ($FrameSizeDataLength > $FLVheaderFrameLength) {
+			fseek($this->getid3->fp, $FrameSizeDataLength - $FLVheaderFrameLength, SEEK_CUR);
+		}
+		$Duration = 0;
+		$found_video = false;
+		$found_audio = false;
+		$found_meta  = false;
+		$found_valid_meta_playtime = false;
+		$tagParseCount = 0;
+		$info['flv']['framecount'] = array('total'=>0, 'audio'=>0, 'video'=>0);
+		$flv_framecount = &$info['flv']['framecount'];
+		while (((ftell($this->getid3->fp) + 16) < $info['avdataend']) && (($tagParseCount++ <= $this->max_frames) || !$found_valid_meta_playtime))  {
+			$ThisTagHeader = fread($this->getid3->fp, 16);
+
+			$PreviousTagLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader,  0, 4));
+			$TagType           = getid3_lib::BigEndian2Int(substr($ThisTagHeader,  4, 1));
+			$DataLength        = getid3_lib::BigEndian2Int(substr($ThisTagHeader,  5, 3));
+			$Timestamp         = getid3_lib::BigEndian2Int(substr($ThisTagHeader,  8, 3));
+			$LastHeaderByte    = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 15, 1));
+			$NextOffset = ftell($this->getid3->fp) - 1 + $DataLength;
+			if ($Timestamp > $Duration) {
+				$Duration = $Timestamp;
+			}
+
+			$flv_framecount['total']++;
+			switch ($TagType) {
+				case GETID3_FLV_TAG_AUDIO:
+					$flv_framecount['audio']++;
+					if (!$found_audio) {
+						$found_audio = true;
+						$info['flv']['audio']['audioFormat']     = ($LastHeaderByte >> 4) & 0x0F;
+						$info['flv']['audio']['audioRate']       = ($LastHeaderByte >> 2) & 0x03;
+						$info['flv']['audio']['audioSampleSize'] = ($LastHeaderByte >> 1) & 0x01;
+						$info['flv']['audio']['audioType']       =  $LastHeaderByte       & 0x01;
+					}
+					break;
+
+				case GETID3_FLV_TAG_VIDEO:
+					$flv_framecount['video']++;
+					if (!$found_video) {
+						$found_video = true;
+						$info['flv']['video']['videoCodec'] = $LastHeaderByte & 0x07;
+
+						$FLVvideoHeader = fread($this->getid3->fp, 11);
+
+						if ($info['flv']['video']['videoCodec'] == GETID3_FLV_VIDEO_H264) {
+							// this code block contributed by: moysevichØgmail*com
+
+							$AVCPacketType = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 0, 1));
+							if ($AVCPacketType == H264_AVC_SEQUENCE_HEADER) {
+								//	read AVCDecoderConfigurationRecord
+								$configurationVersion       = getid3_lib::BigEndian2Int(substr($FLVvideoHeader,  4, 1));
+								$AVCProfileIndication       = getid3_lib::BigEndian2Int(substr($FLVvideoHeader,  5, 1));
+								$profile_compatibility      = getid3_lib::BigEndian2Int(substr($FLVvideoHeader,  6, 1));
+								$lengthSizeMinusOne         = getid3_lib::BigEndian2Int(substr($FLVvideoHeader,  7, 1));
+								$numOfSequenceParameterSets = getid3_lib::BigEndian2Int(substr($FLVvideoHeader,  8, 1));
+
+								if (($numOfSequenceParameterSets & 0x1F) != 0) {
+									//	there is at least one SequenceParameterSet
+									//	read size of the first SequenceParameterSet
+									//$spsSize = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 9, 2));
+									$spsSize = getid3_lib::LittleEndian2Int(substr($FLVvideoHeader, 9, 2));
+									//	read the first SequenceParameterSet
+									$sps = fread($this->getid3->fp, $spsSize);
+									if (strlen($sps) == $spsSize) {	//	make sure that whole SequenceParameterSet was red
+										$spsReader = new AVCSequenceParameterSetReader($sps);
+										$spsReader->readData();
+										$info['video']['resolution_x'] = $spsReader->getWidth();
+										$info['video']['resolution_y'] = $spsReader->getHeight();
+									}
+								}
+							}
+							// end: moysevichØgmail*com
+
+						} elseif ($info['flv']['video']['videoCodec'] == GETID3_FLV_VIDEO_H263) {
+
+							$PictureSizeType = (getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 3, 2))) >> 7;
+							$PictureSizeType = $PictureSizeType & 0x0007;
+							$info['flv']['header']['videoSizeType'] = $PictureSizeType;
+							switch ($PictureSizeType) {
+								case 0:
+									//$PictureSizeEnc = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 2));
+									//$PictureSizeEnc <<= 1;
+									//$info['video']['resolution_x'] = ($PictureSizeEnc & 0xFF00) >> 8;
+									//$PictureSizeEnc = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 2));
+									//$PictureSizeEnc <<= 1;
+									//$info['video']['resolution_y'] = ($PictureSizeEnc & 0xFF00) >> 8;
+
+									$PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 2));
+									$PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 2));
+									$PictureSizeEnc['x'] >>= 7;
+									$PictureSizeEnc['y'] >>= 7;
+									$info['video']['resolution_x'] = $PictureSizeEnc['x'] & 0xFF;
+									$info['video']['resolution_y'] = $PictureSizeEnc['y'] & 0xFF;
+									break;
+
+								case 1:
+									$PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 3));
+									$PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 3));
+									$PictureSizeEnc['x'] >>= 7;
+									$PictureSizeEnc['y'] >>= 7;
+									$info['video']['resolution_x'] = $PictureSizeEnc['x'] & 0xFFFF;
+									$info['video']['resolution_y'] = $PictureSizeEnc['y'] & 0xFFFF;
+									break;
+
+								case 2:
+									$info['video']['resolution_x'] = 352;
+									$info['video']['resolution_y'] = 288;
+									break;
+
+								case 3:
+									$info['video']['resolution_x'] = 176;
+									$info['video']['resolution_y'] = 144;
+									break;
+
+								case 4:
+									$info['video']['resolution_x'] = 128;
+									$info['video']['resolution_y'] = 96;
+									break;
+
+								case 5:
+									$info['video']['resolution_x'] = 320;
+									$info['video']['resolution_y'] = 240;
+									break;
+
+								case 6:
+									$info['video']['resolution_x'] = 160;
+									$info['video']['resolution_y'] = 120;
+									break;
+
+								default:
+									$info['video']['resolution_x'] = 0;
+									$info['video']['resolution_y'] = 0;
+									break;
+
+							}
+						}
+						$info['video']['pixel_aspect_ratio'] = $info['video']['resolution_x'] / $info['video']['resolution_y'];
+					}
+					break;
+
+				// Meta tag
+				case GETID3_FLV_TAG_META:
+					if (!$found_meta) {
+						$found_meta = true;
+						fseek($this->getid3->fp, -1, SEEK_CUR);
+						$datachunk = fread($this->getid3->fp, $DataLength);
+						$AMFstream = new AMFStream($datachunk);
+						$reader = new AMFReader($AMFstream);
+						$eventName = $reader->readData();
+						$info['flv']['meta'][$eventName] = $reader->readData();
+						unset($reader);
+
+						$copykeys = array('framerate'=>'frame_rate', 'width'=>'resolution_x', 'height'=>'resolution_y', 'audiodatarate'=>'bitrate', 'videodatarate'=>'bitrate');
+						foreach ($copykeys as $sourcekey => $destkey) {
+							if (isset($info['flv']['meta']['onMetaData'][$sourcekey])) {
+								switch ($sourcekey) {
+									case 'width':
+									case 'height':
+										$info['video'][$destkey] = intval(round($info['flv']['meta']['onMetaData'][$sourcekey]));
+										break;
+									case 'audiodatarate':
+										$info['audio'][$destkey] = getid3_lib::CastAsInt(round($info['flv']['meta']['onMetaData'][$sourcekey] * 1000));
+										break;
+									case 'videodatarate':
+									case 'frame_rate':
+									default:
+										$info['video'][$destkey] = $info['flv']['meta']['onMetaData'][$sourcekey];
+										break;
+								}
+							}
+						}
+						if (!empty($info['flv']['meta']['onMetaData']['duration'])) {
+							$found_valid_meta_playtime = true;
+						}
+					}
+					break;
+
+				default:
+					// noop
+					break;
+			}
+			fseek($this->getid3->fp, $NextOffset, SEEK_SET);
+		}
+
+		$info['playtime_seconds'] = $Duration / 1000;
+		if ($info['playtime_seconds'] > 0) {
+			$info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
+		}
+
+		if ($info['flv']['header']['hasAudio']) {
+			$info['audio']['codec']           =   $this->FLVaudioFormat($info['flv']['audio']['audioFormat']);
+			$info['audio']['sample_rate']     =     $this->FLVaudioRate($info['flv']['audio']['audioRate']);
+			$info['audio']['bits_per_sample'] = $this->FLVaudioBitDepth($info['flv']['audio']['audioSampleSize']);
+
+			$info['audio']['channels']   =  $info['flv']['audio']['audioType'] + 1; // 0=mono,1=stereo
+			$info['audio']['lossless']   = ($info['flv']['audio']['audioFormat'] ? false : true); // 0=uncompressed
+			$info['audio']['dataformat'] = 'flv';
+		}
+		if (!empty($info['flv']['header']['hasVideo'])) {
+			$info['video']['codec']      = $this->FLVvideoCodec($info['flv']['video']['videoCodec']);
+			$info['video']['dataformat'] = 'flv';
+			$info['video']['lossless']   = false;
+		}
+
+		// Set information from meta
+		if (!empty($info['flv']['meta']['onMetaData']['duration'])) {
+			$info['playtime_seconds'] = $info['flv']['meta']['onMetaData']['duration'];
+			$info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
+		}
+		if (isset($info['flv']['meta']['onMetaData']['audiocodecid'])) {
+			$info['audio']['codec'] = $this->FLVaudioFormat($info['flv']['meta']['onMetaData']['audiocodecid']);
+		}
+		if (isset($info['flv']['meta']['onMetaData']['videocodecid'])) {
+			$info['video']['codec'] = $this->FLVvideoCodec($info['flv']['meta']['onMetaData']['videocodecid']);
+		}
+		return true;
+	}
+
+
+	public function FLVaudioFormat($id) {
+		$FLVaudioFormat = array(
+			0  => 'Linear PCM, platform endian',
+			1  => 'ADPCM',
+			2  => 'mp3',
+			3  => 'Linear PCM, little endian',
+			4  => 'Nellymoser 16kHz mono',
+			5  => 'Nellymoser 8kHz mono',
+			6  => 'Nellymoser',
+			7  => 'G.711A-law logarithmic PCM',
+			8  => 'G.711 mu-law logarithmic PCM',
+			9  => 'reserved',
+			10 => 'AAC',
+			11 => false, // unknown?
+			12 => false, // unknown?
+			13 => false, // unknown?
+			14 => 'mp3 8kHz',
+			15 => 'Device-specific sound',
+		);
+		return (isset($FLVaudioFormat[$id]) ? $FLVaudioFormat[$id] : false);
+	}
+
+	public function FLVaudioRate($id) {
+		$FLVaudioRate = array(
+			0 =>  5500,
+			1 => 11025,
+			2 => 22050,
+			3 => 44100,
+		);
+		return (isset($FLVaudioRate[$id]) ? $FLVaudioRate[$id] : false);
+	}
+
+	public function FLVaudioBitDepth($id) {
+		$FLVaudioBitDepth = array(
+			0 =>  8,
+			1 => 16,
+		);
+		return (isset($FLVaudioBitDepth[$id]) ? $FLVaudioBitDepth[$id] : false);
+	}
+
+	public function FLVvideoCodec($id) {
+		$FLVvideoCodec = array(
+			GETID3_FLV_VIDEO_H263         => 'Sorenson H.263',
+			GETID3_FLV_VIDEO_SCREEN       => 'Screen video',
+			GETID3_FLV_VIDEO_VP6FLV       => 'On2 VP6',
+			GETID3_FLV_VIDEO_VP6FLV_ALPHA => 'On2 VP6 with alpha channel',
+			GETID3_FLV_VIDEO_SCREENV2     => 'Screen video v2',
+			GETID3_FLV_VIDEO_H264         => 'Sorenson H.264',
+		);
+		return (isset($FLVvideoCodec[$id]) ? $FLVvideoCodec[$id] : false);
+	}
+}
+
+class AMFStream {
+	public $bytes;
+	public $pos;
+
+	public function AMFStream(&$bytes) {
+		$this->bytes =& $bytes;
+		$this->pos = 0;
+	}
+
+	public function readByte() {
+		return getid3_lib::BigEndian2Int(substr($this->bytes, $this->pos++, 1));
+	}
+
+	public function readInt() {
+		return ($this->readByte() << 8) + $this->readByte();
+	}
+
+	public function readLong() {
+		return ($this->readByte() << 24) + ($this->readByte() << 16) + ($this->readByte() << 8) + $this->readByte();
+	}
+
+	public function readDouble() {
+		return getid3_lib::BigEndian2Float($this->read(8));
+	}
+
+	public function readUTF() {
+		$length = $this->readInt();
+		return $this->read($length);
+	}
+
+	public function readLongUTF() {
+		$length = $this->readLong();
+		return $this->read($length);
+	}
+
+	public function read($length) {
+		$val = substr($this->bytes, $this->pos, $length);
+		$this->pos += $length;
+		return $val;
+	}
+
+	public function peekByte() {
+		$pos = $this->pos;
+		$val = $this->readByte();
+		$this->pos = $pos;
+		return $val;
+	}
+
+	public function peekInt() {
+		$pos = $this->pos;
+		$val = $this->readInt();
+		$this->pos = $pos;
+		return $val;
+	}
+
+	public function peekLong() {
+		$pos = $this->pos;
+		$val = $this->readLong();
+		$this->pos = $pos;
+		return $val;
+	}
+
+	public function peekDouble() {
+		$pos = $this->pos;
+		$val = $this->readDouble();
+		$this->pos = $pos;
+		return $val;
+	}
+
+	public function peekUTF() {
+		$pos = $this->pos;
+		$val = $this->readUTF();
+		$this->pos = $pos;
+		return $val;
+	}
+
+	public function peekLongUTF() {
+		$pos = $this->pos;
+		$val = $this->readLongUTF();
+		$this->pos = $pos;
+		return $val;
+	}
+}
+
+class AMFReader {
+	public $stream;
+
+	public function AMFReader(&$stream) {
+		$this->stream =& $stream;
+	}
+
+	public function readData() {
+		$value = null;
+
+		$type = $this->stream->readByte();
+		switch ($type) {
+
+			// Double
+			case 0:
+				$value = $this->readDouble();
+			break;
+
+			// Boolean
+			case 1:
+				$value = $this->readBoolean();
+				break;
+
+			// String
+			case 2:
+				$value = $this->readString();
+				break;
+
+			// Object
+			case 3:
+				$value = $this->readObject();
+				break;
+
+			// null
+			case 6:
+				return null;
+				break;
+
+			// Mixed array
+			case 8:
+				$value = $this->readMixedArray();
+				break;
+
+			// Array
+			case 10:
+				$value = $this->readArray();
+				break;
+
+			// Date
+			case 11:
+				$value = $this->readDate();
+				break;
+
+			// Long string
+			case 13:
+				$value = $this->readLongString();
+				break;
+
+			// XML (handled as string)
+			case 15:
+				$value = $this->readXML();
+				break;
+
+			// Typed object (handled as object)
+			case 16:
+				$value = $this->readTypedObject();
+				break;
+
+			// Long string
+			default:
+				$value = '(unknown or unsupported data type)';
+			break;
+		}
+
+		return $value;
+	}
+
+	public function readDouble() {
+		return $this->stream->readDouble();
+	}
+
+	public function readBoolean() {
+		return $this->stream->readByte() == 1;
+	}
+
+	public function readString() {
+		return $this->stream->readUTF();
+	}
+
+	public function readObject() {
+		// Get highest numerical index - ignored
+//		$highestIndex = $this->stream->readLong();
+
+		$data = array();
+
+		while ($key = $this->stream->readUTF()) {
+			$data[$key] = $this->readData();
+		}
+		// Mixed array record ends with empty string (0x00 0x00) and 0x09
+		if (($key == '') && ($this->stream->peekByte() == 0x09)) {
+			// Consume byte
+			$this->stream->readByte();
+		}
+		return $data;
+	}
+
+	public function readMixedArray() {
+		// Get highest numerical index - ignored
+		$highestIndex = $this->stream->readLong();
+
+		$data = array();
+
+		while ($key = $this->stream->readUTF()) {
+			if (is_numeric($key)) {
+				$key = (float) $key;
+			}
+			$data[$key] = $this->readData();
+		}
+		// Mixed array record ends with empty string (0x00 0x00) and 0x09
+		if (($key == '') && ($this->stream->peekByte() == 0x09)) {
+			// Consume byte
+			$this->stream->readByte();
+		}
+
+		return $data;
+	}
+
+	public function readArray() {
+		$length = $this->stream->readLong();
+		$data = array();
+
+		for ($i = 0; $i < $length; $i++) {
+			$data[] = $this->readData();
+		}
+		return $data;
+	}
+
+	public function readDate() {
+		$timestamp = $this->stream->readDouble();
+		$timezone = $this->stream->readInt();
+		return $timestamp;
+	}
+
+	public function readLongString() {
+		return $this->stream->readLongUTF();
+	}
+
+	public function readXML() {
+		return $this->stream->readLongUTF();
+	}
+
+	public function readTypedObject() {
+		$className = $this->stream->readUTF();
+		return $this->readObject();
+	}
+}
+
+class AVCSequenceParameterSetReader {
+	public $sps;
+	public $start = 0;
+	public $currentBytes = 0;
+	public $currentBits = 0;
+	public $width;
+	public $height;
+
+	public function AVCSequenceParameterSetReader($sps) {
+		$this->sps = $sps;
+	}
+
+	public function readData() {
+		$this->skipBits(8);
+		$this->skipBits(8);
+		$profile = $this->getBits(8);	//	read profile
+		$this->skipBits(16);
+		$this->expGolombUe();	//	read sps id
+		if (in_array($profile, array(H264_PROFILE_HIGH, H264_PROFILE_HIGH10, H264_PROFILE_HIGH422, H264_PROFILE_HIGH444, H264_PROFILE_HIGH444_PREDICTIVE))) {
+			if ($this->expGolombUe() == 3) {
+				$this->skipBits(1);
+			}
+			$this->expGolombUe();
+			$this->expGolombUe();
+			$this->skipBits(1);
+			if ($this->getBit()) {
+				for ($i = 0; $i < 8; $i++) {
+					if ($this->getBit()) {
+						$size = $i < 6 ? 16 : 64;
+						$lastScale = 8;
+						$nextScale = 8;
+						for ($j = 0; $j < $size; $j++) {
+							if ($nextScale != 0) {
+								$deltaScale = $this->expGolombUe();
+								$nextScale = ($lastScale + $deltaScale + 256) % 256;
+							}
+							if ($nextScale != 0) {
+								$lastScale = $nextScale;
+							}
+						}
+					}
+				}
+			}
+		}
+		$this->expGolombUe();
+		$pocType = $this->expGolombUe();
+		if ($pocType == 0) {
+			$this->expGolombUe();
+		} elseif ($pocType == 1) {
+			$this->skipBits(1);
+			$this->expGolombSe();
+			$this->expGolombSe();
+			$pocCycleLength = $this->expGolombUe();
+			for ($i = 0; $i < $pocCycleLength; $i++) {
+				$this->expGolombSe();
+			}
+		}
+		$this->expGolombUe();
+		$this->skipBits(1);
+		$this->width = ($this->expGolombUe() + 1) * 16;
+		$heightMap = $this->expGolombUe() + 1;
+		$this->height = (2 - $this->getBit()) * $heightMap * 16;
+	}
+
+	public function skipBits($bits) {
+		$newBits = $this->currentBits + $bits;
+		$this->currentBytes += (int)floor($newBits / 8);
+		$this->currentBits = $newBits % 8;
+	}
+
+	public function getBit() {
+		$result = (getid3_lib::BigEndian2Int(substr($this->sps, $this->currentBytes, 1)) >> (7 - $this->currentBits)) & 0x01;
+		$this->skipBits(1);
+		return $result;
+	}
+
+	public function getBits($bits) {
+		$result = 0;
+		for ($i = 0; $i < $bits; $i++) {
+			$result = ($result << 1) + $this->getBit();
+		}
+		return $result;
+	}
+
+	public function expGolombUe() {
+		$significantBits = 0;
+		$bit = $this->getBit();
+		while ($bit == 0) {
+			$significantBits++;
+			$bit = $this->getBit();
+
+			if ($significantBits > 31) {
+				// something is broken, this is an emergency escape to prevent infinite loops
+				return 0;
+			}
+		}
+		return (1 << $significantBits) + $this->getBits($significantBits) - 1;
+	}
+
+	public function expGolombSe() {
+		$result = $this->expGolombUe();
+		if (($result & 0x01) == 0) {
+			return -($result >> 1);
+		} else {
+			return ($result + 1) >> 1;
+		}
+	}
+
+	public function getWidth() {
+		return $this->width;
+	}
+
+	public function getHeight() {
+		return $this->height;
+	}
+}
Index: /extensions/piwigo_videojs/include/getid3/module.audio-video.matroska.php
===================================================================
--- /extensions/piwigo_videojs/include/getid3/module.audio-video.matroska.php	(revision 24676)
+++ /extensions/piwigo_videojs/include/getid3/module.audio-video.matroska.php	(revision 24676)
@@ -0,0 +1,1771 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// module.audio-video.matriska.php                             //
+// module for analyzing Matroska containers                    //
+// dependencies: NONE                                          //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+
+define('EBML_ID_CHAPTERS',                  0x0043A770); // [10][43][A7][70] -- A system to define basic menus and partition data. For more detailed information, look at the Chapters Explanation.
+define('EBML_ID_SEEKHEAD',                  0x014D9B74); // [11][4D][9B][74] -- Contains the position of other level 1 elements.
+define('EBML_ID_TAGS',                      0x0254C367); // [12][54][C3][67] -- Element containing elements specific to Tracks/Chapters. A list of valid tags can be found <http://www.matroska.org/technical/specs/tagging/index.html>.
+define('EBML_ID_INFO',                      0x0549A966); // [15][49][A9][66] -- Contains miscellaneous general information and statistics on the file.
+define('EBML_ID_TRACKS',                    0x0654AE6B); // [16][54][AE][6B] -- A top-level block of information with many tracks described.
+define('EBML_ID_SEGMENT',                   0x08538067); // [18][53][80][67] -- This element contains all other top-level (level 1) elements. Typically a Matroska file is composed of 1 segment.
+define('EBML_ID_ATTACHMENTS',               0x0941A469); // [19][41][A4][69] -- Contain attached files.
+define('EBML_ID_EBML',                      0x0A45DFA3); // [1A][45][DF][A3] -- Set the EBML characteristics of the data to follow. Each EBML document has to start with this.
+define('EBML_ID_CUES',                      0x0C53BB6B); // [1C][53][BB][6B] -- A top-level element to speed seeking access. All entries are local to the segment.
+define('EBML_ID_CLUSTER',                   0x0F43B675); // [1F][43][B6][75] -- The lower level element containing the (monolithic) Block structure.
+define('EBML_ID_LANGUAGE',                    0x02B59C); //     [22][B5][9C] -- Specifies the language of the track in the Matroska languages form.
+define('EBML_ID_TRACKTIMECODESCALE',          0x03314F); //     [23][31][4F] -- The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs).
+define('EBML_ID_DEFAULTDURATION',             0x03E383); //     [23][E3][83] -- Number of nanoseconds (i.e. not scaled) per frame.
+define('EBML_ID_CODECNAME',                   0x058688); //     [25][86][88] -- A human-readable string specifying the codec.
+define('EBML_ID_CODECDOWNLOADURL',            0x06B240); //     [26][B2][40] -- A URL to download about the codec used.
+define('EBML_ID_TIMECODESCALE',               0x0AD7B1); //     [2A][D7][B1] -- Timecode scale in nanoseconds (1.000.000 means all timecodes in the segment are expressed in milliseconds).
+define('EBML_ID_COLOURSPACE',                 0x0EB524); //     [2E][B5][24] -- Same value as in AVI (32 bits).
+define('EBML_ID_GAMMAVALUE',                  0x0FB523); //     [2F][B5][23] -- Gamma Value.
+define('EBML_ID_CODECSETTINGS',               0x1A9697); //     [3A][96][97] -- A string describing the encoding setting used.
+define('EBML_ID_CODECINFOURL',                0x1B4040); //     [3B][40][40] -- A URL to find information about the codec used.
+define('EBML_ID_PREVFILENAME',                0x1C83AB); //     [3C][83][AB] -- An escaped filename corresponding to the previous segment.
+define('EBML_ID_PREVUID',                     0x1CB923); //     [3C][B9][23] -- A unique ID to identify the previous chained segment (128 bits).
+define('EBML_ID_NEXTFILENAME',                0x1E83BB); //     [3E][83][BB] -- An escaped filename corresponding to the next segment.
+define('EBML_ID_NEXTUID',                     0x1EB923); //     [3E][B9][23] -- A unique ID to identify the next chained segment (128 bits).
+define('EBML_ID_CONTENTCOMPALGO',               0x0254); //         [42][54] -- The compression algorithm used. Algorithms that have been specified so far are:
+define('EBML_ID_CONTENTCOMPSETTINGS',           0x0255); //         [42][55] -- Settings that might be needed by the decompressor. For Header Stripping (ContentCompAlgo=3), the bytes that were removed from the beggining of each frames of the track.
+define('EBML_ID_DOCTYPE',                       0x0282); //         [42][82] -- A string that describes the type of document that follows this EBML header ('matroska' in our case).
+define('EBML_ID_DOCTYPEREADVERSION',            0x0285); //         [42][85] -- The minimum DocType version an interpreter has to support to read this file.
+define('EBML_ID_EBMLVERSION',                   0x0286); //         [42][86] -- The version of EBML parser used to create the file.
+define('EBML_ID_DOCTYPEVERSION',                0x0287); //         [42][87] -- The version of DocType interpreter used to create the file.
+define('EBML_ID_EBMLMAXIDLENGTH',               0x02F2); //         [42][F2] -- The maximum length of the IDs you'll find in this file (4 or less in Matroska).
+define('EBML_ID_EBMLMAXSIZELENGTH',             0x02F3); //         [42][F3] -- The maximum length of the sizes you'll find in this file (8 or less in Matroska). This does not override the element size indicated at the beginning of an element. Elements that have an indicated size which is larger than what is allowed by EBMLMaxSizeLength shall be considered invalid.
+define('EBML_ID_EBMLREADVERSION',               0x02F7); //         [42][F7] -- The minimum EBML version a parser has to support to read this file.
+define('EBML_ID_CHAPLANGUAGE',                  0x037C); //         [43][7C] -- The languages corresponding to the string, in the bibliographic ISO-639-2 form.
+define('EBML_ID_CHAPCOUNTRY',                   0x037E); //         [43][7E] -- The countries corresponding to the string, same 2 octets as in Internet domains.
+define('EBML_ID_SEGMENTFAMILY',                 0x0444); //         [44][44] -- A randomly generated unique ID that all segments related to each other must use (128 bits).
+define('EBML_ID_DATEUTC',                       0x0461); //         [44][61] -- Date of the origin of timecode (value 0), i.e. production date.
+define('EBML_ID_TAGLANGUAGE',                   0x047A); //         [44][7A] -- Specifies the language of the tag specified, in the Matroska languages form.
+define('EBML_ID_TAGDEFAULT',                    0x0484); //         [44][84] -- Indication to know if this is the default/original language to use for the given tag.
+define('EBML_ID_TAGBINARY',                     0x0485); //         [44][85] -- The values of the Tag if it is binary. Note that this cannot be used in the same SimpleTag as TagString.
+define('EBML_ID_TAGSTRING',                     0x0487); //         [44][87] -- The value of the Tag.
+define('EBML_ID_DURATION',                      0x0489); //         [44][89] -- Duration of the segment (based on TimecodeScale).
+define('EBML_ID_CHAPPROCESSPRIVATE',            0x050D); //         [45][0D] -- Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent.
+define('EBML_ID_CHAPTERFLAGENABLED',            0x0598); //         [45][98] -- Specify wether the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie should skip all the content between the TimeStart and TimeEnd of this chapter.
+define('EBML_ID_TAGNAME',                       0x05A3); //         [45][A3] -- The name of the Tag that is going to be stored.
+define('EBML_ID_EDITIONENTRY',                  0x05B9); //         [45][B9] -- Contains all information about a segment edition.
+define('EBML_ID_EDITIONUID',                    0x05BC); //         [45][BC] -- A unique ID to identify the edition. It's useful for tagging an edition.
+define('EBML_ID_EDITIONFLAGHIDDEN',             0x05BD); //         [45][BD] -- If an edition is hidden (1), it should not be available to the user interface (but still to Control Tracks).
+define('EBML_ID_EDITIONFLAGDEFAULT',            0x05DB); //         [45][DB] -- If a flag is set (1) the edition should be used as the default one.
+define('EBML_ID_EDITIONFLAGORDERED',            0x05DD); //         [45][DD] -- Specify if the chapters can be defined multiple times and the order to play them is enforced.
+define('EBML_ID_FILEDATA',                      0x065C); //         [46][5C] -- The data of the file.
+define('EBML_ID_FILEMIMETYPE',                  0x0660); //         [46][60] -- MIME type of the file.
+define('EBML_ID_FILENAME',                      0x066E); //         [46][6E] -- Filename of the attached file.
+define('EBML_ID_FILEREFERRAL',                  0x0675); //         [46][75] -- A binary value that a track/codec can refer to when the attachment is needed.
+define('EBML_ID_FILEDESCRIPTION',               0x067E); //         [46][7E] -- A human-friendly name for the attached file.
+define('EBML_ID_FILEUID',                       0x06AE); //         [46][AE] -- Unique ID representing the file, as random as possible.
+define('EBML_ID_CONTENTENCALGO',                0x07E1); //         [47][E1] -- The encryption algorithm used. The value '0' means that the contents have not been encrypted but only signed. Predefined values:
+define('EBML_ID_CONTENTENCKEYID',               0x07E2); //         [47][E2] -- For public key algorithms this is the ID of the public key the the data was encrypted with.
+define('EBML_ID_CONTENTSIGNATURE',              0x07E3); //         [47][E3] -- A cryptographic signature of the contents.
+define('EBML_ID_CONTENTSIGKEYID',               0x07E4); //         [47][E4] -- This is the ID of the private key the data was signed with.
+define('EBML_ID_CONTENTSIGALGO',                0x07E5); //         [47][E5] -- The algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values:
+define('EBML_ID_CONTENTSIGHASHALGO',            0x07E6); //         [47][E6] -- The hash algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values:
+define('EBML_ID_MUXINGAPP',                     0x0D80); //         [4D][80] -- Muxing application or library ("libmatroska-0.4.3").
+define('EBML_ID_SEEK',                          0x0DBB); //         [4D][BB] -- Contains a single seek entry to an EBML element.
+define('EBML_ID_CONTENTENCODINGORDER',          0x1031); //         [50][31] -- Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder elements in the segment.
+define('EBML_ID_CONTENTENCODINGSCOPE',          0x1032); //         [50][32] -- A bit field that describes which elements have been modified in this way. Values (big endian) can be OR'ed. Possible values:
+define('EBML_ID_CONTENTENCODINGTYPE',           0x1033); //         [50][33] -- A value describing what kind of transformation has been done. Possible values:
+define('EBML_ID_CONTENTCOMPRESSION',            0x1034); //         [50][34] -- Settings describing the compression used. Must be present if the value of ContentEncodingType is 0 and absent otherwise. Each block must be decompressable even if no previous block is available in order not to prevent seeking.
+define('EBML_ID_CONTENTENCRYPTION',             0x1035); //         [50][35] -- Settings describing the encryption used. Must be present if the value of ContentEncodingType is 1 and absent otherwise.
+define('EBML_ID_CUEREFNUMBER',                  0x135F); //         [53][5F] -- Number of the referenced Block of Track X in the specified Cluster.
+define('EBML_ID_NAME',                          0x136E); //         [53][6E] -- A human-readable track name.
+define('EBML_ID_CUEBLOCKNUMBER',                0x1378); //         [53][78] -- Number of the Block in the specified Cluster.
+define('EBML_ID_TRACKOFFSET',                   0x137F); //         [53][7F] -- A value to add to the Block's Timecode. This can be used to adjust the playback offset of a track.
+define('EBML_ID_SEEKID',                        0x13AB); //         [53][AB] -- The binary ID corresponding to the element name.
+define('EBML_ID_SEEKPOSITION',                  0x13AC); //         [53][AC] -- The position of the element in the segment in octets (0 = first level 1 element).
+define('EBML_ID_STEREOMODE',                    0x13B8); //         [53][B8] -- Stereo-3D video mode.
+define('EBML_ID_OLDSTEREOMODE',                 0x13B9); //         [53][B9] -- Bogus StereoMode value used in old versions of libmatroska. DO NOT USE. (0: mono, 1: right eye, 2: left eye, 3: both eyes).
+define('EBML_ID_PIXELCROPBOTTOM',               0x14AA); //         [54][AA] -- The number of video pixels to remove at the bottom of the image (for HDTV content).
+define('EBML_ID_DISPLAYWIDTH',                  0x14B0); //         [54][B0] -- Width of the video frames to display.
+define('EBML_ID_DISPLAYUNIT',                   0x14B2); //         [54][B2] -- Type of the unit for DisplayWidth/Height (0: pixels, 1: centimeters, 2: inches).
+define('EBML_ID_ASPECTRATIOTYPE',               0x14B3); //         [54][B3] -- Specify the possible modifications to the aspect ratio (0: free resizing, 1: keep aspect ratio, 2: fixed).
+define('EBML_ID_DISPLAYHEIGHT',                 0x14BA); //         [54][BA] -- Height of the video frames to display.
+define('EBML_ID_PIXELCROPTOP',                  0x14BB); //         [54][BB] -- The number of video pixels to remove at the top of the image.
+define('EBML_ID_PIXELCROPLEFT',                 0x14CC); //         [54][CC] -- The number of video pixels to remove on the left of the image.
+define('EBML_ID_PIXELCROPRIGHT',                0x14DD); //         [54][DD] -- The number of video pixels to remove on the right of the image.
+define('EBML_ID_FLAGFORCED',                    0x15AA); //         [55][AA] -- Set if that track MUST be used during playback. There can be many forced track for a kind (audio, video or subs), the player should select the one which language matches the user preference or the default + forced track. Overlay MAY happen between a forced and non-forced track of the same kind.
+define('EBML_ID_MAXBLOCKADDITIONID',            0x15EE); //         [55][EE] -- The maximum value of BlockAddID. A value 0 means there is no BlockAdditions for this track.
+define('EBML_ID_WRITINGAPP',                    0x1741); //         [57][41] -- Writing application ("mkvmerge-0.3.3").
+define('EBML_ID_CLUSTERSILENTTRACKS',           0x1854); //         [58][54] -- The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking. Then you should decide what track to use.
+define('EBML_ID_CLUSTERSILENTTRACKNUMBER',      0x18D7); //         [58][D7] -- One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster.
+define('EBML_ID_ATTACHEDFILE',                  0x21A7); //         [61][A7] -- An attached file.
+define('EBML_ID_CONTENTENCODING',               0x2240); //         [62][40] -- Settings for one content encoding like compression or encryption.
+define('EBML_ID_BITDEPTH',                      0x2264); //         [62][64] -- Bits per sample, mostly used for PCM.
+define('EBML_ID_CODECPRIVATE',                  0x23A2); //         [63][A2] -- Private data only known to the codec.
+define('EBML_ID_TARGETS',                       0x23C0); //         [63][C0] -- Contain all UIDs where the specified meta data apply. It is void to describe everything in the segment.
+define('EBML_ID_CHAPTERPHYSICALEQUIV',          0x23C3); //         [63][C3] -- Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50), see complete list of values.
+define('EBML_ID_TAGCHAPTERUID',                 0x23C4); //         [63][C4] -- A unique ID to identify the Chapter(s) the tags belong to. If the value is 0 at this level, the tags apply to all chapters in the Segment.
+define('EBML_ID_TAGTRACKUID',                   0x23C5); //         [63][C5] -- A unique ID to identify the Track(s) the tags belong to. If the value is 0 at this level, the tags apply to all tracks in the Segment.
+define('EBML_ID_TAGATTACHMENTUID',              0x23C6); //         [63][C6] -- A unique ID to identify the Attachment(s) the tags belong to. If the value is 0 at this level, the tags apply to all the attachments in the Segment.
+define('EBML_ID_TAGEDITIONUID',                 0x23C9); //         [63][C9] -- A unique ID to identify the EditionEntry(s) the tags belong to. If the value is 0 at this level, the tags apply to all editions in the Segment.
+define('EBML_ID_TARGETTYPE',                    0x23CA); //         [63][CA] -- An informational string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc (see TargetType).
+define('EBML_ID_TRACKTRANSLATE',                0x2624); //         [66][24] -- The track identification for the given Chapter Codec.
+define('EBML_ID_TRACKTRANSLATETRACKID',         0x26A5); //         [66][A5] -- The binary value used to represent this track in the chapter codec data. The format depends on the ChapProcessCodecID used.
+define('EBML_ID_TRACKTRANSLATECODEC',           0x26BF); //         [66][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu).
+define('EBML_ID_TRACKTRANSLATEEDITIONUID',      0x26FC); //         [66][FC] -- Specify an edition UID on which this translation applies. When not specified, it means for all editions found in the segment.
+define('EBML_ID_SIMPLETAG',                     0x27C8); //         [67][C8] -- Contains general information about the target.
+define('EBML_ID_TARGETTYPEVALUE',               0x28CA); //         [68][CA] -- A number to indicate the logical level of the target (see TargetType).
+define('EBML_ID_CHAPPROCESSCOMMAND',            0x2911); //         [69][11] -- Contains all the commands associated to the Atom.
+define('EBML_ID_CHAPPROCESSTIME',               0x2922); //         [69][22] -- Defines when the process command should be handled (0: during the whole chapter, 1: before starting playback, 2: after playback of the chapter).
+define('EBML_ID_CHAPTERTRANSLATE',              0x2924); //         [69][24] -- A tuple of corresponding ID used by chapter codecs to represent this segment.
+define('EBML_ID_CHAPPROCESSDATA',               0x2933); //         [69][33] -- Contains the command information. The data should be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands.
+define('EBML_ID_CHAPPROCESS',                   0x2944); //         [69][44] -- Contains all the commands associated to the Atom.
+define('EBML_ID_CHAPPROCESSCODECID',            0x2955); //         [69][55] -- Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used. More codec IDs can be added later.
+define('EBML_ID_CHAPTERTRANSLATEID',            0x29A5); //         [69][A5] -- The binary value used to represent this segment in the chapter codec data. The format depends on the ChapProcessCodecID used.
+define('EBML_ID_CHAPTERTRANSLATECODEC',         0x29BF); //         [69][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu).
+define('EBML_ID_CHAPTERTRANSLATEEDITIONUID',    0x29FC); //         [69][FC] -- Specify an edition UID on which this correspondance applies. When not specified, it means for all editions found in the segment.
+define('EBML_ID_CONTENTENCODINGS',              0x2D80); //         [6D][80] -- Settings for several content encoding mechanisms like compression or encryption.
+define('EBML_ID_MINCACHE',                      0x2DE7); //         [6D][E7] -- The minimum number of frames a player should be able to cache during playback. If set to 0, the reference pseudo-cache system is not used.
+define('EBML_ID_MAXCACHE',                      0x2DF8); //         [6D][F8] -- The maximum cache size required to store referenced frames in and the current frame. 0 means no cache is needed.
+define('EBML_ID_CHAPTERSEGMENTUID',             0x2E67); //         [6E][67] -- A segment to play in place of this chapter. Edition ChapterSegmentEditionUID should be used for this segment, otherwise no edition is used.
+define('EBML_ID_CHAPTERSEGMENTEDITIONUID',      0x2EBC); //         [6E][BC] -- The edition to play from the segment linked in ChapterSegmentUID.
+define('EBML_ID_TRACKOVERLAY',                  0x2FAB); //         [6F][AB] -- Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap (see SilentTracks) the overlay track should be used instead. The order of multiple TrackOverlay matters, the first one is the one that should be used. If not found it should be the second, etc.
+define('EBML_ID_TAG',                           0x3373); //         [73][73] -- Element containing elements specific to Tracks/Chapters.
+define('EBML_ID_SEGMENTFILENAME',               0x3384); //         [73][84] -- A filename corresponding to this segment.
+define('EBML_ID_SEGMENTUID',                    0x33A4); //         [73][A4] -- A randomly generated unique ID to identify the current segment between many others (128 bits).
+define('EBML_ID_CHAPTERUID',                    0x33C4); //         [73][C4] -- A unique ID to identify the Chapter.
+define('EBML_ID_TRACKUID',                      0x33C5); //         [73][C5] -- A unique ID to identify the Track. This should be kept the same when making a direct stream copy of the Track to another file.
+define('EBML_ID_ATTACHMENTLINK',                0x3446); //         [74][46] -- The UID of an attachment that is used by this codec.
+define('EBML_ID_CLUSTERBLOCKADDITIONS',         0x35A1); //         [75][A1] -- Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data.
+define('EBML_ID_CHANNELPOSITIONS',              0x347B); //         [7D][7B] -- Table of horizontal angles for each successive channel, see appendix.
+define('EBML_ID_OUTPUTSAMPLINGFREQUENCY',       0x38B5); //         [78][B5] -- Real output sampling frequency in Hz (used for SBR techniques).
+define('EBML_ID_TITLE',                         0x3BA9); //         [7B][A9] -- General name of the segment.
+define('EBML_ID_CHAPTERDISPLAY',                  0x00); //             [80] -- Contains all possible strings to use for the chapter display.
+define('EBML_ID_TRACKTYPE',                       0x03); //             [83] -- A set of track types coded on 8 bits (1: video, 2: audio, 3: complex, 0x10: logo, 0x11: subtitle, 0x12: buttons, 0x20: control).
+define('EBML_ID_CHAPSTRING',                      0x05); //             [85] -- Contains the string to use as the chapter atom.
+define('EBML_ID_CODECID',                         0x06); //             [86] -- An ID corresponding to the codec, see the codec page for more info.
+define('EBML_ID_FLAGDEFAULT',                     0x08); //             [88] -- Set if that track (audio, video or subs) SHOULD be used if no language found matches the user preference.
+define('EBML_ID_CHAPTERTRACKNUMBER',              0x09); //             [89] -- UID of the Track to apply this chapter too. In the absense of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absense of this element indicates that the Chapter should be applied to any currently used Tracks.
+define('EBML_ID_CLUSTERSLICES',                   0x0E); //             [8E] -- Contains slices description.
+define('EBML_ID_CHAPTERTRACK',                    0x0F); //             [8F] -- List of tracks on which the chapter applies. If this element is not present, all tracks apply
+define('EBML_ID_CHAPTERTIMESTART',                0x11); //             [91] -- Timecode of the start of Chapter (not scaled).
+define('EBML_ID_CHAPTERTIMEEND',                  0x12); //             [92] -- Timecode of the end of Chapter (timecode excluded, not scaled).
+define('EBML_ID_CUEREFTIME',                      0x16); //             [96] -- Timecode of the referenced Block.
+define('EBML_ID_CUEREFCLUSTER',                   0x17); //             [97] -- Position of the Cluster containing the referenced Block.
+define('EBML_ID_CHAPTERFLAGHIDDEN',               0x18); //             [98] -- If a chapter is hidden (1), it should not be available to the user interface (but still to Control Tracks).
+define('EBML_ID_FLAGINTERLACED',                  0x1A); //             [9A] -- Set if the video is interlaced.
+define('EBML_ID_CLUSTERBLOCKDURATION',            0x1B); //             [9B] -- The duration of the Block (based on TimecodeScale). This element is mandatory when DefaultDuration is set for the track. When not written and with no DefaultDuration, the value is assumed to be the difference between the timecode of this Block and the timecode of the next Block in "display" order (not coding order). This element can be useful at the end of a Track (as there is not other Block available), or when there is a break in a track like for subtitle tracks.
+define('EBML_ID_FLAGLACING',                      0x1C); //             [9C] -- Set if the track may contain blocks using lacing.
+define('EBML_ID_CHANNELS',                        0x1F); //             [9F] -- Numbers of channels in the track.
+define('EBML_ID_CLUSTERBLOCKGROUP',               0x20); //             [A0] -- Basic container of information containing a single Block or BlockVirtual, and information specific to that Block/VirtualBlock.
+define('EBML_ID_CLUSTERBLOCK',                    0x21); //             [A1] -- Block containing the actual data to be rendered and a timecode relative to the Cluster Timecode.
+define('EBML_ID_CLUSTERBLOCKVIRTUAL',             0x22); //             [A2] -- A Block with no data. It must be stored in the stream at the place the real Block should be in display order.
+define('EBML_ID_CLUSTERSIMPLEBLOCK',              0x23); //             [A3] -- Similar to Block but without all the extra information, mostly used to reduced overhead when no extra feature is needed.
+define('EBML_ID_CLUSTERCODECSTATE',               0x24); //             [A4] -- The new codec state to use. Data interpretation is private to the codec. This information should always be referenced by a seek entry.
+define('EBML_ID_CLUSTERBLOCKADDITIONAL',          0x25); //             [A5] -- Interpreted by the codec as it wishes (using the BlockAddID).
+define('EBML_ID_CLUSTERBLOCKMORE',                0x26); //             [A6] -- Contain the BlockAdditional and some parameters.
+define('EBML_ID_CLUSTERPOSITION',                 0x27); //             [A7] -- Position of the Cluster in the segment (0 in live broadcast streams). It might help to resynchronise offset on damaged streams.
+define('EBML_ID_CODECDECODEALL',                  0x2A); //             [AA] -- The codec can decode potentially damaged data.
+define('EBML_ID_CLUSTERPREVSIZE',                 0x2B); //             [AB] -- Size of the previous Cluster, in octets. Can be useful for backward playing.
+define('EBML_ID_TRACKENTRY',                      0x2E); //             [AE] -- Describes a track with all elements.
+define('EBML_ID_CLUSTERENCRYPTEDBLOCK',           0x2F); //             [AF] -- Similar to SimpleBlock but the data inside the Block are Transformed (encrypt and/or signed).
+define('EBML_ID_PIXELWIDTH',                      0x30); //             [B0] -- Width of the encoded video frames in pixels.
+define('EBML_ID_CUETIME',                         0x33); //             [B3] -- Absolute timecode according to the segment time base.
+define('EBML_ID_SAMPLINGFREQUENCY',               0x35); //             [B5] -- Sampling frequency in Hz.
+define('EBML_ID_CHAPTERATOM',                     0x36); //             [B6] -- Contains the atom information to use as the chapter atom (apply to all tracks).
+define('EBML_ID_CUETRACKPOSITIONS',               0x37); //             [B7] -- Contain positions for different tracks corresponding to the timecode.
+define('EBML_ID_FLAGENABLED',                     0x39); //             [B9] -- Set if the track is used.
+define('EBML_ID_PIXELHEIGHT',                     0x3A); //             [BA] -- Height of the encoded video frames in pixels.
+define('EBML_ID_CUEPOINT',                        0x3B); //             [BB] -- Contains all information relative to a seek point in the segment.
+define('EBML_ID_CRC32',                           0x3F); //             [BF] -- The CRC is computed on all the data of the Master element it's in, regardless of its position. It's recommended to put the CRC value at the beggining of the Master element for easier reading. All level 1 elements should include a CRC-32.
+define('EBML_ID_CLUSTERBLOCKADDITIONID',          0x4B); //             [CB] -- The ID of the BlockAdditional element (0 is the main Block).
+define('EBML_ID_CLUSTERLACENUMBER',               0x4C); //             [CC] -- The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback.
+define('EBML_ID_CLUSTERFRAMENUMBER',              0x4D); //             [CD] -- The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame).
+define('EBML_ID_CLUSTERDELAY',                    0x4E); //             [CE] -- The (scaled) delay to apply to the element.
+define('EBML_ID_CLUSTERDURATION',                 0x4F); //             [CF] -- The (scaled) duration to apply to the element.
+define('EBML_ID_TRACKNUMBER',                     0x57); //             [D7] -- The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number).
+define('EBML_ID_CUEREFERENCE',                    0x5B); //             [DB] -- The Clusters containing the required referenced Blocks.
+define('EBML_ID_VIDEO',                           0x60); //             [E0] -- Video settings.
+define('EBML_ID_AUDIO',                           0x61); //             [E1] -- Audio settings.
+define('EBML_ID_CLUSTERTIMESLICE',                0x68); //             [E8] -- Contains extra time information about the data contained in the Block. While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback.
+define('EBML_ID_CUECODECSTATE',                   0x6A); //             [EA] -- The position of the Codec State corresponding to this Cue element. 0 means that the data is taken from the initial Track Entry.
+define('EBML_ID_CUEREFCODECSTATE',                0x6B); //             [EB] -- The position of the Codec State corresponding to this referenced element. 0 means that the data is taken from the initial Track Entry.
+define('EBML_ID_VOID',                            0x6C); //             [EC] -- Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use.
+define('EBML_ID_CLUSTERTIMECODE',                 0x67); //             [E7] -- Absolute timecode of the cluster (based on TimecodeScale).
+define('EBML_ID_CLUSTERBLOCKADDID',               0x6E); //             [EE] -- An ID to identify the BlockAdditional level.
+define('EBML_ID_CUECLUSTERPOSITION',              0x71); //             [F1] -- The position of the Cluster containing the required Block.
+define('EBML_ID_CUETRACK',                        0x77); //             [F7] -- The track for which a position is given.
+define('EBML_ID_CLUSTERREFERENCEPRIORITY',        0x7A); //             [FA] -- This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced.
+define('EBML_ID_CLUSTERREFERENCEBLOCK',           0x7B); //             [FB] -- Timecode of another frame used as a reference (ie: B or P frame). The timecode is relative to the block it's attached to.
+define('EBML_ID_CLUSTERREFERENCEVIRTUAL',         0x7D); //             [FD] -- Relative position of the data that should be in position of the virtual block.
+
+
+/**
+* @tutorial http://www.matroska.org/technical/specs/index.html
+*
+* @todo Rewrite EBML parser to reduce it's size and honor default element values
+* @todo After rewrite implement stream size calculation, that will provide additional useful info and enable AAC/FLAC audio bitrate detection
+*/
+class getid3_matroska extends getid3_handler
+{
+	// public options
+	public static $hide_clusters    = true;  // if true, do not return information about CLUSTER chunks, since there's a lot of them and they're not usually useful [default: TRUE]
+    public static $parse_whole_file = false; // true to parse the whole file, not only header [default: FALSE]
+
+    // private parser settings/placeholders
+    private $EBMLbuffer        = '';
+    private $EBMLbuffer_offset = 0;
+    private $EBMLbuffer_length = 0;
+    private $current_offset    = 0;
+    private $unuseful_elements = array(EBML_ID_CRC32, EBML_ID_VOID);
+
+	public function Analyze()
+	{
+		$info = &$this->getid3->info;
+
+		// parse container
+		try {
+			$this->parseEBML($info);
+		} catch (Exception $e) {
+			$info['error'][] = 'EBML parser: '.$e->getMessage();
+		}
+
+		// calculate playtime
+		if (isset($info['matroska']['info']) && is_array($info['matroska']['info'])) {
+			foreach ($info['matroska']['info'] as $key => $infoarray) {
+				if (isset($infoarray['Duration'])) {
+					// TimecodeScale is how many nanoseconds each Duration unit is
+					$info['playtime_seconds'] = $infoarray['Duration'] * ((isset($infoarray['TimecodeScale']) ? $infoarray['TimecodeScale'] : 1000000) / 1000000000);
+					break;
+				}
+			}
+		}
+
+		// extract tags
+		if (isset($info['matroska']['tags']) && is_array($info['matroska']['tags'])) {
+			foreach ($info['matroska']['tags'] as $key => $infoarray) {
+				$this->ExtractCommentsSimpleTag($infoarray);
+			}
+		}
+
+		// process tracks
+		if (isset($info['matroska']['tracks']['tracks']) && is_array($info['matroska']['tracks']['tracks'])) {
+			foreach ($info['matroska']['tracks']['tracks'] as $key => $trackarray) {
+
+				$track_info = array();
+				$track_info['dataformat'] = self::CodecIDtoCommonName($trackarray['CodecID']);
+				$track_info['default'] = (isset($trackarray['FlagDefault']) ? $trackarray['FlagDefault'] : true);
+				if (isset($trackarray['Name'])) { $track_info['name'] = $trackarray['Name']; }
+
+				switch ($trackarray['TrackType']) {
+
+					case 1: // Video
+						$track_info['resolution_x'] = $trackarray['PixelWidth'];
+						$track_info['resolution_y'] = $trackarray['PixelHeight'];
+						$track_info['display_unit'] = self::displayUnit(isset($trackarray['DisplayUnit']) ? $trackarray['DisplayUnit'] : 0);
+						$track_info['display_x']    = (isset($trackarray['DisplayWidth']) ? $trackarray['DisplayWidth'] : $trackarray['PixelWidth']);
+						$track_info['display_y']    = (isset($trackarray['DisplayHeight']) ? $trackarray['DisplayHeight'] : $trackarray['PixelHeight']);
+
+						if (isset($trackarray['PixelCropBottom'])) { $track_info['crop_bottom'] = $trackarray['PixelCropBottom']; }
+						if (isset($trackarray['PixelCropTop']))    { $track_info['crop_top']    = $trackarray['PixelCropTop']; }
+						if (isset($trackarray['PixelCropLeft']))   { $track_info['crop_left']   = $trackarray['PixelCropLeft']; }
+						if (isset($trackarray['PixelCropRight']))  { $track_info['crop_right']  = $trackarray['PixelCropRight']; }
+						if (isset($trackarray['DefaultDuration'])) { $track_info['frame_rate']  = round(1000000000 / $trackarray['DefaultDuration'], 3); }
+						if (isset($trackarray['CodecName']))       { $track_info['codec']       = $trackarray['CodecName']; }
+
+						switch ($trackarray['CodecID']) {
+							case 'V_MS/VFW/FOURCC':
+								if (!getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, false)) {
+									$this->warning('Unable to parse codec private data ['.basename(__FILE__).':'.__LINE__.'] because cannot include "module.audio-video.riff.php"');
+									break;
+								}
+								$parsed = getid3_riff::ParseBITMAPINFOHEADER($trackarray['CodecPrivate']);
+								$track_info['codec'] = getid3_riff::fourccLookup($parsed['fourcc']);
+								$info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $parsed;
+								break;
+
+							/*case 'V_MPEG4/ISO/AVC':
+								$h264['profile']    = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 1, 1));
+								$h264['level']      = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 3, 1));
+								$rn                 = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 4, 1));
+								$h264['NALUlength'] = ($rn & 3) + 1;
+								$rn                 = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 5, 1));
+								$nsps               = ($rn & 31);
+								$offset             = 6;
+								for ($i = 0; $i < $nsps; $i ++) {
+									$length        = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], $offset, 2));
+									$h264['SPS'][] = substr($trackarray['CodecPrivate'], $offset + 2, $length);
+									$offset       += 2 + $length;
+								}
+								$npps               = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], $offset, 1));
+								$offset            += 1;
+								for ($i = 0; $i < $npps; $i ++) {
+									$length        = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], $offset, 2));
+									$h264['PPS'][] = substr($trackarray['CodecPrivate'], $offset + 2, $length);
+									$offset       += 2 + $length;
+								}
+								$info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $h264;
+								break;*/
+						}
+
+						$info['video']['streams'][] = $track_info;
+						break;
+
+					case 2: // Audio
+						$track_info['sample_rate'] = (isset($trackarray['SamplingFrequency']) ? $trackarray['SamplingFrequency'] : 8000.0);
+						$track_info['channels']    = (isset($trackarray['Channels']) ? $trackarray['Channels'] : 1);
+						$track_info['language']    = (isset($trackarray['Language']) ? $trackarray['Language'] : 'eng');
+						if (isset($trackarray['BitDepth']))  { $track_info['bits_per_sample'] = $trackarray['BitDepth']; }
+						if (isset($trackarray['CodecName'])) { $track_info['codec']           = $trackarray['CodecName']; }
+
+						switch ($trackarray['CodecID']) {
+							case 'A_PCM/INT/LIT':
+							case 'A_PCM/INT/BIG':
+								$track_info['bitrate'] = $trackarray['SamplingFrequency'] * $trackarray['Channels'] * $trackarray['BitDepth'];
+								break;
+
+							case 'A_AC3':
+							case 'A_DTS':
+							case 'A_MPEG/L3':
+							case 'A_MPEG/L2':
+							case 'A_FLAC':
+								if (!getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.'.($track_info['dataformat'] == 'mp2' ? 'mp3' : $track_info['dataformat']).'.php', __FILE__, false)) {
+									$this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because cannot include "module.audio.'.$track_info['dataformat'].'.php"');
+									break;
+								}
+
+								if (!isset($info['matroska']['track_data_offsets'][$trackarray['TrackNumber']])) {
+									$this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because $info[matroska][track_data_offsets]['.$trackarray['TrackNumber'].'] not set');
+									break;
+								}
+
+								// create temp instance
+								$getid3_temp = new getID3();
+								if ($track_info['dataformat'] != 'flac') {
+									$getid3_temp->openfile($this->getid3->filename);
+								}
+								$getid3_temp->info['avdataoffset'] = $info['matroska']['track_data_offsets'][$trackarray['TrackNumber']]['offset'];
+								if ($track_info['dataformat'][0] == 'm' || $track_info['dataformat'] == 'flac') {
+									$getid3_temp->info['avdataend'] = $info['matroska']['track_data_offsets'][$trackarray['TrackNumber']]['offset'] + $info['matroska']['track_data_offsets'][$trackarray['TrackNumber']]['length'];
+								}
+
+								// analyze
+								$class = 'getid3_'.($track_info['dataformat'] == 'mp2' ? 'mp3' : $track_info['dataformat']);
+								$header_data_key = $track_info['dataformat'][0] == 'm' ? 'mpeg' : $track_info['dataformat'];
+								$getid3_audio = new $class($getid3_temp, __CLASS__);
+								if ($track_info['dataformat'] == 'flac') {
+									$getid3_audio->AnalyzeString($trackarray['CodecPrivate']);
+								}
+								else {
+									$getid3_audio->Analyze();
+								}
+								if (!empty($getid3_temp->info[$header_data_key])) {
+									$info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $getid3_temp->info[$header_data_key];
+									if (isset($getid3_temp->info['audio']) && is_array($getid3_temp->info['audio'])) {
+										foreach ($getid3_temp->info['audio'] as $key => $value) {
+											$track_info[$key] = $value;
+										}
+									}
+								}
+								else {
+									$this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because '.$class.'::Analyze() failed at offset '.$getid3_temp->info['avdataoffset']);
+								}
+
+								// copy errors and warnings
+								if (!empty($getid3_temp->info['error'])) {
+									foreach ($getid3_temp->info['error'] as $newerror) {
+										$this->warning($class.'() says: ['.$newerror.']');
+									}
+								}
+								if (!empty($getid3_temp->info['warning'])) {
+									foreach ($getid3_temp->info['warning'] as $newerror) {
+										if ($track_info['dataformat'] == 'mp3' && preg_match('/^Probable truncated file: expecting \d+ bytes of audio data, only found \d+ \(short by \d+ bytes\)$/', $newerror)) {
+											// LAME/Xing header is probably set, but audio data is chunked into Matroska file and near-impossible to verify if audio stream is complete, so ignore useless warning
+											continue;
+										}
+										$this->warning($class.'() says: ['.$newerror.']');
+									}
+								}
+								unset($getid3_temp, $getid3_audio);
+								break;
+
+							case 'A_AAC':
+							case 'A_AAC/MPEG2/LC':
+							case 'A_AAC/MPEG2/LC/SBR':
+							case 'A_AAC/MPEG4/LC':
+							case 'A_AAC/MPEG4/LC/SBR':
+							    $this->warning($trackarray['CodecID'].' audio data contains no header, audio/video bitrates can\'t be calculated');
+								break;
+
+							case 'A_VORBIS':
+								if (!isset($trackarray['CodecPrivate'])) {
+									$this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because CodecPrivate data not set');
+									break;
+								}
+								$vorbis_offset = strpos($trackarray['CodecPrivate'], 'vorbis', 1);
+								if ($vorbis_offset === false) {
+									$this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because CodecPrivate data does not contain "vorbis" keyword');
+									break;
+								}
+								$vorbis_offset -= 1;
+
+								if (!getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ogg.php', __FILE__, false)) {
+									$this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because cannot include "module.audio.ogg.php"');
+									break;
+								}
+
+								// create temp instance
+								$getid3_temp = new getID3();
+
+								// analyze
+								$getid3_ogg = new getid3_ogg($getid3_temp);
+								$oggpageinfo['page_seqno'] = 0;
+								$getid3_ogg->ParseVorbisPageHeader($trackarray['CodecPrivate'], $vorbis_offset, $oggpageinfo);
+								if (!empty($getid3_temp->info['ogg'])) {
+									$info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $getid3_temp->info['ogg'];
+									if (isset($getid3_temp->info['audio']) && is_array($getid3_temp->info['audio'])) {
+										foreach ($getid3_temp->info['audio'] as $key => $value) {
+											$track_info[$key] = $value;
+										}
+									}
+								}
+
+								// copy errors and warnings
+								if (!empty($getid3_temp->info['error'])) {
+									foreach ($getid3_temp->info['error'] as $newerror) {
+										$this->warning('getid3_ogg() says: ['.$newerror.']');
+									}
+								}
+								if (!empty($getid3_temp->info['warning'])) {
+									foreach ($getid3_temp->info['warning'] as $newerror) {
+										$this->warning('getid3_ogg() says: ['.$newerror.']');
+									}
+								}
+
+								if (!empty($getid3_temp->info['ogg']['bitrate_nominal'])) {
+									$track_info['bitrate'] = $getid3_temp->info['ogg']['bitrate_nominal'];
+								}
+								unset($getid3_temp, $getid3_ogg, $oggpageinfo, $vorbis_offset);
+								break;
+
+							case 'A_MS/ACM':
+								if (!getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, false)) {
+									$this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because cannot include "module.audio-video.riff.php"');
+									break;
+								}
+
+								$parsed = getid3_riff::parseWAVEFORMATex($trackarray['CodecPrivate']);
+								foreach ($parsed as $key => $value) {
+									if ($key != 'raw') {
+										$track_info[$key] = $value;
+									}
+								}
+								$info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $parsed;
+								break;
+
+							default:
+								$this->warning('Unhandled audio type "'.(isset($trackarray['CodecID']) ? $trackarray['CodecID'] : '').'"');
+						}
+
+						$info['audio']['streams'][] = $track_info;
+						break;
+				}
+			}
+
+			if (!empty($info['video']['streams'])) {
+				$info['video'] = self::getDefaultStreamInfo($info['video']['streams']);
+			}
+			if (!empty($info['audio']['streams'])) {
+				$info['audio'] = self::getDefaultStreamInfo($info['audio']['streams']);
+			}
+		}
+
+		// process attachments
+		if (isset($info['matroska']['attachments']) && $this->getid3->option_save_attachments !== getID3::ATTACHMENTS_NONE) {
+			foreach ($info['matroska']['attachments'] as $i => $entry) {
+				if (strpos($entry['FileMimeType'], 'image/') === 0 && !empty($entry['FileData'])) {
+					$info['matroska']['comments']['picture'][] = array('data' => $entry['FileData'], 'image_mime' => $entry['FileMimeType'], 'filename' => $entry['FileName']);
+				}
+			}
+		}
+
+        // determine mime type
+		if (!empty($info['video']['streams'])) {
+			$info['mime_type'] = ($info['matroska']['doctype'] == 'webm' ? 'video/webm' : 'video/x-matroska');
+		} elseif (!empty($info['audio']['streams'])) {
+			$info['mime_type'] = ($info['matroska']['doctype'] == 'webm' ? 'audio/webm' : 'audio/x-matroska');
+		} elseif (isset($info['mime_type'])) {
+			unset($info['mime_type']);
+		}
+
+		return true;
+	}
+
+    private function parseEBML(&$info) {
+		// http://www.matroska.org/technical/specs/index.html#EBMLBasics
+		$this->current_offset = $info['avdataoffset'];
+
+		while ($this->getEBMLelement($top_element, $info['avdataend'])) {
+			switch ($top_element['id']) {
+
+				case EBML_ID_EBML:
+					$info['fileformat'] = 'matroska';
+					$info['matroska']['header']['offset'] = $top_element['offset'];
+					$info['matroska']['header']['length'] = $top_element['length'];
+
+					while ($this->getEBMLelement($element_data, $top_element['end'], true)) {
+						switch ($element_data['id']) {
+
+							case EBML_ID_EBMLVERSION:
+							case EBML_ID_EBMLREADVERSION:
+							case EBML_ID_EBMLMAXIDLENGTH:
+							case EBML_ID_EBMLMAXSIZELENGTH:
+							case EBML_ID_DOCTYPEVERSION:
+							case EBML_ID_DOCTYPEREADVERSION:
+								$element_data['data'] = getid3_lib::BigEndian2Int($element_data['data']);
+								break;
+
+							case EBML_ID_DOCTYPE:
+								$element_data['data'] = getid3_lib::trimNullByte($element_data['data']);
+								$info['matroska']['doctype'] = $element_data['data'];
+								break;
+
+							case EBML_ID_CRC32: // not useful, ignore
+								$this->current_offset = $element_data['end'];
+								unset($element_data);
+								break;
+
+							default:
+								$this->unhandledElement('header', __LINE__, $element_data);
+						}
+						if (!empty($element_data)) {
+							unset($element_data['offset'], $element_data['end']);
+							$info['matroska']['header']['elements'][] = $element_data;
+						}
+					}
+					break;
+
+				case EBML_ID_SEGMENT:
+					$info['matroska']['segment'][0]['offset'] = $top_element['offset'];
+					$info['matroska']['segment'][0]['length'] = $top_element['length'];
+
+					while ($this->getEBMLelement($element_data, $top_element['end'])) {
+						if ($element_data['id'] != EBML_ID_CLUSTER || !self::$hide_clusters) { // collect clusters only if required
+							$info['matroska']['segments'][] = $element_data;
+						}
+						switch ($element_data['id']) {
+
+							case EBML_ID_SEEKHEAD: // Contains the position of other level 1 elements.
+
+								while ($this->getEBMLelement($seek_entry, $element_data['end'])) {
+									switch ($seek_entry['id']) {
+
+										case EBML_ID_SEEK: // Contains a single seek entry to an EBML element
+											while ($this->getEBMLelement($sub_seek_entry, $seek_entry['end'], true)) {
+
+												switch ($sub_seek_entry['id']) {
+
+													case EBML_ID_SEEKID:
+														$seek_entry['target_id']   = self::EBML2Int($sub_seek_entry['data']);
+														$seek_entry['target_name'] = self::EBMLidName($seek_entry['target_id']);
+														break;
+
+													case EBML_ID_SEEKPOSITION:
+														$seek_entry['target_offset'] = $element_data['offset'] + getid3_lib::BigEndian2Int($sub_seek_entry['data']);
+														break;
+
+													default:
+														$this->unhandledElement('seekhead.seek', __LINE__, $sub_seek_entry);												}
+											}
+
+											if ($seek_entry['target_id'] != EBML_ID_CLUSTER || !self::$hide_clusters) { // collect clusters only if required
+												$info['matroska']['seek'][] = $seek_entry;
+											}
+											break;
+
+										default:
+											$this->unhandledElement('seekhead', __LINE__, $seek_entry);
+									}
+								}
+								break;
+
+							case EBML_ID_TRACKS: // A top-level block of information with many tracks described.
+								$info['matroska']['tracks'] = $element_data;
+
+								while ($this->getEBMLelement($track_entry, $element_data['end'])) {
+									switch ($track_entry['id']) {
+
+										case EBML_ID_TRACKENTRY: //subelements: Describes a track with all elements.
+
+											while ($this->getEBMLelement($subelement, $track_entry['end'], array(EBML_ID_VIDEO, EBML_ID_AUDIO, EBML_ID_CONTENTENCODINGS, EBML_ID_CODECPRIVATE))) {
+												switch ($subelement['id']) {
+
+													case EBML_ID_TRACKNUMBER:
+													case EBML_ID_TRACKUID:
+													case EBML_ID_TRACKTYPE:
+													case EBML_ID_MINCACHE:
+													case EBML_ID_MAXCACHE:
+													case EBML_ID_MAXBLOCKADDITIONID:
+													case EBML_ID_DEFAULTDURATION: // nanoseconds per frame
+														$track_entry[$subelement['id_name']] = getid3_lib::BigEndian2Int($subelement['data']);
+														break;
+
+													case EBML_ID_TRACKTIMECODESCALE:
+														$track_entry[$subelement['id_name']] = getid3_lib::BigEndian2Float($subelement['data']);
+														break;
+
+													case EBML_ID_CODECID:
+													case EBML_ID_LANGUAGE:
+													case EBML_ID_NAME:
+													case EBML_ID_CODECNAME:
+														$track_entry[$subelement['id_name']] = getid3_lib::trimNullByte($subelement['data']);
+														break;
+
+													case EBML_ID_CODECPRIVATE:
+														$track_entry[$subelement['id_name']] = $this->readEBMLelementData($subelement['length'], true);
+														break;
+
+													case EBML_ID_FLAGENABLED:
+													case EBML_ID_FLAGDEFAULT:
+													case EBML_ID_FLAGFORCED:
+													case EBML_ID_FLAGLACING:
+													case EBML_ID_CODECDECODEALL:
+														$track_entry[$subelement['id_name']] = (bool) getid3_lib::BigEndian2Int($subelement['data']);
+														break;
+
+													case EBML_ID_VIDEO:
+
+														while ($this->getEBMLelement($sub_subelement, $subelement['end'], true)) {
+															switch ($sub_subelement['id']) {
+
+																case EBML_ID_PIXELWIDTH:
+																case EBML_ID_PIXELHEIGHT:
+																case EBML_ID_PIXELCROPBOTTOM:
+																case EBML_ID_PIXELCROPTOP:
+																case EBML_ID_PIXELCROPLEFT:
+																case EBML_ID_PIXELCROPRIGHT:
+																case EBML_ID_DISPLAYWIDTH:
+																case EBML_ID_DISPLAYHEIGHT:
+																case EBML_ID_DISPLAYUNIT:
+																case EBML_ID_ASPECTRATIOTYPE:
+																case EBML_ID_STEREOMODE:
+																case EBML_ID_OLDSTEREOMODE:
+																	$track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
+																	break;
+
+																case EBML_ID_FLAGINTERLACED:
+																	$track_entry[$sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_subelement['data']);
+																	break;
+
+																case EBML_ID_GAMMAVALUE:
+																	$track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Float($sub_subelement['data']);
+																	break;
+
+																case EBML_ID_COLOURSPACE:
+																	$track_entry[$sub_subelement['id_name']] = getid3_lib::trimNullByte($sub_subelement['data']);
+																	break;
+
+																default:
+																	$this->unhandledElement('track.video', __LINE__, $sub_subelement);
+															}
+														}
+														break;
+
+													case EBML_ID_AUDIO:
+
+														while ($this->getEBMLelement($sub_subelement, $subelement['end'], true)) {
+															switch ($sub_subelement['id']) {
+
+																case EBML_ID_CHANNELS:
+																case EBML_ID_BITDEPTH:
+																	$track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
+																	break;
+
+																case EBML_ID_SAMPLINGFREQUENCY:
+																case EBML_ID_OUTPUTSAMPLINGFREQUENCY:
+																	$track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Float($sub_subelement['data']);
+																	break;
+
+																case EBML_ID_CHANNELPOSITIONS:
+																	$track_entry[$sub_subelement['id_name']] = getid3_lib::trimNullByte($sub_subelement['data']);
+																	break;
+
+																default:
+																	$this->unhandledElement('track.audio', __LINE__, $sub_subelement);
+															}
+														}
+														break;
+
+													case EBML_ID_CONTENTENCODINGS:
+
+														while ($this->getEBMLelement($sub_subelement, $subelement['end'])) {
+															switch ($sub_subelement['id']) {
+
+																case EBML_ID_CONTENTENCODING:
+
+																	while ($this->getEBMLelement($sub_sub_subelement, $sub_subelement['end'], array(EBML_ID_CONTENTCOMPRESSION, EBML_ID_CONTENTENCRYPTION))) {
+																		switch ($sub_sub_subelement['id']) {
+
+																			case EBML_ID_CONTENTENCODINGORDER:
+																			case EBML_ID_CONTENTENCODINGSCOPE:
+																			case EBML_ID_CONTENTENCODINGTYPE:
+																				$track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']);
+																				break;
+
+																			case EBML_ID_CONTENTCOMPRESSION:
+
+																				while ($this->getEBMLelement($sub_sub_sub_subelement, $sub_sub_subelement['end'], true)) {
+																					switch ($sub_sub_sub_subelement['id']) {
+
+																						case EBML_ID_CONTENTCOMPALGO:
+																							$track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']][$sub_sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_sub_subelement['data']);
+																							break;
+
+																						case EBML_ID_CONTENTCOMPSETTINGS:
+																							$track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']][$sub_sub_sub_subelement['id_name']] = $sub_sub_sub_subelement['data'];
+																							break;
+
+																						default:
+																							$this->unhandledElement('track.contentencodings.contentencoding.contentcompression', __LINE__, $sub_sub_sub_subelement);
+																					}
+																				}
+																				break;
+
+																			case EBML_ID_CONTENTENCRYPTION:
+
+																				while ($this->getEBMLelement($sub_sub_sub_subelement, $sub_sub_subelement['end'], true)) {
+																					switch ($sub_sub_sub_subelement['id']) {
+
+																						case EBML_ID_CONTENTENCALGO:
+																						case EBML_ID_CONTENTSIGALGO:
+																						case EBML_ID_CONTENTSIGHASHALGO:
+																							$track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']][$sub_sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_sub_subelement['data']);
+																							break;
+
+																						case EBML_ID_CONTENTENCKEYID:
+																						case EBML_ID_CONTENTSIGNATURE:
+																						case EBML_ID_CONTENTSIGKEYID:
+																							$track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']][$sub_sub_sub_subelement['id_name']] = $sub_sub_sub_subelement['data'];
+																							break;
+
+																						default:
+																							$this->unhandledElement('track.contentencodings.contentencoding.contentcompression', __LINE__, $sub_sub_sub_subelement);
+																					}
+																				}
+																				break;
+
+																			default:
+																				$this->unhandledElement('track.contentencodings.contentencoding', __LINE__, $sub_sub_subelement);
+																		}
+																	}
+																	break;
+
+																default:
+																	$this->unhandledElement('track.contentencodings', __LINE__, $sub_subelement);
+															}
+														}
+														break;
+
+													default:
+														$this->unhandledElement('track', __LINE__, $subelement);
+												}
+											}
+
+											$info['matroska']['tracks']['tracks'][] = $track_entry;
+											break;
+
+										default:
+											$this->unhandledElement('tracks', __LINE__, $track_entry);
+									}
+								}
+								break;
+
+							case EBML_ID_INFO: // Contains miscellaneous general information and statistics on the file.
+								$info_entry = array();
+
+								while ($this->getEBMLelement($subelement, $element_data['end'], true)) {
+									switch ($subelement['id']) {
+
+										case EBML_ID_TIMECODESCALE:
+											$info_entry[$subelement['id_name']] = getid3_lib::BigEndian2Int($subelement['data']);
+											break;
+
+										case EBML_ID_DURATION:
+											$info_entry[$subelement['id_name']] = getid3_lib::BigEndian2Float($subelement['data']);
+											break;
+
+										case EBML_ID_DATEUTC:
+											$info_entry[$subelement['id_name']]         = getid3_lib::BigEndian2Int($subelement['data']);
+											$info_entry[$subelement['id_name'].'_unix'] = self::EBMLdate2unix($info_entry[$subelement['id_name']]);
+											break;
+
+										case EBML_ID_SEGMENTUID:
+										case EBML_ID_PREVUID:
+										case EBML_ID_NEXTUID:
+											$info_entry[$subelement['id_name']] = getid3_lib::trimNullByte($subelement['data']);
+											break;
+
+										case EBML_ID_SEGMENTFAMILY:
+											$info_entry[$subelement['id_name']][] = getid3_lib::trimNullByte($subelement['data']);
+											break;
+
+										case EBML_ID_SEGMENTFILENAME:
+										case EBML_ID_PREVFILENAME:
+										case EBML_ID_NEXTFILENAME:
+										case EBML_ID_TITLE:
+										case EBML_ID_MUXINGAPP:
+										case EBML_ID_WRITINGAPP:
+											$info_entry[$subelement['id_name']] = getid3_lib::trimNullByte($subelement['data']);
+											$info['matroska']['comments'][strtolower($subelement['id_name'])][] = $info_entry[$subelement['id_name']];
+											break;
+
+										case EBML_ID_CHAPTERTRANSLATE:
+											$chaptertranslate_entry = array();
+
+											while ($this->getEBMLelement($sub_subelement, $subelement['end'], true)) {
+												switch ($sub_subelement['id']) {
+
+													case EBML_ID_CHAPTERTRANSLATEEDITIONUID:
+														$chaptertranslate_entry[$sub_subelement['id_name']][] = getid3_lib::BigEndian2Int($sub_subelement['data']);
+														break;
+
+													case EBML_ID_CHAPTERTRANSLATECODEC:
+														$chaptertranslate_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
+														break;
+
+													case EBML_ID_CHAPTERTRANSLATEID:
+														$chaptertranslate_entry[$sub_subelement['id_name']] = getid3_lib::trimNullByte($sub_subelement['data']);
+														break;
+
+													default:
+														$this->unhandledElement('info.chaptertranslate', __LINE__, $sub_subelement);
+												}
+											}
+											$info_entry[$subelement['id_name']] = $chaptertranslate_entry;
+											break;
+
+										default:
+											$this->unhandledElement('info', __LINE__, $subelement);
+									}
+								}
+								$info['matroska']['info'][] = $info_entry;
+								break;
+
+							case EBML_ID_CUES: // A top-level element to speed seeking access. All entries are local to the segment. Should be mandatory for non "live" streams.
+								if (self::$hide_clusters) { // do not parse cues if hide clusters is "ON" till they point to clusters anyway
+									$this->current_offset = $element_data['end'];
+									break;
+								}
+								$cues_entry = array();
+
+								while ($this->getEBMLelement($subelement, $element_data['end'])) {
+									switch ($subelement['id']) {
+
+										case EBML_ID_CUEPOINT:
+											$cuepoint_entry = array();
+
+											while ($this->getEBMLelement($sub_subelement, $subelement['end'], array(EBML_ID_CUETRACKPOSITIONS))) {
+												switch ($sub_subelement['id']) {
+
+													case EBML_ID_CUETRACKPOSITIONS:
+                                                    	$cuetrackpositions_entry = array();
+
+														while ($this->getEBMLelement($sub_sub_subelement, $sub_subelement['end'], true)) {
+															switch ($sub_sub_subelement['id']) {
+
+																case EBML_ID_CUETRACK:
+																case EBML_ID_CUECLUSTERPOSITION:
+																case EBML_ID_CUEBLOCKNUMBER:
+																case EBML_ID_CUECODECSTATE:
+																	$cuetrackpositions_entry[$sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']);
+																	break;
+
+																default:
+																	$this->unhandledElement('cues.cuepoint.cuetrackpositions', __LINE__, $sub_sub_subelement);
+															}
+														}
+														$cuepoint_entry[$sub_subelement['id_name']][] = $cuetrackpositions_entry;
+														break;
+
+													case EBML_ID_CUETIME:
+														$cuepoint_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
+														break;
+
+													default:
+														$this->unhandledElement('cues.cuepoint', __LINE__, $sub_subelement);
+												}
+											}
+											$cues_entry[] = $cuepoint_entry;
+											break;
+
+										default:
+											$this->unhandledElement('cues', __LINE__, $subelement);
+									}
+								}
+								$info['matroska']['cues'] = $cues_entry;
+								break;
+
+							case EBML_ID_TAGS: // Element containing elements specific to Tracks/Chapters.
+                            	$tags_entry = array();
+
+								while ($this->getEBMLelement($subelement, $element_data['end'], false)) {
+									switch ($subelement['id']) {
+
+										case EBML_ID_TAG:
+											$tag_entry = array();
+
+											while ($this->getEBMLelement($sub_subelement, $subelement['end'], false)) {
+												switch ($sub_subelement['id']) {
+
+													case EBML_ID_TARGETS:
+														$targets_entry = array();
+
+														while ($this->getEBMLelement($sub_sub_subelement, $sub_subelement['end'], true)) {
+															switch ($sub_sub_subelement['id']) {
+
+																case EBML_ID_TARGETTYPEVALUE:
+																	$targets_entry[$sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']);
+																	$targets_entry[strtolower($sub_sub_subelement['id_name']).'_long'] = self::TargetTypeValue($targets_entry[$sub_sub_subelement['id_name']]);
+																	break;
+
+																case EBML_ID_TARGETTYPE:
+																	$targets_entry[$sub_sub_subelement['id_name']] = $sub_sub_subelement['data'];
+																	break;
+
+																case EBML_ID_TAGTRACKUID:
+																case EBML_ID_TAGEDITIONUID:
+																case EBML_ID_TAGCHAPTERUID:
+																case EBML_ID_TAGATTACHMENTUID:
+																	$targets_entry[$sub_sub_subelement['id_name']][] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']);
+																	break;
+
+																default:
+																	$this->unhandledElement('tags.tag.targets', __LINE__, $sub_sub_subelement);
+															}
+														}
+														$tag_entry[$sub_subelement['id_name']] = $targets_entry;
+														break;
+
+													case EBML_ID_SIMPLETAG:
+														$tag_entry[$sub_subelement['id_name']][] = $this->HandleEMBLSimpleTag($sub_subelement['end']);
+														break;
+
+													default:
+														$this->unhandledElement('tags.tag', __LINE__, $sub_subelement);
+												}
+											}
+											$tags_entry[] = $tag_entry;
+											break;
+
+										default:
+											$this->unhandledElement('tags', __LINE__, $subelement);
+									}
+								}
+								$info['matroska']['tags'] = $tags_entry;
+								break;
+
+							case EBML_ID_ATTACHMENTS: // Contain attached files.
+
+								while ($this->getEBMLelement($subelement, $element_data['end'])) {
+									switch ($subelement['id']) {
+
+										case EBML_ID_ATTACHEDFILE:
+											$attachedfile_entry = array();
+
+											while ($this->getEBMLelement($sub_subelement, $subelement['end'], array(EBML_ID_FILEDATA))) {
+												switch ($sub_subelement['id']) {
+
+													case EBML_ID_FILEDESCRIPTION:
+													case EBML_ID_FILENAME:
+													case EBML_ID_FILEMIMETYPE:
+														$attachedfile_entry[$sub_subelement['id_name']] = $sub_subelement['data'];
+														break;
+
+													case EBML_ID_FILEDATA:
+														$attachedfile_entry['data_offset'] = $this->current_offset;
+														$attachedfile_entry['data_length'] = $sub_subelement['length'];
+
+														$attachedfile_entry[$sub_subelement['id_name']] = $this->saveAttachment(
+															$attachedfile_entry['FileName'],
+															$attachedfile_entry['data_offset'],
+															$attachedfile_entry['data_length']);
+
+														$this->current_offset = $sub_subelement['end'];
+														break;
+
+													case EBML_ID_FILEUID:
+														$attachedfile_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
+														break;
+
+													default:
+														$this->unhandledElement('attachments.attachedfile', __LINE__, $sub_subelement);
+												}
+											}
+											$info['matroska']['attachments'][] = $attachedfile_entry;
+											break;
+
+										default:
+											$this->unhandledElement('attachments', __LINE__, $subelement);
+									}
+								}
+								break;
+
+							case EBML_ID_CHAPTERS:
+
+								while ($this->getEBMLelement($subelement, $element_data['end'])) {
+									switch ($subelement['id']) {
+
+										case EBML_ID_EDITIONENTRY:
+											$editionentry_entry = array();
+
+											while ($this->getEBMLelement($sub_subelement, $subelement['end'], array(EBML_ID_CHAPTERATOM))) {
+												switch ($sub_subelement['id']) {
+
+													case EBML_ID_EDITIONUID:
+														$editionentry_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
+														break;
+
+													case EBML_ID_EDITIONFLAGHIDDEN:
+													case EBML_ID_EDITIONFLAGDEFAULT:
+													case EBML_ID_EDITIONFLAGORDERED:
+														$editionentry_entry[$sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_subelement['data']);
+														break;
+
+													case EBML_ID_CHAPTERATOM:
+														$chapteratom_entry = array();
+
+														while ($this->getEBMLelement($sub_sub_subelement, $sub_subelement['end'], array(EBML_ID_CHAPTERTRACK, EBML_ID_CHAPTERDISPLAY))) {
+															switch ($sub_sub_subelement['id']) {
+
+																case EBML_ID_CHAPTERSEGMENTUID:
+																case EBML_ID_CHAPTERSEGMENTEDITIONUID:
+																	$chapteratom_entry[$sub_sub_subelement['id_name']] = $sub_sub_subelement['data'];
+																	break;
+
+																case EBML_ID_CHAPTERFLAGENABLED:
+																case EBML_ID_CHAPTERFLAGHIDDEN:
+																	$chapteratom_entry[$sub_sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_sub_subelement['data']);
+																	break;
+
+																case EBML_ID_CHAPTERUID:
+																case EBML_ID_CHAPTERTIMESTART:
+																case EBML_ID_CHAPTERTIMEEND:
+																	$chapteratom_entry[$sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']);
+																	break;
+
+																case EBML_ID_CHAPTERTRACK:
+																	$chaptertrack_entry = array();
+
+																	while ($this->getEBMLelement($sub_sub_sub_subelement, $sub_sub_subelement['end'], true)) {
+																		switch ($sub_sub_sub_subelement['id']) {
+
+																			case EBML_ID_CHAPTERTRACKNUMBER:
+																				$chaptertrack_entry[$sub_sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_sub_subelement['data']);
+																				break;
+
+																			default:
+																				$this->unhandledElement('chapters.editionentry.chapteratom.chaptertrack', __LINE__, $sub_sub_sub_subelement);
+																		}
+																	}
+																	$chapteratom_entry[$sub_sub_subelement['id_name']][] = $chaptertrack_entry;
+																	break;
+
+																case EBML_ID_CHAPTERDISPLAY:
+																	$chapterdisplay_entry = array();
+
+																	while ($this->getEBMLelement($sub_sub_sub_subelement, $sub_sub_subelement['end'], true)) {
+																		switch ($sub_sub_sub_subelement['id']) {
+
+																			case EBML_ID_CHAPSTRING:
+																			case EBML_ID_CHAPLANGUAGE:
+																			case EBML_ID_CHAPCOUNTRY:
+																				$chapterdisplay_entry[$sub_sub_sub_subelement['id_name']] = $sub_sub_sub_subelement['data'];
+																				break;
+
+																			default:
+																				$this->unhandledElement('chapters.editionentry.chapteratom.chapterdisplay', __LINE__, $sub_sub_sub_subelement);
+																		}
+																	}
+																	$chapteratom_entry[$sub_sub_subelement['id_name']][] = $chapterdisplay_entry;
+																	break;
+
+																default:
+																	$this->unhandledElement('chapters.editionentry.chapteratom', __LINE__, $sub_sub_subelement);
+															}
+														}
+														$editionentry_entry[$sub_subelement['id_name']][] = $chapteratom_entry;
+														break;
+
+													default:
+														$this->unhandledElement('chapters.editionentry', __LINE__, $sub_subelement);
+												}
+											}
+											$info['matroska']['chapters'][] = $editionentry_entry;
+											break;
+
+										default:
+											$this->unhandledElement('chapters', __LINE__, $subelement);
+									}
+								}
+								break;
+
+							case EBML_ID_CLUSTER: // The lower level element containing the (monolithic) Block structure.
+								$cluster_entry = array();
+
+								while ($this->getEBMLelement($subelement, $element_data['end'], array(EBML_ID_CLUSTERSILENTTRACKS, EBML_ID_CLUSTERBLOCKGROUP, EBML_ID_CLUSTERSIMPLEBLOCK))) {
+									switch ($subelement['id']) {
+
+										case EBML_ID_CLUSTERTIMECODE:
+										case EBML_ID_CLUSTERPOSITION:
+										case EBML_ID_CLUSTERPREVSIZE:
+											$cluster_entry[$subelement['id_name']] = getid3_lib::BigEndian2Int($subelement['data']);
+											break;
+
+										case EBML_ID_CLUSTERSILENTTRACKS:
+											$cluster_silent_tracks = array();
+
+											while ($this->getEBMLelement($sub_subelement, $subelement['end'], true)) {
+												switch ($sub_subelement['id']) {
+
+													case EBML_ID_CLUSTERSILENTTRACKNUMBER:
+														$cluster_silent_tracks[] = getid3_lib::BigEndian2Int($sub_subelement['data']);
+														break;
+
+													default:
+														$this->unhandledElement('cluster.silenttracks', __LINE__, $sub_subelement);
+												}
+											}
+											$cluster_entry[$subelement['id_name']][] = $cluster_silent_tracks;
+											break;
+
+										case EBML_ID_CLUSTERBLOCKGROUP:
+											$cluster_block_group = array('offset' => $this->current_offset);
+
+											while ($this->getEBMLelement($sub_subelement, $subelement['end'], array(EBML_ID_CLUSTERBLOCK))) {
+												switch ($sub_subelement['id']) {
+
+													case EBML_ID_CLUSTERBLOCK:
+														$cluster_block_group[$sub_subelement['id_name']] = $this->HandleEMBLClusterBlock($sub_subelement, EBML_ID_CLUSTERBLOCK, $info);
+														break;
+
+													case EBML_ID_CLUSTERREFERENCEPRIORITY: // unsigned-int
+													case EBML_ID_CLUSTERBLOCKDURATION:     // unsigned-int
+														$cluster_block_group[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
+														break;
+
+													case EBML_ID_CLUSTERREFERENCEBLOCK:    // signed-int
+														$cluster_block_group[$sub_subelement['id_name']][] = getid3_lib::BigEndian2Int($sub_subelement['data'], false, true);
+														break;
+
+													case EBML_ID_CLUSTERCODECSTATE:
+														$cluster_block_group[$sub_subelement['id_name']] = getid3_lib::trimNullByte($sub_subelement['data']);
+														break;
+
+													default:
+														$this->unhandledElement('clusters.blockgroup', __LINE__, $sub_subelement);
+												}
+											}
+											$cluster_entry[$subelement['id_name']][] = $cluster_block_group;
+											break;
+
+										case EBML_ID_CLUSTERSIMPLEBLOCK:
+											$cluster_entry[$subelement['id_name']][] = $this->HandleEMBLClusterBlock($subelement, EBML_ID_CLUSTERSIMPLEBLOCK, $info);
+											break;
+
+										default:
+											$this->unhandledElement('cluster', __LINE__, $subelement);
+									}
+									$this->current_offset = $subelement['end'];
+								}
+								if (!self::$hide_clusters) {
+									$info['matroska']['cluster'][] = $cluster_entry;
+								}
+
+								// check to see if all the data we need exists already, if so, break out of the loop
+								if (!self::$parse_whole_file) {
+									if (isset($info['matroska']['info']) && is_array($info['matroska']['info'])) {
+										if (isset($info['matroska']['tracks']['tracks']) && is_array($info['matroska']['tracks']['tracks'])) {
+											if (count($info['matroska']['track_data_offsets']) == count($info['matroska']['tracks']['tracks'])) {
+												return;
+											}
+										}
+									}
+								}
+								break;
+
+							default:
+								$this->unhandledElement('segment', __LINE__, $element_data);
+						}
+					}
+					break;
+
+				default:
+					$this->unhandledElement('root', __LINE__, $top_element);
+			}
+		}
+    }
+
+	private function EnsureBufferHasEnoughData($min_data=1024) {
+		if (($this->current_offset - $this->EBMLbuffer_offset) >= ($this->EBMLbuffer_length - $min_data)) {
+			$read_bytes = max($min_data, $this->getid3->fread_buffer_size());
+
+			try {
+				$this->fseek($this->current_offset);
+				$this->EBMLbuffer_offset = $this->current_offset;
+				$this->EBMLbuffer        = $this->fread($read_bytes);
+				$this->EBMLbuffer_length = strlen($this->EBMLbuffer);
+			} catch (getid3_exception $e) {
+				$this->warning('EBML parser: '.$e->getMessage());
+				return false;
+			}
+
+			if ($this->EBMLbuffer_length == 0 && $this->feof()) {
+				return $this->error('EBML parser: ran out of file at offset '.$this->current_offset);
+			}
+		}
+		return true;
+	}
+
+	private function readEBMLint() {
+		$actual_offset = $this->current_offset - $this->EBMLbuffer_offset;
+
+		// get length of integer
+		$first_byte_int = ord($this->EBMLbuffer[$actual_offset]);
+		if       (0x80 & $first_byte_int) {
+			$length = 1;
+		} elseif (0x40 & $first_byte_int) {
+			$length = 2;
+		} elseif (0x20 & $first_byte_int) {
+			$length = 3;
+		} elseif (0x10 & $first_byte_int) {
+			$length = 4;
+		} elseif (0x08 & $first_byte_int) {
+			$length = 5;
+		} elseif (0x04 & $first_byte_int) {
+			$length = 6;
+		} elseif (0x02 & $first_byte_int) {
+			$length = 7;
+		} elseif (0x01 & $first_byte_int) {
+			$length = 8;
+		} else {
+			throw new Exception('invalid EBML integer (leading 0x00) at '.$this->current_offset);
+		}
+
+		// read
+		$int_value = self::EBML2Int(substr($this->EBMLbuffer, $actual_offset, $length));
+		$this->current_offset += $length;
+
+		return $int_value;
+	}
+
+	private function readEBMLelementData($length, $check_buffer=false) {
+		if ($check_buffer && !$this->EnsureBufferHasEnoughData($length)) {
+			return false;
+		}
+		$data = substr($this->EBMLbuffer, $this->current_offset - $this->EBMLbuffer_offset, $length);
+		$this->current_offset += $length;
+		return $data;
+	}
+
+	private function getEBMLelement(&$element, $parent_end, $get_data=false) {
+		if ($this->current_offset >= $parent_end) {
+			return false;
+		}
+
+		if (!$this->EnsureBufferHasEnoughData()) {
+			$this->current_offset = PHP_INT_MAX; // do not exit parser right now, allow to finish current loop to gather maximum information
+			return false;
+		}
+
+		$element = array();
+
+		// set offset
+		$element['offset'] = $this->current_offset;
+
+		// get ID
+		$element['id'] = $this->readEBMLint();
+
+		// get name
+		$element['id_name'] = self::EBMLidName($element['id']);
+
+		// get length
+		$element['length'] = $this->readEBMLint();
+
+		// get end offset
+		$element['end'] = $this->current_offset + $element['length'];
+
+		// get raw data
+		$dont_parse = (in_array($element['id'], $this->unuseful_elements) || $element['id_name'] == dechex($element['id']));
+		if (($get_data === true || (is_array($get_data) && !in_array($element['id'], $get_data))) && !$dont_parse) {
+			$element['data'] = $this->readEBMLelementData($element['length'], $element);
+		}
+
+		return true;
+	}
+
+	private function unhandledElement($type, $line, $element) {
+		// warn only about unknown and missed elements, not about unuseful
+		if (!in_array($element['id'], $this->unuseful_elements)) {
+			$this->warning('Unhandled '.$type.' element ['.basename(__FILE__).':'.$line.'] ('.$element['id'].'::'.$element['id_name'].' ['.$element['length'].' bytes]) at '.$element['offset']);
+		}
+
+		// increase offset for unparsed elements
+		if (!isset($element['data'])) {
+			$this->current_offset = $element['end'];
+		}
+	}
+
+	private function ExtractCommentsSimpleTag($SimpleTagArray) {
+		if (!empty($SimpleTagArray['SimpleTag'])) {
+			foreach ($SimpleTagArray['SimpleTag'] as $SimpleTagKey => $SimpleTagData) {
+				if (!empty($SimpleTagData['TagName']) && !empty($SimpleTagData['TagString'])) {
+					$this->getid3->info['matroska']['comments'][strtolower($SimpleTagData['TagName'])][] = $SimpleTagData['TagString'];
+				}
+				if (!empty($SimpleTagData['SimpleTag'])) {
+					$this->ExtractCommentsSimpleTag($SimpleTagData);
+				}
+			}
+		}
+
+		return true;
+	}
+
+	private function HandleEMBLSimpleTag($parent_end) {
+		$simpletag_entry = array();
+
+		while ($this->getEBMLelement($element, $parent_end, array(EBML_ID_SIMPLETAG))) {
+			switch ($element['id']) {
+
+				case EBML_ID_TAGNAME:
+				case EBML_ID_TAGLANGUAGE:
+				case EBML_ID_TAGSTRING:
+				case EBML_ID_TAGBINARY:
+					$simpletag_entry[$element['id_name']] = $element['data'];
+					break;
+
+				case EBML_ID_SIMPLETAG:
+					$simpletag_entry[$element['id_name']][] = $this->HandleEMBLSimpleTag($element['end']);
+					break;
+
+				case EBML_ID_TAGDEFAULT:
+					$simpletag_entry[$element['id_name']] = (bool)getid3_lib::BigEndian2Int($element['data']);
+					break;
+
+				default:
+					$this->unhandledElement('tag.simpletag', __LINE__, $element);
+			}
+		}
+
+		return $simpletag_entry;
+	}
+
+	private function HandleEMBLClusterBlock($element, $block_type, &$info) {
+		// http://www.matroska.org/technical/specs/index.html#block_structure
+		// http://www.matroska.org/technical/specs/index.html#simpleblock_structure
+
+		$block_data = array();
+		$block_data['tracknumber'] = $this->readEBMLint();
+		$block_data['timecode']    = getid3_lib::BigEndian2Int($this->readEBMLelementData(2), false, true);
+		$block_data['flags_raw']   = getid3_lib::BigEndian2Int($this->readEBMLelementData(1));
+
+		if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) {
+			$block_data['flags']['keyframe']  = (($block_data['flags_raw'] & 0x80) >> 7);
+			//$block_data['flags']['reserved1'] = (($block_data['flags_raw'] & 0x70) >> 4);
+		}
+		else {
+			//$block_data['flags']['reserved1'] = (($block_data['flags_raw'] & 0xF0) >> 4);
+		}
+		$block_data['flags']['invisible'] = (bool)(($block_data['flags_raw'] & 0x08) >> 3);
+		$block_data['flags']['lacing']    =       (($block_data['flags_raw'] & 0x06) >> 1);  // 00=no lacing; 01=Xiph lacing; 11=EBML lacing; 10=fixed-size lacing
+		if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) {
+			$block_data['flags']['discardable'] = (($block_data['flags_raw'] & 0x01));
+		}
+		else {
+			//$block_data['flags']['reserved2'] = (($block_data['flags_raw'] & 0x01) >> 0);
+		}
+		$block_data['flags']['lacing_type'] = self::BlockLacingType($block_data['flags']['lacing']);
+
+        // Lace (when lacing bit is set)
+		if ($block_data['flags']['lacing'] > 0) {
+			$block_data['lace_frames'] = getid3_lib::BigEndian2Int($this->readEBMLelementData(1)) + 1; // Number of frames in the lace-1 (uint8)
+			if ($block_data['flags']['lacing'] != 0x02) {
+				for ($i = 1; $i < $block_data['lace_frames']; $i ++) { // Lace-coded size of each frame of the lace, except for the last one (multiple uint8). *This is not used with Fixed-size lacing as it is calculated automatically from (total size of lace) / (number of frames in lace).
+					if ($block_data['flags']['lacing'] == 0x03) { // EBML lacing
+						$block_data['lace_frames_size'][$i] = $this->readEBMLint(); // TODO: read size correctly, calc size for the last frame. For now offsets are deteminded OK with readEBMLint() and that's the most important thing.
+					}
+					else { // Xiph lacing
+						$block_data['lace_frames_size'][$i] = 0;
+						do {
+							$size = getid3_lib::BigEndian2Int($this->readEBMLelementData(1));
+							$block_data['lace_frames_size'][$i] += $size;
+						}
+						while ($size == 255);
+					}
+				}
+				if ($block_data['flags']['lacing'] == 0x01) { // calc size of the last frame only for Xiph lacing, till EBML sizes are now anyway determined incorrectly
+					$block_data['lace_frames_size'][] = $element['end'] - $this->current_offset - array_sum($block_data['lace_frames_size']);
+				}
+			}
+		}
+
+		if (!isset($info['matroska']['track_data_offsets'][$block_data['tracknumber']])) {
+			$info['matroska']['track_data_offsets'][$block_data['tracknumber']]['offset'] = $this->current_offset;
+			$info['matroska']['track_data_offsets'][$block_data['tracknumber']]['length'] = $element['end'] - $this->current_offset;
+			//$info['matroska']['track_data_offsets'][$block_data['tracknumber']]['total_length'] = 0;
+		}
+		//$info['matroska']['track_data_offsets'][$block_data['tracknumber']]['total_length'] += $info['matroska']['track_data_offsets'][$block_data['tracknumber']]['length'];
+		//$info['matroska']['track_data_offsets'][$block_data['tracknumber']]['duration']      = $block_data['timecode'] * ((isset($info['matroska']['info'][0]['TimecodeScale']) ? $info['matroska']['info'][0]['TimecodeScale'] : 1000000) / 1000000000);
+
+		// set offset manually
+		$this->current_offset = $element['end'];
+
+		return $block_data;
+	}
+
+	private static function EBML2Int($EBMLstring) {
+		// http://matroska.org/specs/
+
+		// Element ID coded with an UTF-8 like system:
+		// 1xxx xxxx                                  - Class A IDs (2^7 -2 possible values) (base 0x8X)
+		// 01xx xxxx  xxxx xxxx                       - Class B IDs (2^14-2 possible values) (base 0x4X 0xXX)
+		// 001x xxxx  xxxx xxxx  xxxx xxxx            - Class C IDs (2^21-2 possible values) (base 0x2X 0xXX 0xXX)
+		// 0001 xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx - Class D IDs (2^28-2 possible values) (base 0x1X 0xXX 0xXX 0xXX)
+		// Values with all x at 0 and 1 are reserved (hence the -2).
+
+		// Data size, in octets, is also coded with an UTF-8 like system :
+		// 1xxx xxxx                                                                              - value 0 to  2^7-2
+		// 01xx xxxx  xxxx xxxx                                                                   - value 0 to 2^14-2
+		// 001x xxxx  xxxx xxxx  xxxx xxxx                                                        - value 0 to 2^21-2
+		// 0001 xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx                                             - value 0 to 2^28-2
+		// 0000 1xxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx                                  - value 0 to 2^35-2
+		// 0000 01xx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx                       - value 0 to 2^42-2
+		// 0000 001x  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx            - value 0 to 2^49-2
+		// 0000 0001  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx - value 0 to 2^56-2
+
+		$first_byte_int = ord($EBMLstring[0]);
+		if (0x80 & $first_byte_int) {
+			$EBMLstring[0] = chr($first_byte_int & 0x7F);
+		} elseif (0x40 & $first_byte_int) {
+			$EBMLstring[0] = chr($first_byte_int & 0x3F);
+		} elseif (0x20 & $first_byte_int) {
+			$EBMLstring[0] = chr($first_byte_int & 0x1F);
+		} elseif (0x10 & $first_byte_int) {
+			$EBMLstring[0] = chr($first_byte_int & 0x0F);
+		} elseif (0x08 & $first_byte_int) {
+			$EBMLstring[0] = chr($first_byte_int & 0x07);
+		} elseif (0x04 & $first_byte_int) {
+			$EBMLstring[0] = chr($first_byte_int & 0x03);
+		} elseif (0x02 & $first_byte_int) {
+			$EBMLstring[0] = chr($first_byte_int & 0x01);
+		} elseif (0x01 & $first_byte_int) {
+			$EBMLstring[0] = chr($first_byte_int & 0x00);
+		}
+
+		return getid3_lib::BigEndian2Int($EBMLstring);
+	}
+
+	private static function EBMLdate2unix($EBMLdatestamp) {
+		// Date - signed 8 octets integer in nanoseconds with 0 indicating the precise beginning of the millennium (at 2001-01-01T00:00:00,000000000 UTC)
+		// 978307200 == mktime(0, 0, 0, 1, 1, 2001) == January 1, 2001 12:00:00am UTC
+		return round(($EBMLdatestamp / 1000000000) + 978307200);
+	}
+
+	public static function TargetTypeValue($target_type) {
+		// http://www.matroska.org/technical/specs/tagging/index.html
+		static $TargetTypeValue = array();
+		if (empty($TargetTypeValue)) {
+			$TargetTypeValue[10] = 'A: ~ V:shot';                                           // the lowest hierarchy found in music or movies
+			$TargetTypeValue[20] = 'A:subtrack/part/movement ~ V:scene';                    // corresponds to parts of a track for audio (like a movement)
+			$TargetTypeValue[30] = 'A:track/song ~ V:chapter';                              // the common parts of an album or a movie
+			$TargetTypeValue[40] = 'A:part/session ~ V:part/session';                       // when an album or episode has different logical parts
+			$TargetTypeValue[50] = 'A:album/opera/concert ~ V:movie/episode/concert';       // the most common grouping level of music and video (equals to an episode for TV series)
+			$TargetTypeValue[60] = 'A:edition/issue/volume/opus ~ V:season/sequel/volume';  // a list of lower levels grouped together
+			$TargetTypeValue[70] = 'A:collection ~ V:collection';                           // the high hierarchy consisting of many different lower items
+		}
+		return (isset($TargetTypeValue[$target_type]) ? $TargetTypeValue[$target_type] : $target_type);
+	}
+
+	public static function BlockLacingType($lacingtype) {
+		// http://matroska.org/technical/specs/index.html#block_structure
+		static $BlockLacingType = array();
+		if (empty($BlockLacingType)) {
+			$BlockLacingType[0x00] = 'no lacing';
+			$BlockLacingType[0x01] = 'Xiph lacing';
+			$BlockLacingType[0x02] = 'fixed-size lacing';
+			$BlockLacingType[0x03] = 'EBML lacing';
+		}
+		return (isset($BlockLacingType[$lacingtype]) ? $BlockLacingType[$lacingtype] : $lacingtype);
+	}
+
+	public static function CodecIDtoCommonName($codecid) {
+		// http://www.matroska.org/technical/specs/codecid/index.html
+		static $CodecIDlist = array();
+		if (empty($CodecIDlist)) {
+			$CodecIDlist['A_AAC']            = 'aac';
+			$CodecIDlist['A_AAC/MPEG2/LC']   = 'aac';
+			$CodecIDlist['A_AC3']            = 'ac3';
+			$CodecIDlist['A_DTS']            = 'dts';
+			$CodecIDlist['A_FLAC']           = 'flac';
+			$CodecIDlist['A_MPEG/L1']        = 'mp1';
+			$CodecIDlist['A_MPEG/L2']        = 'mp2';
+			$CodecIDlist['A_MPEG/L3']        = 'mp3';
+			$CodecIDlist['A_PCM/INT/LIT']    = 'pcm';       // PCM Integer Little Endian
+			$CodecIDlist['A_PCM/INT/BIG']    = 'pcm';       // PCM Integer Big Endian
+			$CodecIDlist['A_QUICKTIME/QDMC'] = 'quicktime'; // Quicktime: QDesign Music
+			$CodecIDlist['A_QUICKTIME/QDM2'] = 'quicktime'; // Quicktime: QDesign Music v2
+			$CodecIDlist['A_VORBIS']         = 'vorbis';
+			$CodecIDlist['V_MPEG1']          = 'mpeg';
+			$CodecIDlist['V_THEORA']         = 'theora';
+			$CodecIDlist['V_REAL/RV40']      = 'real';
+			$CodecIDlist['V_REAL/RV10']      = 'real';
+			$CodecIDlist['V_REAL/RV20']      = 'real';
+			$CodecIDlist['V_REAL/RV30']      = 'real';
+			$CodecIDlist['V_QUICKTIME']      = 'quicktime'; // Quicktime
+			$CodecIDlist['V_MPEG4/ISO/AP']   = 'mpeg4';
+			$CodecIDlist['V_MPEG4/ISO/ASP']  = 'mpeg4';
+			$CodecIDlist['V_MPEG4/ISO/AVC']  = 'h264';
+			$CodecIDlist['V_MPEG4/ISO/SP']   = 'mpeg4';
+			$CodecIDlist['V_VP8']            = 'vp8';
+			$CodecIDlist['V_MS/VFW/FOURCC']  = 'riff';
+			$CodecIDlist['A_MS/ACM']         = 'riff';
+		}
+		return (isset($CodecIDlist[$codecid]) ? $CodecIDlist[$codecid] : $codecid);
+	}
+
+	private static function EBMLidName($value) {
+		static $EBMLidList = array();
+		if (empty($EBMLidList)) {
+			$EBMLidList[EBML_ID_ASPECTRATIOTYPE]            = 'AspectRatioType';
+			$EBMLidList[EBML_ID_ATTACHEDFILE]               = 'AttachedFile';
+			$EBMLidList[EBML_ID_ATTACHMENTLINK]             = 'AttachmentLink';
+			$EBMLidList[EBML_ID_ATTACHMENTS]                = 'Attachments';
+			$EBMLidList[EBML_ID_AUDIO]                      = 'Audio';
+			$EBMLidList[EBML_ID_BITDEPTH]                   = 'BitDepth';
+			$EBMLidList[EBML_ID_CHANNELPOSITIONS]           = 'ChannelPositions';
+			$EBMLidList[EBML_ID_CHANNELS]                   = 'Channels';
+			$EBMLidList[EBML_ID_CHAPCOUNTRY]                = 'ChapCountry';
+			$EBMLidList[EBML_ID_CHAPLANGUAGE]               = 'ChapLanguage';
+			$EBMLidList[EBML_ID_CHAPPROCESS]                = 'ChapProcess';
+			$EBMLidList[EBML_ID_CHAPPROCESSCODECID]         = 'ChapProcessCodecID';
+			$EBMLidList[EBML_ID_CHAPPROCESSCOMMAND]         = 'ChapProcessCommand';
+			$EBMLidList[EBML_ID_CHAPPROCESSDATA]            = 'ChapProcessData';
+			$EBMLidList[EBML_ID_CHAPPROCESSPRIVATE]         = 'ChapProcessPrivate';
+			$EBMLidList[EBML_ID_CHAPPROCESSTIME]            = 'ChapProcessTime';
+			$EBMLidList[EBML_ID_CHAPSTRING]                 = 'ChapString';
+			$EBMLidList[EBML_ID_CHAPTERATOM]                = 'ChapterAtom';
+			$EBMLidList[EBML_ID_CHAPTERDISPLAY]             = 'ChapterDisplay';
+			$EBMLidList[EBML_ID_CHAPTERFLAGENABLED]         = 'ChapterFlagEnabled';
+			$EBMLidList[EBML_ID_CHAPTERFLAGHIDDEN]          = 'ChapterFlagHidden';
+			$EBMLidList[EBML_ID_CHAPTERPHYSICALEQUIV]       = 'ChapterPhysicalEquiv';
+			$EBMLidList[EBML_ID_CHAPTERS]                   = 'Chapters';
+			$EBMLidList[EBML_ID_CHAPTERSEGMENTEDITIONUID]   = 'ChapterSegmentEditionUID';
+			$EBMLidList[EBML_ID_CHAPTERSEGMENTUID]          = 'ChapterSegmentUID';
+			$EBMLidList[EBML_ID_CHAPTERTIMEEND]             = 'ChapterTimeEnd';
+			$EBMLidList[EBML_ID_CHAPTERTIMESTART]           = 'ChapterTimeStart';
+			$EBMLidList[EBML_ID_CHAPTERTRACK]               = 'ChapterTrack';
+			$EBMLidList[EBML_ID_CHAPTERTRACKNUMBER]         = 'ChapterTrackNumber';
+			$EBMLidList[EBML_ID_CHAPTERTRANSLATE]           = 'ChapterTranslate';
+			$EBMLidList[EBML_ID_CHAPTERTRANSLATECODEC]      = 'ChapterTranslateCodec';
+			$EBMLidList[EBML_ID_CHAPTERTRANSLATEEDITIONUID] = 'ChapterTranslateEditionUID';
+			$EBMLidList[EBML_ID_CHAPTERTRANSLATEID]         = 'ChapterTranslateID';
+			$EBMLidList[EBML_ID_CHAPTERUID]                 = 'ChapterUID';
+			$EBMLidList[EBML_ID_CLUSTER]                    = 'Cluster';
+			$EBMLidList[EBML_ID_CLUSTERBLOCK]               = 'ClusterBlock';
+			$EBMLidList[EBML_ID_CLUSTERBLOCKADDID]          = 'ClusterBlockAddID';
+			$EBMLidList[EBML_ID_CLUSTERBLOCKADDITIONAL]     = 'ClusterBlockAdditional';
+			$EBMLidList[EBML_ID_CLUSTERBLOCKADDITIONID]     = 'ClusterBlockAdditionID';
+			$EBMLidList[EBML_ID_CLUSTERBLOCKADDITIONS]      = 'ClusterBlockAdditions';
+			$EBMLidList[EBML_ID_CLUSTERBLOCKDURATION]       = 'ClusterBlockDuration';
+			$EBMLidList[EBML_ID_CLUSTERBLOCKGROUP]          = 'ClusterBlockGroup';
+			$EBMLidList[EBML_ID_CLUSTERBLOCKMORE]           = 'ClusterBlockMore';
+			$EBMLidList[EBML_ID_CLUSTERBLOCKVIRTUAL]        = 'ClusterBlockVirtual';
+			$EBMLidList[EBML_ID_CLUSTERCODECSTATE]          = 'ClusterCodecState';
+			$EBMLidList[EBML_ID_CLUSTERDELAY]               = 'ClusterDelay';
+			$EBMLidList[EBML_ID_CLUSTERDURATION]            = 'ClusterDuration';
+			$EBMLidList[EBML_ID_CLUSTERENCRYPTEDBLOCK]      = 'ClusterEncryptedBlock';
+			$EBMLidList[EBML_ID_CLUSTERFRAMENUMBER]         = 'ClusterFrameNumber';
+			$EBMLidList[EBML_ID_CLUSTERLACENUMBER]          = 'ClusterLaceNumber';
+			$EBMLidList[EBML_ID_CLUSTERPOSITION]            = 'ClusterPosition';
+			$EBMLidList[EBML_ID_CLUSTERPREVSIZE]            = 'ClusterPrevSize';
+			$EBMLidList[EBML_ID_CLUSTERREFERENCEBLOCK]      = 'ClusterReferenceBlock';
+			$EBMLidList[EBML_ID_CLUSTERREFERENCEPRIORITY]   = 'ClusterReferencePriority';
+			$EBMLidList[EBML_ID_CLUSTERREFERENCEVIRTUAL]    = 'ClusterReferenceVirtual';
+			$EBMLidList[EBML_ID_CLUSTERSILENTTRACKNUMBER]   = 'ClusterSilentTrackNumber';
+			$EBMLidList[EBML_ID_CLUSTERSILENTTRACKS]        = 'ClusterSilentTracks';
+			$EBMLidList[EBML_ID_CLUSTERSIMPLEBLOCK]         = 'ClusterSimpleBlock';
+			$EBMLidList[EBML_ID_CLUSTERTIMECODE]            = 'ClusterTimecode';
+			$EBMLidList[EBML_ID_CLUSTERTIMESLICE]           = 'ClusterTimeSlice';
+			$EBMLidList[EBML_ID_CODECDECODEALL]             = 'CodecDecodeAll';
+			$EBMLidList[EBML_ID_CODECDOWNLOADURL]           = 'CodecDownloadURL';
+			$EBMLidList[EBML_ID_CODECID]                    = 'CodecID';
+			$EBMLidList[EBML_ID_CODECINFOURL]               = 'CodecInfoURL';
+			$EBMLidList[EBML_ID_CODECNAME]                  = 'CodecName';
+			$EBMLidList[EBML_ID_CODECPRIVATE]               = 'CodecPrivate';
+			$EBMLidList[EBML_ID_CODECSETTINGS]              = 'CodecSettings';
+			$EBMLidList[EBML_ID_COLOURSPACE]                = 'ColourSpace';
+			$EBMLidList[EBML_ID_CONTENTCOMPALGO]            = 'ContentCompAlgo';
+			$EBMLidList[EBML_ID_CONTENTCOMPRESSION]         = 'ContentCompression';
+			$EBMLidList[EBML_ID_CONTENTCOMPSETTINGS]        = 'ContentCompSettings';
+			$EBMLidList[EBML_ID_CONTENTENCALGO]             = 'ContentEncAlgo';
+			$EBMLidList[EBML_ID_CONTENTENCKEYID]            = 'ContentEncKeyID';
+			$EBMLidList[EBML_ID_CONTENTENCODING]            = 'ContentEncoding';
+			$EBMLidList[EBML_ID_CONTENTENCODINGORDER]       = 'ContentEncodingOrder';
+			$EBMLidList[EBML_ID_CONTENTENCODINGS]           = 'ContentEncodings';
+			$EBMLidList[EBML_ID_CONTENTENCODINGSCOPE]       = 'ContentEncodingScope';
+			$EBMLidList[EBML_ID_CONTENTENCODINGTYPE]        = 'ContentEncodingType';
+			$EBMLidList[EBML_ID_CONTENTENCRYPTION]          = 'ContentEncryption';
+			$EBMLidList[EBML_ID_CONTENTSIGALGO]             = 'ContentSigAlgo';
+			$EBMLidList[EBML_ID_CONTENTSIGHASHALGO]         = 'ContentSigHashAlgo';
+			$EBMLidList[EBML_ID_CONTENTSIGKEYID]            = 'ContentSigKeyID';
+			$EBMLidList[EBML_ID_CONTENTSIGNATURE]           = 'ContentSignature';
+			$EBMLidList[EBML_ID_CRC32]                      = 'CRC32';
+			$EBMLidList[EBML_ID_CUEBLOCKNUMBER]             = 'CueBlockNumber';
+			$EBMLidList[EBML_ID_CUECLUSTERPOSITION]         = 'CueClusterPosition';
+			$EBMLidList[EBML_ID_CUECODECSTATE]              = 'CueCodecState';
+			$EBMLidList[EBML_ID_CUEPOINT]                   = 'CuePoint';
+			$EBMLidList[EBML_ID_CUEREFCLUSTER]              = 'CueRefCluster';
+			$EBMLidList[EBML_ID_CUEREFCODECSTATE]           = 'CueRefCodecState';
+			$EBMLidList[EBML_ID_CUEREFERENCE]               = 'CueReference';
+			$EBMLidList[EBML_ID_CUEREFNUMBER]               = 'CueRefNumber';
+			$EBMLidList[EBML_ID_CUEREFTIME]                 = 'CueRefTime';
+			$EBMLidList[EBML_ID_CUES]                       = 'Cues';
+			$EBMLidList[EBML_ID_CUETIME]                    = 'CueTime';
+			$EBMLidList[EBML_ID_CUETRACK]                   = 'CueTrack';
+			$EBMLidList[EBML_ID_CUETRACKPOSITIONS]          = 'CueTrackPositions';
+			$EBMLidList[EBML_ID_DATEUTC]                    = 'DateUTC';
+			$EBMLidList[EBML_ID_DEFAULTDURATION]            = 'DefaultDuration';
+			$EBMLidList[EBML_ID_DISPLAYHEIGHT]              = 'DisplayHeight';
+			$EBMLidList[EBML_ID_DISPLAYUNIT]                = 'DisplayUnit';
+			$EBMLidList[EBML_ID_DISPLAYWIDTH]               = 'DisplayWidth';
+			$EBMLidList[EBML_ID_DOCTYPE]                    = 'DocType';
+			$EBMLidList[EBML_ID_DOCTYPEREADVERSION]         = 'DocTypeReadVersion';
+			$EBMLidList[EBML_ID_DOCTYPEVERSION]             = 'DocTypeVersion';
+			$EBMLidList[EBML_ID_DURATION]                   = 'Duration';
+			$EBMLidList[EBML_ID_EBML]                       = 'EBML';
+			$EBMLidList[EBML_ID_EBMLMAXIDLENGTH]            = 'EBMLMaxIDLength';
+			$EBMLidList[EBML_ID_EBMLMAXSIZELENGTH]          = 'EBMLMaxSizeLength';
+			$EBMLidList[EBML_ID_EBMLREADVERSION]            = 'EBMLReadVersion';
+			$EBMLidList[EBML_ID_EBMLVERSION]                = 'EBMLVersion';
+			$EBMLidList[EBML_ID_EDITIONENTRY]               = 'EditionEntry';
+			$EBMLidList[EBML_ID_EDITIONFLAGDEFAULT]         = 'EditionFlagDefault';
+			$EBMLidList[EBML_ID_EDITIONFLAGHIDDEN]          = 'EditionFlagHidden';
+			$EBMLidList[EBML_ID_EDITIONFLAGORDERED]         = 'EditionFlagOrdered';
+			$EBMLidList[EBML_ID_EDITIONUID]                 = 'EditionUID';
+			$EBMLidList[EBML_ID_FILEDATA]                   = 'FileData';
+			$EBMLidList[EBML_ID_FILEDESCRIPTION]            = 'FileDescription';
+			$EBMLidList[EBML_ID_FILEMIMETYPE]               = 'FileMimeType';
+			$EBMLidList[EBML_ID_FILENAME]                   = 'FileName';
+			$EBMLidList[EBML_ID_FILEREFERRAL]               = 'FileReferral';
+			$EBMLidList[EBML_ID_FILEUID]                    = 'FileUID';
+			$EBMLidList[EBML_ID_FLAGDEFAULT]                = 'FlagDefault';
+			$EBMLidList[EBML_ID_FLAGENABLED]                = 'FlagEnabled';
+			$EBMLidList[EBML_ID_FLAGFORCED]                 = 'FlagForced';
+			$EBMLidList[EBML_ID_FLAGINTERLACED]             = 'FlagInterlaced';
+			$EBMLidList[EBML_ID_FLAGLACING]                 = 'FlagLacing';
+			$EBMLidList[EBML_ID_GAMMAVALUE]                 = 'GammaValue';
+			$EBMLidList[EBML_ID_INFO]                       = 'Info';
+			$EBMLidList[EBML_ID_LANGUAGE]                   = 'Language';
+			$EBMLidList[EBML_ID_MAXBLOCKADDITIONID]         = 'MaxBlockAdditionID';
+			$EBMLidList[EBML_ID_MAXCACHE]                   = 'MaxCache';
+			$EBMLidList[EBML_ID_MINCACHE]                   = 'MinCache';
+			$EBMLidList[EBML_ID_MUXINGAPP]                  = 'MuxingApp';
+			$EBMLidList[EBML_ID_NAME]                       = 'Name';
+			$EBMLidList[EBML_ID_NEXTFILENAME]               = 'NextFilename';
+			$EBMLidList[EBML_ID_NEXTUID]                    = 'NextUID';
+			$EBMLidList[EBML_ID_OUTPUTSAMPLINGFREQUENCY]    = 'OutputSamplingFrequency';
+			$EBMLidList[EBML_ID_PIXELCROPBOTTOM]            = 'PixelCropBottom';
+			$EBMLidList[EBML_ID_PIXELCROPLEFT]              = 'PixelCropLeft';
+			$EBMLidList[EBML_ID_PIXELCROPRIGHT]             = 'PixelCropRight';
+			$EBMLidList[EBML_ID_PIXELCROPTOP]               = 'PixelCropTop';
+			$EBMLidList[EBML_ID_PIXELHEIGHT]                = 'PixelHeight';
+			$EBMLidList[EBML_ID_PIXELWIDTH]                 = 'PixelWidth';
+			$EBMLidList[EBML_ID_PREVFILENAME]               = 'PrevFilename';
+			$EBMLidList[EBML_ID_PREVUID]                    = 'PrevUID';
+			$EBMLidList[EBML_ID_SAMPLINGFREQUENCY]          = 'SamplingFrequency';
+			$EBMLidList[EBML_ID_SEEK]                       = 'Seek';
+			$EBMLidList[EBML_ID_SEEKHEAD]                   = 'SeekHead';
+			$EBMLidList[EBML_ID_SEEKID]                     = 'SeekID';
+			$EBMLidList[EBML_ID_SEEKPOSITION]               = 'SeekPosition';
+			$EBMLidList[EBML_ID_SEGMENT]                    = 'Segment';
+			$EBMLidList[EBML_ID_SEGMENTFAMILY]              = 'SegmentFamily';
+			$EBMLidList[EBML_ID_SEGMENTFILENAME]            = 'SegmentFilename';
+			$EBMLidList[EBML_ID_SEGMENTUID]                 = 'SegmentUID';
+			$EBMLidList[EBML_ID_SIMPLETAG]                  = 'SimpleTag';
+			$EBMLidList[EBML_ID_CLUSTERSLICES]              = 'ClusterSlices';
+			$EBMLidList[EBML_ID_STEREOMODE]                 = 'StereoMode';
+			$EBMLidList[EBML_ID_OLDSTEREOMODE]              = 'OldStereoMode';
+			$EBMLidList[EBML_ID_TAG]                        = 'Tag';
+			$EBMLidList[EBML_ID_TAGATTACHMENTUID]           = 'TagAttachmentUID';
+			$EBMLidList[EBML_ID_TAGBINARY]                  = 'TagBinary';
+			$EBMLidList[EBML_ID_TAGCHAPTERUID]              = 'TagChapterUID';
+			$EBMLidList[EBML_ID_TAGDEFAULT]                 = 'TagDefault';
+			$EBMLidList[EBML_ID_TAGEDITIONUID]              = 'TagEditionUID';
+			$EBMLidList[EBML_ID_TAGLANGUAGE]                = 'TagLanguage';
+			$EBMLidList[EBML_ID_TAGNAME]                    = 'TagName';
+			$EBMLidList[EBML_ID_TAGTRACKUID]                = 'TagTrackUID';
+			$EBMLidList[EBML_ID_TAGS]                       = 'Tags';
+			$EBMLidList[EBML_ID_TAGSTRING]                  = 'TagString';
+			$EBMLidList[EBML_ID_TARGETS]                    = 'Targets';
+			$EBMLidList[EBML_ID_TARGETTYPE]                 = 'TargetType';
+			$EBMLidList[EBML_ID_TARGETTYPEVALUE]            = 'TargetTypeValue';
+			$EBMLidList[EBML_ID_TIMECODESCALE]              = 'TimecodeScale';
+			$EBMLidList[EBML_ID_TITLE]                      = 'Title';
+			$EBMLidList[EBML_ID_TRACKENTRY]                 = 'TrackEntry';
+			$EBMLidList[EBML_ID_TRACKNUMBER]                = 'TrackNumber';
+			$EBMLidList[EBML_ID_TRACKOFFSET]                = 'TrackOffset';
+			$EBMLidList[EBML_ID_TRACKOVERLAY]               = 'TrackOverlay';
+			$EBMLidList[EBML_ID_TRACKS]                     = 'Tracks';
+			$EBMLidList[EBML_ID_TRACKTIMECODESCALE]         = 'TrackTimecodeScale';
+			$EBMLidList[EBML_ID_TRACKTRANSLATE]             = 'TrackTranslate';
+			$EBMLidList[EBML_ID_TRACKTRANSLATECODEC]        = 'TrackTranslateCodec';
+			$EBMLidList[EBML_ID_TRACKTRANSLATEEDITIONUID]   = 'TrackTranslateEditionUID';
+			$EBMLidList[EBML_ID_TRACKTRANSLATETRACKID]      = 'TrackTranslateTrackID';
+			$EBMLidList[EBML_ID_TRACKTYPE]                  = 'TrackType';
+			$EBMLidList[EBML_ID_TRACKUID]                   = 'TrackUID';
+			$EBMLidList[EBML_ID_VIDEO]                      = 'Video';
+			$EBMLidList[EBML_ID_VOID]                       = 'Void';
+			$EBMLidList[EBML_ID_WRITINGAPP]                 = 'WritingApp';
+		}
+
+		return (isset($EBMLidList[$value]) ? $EBMLidList[$value] : dechex($value));
+	}
+
+	public static function displayUnit($value) {
+		// http://www.matroska.org/technical/specs/index.html#DisplayUnit
+		static $units = array(
+			0 => 'pixels',
+			1 => 'centimeters',
+			2 => 'inches',
+			3 => 'Display Aspect Ratio');
+
+		return (isset($units[$value]) ? $units[$value] : 'unknown');
+	}
+
+	private static function getDefaultStreamInfo($streams)
+	{
+		foreach (array_reverse($streams) as $stream) {
+			if ($stream['default']) {
+				break;
+			}
+		}
+
+		$unset = array('default', 'name');
+		foreach ($unset as $u) {
+			if (isset($stream[$u])) {
+				unset($stream[$u]);
+			}
+		}
+
+		$info = $stream;
+		$info['streams'] = $streams;
+
+		return $info;
+	}
+
+}
Index: /extensions/piwigo_videojs/include/getid3/module.audio-video.quicktime.php
===================================================================
--- /extensions/piwigo_videojs/include/getid3/module.audio-video.quicktime.php	(revision 24676)
+++ /extensions/piwigo_videojs/include/getid3/module.audio-video.quicktime.php	(revision 24676)
@@ -0,0 +1,2147 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// module.audio-video.quicktime.php                            //
+// module for analyzing Quicktime and MP3-in-MP4 files         //
+// dependencies: module.audio.mp3.php                          //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.mp3.php', __FILE__, true);
+
+class getid3_quicktime extends getid3_handler
+{
+
+	public $ReturnAtomData        = true;
+	public $ParseAllPossibleAtoms = false;
+
+	public function Analyze() {
+		$info = &$this->getid3->info;
+
+		$info['fileformat'] = 'quicktime';
+		$info['quicktime']['hinting']    = false;
+		$info['quicktime']['controller'] = 'standard'; // may be overridden if 'ctyp' atom is present
+
+		fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
+
+		$offset      = 0;
+		$atomcounter = 0;
+
+		while ($offset < $info['avdataend']) {
+			if (!getid3_lib::intValueSupported($offset)) {
+				$info['error'][] = 'Unable to parse atom at offset '.$offset.' because beyond '.round(PHP_INT_MAX / 1073741824).'GB limit of PHP filesystem functions';
+				break;
+			}
+			fseek($this->getid3->fp, $offset, SEEK_SET);
+			$AtomHeader = fread($this->getid3->fp, 8);
+
+			$atomsize = getid3_lib::BigEndian2Int(substr($AtomHeader, 0, 4));
+			$atomname = substr($AtomHeader, 4, 4);
+
+			// 64-bit MOV patch by jlegateØktnc*com
+			if ($atomsize == 1) {
+				$atomsize = getid3_lib::BigEndian2Int(fread($this->getid3->fp, 8));
+			}
+
+			$info['quicktime'][$atomname]['name']   = $atomname;
+			$info['quicktime'][$atomname]['size']   = $atomsize;
+			$info['quicktime'][$atomname]['offset'] = $offset;
+
+			if (($offset + $atomsize) > $info['avdataend']) {
+				$info['error'][] = 'Atom at offset '.$offset.' claims to go beyond end-of-file (length: '.$atomsize.' bytes)';
+				return false;
+			}
+
+			if ($atomsize == 0) {
+				// Furthermore, for historical reasons the list of atoms is optionally
+				// terminated by a 32-bit integer set to 0. If you are writing a program
+				// to read user data atoms, you should allow for the terminating 0.
+				break;
+			}
+			switch ($atomname) {
+				case 'mdat': // Media DATa atom
+					// 'mdat' contains the actual data for the audio/video
+					if (($atomsize > 8) && (!isset($info['avdataend_tmp']) || ($info['quicktime'][$atomname]['size'] > ($info['avdataend_tmp'] - $info['avdataoffset'])))) {
+
+						$info['avdataoffset'] = $info['quicktime'][$atomname]['offset'] + 8;
+						$OldAVDataEnd         = $info['avdataend'];
+						$info['avdataend']    = $info['quicktime'][$atomname]['offset'] + $info['quicktime'][$atomname]['size'];
+
+						$getid3_temp = new getID3();
+						$getid3_temp->openfile($this->getid3->filename);
+						$getid3_temp->info['avdataoffset'] = $info['avdataoffset'];
+						$getid3_temp->info['avdataend']    = $info['avdataend'];
+						$getid3_mp3 = new getid3_mp3($getid3_temp);
+						if ($getid3_mp3->MPEGaudioHeaderValid($getid3_mp3->MPEGaudioHeaderDecode(fread($this->getid3->fp, 4)))) {
+							$getid3_mp3->getOnlyMPEGaudioInfo($getid3_temp->info['avdataoffset'], false);
+							if (!empty($getid3_temp->info['warning'])) {
+								foreach ($getid3_temp->info['warning'] as $value) {
+									$info['warning'][] = $value;
+								}
+							}
+							if (!empty($getid3_temp->info['mpeg'])) {
+								$info['mpeg'] = $getid3_temp->info['mpeg'];
+								if (isset($info['mpeg']['audio'])) {
+									$info['audio']['dataformat']   = 'mp3';
+									$info['audio']['codec']        = (!empty($info['mpeg']['audio']['encoder']) ? $info['mpeg']['audio']['encoder'] : (!empty($info['mpeg']['audio']['codec']) ? $info['mpeg']['audio']['codec'] : (!empty($info['mpeg']['audio']['LAME']) ? 'LAME' :'mp3')));
+									$info['audio']['sample_rate']  = $info['mpeg']['audio']['sample_rate'];
+									$info['audio']['channels']     = $info['mpeg']['audio']['channels'];
+									$info['audio']['bitrate']      = $info['mpeg']['audio']['bitrate'];
+									$info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']);
+									$info['bitrate']               = $info['audio']['bitrate'];
+								}
+							}
+						}
+						unset($getid3_mp3, $getid3_temp);
+						$info['avdataend'] = $OldAVDataEnd;
+						unset($OldAVDataEnd);
+
+					}
+					break;
+
+				case 'free': // FREE space atom
+				case 'skip': // SKIP atom
+				case 'wide': // 64-bit expansion placeholder atom
+					// 'free', 'skip' and 'wide' are just padding, contains no useful data at all
+					break;
+
+				default:
+					$atomHierarchy = array();
+					$info['quicktime'][$atomname] = $this->QuicktimeParseAtom($atomname, $atomsize, fread($this->getid3->fp, $atomsize), $offset, $atomHierarchy, $this->ParseAllPossibleAtoms);
+					break;
+			}
+
+			$offset += $atomsize;
+			$atomcounter++;
+		}
+
+		if (!empty($info['avdataend_tmp'])) {
+			// this value is assigned to a temp value and then erased because
+			// otherwise any atoms beyond the 'mdat' atom would not get parsed
+			$info['avdataend'] = $info['avdataend_tmp'];
+			unset($info['avdataend_tmp']);
+		}
+
+		if (!isset($info['bitrate']) && isset($info['playtime_seconds'])) {
+			$info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
+		}
+		if (isset($info['bitrate']) && !isset($info['audio']['bitrate']) && !isset($info['quicktime']['video'])) {
+			$info['audio']['bitrate'] = $info['bitrate'];
+		}
+		if (!empty($info['playtime_seconds']) && !isset($info['video']['frame_rate']) && !empty($info['quicktime']['stts_framecount'])) {
+			foreach ($info['quicktime']['stts_framecount'] as $key => $samples_count) {
+				$samples_per_second = $samples_count / $info['playtime_seconds'];
+				if ($samples_per_second > 240) {
+					// has to be audio samples
+				} else {
+					$info['video']['frame_rate'] = $samples_per_second;
+					break;
+				}
+			}
+		}
+		if (($info['audio']['dataformat'] == 'mp4') && empty($info['video']['resolution_x'])) {
+			$info['fileformat'] = 'mp4';
+			$info['mime_type']  = 'audio/mp4';
+			unset($info['video']['dataformat']);
+		}
+
+		if (!$this->ReturnAtomData) {
+			unset($info['quicktime']['moov']);
+		}
+
+		if (empty($info['audio']['dataformat']) && !empty($info['quicktime']['audio'])) {
+			$info['audio']['dataformat'] = 'quicktime';
+		}
+		if (empty($info['video']['dataformat']) && !empty($info['quicktime']['video'])) {
+			$info['video']['dataformat'] = 'quicktime';
+		}
+
+		return true;
+	}
+
+	public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) {
+		// http://developer.apple.com/techpubs/quicktime/qtdevdocs/APIREF/INDEX/atomalphaindex.htm
+
+		$info = &$this->getid3->info;
+
+		$atom_parent = array_pop($atomHierarchy);
+		array_push($atomHierarchy, $atomname);
+		$atom_structure['hierarchy'] = implode(' ', $atomHierarchy);
+		$atom_structure['name']      = $atomname;
+		$atom_structure['size']      = $atomsize;
+		$atom_structure['offset']    = $baseoffset;
+//echo getid3_lib::PrintHexBytes(substr($atom_data, 0, 8)).'<br>';
+//echo getid3_lib::PrintHexBytes(substr($atom_data, 0, 8), false).'<br><br>';
+		switch ($atomname) {
+			case 'moov': // MOVie container atom
+			case 'trak': // TRAcK container atom
+			case 'clip': // CLIPping container atom
+			case 'matt': // track MATTe container atom
+			case 'edts': // EDiTS container atom
+			case 'tref': // Track REFerence container atom
+			case 'mdia': // MeDIA container atom
+			case 'minf': // Media INFormation container atom
+			case 'dinf': // Data INFormation container atom
+			case 'udta': // User DaTA container atom
+			case 'cmov': // Compressed MOVie container atom
+			case 'rmra': // Reference Movie Record Atom
+			case 'rmda': // Reference Movie Descriptor Atom
+			case 'gmhd': // Generic Media info HeaDer atom (seen on QTVR)
+				$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms);
+				break;
+
+			case 'ilst': // Item LiST container atom
+				$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms);
+
+				// some "ilst" atoms contain data atoms that have a numeric name, and the data is far more accessible if the returned array is compacted
+				$allnumericnames = true;
+				foreach ($atom_structure['subatoms'] as $subatomarray) {
+					if (!is_integer($subatomarray['name']) || (count($subatomarray['subatoms']) != 1)) {
+						$allnumericnames = false;
+						break;
+					}
+				}
+				if ($allnumericnames) {
+					$newData = array();
+					foreach ($atom_structure['subatoms'] as $subatomarray) {
+						foreach ($subatomarray['subatoms'] as $newData_subatomarray) {
+							unset($newData_subatomarray['hierarchy'], $newData_subatomarray['name']);
+							$newData[$subatomarray['name']] = $newData_subatomarray;
+							break;
+						}
+					}
+					$atom_structure['data'] = $newData;
+					unset($atom_structure['subatoms']);
+				}
+				break;
+
+			case "\x00\x00\x00\x01":
+			case "\x00\x00\x00\x02":
+			case "\x00\x00\x00\x03":
+			case "\x00\x00\x00\x04":
+			case "\x00\x00\x00\x05":
+				$atomname = getid3_lib::BigEndian2Int($atomname);
+				$atom_structure['name'] = $atomname;
+				$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms);
+				break;
+
+			case 'stbl': // Sample TaBLe container atom
+				$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms);
+				$isVideo = false;
+				$framerate  = 0;
+				$framecount = 0;
+				foreach ($atom_structure['subatoms'] as $key => $value_array) {
+					if (isset($value_array['sample_description_table'])) {
+						foreach ($value_array['sample_description_table'] as $key2 => $value_array2) {
+							if (isset($value_array2['data_format'])) {
+								switch ($value_array2['data_format']) {
+									case 'avc1':
+									case 'mp4v':
+										// video data
+										$isVideo = true;
+										break;
+									case 'mp4a':
+										// audio data
+										break;
+								}
+							}
+						}
+					} elseif (isset($value_array['time_to_sample_table'])) {
+						foreach ($value_array['time_to_sample_table'] as $key2 => $value_array2) {
+							if (isset($value_array2['sample_count']) && isset($value_array2['sample_duration']) && ($value_array2['sample_duration'] > 0)) {
+								$framerate  = round($info['quicktime']['time_scale'] / $value_array2['sample_duration'], 3);
+								$framecount = $value_array2['sample_count'];
+							}
+						}
+					}
+				}
+				if ($isVideo && $framerate) {
+					$info['quicktime']['video']['frame_rate'] = $framerate;
+					$info['video']['frame_rate'] = $info['quicktime']['video']['frame_rate'];
+				}
+				if ($isVideo && $framecount) {
+					$info['quicktime']['video']['frame_count'] = $framecount;
+				}
+				break;
+
+
+			case 'aART': // Album ARTist
+			case 'catg': // CaTeGory
+			case 'covr': // COVeR artwork
+			case 'cpil': // ComPILation
+			case 'cprt': // CoPyRighT
+			case 'desc': // DESCription
+			case 'disk': // DISK number
+			case 'egid': // Episode Global ID
+			case 'gnre': // GeNRE
+			case 'keyw': // KEYWord
+			case 'ldes':
+			case 'pcst': // PodCaST
+			case 'pgap': // GAPless Playback
+			case 'purd': // PURchase Date
+			case 'purl': // Podcast URL
+			case 'rati':
+			case 'rndu':
+			case 'rpdu':
+			case 'rtng': // RaTiNG
+			case 'stik':
+			case 'tmpo': // TeMPO (BPM)
+			case 'trkn': // TRacK Number
+			case 'tves': // TV EpiSode
+			case 'tvnn': // TV Network Name
+			case 'tvsh': // TV SHow Name
+			case 'tvsn': // TV SeasoN
+			case 'akID': // iTunes store account type
+			case 'apID':
+			case 'atID':
+			case 'cmID':
+			case 'cnID':
+			case 'geID':
+			case 'plID':
+			case 'sfID': // iTunes store country
+			case '©alb': // ALBum
+			case '©art': // ARTist
+			case '©ART':
+			case '©aut':
+			case '©cmt': // CoMmenT
+			case '©com': // COMposer
+			case '©cpy':
+			case '©day': // content created year
+			case '©dir':
+			case '©ed1':
+			case '©ed2':
+			case '©ed3':
+			case '©ed4':
+			case '©ed5':
+			case '©ed6':
+			case '©ed7':
+			case '©ed8':
+			case '©ed9':
+			case '©enc':
+			case '©fmt':
+			case '©gen': // GENre
+			case '©grp': // GRouPing
+			case '©hst':
+			case '©inf':
+			case '©lyr': // LYRics
+			case '©mak':
+			case '©mod':
+			case '©nam': // full NAMe
+			case '©ope':
+			case '©PRD':
+			case '©prd':
+			case '©prf':
+			case '©req':
+			case '©src':
+			case '©swr':
+			case '©too': // encoder
+			case '©trk': // TRacK
+			case '©url':
+			case '©wrn':
+			case '©wrt': // WRiTer
+			case '----': // itunes specific
+				if ($atom_parent == 'udta') {
+					// User data atom handler
+					$atom_structure['data_length'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2));
+					$atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2));
+					$atom_structure['data']        =                           substr($atom_data, 4);
+
+					$atom_structure['language']    = $this->QuicktimeLanguageLookup($atom_structure['language_id']);
+					if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) {
+						$info['comments']['language'][] = $atom_structure['language'];
+					}
+				} else {
+					// Apple item list box atom handler
+					$atomoffset = 0;
+					if (substr($atom_data, 2, 2) == "\x10\xB5") {
+						// not sure what it means, but observed on iPhone4 data.
+						// Each $atom_data has 2 bytes of datasize, plus 0x10B5, then data
+						while ($atomoffset < strlen($atom_data)) {
+							$boxsmallsize = getid3_lib::BigEndian2Int(substr($atom_data, $atomoffset,     2));
+							$boxsmalltype =                           substr($atom_data, $atomoffset + 2, 2);
+							$boxsmalldata =                           substr($atom_data, $atomoffset + 4, $boxsmallsize);
+							switch ($boxsmalltype) {
+								case "\x10\xB5":
+									$atom_structure['data'] = $boxsmalldata;
+									break;
+								default:
+									$info['warning'][] = 'Unknown QuickTime smallbox type: "'.getid3_lib::PrintHexBytes($boxsmalltype).'" at offset '.$baseoffset;
+									$atom_structure['data'] = $atom_data;
+									break;
+							}
+							$atomoffset += (4 + $boxsmallsize);
+						}
+					} else {
+						while ($atomoffset < strlen($atom_data)) {
+							$boxsize = getid3_lib::BigEndian2Int(substr($atom_data, $atomoffset, 4));
+							$boxtype =                           substr($atom_data, $atomoffset + 4, 4);
+							$boxdata =                           substr($atom_data, $atomoffset + 8, $boxsize - 8);
+							if ($boxsize <= 1) {
+								$info['warning'][] = 'Invalid QuickTime atom box size "'.$boxsize.'" in atom "'.$atomname.'" at offset: '.($atom_structure['offset'] + $atomoffset);
+								$atom_structure['data'] = null;
+								$atomoffset = strlen($atom_data);
+								break;
+							}
+							$atomoffset += $boxsize;
+
+							switch ($boxtype) {
+								case 'mean':
+								case 'name':
+									$atom_structure[$boxtype] = substr($boxdata, 4);
+									break;
+
+								case 'data':
+									$atom_structure['version']   = getid3_lib::BigEndian2Int(substr($boxdata,  0, 1));
+									$atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($boxdata,  1, 3));
+									switch ($atom_structure['flags_raw']) {
+										case 0:  // data flag
+										case 21: // tmpo/cpil flag
+											switch ($atomname) {
+												case 'cpil':
+												case 'pcst':
+												case 'pgap':
+													$atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1));
+													break;
+
+												case 'tmpo':
+													$atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 2));
+													break;
+
+												case 'disk':
+												case 'trkn':
+													$num       = getid3_lib::BigEndian2Int(substr($boxdata, 10, 2));
+													$num_total = getid3_lib::BigEndian2Int(substr($boxdata, 12, 2));
+													$atom_structure['data']  = empty($num) ? '' : $num;
+													$atom_structure['data'] .= empty($num_total) ? '' : '/'.$num_total;
+													break;
+
+												case 'gnre':
+													$GenreID = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4));
+													$atom_structure['data']    = getid3_id3v1::LookupGenreName($GenreID - 1);
+													break;
+
+												case 'rtng':
+													$atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1));
+													$atom_structure['data']    = $this->QuicktimeContentRatingLookup($atom_structure[$atomname]);
+													break;
+
+												case 'stik':
+													$atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1));
+													$atom_structure['data']    = $this->QuicktimeSTIKLookup($atom_structure[$atomname]);
+													break;
+
+												case 'sfID':
+													$atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4));
+													$atom_structure['data']    = $this->QuicktimeStoreFrontCodeLookup($atom_structure[$atomname]);
+													break;
+
+												case 'egid':
+												case 'purl':
+													$atom_structure['data'] = substr($boxdata, 8);
+													break;
+
+												default:
+													$atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4));
+											}
+											break;
+
+										case 1:  // text flag
+										case 13: // image flag
+										default:
+											$atom_structure['data'] = substr($boxdata, 8);
+											break;
+
+									}
+									break;
+
+								default:
+									$info['warning'][] = 'Unknown QuickTime box type: "'.getid3_lib::PrintHexBytes($boxtype).'" at offset '.$baseoffset;
+									$atom_structure['data'] = $atom_data;
+
+							}
+						}
+					}
+				}
+				$this->CopyToAppropriateCommentsSection($atomname, $atom_structure['data'], $atom_structure['name']);
+				break;
+
+
+			case 'play': // auto-PLAY atom
+				$atom_structure['autoplay'] = (bool) getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+
+				$info['quicktime']['autoplay'] = $atom_structure['autoplay'];
+				break;
+
+
+			case 'WLOC': // Window LOCation atom
+				$atom_structure['location_x']  = getid3_lib::BigEndian2Int(substr($atom_data,  0, 2));
+				$atom_structure['location_y']  = getid3_lib::BigEndian2Int(substr($atom_data,  2, 2));
+				break;
+
+
+			case 'LOOP': // LOOPing atom
+			case 'SelO': // play SELection Only atom
+			case 'AllF': // play ALL Frames atom
+				$atom_structure['data'] = getid3_lib::BigEndian2Int($atom_data);
+				break;
+
+
+			case 'name': //
+			case 'MCPS': // Media Cleaner PRo
+			case '@PRM': // adobe PReMiere version
+			case '@PRQ': // adobe PRemiere Quicktime version
+				$atom_structure['data'] = $atom_data;
+				break;
+
+
+			case 'cmvd': // Compressed MooV Data atom
+				// Code by ubergeekØubergeek*tv based on information from
+				// http://developer.apple.com/quicktime/icefloe/dispatch012.html
+				$atom_structure['unCompressedSize'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4));
+
+				$CompressedFileData = substr($atom_data, 4);
+				if ($UncompressedHeader = @gzuncompress($CompressedFileData)) {
+					$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($UncompressedHeader, 0, $atomHierarchy, $ParseAllPossibleAtoms);
+				} else {
+					$info['warning'][] = 'Error decompressing compressed MOV atom at offset '.$atom_structure['offset'];
+				}
+				break;
+
+
+			case 'dcom': // Data COMpression atom
+				$atom_structure['compression_id']   = $atom_data;
+				$atom_structure['compression_text'] = $this->QuicktimeDCOMLookup($atom_data);
+				break;
+
+
+			case 'rdrf': // Reference movie Data ReFerence atom
+				$atom_structure['version']                = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']              = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3));
+				$atom_structure['flags']['internal_data'] = (bool) ($atom_structure['flags_raw'] & 0x000001);
+
+				$atom_structure['reference_type_name']    =                           substr($atom_data,  4, 4);
+				$atom_structure['reference_length']       = getid3_lib::BigEndian2Int(substr($atom_data,  8, 4));
+				switch ($atom_structure['reference_type_name']) {
+					case 'url ':
+						$atom_structure['url']            =       $this->NoNullString(substr($atom_data, 12));
+						break;
+
+					case 'alis':
+						$atom_structure['file_alias']     =                           substr($atom_data, 12);
+						break;
+
+					case 'rsrc':
+						$atom_structure['resource_alias'] =                           substr($atom_data, 12);
+						break;
+
+					default:
+						$atom_structure['data']           =                           substr($atom_data, 12);
+						break;
+				}
+				break;
+
+
+			case 'rmqu': // Reference Movie QUality atom
+				$atom_structure['movie_quality'] = getid3_lib::BigEndian2Int($atom_data);
+				break;
+
+
+			case 'rmcs': // Reference Movie Cpu Speed atom
+				$atom_structure['version']          = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']        = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['cpu_speed_rating'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 2));
+				break;
+
+
+			case 'rmvc': // Reference Movie Version Check atom
+				$atom_structure['version']            = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']          = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['gestalt_selector']   =                           substr($atom_data,  4, 4);
+				$atom_structure['gestalt_value_mask'] = getid3_lib::BigEndian2Int(substr($atom_data,  8, 4));
+				$atom_structure['gestalt_value']      = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4));
+				$atom_structure['gestalt_check_type'] = getid3_lib::BigEndian2Int(substr($atom_data, 14, 2));
+				break;
+
+
+			case 'rmcd': // Reference Movie Component check atom
+				$atom_structure['version']                = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']              = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['component_type']         =                           substr($atom_data,  4, 4);
+				$atom_structure['component_subtype']      =                           substr($atom_data,  8, 4);
+				$atom_structure['component_manufacturer'] =                           substr($atom_data, 12, 4);
+				$atom_structure['component_flags_raw']    = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4));
+				$atom_structure['component_flags_mask']   = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4));
+				$atom_structure['component_min_version']  = getid3_lib::BigEndian2Int(substr($atom_data, 24, 4));
+				break;
+
+
+			case 'rmdr': // Reference Movie Data Rate atom
+				$atom_structure['version']       = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']     = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['data_rate']     = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+
+				$atom_structure['data_rate_bps'] = $atom_structure['data_rate'] * 10;
+				break;
+
+
+			case 'rmla': // Reference Movie Language Atom
+				$atom_structure['version']     = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']   = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 2));
+
+				$atom_structure['language']    = $this->QuicktimeLanguageLookup($atom_structure['language_id']);
+				if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) {
+					$info['comments']['language'][] = $atom_structure['language'];
+				}
+				break;
+
+
+			case 'rmla': // Reference Movie Language Atom
+				$atom_structure['version']   = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['track_id']  = getid3_lib::BigEndian2Int(substr($atom_data,  4, 2));
+				break;
+
+
+			case 'ptv ': // Print To Video - defines a movie's full screen mode
+				// http://developer.apple.com/documentation/QuickTime/APIREF/SOURCESIV/at_ptv-_pg.htm
+				$atom_structure['display_size_raw']  = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2));
+				$atom_structure['reserved_1']        = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2)); // hardcoded: 0x0000
+				$atom_structure['reserved_2']        = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); // hardcoded: 0x0000
+				$atom_structure['slide_show_flag']   = getid3_lib::BigEndian2Int(substr($atom_data, 6, 1));
+				$atom_structure['play_on_open_flag'] = getid3_lib::BigEndian2Int(substr($atom_data, 7, 1));
+
+				$atom_structure['flags']['play_on_open'] = (bool) $atom_structure['play_on_open_flag'];
+				$atom_structure['flags']['slide_show']   = (bool) $atom_structure['slide_show_flag'];
+
+				$ptv_lookup[0] = 'normal';
+				$ptv_lookup[1] = 'double';
+				$ptv_lookup[2] = 'half';
+				$ptv_lookup[3] = 'full';
+				$ptv_lookup[4] = 'current';
+				if (isset($ptv_lookup[$atom_structure['display_size_raw']])) {
+					$atom_structure['display_size'] = $ptv_lookup[$atom_structure['display_size_raw']];
+				} else {
+					$info['warning'][] = 'unknown "ptv " display constant ('.$atom_structure['display_size_raw'].')';
+				}
+				break;
+
+
+			case 'stsd': // Sample Table Sample Description atom
+				$atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+				$stsdEntriesDataOffset = 8;
+				for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
+					$atom_structure['sample_description_table'][$i]['size']             = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 4));
+					$stsdEntriesDataOffset += 4;
+					$atom_structure['sample_description_table'][$i]['data_format']      =                           substr($atom_data, $stsdEntriesDataOffset, 4);
+					$stsdEntriesDataOffset += 4;
+					$atom_structure['sample_description_table'][$i]['reserved']         = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 6));
+					$stsdEntriesDataOffset += 6;
+					$atom_structure['sample_description_table'][$i]['reference_index']  = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 2));
+					$stsdEntriesDataOffset += 2;
+					$atom_structure['sample_description_table'][$i]['data']             =                           substr($atom_data, $stsdEntriesDataOffset, ($atom_structure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2));
+					$stsdEntriesDataOffset += ($atom_structure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2);
+
+					$atom_structure['sample_description_table'][$i]['encoder_version']  = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'],  0, 2));
+					$atom_structure['sample_description_table'][$i]['encoder_revision'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'],  2, 2));
+					$atom_structure['sample_description_table'][$i]['encoder_vendor']   =                           substr($atom_structure['sample_description_table'][$i]['data'],  4, 4);
+
+					switch ($atom_structure['sample_description_table'][$i]['encoder_vendor']) {
+
+						case "\x00\x00\x00\x00":
+							// audio atom
+							$atom_structure['sample_description_table'][$i]['audio_channels']       =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'],  8,  2));
+							$atom_structure['sample_description_table'][$i]['audio_bit_depth']      =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 10,  2));
+							$atom_structure['sample_description_table'][$i]['audio_compression_id'] =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12,  2));
+							$atom_structure['sample_description_table'][$i]['audio_packet_size']    =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 14,  2));
+							$atom_structure['sample_description_table'][$i]['audio_sample_rate']    = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 16,  4));
+
+							switch ($atom_structure['sample_description_table'][$i]['data_format']) {
+								case 'avc1':
+								case 'mp4v':
+									$info['fileformat'] = 'mp4';
+									$info['video']['fourcc'] = $atom_structure['sample_description_table'][$i]['data_format'];
+									//$info['warning'][] = 'This version of getID3() ['.$this->getid3->version().'] does not fully support MPEG-4 audio/video streams'; // 2011-02-18: why am I warning about this again? What's not supported?
+									break;
+
+								case 'qtvr':
+									$info['video']['dataformat'] = 'quicktimevr';
+									break;
+
+								case 'mp4a':
+								default:
+									$info['quicktime']['audio']['codec']       = $this->QuicktimeAudioCodecLookup($atom_structure['sample_description_table'][$i]['data_format']);
+									$info['quicktime']['audio']['sample_rate'] = $atom_structure['sample_description_table'][$i]['audio_sample_rate'];
+									$info['quicktime']['audio']['channels']    = $atom_structure['sample_description_table'][$i]['audio_channels'];
+									$info['quicktime']['audio']['bit_depth']   = $atom_structure['sample_description_table'][$i]['audio_bit_depth'];
+									$info['audio']['codec']                    = $info['quicktime']['audio']['codec'];
+									$info['audio']['sample_rate']              = $info['quicktime']['audio']['sample_rate'];
+									$info['audio']['channels']                 = $info['quicktime']['audio']['channels'];
+									$info['audio']['bits_per_sample']          = $info['quicktime']['audio']['bit_depth'];
+									switch ($atom_structure['sample_description_table'][$i]['data_format']) {
+										case 'raw ': // PCM
+										case 'alac': // Apple Lossless Audio Codec
+											$info['audio']['lossless'] = true;
+											break;
+										default:
+											$info['audio']['lossless'] = false;
+											break;
+									}
+									break;
+							}
+							break;
+
+						default:
+							switch ($atom_structure['sample_description_table'][$i]['data_format']) {
+								case 'mp4s':
+									$info['fileformat'] = 'mp4';
+									break;
+
+								default:
+									// video atom
+									$atom_structure['sample_description_table'][$i]['video_temporal_quality']  =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'],  8,  4));
+									$atom_structure['sample_description_table'][$i]['video_spatial_quality']   =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12,  4));
+									$atom_structure['sample_description_table'][$i]['video_frame_width']       =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 16,  2));
+									$atom_structure['sample_description_table'][$i]['video_frame_height']      =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 18,  2));
+									$atom_structure['sample_description_table'][$i]['video_resolution_x']      = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 20,  4));
+									$atom_structure['sample_description_table'][$i]['video_resolution_y']      = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 24,  4));
+									$atom_structure['sample_description_table'][$i]['video_data_size']         =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 28,  4));
+									$atom_structure['sample_description_table'][$i]['video_frame_count']       =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 32,  2));
+									$atom_structure['sample_description_table'][$i]['video_encoder_name_len']  =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 34,  1));
+									$atom_structure['sample_description_table'][$i]['video_encoder_name']      =                             substr($atom_structure['sample_description_table'][$i]['data'], 35, $atom_structure['sample_description_table'][$i]['video_encoder_name_len']);
+									$atom_structure['sample_description_table'][$i]['video_pixel_color_depth'] =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 66,  2));
+									$atom_structure['sample_description_table'][$i]['video_color_table_id']    =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 68,  2));
+
+									$atom_structure['sample_description_table'][$i]['video_pixel_color_type']  = (($atom_structure['sample_description_table'][$i]['video_pixel_color_depth'] > 32) ? 'grayscale' : 'color');
+									$atom_structure['sample_description_table'][$i]['video_pixel_color_name']  = $this->QuicktimeColorNameLookup($atom_structure['sample_description_table'][$i]['video_pixel_color_depth']);
+
+									if ($atom_structure['sample_description_table'][$i]['video_pixel_color_name'] != 'invalid') {
+										$info['quicktime']['video']['codec_fourcc']        = $atom_structure['sample_description_table'][$i]['data_format'];
+										$info['quicktime']['video']['codec_fourcc_lookup'] = $this->QuicktimeVideoCodecLookup($atom_structure['sample_description_table'][$i]['data_format']);
+										$info['quicktime']['video']['codec']               = (($atom_structure['sample_description_table'][$i]['video_encoder_name_len'] > 0) ? $atom_structure['sample_description_table'][$i]['video_encoder_name'] : $atom_structure['sample_description_table'][$i]['data_format']);
+										$info['quicktime']['video']['color_depth']         = $atom_structure['sample_description_table'][$i]['video_pixel_color_depth'];
+										$info['quicktime']['video']['color_depth_name']    = $atom_structure['sample_description_table'][$i]['video_pixel_color_name'];
+
+										$info['video']['codec']           = $info['quicktime']['video']['codec'];
+										$info['video']['bits_per_sample'] = $info['quicktime']['video']['color_depth'];
+									}
+									$info['video']['lossless']           = false;
+									$info['video']['pixel_aspect_ratio'] = (float) 1;
+									break;
+							}
+							break;
+					}
+					switch (strtolower($atom_structure['sample_description_table'][$i]['data_format'])) {
+						case 'mp4a':
+							$info['audio']['dataformat']         = 'mp4';
+							$info['quicktime']['audio']['codec'] = 'mp4';
+							break;
+
+						case '3ivx':
+						case '3iv1':
+						case '3iv2':
+							$info['video']['dataformat'] = '3ivx';
+							break;
+
+						case 'xvid':
+							$info['video']['dataformat'] = 'xvid';
+							break;
+
+						case 'mp4v':
+							$info['video']['dataformat'] = 'mpeg4';
+							break;
+
+						case 'divx':
+						case 'div1':
+						case 'div2':
+						case 'div3':
+						case 'div4':
+						case 'div5':
+						case 'div6':
+							$info['video']['dataformat'] = 'divx';
+							break;
+
+						default:
+							// do nothing
+							break;
+					}
+					unset($atom_structure['sample_description_table'][$i]['data']);
+				}
+				break;
+
+
+			case 'stts': // Sample Table Time-to-Sample atom
+				$atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+				$sttsEntriesDataOffset = 8;
+				//$FrameRateCalculatorArray = array();
+				$frames_count = 0;
+				for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
+					$atom_structure['time_to_sample_table'][$i]['sample_count']    = getid3_lib::BigEndian2Int(substr($atom_data, $sttsEntriesDataOffset, 4));
+					$sttsEntriesDataOffset += 4;
+					$atom_structure['time_to_sample_table'][$i]['sample_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, $sttsEntriesDataOffset, 4));
+					$sttsEntriesDataOffset += 4;
+
+					$frames_count += $atom_structure['time_to_sample_table'][$i]['sample_count'];
+
+					// THIS SECTION REPLACED WITH CODE IN "stbl" ATOM
+					//if (!empty($info['quicktime']['time_scale']) && ($atom_structure['time_to_sample_table'][$i]['sample_duration'] > 0)) {
+					//	$stts_new_framerate = $info['quicktime']['time_scale'] / $atom_structure['time_to_sample_table'][$i]['sample_duration'];
+					//	if ($stts_new_framerate <= 60) {
+					//		// some atoms have durations of "1" giving a very large framerate, which probably is not right
+					//		$info['video']['frame_rate'] = max($info['video']['frame_rate'], $stts_new_framerate);
+					//	}
+					//}
+					//
+					//$FrameRateCalculatorArray[($info['quicktime']['time_scale'] / $atom_structure['time_to_sample_table'][$i]['sample_duration'])] += $atom_structure['time_to_sample_table'][$i]['sample_count'];
+				}
+				$info['quicktime']['stts_framecount'][] = $frames_count;
+				//$sttsFramesTotal  = 0;
+				//$sttsSecondsTotal = 0;
+				//foreach ($FrameRateCalculatorArray as $frames_per_second => $frame_count) {
+				//	if (($frames_per_second > 60) || ($frames_per_second < 1)) {
+				//		// not video FPS information, probably audio information
+				//		$sttsFramesTotal  = 0;
+				//		$sttsSecondsTotal = 0;
+				//		break;
+				//	}
+				//	$sttsFramesTotal  += $frame_count;
+				//	$sttsSecondsTotal += $frame_count / $frames_per_second;
+				//}
+				//if (($sttsFramesTotal > 0) && ($sttsSecondsTotal > 0)) {
+				//	if (($sttsFramesTotal / $sttsSecondsTotal) > $info['video']['frame_rate']) {
+				//		$info['video']['frame_rate'] = $sttsFramesTotal / $sttsSecondsTotal;
+				//	}
+				//}
+				break;
+
+
+			case 'stss': // Sample Table Sync Sample (key frames) atom
+				if ($ParseAllPossibleAtoms) {
+					$atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+					$atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+					$atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+					$stssEntriesDataOffset = 8;
+					for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
+						$atom_structure['time_to_sample_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stssEntriesDataOffset, 4));
+						$stssEntriesDataOffset += 4;
+					}
+				}
+				break;
+
+
+			case 'stsc': // Sample Table Sample-to-Chunk atom
+				if ($ParseAllPossibleAtoms) {
+					$atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+					$atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+					$atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+					$stscEntriesDataOffset = 8;
+					for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
+						$atom_structure['sample_to_chunk_table'][$i]['first_chunk']        = getid3_lib::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4));
+						$stscEntriesDataOffset += 4;
+						$atom_structure['sample_to_chunk_table'][$i]['samples_per_chunk']  = getid3_lib::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4));
+						$stscEntriesDataOffset += 4;
+						$atom_structure['sample_to_chunk_table'][$i]['sample_description'] = getid3_lib::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4));
+						$stscEntriesDataOffset += 4;
+					}
+				}
+				break;
+
+
+			case 'stsz': // Sample Table SiZe atom
+				if ($ParseAllPossibleAtoms) {
+					$atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+					$atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+					$atom_structure['sample_size']    = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+					$atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data,  8, 4));
+					$stszEntriesDataOffset = 12;
+					if ($atom_structure['sample_size'] == 0) {
+						for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
+							$atom_structure['sample_size_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stszEntriesDataOffset, 4));
+							$stszEntriesDataOffset += 4;
+						}
+					}
+				}
+				break;
+
+
+			case 'stco': // Sample Table Chunk Offset atom
+				if ($ParseAllPossibleAtoms) {
+					$atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+					$atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+					$atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+					$stcoEntriesDataOffset = 8;
+					for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
+						$atom_structure['chunk_offset_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stcoEntriesDataOffset, 4));
+						$stcoEntriesDataOffset += 4;
+					}
+				}
+				break;
+
+
+			case 'co64': // Chunk Offset 64-bit (version of "stco" that supports > 2GB files)
+				if ($ParseAllPossibleAtoms) {
+					$atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+					$atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+					$atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+					$stcoEntriesDataOffset = 8;
+					for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
+						$atom_structure['chunk_offset_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stcoEntriesDataOffset, 8));
+						$stcoEntriesDataOffset += 8;
+					}
+				}
+				break;
+
+
+			case 'dref': // Data REFerence atom
+				$atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+				$drefDataOffset = 8;
+				for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
+					$atom_structure['data_references'][$i]['size']                    = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 4));
+					$drefDataOffset += 4;
+					$atom_structure['data_references'][$i]['type']                    =               substr($atom_data, $drefDataOffset, 4);
+					$drefDataOffset += 4;
+					$atom_structure['data_references'][$i]['version']                 = getid3_lib::BigEndian2Int(substr($atom_data,  $drefDataOffset, 1));
+					$drefDataOffset += 1;
+					$atom_structure['data_references'][$i]['flags_raw']               = getid3_lib::BigEndian2Int(substr($atom_data,  $drefDataOffset, 3)); // hardcoded: 0x0000
+					$drefDataOffset += 3;
+					$atom_structure['data_references'][$i]['data']                    =               substr($atom_data, $drefDataOffset, ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3));
+					$drefDataOffset += ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3);
+
+					$atom_structure['data_references'][$i]['flags']['self_reference'] = (bool) ($atom_structure['data_references'][$i]['flags_raw'] & 0x001);
+				}
+				break;
+
+
+			case 'gmin': // base Media INformation atom
+				$atom_structure['version']                = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']              = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['graphics_mode']          = getid3_lib::BigEndian2Int(substr($atom_data,  4, 2));
+				$atom_structure['opcolor_red']            = getid3_lib::BigEndian2Int(substr($atom_data,  6, 2));
+				$atom_structure['opcolor_green']          = getid3_lib::BigEndian2Int(substr($atom_data,  8, 2));
+				$atom_structure['opcolor_blue']           = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2));
+				$atom_structure['balance']                = getid3_lib::BigEndian2Int(substr($atom_data, 12, 2));
+				$atom_structure['reserved']               = getid3_lib::BigEndian2Int(substr($atom_data, 14, 2));
+				break;
+
+
+			case 'smhd': // Sound Media information HeaDer atom
+				$atom_structure['version']                = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']              = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['balance']                = getid3_lib::BigEndian2Int(substr($atom_data,  4, 2));
+				$atom_structure['reserved']               = getid3_lib::BigEndian2Int(substr($atom_data,  6, 2));
+				break;
+
+
+			case 'vmhd': // Video Media information HeaDer atom
+				$atom_structure['version']                = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']              = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3));
+				$atom_structure['graphics_mode']          = getid3_lib::BigEndian2Int(substr($atom_data,  4, 2));
+				$atom_structure['opcolor_red']            = getid3_lib::BigEndian2Int(substr($atom_data,  6, 2));
+				$atom_structure['opcolor_green']          = getid3_lib::BigEndian2Int(substr($atom_data,  8, 2));
+				$atom_structure['opcolor_blue']           = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2));
+
+				$atom_structure['flags']['no_lean_ahead'] = (bool) ($atom_structure['flags_raw'] & 0x001);
+				break;
+
+
+			case 'hdlr': // HanDLeR reference atom
+				$atom_structure['version']                = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']              = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['component_type']         =                           substr($atom_data,  4, 4);
+				$atom_structure['component_subtype']      =                           substr($atom_data,  8, 4);
+				$atom_structure['component_manufacturer'] =                           substr($atom_data, 12, 4);
+				$atom_structure['component_flags_raw']    = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4));
+				$atom_structure['component_flags_mask']   = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4));
+				$atom_structure['component_name']         =      $this->Pascal2String(substr($atom_data, 24));
+
+				if (($atom_structure['component_subtype'] == 'STpn') && ($atom_structure['component_manufacturer'] == 'zzzz')) {
+					$info['video']['dataformat'] = 'quicktimevr';
+				}
+				break;
+
+
+			case 'mdhd': // MeDia HeaDer atom
+				$atom_structure['version']               = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']             = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['creation_time']         = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+				$atom_structure['modify_time']           = getid3_lib::BigEndian2Int(substr($atom_data,  8, 4));
+				$atom_structure['time_scale']            = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4));
+				$atom_structure['duration']              = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4));
+				$atom_structure['language_id']           = getid3_lib::BigEndian2Int(substr($atom_data, 20, 2));
+				$atom_structure['quality']               = getid3_lib::BigEndian2Int(substr($atom_data, 22, 2));
+
+				if ($atom_structure['time_scale'] == 0) {
+					$info['error'][] = 'Corrupt Quicktime file: mdhd.time_scale == zero';
+					return false;
+				}
+				$info['quicktime']['time_scale'] = (isset($info['quicktime']['time_scale']) ? max($info['quicktime']['time_scale'], $atom_structure['time_scale']) : $atom_structure['time_scale']);
+
+				$atom_structure['creation_time_unix']    = getid3_lib::DateMac2Unix($atom_structure['creation_time']);
+				$atom_structure['modify_time_unix']      = getid3_lib::DateMac2Unix($atom_structure['modify_time']);
+				$atom_structure['playtime_seconds']      = $atom_structure['duration'] / $atom_structure['time_scale'];
+				$atom_structure['language']              = $this->QuicktimeLanguageLookup($atom_structure['language_id']);
+				if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) {
+					$info['comments']['language'][] = $atom_structure['language'];
+				}
+				break;
+
+
+			case 'pnot': // Preview atom
+				$atom_structure['modification_date']      = getid3_lib::BigEndian2Int(substr($atom_data,  0, 4)); // "standard Macintosh format"
+				$atom_structure['version_number']         = getid3_lib::BigEndian2Int(substr($atom_data,  4, 2)); // hardcoded: 0x00
+				$atom_structure['atom_type']              =               substr($atom_data,  6, 4);        // usually: 'PICT'
+				$atom_structure['atom_index']             = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2)); // usually: 0x01
+
+				$atom_structure['modification_date_unix'] = getid3_lib::DateMac2Unix($atom_structure['modification_date']);
+				break;
+
+
+			case 'crgn': // Clipping ReGioN atom
+				$atom_structure['region_size']   = getid3_lib::BigEndian2Int(substr($atom_data,  0, 2)); // The Region size, Region boundary box,
+				$atom_structure['boundary_box']  = getid3_lib::BigEndian2Int(substr($atom_data,  2, 8)); // and Clipping region data fields
+				$atom_structure['clipping_data'] =               substr($atom_data, 10);           // constitute a QuickDraw region.
+				break;
+
+
+			case 'load': // track LOAD settings atom
+				$atom_structure['preload_start_time'] = getid3_lib::BigEndian2Int(substr($atom_data,  0, 4));
+				$atom_structure['preload_duration']   = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+				$atom_structure['preload_flags_raw']  = getid3_lib::BigEndian2Int(substr($atom_data,  8, 4));
+				$atom_structure['default_hints_raw']  = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4));
+
+				$atom_structure['default_hints']['double_buffer'] = (bool) ($atom_structure['default_hints_raw'] & 0x0020);
+				$atom_structure['default_hints']['high_quality']  = (bool) ($atom_structure['default_hints_raw'] & 0x0100);
+				break;
+
+
+			case 'tmcd': // TiMe CoDe atom
+			case 'chap': // CHAPter list atom
+			case 'sync': // SYNChronization atom
+			case 'scpt': // tranSCriPT atom
+			case 'ssrc': // non-primary SouRCe atom
+				for ($i = 0; $i < (strlen($atom_data) % 4); $i++) {
+					$atom_structure['track_id'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $i * 4, 4));
+				}
+				break;
+
+
+			case 'elst': // Edit LiST atom
+				$atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+				for ($i = 0; $i < $atom_structure['number_entries']; $i++ ) {
+					$atom_structure['edit_list'][$i]['track_duration'] =   getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 0, 4));
+					$atom_structure['edit_list'][$i]['media_time']     =   getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 4, 4));
+					$atom_structure['edit_list'][$i]['media_rate']     = getid3_lib::FixedPoint16_16(substr($atom_data, 8 + ($i * 12) + 8, 4));
+				}
+				break;
+
+
+			case 'kmat': // compressed MATte atom
+				$atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['matte_data_raw'] =               substr($atom_data,  4);
+				break;
+
+
+			case 'ctab': // Color TABle atom
+				$atom_structure['color_table_seed']   = getid3_lib::BigEndian2Int(substr($atom_data,  0, 4)); // hardcoded: 0x00000000
+				$atom_structure['color_table_flags']  = getid3_lib::BigEndian2Int(substr($atom_data,  4, 2)); // hardcoded: 0x8000
+				$atom_structure['color_table_size']   = getid3_lib::BigEndian2Int(substr($atom_data,  6, 2)) + 1;
+				for ($colortableentry = 0; $colortableentry < $atom_structure['color_table_size']; $colortableentry++) {
+					$atom_structure['color_table'][$colortableentry]['alpha'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 0, 2));
+					$atom_structure['color_table'][$colortableentry]['red']   = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 2, 2));
+					$atom_structure['color_table'][$colortableentry]['green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 4, 2));
+					$atom_structure['color_table'][$colortableentry]['blue']  = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 6, 2));
+				}
+				break;
+
+
+			case 'mvhd': // MoVie HeaDer atom
+				$atom_structure['version']            =   getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']          =   getid3_lib::BigEndian2Int(substr($atom_data,  1, 3));
+				$atom_structure['creation_time']      =   getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+				$atom_structure['modify_time']        =   getid3_lib::BigEndian2Int(substr($atom_data,  8, 4));
+				$atom_structure['time_scale']         =   getid3_lib::BigEndian2Int(substr($atom_data, 12, 4));
+				$atom_structure['duration']           =   getid3_lib::BigEndian2Int(substr($atom_data, 16, 4));
+				$atom_structure['preferred_rate']     = getid3_lib::FixedPoint16_16(substr($atom_data, 20, 4));
+				$atom_structure['preferred_volume']   =   getid3_lib::FixedPoint8_8(substr($atom_data, 24, 2));
+				$atom_structure['reserved']           =                             substr($atom_data, 26, 10);
+				$atom_structure['matrix_a']           = getid3_lib::FixedPoint16_16(substr($atom_data, 36, 4));
+				$atom_structure['matrix_b']           = getid3_lib::FixedPoint16_16(substr($atom_data, 40, 4));
+				$atom_structure['matrix_u']           =  getid3_lib::FixedPoint2_30(substr($atom_data, 44, 4));
+				$atom_structure['matrix_c']           = getid3_lib::FixedPoint16_16(substr($atom_data, 48, 4));
+				$atom_structure['matrix_d']           = getid3_lib::FixedPoint16_16(substr($atom_data, 52, 4));
+				$atom_structure['matrix_v']           =  getid3_lib::FixedPoint2_30(substr($atom_data, 56, 4));
+				$atom_structure['matrix_x']           = getid3_lib::FixedPoint16_16(substr($atom_data, 60, 4));
+				$atom_structure['matrix_y']           = getid3_lib::FixedPoint16_16(substr($atom_data, 64, 4));
+				$atom_structure['matrix_w']           =  getid3_lib::FixedPoint2_30(substr($atom_data, 68, 4));
+				$atom_structure['preview_time']       =   getid3_lib::BigEndian2Int(substr($atom_data, 72, 4));
+				$atom_structure['preview_duration']   =   getid3_lib::BigEndian2Int(substr($atom_data, 76, 4));
+				$atom_structure['poster_time']        =   getid3_lib::BigEndian2Int(substr($atom_data, 80, 4));
+				$atom_structure['selection_time']     =   getid3_lib::BigEndian2Int(substr($atom_data, 84, 4));
+				$atom_structure['selection_duration'] =   getid3_lib::BigEndian2Int(substr($atom_data, 88, 4));
+				$atom_structure['current_time']       =   getid3_lib::BigEndian2Int(substr($atom_data, 92, 4));
+				$atom_structure['next_track_id']      =   getid3_lib::BigEndian2Int(substr($atom_data, 96, 4));
+
+				if ($atom_structure['time_scale'] == 0) {
+					$info['error'][] = 'Corrupt Quicktime file: mvhd.time_scale == zero';
+					return false;
+				}
+				$atom_structure['creation_time_unix']        = getid3_lib::DateMac2Unix($atom_structure['creation_time']);
+				$atom_structure['modify_time_unix']          = getid3_lib::DateMac2Unix($atom_structure['modify_time']);
+				$info['quicktime']['time_scale']    = (isset($info['quicktime']['time_scale']) ? max($info['quicktime']['time_scale'], $atom_structure['time_scale']) : $atom_structure['time_scale']);
+				$info['quicktime']['display_scale'] = $atom_structure['matrix_a'];
+				$info['playtime_seconds']           = $atom_structure['duration'] / $atom_structure['time_scale'];
+				break;
+
+
+			case 'tkhd': // TracK HeaDer atom
+				$atom_structure['version']             =   getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']           =   getid3_lib::BigEndian2Int(substr($atom_data,  1, 3));
+				$atom_structure['creation_time']       =   getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+				$atom_structure['modify_time']         =   getid3_lib::BigEndian2Int(substr($atom_data,  8, 4));
+				$atom_structure['trackid']             =   getid3_lib::BigEndian2Int(substr($atom_data, 12, 4));
+				$atom_structure['reserved1']           =   getid3_lib::BigEndian2Int(substr($atom_data, 16, 4));
+				$atom_structure['duration']            =   getid3_lib::BigEndian2Int(substr($atom_data, 20, 4));
+				$atom_structure['reserved2']           =   getid3_lib::BigEndian2Int(substr($atom_data, 24, 8));
+				$atom_structure['layer']               =   getid3_lib::BigEndian2Int(substr($atom_data, 32, 2));
+				$atom_structure['alternate_group']     =   getid3_lib::BigEndian2Int(substr($atom_data, 34, 2));
+				$atom_structure['volume']              =   getid3_lib::FixedPoint8_8(substr($atom_data, 36, 2));
+				$atom_structure['reserved3']           =   getid3_lib::BigEndian2Int(substr($atom_data, 38, 2));
+				$atom_structure['matrix_a']            = getid3_lib::FixedPoint16_16(substr($atom_data, 40, 4));
+				$atom_structure['matrix_b']            = getid3_lib::FixedPoint16_16(substr($atom_data, 44, 4));
+				$atom_structure['matrix_u']            = getid3_lib::FixedPoint16_16(substr($atom_data, 48, 4));
+				$atom_structure['matrix_c']            = getid3_lib::FixedPoint16_16(substr($atom_data, 52, 4));
+				$atom_structure['matrix_d']            = getid3_lib::FixedPoint16_16(substr($atom_data, 56, 4));
+				$atom_structure['matrix_v']            = getid3_lib::FixedPoint16_16(substr($atom_data, 60, 4));
+				$atom_structure['matrix_x']            =  getid3_lib::FixedPoint2_30(substr($atom_data, 64, 4));
+				$atom_structure['matrix_y']            =  getid3_lib::FixedPoint2_30(substr($atom_data, 68, 4));
+				$atom_structure['matrix_w']            =  getid3_lib::FixedPoint2_30(substr($atom_data, 72, 4));
+				$atom_structure['width']               = getid3_lib::FixedPoint16_16(substr($atom_data, 76, 4));
+				$atom_structure['height']              = getid3_lib::FixedPoint16_16(substr($atom_data, 80, 4));
+
+				$atom_structure['flags']['enabled']    = (bool) ($atom_structure['flags_raw'] & 0x0001);
+				$atom_structure['flags']['in_movie']   = (bool) ($atom_structure['flags_raw'] & 0x0002);
+				$atom_structure['flags']['in_preview'] = (bool) ($atom_structure['flags_raw'] & 0x0004);
+				$atom_structure['flags']['in_poster']  = (bool) ($atom_structure['flags_raw'] & 0x0008);
+				$atom_structure['creation_time_unix']  = getid3_lib::DateMac2Unix($atom_structure['creation_time']);
+				$atom_structure['modify_time_unix']    = getid3_lib::DateMac2Unix($atom_structure['modify_time']);
+
+				if ($atom_structure['flags']['enabled'] == 1) {
+					if (!isset($info['video']['resolution_x']) || !isset($info['video']['resolution_y'])) {
+						$info['video']['resolution_x'] = $atom_structure['width'];
+						$info['video']['resolution_y'] = $atom_structure['height'];
+					}
+					$info['video']['resolution_x'] = max($info['video']['resolution_x'], $atom_structure['width']);
+					$info['video']['resolution_y'] = max($info['video']['resolution_y'], $atom_structure['height']);
+					$info['quicktime']['video']['resolution_x'] = $info['video']['resolution_x'];
+					$info['quicktime']['video']['resolution_y'] = $info['video']['resolution_y'];
+				} else {
+					// see: http://www.getid3.org/phpBB3/viewtopic.php?t=1295
+					//if (isset($info['video']['resolution_x'])) { unset($info['video']['resolution_x']); }
+					//if (isset($info['video']['resolution_y'])) { unset($info['video']['resolution_y']); }
+					//if (isset($info['quicktime']['video']))    { unset($info['quicktime']['video']);    }
+				}
+				break;
+
+
+			case 'iods': // Initial Object DeScriptor atom
+				// http://www.koders.com/c/fid1FAB3E762903DC482D8A246D4A4BF9F28E049594.aspx?s=windows.h
+				// http://libquicktime.sourcearchive.com/documentation/1.0.2plus-pdebian/iods_8c-source.html
+				$offset = 0;
+				$atom_structure['version']                =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
+				$offset += 1;
+				$atom_structure['flags_raw']              =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 3));
+				$offset += 3;
+				$atom_structure['mp4_iod_tag']            =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
+				$offset += 1;
+				$atom_structure['length']                 = $this->quicktime_read_mp4_descr_length($atom_data, $offset);
+				//$offset already adjusted by quicktime_read_mp4_descr_length()
+				$atom_structure['object_descriptor_id']   =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2));
+				$offset += 2;
+				$atom_structure['od_profile_level']       =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
+				$offset += 1;
+				$atom_structure['scene_profile_level']    =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
+				$offset += 1;
+				$atom_structure['audio_profile_id']       =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
+				$offset += 1;
+				$atom_structure['video_profile_id']       =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
+				$offset += 1;
+				$atom_structure['graphics_profile_level'] =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
+				$offset += 1;
+
+				$atom_structure['num_iods_tracks'] = ($atom_structure['length'] - 7) / 6; // 6 bytes would only be right if all tracks use 1-byte length fields
+				for ($i = 0; $i < $atom_structure['num_iods_tracks']; $i++) {
+					$atom_structure['track'][$i]['ES_ID_IncTag'] =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
+					$offset += 1;
+					$atom_structure['track'][$i]['length']       = $this->quicktime_read_mp4_descr_length($atom_data, $offset);
+					//$offset already adjusted by quicktime_read_mp4_descr_length()
+					$atom_structure['track'][$i]['track_id']     =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 4));
+					$offset += 4;
+				}
+
+				$atom_structure['audio_profile_name'] = $this->QuicktimeIODSaudioProfileName($atom_structure['audio_profile_id']);
+				$atom_structure['video_profile_name'] = $this->QuicktimeIODSvideoProfileName($atom_structure['video_profile_id']);
+				break;
+
+			case 'ftyp': // FileTYPe (?) atom (for MP4 it seems)
+				$atom_structure['signature'] =                           substr($atom_data,  0, 4);
+				$atom_structure['unknown_1'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+				$atom_structure['fourcc']    =                           substr($atom_data,  8, 4);
+				break;
+
+			case 'mdat': // Media DATa atom
+			case 'free': // FREE space atom
+			case 'skip': // SKIP atom
+			case 'wide': // 64-bit expansion placeholder atom
+				// 'mdat' data is too big to deal with, contains no useful metadata
+				// 'free', 'skip' and 'wide' are just padding, contains no useful data at all
+
+				// When writing QuickTime files, it is sometimes necessary to update an atom's size.
+				// It is impossible to update a 32-bit atom to a 64-bit atom since the 32-bit atom
+				// is only 8 bytes in size, and the 64-bit atom requires 16 bytes. Therefore, QuickTime
+				// puts an 8-byte placeholder atom before any atoms it may have to update the size of.
+				// In this way, if the atom needs to be converted from a 32-bit to a 64-bit atom, the
+				// placeholder atom can be overwritten to obtain the necessary 8 extra bytes.
+				// The placeholder atom has a type of kWideAtomPlaceholderType ( 'wide' ).
+				break;
+
+
+			case 'nsav': // NoSAVe atom
+				// http://developer.apple.com/technotes/tn/tn2038.html
+				$atom_structure['data'] = getid3_lib::BigEndian2Int(substr($atom_data,  0, 4));
+				break;
+
+			case 'ctyp': // Controller TYPe atom (seen on QTVR)
+				// http://homepages.slingshot.co.nz/~helmboy/quicktime/formats/qtm-layout.txt
+				// some controller names are:
+				//   0x00 + 'std' for linear movie
+				//   'none' for no controls
+				$atom_structure['ctyp'] = substr($atom_data, 0, 4);
+				$info['quicktime']['controller'] = $atom_structure['ctyp'];
+				switch ($atom_structure['ctyp']) {
+					case 'qtvr':
+						$info['video']['dataformat'] = 'quicktimevr';
+						break;
+				}
+				break;
+
+			case 'pano': // PANOrama track (seen on QTVR)
+				$atom_structure['pano'] = getid3_lib::BigEndian2Int(substr($atom_data,  0, 4));
+				break;
+
+			case 'hint': // HINT track
+			case 'hinf': //
+			case 'hinv': //
+			case 'hnti': //
+				$info['quicktime']['hinting'] = true;
+				break;
+
+			case 'imgt': // IMaGe Track reference (kQTVRImageTrackRefType) (seen on QTVR)
+				for ($i = 0; $i < ($atom_structure['size'] - 8); $i += 4) {
+					$atom_structure['imgt'][] = getid3_lib::BigEndian2Int(substr($atom_data, $i, 4));
+				}
+				break;
+
+
+			// Observed-but-not-handled atom types are just listed here to prevent warnings being generated
+			case 'FXTC': // Something to do with Adobe After Effects (?)
+			case 'PrmA':
+			case 'code':
+			case 'FIEL': // this is NOT "fiel" (Field Ordering) as describe here: http://developer.apple.com/documentation/QuickTime/QTFF/QTFFChap3/chapter_4_section_2.html
+			case 'tapt': // TrackApertureModeDimensionsAID - http://developer.apple.com/documentation/QuickTime/Reference/QT7-1_Update_Reference/Constants/Constants.html
+						// tapt seems to be used to compute the video size [http://www.getid3.org/phpBB3/viewtopic.php?t=838]
+						// * http://lists.apple.com/archives/quicktime-api/2006/Aug/msg00014.html
+						// * http://handbrake.fr/irclogs/handbrake-dev/handbrake-dev20080128_pg2.html
+			case 'ctts'://  STCompositionOffsetAID             - http://developer.apple.com/documentation/QuickTime/Reference/QTRef_Constants/Reference/reference.html
+			case 'cslg'://  STCompositionShiftLeastGreatestAID - http://developer.apple.com/documentation/QuickTime/Reference/QTRef_Constants/Reference/reference.html
+			case 'sdtp'://  STSampleDependencyAID              - http://developer.apple.com/documentation/QuickTime/Reference/QTRef_Constants/Reference/reference.html
+			case 'stps'://  STPartialSyncSampleAID             - http://developer.apple.com/documentation/QuickTime/Reference/QTRef_Constants/Reference/reference.html
+				//$atom_structure['data'] = $atom_data;
+				break;
+
+			case '©xyz':  // GPS latitude+longitude+altitude
+				$atom_structure['data'] = $atom_data;
+				if (preg_match('#([\\+\\-][0-9\\.]+)([\\+\\-][0-9\\.]+)([\\+\\-][0-9\\.]+)?/$#i', $atom_data, $matches)) {
+					@list($all, $latitude, $longitude, $altitude) = $matches;
+					$info['quicktime']['comments']['gps_latitude'][]  = floatval($latitude);
+					$info['quicktime']['comments']['gps_longitude'][] = floatval($longitude);
+					if (!empty($altitude)) {
+						$info['quicktime']['comments']['gps_altitude'][] = floatval($altitude);
+					}
+				} else {
+					$info['warning'][] = 'QuickTime atom "©xyz" data does not match expected data pattern at offset '.$baseoffset.'. Please report as getID3() bug.';
+				}
+				break;
+
+			case 'NCDT':
+				// http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html
+				// Nikon-specific QuickTime tags found in the NCDT atom of MOV videos from some Nikon cameras such as the Coolpix S8000 and D5100
+				$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 4, $atomHierarchy, $ParseAllPossibleAtoms);
+				break;
+			case 'NCTH': // Nikon Camera THumbnail image
+			case 'NCVW': // Nikon Camera preVieW image
+				// http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html
+				if (preg_match('/^\xFF\xD8\xFF/', $atom_data)) {
+					$atom_structure['data'] = $atom_data;
+					$atom_structure['image_mime'] = 'image/jpeg';
+					$atom_structure['description'] = (($atomname == 'NCTH') ? 'Nikon Camera Thumbnail Image' : (($atomname == 'NCVW') ? 'Nikon Camera Preview Image' : 'Nikon preview image'));
+					$info['quicktime']['comments']['picture'][] = array('image_mime'=>$atom_structure['image_mime'], 'data'=>$atom_data, 'description'=>$atom_structure['description']);
+				}
+				break;
+			case 'NCHD': // MakerNoteVersion
+				// http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html
+				$atom_structure['data'] = $atom_data;
+				break;
+			case 'NCTG': // NikonTags
+				// http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html#NCTG
+				$atom_structure['data'] = $this->QuicktimeParseNikonNCTG($atom_data);
+				break;
+			case 'NCDB': // NikonTags
+				// http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html
+				$atom_structure['data'] = $atom_data;
+				break;
+
+			case "\x00\x00\x00\x00":
+			case 'meta': // METAdata atom
+				// some kind of metacontainer, may contain a big data dump such as:
+				// mdta keys  mdtacom.apple.quicktime.make (mdtacom.apple.quicktime.creationdate ,mdtacom.apple.quicktime.location.ISO6709 $mdtacom.apple.quicktime.software !mdtacom.apple.quicktime.model ilst 
+  data DEApple 0  (data DE2011-05-11T17:54:04+0200 2  *data DE+52.4936+013.3897+040.247/ 
+  data DE4.3.1  data DEiPhone 4
+				// http://www.geocities.com/xhelmboyx/quicktime/formats/qti-layout.txt
+
+	            $atom_structure['version']   =          getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
+	            $atom_structure['flags_raw'] =          getid3_lib::BigEndian2Int(substr($atom_data, 1, 3));
+	            $atom_structure['subatoms']  = $this->QuicktimeParseContainerAtom(substr($atom_data, 4), $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms);
+				//$atom_structure['subatoms']  = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms);
+				break;
+
+			case 'data': // metaDATA atom
+				// seems to be 2 bytes language code (ASCII), 2 bytes unknown (set to 0x10B5 in sample I have), remainder is useful data
+				$atom_structure['language'] =                           substr($atom_data, 4 + 0, 2);
+				$atom_structure['unknown']  = getid3_lib::BigEndian2Int(substr($atom_data, 4 + 2, 2));
+				$atom_structure['data']     =                           substr($atom_data, 4 + 4);
+				break;
+
+			default:
+				$info['warning'][] = 'Unknown QuickTime atom type: "'.$atomname.'" ('.trim(getid3_lib::PrintHexBytes($atomname)).') at offset '.$baseoffset;
+				$atom_structure['data'] = $atom_data;
+				break;
+		}
+		array_pop($atomHierarchy);
+		return $atom_structure;
+	}
+
+	public function QuicktimeParseContainerAtom($atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) {
+//echo 'QuicktimeParseContainerAtom('.substr($atom_data, 4, 4).') @ '.$baseoffset.'<br><br>';
+		$atom_structure  = false;
+		$subatomoffset  = 0;
+		$subatomcounter = 0;
+		if ((strlen($atom_data) == 4) && (getid3_lib::BigEndian2Int($atom_data) == 0x00000000)) {
+			return false;
+		}
+		while ($subatomoffset < strlen($atom_data)) {
+			$subatomsize = getid3_lib::BigEndian2Int(substr($atom_data, $subatomoffset + 0, 4));
+			$subatomname =                           substr($atom_data, $subatomoffset + 4, 4);
+			$subatomdata =                           substr($atom_data, $subatomoffset + 8, $subatomsize - 8);
+			if ($subatomsize == 0) {
+				// Furthermore, for historical reasons the list of atoms is optionally
+				// terminated by a 32-bit integer set to 0. If you are writing a program
+				// to read user data atoms, you should allow for the terminating 0.
+				return $atom_structure;
+			}
+
+			$atom_structure[$subatomcounter] = $this->QuicktimeParseAtom($subatomname, $subatomsize, $subatomdata, $baseoffset + $subatomoffset, $atomHierarchy, $ParseAllPossibleAtoms);
+
+			$subatomoffset += $subatomsize;
+			$subatomcounter++;
+		}
+		return $atom_structure;
+	}
+
+
+	public function quicktime_read_mp4_descr_length($data, &$offset) {
+		// http://libquicktime.sourcearchive.com/documentation/2:1.0.2plus-pdebian-2build1/esds_8c-source.html
+		$num_bytes = 0;
+		$length    = 0;
+		do {
+			$b = ord(substr($data, $offset++, 1));
+			$length = ($length << 7) | ($b & 0x7F);
+		} while (($b & 0x80) && ($num_bytes++ < 4));
+		return $length;
+	}
+
+
+	public function QuicktimeLanguageLookup($languageid) {
+		static $QuicktimeLanguageLookup = array();
+		if (empty($QuicktimeLanguageLookup)) {
+			$QuicktimeLanguageLookup[0]   = 'English';
+			$QuicktimeLanguageLookup[1]   = 'French';
+			$QuicktimeLanguageLookup[2]   = 'German';
+			$QuicktimeLanguageLookup[3]   = 'Italian';
+			$QuicktimeLanguageLookup[4]   = 'Dutch';
+			$QuicktimeLanguageLookup[5]   = 'Swedish';
+			$QuicktimeLanguageLookup[6]   = 'Spanish';
+			$QuicktimeLanguageLookup[7]   = 'Danish';
+			$QuicktimeLanguageLookup[8]   = 'Portuguese';
+			$QuicktimeLanguageLookup[9]   = 'Norwegian';
+			$QuicktimeLanguageLookup[10]  = 'Hebrew';
+			$QuicktimeLanguageLookup[11]  = 'Japanese';
+			$QuicktimeLanguageLookup[12]  = 'Arabic';
+			$QuicktimeLanguageLookup[13]  = 'Finnish';
+			$QuicktimeLanguageLookup[14]  = 'Greek';
+			$QuicktimeLanguageLookup[15]  = 'Icelandic';
+			$QuicktimeLanguageLookup[16]  = 'Maltese';
+			$QuicktimeLanguageLookup[17]  = 'Turkish';
+			$QuicktimeLanguageLookup[18]  = 'Croatian';
+			$QuicktimeLanguageLookup[19]  = 'Chinese (Traditional)';
+			$QuicktimeLanguageLookup[20]  = 'Urdu';
+			$QuicktimeLanguageLookup[21]  = 'Hindi';
+			$QuicktimeLanguageLookup[22]  = 'Thai';
+			$QuicktimeLanguageLookup[23]  = 'Korean';
+			$QuicktimeLanguageLookup[24]  = 'Lithuanian';
+			$QuicktimeLanguageLookup[25]  = 'Polish';
+			$QuicktimeLanguageLookup[26]  = 'Hungarian';
+			$QuicktimeLanguageLookup[27]  = 'Estonian';
+			$QuicktimeLanguageLookup[28]  = 'Lettish';
+			$QuicktimeLanguageLookup[28]  = 'Latvian';
+			$QuicktimeLanguageLookup[29]  = 'Saamisk';
+			$QuicktimeLanguageLookup[29]  = 'Lappish';
+			$QuicktimeLanguageLookup[30]  = 'Faeroese';
+			$QuicktimeLanguageLookup[31]  = 'Farsi';
+			$QuicktimeLanguageLookup[31]  = 'Persian';
+			$QuicktimeLanguageLookup[32]  = 'Russian';
+			$QuicktimeLanguageLookup[33]  = 'Chinese (Simplified)';
+			$QuicktimeLanguageLookup[34]  = 'Flemish';
+			$QuicktimeLanguageLookup[35]  = 'Irish';
+			$QuicktimeLanguageLookup[36]  = 'Albanian';
+			$QuicktimeLanguageLookup[37]  = 'Romanian';
+			$QuicktimeLanguageLookup[38]  = 'Czech';
+			$QuicktimeLanguageLookup[39]  = 'Slovak';
+			$QuicktimeLanguageLookup[40]  = 'Slovenian';
+			$QuicktimeLanguageLookup[41]  = 'Yiddish';
+			$QuicktimeLanguageLookup[42]  = 'Serbian';
+			$QuicktimeLanguageLookup[43]  = 'Macedonian';
+			$QuicktimeLanguageLookup[44]  = 'Bulgarian';
+			$QuicktimeLanguageLookup[45]  = 'Ukrainian';
+			$QuicktimeLanguageLookup[46]  = 'Byelorussian';
+			$QuicktimeLanguageLookup[47]  = 'Uzbek';
+			$QuicktimeLanguageLookup[48]  = 'Kazakh';
+			$QuicktimeLanguageLookup[49]  = 'Azerbaijani';
+			$QuicktimeLanguageLookup[50]  = 'AzerbaijanAr';
+			$QuicktimeLanguageLookup[51]  = 'Armenian';
+			$QuicktimeLanguageLookup[52]  = 'Georgian';
+			$QuicktimeLanguageLookup[53]  = 'Moldavian';
+			$QuicktimeLanguageLookup[54]  = 'Kirghiz';
+			$QuicktimeLanguageLookup[55]  = 'Tajiki';
+			$QuicktimeLanguageLookup[56]  = 'Turkmen';
+			$QuicktimeLanguageLookup[57]  = 'Mongolian';
+			$QuicktimeLanguageLookup[58]  = 'MongolianCyr';
+			$QuicktimeLanguageLookup[59]  = 'Pashto';
+			$QuicktimeLanguageLookup[60]  = 'Kurdish';
+			$QuicktimeLanguageLookup[61]  = 'Kashmiri';
+			$QuicktimeLanguageLookup[62]  = 'Sindhi';
+			$QuicktimeLanguageLookup[63]  = 'Tibetan';
+			$QuicktimeLanguageLookup[64]  = 'Nepali';
+			$QuicktimeLanguageLookup[65]  = 'Sanskrit';
+			$QuicktimeLanguageLookup[66]  = 'Marathi';
+			$QuicktimeLanguageLookup[67]  = 'Bengali';
+			$QuicktimeLanguageLookup[68]  = 'Assamese';
+			$QuicktimeLanguageLookup[69]  = 'Gujarati';
+			$QuicktimeLanguageLookup[70]  = 'Punjabi';
+			$QuicktimeLanguageLookup[71]  = 'Oriya';
+			$QuicktimeLanguageLookup[72]  = 'Malayalam';
+			$QuicktimeLanguageLookup[73]  = 'Kannada';
+			$QuicktimeLanguageLookup[74]  = 'Tamil';
+			$QuicktimeLanguageLookup[75]  = 'Telugu';
+			$QuicktimeLanguageLookup[76]  = 'Sinhalese';
+			$QuicktimeLanguageLookup[77]  = 'Burmese';
+			$QuicktimeLanguageLookup[78]  = 'Khmer';
+			$QuicktimeLanguageLookup[79]  = 'Lao';
+			$QuicktimeLanguageLookup[80]  = 'Vietnamese';
+			$QuicktimeLanguageLookup[81]  = 'Indonesian';
+			$QuicktimeLanguageLookup[82]  = 'Tagalog';
+			$QuicktimeLanguageLookup[83]  = 'MalayRoman';
+			$QuicktimeLanguageLookup[84]  = 'MalayArabic';
+			$QuicktimeLanguageLookup[85]  = 'Amharic';
+			$QuicktimeLanguageLookup[86]  = 'Tigrinya';
+			$QuicktimeLanguageLookup[87]  = 'Galla';
+			$QuicktimeLanguageLookup[87]  = 'Oromo';
+			$QuicktimeLanguageLookup[88]  = 'Somali';
+			$QuicktimeLanguageLookup[89]  = 'Swahili';
+			$QuicktimeLanguageLookup[90]  = 'Ruanda';
+			$QuicktimeLanguageLookup[91]  = 'Rundi';
+			$QuicktimeLanguageLookup[92]  = 'Chewa';
+			$QuicktimeLanguageLookup[93]  = 'Malagasy';
+			$QuicktimeLanguageLookup[94]  = 'Esperanto';
+			$QuicktimeLanguageLookup[128] = 'Welsh';
+			$QuicktimeLanguageLookup[129] = 'Basque';
+			$QuicktimeLanguageLookup[130] = 'Catalan';
+			$QuicktimeLanguageLookup[131] = 'Latin';
+			$QuicktimeLanguageLookup[132] = 'Quechua';
+			$QuicktimeLanguageLookup[133] = 'Guarani';
+			$QuicktimeLanguageLookup[134] = 'Aymara';
+			$QuicktimeLanguageLookup[135] = 'Tatar';
+			$QuicktimeLanguageLookup[136] = 'Uighur';
+			$QuicktimeLanguageLookup[137] = 'Dzongkha';
+			$QuicktimeLanguageLookup[138] = 'JavaneseRom';
+		}
+		return (isset($QuicktimeLanguageLookup[$languageid]) ? $QuicktimeLanguageLookup[$languageid] : 'invalid');
+	}
+
+	public function QuicktimeVideoCodecLookup($codecid) {
+		static $QuicktimeVideoCodecLookup = array();
+		if (empty($QuicktimeVideoCodecLookup)) {
+			$QuicktimeVideoCodecLookup['.SGI'] = 'SGI';
+			$QuicktimeVideoCodecLookup['3IV1'] = '3ivx MPEG-4 v1';
+			$QuicktimeVideoCodecLookup['3IV2'] = '3ivx MPEG-4 v2';
+			$QuicktimeVideoCodecLookup['3IVX'] = '3ivx MPEG-4';
+			$QuicktimeVideoCodecLookup['8BPS'] = 'Planar RGB';
+			$QuicktimeVideoCodecLookup['avc1'] = 'H.264/MPEG-4 AVC';
+			$QuicktimeVideoCodecLookup['avr '] = 'AVR-JPEG';
+			$QuicktimeVideoCodecLookup['b16g'] = '16Gray';
+			$QuicktimeVideoCodecLookup['b32a'] = '32AlphaGray';
+			$QuicktimeVideoCodecLookup['b48r'] = '48RGB';
+			$QuicktimeVideoCodecLookup['b64a'] = '64ARGB';
+			$QuicktimeVideoCodecLookup['base'] = 'Base';
+			$QuicktimeVideoCodecLookup['clou'] = 'Cloud';
+			$QuicktimeVideoCodecLookup['cmyk'] = 'CMYK';
+			$QuicktimeVideoCodecLookup['cvid'] = 'Cinepak';
+			$QuicktimeVideoCodecLookup['dmb1'] = 'OpenDML JPEG';
+			$QuicktimeVideoCodecLookup['dvc '] = 'DVC-NTSC';
+			$QuicktimeVideoCodecLookup['dvcp'] = 'DVC-PAL';
+			$QuicktimeVideoCodecLookup['dvpn'] = 'DVCPro-NTSC';
+			$QuicktimeVideoCodecLookup['dvpp'] = 'DVCPro-PAL';
+			$QuicktimeVideoCodecLookup['fire'] = 'Fire';
+			$QuicktimeVideoCodecLookup['flic'] = 'FLC';
+			$QuicktimeVideoCodecLookup['gif '] = 'GIF';
+			$QuicktimeVideoCodecLookup['h261'] = 'H261';
+			$QuicktimeVideoCodecLookup['h263'] = 'H263';
+			$QuicktimeVideoCodecLookup['IV41'] = 'Indeo4';
+			$QuicktimeVideoCodecLookup['jpeg'] = 'JPEG';
+			$QuicktimeVideoCodecLookup['kpcd'] = 'PhotoCD';
+			$QuicktimeVideoCodecLookup['mjpa'] = 'Motion JPEG-A';
+			$QuicktimeVideoCodecLookup['mjpb'] = 'Motion JPEG-B';
+			$QuicktimeVideoCodecLookup['msvc'] = 'Microsoft Video1';
+			$QuicktimeVideoCodecLookup['myuv'] = 'MPEG YUV420';
+			$QuicktimeVideoCodecLookup['path'] = 'Vector';
+			$QuicktimeVideoCodecLookup['png '] = 'PNG';
+			$QuicktimeVideoCodecLookup['PNTG'] = 'MacPaint';
+			$QuicktimeVideoCodecLookup['qdgx'] = 'QuickDrawGX';
+			$QuicktimeVideoCodecLookup['qdrw'] = 'QuickDraw';
+			$QuicktimeVideoCodecLookup['raw '] = 'RAW';
+			$QuicktimeVideoCodecLookup['ripl'] = 'WaterRipple';
+			$QuicktimeVideoCodecLookup['rpza'] = 'Video';
+			$QuicktimeVideoCodecLookup['smc '] = 'Graphics';
+			$QuicktimeVideoCodecLookup['SVQ1'] = 'Sorenson Video 1';
+			$QuicktimeVideoCodecLookup['SVQ1'] = 'Sorenson Video 3';
+			$QuicktimeVideoCodecLookup['syv9'] = 'Sorenson YUV9';
+			$QuicktimeVideoCodecLookup['tga '] = 'Targa';
+			$QuicktimeVideoCodecLookup['tiff'] = 'TIFF';
+			$QuicktimeVideoCodecLookup['WRAW'] = 'Windows RAW';
+			$QuicktimeVideoCodecLookup['WRLE'] = 'BMP';
+			$QuicktimeVideoCodecLookup['y420'] = 'YUV420';
+			$QuicktimeVideoCodecLookup['yuv2'] = 'ComponentVideo';
+			$QuicktimeVideoCodecLookup['yuvs'] = 'ComponentVideoUnsigned';
+			$QuicktimeVideoCodecLookup['yuvu'] = 'ComponentVideoSigned';
+		}
+		return (isset($QuicktimeVideoCodecLookup[$codecid]) ? $QuicktimeVideoCodecLookup[$codecid] : '');
+	}
+
+	public function QuicktimeAudioCodecLookup($codecid) {
+		static $QuicktimeAudioCodecLookup = array();
+		if (empty($QuicktimeAudioCodecLookup)) {
+			$QuicktimeAudioCodecLookup['.mp3']          = 'Fraunhofer MPEG Layer-III alias';
+			$QuicktimeAudioCodecLookup['aac ']          = 'ISO/IEC 14496-3 AAC';
+			$QuicktimeAudioCodecLookup['agsm']          = 'Apple GSM 10:1';
+			$QuicktimeAudioCodecLookup['alac']          = 'Apple Lossless Audio Codec';
+			$QuicktimeAudioCodecLookup['alaw']          = 'A-law 2:1';
+			$QuicktimeAudioCodecLookup['conv']          = 'Sample Format';
+			$QuicktimeAudioCodecLookup['dvca']          = 'DV';
+			$QuicktimeAudioCodecLookup['dvi ']          = 'DV 4:1';
+			$QuicktimeAudioCodecLookup['eqal']          = 'Frequency Equalizer';
+			$QuicktimeAudioCodecLookup['fl32']          = '32-bit Floating Point';
+			$QuicktimeAudioCodecLookup['fl64']          = '64-bit Floating Point';
+			$QuicktimeAudioCodecLookup['ima4']          = 'Interactive Multimedia Association 4:1';
+			$QuicktimeAudioCodecLookup['in24']          = '24-bit Integer';
+			$QuicktimeAudioCodecLookup['in32']          = '32-bit Integer';
+			$QuicktimeAudioCodecLookup['lpc ']          = 'LPC 23:1';
+			$QuicktimeAudioCodecLookup['MAC3']          = 'Macintosh Audio Compression/Expansion (MACE) 3:1';
+			$QuicktimeAudioCodecLookup['MAC6']          = 'Macintosh Audio Compression/Expansion (MACE) 6:1';
+			$QuicktimeAudioCodecLookup['mixb']          = '8-bit Mixer';
+			$QuicktimeAudioCodecLookup['mixw']          = '16-bit Mixer';
+			$QuicktimeAudioCodecLookup['mp4a']          = 'ISO/IEC 14496-3 AAC';
+			$QuicktimeAudioCodecLookup['MS'."\x00\x02"] = 'Microsoft ADPCM';
+			$QuicktimeAudioCodecLookup['MS'."\x00\x11"] = 'DV IMA';
+			$QuicktimeAudioCodecLookup['MS'."\x00\x55"] = 'Fraunhofer MPEG Layer III';
+			$QuicktimeAudioCodecLookup['NONE']          = 'No Encoding';
+			$QuicktimeAudioCodecLookup['Qclp']          = 'Qualcomm PureVoice';
+			$QuicktimeAudioCodecLookup['QDM2']          = 'QDesign Music 2';
+			$QuicktimeAudioCodecLookup['QDMC']          = 'QDesign Music 1';
+			$QuicktimeAudioCodecLookup['ratb']          = '8-bit Rate';
+			$QuicktimeAudioCodecLookup['ratw']          = '16-bit Rate';
+			$QuicktimeAudioCodecLookup['raw ']          = 'raw PCM';
+			$QuicktimeAudioCodecLookup['sour']          = 'Sound Source';
+			$QuicktimeAudioCodecLookup['sowt']          = 'signed/two\'s complement (Little Endian)';
+			$QuicktimeAudioCodecLookup['str1']          = 'Iomega MPEG layer II';
+			$QuicktimeAudioCodecLookup['str2']          = 'Iomega MPEG *layer II';
+			$QuicktimeAudioCodecLookup['str3']          = 'Iomega MPEG **layer II';
+			$QuicktimeAudioCodecLookup['str4']          = 'Iomega MPEG ***layer II';
+			$QuicktimeAudioCodecLookup['twos']          = 'signed/two\'s complement (Big Endian)';
+			$QuicktimeAudioCodecLookup['ulaw']          = 'mu-law 2:1';
+		}
+		return (isset($QuicktimeAudioCodecLookup[$codecid]) ? $QuicktimeAudioCodecLookup[$codecid] : '');
+	}
+
+	public function QuicktimeDCOMLookup($compressionid) {
+		static $QuicktimeDCOMLookup = array();
+		if (empty($QuicktimeDCOMLookup)) {
+			$QuicktimeDCOMLookup['zlib'] = 'ZLib Deflate';
+			$QuicktimeDCOMLookup['adec'] = 'Apple Compression';
+		}
+		return (isset($QuicktimeDCOMLookup[$compressionid]) ? $QuicktimeDCOMLookup[$compressionid] : '');
+	}
+
+	public function QuicktimeColorNameLookup($colordepthid) {
+		static $QuicktimeColorNameLookup = array();
+		if (empty($QuicktimeColorNameLookup)) {
+			$QuicktimeColorNameLookup[1]  = '2-color (monochrome)';
+			$QuicktimeColorNameLookup[2]  = '4-color';
+			$QuicktimeColorNameLookup[4]  = '16-color';
+			$QuicktimeColorNameLookup[8]  = '256-color';
+			$QuicktimeColorNameLookup[16] = 'thousands (16-bit color)';
+			$QuicktimeColorNameLookup[24] = 'millions (24-bit color)';
+			$QuicktimeColorNameLookup[32] = 'millions+ (32-bit color)';
+			$QuicktimeColorNameLookup[33] = 'black & white';
+			$QuicktimeColorNameLookup[34] = '4-gray';
+			$QuicktimeColorNameLookup[36] = '16-gray';
+			$QuicktimeColorNameLookup[40] = '256-gray';
+		}
+		return (isset($QuicktimeColorNameLookup[$colordepthid]) ? $QuicktimeColorNameLookup[$colordepthid] : 'invalid');
+	}
+
+	public function QuicktimeSTIKLookup($stik) {
+		static $QuicktimeSTIKLookup = array();
+		if (empty($QuicktimeSTIKLookup)) {
+			$QuicktimeSTIKLookup[0]  = 'Movie';
+			$QuicktimeSTIKLookup[1]  = 'Normal';
+			$QuicktimeSTIKLookup[2]  = 'Audiobook';
+			$QuicktimeSTIKLookup[5]  = 'Whacked Bookmark';
+			$QuicktimeSTIKLookup[6]  = 'Music Video';
+			$QuicktimeSTIKLookup[9]  = 'Short Film';
+			$QuicktimeSTIKLookup[10] = 'TV Show';
+			$QuicktimeSTIKLookup[11] = 'Booklet';
+			$QuicktimeSTIKLookup[14] = 'Ringtone';
+			$QuicktimeSTIKLookup[21] = 'Podcast';
+		}
+		return (isset($QuicktimeSTIKLookup[$stik]) ? $QuicktimeSTIKLookup[$stik] : 'invalid');
+	}
+
+	public function QuicktimeIODSaudioProfileName($audio_profile_id) {
+		static $QuicktimeIODSaudioProfileNameLookup = array();
+		if (empty($QuicktimeIODSaudioProfileNameLookup)) {
+			$QuicktimeIODSaudioProfileNameLookup = array(
+			    0x00 => 'ISO Reserved (0x00)',
+			    0x01 => 'Main Audio Profile @ Level 1',
+			    0x02 => 'Main Audio Profile @ Level 2',
+			    0x03 => 'Main Audio Profile @ Level 3',
+			    0x04 => 'Main Audio Profile @ Level 4',
+			    0x05 => 'Scalable Audio Profile @ Level 1',
+			    0x06 => 'Scalable Audio Profile @ Level 2',
+			    0x07 => 'Scalable Audio Profile @ Level 3',
+			    0x08 => 'Scalable Audio Profile @ Level 4',
+			    0x09 => 'Speech Audio Profile @ Level 1',
+			    0x0A => 'Speech Audio Profile @ Level 2',
+			    0x0B => 'Synthetic Audio Profile @ Level 1',
+			    0x0C => 'Synthetic Audio Profile @ Level 2',
+			    0x0D => 'Synthetic Audio Profile @ Level 3',
+			    0x0E => 'High Quality Audio Profile @ Level 1',
+			    0x0F => 'High Quality Audio Profile @ Level 2',
+			    0x10 => 'High Quality Audio Profile @ Level 3',
+			    0x11 => 'High Quality Audio Profile @ Level 4',
+			    0x12 => 'High Quality Audio Profile @ Level 5',
+			    0x13 => 'High Quality Audio Profile @ Level 6',
+			    0x14 => 'High Quality Audio Profile @ Level 7',
+			    0x15 => 'High Quality Audio Profile @ Level 8',
+			    0x16 => 'Low Delay Audio Profile @ Level 1',
+			    0x17 => 'Low Delay Audio Profile @ Level 2',
+			    0x18 => 'Low Delay Audio Profile @ Level 3',
+			    0x19 => 'Low Delay Audio Profile @ Level 4',
+			    0x1A => 'Low Delay Audio Profile @ Level 5',
+			    0x1B => 'Low Delay Audio Profile @ Level 6',
+			    0x1C => 'Low Delay Audio Profile @ Level 7',
+			    0x1D => 'Low Delay Audio Profile @ Level 8',
+			    0x1E => 'Natural Audio Profile @ Level 1',
+			    0x1F => 'Natural Audio Profile @ Level 2',
+			    0x20 => 'Natural Audio Profile @ Level 3',
+			    0x21 => 'Natural Audio Profile @ Level 4',
+			    0x22 => 'Mobile Audio Internetworking Profile @ Level 1',
+			    0x23 => 'Mobile Audio Internetworking Profile @ Level 2',
+			    0x24 => 'Mobile Audio Internetworking Profile @ Level 3',
+			    0x25 => 'Mobile Audio Internetworking Profile @ Level 4',
+			    0x26 => 'Mobile Audio Internetworking Profile @ Level 5',
+			    0x27 => 'Mobile Audio Internetworking Profile @ Level 6',
+			    0x28 => 'AAC Profile @ Level 1',
+			    0x29 => 'AAC Profile @ Level 2',
+			    0x2A => 'AAC Profile @ Level 4',
+			    0x2B => 'AAC Profile @ Level 5',
+			    0x2C => 'High Efficiency AAC Profile @ Level 2',
+			    0x2D => 'High Efficiency AAC Profile @ Level 3',
+			    0x2E => 'High Efficiency AAC Profile @ Level 4',
+			    0x2F => 'High Efficiency AAC Profile @ Level 5',
+			    0xFE => 'Not part of MPEG-4 audio profiles',
+			    0xFF => 'No audio capability required',
+			);
+		}
+		return (isset($QuicktimeIODSaudioProfileNameLookup[$audio_profile_id]) ? $QuicktimeIODSaudioProfileNameLookup[$audio_profile_id] : 'ISO Reserved / User Private');
+	}
+
+
+	public function QuicktimeIODSvideoProfileName($video_profile_id) {
+		static $QuicktimeIODSvideoProfileNameLookup = array();
+		if (empty($QuicktimeIODSvideoProfileNameLookup)) {
+			$QuicktimeIODSvideoProfileNameLookup = array(
+				0x00 => 'Reserved (0x00) Profile',
+				0x01 => 'Simple Profile @ Level 1',
+				0x02 => 'Simple Profile @ Level 2',
+				0x03 => 'Simple Profile @ Level 3',
+				0x08 => 'Simple Profile @ Level 0',
+				0x10 => 'Simple Scalable Profile @ Level 0',
+				0x11 => 'Simple Scalable Profile @ Level 1',
+				0x12 => 'Simple Scalable Profile @ Level 2',
+				0x15 => 'AVC/H264 Profile',
+				0x21 => 'Core Profile @ Level 1',
+				0x22 => 'Core Profile @ Level 2',
+				0x32 => 'Main Profile @ Level 2',
+				0x33 => 'Main Profile @ Level 3',
+				0x34 => 'Main Profile @ Level 4',
+				0x42 => 'N-bit Profile @ Level 2',
+				0x51 => 'Scalable Texture Profile @ Level 1',
+				0x61 => 'Simple Face Animation Profile @ Level 1',
+				0x62 => 'Simple Face Animation Profile @ Level 2',
+				0x63 => 'Simple FBA Profile @ Level 1',
+				0x64 => 'Simple FBA Profile @ Level 2',
+				0x71 => 'Basic Animated Texture Profile @ Level 1',
+				0x72 => 'Basic Animated Texture Profile @ Level 2',
+				0x81 => 'Hybrid Profile @ Level 1',
+				0x82 => 'Hybrid Profile @ Level 2',
+				0x91 => 'Advanced Real Time Simple Profile @ Level 1',
+				0x92 => 'Advanced Real Time Simple Profile @ Level 2',
+				0x93 => 'Advanced Real Time Simple Profile @ Level 3',
+				0x94 => 'Advanced Real Time Simple Profile @ Level 4',
+				0xA1 => 'Core Scalable Profile @ Level1',
+				0xA2 => 'Core Scalable Profile @ Level2',
+				0xA3 => 'Core Scalable Profile @ Level3',
+				0xB1 => 'Advanced Coding Efficiency Profile @ Level 1',
+				0xB2 => 'Advanced Coding Efficiency Profile @ Level 2',
+				0xB3 => 'Advanced Coding Efficiency Profile @ Level 3',
+				0xB4 => 'Advanced Coding Efficiency Profile @ Level 4',
+				0xC1 => 'Advanced Core Profile @ Level 1',
+				0xC2 => 'Advanced Core Profile @ Level 2',
+				0xD1 => 'Advanced Scalable Texture @ Level1',
+				0xD2 => 'Advanced Scalable Texture @ Level2',
+				0xE1 => 'Simple Studio Profile @ Level 1',
+				0xE2 => 'Simple Studio Profile @ Level 2',
+				0xE3 => 'Simple Studio Profile @ Level 3',
+				0xE4 => 'Simple Studio Profile @ Level 4',
+				0xE5 => 'Core Studio Profile @ Level 1',
+				0xE6 => 'Core Studio Profile @ Level 2',
+				0xE7 => 'Core Studio Profile @ Level 3',
+				0xE8 => 'Core Studio Profile @ Level 4',
+				0xF0 => 'Advanced Simple Profile @ Level 0',
+				0xF1 => 'Advanced Simple Profile @ Level 1',
+				0xF2 => 'Advanced Simple Profile @ Level 2',
+				0xF3 => 'Advanced Simple Profile @ Level 3',
+				0xF4 => 'Advanced Simple Profile @ Level 4',
+				0xF5 => 'Advanced Simple Profile @ Level 5',
+				0xF7 => 'Advanced Simple Profile @ Level 3b',
+				0xF8 => 'Fine Granularity Scalable Profile @ Level 0',
+				0xF9 => 'Fine Granularity Scalable Profile @ Level 1',
+				0xFA => 'Fine Granularity Scalable Profile @ Level 2',
+				0xFB => 'Fine Granularity Scalable Profile @ Level 3',
+				0xFC => 'Fine Granularity Scalable Profile @ Level 4',
+				0xFD => 'Fine Granularity Scalable Profile @ Level 5',
+				0xFE => 'Not part of MPEG-4 Visual profiles',
+				0xFF => 'No visual capability required',
+			);
+		}
+		return (isset($QuicktimeIODSvideoProfileNameLookup[$video_profile_id]) ? $QuicktimeIODSvideoProfileNameLookup[$video_profile_id] : 'ISO Reserved Profile');
+	}
+
+
+	public function QuicktimeContentRatingLookup($rtng) {
+		static $QuicktimeContentRatingLookup = array();
+		if (empty($QuicktimeContentRatingLookup)) {
+			$QuicktimeContentRatingLookup[0]  = 'None';
+			$QuicktimeContentRatingLookup[2]  = 'Clean';
+			$QuicktimeContentRatingLookup[4]  = 'Explicit';
+		}
+		return (isset($QuicktimeContentRatingLookup[$rtng]) ? $QuicktimeContentRatingLookup[$rtng] : 'invalid');
+	}
+
+	public function QuicktimeStoreAccountTypeLookup($akid) {
+		static $QuicktimeStoreAccountTypeLookup = array();
+		if (empty($QuicktimeStoreAccountTypeLookup)) {
+			$QuicktimeStoreAccountTypeLookup[0] = 'iTunes';
+			$QuicktimeStoreAccountTypeLookup[1] = 'AOL';
+		}
+		return (isset($QuicktimeStoreAccountTypeLookup[$akid]) ? $QuicktimeStoreAccountTypeLookup[$akid] : 'invalid');
+	}
+
+	public function QuicktimeStoreFrontCodeLookup($sfid) {
+		static $QuicktimeStoreFrontCodeLookup = array();
+		if (empty($QuicktimeStoreFrontCodeLookup)) {
+			$QuicktimeStoreFrontCodeLookup[143460] = 'Australia';
+			$QuicktimeStoreFrontCodeLookup[143445] = 'Austria';
+			$QuicktimeStoreFrontCodeLookup[143446] = 'Belgium';
+			$QuicktimeStoreFrontCodeLookup[143455] = 'Canada';
+			$QuicktimeStoreFrontCodeLookup[143458] = 'Denmark';
+			$QuicktimeStoreFrontCodeLookup[143447] = 'Finland';
+			$QuicktimeStoreFrontCodeLookup[143442] = 'France';
+			$QuicktimeStoreFrontCodeLookup[143443] = 'Germany';
+			$QuicktimeStoreFrontCodeLookup[143448] = 'Greece';
+			$QuicktimeStoreFrontCodeLookup[143449] = 'Ireland';
+			$QuicktimeStoreFrontCodeLookup[143450] = 'Italy';
+			$QuicktimeStoreFrontCodeLookup[143462] = 'Japan';
+			$QuicktimeStoreFrontCodeLookup[143451] = 'Luxembourg';
+			$QuicktimeStoreFrontCodeLookup[143452] = 'Netherlands';
+			$QuicktimeStoreFrontCodeLookup[143461] = 'New Zealand';
+			$QuicktimeStoreFrontCodeLookup[143457] = 'Norway';
+			$QuicktimeStoreFrontCodeLookup[143453] = 'Portugal';
+			$QuicktimeStoreFrontCodeLookup[143454] = 'Spain';
+			$QuicktimeStoreFrontCodeLookup[143456] = 'Sweden';
+			$QuicktimeStoreFrontCodeLookup[143459] = 'Switzerland';
+			$QuicktimeStoreFrontCodeLookup[143444] = 'United Kingdom';
+			$QuicktimeStoreFrontCodeLookup[143441] = 'United States';
+		}
+		return (isset($QuicktimeStoreFrontCodeLookup[$sfid]) ? $QuicktimeStoreFrontCodeLookup[$sfid] : 'invalid');
+	}
+
+	public function QuicktimeParseNikonNCTG($atom_data) {
+		// http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html#NCTG
+		// Nikon-specific QuickTime tags found in the NCDT atom of MOV videos from some Nikon cameras such as the Coolpix S8000 and D5100
+		// Data is stored as records of:
+		// * 4 bytes record type
+		// * 2 bytes size of data field type:
+		//     0x0001 = flag   (size field *= 1-byte)
+		//     0x0002 = char   (size field *= 1-byte)
+		//     0x0003 = DWORD+ (size field *= 2-byte), values are stored CDAB
+		//     0x0004 = QWORD+ (size field *= 4-byte), values are stored EFGHABCD
+		//     0x0005 = float  (size field *= 8-byte), values are stored aaaabbbb where value is aaaa/bbbb; possibly multiple sets of values appended together
+		//     0x0007 = bytes  (size field *= 1-byte), values are stored as ??????
+		//     0x0008 = ?????  (size field *= 2-byte), values are stored as ??????
+		// * 2 bytes data size field
+		// * ? bytes data (string data may be null-padded; datestamp fields are in the format "2011:05:25 20:24:15")
+		// all integers are stored BigEndian
+
+		$NCTGtagName = array(
+			0x00000001 => 'Make',
+			0x00000002 => 'Model',
+			0x00000003 => 'Software',
+			0x00000011 => 'CreateDate',
+			0x00000012 => 'DateTimeOriginal',
+			0x00000013 => 'FrameCount',
+			0x00000016 => 'FrameRate',
+			0x00000022 => 'FrameWidth',
+			0x00000023 => 'FrameHeight',
+			0x00000032 => 'AudioChannels',
+			0x00000033 => 'AudioBitsPerSample',
+			0x00000034 => 'AudioSampleRate',
+			0x02000001 => 'MakerNoteVersion',
+			0x02000005 => 'WhiteBalance',
+			0x0200000b => 'WhiteBalanceFineTune',
+			0x0200001e => 'ColorSpace',
+			0x02000023 => 'PictureControlData',
+			0x02000024 => 'WorldTime',
+			0x02000032 => 'UnknownInfo',
+			0x02000083 => 'LensType',
+			0x02000084 => 'Lens',
+		);
+
+		$offset = 0;
+		$datalength = strlen($atom_data);
+		$parsed = array();
+		while ($offset < $datalength) {
+//echo getid3_lib::PrintHexBytes(substr($atom_data, $offset, 4)).'<br>';
+			$record_type       = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 4));  $offset += 4;
+			$data_size_type    = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2));  $offset += 2;
+			$data_size         = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2));  $offset += 2;
+			switch ($data_size_type) {
+				case 0x0001: // 0x0001 = flag   (size field *= 1-byte)
+					$data = getid3_lib::BigEndian2Int(substr($atom_data, $offset, $data_size * 1));
+					$offset += ($data_size * 1);
+					break;
+				case 0x0002: // 0x0002 = char   (size field *= 1-byte)
+					$data = substr($atom_data, $offset, $data_size * 1);
+					$offset += ($data_size * 1);
+					$data = rtrim($data, "\x00");
+					break;
+				case 0x0003: // 0x0003 = DWORD+ (size field *= 2-byte), values are stored CDAB
+					$data = '';
+					for ($i = $data_size - 1; $i >= 0; $i--) {
+						$data .= substr($atom_data, $offset + ($i * 2), 2);
+					}
+					$data = getid3_lib::BigEndian2Int($data);
+					$offset += ($data_size * 2);
+					break;
+				case 0x0004: // 0x0004 = QWORD+ (size field *= 4-byte), values are stored EFGHABCD
+					$data = '';
+					for ($i = $data_size - 1; $i >= 0; $i--) {
+						$data .= substr($atom_data, $offset + ($i * 4), 4);
+					}
+					$data = getid3_lib::BigEndian2Int($data);
+					$offset += ($data_size * 4);
+					break;
+				case 0x0005: // 0x0005 = float  (size field *= 8-byte), values are stored aaaabbbb where value is aaaa/bbbb; possibly multiple sets of values appended together
+					$data = array();
+					for ($i = 0; $i < $data_size; $i++) {
+						$numerator    = getid3_lib::BigEndian2Int(substr($atom_data, $offset + ($i * 8) + 0, 4));
+						$denomninator = getid3_lib::BigEndian2Int(substr($atom_data, $offset + ($i * 8) + 4, 4));
+						if ($denomninator == 0) {
+							$data[$i] = false;
+						} else {
+							$data[$i] = (double) $numerator / $denomninator;
+						}
+					}
+					$offset += (8 * $data_size);
+					if (count($data) == 1) {
+						$data = $data[0];
+					}
+					break;
+				case 0x0007: // 0x0007 = bytes  (size field *= 1-byte), values are stored as ??????
+					$data = substr($atom_data, $offset, $data_size * 1);
+					$offset += ($data_size * 1);
+					break;
+				case 0x0008: // 0x0008 = ?????  (size field *= 2-byte), values are stored as ??????
+					$data = substr($atom_data, $offset, $data_size * 2);
+					$offset += ($data_size * 2);
+					break;
+				default:
+echo 'QuicktimeParseNikonNCTG()::unknown $data_size_type: '.$data_size_type.'<br>';
+					break 2;
+			}
+
+			switch ($record_type) {
+				case 0x00000011: // CreateDate
+				case 0x00000012: // DateTimeOriginal
+					$data = strtotime($data);
+					break;
+				case 0x0200001e: // ColorSpace
+					switch ($data) {
+						case 1:
+							$data = 'sRGB';
+							break;
+						case 2:
+							$data = 'Adobe RGB';
+							break;
+					}
+					break;
+				case 0x02000023: // PictureControlData
+					$PictureControlAdjust = array(0=>'default', 1=>'quick', 2=>'full');
+					$FilterEffect = array(0x80=>'off', 0x81=>'yellow', 0x82=>'orange',    0x83=>'red', 0x84=>'green',  0xff=>'n/a');
+					$ToningEffect = array(0x80=>'b&w', 0x81=>'sepia',  0x82=>'cyanotype', 0x83=>'red', 0x84=>'yellow', 0x85=>'green', 0x86=>'blue-green', 0x87=>'blue', 0x88=>'purple-blue', 0x89=>'red-purple', 0xff=>'n/a');
+					$data = array(
+						'PictureControlVersion'     =>                           substr($data,  0,  4),
+						'PictureControlName'        =>                     rtrim(substr($data,  4, 20), "\x00"),
+						'PictureControlBase'        =>                     rtrim(substr($data, 24, 20), "\x00"),
+						//'?'                       =>                           substr($data, 44,  4),
+						'PictureControlAdjust'      => $PictureControlAdjust[ord(substr($data, 48,  1))],
+						'PictureControlQuickAdjust' =>                       ord(substr($data, 49,  1)),
+						'Sharpness'                 =>                       ord(substr($data, 50,  1)),
+						'Contrast'                  =>                       ord(substr($data, 51,  1)),
+						'Brightness'                =>                       ord(substr($data, 52,  1)),
+						'Saturation'                =>                       ord(substr($data, 53,  1)),
+						'HueAdjustment'             =>                       ord(substr($data, 54,  1)),
+						'FilterEffect'              =>         $FilterEffect[ord(substr($data, 55,  1))],
+						'ToningEffect'              =>         $ToningEffect[ord(substr($data, 56,  1))],
+						'ToningSaturation'          =>                       ord(substr($data, 57,  1)),
+					);
+					break;
+				case 0x02000024: // WorldTime
+					// http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html#WorldTime
+					// timezone is stored as offset from GMT in minutes
+					$timezone = getid3_lib::BigEndian2Int(substr($data, 0, 2));
+					if ($timezone & 0x8000) {
+						$timezone = 0 - (0x10000 - $timezone);
+					}
+					$timezone /= 60;
+
+					$dst = (bool) getid3_lib::BigEndian2Int(substr($data, 2, 1));
+					switch (getid3_lib::BigEndian2Int(substr($data, 3, 1))) {
+						case 2:
+							$datedisplayformat = 'D/M/Y'; break;
+						case 1:
+							$datedisplayformat = 'M/D/Y'; break;
+						case 0:
+						default:
+							$datedisplayformat = 'Y/M/D'; break;
+					}
+
+					$data = array('timezone'=>floatval($timezone), 'dst'=>$dst, 'display'=>$datedisplayformat);
+					break;
+				case 0x02000083: // LensType
+					$data = array(
+						//'_'  => $data,
+						'mf' => (bool) ($data & 0x01),
+						'd'  => (bool) ($data & 0x02),
+						'g'  => (bool) ($data & 0x04),
+						'vr' => (bool) ($data & 0x08),
+					);
+					break;
+			}
+			$tag_name = (isset($NCTGtagName[$record_type]) ? $NCTGtagName[$record_type] : '0x'.str_pad(dechex($record_type), 8, '0', STR_PAD_LEFT));
+			$parsed[$tag_name] = $data;
+		}
+		return $parsed;
+	}
+
+
+	public function CopyToAppropriateCommentsSection($keyname, $data, $boxname='') {
+		static $handyatomtranslatorarray = array();
+		if (empty($handyatomtranslatorarray)) {
+			$handyatomtranslatorarray['©cpy'] = 'copyright';
+			$handyatomtranslatorarray['©day'] = 'creation_date';    // iTunes 4.0
+			$handyatomtranslatorarray['©dir'] = 'director';
+			$handyatomtranslatorarray['©ed1'] = 'edit1';
+			$handyatomtranslatorarray['©ed2'] = 'edit2';
+			$handyatomtranslatorarray['©ed3'] = 'edit3';
+			$handyatomtranslatorarray['©ed4'] = 'edit4';
+			$handyatomtranslatorarray['©ed5'] = 'edit5';
+			$handyatomtranslatorarray['©ed6'] = 'edit6';
+			$handyatomtranslatorarray['©ed7'] = 'edit7';
+			$handyatomtranslatorarray['©ed8'] = 'edit8';
+			$handyatomtranslatorarray['©ed9'] = 'edit9';
+			$handyatomtranslatorarray['©fmt'] = 'format';
+			$handyatomtranslatorarray['©inf'] = 'information';
+			$handyatomtranslatorarray['©prd'] = 'producer';
+			$handyatomtranslatorarray['©prf'] = 'performers';
+			$handyatomtranslatorarray['©req'] = 'system_requirements';
+			$handyatomtranslatorarray['©src'] = 'source_credit';
+			$handyatomtranslatorarray['©wrt'] = 'writer';
+
+			// http://www.geocities.com/xhelmboyx/quicktime/formats/qtm-layout.txt
+			$handyatomtranslatorarray['©nam'] = 'title';           // iTunes 4.0
+			$handyatomtranslatorarray['©cmt'] = 'comment';         // iTunes 4.0
+			$handyatomtranslatorarray['©wrn'] = 'warning';
+			$handyatomtranslatorarray['©hst'] = 'host_computer';
+			$handyatomtranslatorarray['©mak'] = 'make';
+			$handyatomtranslatorarray['©mod'] = 'model';
+			$handyatomtranslatorarray['©PRD'] = 'product';
+			$handyatomtranslatorarray['©swr'] = 'software';
+			$handyatomtranslatorarray['©aut'] = 'author';
+			$handyatomtranslatorarray['©ART'] = 'artist';
+			$handyatomtranslatorarray['©trk'] = 'track';
+			$handyatomtranslatorarray['©alb'] = 'album';           // iTunes 4.0
+			$handyatomtranslatorarray['©com'] = 'comment';
+			$handyatomtranslatorarray['©gen'] = 'genre';           // iTunes 4.0
+			$handyatomtranslatorarray['©ope'] = 'composer';
+			$handyatomtranslatorarray['©url'] = 'url';
+			$handyatomtranslatorarray['©enc'] = 'encoder';
+
+			// http://atomicparsley.sourceforge.net/mpeg-4files.html
+			$handyatomtranslatorarray['©art'] = 'artist';           // iTunes 4.0
+			$handyatomtranslatorarray['aART'] = 'album_artist';
+			$handyatomtranslatorarray['trkn'] = 'track_number';     // iTunes 4.0
+			$handyatomtranslatorarray['disk'] = 'disc_number';      // iTunes 4.0
+			$handyatomtranslatorarray['gnre'] = 'genre';            // iTunes 4.0
+			$handyatomtranslatorarray['©too'] = 'encoder';          // iTunes 4.0
+			$handyatomtranslatorarray['tmpo'] = 'bpm';              // iTunes 4.0
+			$handyatomtranslatorarray['cprt'] = 'copyright';        // iTunes 4.0?
+			$handyatomtranslatorarray['cpil'] = 'compilation';      // iTunes 4.0
+			$handyatomtranslatorarray['covr'] = 'picture';          // iTunes 4.0
+			$handyatomtranslatorarray['rtng'] = 'rating';           // iTunes 4.0
+			$handyatomtranslatorarray['©grp'] = 'grouping';         // iTunes 4.2
+			$handyatomtranslatorarray['stik'] = 'stik';             // iTunes 4.9
+			$handyatomtranslatorarray['pcst'] = 'podcast';          // iTunes 4.9
+			$handyatomtranslatorarray['catg'] = 'category';         // iTunes 4.9
+			$handyatomtranslatorarray['keyw'] = 'keyword';          // iTunes 4.9
+			$handyatomtranslatorarray['purl'] = 'podcast_url';      // iTunes 4.9
+			$handyatomtranslatorarray['egid'] = 'episode_guid';     // iTunes 4.9
+			$handyatomtranslatorarray['desc'] = 'description';      // iTunes 5.0
+			$handyatomtranslatorarray['©lyr'] = 'lyrics';           // iTunes 5.0
+			$handyatomtranslatorarray['tvnn'] = 'tv_network_name';  // iTunes 6.0
+			$handyatomtranslatorarray['tvsh'] = 'tv_show_name';     // iTunes 6.0
+			$handyatomtranslatorarray['tvsn'] = 'tv_season';        // iTunes 6.0
+			$handyatomtranslatorarray['tves'] = 'tv_episode';       // iTunes 6.0
+			$handyatomtranslatorarray['purd'] = 'purchase_date';    // iTunes 6.0.2
+			$handyatomtranslatorarray['pgap'] = 'gapless_playback'; // iTunes 7.0
+
+			// http://www.geocities.com/xhelmboyx/quicktime/formats/mp4-layout.txt
+
+
+
+			// boxnames:
+			/*
+			$handyatomtranslatorarray['iTunSMPB']                    = 'iTunSMPB';
+			$handyatomtranslatorarray['iTunNORM']                    = 'iTunNORM';
+			$handyatomtranslatorarray['Encoding Params']             = 'Encoding Params';
+			$handyatomtranslatorarray['replaygain_track_gain']       = 'replaygain_track_gain';
+			$handyatomtranslatorarray['replaygain_track_peak']       = 'replaygain_track_peak';
+			$handyatomtranslatorarray['replaygain_track_minmax']     = 'replaygain_track_minmax';
+			$handyatomtranslatorarray['MusicIP PUID']                = 'MusicIP PUID';
+			$handyatomtranslatorarray['MusicBrainz Artist Id']       = 'MusicBrainz Artist Id';
+			$handyatomtranslatorarray['MusicBrainz Album Id']        = 'MusicBrainz Album Id';
+			$handyatomtranslatorarray['MusicBrainz Album Artist Id'] = 'MusicBrainz Album Artist Id';
+			$handyatomtranslatorarray['MusicBrainz Track Id']        = 'MusicBrainz Track Id';
+			$handyatomtranslatorarray['MusicBrainz Disc Id']         = 'MusicBrainz Disc Id';
+
+			// http://age.hobba.nl/audio/tag_frame_reference.html
+			$handyatomtranslatorarray['PLAY_COUNTER']                = 'play_counter'; // Foobar2000 - http://www.getid3.org/phpBB3/viewtopic.php?t=1355
+			$handyatomtranslatorarray['MEDIATYPE']                   = 'mediatype';    // Foobar2000 - http://www.getid3.org/phpBB3/viewtopic.php?t=1355
+			*/
+		}
+		$info = &$this->getid3->info;
+		$comment_key = '';
+		if ($boxname && ($boxname != $keyname)) {
+			$comment_key = (isset($handyatomtranslatorarray[$boxname]) ? $handyatomtranslatorarray[$boxname] : $boxname);
+		} elseif (isset($handyatomtranslatorarray[$keyname])) {
+			$comment_key = $handyatomtranslatorarray[$keyname];
+		}
+		if ($comment_key) {
+			if ($comment_key == 'picture') {
+				if (!is_array($data)) {
+					$image_mime = '';
+					if (preg_match('#^\x89\x50\x4E\x47\x0D\x0A\x1A\x0A#', $data)) {
+						$image_mime = 'image/png';
+					} elseif (preg_match('#^\xFF\xD8\xFF#', $data)) {
+						$image_mime = 'image/jpeg';
+					} elseif (preg_match('#^GIF#', $data)) {
+						$image_mime = 'image/gif';
+					} elseif (preg_match('#^BM#', $data)) {
+						$image_mime = 'image/bmp';
+					}
+					$data = array('data'=>$data, 'image_mime'=>$image_mime);
+				}
+			}
+			$info['quicktime']['comments'][$comment_key][] = $data;
+		}
+		return true;
+	}
+
+	public function NoNullString($nullterminatedstring) {
+		// remove the single null terminator on null terminated strings
+		if (substr($nullterminatedstring, strlen($nullterminatedstring) - 1, 1) === "\x00") {
+			return substr($nullterminatedstring, 0, strlen($nullterminatedstring) - 1);
+		}
+		return $nullterminatedstring;
+	}
+
+	public function Pascal2String($pascalstring) {
+		// Pascal strings have 1 unsigned byte at the beginning saying how many chars (1-255) are in the string
+		return substr($pascalstring, 1);
+	}
+
+}
Index: /extensions/piwigo_videojs/include/getid3/module.audio.flac.php
===================================================================
--- /extensions/piwigo_videojs/include/getid3/module.audio.flac.php	(revision 24676)
+++ /extensions/piwigo_videojs/include/getid3/module.audio.flac.php	(revision 24676)
@@ -0,0 +1,442 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// module.audio.flac.php                                       //
+// module for analyzing FLAC and OggFLAC audio files           //
+// dependencies: module.audio.ogg.php                          //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+
+getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ogg.php', __FILE__, true);
+
+/**
+* @tutorial http://flac.sourceforge.net/format.html
+*/
+class getid3_flac extends getid3_handler
+{
+	const syncword = 'fLaC';
+
+	public function Analyze() {
+		$info = &$this->getid3->info;
+
+		$this->fseek($info['avdataoffset']);
+		$StreamMarker = $this->fread(4);
+		if ($StreamMarker != self::syncword) {
+			return $this->error('Expecting "'.getid3_lib::PrintHexBytes(self::syncword).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($StreamMarker).'"');
+		}
+		$info['fileformat']            = 'flac';
+		$info['audio']['dataformat']   = 'flac';
+		$info['audio']['bitrate_mode'] = 'vbr';
+		$info['audio']['lossless']     = true;
+
+		// parse flac container
+		return $this->parseMETAdata();
+	}
+
+	public function parseMETAdata() {
+		$info = &$this->getid3->info;
+		do {
+			$BlockOffset   = $this->ftell();
+			$BlockHeader   = $this->fread(4);
+			$LBFBT         = getid3_lib::BigEndian2Int(substr($BlockHeader, 0, 1));
+			$LastBlockFlag = (bool) ($LBFBT & 0x80);
+			$BlockType     =        ($LBFBT & 0x7F);
+			$BlockLength   = getid3_lib::BigEndian2Int(substr($BlockHeader, 1, 3));
+			$BlockTypeText = self::metaBlockTypeLookup($BlockType);
+
+			if (($BlockOffset + 4 + $BlockLength) > $info['avdataend']) {
+				$this->error('METADATA_BLOCK_HEADER.BLOCK_TYPE ('.$BlockTypeText.') at offset '.$BlockOffset.' extends beyond end of file');
+				break;
+			}
+			if ($BlockLength < 1) {
+				$this->error('METADATA_BLOCK_HEADER.BLOCK_LENGTH ('.$BlockLength.') at offset '.$BlockOffset.' is invalid');
+				break;
+			}
+
+			$info['flac'][$BlockTypeText]['raw'] = array();
+			$BlockTypeText_raw = &$info['flac'][$BlockTypeText]['raw'];
+
+			$BlockTypeText_raw['offset']          = $BlockOffset;
+			$BlockTypeText_raw['last_meta_block'] = $LastBlockFlag;
+			$BlockTypeText_raw['block_type']      = $BlockType;
+			$BlockTypeText_raw['block_type_text'] = $BlockTypeText;
+			$BlockTypeText_raw['block_length']    = $BlockLength;
+			if ($BlockTypeText_raw['block_type'] != 0x06) { // do not read attachment data automatically
+				$BlockTypeText_raw['block_data']  = $this->fread($BlockLength);
+			}
+
+			switch ($BlockTypeText) {
+				case 'STREAMINFO':     // 0x00
+					if (!$this->parseSTREAMINFO($BlockTypeText_raw['block_data'])) {
+						return false;
+					}
+					break;
+
+				case 'PADDING':        // 0x01
+					unset($info['flac']['PADDING']); // ignore
+					break;
+
+				case 'APPLICATION':    // 0x02
+					if (!$this->parseAPPLICATION($BlockTypeText_raw['block_data'])) {
+						return false;
+					}
+					break;
+
+				case 'SEEKTABLE':      // 0x03
+					if (!$this->parseSEEKTABLE($BlockTypeText_raw['block_data'])) {
+						return false;
+					}
+					break;
+
+				case 'VORBIS_COMMENT': // 0x04
+					if (!$this->parseVORBIS_COMMENT($BlockTypeText_raw['block_data'])) {
+						return false;
+					}
+					break;
+
+				case 'CUESHEET':       // 0x05
+					if (!$this->parseCUESHEET($BlockTypeText_raw['block_data'])) {
+						return false;
+					}
+					break;
+
+				case 'PICTURE':        // 0x06
+					if (!$this->parsePICTURE()) {
+						return false;
+					}
+					break;
+
+				default:
+					$this->warning('Unhandled METADATA_BLOCK_HEADER.BLOCK_TYPE ('.$BlockType.') at offset '.$BlockOffset);
+			}
+
+			unset($info['flac'][$BlockTypeText]['raw']);
+			$info['avdataoffset'] = $this->ftell();
+		}
+		while ($LastBlockFlag === false);
+
+		// handle tags
+		if (!empty($info['flac']['VORBIS_COMMENT']['comments'])) {
+			$info['flac']['comments'] = $info['flac']['VORBIS_COMMENT']['comments'];
+		}
+		if (!empty($info['flac']['VORBIS_COMMENT']['vendor'])) {
+			$info['audio']['encoder'] = str_replace('reference ', '', $info['flac']['VORBIS_COMMENT']['vendor']);
+		}
+
+		// copy attachments to 'comments' array if nesesary
+		if (isset($info['flac']['PICTURE']) && ($this->getid3->option_save_attachments !== getID3::ATTACHMENTS_NONE)) {
+			foreach ($info['flac']['PICTURE'] as $entry) {
+				if (!empty($entry['data'])) {
+					$info['flac']['comments']['picture'][] = array('image_mime'=>$entry['image_mime'], 'data'=>$entry['data']);
+				}
+			}
+		}
+
+		if (isset($info['flac']['STREAMINFO'])) {
+			if (!$this->isDependencyFor('matroska')) {
+				$info['flac']['compressed_audio_bytes'] = $info['avdataend'] - $info['avdataoffset'];
+			}
+			$info['flac']['uncompressed_audio_bytes'] = $info['flac']['STREAMINFO']['samples_stream'] * $info['flac']['STREAMINFO']['channels'] * ($info['flac']['STREAMINFO']['bits_per_sample'] / 8);
+			if ($info['flac']['uncompressed_audio_bytes'] == 0) {
+				return $this->error('Corrupt FLAC file: uncompressed_audio_bytes == zero');
+			}
+			if (!empty($info['flac']['compressed_audio_bytes'])) {
+				$info['flac']['compression_ratio'] = $info['flac']['compressed_audio_bytes'] / $info['flac']['uncompressed_audio_bytes'];
+			}
+		}
+
+		// set md5_data_source - built into flac 0.5+
+		if (isset($info['flac']['STREAMINFO']['audio_signature'])) {
+
+			if ($info['flac']['STREAMINFO']['audio_signature'] === str_repeat("\x00", 16)) {
+                $this->warning('FLAC STREAMINFO.audio_signature is null (known issue with libOggFLAC)');
+			}
+			else {
+				$info['md5_data_source'] = '';
+				$md5 = $info['flac']['STREAMINFO']['audio_signature'];
+				for ($i = 0; $i < strlen($md5); $i++) {
+					$info['md5_data_source'] .= str_pad(dechex(ord($md5[$i])), 2, '00', STR_PAD_LEFT);
+				}
+				if (!preg_match('/^[0-9a-f]{32}$/', $info['md5_data_source'])) {
+					unset($info['md5_data_source']);
+				}
+			}
+		}
+
+		if (isset($info['flac']['STREAMINFO']['bits_per_sample'])) {
+			$info['audio']['bits_per_sample'] = $info['flac']['STREAMINFO']['bits_per_sample'];
+			if ($info['audio']['bits_per_sample'] == 8) {
+				// special case
+				// must invert sign bit on all data bytes before MD5'ing to match FLAC's calculated value
+				// MD5sum calculates on unsigned bytes, but FLAC calculated MD5 on 8-bit audio data as signed
+				$this->warning('FLAC calculates MD5 data strangely on 8-bit audio, so the stored md5_data_source value will not match the decoded WAV file');
+			}
+		}
+
+		return true;
+	}
+
+	private function parseSTREAMINFO($BlockData) {
+		$info = &$this->getid3->info;
+
+		$info['flac']['STREAMINFO'] = array();
+		$streaminfo = &$info['flac']['STREAMINFO'];
+
+		$streaminfo['min_block_size']  = getid3_lib::BigEndian2Int(substr($BlockData, 0, 2));
+		$streaminfo['max_block_size']  = getid3_lib::BigEndian2Int(substr($BlockData, 2, 2));
+		$streaminfo['min_frame_size']  = getid3_lib::BigEndian2Int(substr($BlockData, 4, 3));
+		$streaminfo['max_frame_size']  = getid3_lib::BigEndian2Int(substr($BlockData, 7, 3));
+
+		$SRCSBSS                       = getid3_lib::BigEndian2Bin(substr($BlockData, 10, 8));
+		$streaminfo['sample_rate']     = getid3_lib::Bin2Dec(substr($SRCSBSS,  0, 20));
+		$streaminfo['channels']        = getid3_lib::Bin2Dec(substr($SRCSBSS, 20,  3)) + 1;
+		$streaminfo['bits_per_sample'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 23,  5)) + 1;
+		$streaminfo['samples_stream']  = getid3_lib::Bin2Dec(substr($SRCSBSS, 28, 36));
+
+		$streaminfo['audio_signature'] = substr($BlockData, 18, 16);
+
+		if (!empty($streaminfo['sample_rate'])) {
+
+			$info['audio']['bitrate_mode']    = 'vbr';
+			$info['audio']['sample_rate']     = $streaminfo['sample_rate'];
+			$info['audio']['channels']        = $streaminfo['channels'];
+			$info['audio']['bits_per_sample'] = $streaminfo['bits_per_sample'];
+			$info['playtime_seconds']         = $streaminfo['samples_stream'] / $streaminfo['sample_rate'];
+			if ($info['playtime_seconds'] > 0) {
+				if (!$this->isDependencyFor('matroska')) {
+					$info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
+				}
+				else {
+					$this->warning('Cannot determine audio bitrate because total stream size is unknown');
+				}
+			}
+
+		} else {
+			return $this->error('Corrupt METAdata block: STREAMINFO');
+		}
+
+		return true;
+	}
+
+	private function parseAPPLICATION($BlockData) {
+		$info = &$this->getid3->info;
+
+		$ApplicationID = getid3_lib::BigEndian2Int(substr($BlockData, 0, 4));
+		$info['flac']['APPLICATION'][$ApplicationID]['name'] = self::applicationIDLookup($ApplicationID);
+		$info['flac']['APPLICATION'][$ApplicationID]['data'] = substr($BlockData, 4);
+
+		return true;
+	}
+
+	private function parseSEEKTABLE($BlockData) {
+		$info = &$this->getid3->info;
+
+		$offset = 0;
+		$BlockLength = strlen($BlockData);
+		$placeholderpattern = str_repeat("\xFF", 8);
+		while ($offset < $BlockLength) {
+			$SampleNumberString = substr($BlockData, $offset, 8);
+			$offset += 8;
+			if ($SampleNumberString == $placeholderpattern) {
+
+				// placeholder point
+				getid3_lib::safe_inc($info['flac']['SEEKTABLE']['placeholders'], 1);
+				$offset += 10;
+
+			} else {
+
+				$SampleNumber                                        = getid3_lib::BigEndian2Int($SampleNumberString);
+				$info['flac']['SEEKTABLE'][$SampleNumber]['offset']  = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8));
+				$offset += 8;
+				$info['flac']['SEEKTABLE'][$SampleNumber]['samples'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 2));
+				$offset += 2;
+
+			}
+		}
+
+		return true;
+	}
+
+	private function parseVORBIS_COMMENT($BlockData) {
+		$info = &$this->getid3->info;
+
+		$getid3_ogg = new getid3_ogg($this->getid3);
+		if ($this->isDependencyFor('matroska')) {
+			$getid3_ogg->setStringMode($this->data_string);
+		}
+		$getid3_ogg->ParseVorbisComments();
+		if (isset($info['ogg'])) {
+			unset($info['ogg']['comments_raw']);
+			$info['flac']['VORBIS_COMMENT'] = $info['ogg'];
+			unset($info['ogg']);
+		}
+
+		unset($getid3_ogg);
+
+		return true;
+	}
+
+	private function parseCUESHEET($BlockData) {
+		$info = &$this->getid3->info;
+		$offset = 0;
+		$info['flac']['CUESHEET']['media_catalog_number'] =                              trim(substr($BlockData, $offset, 128), "\0");
+		$offset += 128;
+		$info['flac']['CUESHEET']['lead_in_samples']      =         getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8));
+		$offset += 8;
+		$info['flac']['CUESHEET']['flags']['is_cd']       = (bool) (getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)) & 0x80);
+		$offset += 1;
+
+		$offset += 258; // reserved
+
+		$info['flac']['CUESHEET']['number_tracks']        =         getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1));
+		$offset += 1;
+
+		for ($track = 0; $track < $info['flac']['CUESHEET']['number_tracks']; $track++) {
+			$TrackSampleOffset = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8));
+			$offset += 8;
+			$TrackNumber       = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1));
+			$offset += 1;
+
+			$info['flac']['CUESHEET']['tracks'][$TrackNumber]['sample_offset']         = $TrackSampleOffset;
+
+			$info['flac']['CUESHEET']['tracks'][$TrackNumber]['isrc']                  =                           substr($BlockData, $offset, 12);
+			$offset += 12;
+
+			$TrackFlagsRaw                                                             = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1));
+			$offset += 1;
+			$info['flac']['CUESHEET']['tracks'][$TrackNumber]['flags']['is_audio']     = (bool) ($TrackFlagsRaw & 0x80);
+			$info['flac']['CUESHEET']['tracks'][$TrackNumber]['flags']['pre_emphasis'] = (bool) ($TrackFlagsRaw & 0x40);
+
+			$offset += 13; // reserved
+
+			$info['flac']['CUESHEET']['tracks'][$TrackNumber]['index_points']          = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1));
+			$offset += 1;
+
+			for ($index = 0; $index < $info['flac']['CUESHEET']['tracks'][$TrackNumber]['index_points']; $index++) {
+				$IndexSampleOffset = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8));
+				$offset += 8;
+				$IndexNumber       = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1));
+				$offset += 1;
+
+				$offset += 3; // reserved
+
+				$info['flac']['CUESHEET']['tracks'][$TrackNumber]['indexes'][$IndexNumber] = $IndexSampleOffset;
+			}
+		}
+
+		return true;
+	}
+
+	/**
+	* Parse METADATA_BLOCK_PICTURE flac structure and extract attachment
+	* External usage: audio.ogg
+	*/
+	public function parsePICTURE() {
+		$info = &$this->getid3->info;
+
+		$picture['typeid']         = getid3_lib::BigEndian2Int($this->fread(4));
+		$picture['type']           = self::pictureTypeLookup($picture['typeid']);
+		$picture['image_mime']     = $this->fread(getid3_lib::BigEndian2Int($this->fread(4)));
+		$descr_length              = getid3_lib::BigEndian2Int($this->fread(4));
+		if ($descr_length) {
+			$picture['description'] = $this->fread($descr_length);
+		}
+		$picture['width']          = getid3_lib::BigEndian2Int($this->fread(4));
+		$picture['height']         = getid3_lib::BigEndian2Int($this->fread(4));
+		$picture['color_depth']    = getid3_lib::BigEndian2Int($this->fread(4));
+		$picture['colors_indexed'] = getid3_lib::BigEndian2Int($this->fread(4));
+		$data_length               = getid3_lib::BigEndian2Int($this->fread(4));
+
+		if ($picture['image_mime'] == '-->') {
+			$picture['data'] = $this->fread($data_length);
+		} else {
+			$picture['data'] = $this->saveAttachment(
+				str_replace('/', '_', $picture['type']).'_'.$this->ftell(),
+				$this->ftell(),
+				$data_length,
+				$picture['image_mime']);
+		}
+
+		$info['flac']['PICTURE'][] = $picture;
+
+		return true;
+	}
+
+	public static function metaBlockTypeLookup($blocktype) {
+		static $lookup = array(
+			0 => 'STREAMINFO',
+			1 => 'PADDING',
+			2 => 'APPLICATION',
+			3 => 'SEEKTABLE',
+			4 => 'VORBIS_COMMENT',
+			5 => 'CUESHEET',
+			6 => 'PICTURE',
+		);
+		return (isset($lookup[$blocktype]) ? $lookup[$blocktype] : 'reserved');
+	}
+
+	public static function applicationIDLookup($applicationid) {
+		// http://flac.sourceforge.net/id.html
+		static $lookup = array(
+			0x41544348 => 'FlacFile',                                                                           // "ATCH"
+			0x42534F4C => 'beSolo',                                                                             // "BSOL"
+			0x42554753 => 'Bugs Player',                                                                        // "BUGS"
+			0x43756573 => 'GoldWave cue points (specification)',                                                // "Cues"
+			0x46696361 => 'CUE Splitter',                                                                       // "Fica"
+			0x46746F6C => 'flac-tools',                                                                         // "Ftol"
+			0x4D4F5442 => 'MOTB MetaCzar',                                                                      // "MOTB"
+			0x4D505345 => 'MP3 Stream Editor',                                                                  // "MPSE"
+			0x4D754D4C => 'MusicML: Music Metadata Language',                                                   // "MuML"
+			0x52494646 => 'Sound Devices RIFF chunk storage',                                                   // "RIFF"
+			0x5346464C => 'Sound Font FLAC',                                                                    // "SFFL"
+			0x534F4E59 => 'Sony Creative Software',                                                             // "SONY"
+			0x5351455A => 'flacsqueeze',                                                                        // "SQEZ"
+			0x54745776 => 'TwistedWave',                                                                        // "TtWv"
+			0x55495453 => 'UITS Embedding tools',                                                               // "UITS"
+			0x61696666 => 'FLAC AIFF chunk storage',                                                            // "aiff"
+			0x696D6167 => 'flac-image application for storing arbitrary files in APPLICATION metadata blocks',  // "imag"
+			0x7065656D => 'Parseable Embedded Extensible Metadata (specification)',                             // "peem"
+			0x71667374 => 'QFLAC Studio',                                                                       // "qfst"
+			0x72696666 => 'FLAC RIFF chunk storage',                                                            // "riff"
+			0x74756E65 => 'TagTuner',                                                                           // "tune"
+			0x78626174 => 'XBAT',                                                                               // "xbat"
+			0x786D6364 => 'xmcd',                                                                               // "xmcd"
+		);
+		return (isset($lookup[$applicationid]) ? $lookup[$applicationid] : 'reserved');
+	}
+
+	public static function pictureTypeLookup($type_id) {
+		static $lookup = array (
+			 0 => 'Other',
+			 1 => '32x32 pixels \'file icon\' (PNG only)',
+			 2 => 'Other file icon',
+			 3 => 'Cover (front)',
+			 4 => 'Cover (back)',
+			 5 => 'Leaflet page',
+			 6 => 'Media (e.g. label side of CD)',
+			 7 => 'Lead artist/lead performer/soloist',
+			 8 => 'Artist/performer',
+			 9 => 'Conductor',
+			10 => 'Band/Orchestra',
+			11 => 'Composer',
+			12 => 'Lyricist/text writer',
+			13 => 'Recording Location',
+			14 => 'During recording',
+			15 => 'During performance',
+			16 => 'Movie/video screen capture',
+			17 => 'A bright coloured fish',
+			18 => 'Illustration',
+			19 => 'Band/artist logotype',
+			20 => 'Publisher/Studio logotype',
+		);
+		return (isset($lookup[$type_id]) ? $lookup[$type_id] : 'reserved');
+	}
+
+}
Index: /extensions/piwigo_videojs/include/getid3/module.audio.mp3.php
===================================================================
--- /extensions/piwigo_videojs/include/getid3/module.audio.mp3.php	(revision 24676)
+++ /extensions/piwigo_videojs/include/getid3/module.audio.mp3.php	(revision 24676)
@@ -0,0 +1,2009 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// module.audio.mp3.php                                        //
+// module for analyzing MP3 files                              //
+// dependencies: NONE                                          //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+
+// number of frames to scan to determine if MPEG-audio sequence is valid
+// Lower this number to 5-20 for faster scanning
+// Increase this number to 50+ for most accurate detection of valid VBR/CBR
+// mpeg-audio streams
+define('GETID3_MP3_VALID_CHECK_FRAMES', 35);
+
+
+class getid3_mp3 extends getid3_handler
+{
+
+	public $allow_bruteforce = false; // forces getID3() to scan the file byte-by-byte and log all the valid audio frame headers - extremely slow, unrecommended, but may provide data from otherwise-unusuable files
+
+	public function Analyze() {
+		$info = &$this->getid3->info;
+
+		$initialOffset = $info['avdataoffset'];
+
+		if (!$this->getOnlyMPEGaudioInfo($info['avdataoffset'])) {
+			if ($this->allow_bruteforce) {
+				$info['error'][] = 'Rescanning file in BruteForce mode';
+				$this->getOnlyMPEGaudioInfoBruteForce($this->getid3->fp, $info);
+			}
+		}
+
+
+		if (isset($info['mpeg']['audio']['bitrate_mode'])) {
+			$info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']);
+		}
+
+		if (((isset($info['id3v2']['headerlength']) && ($info['avdataoffset'] > $info['id3v2']['headerlength'])) || (!isset($info['id3v2']) && ($info['avdataoffset'] > 0) && ($info['avdataoffset'] != $initialOffset)))) {
+
+			$synchoffsetwarning = 'Unknown data before synch ';
+			if (isset($info['id3v2']['headerlength'])) {
+				$synchoffsetwarning .= '(ID3v2 header ends at '.$info['id3v2']['headerlength'].', then '.($info['avdataoffset'] - $info['id3v2']['headerlength']).' bytes garbage, ';
+			} elseif ($initialOffset > 0) {
+				$synchoffsetwarning .= '(should be at '.$initialOffset.', ';
+			} else {
+				$synchoffsetwarning .= '(should be at beginning of file, ';
+			}
+			$synchoffsetwarning .= 'synch detected at '.$info['avdataoffset'].')';
+			if (isset($info['audio']['bitrate_mode']) && ($info['audio']['bitrate_mode'] == 'cbr')) {
+
+				if (!empty($info['id3v2']['headerlength']) && (($info['avdataoffset'] - $info['id3v2']['headerlength']) == $info['mpeg']['audio']['framelength'])) {
+
+					$synchoffsetwarning .= '. This is a known problem with some versions of LAME (3.90-3.92) DLL in CBR mode.';
+					$info['audio']['codec'] = 'LAME';
+					$CurrentDataLAMEversionString = 'LAME3.';
+
+				} elseif (empty($info['id3v2']['headerlength']) && ($info['avdataoffset'] == $info['mpeg']['audio']['framelength'])) {
+
+					$synchoffsetwarning .= '. This is a known problem with some versions of LAME (3.90 - 3.92) DLL in CBR mode.';
+					$info['audio']['codec'] = 'LAME';
+					$CurrentDataLAMEversionString = 'LAME3.';
+
+				}
+
+			}
+			$info['warning'][] = $synchoffsetwarning;
+
+		}
+
+		if (isset($info['mpeg']['audio']['LAME'])) {
+			$info['audio']['codec'] = 'LAME';
+			if (!empty($info['mpeg']['audio']['LAME']['long_version'])) {
+				$info['audio']['encoder'] = rtrim($info['mpeg']['audio']['LAME']['long_version'], "\x00");
+			} elseif (!empty($info['mpeg']['audio']['LAME']['short_version'])) {
+				$info['audio']['encoder'] = rtrim($info['mpeg']['audio']['LAME']['short_version'], "\x00");
+			}
+		}
+
+		$CurrentDataLAMEversionString = (!empty($CurrentDataLAMEversionString) ? $CurrentDataLAMEversionString : (isset($info['audio']['encoder']) ? $info['audio']['encoder'] : ''));
+		if (!empty($CurrentDataLAMEversionString) && (substr($CurrentDataLAMEversionString, 0, 6) == 'LAME3.') && !preg_match('[0-9\)]', substr($CurrentDataLAMEversionString, -1))) {
+			// a version number of LAME that does not end with a number like "LAME3.92"
+			// or with a closing parenthesis like "LAME3.88 (alpha)"
+			// or a version of LAME with the LAMEtag-not-filled-in-DLL-mode bug (3.90-3.92)
+
+			// not sure what the actual last frame length will be, but will be less than or equal to 1441
+			$PossiblyLongerLAMEversion_FrameLength = 1441;
+
+			// Not sure what version of LAME this is - look in padding of last frame for longer version string
+			$PossibleLAMEversionStringOffset = $info['avdataend'] - $PossiblyLongerLAMEversion_FrameLength;
+			fseek($this->getid3->fp, $PossibleLAMEversionStringOffset);
+			$PossiblyLongerLAMEversion_Data = fread($this->getid3->fp, $PossiblyLongerLAMEversion_FrameLength);
+			switch (substr($CurrentDataLAMEversionString, -1)) {
+				case 'a':
+				case 'b':
+					// "LAME3.94a" will have a longer version string of "LAME3.94 (alpha)" for example
+					// need to trim off "a" to match longer string
+					$CurrentDataLAMEversionString = substr($CurrentDataLAMEversionString, 0, -1);
+					break;
+			}
+			if (($PossiblyLongerLAMEversion_String = strstr($PossiblyLongerLAMEversion_Data, $CurrentDataLAMEversionString)) !== false) {
+				if (substr($PossiblyLongerLAMEversion_String, 0, strlen($CurrentDataLAMEversionString)) == $CurrentDataLAMEversionString) {
+					$PossiblyLongerLAMEversion_NewString = substr($PossiblyLongerLAMEversion_String, 0, strspn($PossiblyLongerLAMEversion_String, 'LAME0123456789., (abcdefghijklmnopqrstuvwxyzJFSOND)')); //"LAME3.90.3"  "LAME3.87 (beta 1, Sep 27 2000)" "LAME3.88 (beta)"
+					if (empty($info['audio']['encoder']) || (strlen($PossiblyLongerLAMEversion_NewString) > strlen($info['audio']['encoder']))) {
+						$info['audio']['encoder'] = $PossiblyLongerLAMEversion_NewString;
+					}
+				}
+			}
+		}
+		if (!empty($info['audio']['encoder'])) {
+			$info['audio']['encoder'] = rtrim($info['audio']['encoder'], "\x00 ");
+		}
+
+		switch (isset($info['mpeg']['audio']['layer']) ? $info['mpeg']['audio']['layer'] : '') {
+			case 1:
+			case 2:
+				$info['audio']['dataformat'] = 'mp'.$info['mpeg']['audio']['layer'];
+				break;
+		}
+		if (isset($info['fileformat']) && ($info['fileformat'] == 'mp3')) {
+			switch ($info['audio']['dataformat']) {
+				case 'mp1':
+				case 'mp2':
+				case 'mp3':
+					$info['fileformat'] = $info['audio']['dataformat'];
+					break;
+
+				default:
+					$info['warning'][] = 'Expecting [audio][dataformat] to be mp1/mp2/mp3 when fileformat == mp3, [audio][dataformat] actually "'.$info['audio']['dataformat'].'"';
+					break;
+			}
+		}
+
+		if (empty($info['fileformat'])) {
+			unset($info['fileformat']);
+			unset($info['audio']['bitrate_mode']);
+			unset($info['avdataoffset']);
+			unset($info['avdataend']);
+			return false;
+		}
+
+		$info['mime_type']         = 'audio/mpeg';
+		$info['audio']['lossless'] = false;
+
+		// Calculate playtime
+		if (!isset($info['playtime_seconds']) && isset($info['audio']['bitrate']) && ($info['audio']['bitrate'] > 0)) {
+			$info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset']) * 8 / $info['audio']['bitrate'];
+		}
+
+		$info['audio']['encoder_options'] = $this->GuessEncoderOptions();
+
+		return true;
+	}
+
+
+	public function GuessEncoderOptions() {
+		// shortcuts
+		$info = &$this->getid3->info;
+		if (!empty($info['mpeg']['audio'])) {
+			$thisfile_mpeg_audio = &$info['mpeg']['audio'];
+			if (!empty($thisfile_mpeg_audio['LAME'])) {
+				$thisfile_mpeg_audio_lame = &$thisfile_mpeg_audio['LAME'];
+			}
+		}
+
+		$encoder_options = '';
+		static $NamedPresetBitrates = array(16, 24, 40, 56, 112, 128, 160, 192, 256);
+
+		if (isset($thisfile_mpeg_audio['VBR_method']) && ($thisfile_mpeg_audio['VBR_method'] == 'Fraunhofer') && !empty($thisfile_mpeg_audio['VBR_quality'])) {
+
+			$encoder_options = 'VBR q'.$thisfile_mpeg_audio['VBR_quality'];
+
+		} elseif (!empty($thisfile_mpeg_audio_lame['preset_used']) && (!in_array($thisfile_mpeg_audio_lame['preset_used_id'], $NamedPresetBitrates))) {
+
+			$encoder_options = $thisfile_mpeg_audio_lame['preset_used'];
+
+		} elseif (!empty($thisfile_mpeg_audio_lame['vbr_quality'])) {
+
+			static $KnownEncoderValues = array();
+			if (empty($KnownEncoderValues)) {
+
+				//$KnownEncoderValues[abrbitrate_minbitrate][vbr_quality][raw_vbr_method][raw_noise_shaping][raw_stereo_mode][ath_type][lowpass_frequency] = 'preset name';
+				$KnownEncoderValues[0xFF][58][1][1][3][2][20500] = '--alt-preset insane';        // 3.90,   3.90.1, 3.92
+				$KnownEncoderValues[0xFF][58][1][1][3][2][20600] = '--alt-preset insane';        // 3.90.2, 3.90.3, 3.91
+				$KnownEncoderValues[0xFF][57][1][1][3][4][20500] = '--alt-preset insane';        // 3.94,   3.95
+				$KnownEncoderValues['**'][78][3][2][3][2][19500] = '--alt-preset extreme';       // 3.90,   3.90.1, 3.92
+				$KnownEncoderValues['**'][78][3][2][3][2][19600] = '--alt-preset extreme';       // 3.90.2, 3.91
+				$KnownEncoderValues['**'][78][3][1][3][2][19600] = '--alt-preset extreme';       // 3.90.3
+				$KnownEncoderValues['**'][78][4][2][3][2][19500] = '--alt-preset fast extreme';  // 3.90,   3.90.1, 3.92
+				$KnownEncoderValues['**'][78][4][2][3][2][19600] = '--alt-preset fast extreme';  // 3.90.2, 3.90.3, 3.91
+				$KnownEncoderValues['**'][78][3][2][3][4][19000] = '--alt-preset standard';      // 3.90,   3.90.1, 3.90.2, 3.91, 3.92
+				$KnownEncoderValues['**'][78][3][1][3][4][19000] = '--alt-preset standard';      // 3.90.3
+				$KnownEncoderValues['**'][78][4][2][3][4][19000] = '--alt-preset fast standard'; // 3.90,   3.90.1, 3.90.2, 3.91, 3.92
+				$KnownEncoderValues['**'][78][4][1][3][4][19000] = '--alt-preset fast standard'; // 3.90.3
+				$KnownEncoderValues['**'][88][4][1][3][3][19500] = '--r3mix';                    // 3.90,   3.90.1, 3.92
+				$KnownEncoderValues['**'][88][4][1][3][3][19600] = '--r3mix';                    // 3.90.2, 3.90.3, 3.91
+				$KnownEncoderValues['**'][67][4][1][3][4][18000] = '--r3mix';                    // 3.94,   3.95
+				$KnownEncoderValues['**'][68][3][2][3][4][18000] = '--alt-preset medium';        // 3.90.3
+				$KnownEncoderValues['**'][68][4][2][3][4][18000] = '--alt-preset fast medium';   // 3.90.3
+
+				$KnownEncoderValues[0xFF][99][1][1][1][2][0]     = '--preset studio';            // 3.90,   3.90.1, 3.90.2, 3.91, 3.92
+				$KnownEncoderValues[0xFF][58][2][1][3][2][20600] = '--preset studio';            // 3.90.3, 3.93.1
+				$KnownEncoderValues[0xFF][58][2][1][3][2][20500] = '--preset studio';            // 3.93
+				$KnownEncoderValues[0xFF][57][2][1][3][4][20500] = '--preset studio';            // 3.94,   3.95
+				$KnownEncoderValues[0xC0][88][1][1][1][2][0]     = '--preset cd';                // 3.90,   3.90.1, 3.90.2,   3.91, 3.92
+				$KnownEncoderValues[0xC0][58][2][2][3][2][19600] = '--preset cd';                // 3.90.3, 3.93.1
+				$KnownEncoderValues[0xC0][58][2][2][3][2][19500] = '--preset cd';                // 3.93
+				$KnownEncoderValues[0xC0][57][2][1][3][4][19500] = '--preset cd';                // 3.94,   3.95
+				$KnownEncoderValues[0xA0][78][1][1][3][2][18000] = '--preset hifi';              // 3.90,   3.90.1, 3.90.2,   3.91, 3.92
+				$KnownEncoderValues[0xA0][58][2][2][3][2][18000] = '--preset hifi';              // 3.90.3, 3.93,   3.93.1
+				$KnownEncoderValues[0xA0][57][2][1][3][4][18000] = '--preset hifi';              // 3.94,   3.95
+				$KnownEncoderValues[0x80][67][1][1][3][2][18000] = '--preset tape';              // 3.90,   3.90.1, 3.90.2,   3.91, 3.92
+				$KnownEncoderValues[0x80][67][1][1][3][2][15000] = '--preset radio';             // 3.90,   3.90.1, 3.90.2,   3.91, 3.92
+				$KnownEncoderValues[0x70][67][1][1][3][2][15000] = '--preset fm';                // 3.90,   3.90.1, 3.90.2,   3.91, 3.92
+				$KnownEncoderValues[0x70][58][2][2][3][2][16000] = '--preset tape/radio/fm';     // 3.90.3, 3.93,   3.93.1
+				$KnownEncoderValues[0x70][57][2][1][3][4][16000] = '--preset tape/radio/fm';     // 3.94,   3.95
+				$KnownEncoderValues[0x38][58][2][2][0][2][10000] = '--preset voice';             // 3.90.3, 3.93,   3.93.1
+				$KnownEncoderValues[0x38][57][2][1][0][4][15000] = '--preset voice';             // 3.94,   3.95
+				$KnownEncoderValues[0x38][57][2][1][0][4][16000] = '--preset voice';             // 3.94a14
+				$KnownEncoderValues[0x28][65][1][1][0][2][7500]  = '--preset mw-us';             // 3.90,   3.90.1, 3.92
+				$KnownEncoderValues[0x28][65][1][1][0][2][7600]  = '--preset mw-us';             // 3.90.2, 3.91
+				$KnownEncoderValues[0x28][58][2][2][0][2][7000]  = '--preset mw-us';             // 3.90.3, 3.93,   3.93.1
+				$KnownEncoderValues[0x28][57][2][1][0][4][10500] = '--preset mw-us';             // 3.94,   3.95
+				$KnownEncoderValues[0x28][57][2][1][0][4][11200] = '--preset mw-us';             // 3.94a14
+				$KnownEncoderValues[0x28][57][2][1][0][4][8800]  = '--preset mw-us';             // 3.94a15
+				$KnownEncoderValues[0x18][58][2][2][0][2][4000]  = '--preset phon+/lw/mw-eu/sw'; // 3.90.3, 3.93.1
+				$KnownEncoderValues[0x18][58][2][2][0][2][3900]  = '--preset phon+/lw/mw-eu/sw'; // 3.93
+				$KnownEncoderValues[0x18][57][2][1][0][4][5900]  = '--preset phon+/lw/mw-eu/sw'; // 3.94,   3.95
+				$KnownEncoderValues[0x18][57][2][1][0][4][6200]  = '--preset phon+/lw/mw-eu/sw'; // 3.94a14
+				$KnownEncoderValues[0x18][57][2][1][0][4][3200]  = '--preset phon+/lw/mw-eu/sw'; // 3.94a15
+				$KnownEncoderValues[0x10][58][2][2][0][2][3800]  = '--preset phone';             // 3.90.3, 3.93.1
+				$KnownEncoderValues[0x10][58][2][2][0][2][3700]  = '--preset phone';             // 3.93
+				$KnownEncoderValues[0x10][57][2][1][0][4][5600]  = '--preset phone';             // 3.94,   3.95
+			}
+
+			if (isset($KnownEncoderValues[$thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate']][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']])) {
+
+				$encoder_options = $KnownEncoderValues[$thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate']][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']];
+
+			} elseif (isset($KnownEncoderValues['**'][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']])) {
+
+				$encoder_options = $KnownEncoderValues['**'][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']];
+
+			} elseif ($info['audio']['bitrate_mode'] == 'vbr') {
+
+				// http://gabriel.mp3-tech.org/mp3infotag.html
+				// int    Quality = (100 - 10 * gfp->VBR_q - gfp->quality)h
+
+
+				$LAME_V_value = 10 - ceil($thisfile_mpeg_audio_lame['vbr_quality'] / 10);
+				$LAME_q_value = 100 - $thisfile_mpeg_audio_lame['vbr_quality'] - ($LAME_V_value * 10);
+				$encoder_options = '-V'.$LAME_V_value.' -q'.$LAME_q_value;
+
+			} elseif ($info['audio']['bitrate_mode'] == 'cbr') {
+
+				$encoder_options = strtoupper($info['audio']['bitrate_mode']).ceil($info['audio']['bitrate'] / 1000);
+
+			} else {
+
+				$encoder_options = strtoupper($info['audio']['bitrate_mode']);
+
+			}
+
+		} elseif (!empty($thisfile_mpeg_audio_lame['bitrate_abr'])) {
+
+			$encoder_options = 'ABR'.$thisfile_mpeg_audio_lame['bitrate_abr'];
+
+		} elseif (!empty($info['audio']['bitrate'])) {
+
+			if ($info['audio']['bitrate_mode'] == 'cbr') {
+				$encoder_options = strtoupper($info['audio']['bitrate_mode']).ceil($info['audio']['bitrate'] / 1000);
+			} else {
+				$encoder_options = strtoupper($info['audio']['bitrate_mode']);
+			}
+
+		}
+		if (!empty($thisfile_mpeg_audio_lame['bitrate_min'])) {
+			$encoder_options .= ' -b'.$thisfile_mpeg_audio_lame['bitrate_min'];
+		}
+
+		if (!empty($thisfile_mpeg_audio_lame['encoding_flags']['nogap_prev']) || !empty($thisfile_mpeg_audio_lame['encoding_flags']['nogap_next'])) {
+			$encoder_options .= ' --nogap';
+		}
+
+		if (!empty($thisfile_mpeg_audio_lame['lowpass_frequency'])) {
+			$ExplodedOptions = explode(' ', $encoder_options, 4);
+			if ($ExplodedOptions[0] == '--r3mix') {
+				$ExplodedOptions[1] = 'r3mix';
+			}
+			switch ($ExplodedOptions[0]) {
+				case '--preset':
+				case '--alt-preset':
+				case '--r3mix':
+					if ($ExplodedOptions[1] == 'fast') {
+						$ExplodedOptions[1] .= ' '.$ExplodedOptions[2];
+					}
+					switch ($ExplodedOptions[1]) {
+						case 'portable':
+						case 'medium':
+						case 'standard':
+						case 'extreme':
+						case 'insane':
+						case 'fast portable':
+						case 'fast medium':
+						case 'fast standard':
+						case 'fast extreme':
+						case 'fast insane':
+						case 'r3mix':
+							static $ExpectedLowpass = array(
+									'insane|20500'        => 20500,
+									'insane|20600'        => 20600,  // 3.90.2, 3.90.3, 3.91
+									'medium|18000'        => 18000,
+									'fast medium|18000'   => 18000,
+									'extreme|19500'       => 19500,  // 3.90,   3.90.1, 3.92, 3.95
+									'extreme|19600'       => 19600,  // 3.90.2, 3.90.3, 3.91, 3.93.1
+									'fast extreme|19500'  => 19500,  // 3.90,   3.90.1, 3.92, 3.95
+									'fast extreme|19600'  => 19600,  // 3.90.2, 3.90.3, 3.91, 3.93.1
+									'standard|19000'      => 19000,
+									'fast standard|19000' => 19000,
+									'r3mix|19500'         => 19500,  // 3.90,   3.90.1, 3.92
+									'r3mix|19600'         => 19600,  // 3.90.2, 3.90.3, 3.91
+									'r3mix|18000'         => 18000,  // 3.94,   3.95
+								);
+							if (!isset($ExpectedLowpass[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio_lame['lowpass_frequency']]) && ($thisfile_mpeg_audio_lame['lowpass_frequency'] < 22050) && (round($thisfile_mpeg_audio_lame['lowpass_frequency'] / 1000) < round($thisfile_mpeg_audio['sample_rate'] / 2000))) {
+								$encoder_options .= ' --lowpass '.$thisfile_mpeg_audio_lame['lowpass_frequency'];
+							}
+							break;
+
+						default:
+							break;
+					}
+					break;
+			}
+		}
+
+		if (isset($thisfile_mpeg_audio_lame['raw']['source_sample_freq'])) {
+			if (($thisfile_mpeg_audio['sample_rate'] == 44100) && ($thisfile_mpeg_audio_lame['raw']['source_sample_freq'] != 1)) {
+				$encoder_options .= ' --resample 44100';
+			} elseif (($thisfile_mpeg_audio['sample_rate'] == 48000) && ($thisfile_mpeg_audio_lame['raw']['source_sample_freq'] != 2)) {
+				$encoder_options .= ' --resample 48000';
+			} elseif ($thisfile_mpeg_audio['sample_rate'] < 44100) {
+				switch ($thisfile_mpeg_audio_lame['raw']['source_sample_freq']) {
+					case 0: // <= 32000
+						// may or may not be same as source frequency - ignore
+						break;
+					case 1: // 44100
+					case 2: // 48000
+					case 3: // 48000+
+						$ExplodedOptions = explode(' ', $encoder_options, 4);
+						switch ($ExplodedOptions[0]) {
+							case '--preset':
+							case '--alt-preset':
+								switch ($ExplodedOptions[1]) {
+									case 'fast':
+									case 'portable':
+									case 'medium':
+									case 'standard':
+									case 'extreme':
+									case 'insane':
+										$encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate'];
+										break;
+
+									default:
+										static $ExpectedResampledRate = array(
+												'phon+/lw/mw-eu/sw|16000' => 16000,
+												'mw-us|24000'             => 24000, // 3.95
+												'mw-us|32000'             => 32000, // 3.93
+												'mw-us|16000'             => 16000, // 3.92
+												'phone|16000'             => 16000,
+												'phone|11025'             => 11025, // 3.94a15
+												'radio|32000'             => 32000, // 3.94a15
+												'fm/radio|32000'          => 32000, // 3.92
+												'fm|32000'                => 32000, // 3.90
+												'voice|32000'             => 32000);
+										if (!isset($ExpectedResampledRate[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio['sample_rate']])) {
+											$encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate'];
+										}
+										break;
+								}
+								break;
+
+							case '--r3mix':
+							default:
+								$encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate'];
+								break;
+						}
+						break;
+				}
+			}
+		}
+		if (empty($encoder_options) && !empty($info['audio']['bitrate']) && !empty($info['audio']['bitrate_mode'])) {
+			//$encoder_options = strtoupper($info['audio']['bitrate_mode']).ceil($info['audio']['bitrate'] / 1000);
+			$encoder_options = strtoupper($info['audio']['bitrate_mode']);
+		}
+
+		return $encoder_options;
+	}
+
+
+	public function decodeMPEGaudioHeader($offset, &$info, $recursivesearch=true, $ScanAsCBR=false, $FastMPEGheaderScan=false) {
+		static $MPEGaudioVersionLookup;
+		static $MPEGaudioLayerLookup;
+		static $MPEGaudioBitrateLookup;
+		static $MPEGaudioFrequencyLookup;
+		static $MPEGaudioChannelModeLookup;
+		static $MPEGaudioModeExtensionLookup;
+		static $MPEGaudioEmphasisLookup;
+		if (empty($MPEGaudioVersionLookup)) {
+			$MPEGaudioVersionLookup       = self::MPEGaudioVersionArray();
+			$MPEGaudioLayerLookup         = self::MPEGaudioLayerArray();
+			$MPEGaudioBitrateLookup       = self::MPEGaudioBitrateArray();
+			$MPEGaudioFrequencyLookup     = self::MPEGaudioFrequencyArray();
+			$MPEGaudioChannelModeLookup   = self::MPEGaudioChannelModeArray();
+			$MPEGaudioModeExtensionLookup = self::MPEGaudioModeExtensionArray();
+			$MPEGaudioEmphasisLookup      = self::MPEGaudioEmphasisArray();
+		}
+
+		if (fseek($this->getid3->fp, $offset, SEEK_SET) != 0) {
+			$info['error'][] = 'decodeMPEGaudioHeader() failed to seek to next offset at '.$offset;
+			return false;
+		}
+		//$headerstring = fread($this->getid3->fp, 1441); // worst-case max length = 32kHz @ 320kbps layer 3 = 1441 bytes/frame
+		$headerstring = fread($this->getid3->fp, 226); // LAME header at offset 36 + 190 bytes of Xing/LAME data
+
+		// MP3 audio frame structure:
+		// $aa $aa $aa $aa [$bb $bb] $cc...
+		// where $aa..$aa is the four-byte mpeg-audio header (below)
+		// $bb $bb is the optional 2-byte CRC
+		// and $cc... is the audio data
+
+		$head4 = substr($headerstring, 0, 4);
+
+		static $MPEGaudioHeaderDecodeCache = array();
+		if (isset($MPEGaudioHeaderDecodeCache[$head4])) {
+			$MPEGheaderRawArray = $MPEGaudioHeaderDecodeCache[$head4];
+		} else {
+			$MPEGheaderRawArray = self::MPEGaudioHeaderDecode($head4);
+			$MPEGaudioHeaderDecodeCache[$head4] = $MPEGheaderRawArray;
+		}
+
+		static $MPEGaudioHeaderValidCache = array();
+		if (!isset($MPEGaudioHeaderValidCache[$head4])) { // Not in cache
+			//$MPEGaudioHeaderValidCache[$head4] = self::MPEGaudioHeaderValid($MPEGheaderRawArray, false, true);  // allow badly-formatted freeformat (from LAME 3.90 - 3.93.1)
+			$MPEGaudioHeaderValidCache[$head4] = self::MPEGaudioHeaderValid($MPEGheaderRawArray, false, false);
+		}
+
+		// shortcut
+		if (!isset($info['mpeg']['audio'])) {
+			$info['mpeg']['audio'] = array();
+		}
+		$thisfile_mpeg_audio = &$info['mpeg']['audio'];
+
+
+		if ($MPEGaudioHeaderValidCache[$head4]) {
+			$thisfile_mpeg_audio['raw'] = $MPEGheaderRawArray;
+		} else {
+			$info['error'][] = 'Invalid MPEG audio header ('.getid3_lib::PrintHexBytes($head4).') at offset '.$offset;
+			return false;
+		}
+
+		if (!$FastMPEGheaderScan) {
+			$thisfile_mpeg_audio['version']       = $MPEGaudioVersionLookup[$thisfile_mpeg_audio['raw']['version']];
+			$thisfile_mpeg_audio['layer']         = $MPEGaudioLayerLookup[$thisfile_mpeg_audio['raw']['layer']];
+
+			$thisfile_mpeg_audio['channelmode']   = $MPEGaudioChannelModeLookup[$thisfile_mpeg_audio['raw']['channelmode']];
+			$thisfile_mpeg_audio['channels']      = (($thisfile_mpeg_audio['channelmode'] == 'mono') ? 1 : 2);
+			$thisfile_mpeg_audio['sample_rate']   = $MPEGaudioFrequencyLookup[$thisfile_mpeg_audio['version']][$thisfile_mpeg_audio['raw']['sample_rate']];
+			$thisfile_mpeg_audio['protection']    = !$thisfile_mpeg_audio['raw']['protection'];
+			$thisfile_mpeg_audio['private']       = (bool) $thisfile_mpeg_audio['raw']['private'];
+			$thisfile_mpeg_audio['modeextension'] = $MPEGaudioModeExtensionLookup[$thisfile_mpeg_audio['layer']][$thisfile_mpeg_audio['raw']['modeextension']];
+			$thisfile_mpeg_audio['copyright']     = (bool) $thisfile_mpeg_audio['raw']['copyright'];
+			$thisfile_mpeg_audio['original']      = (bool) $thisfile_mpeg_audio['raw']['original'];
+			$thisfile_mpeg_audio['emphasis']      = $MPEGaudioEmphasisLookup[$thisfile_mpeg_audio['raw']['emphasis']];
+
+			$info['audio']['channels']    = $thisfile_mpeg_audio['channels'];
+			$info['audio']['sample_rate'] = $thisfile_mpeg_audio['sample_rate'];
+
+			if ($thisfile_mpeg_audio['protection']) {
+				$thisfile_mpeg_audio['crc'] = getid3_lib::BigEndian2Int(substr($headerstring, 4, 2));
+			}
+		}
+
+		if ($thisfile_mpeg_audio['raw']['bitrate'] == 15) {
+			// http://www.hydrogenaudio.org/?act=ST&f=16&t=9682&st=0
+			$info['warning'][] = 'Invalid bitrate index (15), this is a known bug in free-format MP3s encoded by LAME v3.90 - 3.93.1';
+			$thisfile_mpeg_audio['raw']['bitrate'] = 0;
+		}
+		$thisfile_mpeg_audio['padding'] = (bool) $thisfile_mpeg_audio['raw']['padding'];
+		$thisfile_mpeg_audio['bitrate'] = $MPEGaudioBitrateLookup[$thisfile_mpeg_audio['version']][$thisfile_mpeg_audio['layer']][$thisfile_mpeg_audio['raw']['bitrate']];
+
+		if (($thisfile_mpeg_audio['bitrate'] == 'free') && ($offset == $info['avdataoffset'])) {
+			// only skip multiple frame check if free-format bitstream found at beginning of file
+			// otherwise is quite possibly simply corrupted data
+			$recursivesearch = false;
+		}
+
+		// For Layer 2 there are some combinations of bitrate and mode which are not allowed.
+		if (!$FastMPEGheaderScan && ($thisfile_mpeg_audio['layer'] == '2')) {
+
+			$info['audio']['dataformat'] = 'mp2';
+			switch ($thisfile_mpeg_audio['channelmode']) {
+
+				case 'mono':
+					if (($thisfile_mpeg_audio['bitrate'] == 'free') || ($thisfile_mpeg_audio['bitrate'] <= 192000)) {
+						// these are ok
+					} else {
+						$info['error'][] = $thisfile_mpeg_audio['bitrate'].'kbps not allowed in Layer 2, '.$thisfile_mpeg_audio['channelmode'].'.';
+						return false;
+					}
+					break;
+
+				case 'stereo':
+				case 'joint stereo':
+				case 'dual channel':
+					if (($thisfile_mpeg_audio['bitrate'] == 'free') || ($thisfile_mpeg_audio['bitrate'] == 64000) || ($thisfile_mpeg_audio['bitrate'] >= 96000)) {
+						// these are ok
+					} else {
+						$info['error'][] = intval(round($thisfile_mpeg_audio['bitrate'] / 1000)).'kbps not allowed in Layer 2, '.$thisfile_mpeg_audio['channelmode'].'.';
+						return false;
+					}
+					break;
+
+			}
+
+		}
+
+
+		if ($info['audio']['sample_rate'] > 0) {
+			$thisfile_mpeg_audio['framelength'] = self::MPEGaudioFrameLength($thisfile_mpeg_audio['bitrate'], $thisfile_mpeg_audio['version'], $thisfile_mpeg_audio['layer'], (int) $thisfile_mpeg_audio['padding'], $info['audio']['sample_rate']);
+		}
+
+		$nextframetestoffset = $offset + 1;
+		if ($thisfile_mpeg_audio['bitrate'] != 'free') {
+
+			$info['audio']['bitrate'] = $thisfile_mpeg_audio['bitrate'];
+
+			if (isset($thisfile_mpeg_audio['framelength'])) {
+				$nextframetestoffset = $offset + $thisfile_mpeg_audio['framelength'];
+			} else {
+				$info['error'][] = 'Frame at offset('.$offset.') is has an invalid frame length.';
+				return false;
+			}
+
+		}
+
+		$ExpectedNumberOfAudioBytes = 0;
+
+		////////////////////////////////////////////////////////////////////////////////////
+		// Variable-bitrate headers
+
+		if (substr($headerstring, 4 + 32, 4) == 'VBRI') {
+			// Fraunhofer VBR header is hardcoded 'VBRI' at offset 0x24 (36)
+			// specs taken from http://minnie.tuhs.org/pipermail/mp3encoder/2001-January/001800.html
+
+			$thisfile_mpeg_audio['bitrate_mode'] = 'vbr';
+			$thisfile_mpeg_audio['VBR_method']   = 'Fraunhofer';
+			$info['audio']['codec']                = 'Fraunhofer';
+
+			$SideInfoData = substr($headerstring, 4 + 2, 32);
+
+			$FraunhoferVBROffset = 36;
+
+			$thisfile_mpeg_audio['VBR_encoder_version']     = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset +  4, 2)); // VbriVersion
+			$thisfile_mpeg_audio['VBR_encoder_delay']       = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset +  6, 2)); // VbriDelay
+			$thisfile_mpeg_audio['VBR_quality']             = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset +  8, 2)); // VbriQuality
+			$thisfile_mpeg_audio['VBR_bytes']               = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 10, 4)); // VbriStreamBytes
+			$thisfile_mpeg_audio['VBR_frames']              = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 14, 4)); // VbriStreamFrames
+			$thisfile_mpeg_audio['VBR_seek_offsets']        = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 18, 2)); // VbriTableSize
+			$thisfile_mpeg_audio['VBR_seek_scale']          = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 20, 2)); // VbriTableScale
+			$thisfile_mpeg_audio['VBR_entry_bytes']         = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 22, 2)); // VbriEntryBytes
+			$thisfile_mpeg_audio['VBR_entry_frames']        = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 24, 2)); // VbriEntryFrames
+
+			$ExpectedNumberOfAudioBytes = $thisfile_mpeg_audio['VBR_bytes'];
+
+			$previousbyteoffset = $offset;
+			for ($i = 0; $i < $thisfile_mpeg_audio['VBR_seek_offsets']; $i++) {
+				$Fraunhofer_OffsetN = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset, $thisfile_mpeg_audio['VBR_entry_bytes']));
+				$FraunhoferVBROffset += $thisfile_mpeg_audio['VBR_entry_bytes'];
+				$thisfile_mpeg_audio['VBR_offsets_relative'][$i] = ($Fraunhofer_OffsetN * $thisfile_mpeg_audio['VBR_seek_scale']);
+				$thisfile_mpeg_audio['VBR_offsets_absolute'][$i] = ($Fraunhofer_OffsetN * $thisfile_mpeg_audio['VBR_seek_scale']) + $previousbyteoffset;
+				$previousbyteoffset += $Fraunhofer_OffsetN;
+			}
+
+
+		} else {
+
+			// Xing VBR header is hardcoded 'Xing' at a offset 0x0D (13), 0x15 (21) or 0x24 (36)
+			// depending on MPEG layer and number of channels
+
+			$VBRidOffset = self::XingVBRidOffset($thisfile_mpeg_audio['version'], $thisfile_mpeg_audio['channelmode']);
+			$SideInfoData = substr($headerstring, 4 + 2, $VBRidOffset - 4);
+
+			if ((substr($headerstring, $VBRidOffset, strlen('Xing')) == 'Xing') || (substr($headerstring, $VBRidOffset, strlen('Info')) == 'Info')) {
+				// 'Xing' is traditional Xing VBR frame
+				// 'Info' is LAME-encoded CBR (This was done to avoid CBR files to be recognized as traditional Xing VBR files by some decoders.)
+				// 'Info' *can* legally be used to specify a VBR file as well, however.
+
+				// http://www.multiweb.cz/twoinches/MP3inside.htm
+				//00..03 = "Xing" or "Info"
+				//04..07 = Flags:
+				//  0x01  Frames Flag     set if value for number of frames in file is stored
+				//  0x02  Bytes Flag      set if value for filesize in bytes is stored
+				//  0x04  TOC Flag        set if values for TOC are stored
+				//  0x08  VBR Scale Flag  set if values for VBR scale is stored
+				//08..11  Frames: Number of frames in file (including the first Xing/Info one)
+				//12..15  Bytes:  File length in Bytes
+				//16..115  TOC (Table of Contents):
+				//  Contains of 100 indexes (one Byte length) for easier lookup in file. Approximately solves problem with moving inside file.
+				//  Each Byte has a value according this formula:
+				//  (TOC[i] / 256) * fileLenInBytes
+				//  So if song lasts eg. 240 sec. and you want to jump to 60. sec. (and file is 5 000 000 Bytes length) you can use:
+				//  TOC[(60/240)*100] = TOC[25]
+				//  and corresponding Byte in file is then approximately at:
+				//  (TOC[25]/256) * 5000000
+				//116..119  VBR Scale
+
+
+				// should be safe to leave this at 'vbr' and let it be overriden to 'cbr' if a CBR preset/mode is used by LAME
+//				if (substr($headerstring, $VBRidOffset, strlen('Info')) == 'Xing') {
+					$thisfile_mpeg_audio['bitrate_mode'] = 'vbr';
+					$thisfile_mpeg_audio['VBR_method']   = 'Xing';
+//				} else {
+//					$ScanAsCBR = true;
+//					$thisfile_mpeg_audio['bitrate_mode'] = 'cbr';
+//				}
+
+				$thisfile_mpeg_audio['xing_flags_raw'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 4, 4));
+
+				$thisfile_mpeg_audio['xing_flags']['frames']    = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000001);
+				$thisfile_mpeg_audio['xing_flags']['bytes']     = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000002);
+				$thisfile_mpeg_audio['xing_flags']['toc']       = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000004);
+				$thisfile_mpeg_audio['xing_flags']['vbr_scale'] = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000008);
+
+				if ($thisfile_mpeg_audio['xing_flags']['frames']) {
+					$thisfile_mpeg_audio['VBR_frames'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset +  8, 4));
+					//$thisfile_mpeg_audio['VBR_frames']--; // don't count header Xing/Info frame
+				}
+				if ($thisfile_mpeg_audio['xing_flags']['bytes']) {
+					$thisfile_mpeg_audio['VBR_bytes']  = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 12, 4));
+				}
+
+				//if (($thisfile_mpeg_audio['bitrate'] == 'free') && !empty($thisfile_mpeg_audio['VBR_frames']) && !empty($thisfile_mpeg_audio['VBR_bytes'])) {
+				if (!empty($thisfile_mpeg_audio['VBR_frames']) && !empty($thisfile_mpeg_audio['VBR_bytes'])) {
+
+					$framelengthfloat = $thisfile_mpeg_audio['VBR_bytes'] / $thisfile_mpeg_audio['VBR_frames'];
+
+					if ($thisfile_mpeg_audio['layer'] == '1') {
+						// BitRate = (((FrameLengthInBytes / 4) - Padding) * SampleRate) / 12
+						//$info['audio']['bitrate'] = ((($framelengthfloat / 4) - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 12;
+						$info['audio']['bitrate'] = ($framelengthfloat / 4) * $thisfile_mpeg_audio['sample_rate'] * (2 / $info['audio']['channels']) / 12;
+					} else {
+						// Bitrate = ((FrameLengthInBytes - Padding) * SampleRate) / 144
+						//$info['audio']['bitrate'] = (($framelengthfloat - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 144;
+						$info['audio']['bitrate'] = $framelengthfloat * $thisfile_mpeg_audio['sample_rate'] * (2 / $info['audio']['channels']) / 144;
+					}
+					$thisfile_mpeg_audio['framelength'] = floor($framelengthfloat);
+				}
+
+				if ($thisfile_mpeg_audio['xing_flags']['toc']) {
+					$LAMEtocData = substr($headerstring, $VBRidOffset + 16, 100);
+					for ($i = 0; $i < 100; $i++) {
+						$thisfile_mpeg_audio['toc'][$i] = ord($LAMEtocData{$i});
+					}
+				}
+				if ($thisfile_mpeg_audio['xing_flags']['vbr_scale']) {
+					$thisfile_mpeg_audio['VBR_scale'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 116, 4));
+				}
+
+
+				// http://gabriel.mp3-tech.org/mp3infotag.html
+				if (substr($headerstring, $VBRidOffset + 120, 4) == 'LAME') {
+
+					// shortcut
+					$thisfile_mpeg_audio['LAME'] = array();
+					$thisfile_mpeg_audio_lame    = &$thisfile_mpeg_audio['LAME'];
+
+
+					$thisfile_mpeg_audio_lame['long_version']  = substr($headerstring, $VBRidOffset + 120, 20);
+					$thisfile_mpeg_audio_lame['short_version'] = substr($thisfile_mpeg_audio_lame['long_version'], 0, 9);
+
+					if ($thisfile_mpeg_audio_lame['short_version'] >= 'LAME3.90') {
+
+						// extra 11 chars are not part of version string when LAMEtag present
+						unset($thisfile_mpeg_audio_lame['long_version']);
+
+						// It the LAME tag was only introduced in LAME v3.90
+						// http://www.hydrogenaudio.org/?act=ST&f=15&t=9933
+
+						// Offsets of various bytes in http://gabriel.mp3-tech.org/mp3infotag.html
+						// are assuming a 'Xing' identifier offset of 0x24, which is the case for
+						// MPEG-1 non-mono, but not for other combinations
+						$LAMEtagOffsetContant = $VBRidOffset - 0x24;
+
+						// shortcuts
+						$thisfile_mpeg_audio_lame['RGAD']    = array('track'=>array(), 'album'=>array());
+						$thisfile_mpeg_audio_lame_RGAD       = &$thisfile_mpeg_audio_lame['RGAD'];
+						$thisfile_mpeg_audio_lame_RGAD_track = &$thisfile_mpeg_audio_lame_RGAD['track'];
+						$thisfile_mpeg_audio_lame_RGAD_album = &$thisfile_mpeg_audio_lame_RGAD['album'];
+						$thisfile_mpeg_audio_lame['raw'] = array();
+						$thisfile_mpeg_audio_lame_raw    = &$thisfile_mpeg_audio_lame['raw'];
+
+						// byte $9B  VBR Quality
+						// This field is there to indicate a quality level, although the scale was not precised in the original Xing specifications.
+						// Actually overwrites original Xing bytes
+						unset($thisfile_mpeg_audio['VBR_scale']);
+						$thisfile_mpeg_audio_lame['vbr_quality'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0x9B, 1));
+
+						// bytes $9C-$A4  Encoder short VersionString
+						$thisfile_mpeg_audio_lame['short_version'] = substr($headerstring, $LAMEtagOffsetContant + 0x9C, 9);
+
+						// byte $A5  Info Tag revision + VBR method
+						$LAMEtagRevisionVBRmethod = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xA5, 1));
+
+						$thisfile_mpeg_audio_lame['tag_revision']   = ($LAMEtagRevisionVBRmethod & 0xF0) >> 4;
+						$thisfile_mpeg_audio_lame_raw['vbr_method'] =  $LAMEtagRevisionVBRmethod & 0x0F;
+						$thisfile_mpeg_audio_lame['vbr_method']     = self::LAMEvbrMethodLookup($thisfile_mpeg_audio_lame_raw['vbr_method']);
+						$thisfile_mpeg_audio['bitrate_mode']        = substr($thisfile_mpeg_audio_lame['vbr_method'], 0, 3); // usually either 'cbr' or 'vbr', but truncates 'vbr-old / vbr-rh' to 'vbr'
+
+						// byte $A6  Lowpass filter value
+						$thisfile_mpeg_audio_lame['lowpass_frequency'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xA6, 1)) * 100;
+
+						// bytes $A7-$AE  Replay Gain
+						// http://privatewww.essex.ac.uk/~djmrob/replaygain/rg_data_format.html
+						// bytes $A7-$AA : 32 bit floating point "Peak signal amplitude"
+						if ($thisfile_mpeg_audio_lame['short_version'] >= 'LAME3.94b') {
+							// LAME 3.94a16 and later - 9.23 fixed point
+							// ie 0x0059E2EE / (2^23) = 5890798 / 8388608 = 0.7022378444671630859375
+							$thisfile_mpeg_audio_lame_RGAD['peak_amplitude'] = (float) ((getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xA7, 4))) / 8388608);
+						} else {
+							// LAME 3.94a15 and earlier - 32-bit floating point
+							// Actually 3.94a16 will fall in here too and be WRONG, but is hard to detect 3.94a16 vs 3.94a15
+							$thisfile_mpeg_audio_lame_RGAD['peak_amplitude'] = getid3_lib::LittleEndian2Float(substr($headerstring, $LAMEtagOffsetContant + 0xA7, 4));
+						}
+						if ($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'] == 0) {
+							unset($thisfile_mpeg_audio_lame_RGAD['peak_amplitude']);
+						} else {
+							$thisfile_mpeg_audio_lame_RGAD['peak_db'] = getid3_lib::RGADamplitude2dB($thisfile_mpeg_audio_lame_RGAD['peak_amplitude']);
+						}
+
+						$thisfile_mpeg_audio_lame_raw['RGAD_track']      =   getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAB, 2));
+						$thisfile_mpeg_audio_lame_raw['RGAD_album']      =   getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAD, 2));
+
+
+						if ($thisfile_mpeg_audio_lame_raw['RGAD_track'] != 0) {
+
+							$thisfile_mpeg_audio_lame_RGAD_track['raw']['name']        = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0xE000) >> 13;
+							$thisfile_mpeg_audio_lame_RGAD_track['raw']['originator']  = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x1C00) >> 10;
+							$thisfile_mpeg_audio_lame_RGAD_track['raw']['sign_bit']    = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x0200) >> 9;
+							$thisfile_mpeg_audio_lame_RGAD_track['raw']['gain_adjust'] =  $thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x01FF;
+							$thisfile_mpeg_audio_lame_RGAD_track['name']       = getid3_lib::RGADnameLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['name']);
+							$thisfile_mpeg_audio_lame_RGAD_track['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['originator']);
+							$thisfile_mpeg_audio_lame_RGAD_track['gain_db']    = getid3_lib::RGADadjustmentLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['gain_adjust'], $thisfile_mpeg_audio_lame_RGAD_track['raw']['sign_bit']);
+
+							if (!empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) {
+								$info['replay_gain']['track']['peak']   = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'];
+							}
+							$info['replay_gain']['track']['originator'] = $thisfile_mpeg_audio_lame_RGAD_track['originator'];
+							$info['replay_gain']['track']['adjustment'] = $thisfile_mpeg_audio_lame_RGAD_track['gain_db'];
+						} else {
+							unset($thisfile_mpeg_audio_lame_RGAD['track']);
+						}
+						if ($thisfile_mpeg_audio_lame_raw['RGAD_album'] != 0) {
+
+							$thisfile_mpeg_audio_lame_RGAD_album['raw']['name']        = ($thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0xE000) >> 13;
+							$thisfile_mpeg_audio_lame_RGAD_album['raw']['originator']  = ($thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0x1C00) >> 10;
+							$thisfile_mpeg_audio_lame_RGAD_album['raw']['sign_bit']    = ($thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0x0200) >> 9;
+							$thisfile_mpeg_audio_lame_RGAD_album['raw']['gain_adjust'] = $thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0x01FF;
+							$thisfile_mpeg_audio_lame_RGAD_album['name']       = getid3_lib::RGADnameLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['name']);
+							$thisfile_mpeg_audio_lame_RGAD_album['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['originator']);
+							$thisfile_mpeg_audio_lame_RGAD_album['gain_db']    = getid3_lib::RGADadjustmentLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['gain_adjust'], $thisfile_mpeg_audio_lame_RGAD_album['raw']['sign_bit']);
+
+							if (!empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) {
+								$info['replay_gain']['album']['peak']   = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'];
+							}
+							$info['replay_gain']['album']['originator'] = $thisfile_mpeg_audio_lame_RGAD_album['originator'];
+							$info['replay_gain']['album']['adjustment'] = $thisfile_mpeg_audio_lame_RGAD_album['gain_db'];
+						} else {
+							unset($thisfile_mpeg_audio_lame_RGAD['album']);
+						}
+						if (empty($thisfile_mpeg_audio_lame_RGAD)) {
+							unset($thisfile_mpeg_audio_lame['RGAD']);
+						}
+
+
+						// byte $AF  Encoding flags + ATH Type
+						$EncodingFlagsATHtype = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAF, 1));
+						$thisfile_mpeg_audio_lame['encoding_flags']['nspsytune']   = (bool) ($EncodingFlagsATHtype & 0x10);
+						$thisfile_mpeg_audio_lame['encoding_flags']['nssafejoint'] = (bool) ($EncodingFlagsATHtype & 0x20);
+						$thisfile_mpeg_audio_lame['encoding_flags']['nogap_next']  = (bool) ($EncodingFlagsATHtype & 0x40);
+						$thisfile_mpeg_audio_lame['encoding_flags']['nogap_prev']  = (bool) ($EncodingFlagsATHtype & 0x80);
+						$thisfile_mpeg_audio_lame['ath_type']                      =         $EncodingFlagsATHtype & 0x0F;
+
+						// byte $B0  if ABR {specified bitrate} else {minimal bitrate}
+						$thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB0, 1));
+						if ($thisfile_mpeg_audio_lame_raw['vbr_method'] == 2) { // Average BitRate (ABR)
+							$thisfile_mpeg_audio_lame['bitrate_abr'] = $thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate'];
+						} elseif ($thisfile_mpeg_audio_lame_raw['vbr_method'] == 1) { // Constant BitRate (CBR)
+							// ignore
+						} elseif ($thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate'] > 0) { // Variable BitRate (VBR) - minimum bitrate
+							$thisfile_mpeg_audio_lame['bitrate_min'] = $thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate'];
+						}
+
+						// bytes $B1-$B3  Encoder delays
+						$EncoderDelays = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB1, 3));
+						$thisfile_mpeg_audio_lame['encoder_delay'] = ($EncoderDelays & 0xFFF000) >> 12;
+						$thisfile_mpeg_audio_lame['end_padding']   =  $EncoderDelays & 0x000FFF;
+
+						// byte $B4  Misc
+						$MiscByte = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB4, 1));
+						$thisfile_mpeg_audio_lame_raw['noise_shaping']       = ($MiscByte & 0x03);
+						$thisfile_mpeg_audio_lame_raw['stereo_mode']         = ($MiscByte & 0x1C) >> 2;
+						$thisfile_mpeg_audio_lame_raw['not_optimal_quality'] = ($MiscByte & 0x20) >> 5;
+						$thisfile_mpeg_audio_lame_raw['source_sample_freq']  = ($MiscByte & 0xC0) >> 6;
+						$thisfile_mpeg_audio_lame['noise_shaping']       = $thisfile_mpeg_audio_lame_raw['noise_shaping'];
+						$thisfile_mpeg_audio_lame['stereo_mode']         = self::LAMEmiscStereoModeLookup($thisfile_mpeg_audio_lame_raw['stereo_mode']);
+						$thisfile_mpeg_audio_lame['not_optimal_quality'] = (bool) $thisfile_mpeg_audio_lame_raw['not_optimal_quality'];
+						$thisfile_mpeg_audio_lame['source_sample_freq']  = self::LAMEmiscSourceSampleFrequencyLookup($thisfile_mpeg_audio_lame_raw['source_sample_freq']);
+
+						// byte $B5  MP3 Gain
+						$thisfile_mpeg_audio_lame_raw['mp3_gain'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB5, 1), false, true);
+						$thisfile_mpeg_audio_lame['mp3_gain_db']     = (getid3_lib::RGADamplitude2dB(2) / 4) * $thisfile_mpeg_audio_lame_raw['mp3_gain'];
+						$thisfile_mpeg_audio_lame['mp3_gain_factor'] = pow(2, ($thisfile_mpeg_audio_lame['mp3_gain_db'] / 6));
+
+						// bytes $B6-$B7  Preset and surround info
+						$PresetSurroundBytes = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB6, 2));
+						// Reserved                                                    = ($PresetSurroundBytes & 0xC000);
+						$thisfile_mpeg_audio_lame_raw['surround_info'] = ($PresetSurroundBytes & 0x3800);
+						$thisfile_mpeg_audio_lame['surround_info']     = self::LAMEsurroundInfoLookup($thisfile_mpeg_audio_lame_raw['surround_info']);
+						$thisfile_mpeg_audio_lame['preset_used_id']    = ($PresetSurroundBytes & 0x07FF);
+						$thisfile_mpeg_audio_lame['preset_used']       = self::LAMEpresetUsedLookup($thisfile_mpeg_audio_lame);
+						if (!empty($thisfile_mpeg_audio_lame['preset_used_id']) && empty($thisfile_mpeg_audio_lame['preset_used'])) {
+							$info['warning'][] = 'Unknown LAME preset used ('.$thisfile_mpeg_audio_lame['preset_used_id'].') - please report to info@getid3.org';
+						}
+						if (($thisfile_mpeg_audio_lame['short_version'] == 'LAME3.90.') && !empty($thisfile_mpeg_audio_lame['preset_used_id'])) {
+							// this may change if 3.90.4 ever comes out
+							$thisfile_mpeg_audio_lame['short_version'] = 'LAME3.90.3';
+						}
+
+						// bytes $B8-$BB  MusicLength
+						$thisfile_mpeg_audio_lame['audio_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB8, 4));
+						$ExpectedNumberOfAudioBytes = (($thisfile_mpeg_audio_lame['audio_bytes'] > 0) ? $thisfile_mpeg_audio_lame['audio_bytes'] : $thisfile_mpeg_audio['VBR_bytes']);
+
+						// bytes $BC-$BD  MusicCRC
+						$thisfile_mpeg_audio_lame['music_crc']    = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xBC, 2));
+
+						// bytes $BE-$BF  CRC-16 of Info Tag
+						$thisfile_mpeg_audio_lame['lame_tag_crc'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xBE, 2));
+
+
+						// LAME CBR
+						if ($thisfile_mpeg_audio_lame_raw['vbr_method'] == 1) {
+
+							$thisfile_mpeg_audio['bitrate_mode'] = 'cbr';
+							$thisfile_mpeg_audio['bitrate'] = self::ClosestStandardMP3Bitrate($thisfile_mpeg_audio['bitrate']);
+							$info['audio']['bitrate'] = $thisfile_mpeg_audio['bitrate'];
+							//if (empty($thisfile_mpeg_audio['bitrate']) || (!empty($thisfile_mpeg_audio_lame['bitrate_min']) && ($thisfile_mpeg_audio_lame['bitrate_min'] != 255))) {
+							//	$thisfile_mpeg_audio['bitrate'] = $thisfile_mpeg_audio_lame['bitrate_min'];
+							//}
+
+						}
+
+					}
+				}
+
+			} else {
+
+				// not Fraunhofer or Xing VBR methods, most likely CBR (but could be VBR with no header)
+				$thisfile_mpeg_audio['bitrate_mode'] = 'cbr';
+				if ($recursivesearch) {
+					$thisfile_mpeg_audio['bitrate_mode'] = 'vbr';
+					if ($this->RecursiveFrameScanning($offset, $nextframetestoffset, true)) {
+						$recursivesearch = false;
+						$thisfile_mpeg_audio['bitrate_mode'] = 'cbr';
+					}
+					if ($thisfile_mpeg_audio['bitrate_mode'] == 'vbr') {
+						$info['warning'][] = 'VBR file with no VBR header. Bitrate values calculated from actual frame bitrates.';
+					}
+				}
+
+			}
+
+		}
+
+		if (($ExpectedNumberOfAudioBytes > 0) && ($ExpectedNumberOfAudioBytes != ($info['avdataend'] - $info['avdataoffset']))) {
+			if ($ExpectedNumberOfAudioBytes > ($info['avdataend'] - $info['avdataoffset'])) {
+				if (isset($info['fileformat']) && ($info['fileformat'] == 'riff')) {
+					// ignore, audio data is broken into chunks so will always be data "missing"
+				} elseif (($ExpectedNumberOfAudioBytes - ($info['avdataend'] - $info['avdataoffset'])) == 1) {
+					$info['warning'][] = 'Last byte of data truncated (this is a known bug in Meracl ID3 Tag Writer before v1.3.5)';
+				} else {
+					$info['warning'][] = 'Probable truncated file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, only found '.($info['avdataend'] - $info['avdataoffset']).' (short by '.($ExpectedNumberOfAudioBytes - ($info['avdataend'] - $info['avdataoffset'])).' bytes)';
+				}
+			} else {
+				if ((($info['avdataend'] - $info['avdataoffset']) - $ExpectedNumberOfAudioBytes) == 1) {
+				//	$prenullbytefileoffset = ftell($this->getid3->fp);
+				//	fseek($this->getid3->fp, $info['avdataend'], SEEK_SET);
+				//	$PossibleNullByte = fread($this->getid3->fp, 1);
+				//	fseek($this->getid3->fp, $prenullbytefileoffset, SEEK_SET);
+				//	if ($PossibleNullByte === "\x00") {
+						$info['avdataend']--;
+				//		$info['warning'][] = 'Extra null byte at end of MP3 data assumed to be RIFF padding and therefore ignored';
+				//	} else {
+				//		$info['warning'][] = 'Too much data in file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, found '.($info['avdataend'] - $info['avdataoffset']).' ('.(($info['avdataend'] - $info['avdataoffset']) - $ExpectedNumberOfAudioBytes).' bytes too many)';
+				//	}
+				} else {
+					$info['warning'][] = 'Too much data in file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, found '.($info['avdataend'] - $info['avdataoffset']).' ('.(($info['avdataend'] - $info['avdataoffset']) - $ExpectedNumberOfAudioBytes).' bytes too many)';
+				}
+			}
+		}
+
+		if (($thisfile_mpeg_audio['bitrate'] == 'free') && empty($info['audio']['bitrate'])) {
+			if (($offset == $info['avdataoffset']) && empty($thisfile_mpeg_audio['VBR_frames'])) {
+				$framebytelength = $this->FreeFormatFrameLength($offset, true);
+				if ($framebytelength > 0) {
+					$thisfile_mpeg_audio['framelength'] = $framebytelength;
+					if ($thisfile_mpeg_audio['layer'] == '1') {
+						// BitRate = (((FrameLengthInBytes / 4) - Padding) * SampleRate) / 12
+						$info['audio']['bitrate'] = ((($framebytelength / 4) - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 12;
+					} else {
+						// Bitrate = ((FrameLengthInBytes - Padding) * SampleRate) / 144
+						$info['audio']['bitrate'] = (($framebytelength - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 144;
+					}
+				} else {
+					$info['error'][] = 'Error calculating frame length of free-format MP3 without Xing/LAME header';
+				}
+			}
+		}
+
+		if (isset($thisfile_mpeg_audio['VBR_frames']) ? $thisfile_mpeg_audio['VBR_frames'] : '') {
+			switch ($thisfile_mpeg_audio['bitrate_mode']) {
+				case 'vbr':
+				case 'abr':
+					$bytes_per_frame = 1152;
+					if (($thisfile_mpeg_audio['version'] == '1') && ($thisfile_mpeg_audio['layer'] == 1)) {
+						$bytes_per_frame = 384;
+					} elseif ((($thisfile_mpeg_audio['version'] == '2') || ($thisfile_mpeg_audio['version'] == '2.5')) && ($thisfile_mpeg_audio['layer'] == 3)) {
+						$bytes_per_frame = 576;
+					}
+					$thisfile_mpeg_audio['VBR_bitrate'] = (isset($thisfile_mpeg_audio['VBR_bytes']) ? (($thisfile_mpeg_audio['VBR_bytes'] / $thisfile_mpeg_audio['VBR_frames']) * 8) * ($info['audio']['sample_rate'] / $bytes_per_frame) : 0);
+					if ($thisfile_mpeg_audio['VBR_bitrate'] > 0) {
+						$info['audio']['bitrate']         = $thisfile_mpeg_audio['VBR_bitrate'];
+						$thisfile_mpeg_audio['bitrate'] = $thisfile_mpeg_audio['VBR_bitrate']; // to avoid confusion
+					}
+					break;
+			}
+		}
+
+		// End variable-bitrate headers
+		////////////////////////////////////////////////////////////////////////////////////
+
+		if ($recursivesearch) {
+
+			if (!$this->RecursiveFrameScanning($offset, $nextframetestoffset, $ScanAsCBR)) {
+				return false;
+			}
+
+		}
+
+
+		//if (false) {
+		//    // experimental side info parsing section - not returning anything useful yet
+		//
+		//    $SideInfoBitstream = getid3_lib::BigEndian2Bin($SideInfoData);
+		//    $SideInfoOffset = 0;
+		//
+		//    if ($thisfile_mpeg_audio['version'] == '1') {
+		//        if ($thisfile_mpeg_audio['channelmode'] == 'mono') {
+		//            // MPEG-1 (mono)
+		//            $thisfile_mpeg_audio['side_info']['main_data_begin'] = substr($SideInfoBitstream, $SideInfoOffset, 9);
+		//            $SideInfoOffset += 9;
+		//            $SideInfoOffset += 5;
+		//        } else {
+		//            // MPEG-1 (stereo, joint-stereo, dual-channel)
+		//            $thisfile_mpeg_audio['side_info']['main_data_begin'] = substr($SideInfoBitstream, $SideInfoOffset, 9);
+		//            $SideInfoOffset += 9;
+		//            $SideInfoOffset += 3;
+		//        }
+		//    } else { // 2 or 2.5
+		//        if ($thisfile_mpeg_audio['channelmode'] == 'mono') {
+		//            // MPEG-2, MPEG-2.5 (mono)
+		//            $thisfile_mpeg_audio['side_info']['main_data_begin'] = substr($SideInfoBitstream, $SideInfoOffset, 8);
+		//            $SideInfoOffset += 8;
+		//            $SideInfoOffset += 1;
+		//        } else {
+		//            // MPEG-2, MPEG-2.5 (stereo, joint-stereo, dual-channel)
+		//            $thisfile_mpeg_audio['side_info']['main_data_begin'] = substr($SideInfoBitstream, $SideInfoOffset, 8);
+		//            $SideInfoOffset += 8;
+		//            $SideInfoOffset += 2;
+		//        }
+		//    }
+		//
+		//    if ($thisfile_mpeg_audio['version'] == '1') {
+		//        for ($channel = 0; $channel < $info['audio']['channels']; $channel++) {
+		//            for ($scfsi_band = 0; $scfsi_band < 4; $scfsi_band++) {
+		//                $thisfile_mpeg_audio['scfsi'][$channel][$scfsi_band] = substr($SideInfoBitstream, $SideInfoOffset, 1);
+		//                $SideInfoOffset += 2;
+		//            }
+		//        }
+		//    }
+		//    for ($granule = 0; $granule < (($thisfile_mpeg_audio['version'] == '1') ? 2 : 1); $granule++) {
+		//        for ($channel = 0; $channel < $info['audio']['channels']; $channel++) {
+		//            $thisfile_mpeg_audio['part2_3_length'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 12);
+		//            $SideInfoOffset += 12;
+		//            $thisfile_mpeg_audio['big_values'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 9);
+		//            $SideInfoOffset += 9;
+		//            $thisfile_mpeg_audio['global_gain'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 8);
+		//            $SideInfoOffset += 8;
+		//            if ($thisfile_mpeg_audio['version'] == '1') {
+		//                $thisfile_mpeg_audio['scalefac_compress'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 4);
+		//                $SideInfoOffset += 4;
+		//            } else {
+		//                $thisfile_mpeg_audio['scalefac_compress'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 9);
+		//                $SideInfoOffset += 9;
+		//            }
+		//            $thisfile_mpeg_audio['window_switching_flag'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1);
+		//            $SideInfoOffset += 1;
+		//
+		//            if ($thisfile_mpeg_audio['window_switching_flag'][$granule][$channel] == '1') {
+		//
+		//                $thisfile_mpeg_audio['block_type'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 2);
+		//                $SideInfoOffset += 2;
+		//                $thisfile_mpeg_audio['mixed_block_flag'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1);
+		//                $SideInfoOffset += 1;
+		//
+		//                for ($region = 0; $region < 2; $region++) {
+		//                    $thisfile_mpeg_audio['table_select'][$granule][$channel][$region] = substr($SideInfoBitstream, $SideInfoOffset, 5);
+		//                    $SideInfoOffset += 5;
+		//                }
+		//                $thisfile_mpeg_audio['table_select'][$granule][$channel][2] = 0;
+		//
+		//                for ($window = 0; $window < 3; $window++) {
+		//                    $thisfile_mpeg_audio['subblock_gain'][$granule][$channel][$window] = substr($SideInfoBitstream, $SideInfoOffset, 3);
+		//                    $SideInfoOffset += 3;
+		//                }
+		//
+		//            } else {
+		//
+		//                for ($region = 0; $region < 3; $region++) {
+		//                    $thisfile_mpeg_audio['table_select'][$granule][$channel][$region] = substr($SideInfoBitstream, $SideInfoOffset, 5);
+		//                    $SideInfoOffset += 5;
+		//                }
+		//
+		//                $thisfile_mpeg_audio['region0_count'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 4);
+		//                $SideInfoOffset += 4;
+		//                $thisfile_mpeg_audio['region1_count'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 3);
+		//                $SideInfoOffset += 3;
+		//                $thisfile_mpeg_audio['block_type'][$granule][$channel] = 0;
+		//            }
+		//
+		//            if ($thisfile_mpeg_audio['version'] == '1') {
+		//                $thisfile_mpeg_audio['preflag'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1);
+		//                $SideInfoOffset += 1;
+		//            }
+		//            $thisfile_mpeg_audio['scalefac_scale'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1);
+		//            $SideInfoOffset += 1;
+		//            $thisfile_mpeg_audio['count1table_select'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1);
+		//            $SideInfoOffset += 1;
+		//        }
+		//    }
+		//}
+
+		return true;
+	}
+
+	public function RecursiveFrameScanning(&$offset, &$nextframetestoffset, $ScanAsCBR) {
+		$info = &$this->getid3->info;
+		$firstframetestarray = array('error'=>'', 'warning'=>'', 'avdataend'=>$info['avdataend'], 'avdataoffset'=>$info['avdataoffset']);
+		$this->decodeMPEGaudioHeader($offset, $firstframetestarray, false);
+
+		for ($i = 0; $i < GETID3_MP3_VALID_CHECK_FRAMES; $i++) {
+			// check next GETID3_MP3_VALID_CHECK_FRAMES frames for validity, to make sure we haven't run across a false synch
+			if (($nextframetestoffset + 4) >= $info['avdataend']) {
+				// end of file
+				return true;
+			}
+
+			$nextframetestarray = array('error'=>'', 'warning'=>'', 'avdataend'=>$info['avdataend'], 'avdataoffset'=>$info['avdataoffset']);
+			if ($this->decodeMPEGaudioHeader($nextframetestoffset, $nextframetestarray, false)) {
+				if ($ScanAsCBR) {
+					// force CBR mode, used for trying to pick out invalid audio streams with valid(?) VBR headers, or VBR streams with no VBR header
+					if (!isset($nextframetestarray['mpeg']['audio']['bitrate']) || !isset($firstframetestarray['mpeg']['audio']['bitrate']) || ($nextframetestarray['mpeg']['audio']['bitrate'] != $firstframetestarray['mpeg']['audio']['bitrate'])) {
+						return false;
+					}
+				}
+
+
+				// next frame is OK, get ready to check the one after that
+				if (isset($nextframetestarray['mpeg']['audio']['framelength']) && ($nextframetestarray['mpeg']['audio']['framelength'] > 0)) {
+					$nextframetestoffset += $nextframetestarray['mpeg']['audio']['framelength'];
+				} else {
+					$info['error'][] = 'Frame at offset ('.$offset.') is has an invalid frame length.';
+					return false;
+				}
+
+			} elseif (!empty($firstframetestarray['mpeg']['audio']['framelength']) && (($nextframetestoffset + $firstframetestarray['mpeg']['audio']['framelength']) > $info['avdataend'])) {
+
+				// it's not the end of the file, but there's not enough data left for another frame, so assume it's garbage/padding and return OK
+				return true;
+
+			} else {
+
+				// next frame is not valid, note the error and fail, so scanning can contiue for a valid frame sequence
+				$info['warning'][] = 'Frame at offset ('.$offset.') is valid, but the next one at ('.$nextframetestoffset.') is not.';
+
+				return false;
+			}
+		}
+		return true;
+	}
+
+	public function FreeFormatFrameLength($offset, $deepscan=false) {
+		$info = &$this->getid3->info;
+
+		fseek($this->getid3->fp, $offset, SEEK_SET);
+		$MPEGaudioData = fread($this->getid3->fp, 32768);
+
+		$SyncPattern1 = substr($MPEGaudioData, 0, 4);
+		// may be different pattern due to padding
+		$SyncPattern2 = $SyncPattern1{0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) | 0x02).$SyncPattern1{3};
+		if ($SyncPattern2 === $SyncPattern1) {
+			$SyncPattern2 = $SyncPattern1{0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) & 0xFD).$SyncPattern1{3};
+		}
+
+		$framelength = false;
+		$framelength1 = strpos($MPEGaudioData, $SyncPattern1, 4);
+		$framelength2 = strpos($MPEGaudioData, $SyncPattern2, 4);
+		if ($framelength1 > 4) {
+			$framelength = $framelength1;
+		}
+		if (($framelength2 > 4) && ($framelength2 < $framelength1)) {
+			$framelength = $framelength2;
+		}
+		if (!$framelength) {
+
+			// LAME 3.88 has a different value for modeextension on the first frame vs the rest
+			$framelength1 = strpos($MPEGaudioData, substr($SyncPattern1, 0, 3), 4);
+			$framelength2 = strpos($MPEGaudioData, substr($SyncPattern2, 0, 3), 4);
+
+			if ($framelength1 > 4) {
+				$framelength = $framelength1;
+			}
+			if (($framelength2 > 4) && ($framelength2 < $framelength1)) {
+				$framelength = $framelength2;
+			}
+			if (!$framelength) {
+				$info['error'][] = 'Cannot find next free-format synch pattern ('.getid3_lib::PrintHexBytes($SyncPattern1).' or '.getid3_lib::PrintHexBytes($SyncPattern2).') after offset '.$offset;
+				return false;
+			} else {
+				$info['warning'][] = 'ModeExtension varies between first frame and other frames (known free-format issue in LAME 3.88)';
+				$info['audio']['codec']   = 'LAME';
+				$info['audio']['encoder'] = 'LAME3.88';
+				$SyncPattern1 = substr($SyncPattern1, 0, 3);
+				$SyncPattern2 = substr($SyncPattern2, 0, 3);
+			}
+		}
+
+		if ($deepscan) {
+
+			$ActualFrameLengthValues = array();
+			$nextoffset = $offset + $framelength;
+			while ($nextoffset < ($info['avdataend'] - 6)) {
+				fseek($this->getid3->fp, $nextoffset - 1, SEEK_SET);
+				$NextSyncPattern = fread($this->getid3->fp, 6);
+				if ((substr($NextSyncPattern, 1, strlen($SyncPattern1)) == $SyncPattern1) || (substr($NextSyncPattern, 1, strlen($SyncPattern2)) == $SyncPattern2)) {
+					// good - found where expected
+					$ActualFrameLengthValues[] = $framelength;
+				} elseif ((substr($NextSyncPattern, 0, strlen($SyncPattern1)) == $SyncPattern1) || (substr($NextSyncPattern, 0, strlen($SyncPattern2)) == $SyncPattern2)) {
+					// ok - found one byte earlier than expected (last frame wasn't padded, first frame was)
+					$ActualFrameLengthValues[] = ($framelength - 1);
+					$nextoffset--;
+				} elseif ((substr($NextSyncPattern, 2, strlen($SyncPattern1)) == $SyncPattern1) || (substr($NextSyncPattern, 2, strlen($SyncPattern2)) == $SyncPattern2)) {
+					// ok - found one byte later than expected (last frame was padded, first frame wasn't)
+					$ActualFrameLengthValues[] = ($framelength + 1);
+					$nextoffset++;
+				} else {
+					$info['error'][] = 'Did not find expected free-format sync pattern at offset '.$nextoffset;
+					return false;
+				}
+				$nextoffset += $framelength;
+			}
+			if (count($ActualFrameLengthValues) > 0) {
+				$framelength = intval(round(array_sum($ActualFrameLengthValues) / count($ActualFrameLengthValues)));
+			}
+		}
+		return $framelength;
+	}
+
+	public function getOnlyMPEGaudioInfoBruteForce() {
+		$MPEGaudioHeaderDecodeCache   = array();
+		$MPEGaudioHeaderValidCache    = array();
+		$MPEGaudioHeaderLengthCache   = array();
+		$MPEGaudioVersionLookup       = self::MPEGaudioVersionArray();
+		$MPEGaudioLayerLookup         = self::MPEGaudioLayerArray();
+		$MPEGaudioBitrateLookup       = self::MPEGaudioBitrateArray();
+		$MPEGaudioFrequencyLookup     = self::MPEGaudioFrequencyArray();
+		$MPEGaudioChannelModeLookup   = self::MPEGaudioChannelModeArray();
+		$MPEGaudioModeExtensionLookup = self::MPEGaudioModeExtensionArray();
+		$MPEGaudioEmphasisLookup      = self::MPEGaudioEmphasisArray();
+		$LongMPEGversionLookup        = array();
+		$LongMPEGlayerLookup          = array();
+		$LongMPEGbitrateLookup        = array();
+		$LongMPEGpaddingLookup        = array();
+		$LongMPEGfrequencyLookup      = array();
+		$Distribution['bitrate']      = array();
+		$Distribution['frequency']    = array();
+		$Distribution['layer']        = array();
+		$Distribution['version']      = array();
+		$Distribution['padding']      = array();
+
+		$info = &$this->getid3->info;
+		fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
+
+		$max_frames_scan = 5000;
+		$frames_scanned  = 0;
+
+		$previousvalidframe = $info['avdataoffset'];
+		while (ftell($this->getid3->fp) < $info['avdataend']) {
+			set_time_limit(30);
+			$head4 = fread($this->getid3->fp, 4);
+			if (strlen($head4) < 4) {
+				break;
+			}
+			if ($head4{0} != "\xFF") {
+				for ($i = 1; $i < 4; $i++) {
+					if ($head4{$i} == "\xFF") {
+						fseek($this->getid3->fp, $i - 4, SEEK_CUR);
+						continue 2;
+					}
+				}
+				continue;
+			}
+			if (!isset($MPEGaudioHeaderDecodeCache[$head4])) {
+				$MPEGaudioHeaderDecodeCache[$head4] = self::MPEGaudioHeaderDecode($head4);
+			}
+			if (!isset($MPEGaudioHeaderValidCache[$head4])) {
+				$MPEGaudioHeaderValidCache[$head4] = self::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$head4], false, false);
+			}
+			if ($MPEGaudioHeaderValidCache[$head4]) {
+
+				if (!isset($MPEGaudioHeaderLengthCache[$head4])) {
+					$LongMPEGversionLookup[$head4]   = $MPEGaudioVersionLookup[$MPEGaudioHeaderDecodeCache[$head4]['version']];
+					$LongMPEGlayerLookup[$head4]     = $MPEGaudioLayerLookup[$MPEGaudioHeaderDecodeCache[$head4]['layer']];
+					$LongMPEGbitrateLookup[$head4]   = $MPEGaudioBitrateLookup[$LongMPEGversionLookup[$head4]][$LongMPEGlayerLookup[$head4]][$MPEGaudioHeaderDecodeCache[$head4]['bitrate']];
+					$LongMPEGpaddingLookup[$head4]   = (bool) $MPEGaudioHeaderDecodeCache[$head4]['padding'];
+					$LongMPEGfrequencyLookup[$head4] = $MPEGaudioFrequencyLookup[$LongMPEGversionLookup[$head4]][$MPEGaudioHeaderDecodeCache[$head4]['sample_rate']];
+					$MPEGaudioHeaderLengthCache[$head4] = self::MPEGaudioFrameLength(
+						$LongMPEGbitrateLookup[$head4],
+						$LongMPEGversionLookup[$head4],
+						$LongMPEGlayerLookup[$head4],
+						$LongMPEGpaddingLookup[$head4],
+						$LongMPEGfrequencyLookup[$head4]);
+				}
+				if ($MPEGaudioHeaderLengthCache[$head4] > 4) {
+					$WhereWeWere = ftell($this->getid3->fp);
+					fseek($this->getid3->fp, $MPEGaudioHeaderLengthCache[$head4] - 4, SEEK_CUR);
+					$next4 = fread($this->getid3->fp, 4);
+					if ($next4{0} == "\xFF") {
+						if (!isset($MPEGaudioHeaderDecodeCache[$next4])) {
+							$MPEGaudioHeaderDecodeCache[$next4] = self::MPEGaudioHeaderDecode($next4);
+						}
+						if (!isset($MPEGaudioHeaderValidCache[$next4])) {
+							$MPEGaudioHeaderValidCache[$next4] = self::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$next4], false, false);
+						}
+						if ($MPEGaudioHeaderValidCache[$next4]) {
+							fseek($this->getid3->fp, -4, SEEK_CUR);
+
+							getid3_lib::safe_inc($Distribution['bitrate'][$LongMPEGbitrateLookup[$head4]]);
+							getid3_lib::safe_inc($Distribution['layer'][$LongMPEGlayerLookup[$head4]]);
+							getid3_lib::safe_inc($Distribution['version'][$LongMPEGversionLookup[$head4]]);
+							getid3_lib::safe_inc($Distribution['padding'][intval($LongMPEGpaddingLookup[$head4])]);
+							getid3_lib::safe_inc($Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]]);
+							if ($max_frames_scan && (++$frames_scanned >= $max_frames_scan)) {
+								$pct_data_scanned = (ftell($this->getid3->fp) - $info['avdataoffset']) / ($info['avdataend'] - $info['avdataoffset']);
+								$info['warning'][] = 'too many MPEG audio frames to scan, only scanned first '.$max_frames_scan.' frames ('.number_format($pct_data_scanned * 100, 1).'% of file) and extrapolated distribution, playtime and bitrate may be incorrect.';
+								foreach ($Distribution as $key1 => $value1) {
+									foreach ($value1 as $key2 => $value2) {
+										$Distribution[$key1][$key2] = round($value2 / $pct_data_scanned);
+									}
+								}
+								break;
+							}
+							continue;
+						}
+					}
+					unset($next4);
+					fseek($this->getid3->fp, $WhereWeWere - 3, SEEK_SET);
+				}
+
+			}
+		}
+		foreach ($Distribution as $key => $value) {
+			ksort($Distribution[$key], SORT_NUMERIC);
+		}
+		ksort($Distribution['version'], SORT_STRING);
+		$info['mpeg']['audio']['bitrate_distribution']   = $Distribution['bitrate'];
+		$info['mpeg']['audio']['frequency_distribution'] = $Distribution['frequency'];
+		$info['mpeg']['audio']['layer_distribution']     = $Distribution['layer'];
+		$info['mpeg']['audio']['version_distribution']   = $Distribution['version'];
+		$info['mpeg']['audio']['padding_distribution']   = $Distribution['padding'];
+		if (count($Distribution['version']) > 1) {
+			$info['error'][] = 'Corrupt file - more than one MPEG version detected';
+		}
+		if (count($Distribution['layer']) > 1) {
+			$info['error'][] = 'Corrupt file - more than one MPEG layer detected';
+		}
+		if (count($Distribution['frequency']) > 1) {
+			$info['error'][] = 'Corrupt file - more than one MPEG sample rate detected';
+		}
+
+
+		$bittotal = 0;
+		foreach ($Distribution['bitrate'] as $bitratevalue => $bitratecount) {
+			if ($bitratevalue != 'free') {
+				$bittotal += ($bitratevalue * $bitratecount);
+			}
+		}
+		$info['mpeg']['audio']['frame_count']  = array_sum($Distribution['bitrate']);
+		if ($info['mpeg']['audio']['frame_count'] == 0) {
+			$info['error'][] = 'no MPEG audio frames found';
+			return false;
+		}
+		$info['mpeg']['audio']['bitrate']      = ($bittotal / $info['mpeg']['audio']['frame_count']);
+		$info['mpeg']['audio']['bitrate_mode'] = ((count($Distribution['bitrate']) > 0) ? 'vbr' : 'cbr');
+		$info['mpeg']['audio']['sample_rate']  = getid3_lib::array_max($Distribution['frequency'], true);
+
+		$info['audio']['bitrate']      = $info['mpeg']['audio']['bitrate'];
+		$info['audio']['bitrate_mode'] = $info['mpeg']['audio']['bitrate_mode'];
+		$info['audio']['sample_rate']  = $info['mpeg']['audio']['sample_rate'];
+		$info['audio']['dataformat']   = 'mp'.getid3_lib::array_max($Distribution['layer'], true);
+		$info['fileformat']            = $info['audio']['dataformat'];
+
+		return true;
+	}
+
+
+	public function getOnlyMPEGaudioInfo($avdataoffset, $BitrateHistogram=false) {
+		// looks for synch, decodes MPEG audio header
+
+		$info = &$this->getid3->info;
+
+		static $MPEGaudioVersionLookup;
+		static $MPEGaudioLayerLookup;
+		static $MPEGaudioBitrateLookup;
+		if (empty($MPEGaudioVersionLookup)) {
+		   $MPEGaudioVersionLookup = self::MPEGaudioVersionArray();
+		   $MPEGaudioLayerLookup   = self::MPEGaudioLayerArray();
+		   $MPEGaudioBitrateLookup = self::MPEGaudioBitrateArray();
+
+		}
+
+		fseek($this->getid3->fp, $avdataoffset, SEEK_SET);
+		$sync_seek_buffer_size = min(128 * 1024, $info['avdataend'] - $avdataoffset);
+		if ($sync_seek_buffer_size <= 0) {
+			$info['error'][] = 'Invalid $sync_seek_buffer_size at offset '.$avdataoffset;
+			return false;
+		}
+		$header = fread($this->getid3->fp, $sync_seek_buffer_size);
+		$sync_seek_buffer_size = strlen($header);
+		$SynchSeekOffset = 0;
+		while ($SynchSeekOffset < $sync_seek_buffer_size) {
+			if ((($avdataoffset + $SynchSeekOffset)  < $info['avdataend']) && !feof($this->getid3->fp)) {
+
+				if ($SynchSeekOffset > $sync_seek_buffer_size) {
+					// if a synch's not found within the first 128k bytes, then give up
+					$info['error'][] = 'Could not find valid MPEG audio synch within the first '.round($sync_seek_buffer_size / 1024).'kB';
+					if (isset($info['audio']['bitrate'])) {
+						unset($info['audio']['bitrate']);
+					}
+					if (isset($info['mpeg']['audio'])) {
+						unset($info['mpeg']['audio']);
+					}
+					if (empty($info['mpeg'])) {
+						unset($info['mpeg']);
+					}
+					return false;
+
+				} elseif (feof($this->getid3->fp)) {
+
+					$info['error'][] = 'Could not find valid MPEG audio synch before end of file';
+					if (isset($info['audio']['bitrate'])) {
+						unset($info['audio']['bitrate']);
+					}
+					if (isset($info['mpeg']['audio'])) {
+						unset($info['mpeg']['audio']);
+					}
+					if (isset($info['mpeg']) && (!is_array($info['mpeg']) || (count($info['mpeg']) == 0))) {
+						unset($info['mpeg']);
+					}
+					return false;
+				}
+			}
+
+			if (($SynchSeekOffset + 1) >= strlen($header)) {
+				$info['error'][] = 'Could not find valid MPEG synch before end of file';
+				return false;
+			}
+
+			if (($header{$SynchSeekOffset} == "\xFF") && ($header{($SynchSeekOffset + 1)} > "\xE0")) { // synch detected
+				if (!isset($FirstFrameThisfileInfo) && !isset($info['mpeg']['audio'])) {
+					$FirstFrameThisfileInfo = $info;
+					$FirstFrameAVDataOffset = $avdataoffset + $SynchSeekOffset;
+					if (!$this->decodeMPEGaudioHeader($FirstFrameAVDataOffset, $FirstFrameThisfileInfo, false)) {
+						// if this is the first valid MPEG-audio frame, save it in case it's a VBR header frame and there's
+						// garbage between this frame and a valid sequence of MPEG-audio frames, to be restored below
+						unset($FirstFrameThisfileInfo);
+					}
+				}
+
+				$dummy = $info; // only overwrite real data if valid header found
+				if ($this->decodeMPEGaudioHeader($avdataoffset + $SynchSeekOffset, $dummy, true)) {
+					$info = $dummy;
+					$info['avdataoffset'] = $avdataoffset + $SynchSeekOffset;
+					switch (isset($info['fileformat']) ? $info['fileformat'] : '') {
+						case '':
+						case 'id3':
+						case 'ape':
+						case 'mp3':
+							$info['fileformat']          = 'mp3';
+							$info['audio']['dataformat'] = 'mp3';
+							break;
+					}
+					if (isset($FirstFrameThisfileInfo['mpeg']['audio']['bitrate_mode']) && ($FirstFrameThisfileInfo['mpeg']['audio']['bitrate_mode'] == 'vbr')) {
+						if (!(abs($info['audio']['bitrate'] - $FirstFrameThisfileInfo['audio']['bitrate']) <= 1)) {
+							// If there is garbage data between a valid VBR header frame and a sequence
+							// of valid MPEG-audio frames the VBR data is no longer discarded.
+							$info = $FirstFrameThisfileInfo;
+							$info['avdataoffset']        = $FirstFrameAVDataOffset;
+							$info['fileformat']          = 'mp3';
+							$info['audio']['dataformat'] = 'mp3';
+							$dummy                       = $info;
+							unset($dummy['mpeg']['audio']);
+							$GarbageOffsetStart = $FirstFrameAVDataOffset + $FirstFrameThisfileInfo['mpeg']['audio']['framelength'];
+							$GarbageOffsetEnd   = $avdataoffset + $SynchSeekOffset;
+							if ($this->decodeMPEGaudioHeader($GarbageOffsetEnd, $dummy, true, true)) {
+								$info = $dummy;
+								$info['avdataoffset'] = $GarbageOffsetEnd;
+								$info['warning'][] = 'apparently-valid VBR header not used because could not find '.GETID3_MP3_VALID_CHECK_FRAMES.' consecutive MPEG-audio frames immediately after VBR header (garbage data for '.($GarbageOffsetEnd - $GarbageOffsetStart).' bytes between '.$GarbageOffsetStart.' and '.$GarbageOffsetEnd.'), but did find valid CBR stream starting at '.$GarbageOffsetEnd;
+							} else {
+								$info['warning'][] = 'using data from VBR header even though could not find '.GETID3_MP3_VALID_CHECK_FRAMES.' consecutive MPEG-audio frames immediately after VBR header (garbage data for '.($GarbageOffsetEnd - $GarbageOffsetStart).' bytes between '.$GarbageOffsetStart.' and '.$GarbageOffsetEnd.')';
+							}
+						}
+					}
+					if (isset($info['mpeg']['audio']['bitrate_mode']) && ($info['mpeg']['audio']['bitrate_mode'] == 'vbr') && !isset($info['mpeg']['audio']['VBR_method'])) {
+						// VBR file with no VBR header
+						$BitrateHistogram = true;
+					}
+
+					if ($BitrateHistogram) {
+
+						$info['mpeg']['audio']['stereo_distribution']  = array('stereo'=>0, 'joint stereo'=>0, 'dual channel'=>0, 'mono'=>0);
+						$info['mpeg']['audio']['version_distribution'] = array('1'=>0, '2'=>0, '2.5'=>0);
+
+						if ($info['mpeg']['audio']['version'] == '1') {
+							if ($info['mpeg']['audio']['layer'] == 3) {
+								$info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 40000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 160000=>0, 192000=>0, 224000=>0, 256000=>0, 320000=>0);
+							} elseif ($info['mpeg']['audio']['layer'] == 2) {
+								$info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 160000=>0, 192000=>0, 224000=>0, 256000=>0, 320000=>0, 384000=>0);
+							} elseif ($info['mpeg']['audio']['layer'] == 1) {
+								$info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 64000=>0, 96000=>0, 128000=>0, 160000=>0, 192000=>0, 224000=>0, 256000=>0, 288000=>0, 320000=>0, 352000=>0, 384000=>0, 416000=>0, 448000=>0);
+							}
+						} elseif ($info['mpeg']['audio']['layer'] == 1) {
+							$info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 144000=>0, 160000=>0, 176000=>0, 192000=>0, 224000=>0, 256000=>0);
+						} else {
+							$info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 8000=>0, 16000=>0, 24000=>0, 32000=>0, 40000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 144000=>0, 160000=>0);
+						}
+
+						$dummy = array('error'=>$info['error'], 'warning'=>$info['warning'], 'avdataend'=>$info['avdataend'], 'avdataoffset'=>$info['avdataoffset']);
+						$synchstartoffset = $info['avdataoffset'];
+						fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
+
+						// you can play with these numbers:
+						$max_frames_scan  = 50000;
+						$max_scan_segments = 10;
+
+						// don't play with these numbers:
+						$FastMode = false;
+						$SynchErrorsFound = 0;
+						$frames_scanned   = 0;
+						$this_scan_segment = 0;
+						$frames_scan_per_segment = ceil($max_frames_scan / $max_scan_segments);
+						$pct_data_scanned = 0;
+						for ($current_segment = 0; $current_segment < $max_scan_segments; $current_segment++) {
+							$frames_scanned_this_segment = 0;
+							if (ftell($this->getid3->fp) >= $info['avdataend']) {
+								break;
+							}
+							$scan_start_offset[$current_segment] = max(ftell($this->getid3->fp), $info['avdataoffset'] + round($current_segment * (($info['avdataend'] - $info['avdataoffset']) / $max_scan_segments)));
+							if ($current_segment > 0) {
+								fseek($this->getid3->fp, $scan_start_offset[$current_segment], SEEK_SET);
+								$buffer_4k = fread($this->getid3->fp, 4096);
+								for ($j = 0; $j < (strlen($buffer_4k) - 4); $j++) {
+									if (($buffer_4k{$j} == "\xFF") && ($buffer_4k{($j + 1)} > "\xE0")) { // synch detected
+										if ($this->decodeMPEGaudioHeader($scan_start_offset[$current_segment] + $j, $dummy, false, false, $FastMode)) {
+											$calculated_next_offset = $scan_start_offset[$current_segment] + $j + $dummy['mpeg']['audio']['framelength'];
+											if ($this->decodeMPEGaudioHeader($calculated_next_offset, $dummy, false, false, $FastMode)) {
+												$scan_start_offset[$current_segment] += $j;
+												break;
+											}
+										}
+									}
+								}
+							}
+							$synchstartoffset = $scan_start_offset[$current_segment];
+							while ($this->decodeMPEGaudioHeader($synchstartoffset, $dummy, false, false, $FastMode)) {
+								$FastMode = true;
+								$thisframebitrate = $MPEGaudioBitrateLookup[$MPEGaudioVersionLookup[$dummy['mpeg']['audio']['raw']['version']]][$MPEGaudioLayerLookup[$dummy['mpeg']['audio']['raw']['layer']]][$dummy['mpeg']['audio']['raw']['bitrate']];
+
+								if (empty($dummy['mpeg']['audio']['framelength'])) {
+									$SynchErrorsFound++;
+									$synchstartoffset++;
+								} else {
+									getid3_lib::safe_inc($info['mpeg']['audio']['bitrate_distribution'][$thisframebitrate]);
+									getid3_lib::safe_inc($info['mpeg']['audio']['stereo_distribution'][$dummy['mpeg']['audio']['channelmode']]);
+									getid3_lib::safe_inc($info['mpeg']['audio']['version_distribution'][$dummy['mpeg']['audio']['version']]);
+									$synchstartoffset += $dummy['mpeg']['audio']['framelength'];
+								}
+								$frames_scanned++;
+								if ($frames_scan_per_segment && (++$frames_scanned_this_segment >= $frames_scan_per_segment)) {
+									$this_pct_scanned = (ftell($this->getid3->fp) - $scan_start_offset[$current_segment]) / ($info['avdataend'] - $info['avdataoffset']);
+									if (($current_segment == 0) && (($this_pct_scanned * $max_scan_segments) >= 1)) {
+										// file likely contains < $max_frames_scan, just scan as one segment
+										$max_scan_segments = 1;
+										$frames_scan_per_segment = $max_frames_scan;
+									} else {
+										$pct_data_scanned += $this_pct_scanned;
+										break;
+									}
+								}
+							}
+						}
+						if ($pct_data_scanned > 0) {
+							$info['warning'][] = 'too many MPEG audio frames to scan, only scanned '.$frames_scanned.' frames in '.$max_scan_segments.' segments ('.number_format($pct_data_scanned * 100, 1).'% of file) and extrapolated distribution, playtime and bitrate may be incorrect.';
+							foreach ($info['mpeg']['audio'] as $key1 => $value1) {
+								if (!preg_match('#_distribution$#i', $key1)) {
+									continue;
+								}
+								foreach ($value1 as $key2 => $value2) {
+									$info['mpeg']['audio'][$key1][$key2] = round($value2 / $pct_data_scanned);
+								}
+							}
+						}
+
+						if ($SynchErrorsFound > 0) {
+							$info['warning'][] = 'Found '.$SynchErrorsFound.' synch errors in histogram analysis';
+							//return false;
+						}
+
+						$bittotal     = 0;
+						$framecounter = 0;
+						foreach ($info['mpeg']['audio']['bitrate_distribution'] as $bitratevalue => $bitratecount) {
+							$framecounter += $bitratecount;
+							if ($bitratevalue != 'free') {
+								$bittotal += ($bitratevalue * $bitratecount);
+							}
+						}
+						if ($framecounter == 0) {
+							$info['error'][] = 'Corrupt MP3 file: framecounter == zero';
+							return false;
+						}
+						$info['mpeg']['audio']['frame_count'] = getid3_lib::CastAsInt($framecounter);
+						$info['mpeg']['audio']['bitrate']     = ($bittotal / $framecounter);
+
+						$info['audio']['bitrate'] = $info['mpeg']['audio']['bitrate'];
+
+
+						// Definitively set VBR vs CBR, even if the Xing/LAME/VBRI header says differently
+						$distinct_bitrates = 0;
+						foreach ($info['mpeg']['audio']['bitrate_distribution'] as $bitrate_value => $bitrate_count) {
+							if ($bitrate_count > 0) {
+								$distinct_bitrates++;
+							}
+						}
+						if ($distinct_bitrates > 1) {
+							$info['mpeg']['audio']['bitrate_mode'] = 'vbr';
+						} else {
+							$info['mpeg']['audio']['bitrate_mode'] = 'cbr';
+						}
+						$info['audio']['bitrate_mode'] = $info['mpeg']['audio']['bitrate_mode'];
+
+					}
+
+					break; // exit while()
+				}
+			}
+
+			$SynchSeekOffset++;
+			if (($avdataoffset + $SynchSeekOffset) >= $info['avdataend']) {
+				// end of file/data
+
+				if (empty($info['mpeg']['audio'])) {
+
+					$info['error'][] = 'could not find valid MPEG synch before end of file';
+					if (isset($info['audio']['bitrate'])) {
+						unset($info['audio']['bitrate']);
+					}
+					if (isset($info['mpeg']['audio'])) {
+						unset($info['mpeg']['audio']);
+					}
+					if (isset($info['mpeg']) && (!is_array($info['mpeg']) || empty($info['mpeg']))) {
+						unset($info['mpeg']);
+					}
+					return false;
+
+				}
+				break;
+			}
+
+		}
+		$info['audio']['channels']        = $info['mpeg']['audio']['channels'];
+		$info['audio']['channelmode']     = $info['mpeg']['audio']['channelmode'];
+		$info['audio']['sample_rate']     = $info['mpeg']['audio']['sample_rate'];
+		return true;
+	}
+
+
+	public static function MPEGaudioVersionArray() {
+		static $MPEGaudioVersion = array('2.5', false, '2', '1');
+		return $MPEGaudioVersion;
+	}
+
+	public static function MPEGaudioLayerArray() {
+		static $MPEGaudioLayer = array(false, 3, 2, 1);
+		return $MPEGaudioLayer;
+	}
+
+	public static function MPEGaudioBitrateArray() {
+		static $MPEGaudioBitrate;
+		if (empty($MPEGaudioBitrate)) {
+			$MPEGaudioBitrate = array (
+				'1'  =>  array (1 => array('free', 32000, 64000, 96000, 128000, 160000, 192000, 224000, 256000, 288000, 320000, 352000, 384000, 416000, 448000),
+								2 => array('free', 32000, 48000, 56000,  64000,  80000,  96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000, 384000),
+								3 => array('free', 32000, 40000, 48000,  56000,  64000,  80000,  96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000)
+							   ),
+
+				'2'  =>  array (1 => array('free', 32000, 48000, 56000,  64000,  80000,  96000, 112000, 128000, 144000, 160000, 176000, 192000, 224000, 256000),
+								2 => array('free',  8000, 16000, 24000,  32000,  40000,  48000,  56000,  64000,  80000,  96000, 112000, 128000, 144000, 160000),
+							   )
+			);
+			$MPEGaudioBitrate['2'][3] = $MPEGaudioBitrate['2'][2];
+			$MPEGaudioBitrate['2.5']  = $MPEGaudioBitrate['2'];
+		}
+		return $MPEGaudioBitrate;
+	}
+
+	public static function MPEGaudioFrequencyArray() {
+		static $MPEGaudioFrequency;
+		if (empty($MPEGaudioFrequency)) {
+			$MPEGaudioFrequency = array (
+				'1'   => array(44100, 48000, 32000),
+				'2'   => array(22050, 24000, 16000),
+				'2.5' => array(11025, 12000,  8000)
+			);
+		}
+		return $MPEGaudioFrequency;
+	}
+
+	public static function MPEGaudioChannelModeArray() {
+		static $MPEGaudioChannelMode = array('stereo', 'joint stereo', 'dual channel', 'mono');
+		return $MPEGaudioChannelMode;
+	}
+
+	public static function MPEGaudioModeExtensionArray() {
+		static $MPEGaudioModeExtension;
+		if (empty($MPEGaudioModeExtension)) {
+			$MPEGaudioModeExtension = array (
+				1 => array('4-31', '8-31', '12-31', '16-31'),
+				2 => array('4-31', '8-31', '12-31', '16-31'),
+				3 => array('', 'IS', 'MS', 'IS+MS')
+			);
+		}
+		return $MPEGaudioModeExtension;
+	}
+
+	public static function MPEGaudioEmphasisArray() {
+		static $MPEGaudioEmphasis = array('none', '50/15ms', false, 'CCIT J.17');
+		return $MPEGaudioEmphasis;
+	}
+
+	public static function MPEGaudioHeaderBytesValid($head4, $allowBitrate15=false) {
+		return self::MPEGaudioHeaderValid(self::MPEGaudioHeaderDecode($head4), false, $allowBitrate15);
+	}
+
+	public static function MPEGaudioHeaderValid($rawarray, $echoerrors=false, $allowBitrate15=false) {
+		if (($rawarray['synch'] & 0x0FFE) != 0x0FFE) {
+			return false;
+		}
+
+		static $MPEGaudioVersionLookup;
+		static $MPEGaudioLayerLookup;
+		static $MPEGaudioBitrateLookup;
+		static $MPEGaudioFrequencyLookup;
+		static $MPEGaudioChannelModeLookup;
+		static $MPEGaudioModeExtensionLookup;
+		static $MPEGaudioEmphasisLookup;
+		if (empty($MPEGaudioVersionLookup)) {
+			$MPEGaudioVersionLookup       = self::MPEGaudioVersionArray();
+			$MPEGaudioLayerLookup         = self::MPEGaudioLayerArray();
+			$MPEGaudioBitrateLookup       = self::MPEGaudioBitrateArray();
+			$MPEGaudioFrequencyLookup     = self::MPEGaudioFrequencyArray();
+			$MPEGaudioChannelModeLookup   = self::MPEGaudioChannelModeArray();
+			$MPEGaudioModeExtensionLookup = self::MPEGaudioModeExtensionArray();
+			$MPEGaudioEmphasisLookup      = self::MPEGaudioEmphasisArray();
+		}
+
+		if (isset($MPEGaudioVersionLookup[$rawarray['version']])) {
+			$decodedVersion = $MPEGaudioVersionLookup[$rawarray['version']];
+		} else {
+			echo ($echoerrors ? "\n".'invalid Version ('.$rawarray['version'].')' : '');
+			return false;
+		}
+		if (isset($MPEGaudioLayerLookup[$rawarray['layer']])) {
+			$decodedLayer = $MPEGaudioLayerLookup[$rawarray['layer']];
+		} else {
+			echo ($echoerrors ? "\n".'invalid Layer ('.$rawarray['layer'].')' : '');
+			return false;
+		}
+		if (!isset($MPEGaudioBitrateLookup[$decodedVersion][$decodedLayer][$rawarray['bitrate']])) {
+			echo ($echoerrors ? "\n".'invalid Bitrate ('.$rawarray['bitrate'].')' : '');
+			if ($rawarray['bitrate'] == 15) {
+				// known issue in LAME 3.90 - 3.93.1 where free-format has bitrate ID of 15 instead of 0
+				// let it go through here otherwise file will not be identified
+				if (!$allowBitrate15) {
+					return false;
+				}
+			} else {
+				return false;
+			}
+		}
+		if (!isset($MPEGaudioFrequencyLookup[$decodedVersion][$rawarray['sample_rate']])) {
+			echo ($echoerrors ? "\n".'invalid Frequency ('.$rawarray['sample_rate'].')' : '');
+			return false;
+		}
+		if (!isset($MPEGaudioChannelModeLookup[$rawarray['channelmode']])) {
+			echo ($echoerrors ? "\n".'invalid ChannelMode ('.$rawarray['channelmode'].')' : '');
+			return false;
+		}
+		if (!isset($MPEGaudioModeExtensionLookup[$decodedLayer][$rawarray['modeextension']])) {
+			echo ($echoerrors ? "\n".'invalid Mode Extension ('.$rawarray['modeextension'].')' : '');
+			return false;
+		}
+		if (!isset($MPEGaudioEmphasisLookup[$rawarray['emphasis']])) {
+			echo ($echoerrors ? "\n".'invalid Emphasis ('.$rawarray['emphasis'].')' : '');
+			return false;
+		}
+		// These are just either set or not set, you can't mess that up :)
+		// $rawarray['protection'];
+		// $rawarray['padding'];
+		// $rawarray['private'];
+		// $rawarray['copyright'];
+		// $rawarray['original'];
+
+		return true;
+	}
+
+	public static function MPEGaudioHeaderDecode($Header4Bytes) {
+		// AAAA AAAA  AAAB BCCD  EEEE FFGH  IIJJ KLMM
+		// A - Frame sync (all bits set)
+		// B - MPEG Audio version ID
+		// C - Layer description
+		// D - Protection bit
+		// E - Bitrate index
+		// F - Sampling rate frequency index
+		// G - Padding bit
+		// H - Private bit
+		// I - Channel Mode
+		// J - Mode extension (Only if Joint stereo)
+		// K - Copyright
+		// L - Original
+		// M - Emphasis
+
+		if (strlen($Header4Bytes) != 4) {
+			return false;
+		}
+
+		$MPEGrawHeader['synch']         = (getid3_lib::BigEndian2Int(substr($Header4Bytes, 0, 2)) & 0xFFE0) >> 4;
+		$MPEGrawHeader['version']       = (ord($Header4Bytes{1}) & 0x18) >> 3; //    BB
+		$MPEGrawHeader['layer']         = (ord($Header4Bytes{1}) & 0x06) >> 1; //      CC
+		$MPEGrawHeader['protection']    = (ord($Header4Bytes{1}) & 0x01);      //        D
+		$MPEGrawHeader['bitrate']       = (ord($Header4Bytes{2}) & 0xF0) >> 4; // EEEE
+		$MPEGrawHeader['sample_rate']   = (ord($Header4Bytes{2}) & 0x0C) >> 2; //     FF
+		$MPEGrawHeader['padding']       = (ord($Header4Bytes{2}) & 0x02) >> 1; //       G
+		$MPEGrawHeader['private']       = (ord($Header4Bytes{2}) & 0x01);      //        H
+		$MPEGrawHeader['channelmode']   = (ord($Header4Bytes{3}) & 0xC0) >> 6; // II
+		$MPEGrawHeader['modeextension'] = (ord($Header4Bytes{3}) & 0x30) >> 4; //   JJ
+		$MPEGrawHeader['copyright']     = (ord($Header4Bytes{3}) & 0x08) >> 3; //     K
+		$MPEGrawHeader['original']      = (ord($Header4Bytes{3}) & 0x04) >> 2; //      L
+		$MPEGrawHeader['emphasis']      = (ord($Header4Bytes{3}) & 0x03);      //       MM
+
+		return $MPEGrawHeader;
+	}
+
+	public static function MPEGaudioFrameLength(&$bitrate, &$version, &$layer, $padding, &$samplerate) {
+		static $AudioFrameLengthCache = array();
+
+		if (!isset($AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate])) {
+			$AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate] = false;
+			if ($bitrate != 'free') {
+
+				if ($version == '1') {
+
+					if ($layer == '1') {
+
+						// For Layer I slot is 32 bits long
+						$FrameLengthCoefficient = 48;
+						$SlotLength = 4;
+
+					} else { // Layer 2 / 3
+
+						// for Layer 2 and Layer 3 slot is 8 bits long.
+						$FrameLengthCoefficient = 144;
+						$SlotLength = 1;
+
+					}
+
+				} else { // MPEG-2 / MPEG-2.5
+
+					if ($layer == '1') {
+
+						// For Layer I slot is 32 bits long
+						$FrameLengthCoefficient = 24;
+						$SlotLength = 4;
+
+					} elseif ($layer == '2') {
+
+						// for Layer 2 and Layer 3 slot is 8 bits long.
+						$FrameLengthCoefficient = 144;
+						$SlotLength = 1;
+
+					} else { // layer 3
+
+						// for Layer 2 and Layer 3 slot is 8 bits long.
+						$FrameLengthCoefficient = 72;
+						$SlotLength = 1;
+
+					}
+
+				}
+
+				// FrameLengthInBytes = ((Coefficient * BitRate) / SampleRate) + Padding
+				if ($samplerate > 0) {
+					$NewFramelength  = ($FrameLengthCoefficient * $bitrate) / $samplerate;
+					$NewFramelength  = floor($NewFramelength / $SlotLength) * $SlotLength; // round to next-lower multiple of SlotLength (1 byte for Layer 2/3, 4 bytes for Layer I)
+					if ($padding) {
+						$NewFramelength += $SlotLength;
+					}
+					$AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate] = (int) $NewFramelength;
+				}
+			}
+		}
+		return $AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate];
+	}
+
+	public static function ClosestStandardMP3Bitrate($bit_rate) {
+		static $standard_bit_rates = array (320000, 256000, 224000, 192000, 160000, 128000, 112000, 96000, 80000, 64000, 56000, 48000, 40000, 32000, 24000, 16000, 8000);
+		static $bit_rate_table = array (0=>'-');
+		$round_bit_rate = intval(round($bit_rate, -3));
+		if (!isset($bit_rate_table[$round_bit_rate])) {
+			if ($round_bit_rate > max($standard_bit_rates)) {
+				$bit_rate_table[$round_bit_rate] = round($bit_rate, 2 - strlen($bit_rate));
+			} else {
+				$bit_rate_table[$round_bit_rate] = max($standard_bit_rates);
+				foreach ($standard_bit_rates as $standard_bit_rate) {
+					if ($round_bit_rate >= $standard_bit_rate + (($bit_rate_table[$round_bit_rate] - $standard_bit_rate) / 2)) {
+						break;
+					}
+					$bit_rate_table[$round_bit_rate] = $standard_bit_rate;
+				}
+			}
+		}
+		return $bit_rate_table[$round_bit_rate];
+	}
+
+	public static function XingVBRidOffset($version, $channelmode) {
+		static $XingVBRidOffsetCache = array();
+		if (empty($XingVBRidOffset)) {
+			$XingVBRidOffset = array (
+				'1'   => array ('mono'          => 0x15, // 4 + 17 = 21
+								'stereo'        => 0x24, // 4 + 32 = 36
+								'joint stereo'  => 0x24,
+								'dual channel'  => 0x24
+							   ),
+
+				'2'   => array ('mono'          => 0x0D, // 4 +  9 = 13
+								'stereo'        => 0x15, // 4 + 17 = 21
+								'joint stereo'  => 0x15,
+								'dual channel'  => 0x15
+							   ),
+
+				'2.5' => array ('mono'          => 0x15,
+								'stereo'        => 0x15,
+								'joint stereo'  => 0x15,
+								'dual channel'  => 0x15
+							   )
+			);
+		}
+		return $XingVBRidOffset[$version][$channelmode];
+	}
+
+	public static function LAMEvbrMethodLookup($VBRmethodID) {
+		static $LAMEvbrMethodLookup = array(
+			0x00 => 'unknown',
+			0x01 => 'cbr',
+			0x02 => 'abr',
+			0x03 => 'vbr-old / vbr-rh',
+			0x04 => 'vbr-new / vbr-mtrh',
+			0x05 => 'vbr-mt',
+			0x06 => 'vbr (full vbr method 4)',
+			0x08 => 'cbr (constant bitrate 2 pass)',
+			0x09 => 'abr (2 pass)',
+			0x0F => 'reserved'
+		);
+		return (isset($LAMEvbrMethodLookup[$VBRmethodID]) ? $LAMEvbrMethodLookup[$VBRmethodID] : '');
+	}
+
+	public static function LAMEmiscStereoModeLookup($StereoModeID) {
+		static $LAMEmiscStereoModeLookup = array(
+			0 => 'mono',
+			1 => 'stereo',
+			2 => 'dual mono',
+			3 => 'joint stereo',
+			4 => 'forced stereo',
+			5 => 'auto',
+			6 => 'intensity stereo',
+			7 => 'other'
+		);
+		return (isset($LAMEmiscStereoModeLookup[$StereoModeID]) ? $LAMEmiscStereoModeLookup[$StereoModeID] : '');
+	}
+
+	public static function LAMEmiscSourceSampleFrequencyLookup($SourceSampleFrequencyID) {
+		static $LAMEmiscSourceSampleFrequencyLookup = array(
+			0 => '<= 32 kHz',
+			1 => '44.1 kHz',
+			2 => '48 kHz',
+			3 => '> 48kHz'
+		);
+		return (isset($LAMEmiscSourceSampleFrequencyLookup[$SourceSampleFrequencyID]) ? $LAMEmiscSourceSampleFrequencyLookup[$SourceSampleFrequencyID] : '');
+	}
+
+	public static function LAMEsurroundInfoLookup($SurroundInfoID) {
+		static $LAMEsurroundInfoLookup = array(
+			0 => 'no surround info',
+			1 => 'DPL encoding',
+			2 => 'DPL2 encoding',
+			3 => 'Ambisonic encoding'
+		);
+		return (isset($LAMEsurroundInfoLookup[$SurroundInfoID]) ? $LAMEsurroundInfoLookup[$SurroundInfoID] : 'reserved');
+	}
+
+	public static function LAMEpresetUsedLookup($LAMEtag) {
+
+		if ($LAMEtag['preset_used_id'] == 0) {
+			// no preset used (LAME >=3.93)
+			// no preset recorded (LAME <3.93)
+			return '';
+		}
+		$LAMEpresetUsedLookup = array();
+
+		/////  THIS PART CANNOT BE STATIC .
+		for ($i = 8; $i <= 320; $i++) {
+			switch ($LAMEtag['vbr_method']) {
+				case 'cbr':
+					$LAMEpresetUsedLookup[$i] = '--alt-preset '.$LAMEtag['vbr_method'].' '.$i;
+					break;
+				case 'abr':
+				default: // other VBR modes shouldn't be here(?)
+					$LAMEpresetUsedLookup[$i] = '--alt-preset '.$i;
+					break;
+			}
+		}
+
+		// named old-style presets (studio, phone, voice, etc) are handled in GuessEncoderOptions()
+
+		// named alt-presets
+		$LAMEpresetUsedLookup[1000] = '--r3mix';
+		$LAMEpresetUsedLookup[1001] = '--alt-preset standard';
+		$LAMEpresetUsedLookup[1002] = '--alt-preset extreme';
+		$LAMEpresetUsedLookup[1003] = '--alt-preset insane';
+		$LAMEpresetUsedLookup[1004] = '--alt-preset fast standard';
+		$LAMEpresetUsedLookup[1005] = '--alt-preset fast extreme';
+		$LAMEpresetUsedLookup[1006] = '--alt-preset medium';
+		$LAMEpresetUsedLookup[1007] = '--alt-preset fast medium';
+
+		// LAME 3.94 additions/changes
+		$LAMEpresetUsedLookup[1010] = '--preset portable';                                                           // 3.94a15 Oct 21 2003
+		$LAMEpresetUsedLookup[1015] = '--preset radio';                                                              // 3.94a15 Oct 21 2003
+
+		$LAMEpresetUsedLookup[320]  = '--preset insane';                                                             // 3.94a15 Nov 12 2003
+		$LAMEpresetUsedLookup[410]  = '-V9';
+		$LAMEpresetUsedLookup[420]  = '-V8';
+		$LAMEpresetUsedLookup[440]  = '-V6';
+		$LAMEpresetUsedLookup[430]  = '--preset radio';                                                              // 3.94a15 Nov 12 2003
+		$LAMEpresetUsedLookup[450]  = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'portable';  // 3.94a15 Nov 12 2003
+		$LAMEpresetUsedLookup[460]  = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'medium';    // 3.94a15 Nov 12 2003
+		$LAMEpresetUsedLookup[470]  = '--r3mix';                                                                     // 3.94b1  Dec 18 2003
+		$LAMEpresetUsedLookup[480]  = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'standard';  // 3.94a15 Nov 12 2003
+		$LAMEpresetUsedLookup[490]  = '-V1';
+		$LAMEpresetUsedLookup[500]  = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'extreme';   // 3.94a15 Nov 12 2003
+
+		return (isset($LAMEpresetUsedLookup[$LAMEtag['preset_used_id']]) ? $LAMEpresetUsedLookup[$LAMEtag['preset_used_id']] : 'new/unknown preset: '.$LAMEtag['preset_used_id'].' - report to info@getid3.org');
+	}
+
+}
Index: /extensions/piwigo_videojs/include/getid3/module.audio.ogg.php
===================================================================
--- /extensions/piwigo_videojs/include/getid3/module.audio.ogg.php	(revision 24676)
+++ /extensions/piwigo_videojs/include/getid3/module.audio.ogg.php	(revision 24676)
@@ -0,0 +1,671 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// module.audio.ogg.php                                        //
+// module for analyzing Ogg Vorbis, OggFLAC and Speex files    //
+// dependencies: module.audio.flac.php                         //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.flac.php', __FILE__, true);
+
+class getid3_ogg extends getid3_handler
+{
+	// http://xiph.org/vorbis/doc/Vorbis_I_spec.html
+	public function Analyze() {
+		$info = &$this->getid3->info;
+
+		$info['fileformat'] = 'ogg';
+
+		// Warn about illegal tags - only vorbiscomments are allowed
+		if (isset($info['id3v2'])) {
+			$info['warning'][] = 'Illegal ID3v2 tag present.';
+		}
+		if (isset($info['id3v1'])) {
+			$info['warning'][] = 'Illegal ID3v1 tag present.';
+		}
+		if (isset($info['ape'])) {
+			$info['warning'][] = 'Illegal APE tag present.';
+		}
+
+
+		// Page 1 - Stream Header
+
+		$this->fseek($info['avdataoffset']);
+
+		$oggpageinfo = $this->ParseOggPageHeader();
+		$info['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo;
+
+		if ($this->ftell() >= $this->getid3->fread_buffer_size()) {
+			$info['error'][] = 'Could not find start of Ogg page in the first '.$this->getid3->fread_buffer_size().' bytes (this might not be an Ogg-Vorbis file?)';
+			unset($info['fileformat']);
+			unset($info['ogg']);
+			return false;
+		}
+
+		$filedata = $this->fread($oggpageinfo['page_length']);
+		$filedataoffset = 0;
+
+		if (substr($filedata, 0, 4) == 'fLaC') {
+
+			$info['audio']['dataformat']   = 'flac';
+			$info['audio']['bitrate_mode'] = 'vbr';
+			$info['audio']['lossless']     = true;
+
+		} elseif (substr($filedata, 1, 6) == 'vorbis') {
+
+			$this->ParseVorbisPageHeader($filedata, $filedataoffset, $oggpageinfo);
+
+		} elseif (substr($filedata, 0, 8) == 'Speex   ') {
+
+			// http://www.speex.org/manual/node10.html
+
+			$info['audio']['dataformat']   = 'speex';
+			$info['mime_type']             = 'audio/speex';
+			$info['audio']['bitrate_mode'] = 'abr';
+			$info['audio']['lossless']     = false;
+
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_string']           =                              substr($filedata, $filedataoffset, 8); // hard-coded to 'Speex   '
+			$filedataoffset += 8;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version']          =                              substr($filedata, $filedataoffset, 20);
+			$filedataoffset += 20;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version_id']       = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['header_size']            = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['rate']                   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['mode']                   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['mode_bitstream_version'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['nb_channels']            = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['bitrate']                = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['framesize']              = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['vbr']                    = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['frames_per_packet']      = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['extra_headers']          = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['reserved1']              = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['reserved2']              = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+
+			$info['speex']['speex_version'] = trim($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version']);
+			$info['speex']['sample_rate']   = $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['rate'];
+			$info['speex']['channels']      = $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['nb_channels'];
+			$info['speex']['vbr']           = (bool) $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['vbr'];
+			$info['speex']['band_type']     = $this->SpeexBandModeLookup($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['mode']);
+
+			$info['audio']['sample_rate']   = $info['speex']['sample_rate'];
+			$info['audio']['channels']      = $info['speex']['channels'];
+			if ($info['speex']['vbr']) {
+				$info['audio']['bitrate_mode'] = 'vbr';
+			}
+
+
+		} elseif (substr($filedata, 0, 8) == "fishead\x00") {
+
+			// Ogg Skeleton version 3.0 Format Specification
+			// http://xiph.org/ogg/doc/skeleton.html
+			$filedataoffset += 8;
+			$info['ogg']['skeleton']['fishead']['raw']['version_major']                = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  2));
+			$filedataoffset += 2;
+			$info['ogg']['skeleton']['fishead']['raw']['version_minor']                = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  2));
+			$filedataoffset += 2;
+			$info['ogg']['skeleton']['fishead']['raw']['presentationtime_numerator']   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  8));
+			$filedataoffset += 8;
+			$info['ogg']['skeleton']['fishead']['raw']['presentationtime_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  8));
+			$filedataoffset += 8;
+			$info['ogg']['skeleton']['fishead']['raw']['basetime_numerator']           = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  8));
+			$filedataoffset += 8;
+			$info['ogg']['skeleton']['fishead']['raw']['basetime_denominator']         = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  8));
+			$filedataoffset += 8;
+			$info['ogg']['skeleton']['fishead']['raw']['utc']                          = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 20));
+			$filedataoffset += 20;
+
+			$info['ogg']['skeleton']['fishead']['version']          = $info['ogg']['skeleton']['fishead']['raw']['version_major'].'.'.$info['ogg']['skeleton']['fishead']['raw']['version_minor'];
+			$info['ogg']['skeleton']['fishead']['presentationtime'] = $info['ogg']['skeleton']['fishead']['raw']['presentationtime_numerator'] / $info['ogg']['skeleton']['fishead']['raw']['presentationtime_denominator'];
+			$info['ogg']['skeleton']['fishead']['basetime']         = $info['ogg']['skeleton']['fishead']['raw']['basetime_numerator']         / $info['ogg']['skeleton']['fishead']['raw']['basetime_denominator'];
+			$info['ogg']['skeleton']['fishead']['utc']              = $info['ogg']['skeleton']['fishead']['raw']['utc'];
+
+
+			$counter = 0;
+			do {
+				$oggpageinfo = $this->ParseOggPageHeader();
+				$info['ogg']['pageheader'][$oggpageinfo['page_seqno'].'.'.$counter++] = $oggpageinfo;
+				$filedata = $this->fread($oggpageinfo['page_length']);
+				$this->fseek($oggpageinfo['page_end_offset']);
+
+				if (substr($filedata, 0, 8) == "fisbone\x00") {
+
+					$filedataoffset = 8;
+					$info['ogg']['skeleton']['fisbone']['raw']['message_header_offset']   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  4));
+					$filedataoffset += 4;
+					$info['ogg']['skeleton']['fisbone']['raw']['serial_number']           = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  4));
+					$filedataoffset += 4;
+					$info['ogg']['skeleton']['fisbone']['raw']['number_header_packets']   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  4));
+					$filedataoffset += 4;
+					$info['ogg']['skeleton']['fisbone']['raw']['granulerate_numerator']   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  8));
+					$filedataoffset += 8;
+					$info['ogg']['skeleton']['fisbone']['raw']['granulerate_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  8));
+					$filedataoffset += 8;
+					$info['ogg']['skeleton']['fisbone']['raw']['basegranule']             = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  8));
+					$filedataoffset += 8;
+					$info['ogg']['skeleton']['fisbone']['raw']['preroll']                 = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  4));
+					$filedataoffset += 4;
+					$info['ogg']['skeleton']['fisbone']['raw']['granuleshift']            = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  1));
+					$filedataoffset += 1;
+					$info['ogg']['skeleton']['fisbone']['raw']['padding']                 =                              substr($filedata, $filedataoffset,  3);
+					$filedataoffset += 3;
+
+				} elseif (substr($filedata, 1, 6) == 'theora') {
+
+					$info['video']['dataformat'] = 'theora';
+					$info['error'][] = 'Ogg Theora not correctly handled in this version of getID3 ['.$this->getid3->version().']';
+					//break;
+
+				} elseif (substr($filedata, 1, 6) == 'vorbis') {
+
+					$this->ParseVorbisPageHeader($filedata, $filedataoffset, $oggpageinfo);
+
+				} else {
+					$info['error'][] = 'unexpected';
+					//break;
+				}
+			//} while ($oggpageinfo['page_seqno'] == 0);
+			} while (($oggpageinfo['page_seqno'] == 0) && (substr($filedata, 0, 8) != "fisbone\x00"));
+
+			$this->fseek($oggpageinfo['page_start_offset']);
+
+			$info['error'][] = 'Ogg Skeleton not correctly handled in this version of getID3 ['.$this->getid3->version().']';
+			//return false;
+
+		} else {
+
+			$info['error'][] = 'Expecting either "Speex   " or "vorbis" identifier strings, found "'.substr($filedata, 0, 8).'"';
+			unset($info['ogg']);
+			unset($info['mime_type']);
+			return false;
+
+		}
+
+		// Page 2 - Comment Header
+		$oggpageinfo = $this->ParseOggPageHeader();
+		$info['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo;
+
+		switch ($info['audio']['dataformat']) {
+			case 'vorbis':
+				$filedata = $this->fread($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']);
+				$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['packet_type'] = getid3_lib::LittleEndian2Int(substr($filedata, 0, 1));
+				$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] =                              substr($filedata, 1, 6); // hard-coded to 'vorbis'
+
+				$this->ParseVorbisComments();
+				break;
+
+			case 'flac':
+				$flac = new getid3_flac($this->getid3);
+				if (!$flac->parseMETAdata()) {
+					$info['error'][] = 'Failed to parse FLAC headers';
+					return false;
+				}
+				unset($flac);
+				break;
+
+			case 'speex':
+				$this->fseek($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length'], SEEK_CUR);
+				$this->ParseVorbisComments();
+				break;
+		}
+
+
+		// Last Page - Number of Samples
+		if (!getid3_lib::intValueSupported($info['avdataend'])) {
+
+			$info['warning'][] = 'Unable to parse Ogg end chunk file (PHP does not support file operations beyond '.round(PHP_INT_MAX / 1073741824).'GB)';
+
+		} else {
+
+			$this->fseek(max($info['avdataend'] - $this->getid3->fread_buffer_size(), 0));
+			$LastChunkOfOgg = strrev($this->fread($this->getid3->fread_buffer_size()));
+			if ($LastOggSpostion = strpos($LastChunkOfOgg, 'SggO')) {
+				$this->fseek($info['avdataend'] - ($LastOggSpostion + strlen('SggO')));
+				$info['avdataend'] = $this->ftell();
+				$info['ogg']['pageheader']['eos'] = $this->ParseOggPageHeader();
+				$info['ogg']['samples']   = $info['ogg']['pageheader']['eos']['pcm_abs_position'];
+				if ($info['ogg']['samples'] == 0) {
+					$info['error'][] = 'Corrupt Ogg file: eos.number of samples == zero';
+					return false;
+				}
+				if (!empty($info['audio']['sample_rate'])) {
+					$info['ogg']['bitrate_average'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / ($info['ogg']['samples'] / $info['audio']['sample_rate']);
+				}
+			}
+
+		}
+
+		if (!empty($info['ogg']['bitrate_average'])) {
+			$info['audio']['bitrate'] = $info['ogg']['bitrate_average'];
+		} elseif (!empty($info['ogg']['bitrate_nominal'])) {
+			$info['audio']['bitrate'] = $info['ogg']['bitrate_nominal'];
+		} elseif (!empty($info['ogg']['bitrate_min']) && !empty($info['ogg']['bitrate_max'])) {
+			$info['audio']['bitrate'] = ($info['ogg']['bitrate_min'] + $info['ogg']['bitrate_max']) / 2;
+		}
+		if (isset($info['audio']['bitrate']) && !isset($info['playtime_seconds'])) {
+			if ($info['audio']['bitrate'] == 0) {
+				$info['error'][] = 'Corrupt Ogg file: bitrate_audio == zero';
+				return false;
+			}
+			$info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) / $info['audio']['bitrate']);
+		}
+
+		if (isset($info['ogg']['vendor'])) {
+			$info['audio']['encoder'] = preg_replace('/^Encoded with /', '', $info['ogg']['vendor']);
+
+			// Vorbis only
+			if ($info['audio']['dataformat'] == 'vorbis') {
+
+				// Vorbis 1.0 starts with Xiph.Org
+				if  (preg_match('/^Xiph.Org/', $info['audio']['encoder'])) {
+
+					if ($info['audio']['bitrate_mode'] == 'abr') {
+
+						// Set -b 128 on abr files
+						$info['audio']['encoder_options'] = '-b '.round($info['ogg']['bitrate_nominal'] / 1000);
+
+					} elseif (($info['audio']['bitrate_mode'] == 'vbr') && ($info['audio']['channels'] == 2) && ($info['audio']['sample_rate'] >= 44100) && ($info['audio']['sample_rate'] <= 48000)) {
+						// Set -q N on vbr files
+						$info['audio']['encoder_options'] = '-q '.$this->get_quality_from_nominal_bitrate($info['ogg']['bitrate_nominal']);
+
+					}
+				}
+
+				if (empty($info['audio']['encoder_options']) && !empty($info['ogg']['bitrate_nominal'])) {
+					$info['audio']['encoder_options'] = 'Nominal bitrate: '.intval(round($info['ogg']['bitrate_nominal'] / 1000)).'kbps';
+				}
+			}
+		}
+
+		return true;
+	}
+
+	public function ParseVorbisPageHeader(&$filedata, &$filedataoffset, &$oggpageinfo) {
+		$info = &$this->getid3->info;
+		$info['audio']['dataformat'] = 'vorbis';
+		$info['audio']['lossless']   = false;
+
+		$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['packet_type'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
+		$filedataoffset += 1;
+		$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] = substr($filedata, $filedataoffset, 6); // hard-coded to 'vorbis'
+		$filedataoffset += 6;
+		$info['ogg']['bitstreamversion'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+		$filedataoffset += 4;
+		$info['ogg']['numberofchannels'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
+		$filedataoffset += 1;
+		$info['audio']['channels']       = $info['ogg']['numberofchannels'];
+		$info['ogg']['samplerate']       = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+		$filedataoffset += 4;
+		if ($info['ogg']['samplerate'] == 0) {
+			$info['error'][] = 'Corrupt Ogg file: sample rate == zero';
+			return false;
+		}
+		$info['audio']['sample_rate']    = $info['ogg']['samplerate'];
+		$info['ogg']['samples']          = 0; // filled in later
+		$info['ogg']['bitrate_average']  = 0; // filled in later
+		$info['ogg']['bitrate_max']      = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+		$filedataoffset += 4;
+		$info['ogg']['bitrate_nominal']  = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+		$filedataoffset += 4;
+		$info['ogg']['bitrate_min']      = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+		$filedataoffset += 4;
+		$info['ogg']['blocksize_small']  = pow(2,  getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)) & 0x0F);
+		$info['ogg']['blocksize_large']  = pow(2, (getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)) & 0xF0) >> 4);
+		$info['ogg']['stop_bit']         = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); // must be 1, marks end of packet
+
+		$info['audio']['bitrate_mode'] = 'vbr'; // overridden if actually abr
+		if ($info['ogg']['bitrate_max'] == 0xFFFFFFFF) {
+			unset($info['ogg']['bitrate_max']);
+			$info['audio']['bitrate_mode'] = 'abr';
+		}
+		if ($info['ogg']['bitrate_nominal'] == 0xFFFFFFFF) {
+			unset($info['ogg']['bitrate_nominal']);
+		}
+		if ($info['ogg']['bitrate_min'] == 0xFFFFFFFF) {
+			unset($info['ogg']['bitrate_min']);
+			$info['audio']['bitrate_mode'] = 'abr';
+		}
+		return true;
+	}
+
+	public function ParseOggPageHeader() {
+		// http://xiph.org/ogg/vorbis/doc/framing.html
+		$oggheader['page_start_offset'] = $this->ftell(); // where we started from in the file
+
+		$filedata = $this->fread($this->getid3->fread_buffer_size());
+		$filedataoffset = 0;
+		while ((substr($filedata, $filedataoffset++, 4) != 'OggS')) {
+			if (($this->ftell() - $oggheader['page_start_offset']) >= $this->getid3->fread_buffer_size()) {
+				// should be found before here
+				return false;
+			}
+			if ((($filedataoffset + 28) > strlen($filedata)) || (strlen($filedata) < 28)) {
+				if ($this->feof() || (($filedata .= $this->fread($this->getid3->fread_buffer_size())) === false)) {
+					// get some more data, unless eof, in which case fail
+					return false;
+				}
+			}
+		}
+		$filedataoffset += strlen('OggS') - 1; // page, delimited by 'OggS'
+
+		$oggheader['stream_structver']  = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
+		$filedataoffset += 1;
+		$oggheader['flags_raw']         = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
+		$filedataoffset += 1;
+		$oggheader['flags']['fresh']    = (bool) ($oggheader['flags_raw'] & 0x01); // fresh packet
+		$oggheader['flags']['bos']      = (bool) ($oggheader['flags_raw'] & 0x02); // first page of logical bitstream (bos)
+		$oggheader['flags']['eos']      = (bool) ($oggheader['flags_raw'] & 0x04); // last page of logical bitstream (eos)
+
+		$oggheader['pcm_abs_position']  = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8));
+		$filedataoffset += 8;
+		$oggheader['stream_serialno']   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+		$filedataoffset += 4;
+		$oggheader['page_seqno']        = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+		$filedataoffset += 4;
+		$oggheader['page_checksum']     = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+		$filedataoffset += 4;
+		$oggheader['page_segments']     = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
+		$filedataoffset += 1;
+		$oggheader['page_length'] = 0;
+		for ($i = 0; $i < $oggheader['page_segments']; $i++) {
+			$oggheader['segment_table'][$i] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
+			$filedataoffset += 1;
+			$oggheader['page_length'] += $oggheader['segment_table'][$i];
+		}
+		$oggheader['header_end_offset'] = $oggheader['page_start_offset'] + $filedataoffset;
+		$oggheader['page_end_offset']   = $oggheader['header_end_offset'] + $oggheader['page_length'];
+		$this->fseek($oggheader['header_end_offset']);
+
+		return $oggheader;
+	}
+
+    // http://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-810005
+	public function ParseVorbisComments() {
+		$info = &$this->getid3->info;
+
+		$OriginalOffset = $this->ftell();
+		$commentdataoffset = 0;
+		$VorbisCommentPage = 1;
+
+		switch ($info['audio']['dataformat']) {
+			case 'vorbis':
+			case 'speex':
+				$CommentStartOffset = $info['ogg']['pageheader'][$VorbisCommentPage]['page_start_offset'];  // Second Ogg page, after header block
+				$this->fseek($CommentStartOffset);
+				$commentdataoffset = 27 + $info['ogg']['pageheader'][$VorbisCommentPage]['page_segments'];
+				$commentdata = $this->fread(self::OggPageSegmentLength($info['ogg']['pageheader'][$VorbisCommentPage], 1) + $commentdataoffset);
+
+				if ($info['audio']['dataformat'] == 'vorbis') {
+					$commentdataoffset += (strlen('vorbis') + 1);
+				}
+				break;
+
+			case 'flac':
+				$CommentStartOffset = $info['flac']['VORBIS_COMMENT']['raw']['offset'] + 4;
+				$this->fseek($CommentStartOffset);
+				$commentdata = $this->fread($info['flac']['VORBIS_COMMENT']['raw']['block_length']);
+				break;
+
+			default:
+				return false;
+		}
+
+		$VendorSize = getid3_lib::LittleEndian2Int(substr($commentdata, $commentdataoffset, 4));
+		$commentdataoffset += 4;
+
+		$info['ogg']['vendor'] = substr($commentdata, $commentdataoffset, $VendorSize);
+		$commentdataoffset += $VendorSize;
+
+		$CommentsCount = getid3_lib::LittleEndian2Int(substr($commentdata, $commentdataoffset, 4));
+		$commentdataoffset += 4;
+		$info['avdataoffset'] = $CommentStartOffset + $commentdataoffset;
+
+		$basicfields = array('TITLE', 'ARTIST', 'ALBUM', 'TRACKNUMBER', 'GENRE', 'DATE', 'DESCRIPTION', 'COMMENT');
+		$ThisFileInfo_ogg_comments_raw = &$info['ogg']['comments_raw'];
+		for ($i = 0; $i < $CommentsCount; $i++) {
+
+			$ThisFileInfo_ogg_comments_raw[$i]['dataoffset'] = $CommentStartOffset + $commentdataoffset;
+
+			if ($this->ftell() < ($ThisFileInfo_ogg_comments_raw[$i]['dataoffset'] + 4)) {
+				if ($oggpageinfo = $this->ParseOggPageHeader()) {
+					$info['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo;
+
+					$VorbisCommentPage++;
+
+					// First, save what we haven't read yet
+					$AsYetUnusedData = substr($commentdata, $commentdataoffset);
+
+					// Then take that data off the end
+					$commentdata     = substr($commentdata, 0, $commentdataoffset);
+
+					// Add [headerlength] bytes of dummy data for the Ogg Page Header, just to keep absolute offsets correct
+					$commentdata .= str_repeat("\x00", 27 + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']);
+					$commentdataoffset += (27 + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']);
+
+					// Finally, stick the unused data back on the end
+					$commentdata .= $AsYetUnusedData;
+
+					//$commentdata .= $this->fread($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']);
+					$commentdata .= $this->fread($this->OggPageSegmentLength($info['ogg']['pageheader'][$VorbisCommentPage], 1));
+				}
+
+			}
+			$ThisFileInfo_ogg_comments_raw[$i]['size'] = getid3_lib::LittleEndian2Int(substr($commentdata, $commentdataoffset, 4));
+
+			// replace avdataoffset with position just after the last vorbiscomment
+			$info['avdataoffset'] = $ThisFileInfo_ogg_comments_raw[$i]['dataoffset'] + $ThisFileInfo_ogg_comments_raw[$i]['size'] + 4;
+
+			$commentdataoffset += 4;
+			while ((strlen($commentdata) - $commentdataoffset) < $ThisFileInfo_ogg_comments_raw[$i]['size']) {
+				if (($ThisFileInfo_ogg_comments_raw[$i]['size'] > $info['avdataend']) || ($ThisFileInfo_ogg_comments_raw[$i]['size'] < 0)) {
+					$info['warning'][] = 'Invalid Ogg comment size (comment #'.$i.', claims to be '.number_format($ThisFileInfo_ogg_comments_raw[$i]['size']).' bytes) - aborting reading comments';
+					break 2;
+				}
+
+				$VorbisCommentPage++;
+
+				$oggpageinfo = $this->ParseOggPageHeader();
+				$info['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo;
+
+				// First, save what we haven't read yet
+				$AsYetUnusedData = substr($commentdata, $commentdataoffset);
+
+				// Then take that data off the end
+				$commentdata     = substr($commentdata, 0, $commentdataoffset);
+
+				// Add [headerlength] bytes of dummy data for the Ogg Page Header, just to keep absolute offsets correct
+				$commentdata .= str_repeat("\x00", 27 + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']);
+				$commentdataoffset += (27 + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']);
+
+				// Finally, stick the unused data back on the end
+				$commentdata .= $AsYetUnusedData;
+
+				//$commentdata .= $this->fread($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']);
+				if (!isset($info['ogg']['pageheader'][$VorbisCommentPage])) {
+					$info['warning'][] = 'undefined Vorbis Comment page "'.$VorbisCommentPage.'" at offset '.$this->ftell();
+					break;
+				}
+				$readlength = self::OggPageSegmentLength($info['ogg']['pageheader'][$VorbisCommentPage], 1);
+				if ($readlength <= 0) {
+					$info['warning'][] = 'invalid length Vorbis Comment page "'.$VorbisCommentPage.'" at offset '.$this->ftell();
+					break;
+				}
+				$commentdata .= $this->fread($readlength);
+
+				//$filebaseoffset += $oggpageinfo['header_end_offset'] - $oggpageinfo['page_start_offset'];
+			}
+			$ThisFileInfo_ogg_comments_raw[$i]['offset'] = $commentdataoffset;
+			$commentstring = substr($commentdata, $commentdataoffset, $ThisFileInfo_ogg_comments_raw[$i]['size']);
+			$commentdataoffset += $ThisFileInfo_ogg_comments_raw[$i]['size'];
+
+			if (!$commentstring) {
+
+				// no comment?
+				$info['warning'][] = 'Blank Ogg comment ['.$i.']';
+
+			} elseif (strstr($commentstring, '=')) {
+
+				$commentexploded = explode('=', $commentstring, 2);
+				$ThisFileInfo_ogg_comments_raw[$i]['key']   = strtoupper($commentexploded[0]);
+				$ThisFileInfo_ogg_comments_raw[$i]['value'] = (isset($commentexploded[1]) ? $commentexploded[1] : '');
+
+				if ($ThisFileInfo_ogg_comments_raw[$i]['key'] == 'METADATA_BLOCK_PICTURE') {
+
+					// http://wiki.xiph.org/VorbisComment#METADATA_BLOCK_PICTURE
+					// The unencoded format is that of the FLAC picture block. The fields are stored in big endian order as in FLAC, picture data is stored according to the relevant standard.
+					// http://flac.sourceforge.net/format.html#metadata_block_picture
+					$flac = new getid3_flac($this->getid3);
+					$flac->setStringMode(base64_decode($ThisFileInfo_ogg_comments_raw[$i]['value']));
+					$flac->parsePICTURE();
+					$info['ogg']['comments']['picture'][] = $flac->getid3->info['flac']['PICTURE'][0];
+					unset($flac);
+
+				} elseif ($ThisFileInfo_ogg_comments_raw[$i]['key'] == 'COVERART') {
+
+					$data = base64_decode($ThisFileInfo_ogg_comments_raw[$i]['value']);
+					$this->notice('Found deprecated COVERART tag, it should be replaced in honor of METADATA_BLOCK_PICTURE structure');
+					/** @todo use 'coverartmime' where available */
+					$imageinfo = getid3_lib::GetDataImageSize($data);
+					if ($imageinfo === false || !isset($imageinfo['mime'])) {
+						$this->warning('COVERART vorbiscomment tag contains invalid image');
+						continue;
+					}
+
+					$ogg = new self($this->getid3);
+					$ogg->setStringMode($data);
+					$info['ogg']['comments']['picture'][] = array(
+						'image_mime' => $imageinfo['mime'],
+						'data'       => $ogg->saveAttachment('coverart', 0, strlen($data), $imageinfo['mime']),
+					);
+					unset($ogg);
+
+				} else {
+
+					$info['ogg']['comments'][strtolower($ThisFileInfo_ogg_comments_raw[$i]['key'])][] = $ThisFileInfo_ogg_comments_raw[$i]['value'];
+
+				}
+
+			} else {
+
+				$info['warning'][] = '[known problem with CDex >= v1.40, < v1.50b7] Invalid Ogg comment name/value pair ['.$i.']: '.$commentstring;
+
+			}
+			unset($ThisFileInfo_ogg_comments_raw[$i]);
+		}
+		unset($ThisFileInfo_ogg_comments_raw);
+
+
+		// Replay Gain Adjustment
+		// http://privatewww.essex.ac.uk/~djmrob/replaygain/
+		if (isset($info['ogg']['comments']) && is_array($info['ogg']['comments'])) {
+			foreach ($info['ogg']['comments'] as $index => $commentvalue) {
+				switch ($index) {
+					case 'rg_audiophile':
+					case 'replaygain_album_gain':
+						$info['replay_gain']['album']['adjustment'] = (double) $commentvalue[0];
+						unset($info['ogg']['comments'][$index]);
+						break;
+
+					case 'rg_radio':
+					case 'replaygain_track_gain':
+						$info['replay_gain']['track']['adjustment'] = (double) $commentvalue[0];
+						unset($info['ogg']['comments'][$index]);
+						break;
+
+					case 'replaygain_album_peak':
+						$info['replay_gain']['album']['peak'] = (double) $commentvalue[0];
+						unset($info['ogg']['comments'][$index]);
+						break;
+
+					case 'rg_peak':
+					case 'replaygain_track_peak':
+						$info['replay_gain']['track']['peak'] = (double) $commentvalue[0];
+						unset($info['ogg']['comments'][$index]);
+						break;
+
+					case 'replaygain_reference_loudness':
+						$info['replay_gain']['reference_volume'] = (double) $commentvalue[0];
+						unset($info['ogg']['comments'][$index]);
+						break;
+
+					default:
+						// do nothing
+						break;
+				}
+			}
+		}
+
+		$this->fseek($OriginalOffset);
+
+		return true;
+	}
+
+	public static function SpeexBandModeLookup($mode) {
+		static $SpeexBandModeLookup = array();
+		if (empty($SpeexBandModeLookup)) {
+			$SpeexBandModeLookup[0] = 'narrow';
+			$SpeexBandModeLookup[1] = 'wide';
+			$SpeexBandModeLookup[2] = 'ultra-wide';
+		}
+		return (isset($SpeexBandModeLookup[$mode]) ? $SpeexBandModeLookup[$mode] : null);
+	}
+
+
+	public static function OggPageSegmentLength($OggInfoArray, $SegmentNumber=1) {
+		for ($i = 0; $i < $SegmentNumber; $i++) {
+			$segmentlength = 0;
+			foreach ($OggInfoArray['segment_table'] as $key => $value) {
+				$segmentlength += $value;
+				if ($value < 255) {
+					break;
+				}
+			}
+		}
+		return $segmentlength;
+	}
+
+
+	public static function get_quality_from_nominal_bitrate($nominal_bitrate) {
+
+		// decrease precision
+		$nominal_bitrate = $nominal_bitrate / 1000;
+
+		if ($nominal_bitrate < 128) {
+			// q-1 to q4
+			$qval = ($nominal_bitrate - 64) / 16;
+		} elseif ($nominal_bitrate < 256) {
+			// q4 to q8
+			$qval = $nominal_bitrate / 32;
+		} elseif ($nominal_bitrate < 320) {
+			// q8 to q9
+			$qval = ($nominal_bitrate + 256) / 64;
+		} else {
+			// q9 to q10
+			$qval = ($nominal_bitrate + 1300) / 180;
+		}
+		//return $qval; // 5.031324
+		//return intval($qval); // 5
+		return round($qval, 1); // 5 or 4.9
+	}
+
+}
Index: /extensions/piwigo_videojs/include/getid3/module.tag.apetag.php
===================================================================
--- /extensions/piwigo_videojs/include/getid3/module.tag.apetag.php	(revision 24676)
+++ /extensions/piwigo_videojs/include/getid3/module.tag.apetag.php	(revision 24676)
@@ -0,0 +1,370 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// module.tag.apetag.php                                       //
+// module for analyzing APE tags                               //
+// dependencies: NONE                                          //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+class getid3_apetag extends getid3_handler
+{
+	public $inline_attachments = true; // true: return full data for all attachments; false: return no data for all attachments; integer: return data for attachments <= than this; string: save as file to this directory
+	public $overrideendoffset  = 0;
+
+	public function Analyze() {
+		$info = &$this->getid3->info;
+
+		if (!getid3_lib::intValueSupported($info['filesize'])) {
+			$info['warning'][] = 'Unable to check for APEtags because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB';
+			return false;
+		}
+
+		$id3v1tagsize     = 128;
+		$apetagheadersize = 32;
+		$lyrics3tagsize   = 10;
+
+		if ($this->overrideendoffset == 0) {
+
+			fseek($this->getid3->fp, 0 - $id3v1tagsize - $apetagheadersize - $lyrics3tagsize, SEEK_END);
+			$APEfooterID3v1 = fread($this->getid3->fp, $id3v1tagsize + $apetagheadersize + $lyrics3tagsize);
+
+			//if (preg_match('/APETAGEX.{24}TAG.{125}$/i', $APEfooterID3v1)) {
+			if (substr($APEfooterID3v1, strlen($APEfooterID3v1) - $id3v1tagsize - $apetagheadersize, 8) == 'APETAGEX') {
+
+				// APE tag found before ID3v1
+				$info['ape']['tag_offset_end'] = $info['filesize'] - $id3v1tagsize;
+
+			//} elseif (preg_match('/APETAGEX.{24}$/i', $APEfooterID3v1)) {
+			} elseif (substr($APEfooterID3v1, strlen($APEfooterID3v1) - $apetagheadersize, 8) == 'APETAGEX') {
+
+				// APE tag found, no ID3v1
+				$info['ape']['tag_offset_end'] = $info['filesize'];
+
+			}
+
+		} else {
+
+			fseek($this->getid3->fp, $this->overrideendoffset - $apetagheadersize, SEEK_SET);
+			if (fread($this->getid3->fp, 8) == 'APETAGEX') {
+				$info['ape']['tag_offset_end'] = $this->overrideendoffset;
+			}
+
+		}
+		if (!isset($info['ape']['tag_offset_end'])) {
+
+			// APE tag not found
+			unset($info['ape']);
+			return false;
+
+		}
+
+		// shortcut
+		$thisfile_ape = &$info['ape'];
+
+		fseek($this->getid3->fp, $thisfile_ape['tag_offset_end'] - $apetagheadersize, SEEK_SET);
+		$APEfooterData = fread($this->getid3->fp, 32);
+		if (!($thisfile_ape['footer'] = $this->parseAPEheaderFooter($APEfooterData))) {
+			$info['error'][] = 'Error parsing APE footer at offset '.$thisfile_ape['tag_offset_end'];
+			return false;
+		}
+
+		if (isset($thisfile_ape['footer']['flags']['header']) && $thisfile_ape['footer']['flags']['header']) {
+			fseek($this->getid3->fp, $thisfile_ape['tag_offset_end'] - $thisfile_ape['footer']['raw']['tagsize'] - $apetagheadersize, SEEK_SET);
+			$thisfile_ape['tag_offset_start'] = ftell($this->getid3->fp);
+			$APEtagData = fread($this->getid3->fp, $thisfile_ape['footer']['raw']['tagsize'] + $apetagheadersize);
+		} else {
+			$thisfile_ape['tag_offset_start'] = $thisfile_ape['tag_offset_end'] - $thisfile_ape['footer']['raw']['tagsize'];
+			fseek($this->getid3->fp, $thisfile_ape['tag_offset_start'], SEEK_SET);
+			$APEtagData = fread($this->getid3->fp, $thisfile_ape['footer']['raw']['tagsize']);
+		}
+		$info['avdataend'] = $thisfile_ape['tag_offset_start'];
+
+		if (isset($info['id3v1']['tag_offset_start']) && ($info['id3v1']['tag_offset_start'] < $thisfile_ape['tag_offset_end'])) {
+			$info['warning'][] = 'ID3v1 tag information ignored since it appears to be a false synch in APEtag data';
+			unset($info['id3v1']);
+			foreach ($info['warning'] as $key => $value) {
+				if ($value == 'Some ID3v1 fields do not use NULL characters for padding') {
+					unset($info['warning'][$key]);
+					sort($info['warning']);
+					break;
+				}
+			}
+		}
+
+		$offset = 0;
+		if (isset($thisfile_ape['footer']['flags']['header']) && $thisfile_ape['footer']['flags']['header']) {
+			if ($thisfile_ape['header'] = $this->parseAPEheaderFooter(substr($APEtagData, 0, $apetagheadersize))) {
+				$offset += $apetagheadersize;
+			} else {
+				$info['error'][] = 'Error parsing APE header at offset '.$thisfile_ape['tag_offset_start'];
+				return false;
+			}
+		}
+
+		// shortcut
+		$info['replay_gain'] = array();
+		$thisfile_replaygain = &$info['replay_gain'];
+
+		for ($i = 0; $i < $thisfile_ape['footer']['raw']['tag_items']; $i++) {
+			$value_size = getid3_lib::LittleEndian2Int(substr($APEtagData, $offset, 4));
+			$offset += 4;
+			$item_flags = getid3_lib::LittleEndian2Int(substr($APEtagData, $offset, 4));
+			$offset += 4;
+			if (strstr(substr($APEtagData, $offset), "\x00") === false) {
+				$info['error'][] = 'Cannot find null-byte (0x00) seperator between ItemKey #'.$i.' and value. ItemKey starts '.$offset.' bytes into the APE tag, at file offset '.($thisfile_ape['tag_offset_start'] + $offset);
+				return false;
+			}
+			$ItemKeyLength = strpos($APEtagData, "\x00", $offset) - $offset;
+			$item_key      = strtolower(substr($APEtagData, $offset, $ItemKeyLength));
+
+			// shortcut
+			$thisfile_ape['items'][$item_key] = array();
+			$thisfile_ape_items_current = &$thisfile_ape['items'][$item_key];
+
+			$thisfile_ape_items_current['offset'] = $thisfile_ape['tag_offset_start'] + $offset;
+
+			$offset += ($ItemKeyLength + 1); // skip 0x00 terminator
+			$thisfile_ape_items_current['data'] = substr($APEtagData, $offset, $value_size);
+			$offset += $value_size;
+
+			$thisfile_ape_items_current['flags'] = $this->parseAPEtagFlags($item_flags);
+			switch ($thisfile_ape_items_current['flags']['item_contents_raw']) {
+				case 0: // UTF-8
+				case 3: // Locator (URL, filename, etc), UTF-8 encoded
+					$thisfile_ape_items_current['data'] = explode("\x00", trim($thisfile_ape_items_current['data']));
+					break;
+
+				default: // binary data
+					break;
+			}
+
+			switch (strtolower($item_key)) {
+				case 'replaygain_track_gain':
+					$thisfile_replaygain['track']['adjustment'] = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero!
+					$thisfile_replaygain['track']['originator'] = 'unspecified';
+					break;
+
+				case 'replaygain_track_peak':
+					$thisfile_replaygain['track']['peak']       = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero!
+					$thisfile_replaygain['track']['originator'] = 'unspecified';
+					if ($thisfile_replaygain['track']['peak'] <= 0) {
+						$info['warning'][] = 'ReplayGain Track peak from APEtag appears invalid: '.$thisfile_replaygain['track']['peak'].' (original value = "'.$thisfile_ape_items_current['data'][0].'")';
+					}
+					break;
+
+				case 'replaygain_album_gain':
+					$thisfile_replaygain['album']['adjustment'] = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero!
+					$thisfile_replaygain['album']['originator'] = 'unspecified';
+					break;
+
+				case 'replaygain_album_peak':
+					$thisfile_replaygain['album']['peak']       = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero!
+					$thisfile_replaygain['album']['originator'] = 'unspecified';
+					if ($thisfile_replaygain['album']['peak'] <= 0) {
+						$info['warning'][] = 'ReplayGain Album peak from APEtag appears invalid: '.$thisfile_replaygain['album']['peak'].' (original value = "'.$thisfile_ape_items_current['data'][0].'")';
+					}
+					break;
+
+				case 'mp3gain_undo':
+					list($mp3gain_undo_left, $mp3gain_undo_right, $mp3gain_undo_wrap) = explode(',', $thisfile_ape_items_current['data'][0]);
+					$thisfile_replaygain['mp3gain']['undo_left']  = intval($mp3gain_undo_left);
+					$thisfile_replaygain['mp3gain']['undo_right'] = intval($mp3gain_undo_right);
+					$thisfile_replaygain['mp3gain']['undo_wrap']  = (($mp3gain_undo_wrap == 'Y') ? true : false);
+					break;
+
+				case 'mp3gain_minmax':
+					list($mp3gain_globalgain_min, $mp3gain_globalgain_max) = explode(',', $thisfile_ape_items_current['data'][0]);
+					$thisfile_replaygain['mp3gain']['globalgain_track_min'] = intval($mp3gain_globalgain_min);
+					$thisfile_replaygain['mp3gain']['globalgain_track_max'] = intval($mp3gain_globalgain_max);
+					break;
+
+				case 'mp3gain_album_minmax':
+					list($mp3gain_globalgain_album_min, $mp3gain_globalgain_album_max) = explode(',', $thisfile_ape_items_current['data'][0]);
+					$thisfile_replaygain['mp3gain']['globalgain_album_min'] = intval($mp3gain_globalgain_album_min);
+					$thisfile_replaygain['mp3gain']['globalgain_album_max'] = intval($mp3gain_globalgain_album_max);
+					break;
+
+				case 'tracknumber':
+					if (is_array($thisfile_ape_items_current['data'])) {
+						foreach ($thisfile_ape_items_current['data'] as $comment) {
+							$thisfile_ape['comments']['track'][] = $comment;
+						}
+					}
+					break;
+
+				case 'cover art (artist)':
+				case 'cover art (back)':
+				case 'cover art (band logo)':
+				case 'cover art (band)':
+				case 'cover art (colored fish)':
+				case 'cover art (composer)':
+				case 'cover art (conductor)':
+				case 'cover art (front)':
+				case 'cover art (icon)':
+				case 'cover art (illustration)':
+				case 'cover art (lead)':
+				case 'cover art (leaflet)':
+				case 'cover art (lyricist)':
+				case 'cover art (media)':
+				case 'cover art (movie scene)':
+				case 'cover art (other icon)':
+				case 'cover art (other)':
+				case 'cover art (performance)':
+				case 'cover art (publisher logo)':
+				case 'cover art (recording)':
+				case 'cover art (studio)':
+					// list of possible cover arts from http://taglib-sharp.sourcearchive.com/documentation/2.0.3.0-2/Ape_2Tag_8cs-source.html
+					list($thisfile_ape_items_current['filename'], $thisfile_ape_items_current['data']) = explode("\x00", $thisfile_ape_items_current['data'], 2);
+					$thisfile_ape_items_current['data_offset'] = $thisfile_ape_items_current['offset'] + strlen($thisfile_ape_items_current['filename']."\x00");
+					$thisfile_ape_items_current['data_length'] = strlen($thisfile_ape_items_current['data']);
+
+					$thisfile_ape_items_current['image_mime'] = '';
+					$imageinfo = array();
+					$imagechunkcheck = getid3_lib::GetDataImageSize($thisfile_ape_items_current['data'], $imageinfo);
+					$thisfile_ape_items_current['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]);
+
+					do {
+						if ($this->inline_attachments === false) {
+							// skip entirely
+							unset($thisfile_ape_items_current['data']);
+							break;
+						}
+						if ($this->inline_attachments === true) {
+							// great
+						} elseif (is_int($this->inline_attachments)) {
+							if ($this->inline_attachments < $thisfile_ape_items_current['data_length']) {
+								// too big, skip
+								$info['warning'][] = 'attachment at '.$thisfile_ape_items_current['offset'].' is too large to process inline ('.number_format($thisfile_ape_items_current['data_length']).' bytes)';
+								unset($thisfile_ape_items_current['data']);
+								break;
+							}
+						} elseif (is_string($this->inline_attachments)) {
+							$this->inline_attachments = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->inline_attachments), DIRECTORY_SEPARATOR);
+							if (!is_dir($this->inline_attachments) || !is_writable($this->inline_attachments)) {
+								// cannot write, skip
+								$info['warning'][] = 'attachment at '.$thisfile_ape_items_current['offset'].' cannot be saved to "'.$this->inline_attachments.'" (not writable)';
+								unset($thisfile_ape_items_current['data']);
+								break;
+							}
+						}
+						// if we get this far, must be OK
+						if (is_string($this->inline_attachments)) {
+							$destination_filename = $this->inline_attachments.DIRECTORY_SEPARATOR.md5($info['filenamepath']).'_'.$thisfile_ape_items_current['data_offset'];
+							if (!file_exists($destination_filename) || is_writable($destination_filename)) {
+								file_put_contents($destination_filename, $thisfile_ape_items_current['data']);
+							} else {
+								$info['warning'][] = 'attachment at '.$thisfile_ape_items_current['offset'].' cannot be saved to "'.$destination_filename.'" (not writable)';
+							}
+							$thisfile_ape_items_current['data_filename'] = $destination_filename;
+							unset($thisfile_ape_items_current['data']);
+						} else {
+							if (!isset($info['ape']['comments']['picture'])) {
+								$info['ape']['comments']['picture'] = array();
+							}
+							$info['ape']['comments']['picture'][] = array('data'=>$thisfile_ape_items_current['data'], 'image_mime'=>$thisfile_ape_items_current['image_mime']);
+						}
+					} while (false);
+					break;
+
+				default:
+					if (is_array($thisfile_ape_items_current['data'])) {
+						foreach ($thisfile_ape_items_current['data'] as $comment) {
+							$thisfile_ape['comments'][strtolower($item_key)][] = $comment;
+						}
+					}
+					break;
+			}
+
+		}
+		if (empty($thisfile_replaygain)) {
+			unset($info['replay_gain']);
+		}
+		return true;
+	}
+
+	public function parseAPEheaderFooter($APEheaderFooterData) {
+		// http://www.uni-jena.de/~pfk/mpp/sv8/apeheader.html
+
+		// shortcut
+		$headerfooterinfo['raw'] = array();
+		$headerfooterinfo_raw = &$headerfooterinfo['raw'];
+
+		$headerfooterinfo_raw['footer_tag']   =                  substr($APEheaderFooterData,  0, 8);
+		if ($headerfooterinfo_raw['footer_tag'] != 'APETAGEX') {
+			return false;
+		}
+		$headerfooterinfo_raw['version']      = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData,  8, 4));
+		$headerfooterinfo_raw['tagsize']      = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 12, 4));
+		$headerfooterinfo_raw['tag_items']    = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 16, 4));
+		$headerfooterinfo_raw['global_flags'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 20, 4));
+		$headerfooterinfo_raw['reserved']     =                              substr($APEheaderFooterData, 24, 8);
+
+		$headerfooterinfo['tag_version']         = $headerfooterinfo_raw['version'] / 1000;
+		if ($headerfooterinfo['tag_version'] >= 2) {
+			$headerfooterinfo['flags'] = $this->parseAPEtagFlags($headerfooterinfo_raw['global_flags']);
+		}
+		return $headerfooterinfo;
+	}
+
+	public function parseAPEtagFlags($rawflagint) {
+		// "Note: APE Tags 1.0 do not use any of the APE Tag flags.
+		// All are set to zero on creation and ignored on reading."
+		// http://www.uni-jena.de/~pfk/mpp/sv8/apetagflags.html
+		$flags['header']            = (bool) ($rawflagint & 0x80000000);
+		$flags['footer']            = (bool) ($rawflagint & 0x40000000);
+		$flags['this_is_header']    = (bool) ($rawflagint & 0x20000000);
+		$flags['item_contents_raw'] =        ($rawflagint & 0x00000006) >> 1;
+		$flags['read_only']         = (bool) ($rawflagint & 0x00000001);
+
+		$flags['item_contents']     = $this->APEcontentTypeFlagLookup($flags['item_contents_raw']);
+
+		return $flags;
+	}
+
+	public function APEcontentTypeFlagLookup($contenttypeid) {
+		static $APEcontentTypeFlagLookup = array(
+			0 => 'utf-8',
+			1 => 'binary',
+			2 => 'external',
+			3 => 'reserved'
+		);
+		return (isset($APEcontentTypeFlagLookup[$contenttypeid]) ? $APEcontentTypeFlagLookup[$contenttypeid] : 'invalid');
+	}
+
+	public function APEtagItemIsUTF8Lookup($itemkey) {
+		static $APEtagItemIsUTF8Lookup = array(
+			'title',
+			'subtitle',
+			'artist',
+			'album',
+			'debut album',
+			'publisher',
+			'conductor',
+			'track',
+			'composer',
+			'comment',
+			'copyright',
+			'publicationright',
+			'file',
+			'year',
+			'record date',
+			'record location',
+			'genre',
+			'media',
+			'related',
+			'isrc',
+			'abstract',
+			'language',
+			'bibliography'
+		);
+		return in_array(strtolower($itemkey), $APEtagItemIsUTF8Lookup);
+	}
+
+}
Index: /extensions/piwigo_videojs/include/getid3/module.tag.id3v1.php
===================================================================
--- /extensions/piwigo_videojs/include/getid3/module.tag.id3v1.php	(revision 24676)
+++ /extensions/piwigo_videojs/include/getid3/module.tag.id3v1.php	(revision 24676)
@@ -0,0 +1,359 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// module.tag.id3v1.php                                        //
+// module for analyzing ID3v1 tags                             //
+// dependencies: NONE                                          //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+
+class getid3_id3v1 extends getid3_handler
+{
+
+	public function Analyze() {
+		$info = &$this->getid3->info;
+
+		if (!getid3_lib::intValueSupported($info['filesize'])) {
+			$info['warning'][] = 'Unable to check for ID3v1 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB';
+			return false;
+		}
+
+		fseek($this->getid3->fp, -256, SEEK_END);
+		$preid3v1 = fread($this->getid3->fp, 128);
+		$id3v1tag = fread($this->getid3->fp, 128);
+
+		if (substr($id3v1tag, 0, 3) == 'TAG') {
+
+			$info['avdataend'] = $info['filesize'] - 128;
+
+			$ParsedID3v1['title']   = $this->cutfield(substr($id3v1tag,   3, 30));
+			$ParsedID3v1['artist']  = $this->cutfield(substr($id3v1tag,  33, 30));
+			$ParsedID3v1['album']   = $this->cutfield(substr($id3v1tag,  63, 30));
+			$ParsedID3v1['year']    = $this->cutfield(substr($id3v1tag,  93,  4));
+			$ParsedID3v1['comment'] =                 substr($id3v1tag,  97, 30);  // can't remove nulls yet, track detection depends on them
+			$ParsedID3v1['genreid'] =             ord(substr($id3v1tag, 127,  1));
+
+			// If second-last byte of comment field is null and last byte of comment field is non-null
+			// then this is ID3v1.1 and the comment field is 28 bytes long and the 30th byte is the track number
+			if (($id3v1tag{125} === "\x00") && ($id3v1tag{126} !== "\x00")) {
+				$ParsedID3v1['track']   = ord(substr($ParsedID3v1['comment'], 29,  1));
+				$ParsedID3v1['comment'] =     substr($ParsedID3v1['comment'],  0, 28);
+			}
+			$ParsedID3v1['comment'] = $this->cutfield($ParsedID3v1['comment']);
+
+			$ParsedID3v1['genre'] = $this->LookupGenreName($ParsedID3v1['genreid']);
+			if (!empty($ParsedID3v1['genre'])) {
+				unset($ParsedID3v1['genreid']);
+			}
+			if (isset($ParsedID3v1['genre']) && (empty($ParsedID3v1['genre']) || ($ParsedID3v1['genre'] == 'Unknown'))) {
+				unset($ParsedID3v1['genre']);
+			}
+
+			foreach ($ParsedID3v1 as $key => $value) {
+				$ParsedID3v1['comments'][$key][0] = $value;
+			}
+
+			// ID3v1 data is supposed to be padded with NULL characters, but some taggers pad with spaces
+			$GoodFormatID3v1tag = $this->GenerateID3v1Tag(
+											$ParsedID3v1['title'],
+											$ParsedID3v1['artist'],
+											$ParsedID3v1['album'],
+											$ParsedID3v1['year'],
+											(isset($ParsedID3v1['genre']) ? $this->LookupGenreID($ParsedID3v1['genre']) : false),
+											$ParsedID3v1['comment'],
+											(!empty($ParsedID3v1['track']) ? $ParsedID3v1['track'] : ''));
+			$ParsedID3v1['padding_valid'] = true;
+			if ($id3v1tag !== $GoodFormatID3v1tag) {
+				$ParsedID3v1['padding_valid'] = false;
+				$info['warning'][] = 'Some ID3v1 fields do not use NULL characters for padding';
+			}
+
+			$ParsedID3v1['tag_offset_end']   = $info['filesize'];
+			$ParsedID3v1['tag_offset_start'] = $ParsedID3v1['tag_offset_end'] - 128;
+
+			$info['id3v1'] = $ParsedID3v1;
+		}
+
+		if (substr($preid3v1, 0, 3) == 'TAG') {
+			// The way iTunes handles tags is, well, brain-damaged.
+			// It completely ignores v1 if ID3v2 is present.
+			// This goes as far as adding a new v1 tag *even if there already is one*
+
+			// A suspected double-ID3v1 tag has been detected, but it could be that
+			// the "TAG" identifier is a legitimate part of an APE or Lyrics3 tag
+			if (substr($preid3v1, 96, 8) == 'APETAGEX') {
+				// an APE tag footer was found before the last ID3v1, assume false "TAG" synch
+			} elseif (substr($preid3v1, 119, 6) == 'LYRICS') {
+				// a Lyrics3 tag footer was found before the last ID3v1, assume false "TAG" synch
+			} else {
+				// APE and Lyrics3 footers not found - assume double ID3v1
+				$info['warning'][] = 'Duplicate ID3v1 tag detected - this has been known to happen with iTunes';
+				$info['avdataend'] -= 128;
+			}
+		}
+
+		return true;
+	}
+
+	public static function cutfield($str) {
+		return trim(substr($str, 0, strcspn($str, "\x00")));
+	}
+
+	public static function ArrayOfGenres($allowSCMPXextended=false) {
+		static $GenreLookup = array(
+			0    => 'Blues',
+			1    => 'Classic Rock',
+			2    => 'Country',
+			3    => 'Dance',
+			4    => 'Disco',
+			5    => 'Funk',
+			6    => 'Grunge',
+			7    => 'Hip-Hop',
+			8    => 'Jazz',
+			9    => 'Metal',
+			10   => 'New Age',
+			11   => 'Oldies',
+			12   => 'Other',
+			13   => 'Pop',
+			14   => 'R&B',
+			15   => 'Rap',
+			16   => 'Reggae',
+			17   => 'Rock',
+			18   => 'Techno',
+			19   => 'Industrial',
+			20   => 'Alternative',
+			21   => 'Ska',
+			22   => 'Death Metal',
+			23   => 'Pranks',
+			24   => 'Soundtrack',
+			25   => 'Euro-Techno',
+			26   => 'Ambient',
+			27   => 'Trip-Hop',
+			28   => 'Vocal',
+			29   => 'Jazz+Funk',
+			30   => 'Fusion',
+			31   => 'Trance',
+			32   => 'Classical',
+			33   => 'Instrumental',
+			34   => 'Acid',
+			35   => 'House',
+			36   => 'Game',
+			37   => 'Sound Clip',
+			38   => 'Gospel',
+			39   => 'Noise',
+			40   => 'Alt. Rock',
+			41   => 'Bass',
+			42   => 'Soul',
+			43   => 'Punk',
+			44   => 'Space',
+			45   => 'Meditative',
+			46   => 'Instrumental Pop',
+			47   => 'Instrumental Rock',
+			48   => 'Ethnic',
+			49   => 'Gothic',
+			50   => 'Darkwave',
+			51   => 'Techno-Industrial',
+			52   => 'Electronic',
+			53   => 'Pop-Folk',
+			54   => 'Eurodance',
+			55   => 'Dream',
+			56   => 'Southern Rock',
+			57   => 'Comedy',
+			58   => 'Cult',
+			59   => 'Gangsta Rap',
+			60   => 'Top 40',
+			61   => 'Christian Rap',
+			62   => 'Pop/Funk',
+			63   => 'Jungle',
+			64   => 'Native American',
+			65   => 'Cabaret',
+			66   => 'New Wave',
+			67   => 'Psychedelic',
+			68   => 'Rave',
+			69   => 'Showtunes',
+			70   => 'Trailer',
+			71   => 'Lo-Fi',
+			72   => 'Tribal',
+			73   => 'Acid Punk',
+			74   => 'Acid Jazz',
+			75   => 'Polka',
+			76   => 'Retro',
+			77   => 'Musical',
+			78   => 'Rock & Roll',
+			79   => 'Hard Rock',
+			80   => 'Folk',
+			81   => 'Folk/Rock',
+			82   => 'National Folk',
+			83   => 'Swing',
+			84   => 'Fast-Fusion',
+			85   => 'Bebob',
+			86   => 'Latin',
+			87   => 'Revival',
+			88   => 'Celtic',
+			89   => 'Bluegrass',
+			90   => 'Avantgarde',
+			91   => 'Gothic Rock',
+			92   => 'Progressive Rock',
+			93   => 'Psychedelic Rock',
+			94   => 'Symphonic Rock',
+			95   => 'Slow Rock',
+			96   => 'Big Band',
+			97   => 'Chorus',
+			98   => 'Easy Listening',
+			99   => 'Acoustic',
+			100  => 'Humour',
+			101  => 'Speech',
+			102  => 'Chanson',
+			103  => 'Opera',
+			104  => 'Chamber Music',
+			105  => 'Sonata',
+			106  => 'Symphony',
+			107  => 'Booty Bass',
+			108  => 'Primus',
+			109  => 'Porn Groove',
+			110  => 'Satire',
+			111  => 'Slow Jam',
+			112  => 'Club',
+			113  => 'Tango',
+			114  => 'Samba',
+			115  => 'Folklore',
+			116  => 'Ballad',
+			117  => 'Power Ballad',
+			118  => 'Rhythmic Soul',
+			119  => 'Freestyle',
+			120  => 'Duet',
+			121  => 'Punk Rock',
+			122  => 'Drum Solo',
+			123  => 'A Cappella',
+			124  => 'Euro-House',
+			125  => 'Dance Hall',
+			126  => 'Goa',
+			127  => 'Drum & Bass',
+			128  => 'Club-House',
+			129  => 'Hardcore',
+			130  => 'Terror',
+			131  => 'Indie',
+			132  => 'BritPop',
+			133  => 'Negerpunk',
+			134  => 'Polsk Punk',
+			135  => 'Beat',
+			136  => 'Christian Gangsta Rap',
+			137  => 'Heavy Metal',
+			138  => 'Black Metal',
+			139  => 'Crossover',
+			140  => 'Contemporary Christian',
+			141  => 'Christian Rock',
+			142  => 'Merengue',
+			143  => 'Salsa',
+			144  => 'Thrash Metal',
+			145  => 'Anime',
+			146  => 'JPop',
+			147  => 'Synthpop',
+
+			255  => 'Unknown',
+
+			'CR' => 'Cover',
+			'RX' => 'Remix'
+		);
+
+		static $GenreLookupSCMPX = array();
+		if ($allowSCMPXextended && empty($GenreLookupSCMPX)) {
+			$GenreLookupSCMPX = $GenreLookup;
+			// http://www.geocities.co.jp/SiliconValley-Oakland/3664/alittle.html#GenreExtended
+			// Extended ID3v1 genres invented by SCMPX
+			// Note that 255 "Japanese Anime" conflicts with standard "Unknown"
+			$GenreLookupSCMPX[240] = 'Sacred';
+			$GenreLookupSCMPX[241] = 'Northern Europe';
+			$GenreLookupSCMPX[242] = 'Irish & Scottish';
+			$GenreLookupSCMPX[243] = 'Scotland';
+			$GenreLookupSCMPX[244] = 'Ethnic Europe';
+			$GenreLookupSCMPX[245] = 'Enka';
+			$GenreLookupSCMPX[246] = 'Children\'s Song';
+			$GenreLookupSCMPX[247] = 'Japanese Sky';
+			$GenreLookupSCMPX[248] = 'Japanese Heavy Rock';
+			$GenreLookupSCMPX[249] = 'Japanese Doom Rock';
+			$GenreLookupSCMPX[250] = 'Japanese J-POP';
+			$GenreLookupSCMPX[251] = 'Japanese Seiyu';
+			$GenreLookupSCMPX[252] = 'Japanese Ambient Techno';
+			$GenreLookupSCMPX[253] = 'Japanese Moemoe';
+			$GenreLookupSCMPX[254] = 'Japanese Tokusatsu';
+			//$GenreLookupSCMPX[255] = 'Japanese Anime';
+		}
+
+		return ($allowSCMPXextended ? $GenreLookupSCMPX : $GenreLookup);
+	}
+
+	public static function LookupGenreName($genreid, $allowSCMPXextended=true) {
+		switch ($genreid) {
+			case 'RX':
+			case 'CR':
+				break;
+			default:
+				if (!is_numeric($genreid)) {
+					return false;
+				}
+				$genreid = intval($genreid); // to handle 3 or '3' or '03'
+				break;
+		}
+		$GenreLookup = self::ArrayOfGenres($allowSCMPXextended);
+		return (isset($GenreLookup[$genreid]) ? $GenreLookup[$genreid] : false);
+	}
+
+	public static function LookupGenreID($genre, $allowSCMPXextended=false) {
+		$GenreLookup = self::ArrayOfGenres($allowSCMPXextended);
+		$LowerCaseNoSpaceSearchTerm = strtolower(str_replace(' ', '', $genre));
+		foreach ($GenreLookup as $key => $value) {
+			if (strtolower(str_replace(' ', '', $value)) == $LowerCaseNoSpaceSearchTerm) {
+				return $key;
+			}
+		}
+		return false;
+	}
+
+	public static function StandardiseID3v1GenreName($OriginalGenre) {
+		if (($GenreID = self::LookupGenreID($OriginalGenre)) !== false) {
+			return self::LookupGenreName($GenreID);
+		}
+		return $OriginalGenre;
+	}
+
+	public static function GenerateID3v1Tag($title, $artist, $album, $year, $genreid, $comment, $track='') {
+		$ID3v1Tag  = 'TAG';
+		$ID3v1Tag .= str_pad(trim(substr($title,  0, 30)), 30, "\x00", STR_PAD_RIGHT);
+		$ID3v1Tag .= str_pad(trim(substr($artist, 0, 30)), 30, "\x00", STR_PAD_RIGHT);
+		$ID3v1Tag .= str_pad(trim(substr($album,  0, 30)), 30, "\x00", STR_PAD_RIGHT);
+		$ID3v1Tag .= str_pad(trim(substr($year,   0,  4)),  4, "\x00", STR_PAD_LEFT);
+		if (!empty($track) && ($track > 0) && ($track <= 255)) {
+			$ID3v1Tag .= str_pad(trim(substr($comment, 0, 28)), 28, "\x00", STR_PAD_RIGHT);
+			$ID3v1Tag .= "\x00";
+			if (gettype($track) == 'string') {
+				$track = (int) $track;
+			}
+			$ID3v1Tag .= chr($track);
+		} else {
+			$ID3v1Tag .= str_pad(trim(substr($comment, 0, 30)), 30, "\x00", STR_PAD_RIGHT);
+		}
+		if (($genreid < 0) || ($genreid > 147)) {
+			$genreid = 255; // 'unknown' genre
+		}
+		switch (gettype($genreid)) {
+			case 'string':
+			case 'integer':
+				$ID3v1Tag .= chr(intval($genreid));
+				break;
+			default:
+				$ID3v1Tag .= chr(255); // 'unknown' genre
+				break;
+		}
+
+		return $ID3v1Tag;
+	}
+
+}
Index: /extensions/piwigo_videojs/include/getid3/module.tag.id3v2.php
===================================================================
--- /extensions/piwigo_videojs/include/getid3/module.tag.id3v2.php	(revision 24676)
+++ /extensions/piwigo_videojs/include/getid3/module.tag.id3v2.php	(revision 24676)
@@ -0,0 +1,3414 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+///                                                            //
+// module.tag.id3v2.php                                        //
+// module for analyzing ID3v2 tags                             //
+// dependencies: module.tag.id3v1.php                          //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v1.php', __FILE__, true);
+
+class getid3_id3v2 extends getid3_handler
+{
+	public $StartingOffset = 0;
+
+	public function Analyze() {
+		$info = &$this->getid3->info;
+
+		//    Overall tag structure:
+		//        +-----------------------------+
+		//        |      Header (10 bytes)      |
+		//        +-----------------------------+
+		//        |       Extended Header       |
+		//        | (variable length, OPTIONAL) |
+		//        +-----------------------------+
+		//        |   Frames (variable length)  |
+		//        +-----------------------------+
+		//        |           Padding           |
+		//        | (variable length, OPTIONAL) |
+		//        +-----------------------------+
+		//        | Footer (10 bytes, OPTIONAL) |
+		//        +-----------------------------+
+
+		//    Header
+		//        ID3v2/file identifier      "ID3"
+		//        ID3v2 version              $04 00
+		//        ID3v2 flags                (%ab000000 in v2.2, %abc00000 in v2.3, %abcd0000 in v2.4.x)
+		//        ID3v2 size             4 * %0xxxxxxx
+
+
+		// shortcuts
+		$info['id3v2']['header'] = true;
+		$thisfile_id3v2                  = &$info['id3v2'];
+		$thisfile_id3v2['flags']         =  array();
+		$thisfile_id3v2_flags            = &$thisfile_id3v2['flags'];
+
+
+		fseek($this->getid3->fp, $this->StartingOffset, SEEK_SET);
+		$header = fread($this->getid3->fp, 10);
+		if (substr($header, 0, 3) == 'ID3'  &&  strlen($header) == 10) {
+
+			$thisfile_id3v2['majorversion'] = ord($header{3});
+			$thisfile_id3v2['minorversion'] = ord($header{4});
+
+			// shortcut
+			$id3v2_majorversion = &$thisfile_id3v2['majorversion'];
+
+		} else {
+
+			unset($info['id3v2']);
+			return false;
+
+		}
+
+		if ($id3v2_majorversion > 4) { // this script probably won't correctly parse ID3v2.5.x and above (if it ever exists)
+
+			$info['error'][] = 'this script only parses up to ID3v2.4.x - this tag is ID3v2.'.$id3v2_majorversion.'.'.$thisfile_id3v2['minorversion'];
+			return false;
+
+		}
+
+		$id3_flags = ord($header{5});
+		switch ($id3v2_majorversion) {
+			case 2:
+				// %ab000000 in v2.2
+				$thisfile_id3v2_flags['unsynch']     = (bool) ($id3_flags & 0x80); // a - Unsynchronisation
+				$thisfile_id3v2_flags['compression'] = (bool) ($id3_flags & 0x40); // b - Compression
+				break;
+
+			case 3:
+				// %abc00000 in v2.3
+				$thisfile_id3v2_flags['unsynch']     = (bool) ($id3_flags & 0x80); // a - Unsynchronisation
+				$thisfile_id3v2_flags['exthead']     = (bool) ($id3_flags & 0x40); // b - Extended header
+				$thisfile_id3v2_flags['experim']     = (bool) ($id3_flags & 0x20); // c - Experimental indicator
+				break;
+
+			case 4:
+				// %abcd0000 in v2.4
+				$thisfile_id3v2_flags['unsynch']     = (bool) ($id3_flags & 0x80); // a - Unsynchronisation
+				$thisfile_id3v2_flags['exthead']     = (bool) ($id3_flags & 0x40); // b - Extended header
+				$thisfile_id3v2_flags['experim']     = (bool) ($id3_flags & 0x20); // c - Experimental indicator
+				$thisfile_id3v2_flags['isfooter']    = (bool) ($id3_flags & 0x10); // d - Footer present
+				break;
+		}
+
+		$thisfile_id3v2['headerlength'] = getid3_lib::BigEndian2Int(substr($header, 6, 4), 1) + 10; // length of ID3v2 tag in 10-byte header doesn't include 10-byte header length
+
+		$thisfile_id3v2['tag_offset_start'] = $this->StartingOffset;
+		$thisfile_id3v2['tag_offset_end']   = $thisfile_id3v2['tag_offset_start'] + $thisfile_id3v2['headerlength'];
+
+
+
+		// create 'encoding' key - used by getid3::HandleAllTags()
+		// in ID3v2 every field can have it's own encoding type
+		// so force everything to UTF-8 so it can be handled consistantly
+		$thisfile_id3v2['encoding'] = 'UTF-8';
+
+
+	//    Frames
+
+	//        All ID3v2 frames consists of one frame header followed by one or more
+	//        fields containing the actual information. The header is always 10
+	//        bytes and laid out as follows:
+	//
+	//        Frame ID      $xx xx xx xx  (four characters)
+	//        Size      4 * %0xxxxxxx
+	//        Flags         $xx xx
+
+		$sizeofframes = $thisfile_id3v2['headerlength'] - 10; // not including 10-byte initial header
+		if (!empty($thisfile_id3v2['exthead']['length'])) {
+			$sizeofframes -= ($thisfile_id3v2['exthead']['length'] + 4);
+		}
+		if (!empty($thisfile_id3v2_flags['isfooter'])) {
+			$sizeofframes -= 10; // footer takes last 10 bytes of ID3v2 header, after frame data, before audio
+		}
+		if ($sizeofframes > 0) {
+
+			$framedata = fread($this->getid3->fp, $sizeofframes); // read all frames from file into $framedata variable
+
+			//    if entire frame data is unsynched, de-unsynch it now (ID3v2.3.x)
+			if (!empty($thisfile_id3v2_flags['unsynch']) && ($id3v2_majorversion <= 3)) {
+				$framedata = $this->DeUnsynchronise($framedata);
+			}
+			//        [in ID3v2.4.0] Unsynchronisation [S:6.1] is done on frame level, instead
+			//        of on tag level, making it easier to skip frames, increasing the streamability
+			//        of the tag. The unsynchronisation flag in the header [S:3.1] indicates that
+			//        there exists an unsynchronised frame, while the new unsynchronisation flag in
+			//        the frame header [S:4.1.2] indicates unsynchronisation.
+
+
+			//$framedataoffset = 10 + ($thisfile_id3v2['exthead']['length'] ? $thisfile_id3v2['exthead']['length'] + 4 : 0); // how many bytes into the stream - start from after the 10-byte header (and extended header length+4, if present)
+			$framedataoffset = 10; // how many bytes into the stream - start from after the 10-byte header
+
+
+			//    Extended Header
+			if (!empty($thisfile_id3v2_flags['exthead'])) {
+				$extended_header_offset = 0;
+
+				if ($id3v2_majorversion == 3) {
+
+					// v2.3 definition:
+					//Extended header size  $xx xx xx xx   // 32-bit integer
+					//Extended Flags        $xx xx
+					//     %x0000000 %00000000 // v2.3
+					//     x - CRC data present
+					//Size of padding       $xx xx xx xx
+
+					$thisfile_id3v2['exthead']['length'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4), 0);
+					$extended_header_offset += 4;
+
+					$thisfile_id3v2['exthead']['flag_bytes'] = 2;
+					$thisfile_id3v2['exthead']['flag_raw'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, $thisfile_id3v2['exthead']['flag_bytes']));
+					$extended_header_offset += $thisfile_id3v2['exthead']['flag_bytes'];
+
+					$thisfile_id3v2['exthead']['flags']['crc'] = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x8000);
+
+					$thisfile_id3v2['exthead']['padding_size'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4));
+					$extended_header_offset += 4;
+
+					if ($thisfile_id3v2['exthead']['flags']['crc']) {
+						$thisfile_id3v2['exthead']['flag_data']['crc'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4));
+						$extended_header_offset += 4;
+					}
+					$extended_header_offset += $thisfile_id3v2['exthead']['padding_size'];
+
+				} elseif ($id3v2_majorversion == 4) {
+
+					// v2.4 definition:
+					//Extended header size   4 * %0xxxxxxx // 28-bit synchsafe integer
+					//Number of flag bytes       $01
+					//Extended Flags             $xx
+					//     %0bcd0000 // v2.4
+					//     b - Tag is an update
+					//         Flag data length       $00
+					//     c - CRC data present
+					//         Flag data length       $05
+					//         Total frame CRC    5 * %0xxxxxxx
+					//     d - Tag restrictions
+					//         Flag data length       $01
+
+					$thisfile_id3v2['exthead']['length'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4), true);
+					$extended_header_offset += 4;
+
+					$thisfile_id3v2['exthead']['flag_bytes'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); // should always be 1
+					$extended_header_offset += 1;
+
+					$thisfile_id3v2['exthead']['flag_raw'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, $thisfile_id3v2['exthead']['flag_bytes']));
+					$extended_header_offset += $thisfile_id3v2['exthead']['flag_bytes'];
+
+					$thisfile_id3v2['exthead']['flags']['update']       = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x40);
+					$thisfile_id3v2['exthead']['flags']['crc']          = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x20);
+					$thisfile_id3v2['exthead']['flags']['restrictions'] = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x10);
+
+					if ($thisfile_id3v2['exthead']['flags']['update']) {
+						$ext_header_chunk_length = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); // should be 0
+						$extended_header_offset += 1;
+					}
+
+					if ($thisfile_id3v2['exthead']['flags']['crc']) {
+						$ext_header_chunk_length = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); // should be 5
+						$extended_header_offset += 1;
+						$thisfile_id3v2['exthead']['flag_data']['crc'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, $ext_header_chunk_length), true, false);
+						$extended_header_offset += $ext_header_chunk_length;
+					}
+
+					if ($thisfile_id3v2['exthead']['flags']['restrictions']) {
+						$ext_header_chunk_length = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); // should be 1
+						$extended_header_offset += 1;
+
+						// %ppqrrstt
+						$restrictions_raw = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1));
+						$extended_header_offset += 1;
+						$thisfile_id3v2['exthead']['flags']['restrictions']['tagsize']  = ($restrictions_raw & 0xC0) >> 6; // p - Tag size restrictions
+						$thisfile_id3v2['exthead']['flags']['restrictions']['textenc']  = ($restrictions_raw & 0x20) >> 5; // q - Text encoding restrictions
+						$thisfile_id3v2['exthead']['flags']['restrictions']['textsize'] = ($restrictions_raw & 0x18) >> 3; // r - Text fields size restrictions
+						$thisfile_id3v2['exthead']['flags']['restrictions']['imgenc']   = ($restrictions_raw & 0x04) >> 2; // s - Image encoding restrictions
+						$thisfile_id3v2['exthead']['flags']['restrictions']['imgsize']  = ($restrictions_raw & 0x03) >> 0; // t - Image size restrictions
+
+						$thisfile_id3v2['exthead']['flags']['restrictions_text']['tagsize']  = $this->LookupExtendedHeaderRestrictionsTagSizeLimits($thisfile_id3v2['exthead']['flags']['restrictions']['tagsize']);
+						$thisfile_id3v2['exthead']['flags']['restrictions_text']['textenc']  = $this->LookupExtendedHeaderRestrictionsTextEncodings($thisfile_id3v2['exthead']['flags']['restrictions']['textenc']);
+						$thisfile_id3v2['exthead']['flags']['restrictions_text']['textsize'] = $this->LookupExtendedHeaderRestrictionsTextFieldSize($thisfile_id3v2['exthead']['flags']['restrictions']['textsize']);
+						$thisfile_id3v2['exthead']['flags']['restrictions_text']['imgenc']   = $this->LookupExtendedHeaderRestrictionsImageEncoding($thisfile_id3v2['exthead']['flags']['restrictions']['imgenc']);
+						$thisfile_id3v2['exthead']['flags']['restrictions_text']['imgsize']  = $this->LookupExtendedHeaderRestrictionsImageSizeSize($thisfile_id3v2['exthead']['flags']['restrictions']['imgsize']);
+					}
+
+					if ($thisfile_id3v2['exthead']['length'] != $extended_header_offset) {
+						$info['warning'][] = 'ID3v2.4 extended header length mismatch (expecting '.intval($thisfile_id3v2['exthead']['length']).', found '.intval($extended_header_offset).')';
+					}
+				}
+
+				$framedataoffset += $extended_header_offset;
+				$framedata = substr($framedata, $extended_header_offset);
+			} // end extended header
+
+
+			while (isset($framedata) && (strlen($framedata) > 0)) { // cycle through until no more frame data is left to parse
+				if (strlen($framedata) <= $this->ID3v2HeaderLength($id3v2_majorversion)) {
+					// insufficient room left in ID3v2 header for actual data - must be padding
+					$thisfile_id3v2['padding']['start']  = $framedataoffset;
+					$thisfile_id3v2['padding']['length'] = strlen($framedata);
+					$thisfile_id3v2['padding']['valid']  = true;
+					for ($i = 0; $i < $thisfile_id3v2['padding']['length']; $i++) {
+						if ($framedata{$i} != "\x00") {
+							$thisfile_id3v2['padding']['valid'] = false;
+							$thisfile_id3v2['padding']['errorpos'] = $thisfile_id3v2['padding']['start'] + $i;
+							$info['warning'][] = 'Invalid ID3v2 padding found at offset '.$thisfile_id3v2['padding']['errorpos'].' (the remaining '.($thisfile_id3v2['padding']['length'] - $i).' bytes are considered invalid)';
+							break;
+						}
+					}
+					break; // skip rest of ID3v2 header
+				}
+				if ($id3v2_majorversion == 2) {
+					// Frame ID  $xx xx xx (three characters)
+					// Size      $xx xx xx (24-bit integer)
+					// Flags     $xx xx
+
+					$frame_header = substr($framedata, 0, 6); // take next 6 bytes for header
+					$framedata    = substr($framedata, 6);    // and leave the rest in $framedata
+					$frame_name   = substr($frame_header, 0, 3);
+					$frame_size   = getid3_lib::BigEndian2Int(substr($frame_header, 3, 3), 0);
+					$frame_flags  = 0; // not used for anything in ID3v2.2, just set to avoid E_NOTICEs
+
+				} elseif ($id3v2_majorversion > 2) {
+
+					// Frame ID  $xx xx xx xx (four characters)
+					// Size      $xx xx xx xx (32-bit integer in v2.3, 28-bit synchsafe in v2.4+)
+					// Flags     $xx xx
+
+					$frame_header = substr($framedata, 0, 10); // take next 10 bytes for header
+					$framedata    = substr($framedata, 10);    // and leave the rest in $framedata
+
+					$frame_name = substr($frame_header, 0, 4);
+					if ($id3v2_majorversion == 3) {
+						$frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 0); // 32-bit integer
+					} else { // ID3v2.4+
+						$frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 1); // 32-bit synchsafe integer (28-bit value)
+					}
+
+					if ($frame_size < (strlen($framedata) + 4)) {
+						$nextFrameID = substr($framedata, $frame_size, 4);
+						if ($this->IsValidID3v2FrameName($nextFrameID, $id3v2_majorversion)) {
+							// next frame is OK
+						} elseif (($frame_name == "\x00".'MP3') || ($frame_name == "\x00\x00".'MP') || ($frame_name == ' MP3') || ($frame_name == 'MP3e')) {
+							// MP3ext known broken frames - "ok" for the purposes of this test
+						} elseif (($id3v2_majorversion == 4) && ($this->IsValidID3v2FrameName(substr($framedata, getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 0), 4), 3))) {
+							$info['warning'][] = 'ID3v2 tag written as ID3v2.4, but with non-synchsafe integers (ID3v2.3 style). Older versions of (Helium2; iTunes) are known culprits of this. Tag has been parsed as ID3v2.3';
+							$id3v2_majorversion = 3;
+							$frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 0); // 32-bit integer
+						}
+					}
+
+
+					$frame_flags = getid3_lib::BigEndian2Int(substr($frame_header, 8, 2));
+				}
+
+				if ((($id3v2_majorversion == 2) && ($frame_name == "\x00\x00\x00")) || ($frame_name == "\x00\x00\x00\x00")) {
+					// padding encountered
+
+					$thisfile_id3v2['padding']['start']  = $framedataoffset;
+					$thisfile_id3v2['padding']['length'] = strlen($frame_header) + strlen($framedata);
+					$thisfile_id3v2['padding']['valid']  = true;
+
+					$len = strlen($framedata);
+					for ($i = 0; $i < $len; $i++) {
+						if ($framedata{$i} != "\x00") {
+							$thisfile_id3v2['padding']['valid'] = false;
+							$thisfile_id3v2['padding']['errorpos'] = $thisfile_id3v2['padding']['start'] + $i;
+							$info['warning'][] = 'Invalid ID3v2 padding found at offset '.$thisfile_id3v2['padding']['errorpos'].' (the remaining '.($thisfile_id3v2['padding']['length'] - $i).' bytes are considered invalid)';
+							break;
+						}
+					}
+					break; // skip rest of ID3v2 header
+				}
+
+				if ($frame_name == 'COM ') {
+					$info['warning'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: IsValidID3v2FrameName("'.str_replace("\x00", ' ', $frame_name).'", '.$id3v2_majorversion.'))). [Note: this particular error has been known to happen with tags edited by iTunes (versions "X v2.0.3", "v3.0.1" are known-guilty, probably others too)]';
+					$frame_name = 'COMM';
+				}
+				if (($frame_size <= strlen($framedata)) && ($this->IsValidID3v2FrameName($frame_name, $id3v2_majorversion))) {
+
+					unset($parsedFrame);
+					$parsedFrame['frame_name']      = $frame_name;
+					$parsedFrame['frame_flags_raw'] = $frame_flags;
+					$parsedFrame['data']            = substr($framedata, 0, $frame_size);
+					$parsedFrame['datalength']      = getid3_lib::CastAsInt($frame_size);
+					$parsedFrame['dataoffset']      = $framedataoffset;
+
+					$this->ParseID3v2Frame($parsedFrame);
+					$thisfile_id3v2[$frame_name][] = $parsedFrame;
+
+					$framedata = substr($framedata, $frame_size);
+
+				} else { // invalid frame length or FrameID
+
+					if ($frame_size <= strlen($framedata)) {
+
+						if ($this->IsValidID3v2FrameName(substr($framedata, $frame_size, 4), $id3v2_majorversion)) {
+
+							// next frame is valid, just skip the current frame
+							$framedata = substr($framedata, $frame_size);
+							$info['warning'][] = 'Next ID3v2 frame is valid, skipping current frame.';
+
+						} else {
+
+							// next frame is invalid too, abort processing
+							//unset($framedata);
+							$framedata = null;
+							$info['error'][] = 'Next ID3v2 frame is also invalid, aborting processing.';
+
+						}
+
+					} elseif ($frame_size == strlen($framedata)) {
+
+						// this is the last frame, just skip
+						$info['warning'][] = 'This was the last ID3v2 frame.';
+
+					} else {
+
+						// next frame is invalid too, abort processing
+						//unset($framedata);
+						$framedata = null;
+						$info['warning'][] = 'Invalid ID3v2 frame size, aborting.';
+
+					}
+					if (!$this->IsValidID3v2FrameName($frame_name, $id3v2_majorversion)) {
+
+						switch ($frame_name) {
+							case "\x00\x00".'MP':
+							case "\x00".'MP3':
+							case ' MP3':
+							case 'MP3e':
+							case "\x00".'MP':
+							case ' MP':
+							case 'MP3':
+								$info['warning'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: !IsValidID3v2FrameName("'.str_replace("\x00", ' ', $frame_name).'", '.$id3v2_majorversion.'))). [Note: this particular error has been known to happen with tags edited by "MP3ext (www.mutschler.de/mp3ext/)"]';
+								break;
+
+							default:
+								$info['warning'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: !IsValidID3v2FrameName("'.str_replace("\x00", ' ', $frame_name).'", '.$id3v2_majorversion.'))).';
+								break;
+						}
+
+					} elseif (!isset($framedata) || ($frame_size > strlen($framedata))) {
+
+						$info['error'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: $frame_size ('.$frame_size.') > strlen($framedata) ('.(isset($framedata) ? strlen($framedata) : 'null').')).';
+
+					} else {
+
+						$info['error'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag).';
+
+					}
+
+				}
+				$framedataoffset += ($frame_size + $this->ID3v2HeaderLength($id3v2_majorversion));
+
+			}
+
+		}
+
+
+	//    Footer
+
+	//    The footer is a copy of the header, but with a different identifier.
+	//        ID3v2 identifier           "3DI"
+	//        ID3v2 version              $04 00
+	//        ID3v2 flags                %abcd0000
+	//        ID3v2 size             4 * %0xxxxxxx
+
+		if (isset($thisfile_id3v2_flags['isfooter']) && $thisfile_id3v2_flags['isfooter']) {
+			$footer = fread($this->getid3->fp, 10);
+			if (substr($footer, 0, 3) == '3DI') {
+				$thisfile_id3v2['footer'] = true;
+				$thisfile_id3v2['majorversion_footer'] = ord($footer{3});
+				$thisfile_id3v2['minorversion_footer'] = ord($footer{4});
+			}
+			if ($thisfile_id3v2['majorversion_footer'] <= 4) {
+				$id3_flags = ord(substr($footer{5}));
+				$thisfile_id3v2_flags['unsynch_footer']  = (bool) ($id3_flags & 0x80);
+				$thisfile_id3v2_flags['extfoot_footer']  = (bool) ($id3_flags & 0x40);
+				$thisfile_id3v2_flags['experim_footer']  = (bool) ($id3_flags & 0x20);
+				$thisfile_id3v2_flags['isfooter_footer'] = (bool) ($id3_flags & 0x10);
+
+				$thisfile_id3v2['footerlength'] = getid3_lib::BigEndian2Int(substr($footer, 6, 4), 1);
+			}
+		} // end footer
+
+		if (isset($thisfile_id3v2['comments']['genre'])) {
+			foreach ($thisfile_id3v2['comments']['genre'] as $key => $value) {
+				unset($thisfile_id3v2['comments']['genre'][$key]);
+				$thisfile_id3v2['comments'] = getid3_lib::array_merge_noclobber($thisfile_id3v2['comments'], array('genre'=>$this->ParseID3v2GenreString($value)));
+			}
+		}
+
+		if (isset($thisfile_id3v2['comments']['track'])) {
+			foreach ($thisfile_id3v2['comments']['track'] as $key => $value) {
+				if (strstr($value, '/')) {
+					list($thisfile_id3v2['comments']['tracknum'][$key], $thisfile_id3v2['comments']['totaltracks'][$key]) = explode('/', $thisfile_id3v2['comments']['track'][$key]);
+				}
+			}
+		}
+
+		if (!isset($thisfile_id3v2['comments']['year']) && !empty($thisfile_id3v2['comments']['recording_time'][0]) && preg_match('#^([0-9]{4})#', trim($thisfile_id3v2['comments']['recording_time'][0]), $matches)) {
+			$thisfile_id3v2['comments']['year'] = array($matches[1]);
+		}
+
+
+		if (!empty($thisfile_id3v2['TXXX'])) {
+			// MediaMonkey does this, maybe others: write a blank RGAD frame, but put replay-gain adjustment values in TXXX frames
+			foreach ($thisfile_id3v2['TXXX'] as $txxx_array) {
+				switch ($txxx_array['description']) {
+					case 'replaygain_track_gain':
+						if (empty($info['replay_gain']['track']['adjustment']) && !empty($txxx_array['data'])) {
+							$info['replay_gain']['track']['adjustment'] = floatval(trim(str_replace('dB', '', $txxx_array['data'])));
+						}
+						break;
+					case 'replaygain_track_peak':
+						if (empty($info['replay_gain']['track']['peak']) && !empty($txxx_array['data'])) {
+							$info['replay_gain']['track']['peak'] = floatval($txxx_array['data']);
+						}
+						break;
+					case 'replaygain_album_gain':
+						if (empty($info['replay_gain']['album']['adjustment']) && !empty($txxx_array['data'])) {
+							$info['replay_gain']['album']['adjustment'] = floatval(trim(str_replace('dB', '', $txxx_array['data'])));
+						}
+						break;
+				}
+			}
+		}
+
+
+		// Set avdataoffset
+		$info['avdataoffset'] = $thisfile_id3v2['headerlength'];
+		if (isset($thisfile_id3v2['footer'])) {
+			$info['avdataoffset'] += 10;
+		}
+
+		return true;
+	}
+
+
+	public function ParseID3v2GenreString($genrestring) {
+		// Parse genres into arrays of genreName and genreID
+		// ID3v2.2.x, ID3v2.3.x: '(21)' or '(4)Eurodisco' or '(51)(39)' or '(55)((I think...)'
+		// ID3v2.4.x: '21' $00 'Eurodisco' $00
+		$clean_genres = array();
+		if (strpos($genrestring, "\x00") === false) {
+			$genrestring = preg_replace('#\(([0-9]{1,3})\)#', '$1'."\x00", $genrestring);
+		}
+		$genre_elements = explode("\x00", $genrestring);
+		foreach ($genre_elements as $element) {
+			$element = trim($element);
+			if ($element) {
+				if (preg_match('#^[0-9]{1,3}#', $element)) {
+					$clean_genres[] = getid3_id3v1::LookupGenreName($element);
+				} else {
+					$clean_genres[] = str_replace('((', '(', $element);
+				}
+			}
+		}
+		return $clean_genres;
+	}
+
+
+	public function ParseID3v2Frame(&$parsedFrame) {
+
+		// shortcuts
+		$info = &$this->getid3->info;
+		$id3v2_majorversion = $info['id3v2']['majorversion'];
+
+		$parsedFrame['framenamelong']  = $this->FrameNameLongLookup($parsedFrame['frame_name']);
+		if (empty($parsedFrame['framenamelong'])) {
+			unset($parsedFrame['framenamelong']);
+		}
+		$parsedFrame['framenameshort'] = $this->FrameNameShortLookup($parsedFrame['frame_name']);
+		if (empty($parsedFrame['framenameshort'])) {
+			unset($parsedFrame['framenameshort']);
+		}
+
+		if ($id3v2_majorversion >= 3) { // frame flags are not part of the ID3v2.2 standard
+			if ($id3v2_majorversion == 3) {
+				//    Frame Header Flags
+				//    %abc00000 %ijk00000
+				$parsedFrame['flags']['TagAlterPreservation']  = (bool) ($parsedFrame['frame_flags_raw'] & 0x8000); // a - Tag alter preservation
+				$parsedFrame['flags']['FileAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x4000); // b - File alter preservation
+				$parsedFrame['flags']['ReadOnly']              = (bool) ($parsedFrame['frame_flags_raw'] & 0x2000); // c - Read only
+				$parsedFrame['flags']['compression']           = (bool) ($parsedFrame['frame_flags_raw'] & 0x0080); // i - Compression
+				$parsedFrame['flags']['Encryption']            = (bool) ($parsedFrame['frame_flags_raw'] & 0x0040); // j - Encryption
+				$parsedFrame['flags']['GroupingIdentity']      = (bool) ($parsedFrame['frame_flags_raw'] & 0x0020); // k - Grouping identity
+
+			} elseif ($id3v2_majorversion == 4) {
+				//    Frame Header Flags
+				//    %0abc0000 %0h00kmnp
+				$parsedFrame['flags']['TagAlterPreservation']  = (bool) ($parsedFrame['frame_flags_raw'] & 0x4000); // a - Tag alter preservation
+				$parsedFrame['flags']['FileAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x2000); // b - File alter preservation
+				$parsedFrame['flags']['ReadOnly']              = (bool) ($parsedFrame['frame_flags_raw'] & 0x1000); // c - Read only
+				$parsedFrame['flags']['GroupingIdentity']      = (bool) ($parsedFrame['frame_flags_raw'] & 0x0040); // h - Grouping identity
+				$parsedFrame['flags']['compression']           = (bool) ($parsedFrame['frame_flags_raw'] & 0x0008); // k - Compression
+				$parsedFrame['flags']['Encryption']            = (bool) ($parsedFrame['frame_flags_raw'] & 0x0004); // m - Encryption
+				$parsedFrame['flags']['Unsynchronisation']     = (bool) ($parsedFrame['frame_flags_raw'] & 0x0002); // n - Unsynchronisation
+				$parsedFrame['flags']['DataLengthIndicator']   = (bool) ($parsedFrame['frame_flags_raw'] & 0x0001); // p - Data length indicator
+
+				// Frame-level de-unsynchronisation - ID3v2.4
+				if ($parsedFrame['flags']['Unsynchronisation']) {
+					$parsedFrame['data'] = $this->DeUnsynchronise($parsedFrame['data']);
+				}
+
+				if ($parsedFrame['flags']['DataLengthIndicator']) {
+					$parsedFrame['data_length_indicator'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 4), 1);
+					$parsedFrame['data']                  =                           substr($parsedFrame['data'], 4);
+				}
+			}
+
+			//    Frame-level de-compression
+			if ($parsedFrame['flags']['compression']) {
+				$parsedFrame['decompressed_size'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 4));
+				if (!function_exists('gzuncompress')) {
+					$info['warning'][] = 'gzuncompress() support required to decompress ID3v2 frame "'.$parsedFrame['frame_name'].'"';
+				} else {
+					if ($decompresseddata = @gzuncompress(substr($parsedFrame['data'], 4))) {
+					//if ($decompresseddata = @gzuncompress($parsedFrame['data'])) {
+						$parsedFrame['data'] = $decompresseddata;
+						unset($decompresseddata);
+					} else {
+						$info['warning'][] = 'gzuncompress() failed on compressed contents of ID3v2 frame "'.$parsedFrame['frame_name'].'"';
+					}
+				}
+			}
+		}
+
+		if (!empty($parsedFrame['flags']['DataLengthIndicator'])) {
+			if ($parsedFrame['data_length_indicator'] != strlen($parsedFrame['data'])) {
+				$info['warning'][] = 'ID3v2 frame "'.$parsedFrame['frame_name'].'" should be '.$parsedFrame['data_length_indicator'].' bytes long according to DataLengthIndicator, but found '.strlen($parsedFrame['data']).' bytes of data';
+			}
+		}
+
+		if (isset($parsedFrame['datalength']) && ($parsedFrame['datalength'] == 0)) {
+
+			$warning = 'Frame "'.$parsedFrame['frame_name'].'" at offset '.$parsedFrame['dataoffset'].' has no data portion';
+			switch ($parsedFrame['frame_name']) {
+				case 'WCOM':
+					$warning .= ' (this is known to happen with files tagged by RioPort)';
+					break;
+
+				default:
+					break;
+			}
+			$info['warning'][] = $warning;
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'UFID')) || // 4.1   UFID Unique file identifier
+			(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'UFI'))) {  // 4.1   UFI  Unique file identifier
+			//   There may be more than one 'UFID' frame in a tag,
+			//   but only one with the same 'Owner identifier'.
+			// <Header for 'Unique file identifier', ID: 'UFID'>
+			// Owner identifier        <text string> $00
+			// Identifier              <up to 64 bytes binary data>
+			$exploded = explode("\x00", $parsedFrame['data'], 2);
+			$parsedFrame['ownerid'] = (isset($exploded[0]) ? $exploded[0] : '');
+			$parsedFrame['data']    = (isset($exploded[1]) ? $exploded[1] : '');
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'TXXX')) || // 4.2.2 TXXX User defined text information frame
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'TXX'))) {    // 4.2.2 TXX  User defined text information frame
+			//   There may be more than one 'TXXX' frame in each tag,
+			//   but only one with the same description.
+			// <Header for 'User defined text information frame', ID: 'TXXX'>
+			// Text encoding     $xx
+			// Description       <text string according to encoding> $00 (00)
+			// Value             <text string according to encoding>
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+			$frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
+			if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+				$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+			}
+			$frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_description) === 0) {
+				$frame_description = '';
+			}
+			$parsedFrame['encodingid']  = $frame_textencoding;
+			$parsedFrame['encoding']    = $this->TextEncodingNameLookup($frame_textencoding);
+
+			$parsedFrame['description'] = $frame_description;
+			$parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)));
+			if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
+				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']));
+			}
+			//unset($parsedFrame['data']); do not unset, may be needed elsewhere, e.g. for replaygain
+
+
+		} elseif ($parsedFrame['frame_name']{0} == 'T') { // 4.2. T??[?] Text information frame
+			//   There may only be one text information frame of its kind in an tag.
+			// <Header for 'Text information frame', ID: 'T000' - 'TZZZ',
+			// excluding 'TXXX' described in 4.2.6.>
+			// Text encoding                $xx
+			// Information                  <text string(s) according to encoding>
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+
+			$parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset);
+
+			$parsedFrame['encodingid'] = $frame_textencoding;
+			$parsedFrame['encoding']   = $this->TextEncodingNameLookup($frame_textencoding);
+
+			if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
+				// ID3v2.3 specs say that TPE1 (and others) can contain multiple artist values separated with /
+				// This of course breaks when an aritst name contains slash character, e.g. "AC/DC"
+				// MP3tag (maybe others) implement alternative system where multiple artists are null-separated, which makes more sense
+				// getID3 will split null-separated artists into multiple artists and leave slash-separated ones to the user
+				switch ($parsedFrame['encoding']) {
+					case 'UTF-16':
+					case 'UTF-16BE':
+					case 'UTF-16LE':
+						$wordsize = 2;
+						break;
+					case 'ISO-8859-1':
+					case 'UTF-8':
+					default:
+						$wordsize = 1;
+						break;
+				}
+				$Txxx_elements = array();
+				$Txxx_elements_start_offset = 0;
+				for ($i = 0; $i < strlen($parsedFrame['data']); $i += $wordsize) {
+					if (substr($parsedFrame['data'], $i, $wordsize) == str_repeat("\x00", $wordsize)) {
+						$Txxx_elements[] = substr($parsedFrame['data'], $Txxx_elements_start_offset, $i - $Txxx_elements_start_offset);
+						$Txxx_elements_start_offset = $i + $wordsize;
+					}
+				}
+				$Txxx_elements[] = substr($parsedFrame['data'], $Txxx_elements_start_offset, $i - $Txxx_elements_start_offset);
+				foreach ($Txxx_elements as $Txxx_element) {
+					$string = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $Txxx_element);
+					if (!empty($string)) {
+						$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $string;
+					}
+				}
+				unset($string, $wordsize, $i, $Txxx_elements, $Txxx_element, $Txxx_elements_start_offset);
+			}
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'WXXX')) || // 4.3.2 WXXX User defined URL link frame
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'WXX'))) {    // 4.3.2 WXX  User defined URL link frame
+			//   There may be more than one 'WXXX' frame in each tag,
+			//   but only one with the same description
+			// <Header for 'User defined URL link frame', ID: 'WXXX'>
+			// Text encoding     $xx
+			// Description       <text string according to encoding> $00 (00)
+			// URL               <text string>
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+			$frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
+			if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+				$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+			}
+			$frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+
+			if (ord($frame_description) === 0) {
+				$frame_description = '';
+			}
+			$parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)));
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding));
+			if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+				$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+			}
+			if ($frame_terminatorpos) {
+				// there are null bytes after the data - this is not according to spec
+				// only use data up to first null byte
+				$frame_urldata = (string) substr($parsedFrame['data'], 0, $frame_terminatorpos);
+			} else {
+				// no null bytes following data, just use all data
+				$frame_urldata = (string) $parsedFrame['data'];
+			}
+
+			$parsedFrame['encodingid']  = $frame_textencoding;
+			$parsedFrame['encoding']    = $this->TextEncodingNameLookup($frame_textencoding);
+
+			$parsedFrame['url']         = $frame_urldata;
+			$parsedFrame['description'] = $frame_description;
+			if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) {
+				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['url']);
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif ($parsedFrame['frame_name']{0} == 'W') { // 4.3. W??? URL link frames
+			//   There may only be one URL link frame of its kind in a tag,
+			//   except when stated otherwise in the frame description
+			// <Header for 'URL link frame', ID: 'W000' - 'WZZZ', excluding 'WXXX'
+			// described in 4.3.2.>
+			// URL              <text string>
+
+			$parsedFrame['url'] = trim($parsedFrame['data']);
+			if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) {
+				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['url'];
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion == 3) && ($parsedFrame['frame_name'] == 'IPLS')) || // 4.4  IPLS Involved people list (ID3v2.3 only)
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'IPL'))) {     // 4.4  IPL  Involved people list (ID3v2.2 only)
+			// http://id3.org/id3v2.3.0#sec4.4
+			//   There may only be one 'IPL' frame in each tag
+			// <Header for 'User defined URL link frame', ID: 'IPL'>
+			// Text encoding     $xx
+			// People list strings    <textstrings>
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+			$parsedFrame['encodingid'] = $frame_textencoding;
+			$parsedFrame['encoding']   = $this->TextEncodingNameLookup($parsedFrame['encodingid']);
+			$parsedFrame['data_raw']   = (string) substr($parsedFrame['data'], $frame_offset);
+
+			// http://www.getid3.org/phpBB3/viewtopic.php?t=1369
+			// "this tag typically contains null terminated strings, which are associated in pairs"
+			// "there are users that use the tag incorrectly"
+			$IPLS_parts = array();
+			if (strpos($parsedFrame['data_raw'], "\x00") !== false) {
+				$IPLS_parts_unsorted = array();
+				if (((strlen($parsedFrame['data_raw']) % 2) == 0) && ((substr($parsedFrame['data_raw'], 0, 2) == "\xFF\xFE") || (substr($parsedFrame['data_raw'], 0, 2) == "\xFE\xFF"))) {
+					// UTF-16, be careful looking for null bytes since most 2-byte characters may contain one; you need to find twin null bytes, and on even padding
+					$thisILPS  = '';
+					for ($i = 0; $i < strlen($parsedFrame['data_raw']); $i += 2) {
+						$twobytes = substr($parsedFrame['data_raw'], $i, 2);
+						if ($twobytes === "\x00\x00") {
+							$IPLS_parts_unsorted[] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $thisILPS);
+							$thisILPS  = '';
+						} else {
+							$thisILPS .= $twobytes;
+						}
+					}
+					if (strlen($thisILPS) > 2) { // 2-byte BOM
+						$IPLS_parts_unsorted[] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $thisILPS);
+					}
+				} else {
+					// ISO-8859-1 or UTF-8 or other single-byte-null character set
+					$IPLS_parts_unsorted = explode("\x00", $parsedFrame['data_raw']);
+				}
+				if (count($IPLS_parts_unsorted) == 1) {
+					// just a list of names, e.g. "Dino Baptiste, Jimmy Copley, John Gordon, Bernie Marsden, Sharon Watson"
+					foreach ($IPLS_parts_unsorted as $key => $value) {
+						$IPLS_parts_sorted = preg_split('#[;,\\r\\n\\t]#', $value);
+						$position = '';
+						foreach ($IPLS_parts_sorted as $person) {
+							$IPLS_parts[] = array('position'=>$position, 'person'=>$person);
+						}
+					}
+				} elseif ((count($IPLS_parts_unsorted) % 2) == 0) {
+					$position = '';
+					$person   = '';
+					foreach ($IPLS_parts_unsorted as $key => $value) {
+						if (($key % 2) == 0) {
+							$position = $value;
+						} else {
+							$person   = $value;
+							$IPLS_parts[] = array('position'=>$position, 'person'=>$person);
+							$position = '';
+							$person   = '';
+						}
+					}
+				} else {
+					foreach ($IPLS_parts_unsorted as $key => $value) {
+						$IPLS_parts[] = array($value);
+					}
+				}
+
+			} else {
+				$IPLS_parts = preg_split('#[;,\\r\\n\\t]#', $parsedFrame['data_raw']);
+			}
+			$parsedFrame['data'] = $IPLS_parts;
+
+			if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
+				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['data'];
+			}
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'MCDI')) || // 4.4   MCDI Music CD identifier
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'MCI'))) {     // 4.5   MCI  Music CD identifier
+			//   There may only be one 'MCDI' frame in each tag
+			// <Header for 'Music CD identifier', ID: 'MCDI'>
+			// CD TOC                <binary data>
+
+			if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
+				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['data'];
+			}
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'ETCO')) || // 4.5   ETCO Event timing codes
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'ETC'))) {     // 4.6   ETC  Event timing codes
+			//   There may only be one 'ETCO' frame in each tag
+			// <Header for 'Event timing codes', ID: 'ETCO'>
+			// Time stamp format    $xx
+			//   Where time stamp format is:
+			// $01  (32-bit value) MPEG frames from beginning of file
+			// $02  (32-bit value) milliseconds from beginning of file
+			//   Followed by a list of key events in the following format:
+			// Type of event   $xx
+			// Time stamp      $xx (xx ...)
+			//   The 'Time stamp' is set to zero if directly at the beginning of the sound
+			//   or after the previous event. All events MUST be sorted in chronological order.
+
+			$frame_offset = 0;
+			$parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+
+			while ($frame_offset < strlen($parsedFrame['data'])) {
+				$parsedFrame['typeid']    = substr($parsedFrame['data'], $frame_offset++, 1);
+				$parsedFrame['type']      = $this->ETCOEventLookup($parsedFrame['typeid']);
+				$parsedFrame['timestamp'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
+				$frame_offset += 4;
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'MLLT')) || // 4.6   MLLT MPEG location lookup table
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'MLL'))) {     // 4.7   MLL MPEG location lookup table
+			//   There may only be one 'MLLT' frame in each tag
+			// <Header for 'Location lookup table', ID: 'MLLT'>
+			// MPEG frames between reference  $xx xx
+			// Bytes between reference        $xx xx xx
+			// Milliseconds between reference $xx xx xx
+			// Bits for bytes deviation       $xx
+			// Bits for milliseconds dev.     $xx
+			//   Then for every reference the following data is included;
+			// Deviation in bytes         %xxx....
+			// Deviation in milliseconds  %xxx....
+
+			$frame_offset = 0;
+			$parsedFrame['framesbetweenreferences'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 2));
+			$parsedFrame['bytesbetweenreferences']  = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 2, 3));
+			$parsedFrame['msbetweenreferences']     = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 5, 3));
+			$parsedFrame['bitsforbytesdeviation']   = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 8, 1));
+			$parsedFrame['bitsformsdeviation']      = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 9, 1));
+			$parsedFrame['data'] = substr($parsedFrame['data'], 10);
+			while ($frame_offset < strlen($parsedFrame['data'])) {
+				$deviationbitstream .= getid3_lib::BigEndian2Bin(substr($parsedFrame['data'], $frame_offset++, 1));
+			}
+			$reference_counter = 0;
+			while (strlen($deviationbitstream) > 0) {
+				$parsedFrame[$reference_counter]['bytedeviation'] = bindec(substr($deviationbitstream, 0, $parsedFrame['bitsforbytesdeviation']));
+				$parsedFrame[$reference_counter]['msdeviation']   = bindec(substr($deviationbitstream, $parsedFrame['bitsforbytesdeviation'], $parsedFrame['bitsformsdeviation']));
+				$deviationbitstream = substr($deviationbitstream, $parsedFrame['bitsforbytesdeviation'] + $parsedFrame['bitsformsdeviation']);
+				$reference_counter++;
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'SYTC')) || // 4.7   SYTC Synchronised tempo codes
+				  (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'STC'))) {  // 4.8   STC  Synchronised tempo codes
+			//   There may only be one 'SYTC' frame in each tag
+			// <Header for 'Synchronised tempo codes', ID: 'SYTC'>
+			// Time stamp format   $xx
+			// Tempo data          <binary data>
+			//   Where time stamp format is:
+			// $01  (32-bit value) MPEG frames from beginning of file
+			// $02  (32-bit value) milliseconds from beginning of file
+
+			$frame_offset = 0;
+			$parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$timestamp_counter = 0;
+			while ($frame_offset < strlen($parsedFrame['data'])) {
+				$parsedFrame[$timestamp_counter]['tempo'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+				if ($parsedFrame[$timestamp_counter]['tempo'] == 255) {
+					$parsedFrame[$timestamp_counter]['tempo'] += ord(substr($parsedFrame['data'], $frame_offset++, 1));
+				}
+				$parsedFrame[$timestamp_counter]['timestamp'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
+				$frame_offset += 4;
+				$timestamp_counter++;
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'USLT')) || // 4.8   USLT Unsynchronised lyric/text transcription
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'ULT'))) {     // 4.9   ULT  Unsynchronised lyric/text transcription
+			//   There may be more than one 'Unsynchronised lyrics/text transcription' frame
+			//   in each tag, but only one with the same language and content descriptor.
+			// <Header for 'Unsynchronised lyrics/text transcription', ID: 'USLT'>
+			// Text encoding        $xx
+			// Language             $xx xx xx
+			// Content descriptor   <text string according to encoding> $00 (00)
+			// Lyrics/text          <full text string according to encoding>
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+			$frame_language = substr($parsedFrame['data'], $frame_offset, 3);
+			$frame_offset += 3;
+			$frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
+			if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+				$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+			}
+			$frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_description) === 0) {
+				$frame_description = '';
+			}
+			$parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)));
+
+			$parsedFrame['encodingid']   = $frame_textencoding;
+			$parsedFrame['encoding']     = $this->TextEncodingNameLookup($frame_textencoding);
+
+			$parsedFrame['data']         = $parsedFrame['data'];
+			$parsedFrame['language']     = $frame_language;
+			$parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false);
+			$parsedFrame['description']  = $frame_description;
+			if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
+				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']);
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'SYLT')) || // 4.9   SYLT Synchronised lyric/text
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'SLT'))) {     // 4.10  SLT  Synchronised lyric/text
+			//   There may be more than one 'SYLT' frame in each tag,
+			//   but only one with the same language and content descriptor.
+			// <Header for 'Synchronised lyrics/text', ID: 'SYLT'>
+			// Text encoding        $xx
+			// Language             $xx xx xx
+			// Time stamp format    $xx
+			//   $01  (32-bit value) MPEG frames from beginning of file
+			//   $02  (32-bit value) milliseconds from beginning of file
+			// Content type         $xx
+			// Content descriptor   <text string according to encoding> $00 (00)
+			//   Terminated text to be synced (typically a syllable)
+			//   Sync identifier (terminator to above string)   $00 (00)
+			//   Time stamp                                     $xx (xx ...)
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+			$frame_language = substr($parsedFrame['data'], $frame_offset, 3);
+			$frame_offset += 3;
+			$parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['contenttypeid']   = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['contenttype']     = $this->SYTLContentTypeLookup($parsedFrame['contenttypeid']);
+			$parsedFrame['encodingid']      = $frame_textencoding;
+			$parsedFrame['encoding']        = $this->TextEncodingNameLookup($frame_textencoding);
+
+			$parsedFrame['language']        = $frame_language;
+			$parsedFrame['languagename']    = $this->LanguageLookup($frame_language, false);
+
+			$timestampindex = 0;
+			$frame_remainingdata = substr($parsedFrame['data'], $frame_offset);
+			while (strlen($frame_remainingdata)) {
+				$frame_offset = 0;
+				$frame_terminatorpos = strpos($frame_remainingdata, $this->TextEncodingTerminatorLookup($frame_textencoding));
+				if ($frame_terminatorpos === false) {
+					$frame_remainingdata = '';
+				} else {
+					if (ord(substr($frame_remainingdata, $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+						$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+					}
+					$parsedFrame['lyrics'][$timestampindex]['data'] = substr($frame_remainingdata, $frame_offset, $frame_terminatorpos - $frame_offset);
+
+					$frame_remainingdata = substr($frame_remainingdata, $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)));
+					if (($timestampindex == 0) && (ord($frame_remainingdata{0}) != 0)) {
+						// timestamp probably omitted for first data item
+					} else {
+						$parsedFrame['lyrics'][$timestampindex]['timestamp'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 0, 4));
+						$frame_remainingdata = substr($frame_remainingdata, 4);
+					}
+					$timestampindex++;
+				}
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'COMM')) || // 4.10  COMM Comments
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'COM'))) {     // 4.11  COM  Comments
+			//   There may be more than one comment frame in each tag,
+			//   but only one with the same language and content descriptor.
+			// <Header for 'Comment', ID: 'COMM'>
+			// Text encoding          $xx
+			// Language               $xx xx xx
+			// Short content descrip. <text string according to encoding> $00 (00)
+			// The actual text        <full text string according to encoding>
+
+			if (strlen($parsedFrame['data']) < 5) {
+
+				$info['warning'][] = 'Invalid data (too short) for "'.$parsedFrame['frame_name'].'" frame at offset '.$parsedFrame['dataoffset'];
+
+			} else {
+
+				$frame_offset = 0;
+				$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+				if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+					$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+				}
+				$frame_language = substr($parsedFrame['data'], $frame_offset, 3);
+				$frame_offset += 3;
+				$frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
+				if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+					$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+				}
+				$frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+				if (ord($frame_description) === 0) {
+					$frame_description = '';
+				}
+				$frame_text = (string) substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)));
+
+				$parsedFrame['encodingid']   = $frame_textencoding;
+				$parsedFrame['encoding']     = $this->TextEncodingNameLookup($frame_textencoding);
+
+				$parsedFrame['language']     = $frame_language;
+				$parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false);
+				$parsedFrame['description']  = $frame_description;
+				$parsedFrame['data']         = $frame_text;
+				if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
+					$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']);
+				}
+
+			}
+
+		} elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'RVA2')) { // 4.11  RVA2 Relative volume adjustment (2) (ID3v2.4+ only)
+			//   There may be more than one 'RVA2' frame in each tag,
+			//   but only one with the same identification string
+			// <Header for 'Relative volume adjustment (2)', ID: 'RVA2'>
+			// Identification          <text string> $00
+			//   The 'identification' string is used to identify the situation and/or
+			//   device where this adjustment should apply. The following is then
+			//   repeated for every channel:
+			// Type of channel         $xx
+			// Volume adjustment       $xx xx
+			// Bits representing peak  $xx
+			// Peak volume             $xx (xx ...)
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00");
+			$frame_idstring = substr($parsedFrame['data'], 0, $frame_terminatorpos);
+			if (ord($frame_idstring) === 0) {
+				$frame_idstring = '';
+			}
+			$frame_remainingdata = substr($parsedFrame['data'], $frame_terminatorpos + strlen("\x00"));
+			$parsedFrame['description'] = $frame_idstring;
+			$RVA2channelcounter = 0;
+			while (strlen($frame_remainingdata) >= 5) {
+				$frame_offset = 0;
+				$frame_channeltypeid = ord(substr($frame_remainingdata, $frame_offset++, 1));
+				$parsedFrame[$RVA2channelcounter]['channeltypeid']  = $frame_channeltypeid;
+				$parsedFrame[$RVA2channelcounter]['channeltype']    = $this->RVA2ChannelTypeLookup($frame_channeltypeid);
+				$parsedFrame[$RVA2channelcounter]['volumeadjust']   = getid3_lib::BigEndian2Int(substr($frame_remainingdata, $frame_offset, 2), false, true); // 16-bit signed
+				$frame_offset += 2;
+				$parsedFrame[$RVA2channelcounter]['bitspeakvolume'] = ord(substr($frame_remainingdata, $frame_offset++, 1));
+				if (($parsedFrame[$RVA2channelcounter]['bitspeakvolume'] < 1) || ($parsedFrame[$RVA2channelcounter]['bitspeakvolume'] > 4)) {
+					$info['warning'][] = 'ID3v2::RVA2 frame['.$RVA2channelcounter.'] contains invalid '.$parsedFrame[$RVA2channelcounter]['bitspeakvolume'].'-byte bits-representing-peak value';
+					break;
+				}
+				$frame_bytespeakvolume = ceil($parsedFrame[$RVA2channelcounter]['bitspeakvolume'] / 8);
+				$parsedFrame[$RVA2channelcounter]['peakvolume']     = getid3_lib::BigEndian2Int(substr($frame_remainingdata, $frame_offset, $frame_bytespeakvolume));
+				$frame_remainingdata = substr($frame_remainingdata, $frame_offset + $frame_bytespeakvolume);
+				$RVA2channelcounter++;
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion == 3) && ($parsedFrame['frame_name'] == 'RVAD')) || // 4.12  RVAD Relative volume adjustment (ID3v2.3 only)
+				  (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'RVA'))) {  // 4.12  RVA  Relative volume adjustment (ID3v2.2 only)
+			//   There may only be one 'RVA' frame in each tag
+			// <Header for 'Relative volume adjustment', ID: 'RVA'>
+			// ID3v2.2 => Increment/decrement     %000000ba
+			// ID3v2.3 => Increment/decrement     %00fedcba
+			// Bits used for volume descr.        $xx
+			// Relative volume change, right      $xx xx (xx ...) // a
+			// Relative volume change, left       $xx xx (xx ...) // b
+			// Peak volume right                  $xx xx (xx ...)
+			// Peak volume left                   $xx xx (xx ...)
+			//   ID3v2.3 only, optional (not present in ID3v2.2):
+			// Relative volume change, right back $xx xx (xx ...) // c
+			// Relative volume change, left back  $xx xx (xx ...) // d
+			// Peak volume right back             $xx xx (xx ...)
+			// Peak volume left back              $xx xx (xx ...)
+			//   ID3v2.3 only, optional (not present in ID3v2.2):
+			// Relative volume change, center     $xx xx (xx ...) // e
+			// Peak volume center                 $xx xx (xx ...)
+			//   ID3v2.3 only, optional (not present in ID3v2.2):
+			// Relative volume change, bass       $xx xx (xx ...) // f
+			// Peak volume bass                   $xx xx (xx ...)
+
+			$frame_offset = 0;
+			$frame_incrdecrflags = getid3_lib::BigEndian2Bin(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['incdec']['right'] = (bool) substr($frame_incrdecrflags, 6, 1);
+			$parsedFrame['incdec']['left']  = (bool) substr($frame_incrdecrflags, 7, 1);
+			$parsedFrame['bitsvolume'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$frame_bytesvolume = ceil($parsedFrame['bitsvolume'] / 8);
+			$parsedFrame['volumechange']['right'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+			if ($parsedFrame['incdec']['right'] === false) {
+				$parsedFrame['volumechange']['right'] *= -1;
+			}
+			$frame_offset += $frame_bytesvolume;
+			$parsedFrame['volumechange']['left'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+			if ($parsedFrame['incdec']['left'] === false) {
+				$parsedFrame['volumechange']['left'] *= -1;
+			}
+			$frame_offset += $frame_bytesvolume;
+			$parsedFrame['peakvolume']['right'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+			$frame_offset += $frame_bytesvolume;
+			$parsedFrame['peakvolume']['left']  = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+			$frame_offset += $frame_bytesvolume;
+			if ($id3v2_majorversion == 3) {
+				$parsedFrame['data'] = substr($parsedFrame['data'], $frame_offset);
+				if (strlen($parsedFrame['data']) > 0) {
+					$parsedFrame['incdec']['rightrear'] = (bool) substr($frame_incrdecrflags, 4, 1);
+					$parsedFrame['incdec']['leftrear']  = (bool) substr($frame_incrdecrflags, 5, 1);
+					$parsedFrame['volumechange']['rightrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+					if ($parsedFrame['incdec']['rightrear'] === false) {
+						$parsedFrame['volumechange']['rightrear'] *= -1;
+					}
+					$frame_offset += $frame_bytesvolume;
+					$parsedFrame['volumechange']['leftrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+					if ($parsedFrame['incdec']['leftrear'] === false) {
+						$parsedFrame['volumechange']['leftrear'] *= -1;
+					}
+					$frame_offset += $frame_bytesvolume;
+					$parsedFrame['peakvolume']['rightrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+					$frame_offset += $frame_bytesvolume;
+					$parsedFrame['peakvolume']['leftrear']  = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+					$frame_offset += $frame_bytesvolume;
+				}
+				$parsedFrame['data'] = substr($parsedFrame['data'], $frame_offset);
+				if (strlen($parsedFrame['data']) > 0) {
+					$parsedFrame['incdec']['center'] = (bool) substr($frame_incrdecrflags, 3, 1);
+					$parsedFrame['volumechange']['center'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+					if ($parsedFrame['incdec']['center'] === false) {
+						$parsedFrame['volumechange']['center'] *= -1;
+					}
+					$frame_offset += $frame_bytesvolume;
+					$parsedFrame['peakvolume']['center'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+					$frame_offset += $frame_bytesvolume;
+				}
+				$parsedFrame['data'] = substr($parsedFrame['data'], $frame_offset);
+				if (strlen($parsedFrame['data']) > 0) {
+					$parsedFrame['incdec']['bass'] = (bool) substr($frame_incrdecrflags, 2, 1);
+					$parsedFrame['volumechange']['bass'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+					if ($parsedFrame['incdec']['bass'] === false) {
+						$parsedFrame['volumechange']['bass'] *= -1;
+					}
+					$frame_offset += $frame_bytesvolume;
+					$parsedFrame['peakvolume']['bass'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+					$frame_offset += $frame_bytesvolume;
+				}
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'EQU2')) { // 4.12  EQU2 Equalisation (2) (ID3v2.4+ only)
+			//   There may be more than one 'EQU2' frame in each tag,
+			//   but only one with the same identification string
+			// <Header of 'Equalisation (2)', ID: 'EQU2'>
+			// Interpolation method  $xx
+			//   $00  Band
+			//   $01  Linear
+			// Identification        <text string> $00
+			//   The following is then repeated for every adjustment point
+			// Frequency          $xx xx
+			// Volume adjustment  $xx xx
+
+			$frame_offset = 0;
+			$frame_interpolationmethod = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_idstring = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_idstring) === 0) {
+				$frame_idstring = '';
+			}
+			$parsedFrame['description'] = $frame_idstring;
+			$frame_remainingdata = substr($parsedFrame['data'], $frame_terminatorpos + strlen("\x00"));
+			while (strlen($frame_remainingdata)) {
+				$frame_frequency = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 0, 2)) / 2;
+				$parsedFrame['data'][$frame_frequency] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 2, 2), false, true);
+				$frame_remainingdata = substr($frame_remainingdata, 4);
+			}
+			$parsedFrame['interpolationmethod'] = $frame_interpolationmethod;
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion == 3) && ($parsedFrame['frame_name'] == 'EQUA')) || // 4.12  EQUA Equalisation (ID3v2.3 only)
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'EQU'))) {     // 4.13  EQU  Equalisation (ID3v2.2 only)
+			//   There may only be one 'EQUA' frame in each tag
+			// <Header for 'Relative volume adjustment', ID: 'EQU'>
+			// Adjustment bits    $xx
+			//   This is followed by 2 bytes + ('adjustment bits' rounded up to the
+			//   nearest byte) for every equalisation band in the following format,
+			//   giving a frequency range of 0 - 32767Hz:
+			// Increment/decrement   %x (MSB of the Frequency)
+			// Frequency             (lower 15 bits)
+			// Adjustment            $xx (xx ...)
+
+			$frame_offset = 0;
+			$parsedFrame['adjustmentbits'] = substr($parsedFrame['data'], $frame_offset++, 1);
+			$frame_adjustmentbytes = ceil($parsedFrame['adjustmentbits'] / 8);
+
+			$frame_remainingdata = (string) substr($parsedFrame['data'], $frame_offset);
+			while (strlen($frame_remainingdata) > 0) {
+				$frame_frequencystr = getid3_lib::BigEndian2Bin(substr($frame_remainingdata, 0, 2));
+				$frame_incdec    = (bool) substr($frame_frequencystr, 0, 1);
+				$frame_frequency = bindec(substr($frame_frequencystr, 1, 15));
+				$parsedFrame[$frame_frequency]['incdec'] = $frame_incdec;
+				$parsedFrame[$frame_frequency]['adjustment'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 2, $frame_adjustmentbytes));
+				if ($parsedFrame[$frame_frequency]['incdec'] === false) {
+					$parsedFrame[$frame_frequency]['adjustment'] *= -1;
+				}
+				$frame_remainingdata = substr($frame_remainingdata, 2 + $frame_adjustmentbytes);
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'RVRB')) || // 4.13  RVRB Reverb
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'REV'))) {     // 4.14  REV  Reverb
+			//   There may only be one 'RVRB' frame in each tag.
+			// <Header for 'Reverb', ID: 'RVRB'>
+			// Reverb left (ms)                 $xx xx
+			// Reverb right (ms)                $xx xx
+			// Reverb bounces, left             $xx
+			// Reverb bounces, right            $xx
+			// Reverb feedback, left to left    $xx
+			// Reverb feedback, left to right   $xx
+			// Reverb feedback, right to right  $xx
+			// Reverb feedback, right to left   $xx
+			// Premix left to right             $xx
+			// Premix right to left             $xx
+
+			$frame_offset = 0;
+			$parsedFrame['left']  = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2));
+			$frame_offset += 2;
+			$parsedFrame['right'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2));
+			$frame_offset += 2;
+			$parsedFrame['bouncesL']      = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['bouncesR']      = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['feedbackLL']    = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['feedbackLR']    = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['feedbackRR']    = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['feedbackRL']    = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['premixLR']      = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['premixRL']      = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'APIC')) || // 4.14  APIC Attached picture
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'PIC'))) {     // 4.15  PIC  Attached picture
+			//   There may be several pictures attached to one file,
+			//   each in their individual 'APIC' frame, but only one
+			//   with the same content descriptor
+			// <Header for 'Attached picture', ID: 'APIC'>
+			// Text encoding      $xx
+			// ID3v2.3+ => MIME type          <text string> $00
+			// ID3v2.2  => Image format       $xx xx xx
+			// Picture type       $xx
+			// Description        <text string according to encoding> $00 (00)
+			// Picture data       <binary data>
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+
+			if ($id3v2_majorversion == 2 && strlen($parsedFrame['data']) > $frame_offset) {
+				$frame_imagetype = substr($parsedFrame['data'], $frame_offset, 3);
+				if (strtolower($frame_imagetype) == 'ima') {
+					// complete hack for mp3Rage (www.chaoticsoftware.com) that puts ID3v2.3-formatted
+					// MIME type instead of 3-char ID3v2.2-format image type  (thanks xbhoffØpacbell*net)
+					$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+					$frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+					if (ord($frame_mimetype) === 0) {
+						$frame_mimetype = '';
+					}
+					$frame_imagetype = strtoupper(str_replace('image/', '', strtolower($frame_mimetype)));
+					if ($frame_imagetype == 'JPEG') {
+						$frame_imagetype = 'JPG';
+					}
+					$frame_offset = $frame_terminatorpos + strlen("\x00");
+				} else {
+					$frame_offset += 3;
+				}
+			}
+			if ($id3v2_majorversion > 2 && strlen($parsedFrame['data']) > $frame_offset) {
+				$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+				$frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+				if (ord($frame_mimetype) === 0) {
+					$frame_mimetype = '';
+				}
+				$frame_offset = $frame_terminatorpos + strlen("\x00");
+			}
+
+			$frame_picturetype = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+
+			if ($frame_offset >= $parsedFrame['datalength']) {
+				$info['warning'][] = 'data portion of APIC frame is missing at offset '.($parsedFrame['dataoffset'] + 8 + $frame_offset);
+			} else {
+				$frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
+				if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+					$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+				}
+				$frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+				if (ord($frame_description) === 0) {
+					$frame_description = '';
+				}
+				$parsedFrame['encodingid']       = $frame_textencoding;
+				$parsedFrame['encoding']         = $this->TextEncodingNameLookup($frame_textencoding);
+
+				if ($id3v2_majorversion == 2) {
+					$parsedFrame['imagetype']    = $frame_imagetype;
+				} else {
+					$parsedFrame['mime']         = $frame_mimetype;
+				}
+				$parsedFrame['picturetypeid']    = $frame_picturetype;
+				$parsedFrame['picturetype']      = $this->APICPictureTypeLookup($frame_picturetype);
+				$parsedFrame['description']      = $frame_description;
+				$parsedFrame['data']             = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)));
+				$parsedFrame['datalength']       = strlen($parsedFrame['data']);
+
+				$parsedFrame['image_mime'] = '';
+				$imageinfo = array();
+				$imagechunkcheck = getid3_lib::GetDataImageSize($parsedFrame['data'], $imageinfo);
+				if (($imagechunkcheck[2] >= 1) && ($imagechunkcheck[2] <= 3)) {
+					$parsedFrame['image_mime']       = 'image/'.getid3_lib::ImageTypesLookup($imagechunkcheck[2]);
+					if ($imagechunkcheck[0]) {
+						$parsedFrame['image_width']  = $imagechunkcheck[0];
+					}
+					if ($imagechunkcheck[1]) {
+						$parsedFrame['image_height'] = $imagechunkcheck[1];
+					}
+				}
+
+				do {
+					if ($this->getid3->option_save_attachments === false) {
+						// skip entirely
+						unset($parsedFrame['data']);
+						break;
+					}
+					if ($this->getid3->option_save_attachments === true) {
+						// great
+/*
+					} elseif (is_int($this->getid3->option_save_attachments)) {
+						if ($this->getid3->option_save_attachments < $parsedFrame['data_length']) {
+							// too big, skip
+							$info['warning'][] = 'attachment at '.$frame_offset.' is too large to process inline ('.number_format($parsedFrame['data_length']).' bytes)';
+							unset($parsedFrame['data']);
+							break;
+						}
+*/
+					} elseif (is_string($this->getid3->option_save_attachments)) {
+						$dir = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->getid3->option_save_attachments), DIRECTORY_SEPARATOR);
+						if (!is_dir($dir) || !is_writable($dir)) {
+							// cannot write, skip
+							$info['warning'][] = 'attachment at '.$frame_offset.' cannot be saved to "'.$dir.'" (not writable)';
+							unset($parsedFrame['data']);
+							break;
+						}
+					}
+					// if we get this far, must be OK
+					if (is_string($this->getid3->option_save_attachments)) {
+						$destination_filename = $dir.DIRECTORY_SEPARATOR.md5($info['filenamepath']).'_'.$frame_offset;
+						if (!file_exists($destination_filename) || is_writable($destination_filename)) {
+							file_put_contents($destination_filename, $parsedFrame['data']);
+						} else {
+							$info['warning'][] = 'attachment at '.$frame_offset.' cannot be saved to "'.$destination_filename.'" (not writable)';
+						}
+						$parsedFrame['data_filename'] = $destination_filename;
+						unset($parsedFrame['data']);
+					} else {
+						if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
+							if (!isset($info['id3v2']['comments']['picture'])) {
+								$info['id3v2']['comments']['picture'] = array();
+							}
+							$info['id3v2']['comments']['picture'][] = array('data'=>$parsedFrame['data'], 'image_mime'=>$parsedFrame['image_mime']);
+						}
+					}
+				} while (false);
+			}
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'GEOB')) || // 4.15  GEOB General encapsulated object
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'GEO'))) {     // 4.16  GEO  General encapsulated object
+			//   There may be more than one 'GEOB' frame in each tag,
+			//   but only one with the same content descriptor
+			// <Header for 'General encapsulated object', ID: 'GEOB'>
+			// Text encoding          $xx
+			// MIME type              <text string> $00
+			// Filename               <text string according to encoding> $00 (00)
+			// Content description    <text string according to encoding> $00 (00)
+			// Encapsulated object    <binary data>
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_mimetype) === 0) {
+				$frame_mimetype = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
+			if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+				$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+			}
+			$frame_filename = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_filename) === 0) {
+				$frame_filename = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding));
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
+			if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+				$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+			}
+			$frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_description) === 0) {
+				$frame_description = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding));
+
+			$parsedFrame['objectdata']  = (string) substr($parsedFrame['data'], $frame_offset);
+			$parsedFrame['encodingid']  = $frame_textencoding;
+			$parsedFrame['encoding']    = $this->TextEncodingNameLookup($frame_textencoding);
+
+			$parsedFrame['mime']        = $frame_mimetype;
+			$parsedFrame['filename']    = $frame_filename;
+			$parsedFrame['description'] = $frame_description;
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'PCNT')) || // 4.16  PCNT Play counter
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'CNT'))) {     // 4.17  CNT  Play counter
+			//   There may only be one 'PCNT' frame in each tag.
+			//   When the counter reaches all one's, one byte is inserted in
+			//   front of the counter thus making the counter eight bits bigger
+			// <Header for 'Play counter', ID: 'PCNT'>
+			// Counter        $xx xx xx xx (xx ...)
+
+			$parsedFrame['data']          = getid3_lib::BigEndian2Int($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'POPM')) || // 4.17  POPM Popularimeter
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'POP'))) {    // 4.18  POP  Popularimeter
+			//   There may be more than one 'POPM' frame in each tag,
+			//   but only one with the same email address
+			// <Header for 'Popularimeter', ID: 'POPM'>
+			// Email to user   <text string> $00
+			// Rating          $xx
+			// Counter         $xx xx xx xx (xx ...)
+
+			$frame_offset = 0;
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_emailaddress = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_emailaddress) === 0) {
+				$frame_emailaddress = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+			$frame_rating = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['counter'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset));
+			$parsedFrame['email']   = $frame_emailaddress;
+			$parsedFrame['rating']  = $frame_rating;
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'RBUF')) || // 4.18  RBUF Recommended buffer size
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'BUF'))) {     // 4.19  BUF  Recommended buffer size
+			//   There may only be one 'RBUF' frame in each tag
+			// <Header for 'Recommended buffer size', ID: 'RBUF'>
+			// Buffer size               $xx xx xx
+			// Embedded info flag        %0000000x
+			// Offset to next tag        $xx xx xx xx
+
+			$frame_offset = 0;
+			$parsedFrame['buffersize'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 3));
+			$frame_offset += 3;
+
+			$frame_embeddedinfoflags = getid3_lib::BigEndian2Bin(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['flags']['embededinfo'] = (bool) substr($frame_embeddedinfoflags, 7, 1);
+			$parsedFrame['nexttagoffset'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
+			unset($parsedFrame['data']);
+
+
+		} elseif (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'CRM')) { // 4.20  Encrypted meta frame (ID3v2.2 only)
+			//   There may be more than one 'CRM' frame in a tag,
+			//   but only one with the same 'owner identifier'
+			// <Header for 'Encrypted meta frame', ID: 'CRM'>
+			// Owner identifier      <textstring> $00 (00)
+			// Content/explanation   <textstring> $00 (00)
+			// Encrypted datablock   <binary data>
+
+			$frame_offset = 0;
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_description) === 0) {
+				$frame_description = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+
+			$parsedFrame['ownerid']     = $frame_ownerid;
+			$parsedFrame['data']        = (string) substr($parsedFrame['data'], $frame_offset);
+			$parsedFrame['description'] = $frame_description;
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'AENC')) || // 4.19  AENC Audio encryption
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'CRA'))) {     // 4.21  CRA  Audio encryption
+			//   There may be more than one 'AENC' frames in a tag,
+			//   but only one with the same 'Owner identifier'
+			// <Header for 'Audio encryption', ID: 'AENC'>
+			// Owner identifier   <text string> $00
+			// Preview start      $xx xx
+			// Preview length     $xx xx
+			// Encryption info    <binary data>
+
+			$frame_offset = 0;
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_ownerid) === 0) {
+				$frame_ownerid == '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+			$parsedFrame['ownerid'] = $frame_ownerid;
+			$parsedFrame['previewstart'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2));
+			$frame_offset += 2;
+			$parsedFrame['previewlength'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2));
+			$frame_offset += 2;
+			$parsedFrame['encryptioninfo'] = (string) substr($parsedFrame['data'], $frame_offset);
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'LINK')) || // 4.20  LINK Linked information
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'LNK'))) {     // 4.22  LNK  Linked information
+			//   There may be more than one 'LINK' frame in a tag,
+			//   but only one with the same contents
+			// <Header for 'Linked information', ID: 'LINK'>
+			// ID3v2.3+ => Frame identifier   $xx xx xx xx
+			// ID3v2.2  => Frame identifier   $xx xx xx
+			// URL                            <text string> $00
+			// ID and additional data         <text string(s)>
+
+			$frame_offset = 0;
+			if ($id3v2_majorversion == 2) {
+				$parsedFrame['frameid'] = substr($parsedFrame['data'], $frame_offset, 3);
+				$frame_offset += 3;
+			} else {
+				$parsedFrame['frameid'] = substr($parsedFrame['data'], $frame_offset, 4);
+				$frame_offset += 4;
+			}
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_url = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_url) === 0) {
+				$frame_url = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+			$parsedFrame['url'] = $frame_url;
+
+			$parsedFrame['additionaldata'] = (string) substr($parsedFrame['data'], $frame_offset);
+			if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) {
+				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = utf8_encode($parsedFrame['url']);
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'POSS')) { // 4.21  POSS Position synchronisation frame (ID3v2.3+ only)
+			//   There may only be one 'POSS' frame in each tag
+			// <Head for 'Position synchronisation', ID: 'POSS'>
+			// Time stamp format         $xx
+			// Position                  $xx (xx ...)
+
+			$frame_offset = 0;
+			$parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['position']        = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset));
+			unset($parsedFrame['data']);
+
+
+		} elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'USER')) { // 4.22  USER Terms of use (ID3v2.3+ only)
+			//   There may be more than one 'Terms of use' frame in a tag,
+			//   but only one with the same 'Language'
+			// <Header for 'Terms of use frame', ID: 'USER'>
+			// Text encoding        $xx
+			// Language             $xx xx xx
+			// The actual text      <text string according to encoding>
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+			$frame_language = substr($parsedFrame['data'], $frame_offset, 3);
+			$frame_offset += 3;
+			$parsedFrame['language']     = $frame_language;
+			$parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false);
+			$parsedFrame['encodingid']   = $frame_textencoding;
+			$parsedFrame['encoding']     = $this->TextEncodingNameLookup($frame_textencoding);
+
+			$parsedFrame['data']         = (string) substr($parsedFrame['data'], $frame_offset);
+			if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
+				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']);
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'OWNE')) { // 4.23  OWNE Ownership frame (ID3v2.3+ only)
+			//   There may only be one 'OWNE' frame in a tag
+			// <Header for 'Ownership frame', ID: 'OWNE'>
+			// Text encoding     $xx
+			// Price paid        <text string> $00
+			// Date of purch.    <text string>
+			// Seller            <text string according to encoding>
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+			$parsedFrame['encodingid'] = $frame_textencoding;
+			$parsedFrame['encoding']   = $this->TextEncodingNameLookup($frame_textencoding);
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_pricepaid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+
+			$parsedFrame['pricepaid']['currencyid'] = substr($frame_pricepaid, 0, 3);
+			$parsedFrame['pricepaid']['currency']   = $this->LookupCurrencyUnits($parsedFrame['pricepaid']['currencyid']);
+			$parsedFrame['pricepaid']['value']      = substr($frame_pricepaid, 3);
+
+			$parsedFrame['purchasedate'] = substr($parsedFrame['data'], $frame_offset, 8);
+			if (!$this->IsValidDateStampString($parsedFrame['purchasedate'])) {
+				$parsedFrame['purchasedateunix'] = mktime (0, 0, 0, substr($parsedFrame['purchasedate'], 4, 2), substr($parsedFrame['purchasedate'], 6, 2), substr($parsedFrame['purchasedate'], 0, 4));
+			}
+			$frame_offset += 8;
+
+			$parsedFrame['seller'] = (string) substr($parsedFrame['data'], $frame_offset);
+			unset($parsedFrame['data']);
+
+
+		} elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'COMR')) { // 4.24  COMR Commercial frame (ID3v2.3+ only)
+			//   There may be more than one 'commercial frame' in a tag,
+			//   but no two may be identical
+			// <Header for 'Commercial frame', ID: 'COMR'>
+			// Text encoding      $xx
+			// Price string       <text string> $00
+			// Valid until        <text string>
+			// Contact URL        <text string> $00
+			// Received as        $xx
+			// Name of seller     <text string according to encoding> $00 (00)
+			// Description        <text string according to encoding> $00 (00)
+			// Picture MIME type  <string> $00
+			// Seller logo        <binary data>
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_pricestring = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+			$frame_rawpricearray = explode('/', $frame_pricestring);
+			foreach ($frame_rawpricearray as $key => $val) {
+				$frame_currencyid = substr($val, 0, 3);
+				$parsedFrame['price'][$frame_currencyid]['currency'] = $this->LookupCurrencyUnits($frame_currencyid);
+				$parsedFrame['price'][$frame_currencyid]['value']    = substr($val, 3);
+			}
+
+			$frame_datestring = substr($parsedFrame['data'], $frame_offset, 8);
+			$frame_offset += 8;
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_contacturl = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+
+			$frame_receivedasid = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
+			if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+				$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+			}
+			$frame_sellername = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_sellername) === 0) {
+				$frame_sellername = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding));
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
+			if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+				$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+			}
+			$frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_description) === 0) {
+				$frame_description = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding));
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+
+			$frame_sellerlogo = substr($parsedFrame['data'], $frame_offset);
+
+			$parsedFrame['encodingid']        = $frame_textencoding;
+			$parsedFrame['encoding']          = $this->TextEncodingNameLookup($frame_textencoding);
+
+			$parsedFrame['pricevaliduntil']   = $frame_datestring;
+			$parsedFrame['contacturl']        = $frame_contacturl;
+			$parsedFrame['receivedasid']      = $frame_receivedasid;
+			$parsedFrame['receivedas']        = $this->COMRReceivedAsLookup($frame_receivedasid);
+			$parsedFrame['sellername']        = $frame_sellername;
+			$parsedFrame['description']       = $frame_description;
+			$parsedFrame['mime']              = $frame_mimetype;
+			$parsedFrame['logo']              = $frame_sellerlogo;
+			unset($parsedFrame['data']);
+
+
+		} elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'ENCR')) { // 4.25  ENCR Encryption method registration (ID3v2.3+ only)
+			//   There may be several 'ENCR' frames in a tag,
+			//   but only one containing the same symbol
+			//   and only one containing the same owner identifier
+			// <Header for 'Encryption method registration', ID: 'ENCR'>
+			// Owner identifier    <text string> $00
+			// Method symbol       $xx
+			// Encryption data     <binary data>
+
+			$frame_offset = 0;
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_ownerid) === 0) {
+				$frame_ownerid = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+
+			$parsedFrame['ownerid']      = $frame_ownerid;
+			$parsedFrame['methodsymbol'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['data']         = (string) substr($parsedFrame['data'], $frame_offset);
+
+
+		} elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'GRID')) { // 4.26  GRID Group identification registration (ID3v2.3+ only)
+
+			//   There may be several 'GRID' frames in a tag,
+			//   but only one containing the same symbol
+			//   and only one containing the same owner identifier
+			// <Header for 'Group ID registration', ID: 'GRID'>
+			// Owner identifier      <text string> $00
+			// Group symbol          $xx
+			// Group dependent data  <binary data>
+
+			$frame_offset = 0;
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_ownerid) === 0) {
+				$frame_ownerid = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+
+			$parsedFrame['ownerid']       = $frame_ownerid;
+			$parsedFrame['groupsymbol']   = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['data']          = (string) substr($parsedFrame['data'], $frame_offset);
+
+
+		} elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'PRIV')) { // 4.27  PRIV Private frame (ID3v2.3+ only)
+			//   The tag may contain more than one 'PRIV' frame
+			//   but only with different contents
+			// <Header for 'Private frame', ID: 'PRIV'>
+			// Owner identifier      <text string> $00
+			// The private data      <binary data>
+
+			$frame_offset = 0;
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_ownerid) === 0) {
+				$frame_ownerid = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+
+			$parsedFrame['ownerid'] = $frame_ownerid;
+			$parsedFrame['data']    = (string) substr($parsedFrame['data'], $frame_offset);
+
+
+		} elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'SIGN')) { // 4.28  SIGN Signature frame (ID3v2.4+ only)
+			//   There may be more than one 'signature frame' in a tag,
+			//   but no two may be identical
+			// <Header for 'Signature frame', ID: 'SIGN'>
+			// Group symbol      $xx
+			// Signature         <binary data>
+
+			$frame_offset = 0;
+			$parsedFrame['groupsymbol'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['data']        = (string) substr($parsedFrame['data'], $frame_offset);
+
+
+		} elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'SEEK')) { // 4.29  SEEK Seek frame (ID3v2.4+ only)
+			//   There may only be one 'seek frame' in a tag
+			// <Header for 'Seek frame', ID: 'SEEK'>
+			// Minimum offset to next tag       $xx xx xx xx
+
+			$frame_offset = 0;
+			$parsedFrame['data']          = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
+
+
+		} elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'ASPI')) { // 4.30  ASPI Audio seek point index (ID3v2.4+ only)
+			//   There may only be one 'audio seek point index' frame in a tag
+			// <Header for 'Seek Point Index', ID: 'ASPI'>
+			// Indexed data start (S)         $xx xx xx xx
+			// Indexed data length (L)        $xx xx xx xx
+			// Number of index points (N)     $xx xx
+			// Bits per index point (b)       $xx
+			//   Then for every index point the following data is included:
+			// Fraction at index (Fi)          $xx (xx)
+
+			$frame_offset = 0;
+			$parsedFrame['datastart'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
+			$frame_offset += 4;
+			$parsedFrame['indexeddatalength'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
+			$frame_offset += 4;
+			$parsedFrame['indexpoints'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2));
+			$frame_offset += 2;
+			$parsedFrame['bitsperpoint'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$frame_bytesperpoint = ceil($parsedFrame['bitsperpoint'] / 8);
+			for ($i = 0; $i < $frame_indexpoints; $i++) {
+				$parsedFrame['indexes'][$i] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesperpoint));
+				$frame_offset += $frame_bytesperpoint;
+			}
+			unset($parsedFrame['data']);
+
+		} elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'RGAD')) { // Replay Gain Adjustment
+			// http://privatewww.essex.ac.uk/~djmrob/replaygain/file_format_id3v2.html
+			//   There may only be one 'RGAD' frame in a tag
+			// <Header for 'Replay Gain Adjustment', ID: 'RGAD'>
+			// Peak Amplitude                      $xx $xx $xx $xx
+			// Radio Replay Gain Adjustment        %aaabbbcd %dddddddd
+			// Audiophile Replay Gain Adjustment   %aaabbbcd %dddddddd
+			//   a - name code
+			//   b - originator code
+			//   c - sign bit
+			//   d - replay gain adjustment
+
+			$frame_offset = 0;
+			$parsedFrame['peakamplitude'] = getid3_lib::BigEndian2Float(substr($parsedFrame['data'], $frame_offset, 4));
+			$frame_offset += 4;
+			$rg_track_adjustment = getid3_lib::Dec2Bin(substr($parsedFrame['data'], $frame_offset, 2));
+			$frame_offset += 2;
+			$rg_album_adjustment = getid3_lib::Dec2Bin(substr($parsedFrame['data'], $frame_offset, 2));
+			$frame_offset += 2;
+			$parsedFrame['raw']['track']['name']       = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 0, 3));
+			$parsedFrame['raw']['track']['originator'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 3, 3));
+			$parsedFrame['raw']['track']['signbit']    = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 6, 1));
+			$parsedFrame['raw']['track']['adjustment'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 7, 9));
+			$parsedFrame['raw']['album']['name']       = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 0, 3));
+			$parsedFrame['raw']['album']['originator'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 3, 3));
+			$parsedFrame['raw']['album']['signbit']    = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 6, 1));
+			$parsedFrame['raw']['album']['adjustment'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 7, 9));
+			$parsedFrame['track']['name']       = getid3_lib::RGADnameLookup($parsedFrame['raw']['track']['name']);
+			$parsedFrame['track']['originator'] = getid3_lib::RGADoriginatorLookup($parsedFrame['raw']['track']['originator']);
+			$parsedFrame['track']['adjustment'] = getid3_lib::RGADadjustmentLookup($parsedFrame['raw']['track']['adjustment'], $parsedFrame['raw']['track']['signbit']);
+			$parsedFrame['album']['name']       = getid3_lib::RGADnameLookup($parsedFrame['raw']['album']['name']);
+			$parsedFrame['album']['originator'] = getid3_lib::RGADoriginatorLookup($parsedFrame['raw']['album']['originator']);
+			$parsedFrame['album']['adjustment'] = getid3_lib::RGADadjustmentLookup($parsedFrame['raw']['album']['adjustment'], $parsedFrame['raw']['album']['signbit']);
+
+			$info['replay_gain']['track']['peak']       = $parsedFrame['peakamplitude'];
+			$info['replay_gain']['track']['originator'] = $parsedFrame['track']['originator'];
+			$info['replay_gain']['track']['adjustment'] = $parsedFrame['track']['adjustment'];
+			$info['replay_gain']['album']['originator'] = $parsedFrame['album']['originator'];
+			$info['replay_gain']['album']['adjustment'] = $parsedFrame['album']['adjustment'];
+
+			unset($parsedFrame['data']);
+
+		}
+
+		return true;
+	}
+
+
+	public function DeUnsynchronise($data) {
+		return str_replace("\xFF\x00", "\xFF", $data);
+	}
+
+	public function LookupExtendedHeaderRestrictionsTagSizeLimits($index) {
+		static $LookupExtendedHeaderRestrictionsTagSizeLimits = array(
+			0x00 => 'No more than 128 frames and 1 MB total tag size',
+			0x01 => 'No more than 64 frames and 128 KB total tag size',
+			0x02 => 'No more than 32 frames and 40 KB total tag size',
+			0x03 => 'No more than 32 frames and 4 KB total tag size',
+		);
+		return (isset($LookupExtendedHeaderRestrictionsTagSizeLimits[$index]) ? $LookupExtendedHeaderRestrictionsTagSizeLimits[$index] : '');
+	}
+
+	public function LookupExtendedHeaderRestrictionsTextEncodings($index) {
+		static $LookupExtendedHeaderRestrictionsTextEncodings = array(
+			0x00 => 'No restrictions',
+			0x01 => 'Strings are only encoded with ISO-8859-1 or UTF-8',
+		);
+		return (isset($LookupExtendedHeaderRestrictionsTextEncodings[$index]) ? $LookupExtendedHeaderRestrictionsTextEncodings[$index] : '');
+	}
+
+	public function LookupExtendedHeaderRestrictionsTextFieldSize($index) {
+		static $LookupExtendedHeaderRestrictionsTextFieldSize = array(
+			0x00 => 'No restrictions',
+			0x01 => 'No string is longer than 1024 characters',
+			0x02 => 'No string is longer than 128 characters',
+			0x03 => 'No string is longer than 30 characters',
+		);
+		return (isset($LookupExtendedHeaderRestrictionsTextFieldSize[$index]) ? $LookupExtendedHeaderRestrictionsTextFieldSize[$index] : '');
+	}
+
+	public function LookupExtendedHeaderRestrictionsImageEncoding($index) {
+		static $LookupExtendedHeaderRestrictionsImageEncoding = array(
+			0x00 => 'No restrictions',
+			0x01 => 'Images are encoded only with PNG or JPEG',
+		);
+		return (isset($LookupExtendedHeaderRestrictionsImageEncoding[$index]) ? $LookupExtendedHeaderRestrictionsImageEncoding[$index] : '');
+	}
+
+	public function LookupExtendedHeaderRestrictionsImageSizeSize($index) {
+		static $LookupExtendedHeaderRestrictionsImageSizeSize = array(
+			0x00 => 'No restrictions',
+			0x01 => 'All images are 256x256 pixels or smaller',
+			0x02 => 'All images are 64x64 pixels or smaller',
+			0x03 => 'All images are exactly 64x64 pixels, unless required otherwise',
+		);
+		return (isset($LookupExtendedHeaderRestrictionsImageSizeSize[$index]) ? $LookupExtendedHeaderRestrictionsImageSizeSize[$index] : '');
+	}
+
+	public function LookupCurrencyUnits($currencyid) {
+
+		$begin = __LINE__;
+
+		/** This is not a comment!
+
+
+			AED	Dirhams
+			AFA	Afghanis
+			ALL	Leke
+			AMD	Drams
+			ANG	Guilders
+			AOA	Kwanza
+			ARS	Pesos
+			ATS	Schillings
+			AUD	Dollars
+			AWG	Guilders
+			AZM	Manats
+			BAM	Convertible Marka
+			BBD	Dollars
+			BDT	Taka
+			BEF	Francs
+			BGL	Leva
+			BHD	Dinars
+			BIF	Francs
+			BMD	Dollars
+			BND	Dollars
+			BOB	Bolivianos
+			BRL	Brazil Real
+			BSD	Dollars
+			BTN	Ngultrum
+			BWP	Pulas
+			BYR	Rubles
+			BZD	Dollars
+			CAD	Dollars
+			CDF	Congolese Francs
+			CHF	Francs
+			CLP	Pesos
+			CNY	Yuan Renminbi
+			COP	Pesos
+			CRC	Colones
+			CUP	Pesos
+			CVE	Escudos
+			CYP	Pounds
+			CZK	Koruny
+			DEM	Deutsche Marks
+			DJF	Francs
+			DKK	Kroner
+			DOP	Pesos
+			DZD	Algeria Dinars
+			EEK	Krooni
+			EGP	Pounds
+			ERN	Nakfa
+			ESP	Pesetas
+			ETB	Birr
+			EUR	Euro
+			FIM	Markkaa
+			FJD	Dollars
+			FKP	Pounds
+			FRF	Francs
+			GBP	Pounds
+			GEL	Lari
+			GGP	Pounds
+			GHC	Cedis
+			GIP	Pounds
+			GMD	Dalasi
+			GNF	Francs
+			GRD	Drachmae
+			GTQ	Quetzales
+			GYD	Dollars
+			HKD	Dollars
+			HNL	Lempiras
+			HRK	Kuna
+			HTG	Gourdes
+			HUF	Forints
+			IDR	Rupiahs
+			IEP	Pounds
+			ILS	New Shekels
+			IMP	Pounds
+			INR	Rupees
+			IQD	Dinars
+			IRR	Rials
+			ISK	Kronur
+			ITL	Lire
+			JEP	Pounds
+			JMD	Dollars
+			JOD	Dinars
+			JPY	Yen
+			KES	Shillings
+			KGS	Soms
+			KHR	Riels
+			KMF	Francs
+			KPW	Won
+			KWD	Dinars
+			KYD	Dollars
+			KZT	Tenge
+			LAK	Kips
+			LBP	Pounds
+			LKR	Rupees
+			LRD	Dollars
+			LSL	Maloti
+			LTL	Litai
+			LUF	Francs
+			LVL	Lati
+			LYD	Dinars
+			MAD	Dirhams
+			MDL	Lei
+			MGF	Malagasy Francs
+			MKD	Denars
+			MMK	Kyats
+			MNT	Tugriks
+			MOP	Patacas
+			MRO	Ouguiyas
+			MTL	Liri
+			MUR	Rupees
+			MVR	Rufiyaa
+			MWK	Kwachas
+			MXN	Pesos
+			MYR	Ringgits
+			MZM	Meticais
+			NAD	Dollars
+			NGN	Nairas
+			NIO	Gold Cordobas
+			NLG	Guilders
+			NOK	Krone
+			NPR	Nepal Rupees
+			NZD	Dollars
+			OMR	Rials
+			PAB	Balboa
+			PEN	Nuevos Soles
+			PGK	Kina
+			PHP	Pesos
+			PKR	Rupees
+			PLN	Zlotych
+			PTE	Escudos
+			PYG	Guarani
+			QAR	Rials
+			ROL	Lei
+			RUR	Rubles
+			RWF	Rwanda Francs
+			SAR	Riyals
+			SBD	Dollars
+			SCR	Rupees
+			SDD	Dinars
+			SEK	Kronor
+			SGD	Dollars
+			SHP	Pounds
+			SIT	Tolars
+			SKK	Koruny
+			SLL	Leones
+			SOS	Shillings
+			SPL	Luigini
+			SRG	Guilders
+			STD	Dobras
+			SVC	Colones
+			SYP	Pounds
+			SZL	Emalangeni
+			THB	Baht
+			TJR	Rubles
+			TMM	Manats
+			TND	Dinars
+			TOP	Pa'anga
+			TRL	Liras
+			TTD	Dollars
+			TVD	Tuvalu Dollars
+			TWD	New Dollars
+			TZS	Shillings
+			UAH	Hryvnia
+			UGX	Shillings
+			USD	Dollars
+			UYU	Pesos
+			UZS	Sums
+			VAL	Lire
+			VEB	Bolivares
+			VND	Dong
+			VUV	Vatu
+			WST	Tala
+			XAF	Francs
+			XAG	Ounces
+			XAU	Ounces
+			XCD	Dollars
+			XDR	Special Drawing Rights
+			XPD	Ounces
+			XPF	Francs
+			XPT	Ounces
+			YER	Rials
+			YUM	New Dinars
+			ZAR	Rand
+			ZMK	Kwacha
+			ZWD	Zimbabwe Dollars
+
+		*/
+
+		return getid3_lib::EmbeddedLookup($currencyid, $begin, __LINE__, __FILE__, 'id3v2-currency-units');
+	}
+
+
+	public function LookupCurrencyCountry($currencyid) {
+
+		$begin = __LINE__;
+
+		/** This is not a comment!
+
+			AED	United Arab Emirates
+			AFA	Afghanistan
+			ALL	Albania
+			AMD	Armenia
+			ANG	Netherlands Antilles
+			AOA	Angola
+			ARS	Argentina
+			ATS	Austria
+			AUD	Australia
+			AWG	Aruba
+			AZM	Azerbaijan
+			BAM	Bosnia and Herzegovina
+			BBD	Barbados
+			BDT	Bangladesh
+			BEF	Belgium
+			BGL	Bulgaria
+			BHD	Bahrain
+			BIF	Burundi
+			BMD	Bermuda
+			BND	Brunei Darussalam
+			BOB	Bolivia
+			BRL	Brazil
+			BSD	Bahamas
+			BTN	Bhutan
+			BWP	Botswana
+			BYR	Belarus
+			BZD	Belize
+			CAD	Canada
+			CDF	Congo/Kinshasa
+			CHF	Switzerland
+			CLP	Chile
+			CNY	China
+			COP	Colombia
+			CRC	Costa Rica
+			CUP	Cuba
+			CVE	Cape Verde
+			CYP	Cyprus
+			CZK	Czech Republic
+			DEM	Germany
+			DJF	Djibouti
+			DKK	Denmark
+			DOP	Dominican Republic
+			DZD	Algeria
+			EEK	Estonia
+			EGP	Egypt
+			ERN	Eritrea
+			ESP	Spain
+			ETB	Ethiopia
+			EUR	Euro Member Countries
+			FIM	Finland
+			FJD	Fiji
+			FKP	Falkland Islands (Malvinas)
+			FRF	France
+			GBP	United Kingdom
+			GEL	Georgia
+			GGP	Guernsey
+			GHC	Ghana
+			GIP	Gibraltar
+			GMD	Gambia
+			GNF	Guinea
+			GRD	Greece
+			GTQ	Guatemala
+			GYD	Guyana
+			HKD	Hong Kong
+			HNL	Honduras
+			HRK	Croatia
+			HTG	Haiti
+			HUF	Hungary
+			IDR	Indonesia
+			IEP	Ireland (Eire)
+			ILS	Israel
+			IMP	Isle of Man
+			INR	India
+			IQD	Iraq
+			IRR	Iran
+			ISK	Iceland
+			ITL	Italy
+			JEP	Jersey
+			JMD	Jamaica
+			JOD	Jordan
+			JPY	Japan
+			KES	Kenya
+			KGS	Kyrgyzstan
+			KHR	Cambodia
+			KMF	Comoros
+			KPW	Korea
+			KWD	Kuwait
+			KYD	Cayman Islands
+			KZT	Kazakstan
+			LAK	Laos
+			LBP	Lebanon
+			LKR	Sri Lanka
+			LRD	Liberia
+			LSL	Lesotho
+			LTL	Lithuania
+			LUF	Luxembourg
+			LVL	Latvia
+			LYD	Libya
+			MAD	Morocco
+			MDL	Moldova
+			MGF	Madagascar
+			MKD	Macedonia
+			MMK	Myanmar (Burma)
+			MNT	Mongolia
+			MOP	Macau
+			MRO	Mauritania
+			MTL	Malta
+			MUR	Mauritius
+			MVR	Maldives (Maldive Islands)
+			MWK	Malawi
+			MXN	Mexico
+			MYR	Malaysia
+			MZM	Mozambique
+			NAD	Namibia
+			NGN	Nigeria
+			NIO	Nicaragua
+			NLG	Netherlands (Holland)
+			NOK	Norway
+			NPR	Nepal
+			NZD	New Zealand
+			OMR	Oman
+			PAB	Panama
+			PEN	Peru
+			PGK	Papua New Guinea
+			PHP	Philippines
+			PKR	Pakistan
+			PLN	Poland
+			PTE	Portugal
+			PYG	Paraguay
+			QAR	Qatar
+			ROL	Romania
+			RUR	Russia
+			RWF	Rwanda
+			SAR	Saudi Arabia
+			SBD	Solomon Islands
+			SCR	Seychelles
+			SDD	Sudan
+			SEK	Sweden
+			SGD	Singapore
+			SHP	Saint Helena
+			SIT	Slovenia
+			SKK	Slovakia
+			SLL	Sierra Leone
+			SOS	Somalia
+			SPL	Seborga
+			SRG	Suriname
+			STD	São Tome and Principe
+			SVC	El Salvador
+			SYP	Syria
+			SZL	Swaziland
+			THB	Thailand
+			TJR	Tajikistan
+			TMM	Turkmenistan
+			TND	Tunisia
+			TOP	Tonga
+			TRL	Turkey
+			TTD	Trinidad and Tobago
+			TVD	Tuvalu
+			TWD	Taiwan
+			TZS	Tanzania
+			UAH	Ukraine
+			UGX	Uganda
+			USD	United States of America
+			UYU	Uruguay
+			UZS	Uzbekistan
+			VAL	Vatican City
+			VEB	Venezuela
+			VND	Viet Nam
+			VUV	Vanuatu
+			WST	Samoa
+			XAF	Communauté Financière Africaine
+			XAG	Silver
+			XAU	Gold
+			XCD	East Caribbean
+			XDR	International Monetary Fund
+			XPD	Palladium
+			XPF	Comptoirs Français du Pacifique
+			XPT	Platinum
+			YER	Yemen
+			YUM	Yugoslavia
+			ZAR	South Africa
+			ZMK	Zambia
+			ZWD	Zimbabwe
+
+		*/
+
+		return getid3_lib::EmbeddedLookup($currencyid, $begin, __LINE__, __FILE__, 'id3v2-currency-country');
+	}
+
+
+
+	public static function LanguageLookup($languagecode, $casesensitive=false) {
+
+		if (!$casesensitive) {
+			$languagecode = strtolower($languagecode);
+		}
+
+		// http://www.id3.org/id3v2.4.0-structure.txt
+		// [4.   ID3v2 frame overview]
+		// The three byte language field, present in several frames, is used to
+		// describe the language of the frame's content, according to ISO-639-2
+		// [ISO-639-2]. The language should be represented in lower case. If the
+		// language is not known the string "XXX" should be used.
+
+
+		// ISO 639-2 - http://www.id3.org/iso639-2.html
+
+		$begin = __LINE__;
+
+		/** This is not a comment!
+
+			XXX	unknown
+			xxx	unknown
+			aar	Afar
+			abk	Abkhazian
+			ace	Achinese
+			ach	Acoli
+			ada	Adangme
+			afa	Afro-Asiatic (Other)
+			afh	Afrihili
+			afr	Afrikaans
+			aka	Akan
+			akk	Akkadian
+			alb	Albanian
+			ale	Aleut
+			alg	Algonquian Languages
+			amh	Amharic
+			ang	English, Old (ca. 450-1100)
+			apa	Apache Languages
+			ara	Arabic
+			arc	Aramaic
+			arm	Armenian
+			arn	Araucanian
+			arp	Arapaho
+			art	Artificial (Other)
+			arw	Arawak
+			asm	Assamese
+			ath	Athapascan Languages
+			ava	Avaric
+			ave	Avestan
+			awa	Awadhi
+			aym	Aymara
+			aze	Azerbaijani
+			bad	Banda
+			bai	Bamileke Languages
+			bak	Bashkir
+			bal	Baluchi
+			bam	Bambara
+			ban	Balinese
+			baq	Basque
+			bas	Basa
+			bat	Baltic (Other)
+			bej	Beja
+			bel	Byelorussian
+			bem	Bemba
+			ben	Bengali
+			ber	Berber (Other)
+			bho	Bhojpuri
+			bih	Bihari
+			bik	Bikol
+			bin	Bini
+			bis	Bislama
+			bla	Siksika
+			bnt	Bantu (Other)
+			bod	Tibetan
+			bra	Braj
+			bre	Breton
+			bua	Buriat
+			bug	Buginese
+			bul	Bulgarian
+			bur	Burmese
+			cad	Caddo
+			cai	Central American Indian (Other)
+			car	Carib
+			cat	Catalan
+			cau	Caucasian (Other)
+			ceb	Cebuano
+			cel	Celtic (Other)
+			ces	Czech
+			cha	Chamorro
+			chb	Chibcha
+			che	Chechen
+			chg	Chagatai
+			chi	Chinese
+			chm	Mari
+			chn	Chinook jargon
+			cho	Choctaw
+			chr	Cherokee
+			chu	Church Slavic
+			chv	Chuvash
+			chy	Cheyenne
+			cop	Coptic
+			cor	Cornish
+			cos	Corsican
+			cpe	Creoles and Pidgins, English-based (Other)
+			cpf	Creoles and Pidgins, French-based (Other)
+			cpp	Creoles and Pidgins, Portuguese-based (Other)
+			cre	Cree
+			crp	Creoles and Pidgins (Other)
+			cus	Cushitic (Other)
+			cym	Welsh
+			cze	Czech
+			dak	Dakota
+			dan	Danish
+			del	Delaware
+			deu	German
+			din	Dinka
+			div	Divehi
+			doi	Dogri
+			dra	Dravidian (Other)
+			dua	Duala
+			dum	Dutch, Middle (ca. 1050-1350)
+			dut	Dutch
+			dyu	Dyula
+			dzo	Dzongkha
+			efi	Efik
+			egy	Egyptian (Ancient)
+			eka	Ekajuk
+			ell	Greek, Modern (1453-)
+			elx	Elamite
+			eng	English
+			enm	English, Middle (ca. 1100-1500)
+			epo	Esperanto
+			esk	Eskimo (Other)
+			esl	Spanish
+			est	Estonian
+			eus	Basque
+			ewe	Ewe
+			ewo	Ewondo
+			fan	Fang
+			fao	Faroese
+			fas	Persian
+			fat	Fanti
+			fij	Fijian
+			fin	Finnish
+			fiu	Finno-Ugrian (Other)
+			fon	Fon
+			fra	French
+			fre	French
+			frm	French, Middle (ca. 1400-1600)
+			fro	French, Old (842- ca. 1400)
+			fry	Frisian
+			ful	Fulah
+			gaa	Ga
+			gae	Gaelic (Scots)
+			gai	Irish
+			gay	Gayo
+			gdh	Gaelic (Scots)
+			gem	Germanic (Other)
+			geo	Georgian
+			ger	German
+			gez	Geez
+			gil	Gilbertese
+			glg	Gallegan
+			gmh	German, Middle High (ca. 1050-1500)
+			goh	German, Old High (ca. 750-1050)
+			gon	Gondi
+			got	Gothic
+			grb	Grebo
+			grc	Greek, Ancient (to 1453)
+			gre	Greek, Modern (1453-)
+			grn	Guarani
+			guj	Gujarati
+			hai	Haida
+			hau	Hausa
+			haw	Hawaiian
+			heb	Hebrew
+			her	Herero
+			hil	Hiligaynon
+			him	Himachali
+			hin	Hindi
+			hmo	Hiri Motu
+			hun	Hungarian
+			hup	Hupa
+			hye	Armenian
+			iba	Iban
+			ibo	Igbo
+			ice	Icelandic
+			ijo	Ijo
+			iku	Inuktitut
+			ilo	Iloko
+			ina	Interlingua (International Auxiliary language Association)
+			inc	Indic (Other)
+			ind	Indonesian
+			ine	Indo-European (Other)
+			ine	Interlingue
+			ipk	Inupiak
+			ira	Iranian (Other)
+			iri	Irish
+			iro	Iroquoian uages
+			isl	Icelandic
+			ita	Italian
+			jav	Javanese
+			jaw	Javanese
+			jpn	Japanese
+			jpr	Judeo-Persian
+			jrb	Judeo-Arabic
+			kaa	Kara-Kalpak
+			kab	Kabyle
+			kac	Kachin
+			kal	Greenlandic
+			kam	Kamba
+			kan	Kannada
+			kar	Karen
+			kas	Kashmiri
+			kat	Georgian
+			kau	Kanuri
+			kaw	Kawi
+			kaz	Kazakh
+			kha	Khasi
+			khi	Khoisan (Other)
+			khm	Khmer
+			kho	Khotanese
+			kik	Kikuyu
+			kin	Kinyarwanda
+			kir	Kirghiz
+			kok	Konkani
+			kom	Komi
+			kon	Kongo
+			kor	Korean
+			kpe	Kpelle
+			kro	Kru
+			kru	Kurukh
+			kua	Kuanyama
+			kum	Kumyk
+			kur	Kurdish
+			kus	Kusaie
+			kut	Kutenai
+			lad	Ladino
+			lah	Lahnda
+			lam	Lamba
+			lao	Lao
+			lat	Latin
+			lav	Latvian
+			lez	Lezghian
+			lin	Lingala
+			lit	Lithuanian
+			lol	Mongo
+			loz	Lozi
+			ltz	Letzeburgesch
+			lub	Luba-Katanga
+			lug	Ganda
+			lui	Luiseno
+			lun	Lunda
+			luo	Luo (Kenya and Tanzania)
+			mac	Macedonian
+			mad	Madurese
+			mag	Magahi
+			mah	Marshall
+			mai	Maithili
+			mak	Macedonian
+			mak	Makasar
+			mal	Malayalam
+			man	Mandingo
+			mao	Maori
+			map	Austronesian (Other)
+			mar	Marathi
+			mas	Masai
+			max	Manx
+			may	Malay
+			men	Mende
+			mga	Irish, Middle (900 - 1200)
+			mic	Micmac
+			min	Minangkabau
+			mis	Miscellaneous (Other)
+			mkh	Mon-Kmer (Other)
+			mlg	Malagasy
+			mlt	Maltese
+			mni	Manipuri
+			mno	Manobo Languages
+			moh	Mohawk
+			mol	Moldavian
+			mon	Mongolian
+			mos	Mossi
+			mri	Maori
+			msa	Malay
+			mul	Multiple Languages
+			mun	Munda Languages
+			mus	Creek
+			mwr	Marwari
+			mya	Burmese
+			myn	Mayan Languages
+			nah	Aztec
+			nai	North American Indian (Other)
+			nau	Nauru
+			nav	Navajo
+			nbl	Ndebele, South
+			nde	Ndebele, North
+			ndo	Ndongo
+			nep	Nepali
+			new	Newari
+			nic	Niger-Kordofanian (Other)
+			niu	Niuean
+			nla	Dutch
+			nno	Norwegian (Nynorsk)
+			non	Norse, Old
+			nor	Norwegian
+			nso	Sotho, Northern
+			nub	Nubian Languages
+			nya	Nyanja
+			nym	Nyamwezi
+			nyn	Nyankole
+			nyo	Nyoro
+			nzi	Nzima
+			oci	Langue d'Oc (post 1500)
+			oji	Ojibwa
+			ori	Oriya
+			orm	Oromo
+			osa	Osage
+			oss	Ossetic
+			ota	Turkish, Ottoman (1500 - 1928)
+			oto	Otomian Languages
+			paa	Papuan-Australian (Other)
+			pag	Pangasinan
+			pal	Pahlavi
+			pam	Pampanga
+			pan	Panjabi
+			pap	Papiamento
+			pau	Palauan
+			peo	Persian, Old (ca 600 - 400 B.C.)
+			per	Persian
+			phn	Phoenician
+			pli	Pali
+			pol	Polish
+			pon	Ponape
+			por	Portuguese
+			pra	Prakrit uages
+			pro	Provencal, Old (to 1500)
+			pus	Pushto
+			que	Quechua
+			raj	Rajasthani
+			rar	Rarotongan
+			roa	Romance (Other)
+			roh	Rhaeto-Romance
+			rom	Romany
+			ron	Romanian
+			rum	Romanian
+			run	Rundi
+			rus	Russian
+			sad	Sandawe
+			sag	Sango
+			sah	Yakut
+			sai	South American Indian (Other)
+			sal	Salishan Languages
+			sam	Samaritan Aramaic
+			san	Sanskrit
+			sco	Scots
+			scr	Serbo-Croatian
+			sel	Selkup
+			sem	Semitic (Other)
+			sga	Irish, Old (to 900)
+			shn	Shan
+			sid	Sidamo
+			sin	Singhalese
+			sio	Siouan Languages
+			sit	Sino-Tibetan (Other)
+			sla	Slavic (Other)
+			slk	Slovak
+			slo	Slovak
+			slv	Slovenian
+			smi	Sami Languages
+			smo	Samoan
+			sna	Shona
+			snd	Sindhi
+			sog	Sogdian
+			som	Somali
+			son	Songhai
+			sot	Sotho, Southern
+			spa	Spanish
+			sqi	Albanian
+			srd	Sardinian
+			srr	Serer
+			ssa	Nilo-Saharan (Other)
+			ssw	Siswant
+			ssw	Swazi
+			suk	Sukuma
+			sun	Sudanese
+			sus	Susu
+			sux	Sumerian
+			sve	Swedish
+			swa	Swahili
+			swe	Swedish
+			syr	Syriac
+			tah	Tahitian
+			tam	Tamil
+			tat	Tatar
+			tel	Telugu
+			tem	Timne
+			ter	Tereno
+			tgk	Tajik
+			tgl	Tagalog
+			tha	Thai
+			tib	Tibetan
+			tig	Tigre
+			tir	Tigrinya
+			tiv	Tivi
+			tli	Tlingit
+			tmh	Tamashek
+			tog	Tonga (Nyasa)
+			ton	Tonga (Tonga Islands)
+			tru	Truk
+			tsi	Tsimshian
+			tsn	Tswana
+			tso	Tsonga
+			tuk	Turkmen
+			tum	Tumbuka
+			tur	Turkish
+			tut	Altaic (Other)
+			twi	Twi
+			tyv	Tuvinian
+			uga	Ugaritic
+			uig	Uighur
+			ukr	Ukrainian
+			umb	Umbundu
+			und	Undetermined
+			urd	Urdu
+			uzb	Uzbek
+			vai	Vai
+			ven	Venda
+			vie	Vietnamese
+			vol	Volapük
+			vot	Votic
+			wak	Wakashan Languages
+			wal	Walamo
+			war	Waray
+			was	Washo
+			wel	Welsh
+			wen	Sorbian Languages
+			wol	Wolof
+			xho	Xhosa
+			yao	Yao
+			yap	Yap
+			yid	Yiddish
+			yor	Yoruba
+			zap	Zapotec
+			zen	Zenaga
+			zha	Zhuang
+			zho	Chinese
+			zul	Zulu
+			zun	Zuni
+
+		*/
+
+		return getid3_lib::EmbeddedLookup($languagecode, $begin, __LINE__, __FILE__, 'id3v2-languagecode');
+	}
+
+
+	public static function ETCOEventLookup($index) {
+		if (($index >= 0x17) && ($index <= 0xDF)) {
+			return 'reserved for future use';
+		}
+		if (($index >= 0xE0) && ($index <= 0xEF)) {
+			return 'not predefined synch 0-F';
+		}
+		if (($index >= 0xF0) && ($index <= 0xFC)) {
+			return 'reserved for future use';
+		}
+
+		static $EventLookup = array(
+			0x00 => 'padding (has no meaning)',
+			0x01 => 'end of initial silence',
+			0x02 => 'intro start',
+			0x03 => 'main part start',
+			0x04 => 'outro start',
+			0x05 => 'outro end',
+			0x06 => 'verse start',
+			0x07 => 'refrain start',
+			0x08 => 'interlude start',
+			0x09 => 'theme start',
+			0x0A => 'variation start',
+			0x0B => 'key change',
+			0x0C => 'time change',
+			0x0D => 'momentary unwanted noise (Snap, Crackle & Pop)',
+			0x0E => 'sustained noise',
+			0x0F => 'sustained noise end',
+			0x10 => 'intro end',
+			0x11 => 'main part end',
+			0x12 => 'verse end',
+			0x13 => 'refrain end',
+			0x14 => 'theme end',
+			0x15 => 'profanity',
+			0x16 => 'profanity end',
+			0xFD => 'audio end (start of silence)',
+			0xFE => 'audio file ends',
+			0xFF => 'one more byte of events follows'
+		);
+
+		return (isset($EventLookup[$index]) ? $EventLookup[$index] : '');
+	}
+
+	public static function SYTLContentTypeLookup($index) {
+		static $SYTLContentTypeLookup = array(
+			0x00 => 'other',
+			0x01 => 'lyrics',
+			0x02 => 'text transcription',
+			0x03 => 'movement/part name', // (e.g. 'Adagio')
+			0x04 => 'events',             // (e.g. 'Don Quijote enters the stage')
+			0x05 => 'chord',              // (e.g. 'Bb F Fsus')
+			0x06 => 'trivia/\'pop up\' information',
+			0x07 => 'URLs to webpages',
+			0x08 => 'URLs to images'
+		);
+
+		return (isset($SYTLContentTypeLookup[$index]) ? $SYTLContentTypeLookup[$index] : '');
+	}
+
+	public static function APICPictureTypeLookup($index, $returnarray=false) {
+		static $APICPictureTypeLookup = array(
+			0x00 => 'Other',
+			0x01 => '32x32 pixels \'file icon\' (PNG only)',
+			0x02 => 'Other file icon',
+			0x03 => 'Cover (front)',
+			0x04 => 'Cover (back)',
+			0x05 => 'Leaflet page',
+			0x06 => 'Media (e.g. label side of CD)',
+			0x07 => 'Lead artist/lead performer/soloist',
+			0x08 => 'Artist/performer',
+			0x09 => 'Conductor',
+			0x0A => 'Band/Orchestra',
+			0x0B => 'Composer',
+			0x0C => 'Lyricist/text writer',
+			0x0D => 'Recording Location',
+			0x0E => 'During recording',
+			0x0F => 'During performance',
+			0x10 => 'Movie/video screen capture',
+			0x11 => 'A bright coloured fish',
+			0x12 => 'Illustration',
+			0x13 => 'Band/artist logotype',
+			0x14 => 'Publisher/Studio logotype'
+		);
+		if ($returnarray) {
+			return $APICPictureTypeLookup;
+		}
+		return (isset($APICPictureTypeLookup[$index]) ? $APICPictureTypeLookup[$index] : '');
+	}
+
+	public static function COMRReceivedAsLookup($index) {
+		static $COMRReceivedAsLookup = array(
+			0x00 => 'Other',
+			0x01 => 'Standard CD album with other songs',
+			0x02 => 'Compressed audio on CD',
+			0x03 => 'File over the Internet',
+			0x04 => 'Stream over the Internet',
+			0x05 => 'As note sheets',
+			0x06 => 'As note sheets in a book with other sheets',
+			0x07 => 'Music on other media',
+			0x08 => 'Non-musical merchandise'
+		);
+
+		return (isset($COMRReceivedAsLookup[$index]) ? $COMRReceivedAsLookup[$index] : '');
+	}
+
+	public static function RVA2ChannelTypeLookup($index) {
+		static $RVA2ChannelTypeLookup = array(
+			0x00 => 'Other',
+			0x01 => 'Master volume',
+			0x02 => 'Front right',
+			0x03 => 'Front left',
+			0x04 => 'Back right',
+			0x05 => 'Back left',
+			0x06 => 'Front centre',
+			0x07 => 'Back centre',
+			0x08 => 'Subwoofer'
+		);
+
+		return (isset($RVA2ChannelTypeLookup[$index]) ? $RVA2ChannelTypeLookup[$index] : '');
+	}
+
+	public static function FrameNameLongLookup($framename) {
+
+		$begin = __LINE__;
+
+		/** This is not a comment!
+
+			AENC	Audio encryption
+			APIC	Attached picture
+			ASPI	Audio seek point index
+			BUF	Recommended buffer size
+			CNT	Play counter
+			COM	Comments
+			COMM	Comments
+			COMR	Commercial frame
+			CRA	Audio encryption
+			CRM	Encrypted meta frame
+			ENCR	Encryption method registration
+			EQU	Equalisation
+			EQU2	Equalisation (2)
+			EQUA	Equalisation
+			ETC	Event timing codes
+			ETCO	Event timing codes
+			GEO	General encapsulated object
+			GEOB	General encapsulated object
+			GRID	Group identification registration
+			IPL	Involved people list
+			IPLS	Involved people list
+			LINK	Linked information
+			LNK	Linked information
+			MCDI	Music CD identifier
+			MCI	Music CD Identifier
+			MLL	MPEG location lookup table
+			MLLT	MPEG location lookup table
+			OWNE	Ownership frame
+			PCNT	Play counter
+			PIC	Attached picture
+			POP	Popularimeter
+			POPM	Popularimeter
+			POSS	Position synchronisation frame
+			PRIV	Private frame
+			RBUF	Recommended buffer size
+			REV	Reverb
+			RVA	Relative volume adjustment
+			RVA2	Relative volume adjustment (2)
+			RVAD	Relative volume adjustment
+			RVRB	Reverb
+			SEEK	Seek frame
+			SIGN	Signature frame
+			SLT	Synchronised lyric/text
+			STC	Synced tempo codes
+			SYLT	Synchronised lyric/text
+			SYTC	Synchronised tempo codes
+			TAL	Album/Movie/Show title
+			TALB	Album/Movie/Show title
+			TBP	BPM (Beats Per Minute)
+			TBPM	BPM (beats per minute)
+			TCM	Composer
+			TCMP	Part of a compilation
+			TCO	Content type
+			TCOM	Composer
+			TCON	Content type
+			TCOP	Copyright message
+			TCP	Part of a compilation
+			TCR	Copyright message
+			TDA	Date
+			TDAT	Date
+			TDEN	Encoding time
+			TDLY	Playlist delay
+			TDOR	Original release time
+			TDRC	Recording time
+			TDRL	Release time
+			TDTG	Tagging time
+			TDY	Playlist delay
+			TEN	Encoded by
+			TENC	Encoded by
+			TEXT	Lyricist/Text writer
+			TFLT	File type
+			TFT	File type
+			TIM	Time
+			TIME	Time
+			TIPL	Involved people list
+			TIT1	Content group description
+			TIT2	Title/songname/content description
+			TIT3	Subtitle/Description refinement
+			TKE	Initial key
+			TKEY	Initial key
+			TLA	Language(s)
+			TLAN	Language(s)
+			TLE	Length
+			TLEN	Length
+			TMCL	Musician credits list
+			TMED	Media type
+			TMOO	Mood
+			TMT	Media type
+			TOA	Original artist(s)/performer(s)
+			TOAL	Original album/movie/show title
+			TOF	Original filename
+			TOFN	Original filename
+			TOL	Original Lyricist(s)/text writer(s)
+			TOLY	Original lyricist(s)/text writer(s)
+			TOPE	Original artist(s)/performer(s)
+			TOR	Original release year
+			TORY	Original release year
+			TOT	Original album/Movie/Show title
+			TOWN	File owner/licensee
+			TP1	Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group
+			TP2	Band/Orchestra/Accompaniment
+			TP3	Conductor/Performer refinement
+			TP4	Interpreted, remixed, or otherwise modified by
+			TPA	Part of a set
+			TPB	Publisher
+			TPE1	Lead performer(s)/Soloist(s)
+			TPE2	Band/orchestra/accompaniment
+			TPE3	Conductor/performer refinement
+			TPE4	Interpreted, remixed, or otherwise modified by
+			TPOS	Part of a set
+			TPRO	Produced notice
+			TPUB	Publisher
+			TRC	ISRC (International Standard Recording Code)
+			TRCK	Track number/Position in set
+			TRD	Recording dates
+			TRDA	Recording dates
+			TRK	Track number/Position in set
+			TRSN	Internet radio station name
+			TRSO	Internet radio station owner
+			TS2	Album-Artist sort order
+			TSA	Album sort order
+			TSC	Composer sort order
+			TSI	Size
+			TSIZ	Size
+			TSO2	Album-Artist sort order
+			TSOA	Album sort order
+			TSOC	Composer sort order
+			TSOP	Performer sort order
+			TSOT	Title sort order
+			TSP	Performer sort order
+			TSRC	ISRC (international standard recording code)
+			TSS	Software/hardware and settings used for encoding
+			TSSE	Software/Hardware and settings used for encoding
+			TSST	Set subtitle
+			TST	Title sort order
+			TT1	Content group description
+			TT2	Title/Songname/Content description
+			TT3	Subtitle/Description refinement
+			TXT	Lyricist/text writer
+			TXX	User defined text information frame
+			TXXX	User defined text information frame
+			TYE	Year
+			TYER	Year
+			UFI	Unique file identifier
+			UFID	Unique file identifier
+			ULT	Unsychronised lyric/text transcription
+			USER	Terms of use
+			USLT	Unsynchronised lyric/text transcription
+			WAF	Official audio file webpage
+			WAR	Official artist/performer webpage
+			WAS	Official audio source webpage
+			WCM	Commercial information
+			WCOM	Commercial information
+			WCOP	Copyright/Legal information
+			WCP	Copyright/Legal information
+			WOAF	Official audio file webpage
+			WOAR	Official artist/performer webpage
+			WOAS	Official audio source webpage
+			WORS	Official Internet radio station homepage
+			WPAY	Payment
+			WPB	Publishers official webpage
+			WPUB	Publishers official webpage
+			WXX	User defined URL link frame
+			WXXX	User defined URL link frame
+			TFEA	Featured Artist
+			TSTU	Recording Studio
+			rgad	Replay Gain Adjustment
+
+		*/
+
+		return getid3_lib::EmbeddedLookup($framename, $begin, __LINE__, __FILE__, 'id3v2-framename_long');
+
+		// Last three:
+		// from Helium2 [www.helium2.com]
+		// from http://privatewww.essex.ac.uk/~djmrob/replaygain/file_format_id3v2.html
+	}
+
+
+	public static function FrameNameShortLookup($framename) {
+
+		$begin = __LINE__;
+
+		/** This is not a comment!
+
+			AENC	audio_encryption
+			APIC	attached_picture
+			ASPI	audio_seek_point_index
+			BUF	recommended_buffer_size
+			CNT	play_counter
+			COM	comment
+			COMM	comment
+			COMR	commercial_frame
+			CRA	audio_encryption
+			CRM	encrypted_meta_frame
+			ENCR	encryption_method_registration
+			EQU	equalisation
+			EQU2	equalisation
+			EQUA	equalisation
+			ETC	event_timing_codes
+			ETCO	event_timing_codes
+			GEO	general_encapsulated_object
+			GEOB	general_encapsulated_object
+			GRID	group_identification_registration
+			IPL	involved_people_list
+			IPLS	involved_people_list
+			LINK	linked_information
+			LNK	linked_information
+			MCDI	music_cd_identifier
+			MCI	music_cd_identifier
+			MLL	mpeg_location_lookup_table
+			MLLT	mpeg_location_lookup_table
+			OWNE	ownership_frame
+			PCNT	play_counter
+			PIC	attached_picture
+			POP	popularimeter
+			POPM	popularimeter
+			POSS	position_synchronisation_frame
+			PRIV	private_frame
+			RBUF	recommended_buffer_size
+			REV	reverb
+			RVA	relative_volume_adjustment
+			RVA2	relative_volume_adjustment
+			RVAD	relative_volume_adjustment
+			RVRB	reverb
+			SEEK	seek_frame
+			SIGN	signature_frame
+			SLT	synchronised_lyric
+			STC	synced_tempo_codes
+			SYLT	synchronised_lyric
+			SYTC	synchronised_tempo_codes
+			TAL	album
+			TALB	album
+			TBP	bpm
+			TBPM	bpm
+			TCM	composer
+			TCMP	part_of_a_compilation
+			TCO	genre
+			TCOM	composer
+			TCON	genre
+			TCOP	copyright_message
+			TCP	part_of_a_compilation
+			TCR	copyright_message
+			TDA	date
+			TDAT	date
+			TDEN	encoding_time
+			TDLY	playlist_delay
+			TDOR	original_release_time
+			TDRC	recording_time
+			TDRL	release_time
+			TDTG	tagging_time
+			TDY	playlist_delay
+			TEN	encoded_by
+			TENC	encoded_by
+			TEXT	lyricist
+			TFLT	file_type
+			TFT	file_type
+			TIM	time
+			TIME	time
+			TIPL	involved_people_list
+			TIT1	content_group_description
+			TIT2	title
+			TIT3	subtitle
+			TKE	initial_key
+			TKEY	initial_key
+			TLA	language
+			TLAN	language
+			TLE	length
+			TLEN	length
+			TMCL	musician_credits_list
+			TMED	media_type
+			TMOO	mood
+			TMT	media_type
+			TOA	original_artist
+			TOAL	original_album
+			TOF	original_filename
+			TOFN	original_filename
+			TOL	original_lyricist
+			TOLY	original_lyricist
+			TOPE	original_artist
+			TOR	original_year
+			TORY	original_year
+			TOT	original_album
+			TOWN	file_owner
+			TP1	artist
+			TP2	band
+			TP3	conductor
+			TP4	remixer
+			TPA	part_of_a_set
+			TPB	publisher
+			TPE1	artist
+			TPE2	band
+			TPE3	conductor
+			TPE4	remixer
+			TPOS	part_of_a_set
+			TPRO	produced_notice
+			TPUB	publisher
+			TRC	isrc
+			TRCK	track_number
+			TRD	recording_dates
+			TRDA	recording_dates
+			TRK	track_number
+			TRSN	internet_radio_station_name
+			TRSO	internet_radio_station_owner
+			TS2	album_artist_sort_order
+			TSA	album_sort_order
+			TSC	composer_sort_order
+			TSI	size
+			TSIZ	size
+			TSO2	album_artist_sort_order
+			TSOA	album_sort_order
+			TSOC	composer_sort_order
+			TSOP	performer_sort_order
+			TSOT	title_sort_order
+			TSP	performer_sort_order
+			TSRC	isrc
+			TSS	encoder_settings
+			TSSE	encoder_settings
+			TSST	set_subtitle
+			TST	title_sort_order
+			TT1	content_group_description
+			TT2	title
+			TT3	subtitle
+			TXT	lyricist
+			TXX	text
+			TXXX	text
+			TYE	year
+			TYER	year
+			UFI	unique_file_identifier
+			UFID	unique_file_identifier
+			ULT	unsychronised_lyric
+			USER	terms_of_use
+			USLT	unsynchronised_lyric
+			WAF	url_file
+			WAR	url_artist
+			WAS	url_source
+			WCM	commercial_information
+			WCOM	commercial_information
+			WCOP	copyright
+			WCP	copyright
+			WOAF	url_file
+			WOAR	url_artist
+			WOAS	url_source
+			WORS	url_station
+			WPAY	url_payment
+			WPB	url_publisher
+			WPUB	url_publisher
+			WXX	url_user
+			WXXX	url_user
+			TFEA	featured_artist
+			TSTU	recording_studio
+			rgad	replay_gain_adjustment
+
+		*/
+
+		return getid3_lib::EmbeddedLookup($framename, $begin, __LINE__, __FILE__, 'id3v2-framename_short');
+	}
+
+	public static function TextEncodingTerminatorLookup($encoding) {
+		// http://www.id3.org/id3v2.4.0-structure.txt
+		// Frames that allow different types of text encoding contains a text encoding description byte. Possible encodings:
+		static $TextEncodingTerminatorLookup = array(
+			0   => "\x00",     // $00  ISO-8859-1. Terminated with $00.
+			1   => "\x00\x00", // $01  UTF-16 encoded Unicode with BOM. All strings in the same frame SHALL have the same byteorder. Terminated with $00 00.
+			2   => "\x00\x00", // $02  UTF-16BE encoded Unicode without BOM. Terminated with $00 00.
+			3   => "\x00",     // $03  UTF-8 encoded Unicode. Terminated with $00.
+			255 => "\x00\x00"
+		);
+		return (isset($TextEncodingTerminatorLookup[$encoding]) ? $TextEncodingTerminatorLookup[$encoding] : '');
+	}
+
+	public static function TextEncodingNameLookup($encoding) {
+		// http://www.id3.org/id3v2.4.0-structure.txt
+		// Frames that allow different types of text encoding contains a text encoding description byte. Possible encodings:
+		static $TextEncodingNameLookup = array(
+			0   => 'ISO-8859-1', // $00  ISO-8859-1. Terminated with $00.
+			1   => 'UTF-16',     // $01  UTF-16 encoded Unicode with BOM. All strings in the same frame SHALL have the same byteorder. Terminated with $00 00.
+			2   => 'UTF-16BE',   // $02  UTF-16BE encoded Unicode without BOM. Terminated with $00 00.
+			3   => 'UTF-8',      // $03  UTF-8 encoded Unicode. Terminated with $00.
+			255 => 'UTF-16BE'
+		);
+		return (isset($TextEncodingNameLookup[$encoding]) ? $TextEncodingNameLookup[$encoding] : 'ISO-8859-1');
+	}
+
+	public static function IsValidID3v2FrameName($framename, $id3v2majorversion) {
+		switch ($id3v2majorversion) {
+			case 2:
+				return preg_match('#[A-Z][A-Z0-9]{2}#', $framename);
+				break;
+
+			case 3:
+			case 4:
+				return preg_match('#[A-Z][A-Z0-9]{3}#', $framename);
+				break;
+		}
+		return false;
+	}
+
+	public static function IsANumber($numberstring, $allowdecimal=false, $allownegative=false) {
+		for ($i = 0; $i < strlen($numberstring); $i++) {
+			if ((chr($numberstring{$i}) < chr('0')) || (chr($numberstring{$i}) > chr('9'))) {
+				if (($numberstring{$i} == '.') && $allowdecimal) {
+					// allowed
+				} elseif (($numberstring{$i} == '-') && $allownegative && ($i == 0)) {
+					// allowed
+				} else {
+					return false;
+				}
+			}
+		}
+		return true;
+	}
+
+	public static function IsValidDateStampString($datestamp) {
+		if (strlen($datestamp) != 8) {
+			return false;
+		}
+		if (!self::IsANumber($datestamp, false)) {
+			return false;
+		}
+		$year  = substr($datestamp, 0, 4);
+		$month = substr($datestamp, 4, 2);
+		$day   = substr($datestamp, 6, 2);
+		if (($year == 0) || ($month == 0) || ($day == 0)) {
+			return false;
+		}
+		if ($month > 12) {
+			return false;
+		}
+		if ($day > 31) {
+			return false;
+		}
+		if (($day > 30) && (($month == 4) || ($month == 6) || ($month == 9) || ($month == 11))) {
+			return false;
+		}
+		if (($day > 29) && ($month == 2)) {
+			return false;
+		}
+		return true;
+	}
+
+	public static function ID3v2HeaderLength($majorversion) {
+		return (($majorversion == 2) ? 6 : 10);
+	}
+
+}
+
Index: /extensions/piwigo_videojs/include/getid3/module.tag.lyrics3.php
===================================================================
--- /extensions/piwigo_videojs/include/getid3/module.tag.lyrics3.php	(revision 24676)
+++ /extensions/piwigo_videojs/include/getid3/module.tag.lyrics3.php	(revision 24676)
@@ -0,0 +1,294 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+///                                                            //
+// module.tag.lyrics3.php                                      //
+// module for analyzing Lyrics3 tags                           //
+// dependencies: module.tag.apetag.php (optional)              //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+
+class getid3_lyrics3 extends getid3_handler
+{
+
+	public function Analyze() {
+		$info = &$this->getid3->info;
+
+		// http://www.volweb.cz/str/tags.htm
+
+		if (!getid3_lib::intValueSupported($info['filesize'])) {
+			$info['warning'][] = 'Unable to check for Lyrics3 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB';
+			return false;
+		}
+
+		fseek($this->getid3->fp, (0 - 128 - 9 - 6), SEEK_END);          // end - ID3v1 - "LYRICSEND" - [Lyrics3size]
+		$lyrics3_id3v1 = fread($this->getid3->fp, 128 + 9 + 6);
+		$lyrics3lsz    = substr($lyrics3_id3v1,  0,   6); // Lyrics3size
+		$lyrics3end    = substr($lyrics3_id3v1,  6,   9); // LYRICSEND or LYRICS200
+		$id3v1tag      = substr($lyrics3_id3v1, 15, 128); // ID3v1
+
+		if ($lyrics3end == 'LYRICSEND') {
+			// Lyrics3v1, ID3v1, no APE
+
+			$lyrics3size    = 5100;
+			$lyrics3offset  = $info['filesize'] - 128 - $lyrics3size;
+			$lyrics3version = 1;
+
+		} elseif ($lyrics3end == 'LYRICS200') {
+			// Lyrics3v2, ID3v1, no APE
+
+			// LSZ = lyrics + 'LYRICSBEGIN'; add 6-byte size field; add 'LYRICS200'
+			$lyrics3size    = $lyrics3lsz + 6 + strlen('LYRICS200');
+			$lyrics3offset  = $info['filesize'] - 128 - $lyrics3size;
+			$lyrics3version = 2;
+
+		} elseif (substr(strrev($lyrics3_id3v1), 0, 9) == strrev('LYRICSEND')) {
+			// Lyrics3v1, no ID3v1, no APE
+
+			$lyrics3size    = 5100;
+			$lyrics3offset  = $info['filesize'] - $lyrics3size;
+			$lyrics3version = 1;
+			$lyrics3offset  = $info['filesize'] - $lyrics3size;
+
+		} elseif (substr(strrev($lyrics3_id3v1), 0, 9) == strrev('LYRICS200')) {
+
+			// Lyrics3v2, no ID3v1, no APE
+
+			$lyrics3size    = strrev(substr(strrev($lyrics3_id3v1), 9, 6)) + 6 + strlen('LYRICS200'); // LSZ = lyrics + 'LYRICSBEGIN'; add 6-byte size field; add 'LYRICS200'
+			$lyrics3offset  = $info['filesize'] - $lyrics3size;
+			$lyrics3version = 2;
+
+		} else {
+
+			if (isset($info['ape']['tag_offset_start']) && ($info['ape']['tag_offset_start'] > 15)) {
+
+				fseek($this->getid3->fp, $info['ape']['tag_offset_start'] - 15, SEEK_SET);
+				$lyrics3lsz = fread($this->getid3->fp, 6);
+				$lyrics3end = fread($this->getid3->fp, 9);
+
+				if ($lyrics3end == 'LYRICSEND') {
+					// Lyrics3v1, APE, maybe ID3v1
+
+					$lyrics3size    = 5100;
+					$lyrics3offset  = $info['ape']['tag_offset_start'] - $lyrics3size;
+					$info['avdataend'] = $lyrics3offset;
+					$lyrics3version = 1;
+					$info['warning'][] = 'APE tag located after Lyrics3, will probably break Lyrics3 compatability';
+
+				} elseif ($lyrics3end == 'LYRICS200') {
+					// Lyrics3v2, APE, maybe ID3v1
+
+					$lyrics3size    = $lyrics3lsz + 6 + strlen('LYRICS200'); // LSZ = lyrics + 'LYRICSBEGIN'; add 6-byte size field; add 'LYRICS200'
+					$lyrics3offset  = $info['ape']['tag_offset_start'] - $lyrics3size;
+					$lyrics3version = 2;
+					$info['warning'][] = 'APE tag located after Lyrics3, will probably break Lyrics3 compatability';
+
+				}
+
+			}
+
+		}
+
+		if (isset($lyrics3offset)) {
+			$info['avdataend'] = $lyrics3offset;
+			$this->getLyrics3Data($lyrics3offset, $lyrics3version, $lyrics3size);
+
+			if (!isset($info['ape'])) {
+				$GETID3_ERRORARRAY = &$info['warning'];
+				if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.apetag.php', __FILE__, false)) {
+					$getid3_temp = new getID3();
+					$getid3_temp->openfile($this->getid3->filename);
+					$getid3_apetag = new getid3_apetag($getid3_temp);
+					$getid3_apetag->overrideendoffset = $info['lyrics3']['tag_offset_start'];
+					$getid3_apetag->Analyze();
+					if (!empty($getid3_temp->info['ape'])) {
+						$info['ape'] = $getid3_temp->info['ape'];
+					}
+					if (!empty($getid3_temp->info['replay_gain'])) {
+						$info['replay_gain'] = $getid3_temp->info['replay_gain'];
+					}
+					unset($getid3_temp, $getid3_apetag);
+				}
+			}
+
+		}
+
+		return true;
+	}
+
+	public function getLyrics3Data($endoffset, $version, $length) {
+		// http://www.volweb.cz/str/tags.htm
+
+		$info = &$this->getid3->info;
+
+		if (!getid3_lib::intValueSupported($endoffset)) {
+			$info['warning'][] = 'Unable to check for Lyrics3 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB';
+			return false;
+		}
+
+		fseek($this->getid3->fp, $endoffset, SEEK_SET);
+		if ($length <= 0) {
+			return false;
+		}
+		$rawdata = fread($this->getid3->fp, $length);
+
+		$ParsedLyrics3['raw']['lyrics3version'] = $version;
+		$ParsedLyrics3['raw']['lyrics3tagsize'] = $length;
+		$ParsedLyrics3['tag_offset_start']      = $endoffset;
+		$ParsedLyrics3['tag_offset_end']        = $endoffset + $length - 1;
+
+		if (substr($rawdata, 0, 11) != 'LYRICSBEGIN') {
+			if (strpos($rawdata, 'LYRICSBEGIN') !== false) {
+
+				$info['warning'][] = '"LYRICSBEGIN" expected at '.$endoffset.' but actually found at '.($endoffset + strpos($rawdata, 'LYRICSBEGIN')).' - this is invalid for Lyrics3 v'.$version;
+				$info['avdataend'] = $endoffset + strpos($rawdata, 'LYRICSBEGIN');
+				$rawdata = substr($rawdata, strpos($rawdata, 'LYRICSBEGIN'));
+				$length = strlen($rawdata);
+				$ParsedLyrics3['tag_offset_start'] = $info['avdataend'];
+				$ParsedLyrics3['raw']['lyrics3tagsize'] = $length;
+
+			} else {
+
+				$info['error'][] = '"LYRICSBEGIN" expected at '.$endoffset.' but found "'.substr($rawdata, 0, 11).'" instead';
+				return false;
+
+			}
+
+		}
+
+		switch ($version) {
+
+			case 1:
+				if (substr($rawdata, strlen($rawdata) - 9, 9) == 'LYRICSEND') {
+					$ParsedLyrics3['raw']['LYR'] = trim(substr($rawdata, 11, strlen($rawdata) - 11 - 9));
+					$this->Lyrics3LyricsTimestampParse($ParsedLyrics3);
+				} else {
+					$info['error'][] = '"LYRICSEND" expected at '.(ftell($this->getid3->fp) - 11 + $length - 9).' but found "'.substr($rawdata, strlen($rawdata) - 9, 9).'" instead';
+					return false;
+				}
+				break;
+
+			case 2:
+				if (substr($rawdata, strlen($rawdata) - 9, 9) == 'LYRICS200') {
+					$ParsedLyrics3['raw']['unparsed'] = substr($rawdata, 11, strlen($rawdata) - 11 - 9 - 6); // LYRICSBEGIN + LYRICS200 + LSZ
+					$rawdata = $ParsedLyrics3['raw']['unparsed'];
+					while (strlen($rawdata) > 0) {
+						$fieldname = substr($rawdata, 0, 3);
+						$fieldsize = (int) substr($rawdata, 3, 5);
+						$ParsedLyrics3['raw'][$fieldname] = substr($rawdata, 8, $fieldsize);
+						$rawdata = substr($rawdata, 3 + 5 + $fieldsize);
+					}
+
+					if (isset($ParsedLyrics3['raw']['IND'])) {
+						$i = 0;
+						$flagnames = array('lyrics', 'timestamps', 'inhibitrandom');
+						foreach ($flagnames as $flagname) {
+							if (strlen($ParsedLyrics3['raw']['IND']) > $i++) {
+								$ParsedLyrics3['flags'][$flagname] = $this->IntString2Bool(substr($ParsedLyrics3['raw']['IND'], $i, 1 - 1));
+							}
+						}
+					}
+
+					$fieldnametranslation = array('ETT'=>'title', 'EAR'=>'artist', 'EAL'=>'album', 'INF'=>'comment', 'AUT'=>'author');
+					foreach ($fieldnametranslation as $key => $value) {
+						if (isset($ParsedLyrics3['raw'][$key])) {
+							$ParsedLyrics3['comments'][$value][] = trim($ParsedLyrics3['raw'][$key]);
+						}
+					}
+
+					if (isset($ParsedLyrics3['raw']['IMG'])) {
+						$imagestrings = explode("\r\n", $ParsedLyrics3['raw']['IMG']);
+						foreach ($imagestrings as $key => $imagestring) {
+							if (strpos($imagestring, '||') !== false) {
+								$imagearray = explode('||', $imagestring);
+								$ParsedLyrics3['images'][$key]['filename']     =                                (isset($imagearray[0]) ? $imagearray[0] : '');
+								$ParsedLyrics3['images'][$key]['description']  =                                (isset($imagearray[1]) ? $imagearray[1] : '');
+								$ParsedLyrics3['images'][$key]['timestamp']    = $this->Lyrics3Timestamp2Seconds(isset($imagearray[2]) ? $imagearray[2] : '');
+							}
+						}
+					}
+					if (isset($ParsedLyrics3['raw']['LYR'])) {
+						$this->Lyrics3LyricsTimestampParse($ParsedLyrics3);
+					}
+				} else {
+					$info['error'][] = '"LYRICS200" expected at '.(ftell($this->getid3->fp) - 11 + $length - 9).' but found "'.substr($rawdata, strlen($rawdata) - 9, 9).'" instead';
+					return false;
+				}
+				break;
+
+			default:
+				$info['error'][] = 'Cannot process Lyrics3 version '.$version.' (only v1 and v2)';
+				return false;
+				break;
+		}
+
+
+		if (isset($info['id3v1']['tag_offset_start']) && ($info['id3v1']['tag_offset_start'] <= $ParsedLyrics3['tag_offset_end'])) {
+			$info['warning'][] = 'ID3v1 tag information ignored since it appears to be a false synch in Lyrics3 tag data';
+			unset($info['id3v1']);
+			foreach ($info['warning'] as $key => $value) {
+				if ($value == 'Some ID3v1 fields do not use NULL characters for padding') {
+					unset($info['warning'][$key]);
+					sort($info['warning']);
+					break;
+				}
+			}
+		}
+
+		$info['lyrics3'] = $ParsedLyrics3;
+
+		return true;
+	}
+
+	public function Lyrics3Timestamp2Seconds($rawtimestamp) {
+		if (preg_match('#^\\[([0-9]{2}):([0-9]{2})\\]$#', $rawtimestamp, $regs)) {
+			return (int) (($regs[1] * 60) + $regs[2]);
+		}
+		return false;
+	}
+
+	public function Lyrics3LyricsTimestampParse(&$Lyrics3data) {
+		$lyricsarray = explode("\r\n", $Lyrics3data['raw']['LYR']);
+		foreach ($lyricsarray as $key => $lyricline) {
+			$regs = array();
+			unset($thislinetimestamps);
+			while (preg_match('#^(\\[[0-9]{2}:[0-9]{2}\\])#', $lyricline, $regs)) {
+				$thislinetimestamps[] = $this->Lyrics3Timestamp2Seconds($regs[0]);
+				$lyricline = str_replace($regs[0], '', $lyricline);
+			}
+			$notimestamplyricsarray[$key] = $lyricline;
+			if (isset($thislinetimestamps) && is_array($thislinetimestamps)) {
+				sort($thislinetimestamps);
+				foreach ($thislinetimestamps as $timestampkey => $timestamp) {
+					if (isset($Lyrics3data['synchedlyrics'][$timestamp])) {
+						// timestamps only have a 1-second resolution, it's possible that multiple lines
+						// could have the same timestamp, if so, append
+						$Lyrics3data['synchedlyrics'][$timestamp] .= "\r\n".$lyricline;
+					} else {
+						$Lyrics3data['synchedlyrics'][$timestamp] = $lyricline;
+					}
+				}
+			}
+		}
+		$Lyrics3data['unsynchedlyrics'] = implode("\r\n", $notimestamplyricsarray);
+		if (isset($Lyrics3data['synchedlyrics']) && is_array($Lyrics3data['synchedlyrics'])) {
+			ksort($Lyrics3data['synchedlyrics']);
+		}
+		return true;
+	}
+
+	public function IntString2Bool($char) {
+		if ($char == '1') {
+			return true;
+		} elseif ($char == '0') {
+			return false;
+		}
+		return null;
+	}
+}
Index: /extensions/piwigo_videojs/include/index.php
===================================================================
--- /extensions/piwigo_videojs/include/index.php	(revision 24676)
+++ /extensions/piwigo_videojs/include/index.php	(revision 24676)
@@ -0,0 +1,7 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/piwigo_videojs/index.php
===================================================================
--- /extensions/piwigo_videojs/index.php	(revision 24676)
+++ /extensions/piwigo_videojs/index.php	(revision 24676)
@@ -0,0 +1,7 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/piwigo_videojs/language/en_UK/description.txt
===================================================================
--- /extensions/piwigo_videojs/language/en_UK/description.txt	(revision 24676)
+++ /extensions/piwigo_videojs/language/en_UK/description.txt	(revision 24676)
@@ -0,0 +1,1 @@
+videojs integration for piwigo
Index: /extensions/piwigo_videojs/language/en_UK/index.php
===================================================================
--- /extensions/piwigo_videojs/language/en_UK/index.php	(revision 24676)
+++ /extensions/piwigo_videojs/language/en_UK/index.php	(revision 24676)
@@ -0,0 +1,7 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/piwigo_videojs/language/en_UK/plugin.lang.php
===================================================================
--- /extensions/piwigo_videojs/language/en_UK/plugin.lang.php	(revision 24676)
+++ /extensions/piwigo_videojs/language/en_UK/plugin.lang.php	(revision 24676)
@@ -0,0 +1,21 @@
+<?php
+
+$lang['HTML5'] = 'HTML5 video tag settings';
+$lang['PRELOAD'] = 'Preload';
+$lang['PRELOAD_DESC'] = 'The preload attribute informs the browser whether or not the video data should begin downloading as soon as the video tag is loaded.';
+$lang['CONTROLS'] = 'Controls';
+$lang['CONTROLS_DESC'] = 'The controls option sets whether or not the player has controls that the user can interact with';
+$lang['AUTOPLAY'] = 'Autoplay';
+$lang['AUTOPLAY_DESC'] = 'If autoplay is true, the video will start playing as soon as page is loaded (without any interaction from the user). NOT SUPPORTED BY APPLE iOS DEVICES.';
+$lang['LOOP'] = 'Loop';
+$lang['LOOP_DESC'] = 'The loop attribute causes the video to start over as soon as it ends.';
+
+$lang['PLUGIN'] = 'Plugin settings';
+$lang['SKIN'] = 'Skin';
+$lang['SKIN_DESC'] = 'Select the style you want to apply to the player.';
+$lang['CUSTOMCSS'] = 'Custom CSS';
+$lang['CUSTOMCSS_DESC'] = 'Custom CSS to copy paste from the VideoJS website.';
+$lang['WIDTH'] = 'Max Width';
+$lang['WIDTH_DESC'] = 'The max width attribute sets the display width of the video, if higher it is divide by 2.';
+
+?>
Index: /extensions/piwigo_videojs/language/fr_FR/index.php
===================================================================
--- /extensions/piwigo_videojs/language/fr_FR/index.php	(revision 24676)
+++ /extensions/piwigo_videojs/language/fr_FR/index.php	(revision 24676)
@@ -0,0 +1,7 @@
+<?php
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/piwigo_videojs/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/piwigo_videojs/language/fr_FR/plugin.lang.php	(revision 24676)
+++ /extensions/piwigo_videojs/language/fr_FR/plugin.lang.php	(revision 24676)
@@ -0,0 +1,21 @@
+<?php
+
+$lang['HTML5'] = 'HTML5 video tag préférences';
+$lang['PRELOAD'] = 'Preload';
+$lang['PRELOAD_DESC'] = 'The preload attribute informs the browser whether or not the video data should begin downloading as soon as the video tag is loaded.';
+$lang['CONTROLS'] = 'Controls';
+$lang['CONTROLS_DESC'] = 'The controls option sets whether or not the player has controls that the user can interact with.';
+$lang['AUTOPLAY'] = 'Autoplay';
+$lang['AUTOPLAY_DESC'] = 'If autoplay is true, the video will start playing as soon as page is loaded (without any interaction from the user). NOT SUPPORTED BY APPLE iOS DEVICES.';
+$lang['LOOP'] = 'Loop';
+$lang['LOOP_DESC'] = 'The loop attribute causes the video to start over as soon as it ends.';
+
+$lang['PLUGIN'] = 'Plugin préférences';
+$lang['SKIN'] = 'Style';
+$lang['SKIN_DESC'] = 'Selectionner un style a appliquer au lecteur.';
+$lang['CUSTOMCSS'] = 'Custom CSS';
+$lang['CUSTOMCSS_DESC'] = 'Custom CSS to copy paste from the VideoJS website.';
+$lang['WIDTH'] = 'Max Width';
+$lang['WIDTH_DESC'] = 'The max width attribute sets the display width of the video. if higher it is divide by 2.';
+
+?>
Index: /extensions/piwigo_videojs/main.inc.php
===================================================================
--- /extensions/piwigo_videojs/main.inc.php	(revision 24676)
+++ /extensions/piwigo_videojs/main.inc.php	(revision 24676)
@@ -0,0 +1,270 @@
+<?php
+/*
+Plugin Name: VideoJS
+Version: 1.0.1
+Description: videojs integration for piwigo
+Plugin URI: http://piwigo.org/ext/extension_view.php?eid=610
+Author: xbmgsharp
+Author URI: https://github.com/xbgmsharp/piwigo-videojs
+*/
+
+// Chech whether we are indeed included by Piwigo.
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+// Define the path to our plugin.
+define('VIDEOJS_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)).'/');
+
+global $conf;
+
+// Prepare configuration
+$conf['vjs_conf'] = unserialize($conf['vjs_conf']);
+
+// Register the allowed extentions to the global conf in order
+// to sync them with other contents
+$vjs_extensions = array(
+    'ogg',
+    'mp4',
+    'm4v',
+    'ogv',
+    'webm',
+    'webmv',
+);
+$conf['file_ext'] = array_merge ($conf['file_ext'], $vjs_extensions, array_map('strtoupper', $vjs_extensions) );
+
+// Hook on to an event to display videos as standard images
+add_event_handler('render_element_content', 'vjs_render_media', 40, 2);
+
+// Hook to display a fallback thumbnail if not defined
+add_event_handler('get_mimetype_location', 'vjs_get_mimetype_icon', 60, 2);
+
+// Hook to change the picture data to template
+//add_event_handler('picture_pictures_data', 'vjs_pictures_data');
+
+// Hook to sync geotag metadata on upload or sync
+//add_event_handler('format_exif_data', 'vjs_format_exif_data', EVENT_HANDLER_PRIORITY_NEUTRAL, 3);
+
+// If admin do the init
+if (defined('IN_ADMIN')) {
+	include_once(VIDEOJS_PATH.'/admin/admin_boot.php');
+}
+
+function vjs_format_exif_data($exif, $file, $map)
+{
+
+}
+
+function vjs_render_media($content, $picture)
+{
+	global $template, $picture, $page, $conf, $user, $refresh;
+	//print_r( $picture['current']);
+	// do nothing if the current picture is actually an image !
+	if ( (array_key_exists('src_image', @$picture['current'])
+		&& @$picture['current']['src_image']->is_original()) )
+	{
+		return $content;
+	}
+
+	// In case, the we handle a large video, we define a MAX_WIDTH
+	// variable to limit the display size.
+	if (isset($user['maxwidth']) and $user['maxwidth']!='')
+	{
+		$MAX_WIDTH = $user['maxwidth'];
+	}
+	else
+	{
+		$MAX_WIDTH = isset($conf['vjs_conf']['max_width']) ? $conf['vjs_conf']['max_width'] : '720';
+	}
+	//print "$MAX_WIDTH=" . $MAX_WIDTH;
+	//print_r($user);
+
+	// Avoid Conflict with other plugin using getID3
+	if( !class_exists('getID3')){
+		// Get video infos with getID3 lib
+		require_once(dirname(__FILE__) . '/include/getid3/getid3.php');
+	}
+	$getID3 = new getID3;
+	$fileinfo = $getID3->analyze($picture['current']['path']);
+	//print "getID3\n";
+	//print_r($fileinfo);
+
+	$extension = strtolower(get_extension($picture['current']['path']));
+	if ($extension == "m4v")
+	{
+		$extension = "mp4";
+	}
+	else if ($extension == "webmv")
+	{
+		$extension = "webm4";
+	}
+	else if ($extension == "ogv")
+	{
+		$extension = "ogg";
+	}
+	//print "extension\n";
+	//print_r($extension);
+
+	if(isset($fileinfo['video']))
+	{
+		// -- video file --
+		// guess resolution
+		if (isset($fileinfo['video']['resolution_x']) )
+		{
+			$width = $fileinfo['video']['resolution_x'];
+		}
+		if (isset($fileinfo['video']['resolution_y']) )
+		{
+			$height = $fileinfo['video']['resolution_y'];
+		}
+		if ( !isset($width) || !isset($height))
+		{
+			// If guess was unsuccessful, fallback to default 16/9 resolution
+			// This is the case for ogv video for example.
+			$width = $MAX_WIDTH;
+			$height = intval( 9 * ($width / 16 ));
+		}
+	}
+	else // Not a supported video format or an image
+	{
+		return $content;
+	}
+
+	// Resize if video is too large
+	if ( $width > $MAX_WIDTH )
+	{
+		//$height = intval($height * ($MAX_WIDTH / $width));
+		//$width  = $MAX_WIDTH;
+		$height = intval($height / 2);
+		$width = intval($width / 2);
+	}
+
+	// Slideshow : The video needs to be launch automatically in
+	// slideshow mode. The refresh of the page is set to the
+	// duration of the video.
+	$autoplay = isset($conf['vjs_conf']['autoplay']) ? strbool($conf['vjs_conf']['autoplay']) : 'false';
+	if ( $page['slideshow'] )
+	{
+		$refresh = $fileinfo['playtime_seconds'];
+		$autoplay = 'true';
+	}
+
+	// Load parameter, fallback to default if unset
+	$skin = isset($conf['vjs_conf']['skin']) ? $conf['vjs_conf']['skin'] : 'vjs-default-skin';
+	$customcss = isset($conf['vjs_customcss']) ? $conf['vjs_customcss'] : '';
+	$preload = isset($conf['vjs_conf']['preload']) ? $conf['vjs_conf']['preload'] : 'none';
+	$loop = isset($conf['vjs_conf']['loop']) ? strbool($conf['vjs_conf']['loop']) : 'false';
+	$controls = isset($conf['vjs_conf']['controls']) ? strbool($conf['vjs_conf']['controls']) : 'false';
+
+	// Assing the CSS file according to the skin
+	$skincss = "";
+	if ($skin == 'vjs-default-skin')
+	{
+		$skincss = "video-js.min.css";
+	} else if ($skin == 'vjs-darkfunk-skin')
+	{
+		$skincss = "darkfunk-skin.css";
+	} else if ($skin == 'vjs-redsheen-skin')
+	{
+		$skincss = "redsheen-skin.css";
+	}
+
+	// Select the template
+	$template->set_filenames(
+		array('vjs_content' => dirname(__FILE__)."/template/vjs-player.tpl")
+	);
+
+	// Try to guess the poster extension
+	$parts = pathinfo($picture['current']['element_url']);
+	$poster = getposterfile (Array(
+		$fileinfo['filepath']."/".$parts['filename'].".png" =>
+			get_gallery_home_url() . $parts['dirname'] . "/".$parts['filename'].".png",
+		$fileinfo['filepath']."/".$parts['filename'].".jpg" =>
+			get_gallery_home_url() . $parts['dirname'] . "/".$parts['filename'].".jpg",
+		$fileinfo['filepath']."/thumbnail/TN-".$parts['filename'].".jpg" =>
+			get_gallery_home_url() . $parts['dirname'] . "/thumbnail/TN-".$parts['filename'].".jpg",
+		$fileinfo['filepath']."/thumbnail/TN-".$parts['filename'].".png" =>
+			get_gallery_home_url() . $parts['dirname'] . "/thumbnail/TN-".$parts['filename'].".png",
+		$fileinfo['filepath']."/pwg_representative/".$parts['filename'].".jpg" =>
+			get_gallery_home_url() . $parts['dirname'] . "/pwg_representative/".$parts['filename'].".jpg",
+		$fileinfo['filepath']."/pwg_representative/".$parts['filename'].".png" =>
+			get_gallery_home_url() . $parts['dirname'] . "/pwg_representative/".$parts['filename'].".png",
+	));
+	//print $poster;
+
+	// Genrate HTML5 tags
+	// Why the data-setup attribute does not work if only one video
+	$options = "";
+	if ($controls == "true")
+	{
+		$options .= "controls";
+	}
+	if ($autoplay == "true")
+	{
+		$options .= " autoplay ";
+	}
+	if ($loop == "true")
+	{
+		$options .= " loop ";
+	}
+	$options .= ' preload="'. $preload .'"';
+
+	// Assign the template variables
+	// We use here the piwigo's get_gallery_home_url function to build
+	// the full URL as suggested by videojs for flash fallback compatibility
+	$template->assign(
+		array(
+			'VIDEOJS_MEDIA_URL'	=> embellish_url(get_gallery_home_url() . $picture['current']['element_url']),
+			'VIDEOJS_POSTER_URL'	=> $poster,
+			'VIDEOJS_PATH'		=> VIDEOJS_PATH,
+			'VIDEOJS_FULLPATH'	=> realpath(dirname(__FILE__)),
+			'WIDTH'			=> $width,
+			'HEIGHT'		=> $height,
+			'TYPE'			=> $extension,
+			'OPTIONS'		=> $options,
+			'VIDEOJS_SKIN'		=> $skin,
+			'VIDEOJS_SKINCSS'	=> $skincss,
+			'VIDEOJS_CUSTOMCSS'	=> $customcss,
+		)
+	);
+
+	// Return the rendered html
+	$vjs_content = $template->parse('vjs_content', true);
+	return $vjs_content;
+}
+
+function vjs_get_mimetype_icon ($location, $element_info)
+{
+	$location= 'plugins/'
+		. basename(dirname(__FILE__))
+		. '/mimetypes/' . $element_info . '.png';
+	return $location;
+}
+
+function strbool($value)
+{
+	return $value ? 'true' : 'false';
+}
+
+function getposterfile($file_list)
+{
+	foreach ($file_list as $file=>$url) {
+		//print $file."=>".$url."<br/>\n";
+		if (file_exists($file)) return $url;
+	}
+	return '';
+}
+
+function vjs_dbSet($fields, $data = array())
+{
+    if (!$data) $data = &$_POST;
+    $set='';
+    foreach ($fields as $field)
+    {
+        if (isset($data[$field]))
+        {
+            $set.="`$field`='".pwg_db_real_escape_string($data[$field])."', ";
+        }
+    }
+    return substr($set, 0, -2);
+}
+
+?>
Index: /extensions/piwigo_videojs/maintain.inc.php
===================================================================
--- /extensions/piwigo_videojs/maintain.inc.php	(revision 24676)
+++ /extensions/piwigo_videojs/maintain.inc.php	(revision 24676)
@@ -0,0 +1,127 @@
+<?php
+/***********************************************
+* File      :   maintain.inc.php
+* Project   :   piwigo-videojs
+* Descr     :   Install / Uninstall method
+*
+* Created   :   24.06.2012
+*
+* Copyright 2012-2013 <xbgmsharp@gmail.com>
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+************************************************/
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+function plugin_install()
+{
+	if (!defined('VIDEOJS_PATH'))
+		define('VIDEOJS_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)).'/');
+
+	// Remove unused directory or files from 0.4 and 0.5 to 0.6
+	$toremove = array("skin", "js", "language/es_ES");
+	foreach ($toremove as $dir)
+	{
+		if (is_dir(VIDEOJS_PATH.$dir))
+		{
+			deltree(VIDEOJS_PATH.$dir);
+		}
+	}
+	$toremove = array("language/index.htm", "language/fr_FR/index.htm", "language/en_UK/index.htm", "admin.tpl", "admin.php");
+	foreach ($toremove as $file)
+	{
+		if (is_file(VIDEOJS_PATH.$file))
+		{
+			@unlink(VIDEOJS_PATH.$file);
+		}
+	}
+
+	$default_config = array(
+		'skin'		=> 'vjs-default-skin',
+		'max_width'	=> '720',
+		'preload'	=> 'auto',
+		'controls'	=> true,
+		'autoplay'	=> false,
+		'loop'		=> false,
+	);
+
+	/* Add configuration to the config table */
+	$conf['vjs_conf'] = serialize($default_config);
+	conf_update_param('vjs_conf', $conf['vjs_conf']);
+
+	/* Add a comment to the entry */
+	$q = 'UPDATE '.CONFIG_TABLE.' SET `comment` = "Configuration settings for piwigo-videojs plugin" WHERE `param` = "vjs_conf";';
+	pwg_query( $q );
+
+	/* Keep customCSS separate as it can be big entry */
+	conf_update_param('vjs_customcss', '');
+
+	/* Add a comment to the entry */
+	$q = 'UPDATE '.CONFIG_TABLE.' SET `comment` = "Custom CSS used by the piwigo-videojs plugin" WHERE `param` = "vjs_customcss";';
+	pwg_query( $q );
+}
+
+function plugin_uninstall()
+{
+	/* Delete all files */
+/* Don't remove myself on restore settings
+	if (is_dir(VIDEOJS_PATH))
+	{
+		deltree(VIDEOJS_PATH);
+	}
+*/
+	$q = 'DELETE FROM '.CONFIG_TABLE.' WHERE param LIKE "%vjs_%" LIMIT 2;';
+	pwg_query( $q );
+	// TODO : Do we need to purge the videos from the images table?
+}
+
+function plugin_activate()
+{
+	global $conf;
+
+	if ( (!isset($conf['vjs_conf'])) or (!isset($conf['vjs_customcss']))
+	    or (count($conf['vjs_conf']) != 6))
+	{
+		plugin_install();
+	}
+}
+
+function deltree($path)
+{
+	if (is_dir($path))
+	{
+		$fh = opendir($path);
+		while ($file = readdir($fh))
+		{
+			if ($file != '.' and $file != '..')
+			{
+				$pathfile = $path . '/' . $file;
+				if (is_dir($pathfile))
+				{
+					deltree($pathfile);
+				}
+				else
+				{
+					@unlink($pathfile);
+				}
+			}
+		}
+		closedir($fh);
+		return @rmdir($path);
+	}
+}
+
+
+?>
Index: /extensions/piwigo_videojs/template/vjs-player.tpl
===================================================================
--- /extensions/piwigo_videojs/template/vjs-player.tpl	(revision 24676)
+++ /extensions/piwigo_videojs/template/vjs-player.tpl	(revision 24676)
@@ -0,0 +1,19 @@
+{html_head}
+<link href="{$VIDEOJS_PATH}video-js/{$VIDEOJS_SKINCSS}" rel="stylesheet">
+{$VIDEOJS_CUSTOMCSS}
+<script src="{$VIDEOJS_PATH}video-js/video.js"></script>
+<script>
+  videojs.options.flash.swf = "{$VIDEOJS_PATH}video-js/video-js.swf"
+</script>
+{/html_head}
+
+<div style="margin: 0 auto; width:{$WIDTH}px; min-width:480px">
+
+{literal}
+<video id="my_video_1" class="video-js {/literal}{$VIDEOJS_SKIN}{literal}" {/literal}{$OPTIONS}{literal} width={/literal}"{$WIDTH}"{literal} height={/literal}"{$HEIGHT}"{literal} poster={/literal}"{$VIDEOJS_POSTER_URL}"{literal} data-setup='{}'>
+  <source src={/literal}"{$VIDEOJS_MEDIA_URL}"{literal} type='video/{/literal}{$TYPE}{literal}'>
+  <p>Video Playback Not Supported<br/>Your browser does not support the video tag.</p>
+</video>
+{/literal}
+
+</div>
Index: /extensions/piwigo_videojs/video-js/darkfunk-skin.css
===================================================================
--- /extensions/piwigo_videojs/video-js/darkfunk-skin.css	(revision 24676)
+++ /extensions/piwigo_videojs/video-js/darkfunk-skin.css	(revision 24676)
@@ -0,0 +1,840 @@
+.video-js {
+  background-color:  #320000;
+	position:relative;
+	padding:0;
+	font-size:10px;
+	vertical-align:middle;
+}
+
+.video-js .vjs-tech {
+	position:absolute;
+	top:0;
+	left:0;
+	width:100%;
+	height:100%;
+}
+
+.video-js:-moz-full-screen {
+	position:absolute;
+}
+
+body.vjs-full-window {
+	padding:0;
+	margin:0;
+	height:100%;
+	overflow-y:auto;
+}
+
+.video-js.vjs-fullscreen {
+	position:fixed;
+	overflow:hidden;
+	z-index:1000;
+	left:0;
+	top:0;
+	bottom:0;
+	right:0;
+	width:100%!important;
+	height:100%!important;
+	_position:absolute;
+}
+
+.video-js:-webkit-full-screen {
+	width:100%!important;
+	height:100%!important;
+}
+
+.vjs-poster {
+	margin:0 auto;
+	padding:0;
+	cursor:pointer;
+	position:relative;
+	width:100%;
+	max-height:100%;
+}
+
+.video-js .vjs-text-track-display {
+	text-align:center;
+	position:absolute;
+	bottom:4em;
+	left:1em;
+	right:1em;
+	font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;
+}
+
+.video-js .vjs-text-track {
+	display:none;
+	color:#2f2f2f;
+	font-size:1.4em;
+	text-align:center;
+	margin-bottom:.1em;
+	background:#000;
+	background:rgba(0,0,0,0.50);
+}
+
+.video-js .vjs-subtitles {
+	color:#020202;
+}
+
+.video-js .vjs-captions {
+	color:#f2ff00;
+}
+
+.vjs-tt-cue {
+	display:block;
+}
+
+.vjs-fade-in {
+	visibility:visible!important;
+	opacity:1!important;
+	-webkit-transition:visibility 0 linear 0s,opacity .3s linear;
+	-moz-transition:visibility 0 linear 0s,opacity .3s linear;
+	-ms-transition:visibility 0 linear 0s,opacity .3s linear;
+	-o-transition:visibility 0 linear 0s,opacity .3s linear;
+	transition:visibility 0 linear 0s,opacity .3s linear;
+}
+
+.vjs-fade-out {
+	visibility:hidden!important;
+	opacity:0!important;
+	-webkit-transition:visibility 0 linear 1.5s,opacity 1.5s linear;
+	-moz-transition:visibility 0 linear 1.5s,opacity 1.5s linear;
+	-ms-transition:visibility 0 linear 1.5s,opacity 1.5s linear;
+	-o-transition:visibility 0 linear 1.5s,opacity 1.5s linear;
+	transition:visibility 0 linear 1.5s,opacity 1.5s linear;
+}
+
+.vjs-darkfunk-skin .vjs-controls {
+	position:absolute;
+	bottom:0;
+	left:0;
+	right:0;
+	margin:0;
+	padding:0;
+	height:2.6em;
+	color:#fff;
+	border-top:1px solid #404040;
+	background:#242424;
+	background:-moz-linear-gradient(top,#242424 50%,#1f1f1f 50%,#171717 100%);
+	background:-webkit-gradient(linear,0% 0,0% 100%,color-stop(50%,#242424),color-stop(50%,#1f1f1f),color-stop(100%,#171717));
+	background:-webkit-linear-gradient(top,#242424 50%,#1f1f1f 50%,#171717 100%);
+	background:-o-linear-gradient(top,#242424 50%,#1f1f1f 50%,#171717 100%);
+	background:-ms-linear-gradient(top,#242424 50%,#1f1f1f 50%,#171717 100%);
+	background:linear-gradient(top,#242424 50%,#1f1f1f 50%,#171717 100%);
+	visibility:hidden;
+	opacity:0;
+}
+
+.vjs-darkfunk-skin .vjs-control {
+	position:relative;
+	float:left;
+	text-align:center;
+	margin:0;
+	padding:0;
+	height:2.6em;
+	width:2.6em;
+}
+
+.vjs-darkfunk-skin .vjs-control:focus {
+	outline:0;
+}
+
+.vjs-darkfunk-skin .vjs-control-text {
+	border:0;
+	clip:rect(0 0 0 0);
+	height:1px;
+	margin:-1px;
+	overflow:hidden;
+	padding:0;
+	position:absolute;
+	width:1px;
+}
+
+.vjs-darkfunk-skin .vjs-play-control {
+	width:5em;
+	cursor:pointer!important;
+}
+
+.vjs-darkfunk-skin.vjs-paused .vjs-play-control div {
+	width:15px;
+	height:17px;
+	background:url(video-js.png);
+	margin:.5em auto 0;
+}
+
+.vjs-darkfunk-skin.vjs-playing .vjs-play-control div {
+	width:15px;
+	height:17px;
+	background:url(video-js.png) -25px 0;
+	margin:.5em auto 0;
+}
+
+.vjs-darkfunk-skin .vjs-rewind-control {
+	width:5em;
+	cursor:pointer!important;
+}
+
+.vjs-darkfunk-skin .vjs-rewind-control div {
+	width:19px;
+	height:16px;
+	background:url(video-js.png);
+	margin:.5em auto 0;
+}
+
+.vjs-darkfunk-skin .vjs-mute-control {
+	width:3.8em;
+	cursor:pointer!important;
+	float:right;
+}
+
+.vjs-darkfunk-skin .vjs-mute-control div {
+	width:22px;
+	height:16px;
+	background:url(video-js.png) -75px -25px;
+	margin:.5em auto 0;
+}
+
+.vjs-darkfunk-skin .vjs-mute-control.vjs-vol-0 div {
+	background:url(video-js.png) 0 -25px;
+}
+
+.vjs-darkfunk-skin .vjs-mute-control.vjs-vol-1 div {
+	background:url(video-js.png) -25px -25px;
+}
+
+.vjs-darkfunk-skin .vjs-mute-control.vjs-vol-2 div {
+	background:url(video-js.png) -50px -25px;
+}
+
+.vjs-darkfunk-skin .vjs-volume-control {
+	width:5em;
+	float:right;
+}
+
+.vjs-darkfunk-skin .vjs-volume-bar {
+	position:relative;
+	width:5em;
+	height:.6em;
+	margin:1em auto 0;
+	cursor:pointer!important;
+	-moz-border-radius:.3em;
+	-webkit-border-radius:.3em;
+	border-radius:.3em;
+	background:#666;
+	background:-moz-linear-gradient(top,#333,#666);
+	background:-webkit-gradient(linear,0% 0,0% 100%,from(#333),to(#666));
+	background:-webkit-linear-gradient(top,#333,#666);
+	background:-o-linear-gradient(top,#333,#666);
+	background:-ms-linear-gradient(top,#333,#666);
+	background:linear-gradient(top,#333,#666);
+}
+
+.vjs-darkfunk-skin .vjs-volume-level {
+	position:absolute;
+	top:0;
+	left:0;
+	height:.6em;
+	-moz-border-radius:.3em;
+	-webkit-border-radius:.3em;
+	border-radius:.3em;
+	background:#fff;
+	background:-moz-linear-gradient(top,#fff,#ccc);
+	background:-webkit-gradient(linear,0% 0,0% 100%,from(#fff),to(#ccc));
+	background:-webkit-linear-gradient(top,#fff,#ccc);
+	background:-o-linear-gradient(top,#fff,#ccc);
+	background:-ms-linear-gradient(top,#fff,#ccc);
+	background:linear-gradient(top,#fff,#ccc);
+}
+
+.vjs-darkfunk-skin .vjs-volume-handle {
+	position:absolute;
+	top:-.2em;
+	width:.8em;
+	height:.8em;
+	background:#ccc;
+	left:0;
+	border:1px solid #fff;
+	-moz-border-radius:.6em;
+	-webkit-border-radius:.6em;
+	border-radius:.6em;
+}
+
+.vjs-darkfunk-skin div.vjs-progress-control {
+	position:absolute;
+	left:4.8em;
+	right:4.8em;
+	height:1em;
+	width:auto;
+	top:-1.3em;
+	border-bottom:1px solid #1f1f1f;
+	border-top:1px solid #222;
+	background:#333;
+	background:-moz-linear-gradient(top,#222,#333);
+	background:-webkit-gradient(linear,0% 0,0% 100%,from(#222),to(#333));
+	background:-webkit-linear-gradient(top,#222,#333);
+	background:-o-linear-gradient(top,#333,#222);
+	background:-ms-linear-gradient(top,#333,#222);
+	background:linear-gradient(top,#333,#222);
+}
+
+.vjs-darkfunk-skin .vjs-progress-holder {
+	position:relative;
+	cursor:pointer!important;
+	padding:0;
+	margin:0;
+	height:1em;
+	-moz-border-radius:.6em;
+	-webkit-border-radius:.6em;
+	border-radius:.6em;
+	background:#111;
+	background:-moz-linear-gradient(top,#111,#262626);
+	background:-webkit-gradient(linear,0% 0,0% 100%,from(#111),to(#262626));
+	background:-webkit-linear-gradient(top,#111,#262626);
+	background:-o-linear-gradient(top,#111,#262626);
+	background:-ms-linear-gradient(top,#111,#262626);
+	background:linear-gradient(top,#111,#262626);
+}
+
+.vjs-darkfunk-skin .vjs-progress-holder .vjs-play-progress,.vjs-darkfunk-skin .vjs-progress-holder .vjs-load-progress {
+	position:absolute;
+	display:block;
+	height:1em;
+	margin:0;
+	padding:0;
+	left:0;
+	top:0;
+	-moz-border-radius:.6em;
+	-webkit-border-radius:.6em;
+	border-radius:.6em;
+}
+
+.vjs-darkfunk-skin .vjs-play-progress {
+	background:#fff;
+	background:-moz-linear-gradient(top,#fff 0,#d6d6d6 50%,#fff 100%);
+	background:-webkit-gradient(linear,0% 0,0% 100%,color-stop(0%,#fff),color-stop(50%,#d6d6d6),color-stop(100%,#fff));
+	background:-webkit-linear-gradient(top,#fff 0,#d6d6d6 50%,#fff 100%);
+	background:-o-linear-gradient(top,#fff 0,#d6d6d6 50%,#fff 100%);
+	background:-ms-linear-gradient(top,#fff 0,#d6d6d6 50%,#fff 100%);
+	background:linear-gradient(top,#fff 0,#d6d6d6 50%,#fff 100%);
+	background:#efefef;
+	background:-moz-linear-gradient(top,#efefef 0,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);
+	background:-webkit-gradient(linear,0% 0,0% 100%,color-stop(0%,#efefef),color-stop(50%,#f5f5f5),color-stop(50%,#dbdbdb),color-stop(100%,#f1f1f1));
+	background:-webkit-linear-gradient(top,#efefef 0,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);
+	background:-o-linear-gradient(top,#efefef 0,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);
+	background:-ms-linear-gradient(top,#efefef 0,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);
+	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#efefef',endColorstr='#f1f1f1',GradientType=0);
+	background:linear-gradient(top,#efefef 0,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);
+}
+
+.vjs-darkfunk-skin .vjs-load-progress {
+	opacity:.8;
+	background:#666;
+	background:-moz-linear-gradient(top,#666,#333);
+	background:-webkit-gradient(linear,0% 0,0% 100%,from(#666),to(#333));
+	background:-webkit-linear-gradient(top,#666,#333);
+	background:-o-linear-gradient(top,#666,#333);
+	background:-ms-linear-gradient(top,#666,#333);
+	background:linear-gradient(top,#666,#333);
+}
+
+.vjs-darkfunk-skin div.vjs-seek-handle {
+	position:absolute;
+	width:16px;
+	height:16px;
+	margin-top:-.3em;
+	left:0;
+	top:0;
+	background:url(video-js.png) 0 -50px;
+	-moz-border-radius:.8em;
+	-webkit-border-radius:.8em;
+	border-radius:.8em;
+	-webkit-box-shadow:0 2px 4px 0 #000;
+	-moz-box-shadow:0 2px 4px 0 #000;
+	box-shadow:0 2px 4px 0 #000;
+}
+
+.vjs-darkfunk-skin .vjs-time-controls {
+	position:absolute;
+	right:0;
+	height:1em;
+	width:4.8em;
+	top:-1.3em;
+	border-bottom:1px solid #1f1f1f;
+	border-top:1px solid #222;
+	background-color:#333;
+	font-size:1em;
+	line-height:1em;
+	font-weight:400;
+	font-family:Helvetica,Arial,sans-serif;
+	background:#333;
+	background:-moz-linear-gradient(top,#222,#333);
+	background:-webkit-gradient(linear,0% 0,0% 100%,from(#222),to(#333));
+	background:-webkit-linear-gradient(top,#222,#333);
+	background:-o-linear-gradient(top,#333,#222);
+	background:-ms-linear-gradient(top,#333,#222);
+	background:linear-gradient(top,#333,#222);
+}
+
+.vjs-darkfunk-skin .vjs-current-time {
+	left:0;
+}
+
+.vjs-darkfunk-skin .vjs-duration {
+	right:0;
+	display:none;
+}
+
+.vjs-darkfunk-skin .vjs-remaining-time {
+	right:0;
+}
+
+.vjs-time-divider {
+	display:none;
+}
+
+.vjs-darkfunk-skin .vjs-time-control {
+	font-size:1em;
+	line-height:1;
+	font-weight:400;
+	font-family:Helvetica,Arial,sans-serif;
+}
+
+.vjs-darkfunk-skin .vjs-time-control span {
+	line-height:25px;
+}
+
+.vjs-secondary-controls {
+	float:right;
+}
+
+.vjs-darkfunk-skin .vjs-fullscreen-control {
+	width:3.8em;
+	cursor:pointer!important;
+	float:right;
+}
+
+.vjs-darkfunk-skin .vjs-fullscreen-control div {
+	width:16px;
+	height:16px;
+	background:url(video-js.png) -50px 0;
+	margin:.5em auto 0;
+}
+
+.vjs-darkfunk-skin.vjs-fullscreen .vjs-fullscreen-control div {
+	background:url(video-js.png) -75px 0;
+}
+
+.vjs-darkfunk-skin .vjs-big-play-button {
+	display:block;
+	z-index:2;
+	position:absolute;
+	top:50%;
+	left:50%;
+	width:8em;
+	height:8em;
+	margin:-42px 0 0 -42px;
+	text-align:center;
+	vertical-align:center;
+	cursor:pointer!important;
+	border:.2em solid #fff;
+	opacity:.95;
+	-webkit-border-radius:25px;
+	-moz-border-radius:25px;
+	border-radius:25px;
+	background:#454545;
+	background:-moz-linear-gradient(top,#454545 0,#232323 50%,#161616 50%,#3f3f3f 100%);
+	background:-webkit-gradient(linear,0% 0,0% 100%,color-stop(0%,#454545),color-stop(50%,#232323),color-stop(50%,#161616),color-stop(100%,#3f3f3f));
+	background:-webkit-linear-gradient(top,#454545 0,#232323 50%,#161616 50%,#3f3f3f 100%);
+	background:-o-linear-gradient(top,#454545 0,#232323 50%,#161616 50%,#3f3f3f 100%);
+	background:-ms-linear-gradient(top,#454545 0,#232323 50%,#161616 50%,#3f3f3f 100%);
+	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#454545',endColorstr='#3f3f3f',GradientType=0);
+	background:linear-gradient(top,#454545 0,#232323 50%,#161616 50%,#3f3f3f 100%);
+	-webkit-box-shadow:4px 4px 8px #000;
+	-moz-box-shadow:4px 4px 8px #000;
+	box-shadow:4px 4px 8px #000;
+}
+
+.vjs-darkfunk-skin div.vjs-big-play-button:hover {
+	-webkit-box-shadow:0 0 80px #fff;
+	-moz-box-shadow:0 0 80px #fff;
+	box-shadow:0 0 80px #fff;
+}
+
+.vjs-darkfunk-skin div.vjs-big-play-button span {
+	position:absolute;
+	top:50%;
+	left:50%;
+	display:block;
+	width:35px;
+	height:42px;
+	margin:-20px 0 0 -15px;
+	background:url(video-js.png) -100px 0;
+}
+
+.vjs-loading-spinner {
+	display:none;
+	position:absolute;
+	top:50%;
+	left:50%;
+	width:55px;
+	height:55px;
+	margin:-28px 0 0 -28px;
+	-webkit-animation-name:rotatethis;
+	-webkit-animation-duration:1s;
+	-webkit-animation-iteration-count:infinite;
+	-webkit-animation-timing-function:linear;
+	-moz-animation-name:rotatethis;
+	-moz-animation-duration:1s;
+	-moz-animation-iteration-count:infinite;
+	-moz-animation-timing-function:linear;
+}
+
+@-webkit-keyframes rotatethis {
+	0% {
+		-webkit-transform:scale(0.6) rotate(0deg);
+	}
+	
+	12.5% {
+		-webkit-transform:scale(0.6) rotate(0deg);
+	}
+	
+	12.51% {
+		-webkit-transform:scale(0.6) rotate(45deg);
+	}
+	
+	25% {
+		-webkit-transform:scale(0.6) rotate(45deg);
+	}
+	
+	25.01% {
+		-webkit-transform:scale(0.6) rotate(90deg);
+	}
+	
+	37.5% {
+		-webkit-transform:scale(0.6) rotate(90deg);
+	}
+	
+	37.51% {
+		-webkit-transform:scale(0.6) rotate(135deg);
+	}
+	
+	50% {
+		-webkit-transform:scale(0.6) rotate(135deg);
+	}
+	
+	50.01% {
+		-webkit-transform:scale(0.6) rotate(180deg);
+	}
+	
+	62.5% {
+		-webkit-transform:scale(0.6) rotate(180deg);
+	}
+	
+	62.51% {
+		-webkit-transform:scale(0.6) rotate(225deg);
+	}
+	
+	75% {
+		-webkit-transform:scale(0.6) rotate(225deg);
+	}
+	
+	75.01% {
+		-webkit-transform:scale(0.6) rotate(270deg);
+	}
+	
+	87.5% {
+		-webkit-transform:scale(0.6) rotate(270deg);
+	}
+	
+	87.51% {
+		-webkit-transform:scale(0.6) rotate(315deg);
+	}
+	
+	100% {
+		-webkit-transform:scale(0.6) rotate(315deg);
+	}
+}
+
+@-moz-keyframes rotatethis {
+	0% {
+		-moz-transform:scale(0.6) rotate(0deg);
+	}
+	
+	12.5% {
+		-moz-transform:scale(0.6) rotate(0deg);
+	}
+	
+	12.51% {
+		-moz-transform:scale(0.6) rotate(45deg);
+	}
+	
+	25% {
+		-moz-transform:scale(0.6) rotate(45deg);
+	}
+	
+	25.01% {
+		-moz-transform:scale(0.6) rotate(90deg);
+	}
+	
+	37.5% {
+		-moz-transform:scale(0.6) rotate(90deg);
+	}
+	
+	37.51% {
+		-moz-transform:scale(0.6) rotate(135deg);
+	}
+	
+	50% {
+		-moz-transform:scale(0.6) rotate(135deg);
+	}
+	
+	50.01% {
+		-moz-transform:scale(0.6) rotate(180deg);
+	}
+	
+	62.5% {
+		-moz-transform:scale(0.6) rotate(180deg);
+	}
+	
+	62.51% {
+		-moz-transform:scale(0.6) rotate(225deg);
+	}
+	
+	75% {
+		-moz-transform:scale(0.6) rotate(225deg);
+	}
+	
+	75.01% {
+		-moz-transform:scale(0.6) rotate(270deg);
+	}
+	
+	87.5% {
+		-moz-transform:scale(0.6) rotate(270deg);
+	}
+	
+	87.51% {
+		-moz-transform:scale(0.6) rotate(315deg);
+	}
+	
+	100% {
+		-moz-transform:scale(0.6) rotate(315deg);
+	}
+}
+
+div.vjs-loading-spinner .ball1 {
+	opacity:.12;
+	position:absolute;
+	left:20px;
+	top:0;
+	width:13px;
+	height:13px;
+	background:#fff;
+	border-radius:13px;
+	-webkit-border-radius:13px;
+	-moz-border-radius:13px;
+	border:1px solid #ccc;
+}
+
+div.vjs-loading-spinner .ball2 {
+	opacity:.25;
+	position:absolute;
+	left:34px;
+	top:6px;
+	width:13px;
+	height:13px;
+	background:#fff;
+	border-radius:13px;
+	-webkit-border-radius:13px;
+	-moz-border-radius:13px;
+	border:1px solid #ccc;
+}
+
+div.vjs-loading-spinner .ball3 {
+	opacity:.37;
+	position:absolute;
+	left:40px;
+	top:20px;
+	width:13px;
+	height:13px;
+	background:#fff;
+	border-radius:13px;
+	-webkit-border-radius:13px;
+	-moz-border-radius:13px;
+	border:1px solid #ccc;
+}
+
+div.vjs-loading-spinner .ball4 {
+	opacity:.5;
+	position:absolute;
+	left:34px;
+	top:34px;
+	width:13px;
+	height:13px;
+	background:#fff;
+	border-radius:10px;
+	-webkit-border-radius:10px;
+	-moz-border-radius:15px;
+	border:1px solid #ccc;
+}
+
+div.vjs-loading-spinner .ball5 {
+	opacity:.62;
+	position:absolute;
+	left:20px;
+	top:40px;
+	width:13px;
+	height:13px;
+	background:#fff;
+	border-radius:13px;
+	-webkit-border-radius:13px;
+	-moz-border-radius:13px;
+	border:1px solid #ccc;
+}
+
+div.vjs-loading-spinner .ball6 {
+	opacity:.75;
+	position:absolute;
+	left:6px;
+	top:34px;
+	width:13px;
+	height:13px;
+	background:#fff;
+	border-radius:13px;
+	-webkit-border-radius:13px;
+	-moz-border-radius:13px;
+	border:1px solid #ccc;
+}
+
+div.vjs-loading-spinner .ball7 {
+	opacity:.87;
+	position:absolute;
+	left:0;
+	top:20px;
+	width:13px;
+	height:13px;
+	background:#fff;
+	border-radius:13px;
+	-webkit-border-radius:13px;
+	-moz-border-radius:13px;
+	border:1px solid #ccc;
+}
+
+div.vjs-loading-spinner .ball8 {
+	opacity:1;
+	position:absolute;
+	left:6px;
+	top:6px;
+	width:13px;
+	height:13px;
+	background:#fff;
+	border-radius:13px;
+	-webkit-border-radius:13px;
+	-moz-border-radius:13px;
+	border:1px solid #ccc;
+}
+
+.vjs-darkfunk-skin .vjs-menu-button {
+	float:right;
+	margin:.2em .5em 0 0;
+	padding:0;
+	width:3em;
+	height:2em;
+	cursor:pointer!important;
+	border:1px solid #111;
+	-moz-border-radius:.3em;
+	-webkit-border-radius:.3em;
+	border-radius:.3em;
+	background:#4d4d4d;
+	background:-moz-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);
+	background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#4d4d4d),color-stop(50%,#3f3f3f),color-stop(50%,#333),color-stop(100%,#252525));
+	background:-webkit-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);
+	background:-o-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);
+	background:-ms-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);
+	background:linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);
+}
+
+.vjs-darkfunk-skin .vjs-menu-button div {
+	background:url(video-js.png) 0 -75px no-repeat;
+	width:16px;
+	height:16px;
+	margin:.2em auto 0;
+	padding:0;
+}
+
+.vjs-darkfunk-skin .vjs-menu-button ul {
+	display:none;
+	opacity:.8;
+	padding:0;
+	margin:0;
+	position:absolute;
+	width:10em;
+	bottom:2em;
+	max-height:15em;
+	left:-3.5em;
+	background-color:#111;
+	border:2px solid #333;
+	-moz-border-radius:.7em;
+	-webkit-border-radius:1em;
+	border-radius:.5em;
+	-webkit-box-shadow:0 2px 4px 0 #000;
+	-moz-box-shadow:0 2px 4px 0 #000;
+	box-shadow:0 2px 4px 0 #000;
+	overflow:auto;
+}
+
+.vjs-darkfunk-skin .vjs-menu-button:focus ul,.vjs-darkfunk-skin .vjs-menu-button:hover ul {
+	display:block;
+	list-style:none;
+}
+
+.vjs-darkfunk-skin .vjs-menu-button ul li {
+	list-style:none;
+	margin:0;
+	padding:.3em 0 .3em 20px;
+	line-height:1.4em;
+	font-size:1.2em;
+	font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;
+	text-align:left;
+}
+
+.vjs-darkfunk-skin .vjs-menu-button ul li.vjs-selected {
+	text-decoration:underline;
+	background:url(video-js.png) -125px -50px no-repeat;
+}
+
+.vjs-darkfunk-skin .vjs-menu-button ul li:focus,.vjs-darkfunk-skin .vjs-menu-button ul li:hover,.vjs-darkfunk-skin .vjs-menu-button ul li.vjs-selected:focus,.vjs-darkfunk-skin .vjs-menu-button ul li.vjs-selected:hover {
+	background-color:#ccc;
+	color:#111;
+	outline:0;
+}
+
+.vjs-darkfunk-skin .vjs-menu-button ul li.vjs-menu-title {
+	text-align:center;
+	text-transform:uppercase;
+	font-size:1em;
+	line-height:2em;
+	padding:0;
+	margin:0 0 .3em;
+	color:#fff;
+	font-weight:700;
+	cursor:default;
+	background:#4d4d4d;
+	background:-moz-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);
+	background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#4d4d4d),color-stop(50%,#3f3f3f),color-stop(50%,#333),color-stop(100%,#252525));
+	background:-webkit-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);
+	background:-o-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);
+	background:-ms-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);
+	background:linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);
+}
+
+.vjs-darkfunk-skin .vjs-captions-button div {
+	background-position:-25px -75px;
+}
+
+.vjs-darkfunk-skin .vjs-chapters-button div {
+	background-position:-100px -75px;
+}
+
+.vjs-darkfunk-skin .vjs-chapters-button ul {
+	width:20em;
+	left:-8.5em;
+}
Index: /extensions/piwigo_videojs/video-js/demo.captions.vtt
===================================================================
--- /extensions/piwigo_videojs/video-js/demo.captions.vtt	(revision 24676)
+++ /extensions/piwigo_videojs/video-js/demo.captions.vtt	(revision 24676)
@@ -0,0 +1,41 @@
+WEBVTT
+
+00:00.700 --> 00:04.110
+Captions describe all relevant audio for the hearing impaired.
+[ Heroic music playing for a seagull ]
+
+00:04.500 --> 00:05.000
+[ Splash!!! ]
+
+00:05.100 --> 00:06.000
+[ Sploosh!!! ]
+
+00:08.000 --> 00:09.225
+[ Splash...splash...splash splash splash ]
+
+00:10.525 --> 00:11.255
+[ Splash, Sploosh again ]
+
+00:13.500 --> 00:14.984
+Dolphin: eeeEEEEEeeee!
+
+00:14.984 --> 00:16.984
+Dolphin: Squawk! eeeEEE?
+
+00:25.000 --> 00:28.284
+[ A whole ton of splashes ]
+
+00:29.500 --> 00:31.000
+Mine. Mine. Mine.
+
+00:34.300 --> 00:36.000
+Shark: Chomp
+
+00:36.800 --> 00:37.900
+Shark: CHOMP!!!
+
+00:37.861 --> 00:41.193
+EEEEEEOOOOOOOOOOWHALENOISE
+
+00:42.593 --> 00:45.611
+[ BIG SPLASH ]
Index: /extensions/piwigo_videojs/video-js/demo.html
===================================================================
--- /extensions/piwigo_videojs/video-js/demo.html	(revision 24676)
+++ /extensions/piwigo_videojs/video-js/demo.html	(revision 24676)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <title>Video.js | HTML5 Video Player</title>
+
+  <!-- Chang URLs to wherever Video.js files will be hosted -->
+  <link href="video-js.css" rel="stylesheet" type="text/css">
+  <!-- video.js must be in the <head> for older IEs to work. -->
+  <script src="video.js"></script>
+
+  <!-- Unless using the CDN hosted version, update the URL to the Flash SWF -->
+  <script>
+    videojs.options.flash.swf = "video-js.swf";
+  </script>
+
+
+</head>
+<body>
+
+  <video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="640" height="264"
+      poster="http://video-js.zencoder.com/oceans-clip.png"
+      data-setup="{}">
+    <source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4' />
+    <source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm' />
+    <source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg' />
+    <track kind="captions" src="demo.captions.vtt" srclang="en" label="English"></track><!-- Tracks need an ending tag thanks to IE9 -->
+  </video>
+
+</body>
+</html>
Index: /extensions/piwigo_videojs/video-js/font/vjs.svg
===================================================================
--- /extensions/piwigo_videojs/video-js/font/vjs.svg	(revision 24676)
+++ /extensions/piwigo_videojs/video-js/font/vjs.svg	(revision 24676)
@@ -0,0 +1,40 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
+<svg xmlns="http://www.w3.org/2000/svg">
+<metadata>
+This is a custom SVG font generated by IcoMoon.
+<iconset grid="16"></iconset>
+</metadata>
+<defs>
+<font id="VideoJS" horiz-adv-x="512" >
+<font-face units-per-em="512" ascent="480" descent="-32" />
+<missing-glyph horiz-adv-x="512" />
+<glyph unicode="&#xe000;" d="M 512.00,480.00 L 512.00,272.00 L 432.00,352.00 L 336.00,256.00 L 288.00,304.00 L 384.00,400.00 L 304.00,480.00 ZM 224.00,144.00 L 128.00,48.00 L 208.00-32.00 L 0.00-32.00 L 0.00,176.00 L 80.00,96.00 L 176.00,192.00 Z"  />
+<glyph unicode="&#xe001;" d="M 96.00,416.00L 416.00,224.00L 96.00,32.00 z"  />
+<glyph unicode="&#xe002;" d="M 64.00,416.00L 224.00,416.00L 224.00,32.00L 64.00,32.00zM 288.00,416.00L 448.00,416.00L 448.00,32.00L 288.00,32.00z"  />
+<glyph unicode="&#xe003;" d="M 200.666,440.666 C 213.50,453.50 224.00,449.15 224.00,431.00 L 224.00,17.00 C 224.00-1.15 213.50-5.499 200.666,7.335 L 80.00,128.00 L 0.00,128.00 L 0.00,320.00 L 80.00,320.00 L 200.666,440.666 Z"  />
+<glyph unicode="&#xe004;" d="M 274.51,109.49c-6.143,0.00-12.284,2.343-16.971,7.029c-9.373,9.373-9.373,24.568,0.00,33.941
+		c 40.55,40.55, 40.55,106.529,0.00,147.078c-9.373,9.373-9.373,24.569,0.00,33.941c 9.373,9.372, 24.568,9.372, 33.941,0.00
+		c 59.265-59.265, 59.265-155.696,0.00-214.961C 286.794,111.833, 280.652,109.49, 274.51,109.49zM 200.666,440.666 C 213.50,453.50 224.00,449.15 224.00,431.00 L 224.00,17.00 C 224.00-1.15 213.50-5.499 200.666,7.335 L 80.00,128.00 L 0.00,128.00 L 0.00,320.00 L 80.00,320.00 L 200.666,440.666 Z"  />
+<glyph unicode="&#xe005;" d="M 359.765,64.235c-6.143,0.00-12.284,2.343-16.971,7.029c-9.372,9.372-9.372,24.568,0.00,33.941
+		c 65.503,65.503, 65.503,172.085,0.00,237.588c-9.372,9.373-9.372,24.569,0.00,33.941c 9.372,9.371, 24.569,9.372, 33.941,0.00
+		C 417.532,335.938, 440.00,281.696, 440.00,224.00c0.00-57.695-22.468-111.938-63.265-152.735C 372.049,66.578, 365.907,64.235, 359.765,64.235zM 274.51,109.49c-6.143,0.00-12.284,2.343-16.971,7.029c-9.373,9.373-9.373,24.568,0.00,33.941
+		c 40.55,40.55, 40.55,106.529,0.00,147.078c-9.373,9.373-9.373,24.569,0.00,33.941c 9.373,9.372, 24.568,9.372, 33.941,0.00
+		c 59.265-59.265, 59.265-155.696,0.00-214.961C 286.794,111.833, 280.652,109.49, 274.51,109.49zM 200.666,440.666 C 213.50,453.50 224.00,449.15 224.00,431.00 L 224.00,17.00 C 224.00-1.15 213.50-5.499 200.666,7.335 L 80.00,128.00 L 0.00,128.00 L 0.00,320.00 L 80.00,320.00 L 200.666,440.666 Z"  />
+<glyph unicode="&#xe006;" d="M 445.02,18.98c-6.143,0.00-12.284,2.343-16.971,7.029c-9.372,9.373-9.372,24.568,0.00,33.941
+		C 471.868,103.771, 496.001,162.03, 496.001,224.00c0.00,61.969-24.133,120.229-67.952,164.049c-9.372,9.373-9.372,24.569,0.00,33.941
+		c 9.372,9.372, 24.569,9.372, 33.941,0.00c 52.885-52.886, 82.011-123.20, 82.011-197.99c0.00-74.791-29.126-145.104-82.011-197.99
+		C 457.304,21.323, 451.162,18.98, 445.02,18.98zM 359.765,64.235c-6.143,0.00-12.284,2.343-16.971,7.029c-9.372,9.372-9.372,24.568,0.00,33.941
+		c 65.503,65.503, 65.503,172.085,0.00,237.588c-9.372,9.373-9.372,24.569,0.00,33.941c 9.372,9.371, 24.569,9.372, 33.941,0.00
+		C 417.532,335.938, 440.00,281.696, 440.00,224.00c0.00-57.695-22.468-111.938-63.265-152.735C 372.049,66.578, 365.907,64.235, 359.765,64.235zM 274.51,109.49c-6.143,0.00-12.284,2.343-16.971,7.029c-9.373,9.373-9.373,24.568,0.00,33.941
+		c 40.55,40.55, 40.55,106.529,0.00,147.078c-9.373,9.373-9.373,24.569,0.00,33.941c 9.373,9.372, 24.568,9.372, 33.941,0.00
+		c 59.265-59.265, 59.265-155.696,0.00-214.961C 286.794,111.833, 280.652,109.49, 274.51,109.49zM 200.666,440.666 C 213.50,453.50 224.00,449.15 224.00,431.00 L 224.00,17.00 C 224.00-1.15 213.50-5.499 200.666,7.335 L 80.00,128.00 L 0.00,128.00 L 0.00,320.00 L 80.00,320.00 L 200.666,440.666 Z" horiz-adv-x="544"  />
+<glyph unicode="&#xe007;" d="M 256.00,480.00L 96.00,224.00L 256.00-32.00L 416.00,224.00 z"  />
+<glyph unicode="&#xe008;" d="M 0.00,480.00 L 687.158,480.00 L 687.158-35.207 L 0.00-35.207 L 0.00,480.00 z M 622.731,224.638 C 621.878,314.664 618.46,353.922 597.131,381.656 C 593.291,387.629 586.038,391.042 580.065,395.304 C 559.158,410.669 460.593,416.211 346.247,416.211 C 231.896,416.211 128.642,410.669 108.162,395.304 C 101.762,391.042 94.504,387.629 90.242,381.656 C 69.331,353.922 66.349,314.664 65.069,224.638 C 66.349,134.607 69.331,95.353 90.242,67.62 C 94.504,61.22 101.762,58.233 108.162,53.967 C 128.642,38.18 231.896,33.06 346.247,32.207 C 460.593,33.06 559.158,38.18 580.065,53.967 C 586.038,58.233 593.291,61.22 597.131,67.62 C 618.46,95.353 621.878,134.607 622.731,224.638 z M 331.179,247.952 C 325.389,318.401 287.924,359.905 220.901,359.905 C 159.672,359.905 111.54,304.689 111.54,215.965 C 111.54,126.859 155.405,71.267 227.907,71.267 C 285.79,71.267 326.306,113.916 332.701,184.742 L 263.55,184.742 C 260.81,158.468 249.843,138.285 226.69,138.285 C 190.136,138.285 183.435,174.462 183.435,212.92 C 183.435,265.854 198.665,292.886 223.951,292.886 C 246.492,292.886 260.81,276.511 262.939,247.952 L 331.179,247.952 z M 570.013,247.952 C 564.228,318.401 526.758,359.905 459.74,359.905 C 398.507,359.905 350.379,304.689 350.379,215.965 C 350.379,126.859 394.244,71.267 466.746,71.267 C 524.625,71.267 565.14,113.916 571.536,184.742 L 502.384,184.742 C 499.649,158.468 488.682,138.285 465.529,138.285 C 428.971,138.285 422.27,174.462 422.27,212.92 C 422.27,265.854 437.504,292.886 462.785,292.886 C 485.327,292.886 499.649,276.511 501.778,247.952 L 570.013,247.952 z " horiz-adv-x="687.1578947368421"  />
+<glyph unicode="&#xe009;" d="M 64.00,416.00L 448.00,416.00L 448.00,32.00L 64.00,32.00z"  />
+<glyph unicode="&#xe00a;" d="M 192.00,416.00A64.00,64.00 12780.00 1 1 320.00,416A64.00,64.00 12780.00 1 1 192.00,416zM 327.765,359.765A64.00,64.00 12780.00 1 1 455.765,359.765A64.00,64.00 12780.00 1 1 327.765,359.765zM 416.00,224.00A32.00,32.00 12780.00 1 1 480.00,224A32.00,32.00 12780.00 1 1 416.00,224zM 359.765,88.235A32.00,32.00 12780.00 1 1 423.765,88.23500000000001A32.00,32.00 12780.00 1 1 359.765,88.23500000000001zM 224.001,32.00A32.00,32.00 12780.00 1 1 288.001,32A32.00,32.00 12780.00 1 1 224.001,32zM 88.236,88.235A32.00,32.00 12780.00 1 1 152.236,88.23500000000001A32.00,32.00 12780.00 1 1 88.236,88.23500000000001zM 72.236,359.765A48.00,48.00 12780.00 1 1 168.236,359.765A48.00,48.00 12780.00 1 1 72.236,359.765zM 28.00,224.00A36.00,36.00 12780.00 1 1 100.00,224A36.00,36.00 12780.00 1 1 28.00,224z"  />
+<glyph unicode="&#xe00b;" d="M 224.00,192.00 L 224.00-16.00 L 144.00,64.00 L 48.00-32.00 L 0.00,16.00 L 96.00,112.00 L 16.00,192.00 ZM 512.00,432.00 L 416.00,336.00 L 496.00,256.00 L 288.00,256.00 L 288.00,464.00 L 368.00,384.00 L 464.00,480.00 Z"  />
+<glyph unicode="&#xe00c;" d="M 256.00,448.00 C 397.385,448.00 512.00,354.875 512.00,240.00 C 512.00,125.124 397.385,32.00 256.00,32.00 C 242.422,32.00 229.095,32.867 216.088,34.522 C 161.099-20.467 95.463-30.328 32.00-31.776 L 32.00-18.318 C 66.268-1.529 96.00,29.052 96.00,64.00 C 96.00,68.877 95.621,73.665 94.918,78.348 C 37.02,116.48 0.00,174.725 0.00,240.00 C 0.00,354.875 114.615,448.00 256.00,448.00 Z"  />
+<glyph unicode="&#x20;" horiz-adv-x="256" />
+<glyph class="hidden" unicode="&#xf000;" d="M0,480L 512 -32L0 -32 z" horiz-adv-x="0" />
+</font></defs></svg>
Index: /extensions/piwigo_videojs/video-js/redsheen-skin.css
===================================================================
--- /extensions/piwigo_videojs/video-js/redsheen-skin.css	(revision 24676)
+++ /extensions/piwigo_videojs/video-js/redsheen-skin.css	(revision 24676)
@@ -0,0 +1,822 @@
+.video-js-redsheen {
+  background-color: #b00e0e;
+	position:relative;
+	padding:0;
+	font-size:10px;
+	vertical-align:middle;
+}
+
+.video-js .vjs-tech {
+	position:absolute;
+	top:0;
+	left:0;
+	width:100%;
+	height:100%;
+}
+
+.video-js:-moz-full-screen {
+	position:absolute;
+}
+
+body.vjs-full-window {
+	padding:0;
+	margin:0;
+	height:100%;
+	overflow-y:auto;
+}
+
+.video-js.vjs-fullscreen {
+	position:fixed;
+	overflow:hidden;
+	z-index:1000;
+	left:0;
+	top:0;
+	bottom:0;
+	right:0;
+	width:100%!important;
+	height:100%!important;
+	_position:absolute;
+}
+
+.video-js:-webkit-full-screen {
+	width:100%!important;
+	height:100%!important;
+}
+
+.vjs-poster {
+	margin:0 auto;
+	padding:0;
+	cursor:pointer;
+	position:relative;
+	width:100%;
+	max-height:100%;
+}
+
+.video-js-redsheen .vjs-text-track-display {
+	text-align:center;
+	position:absolute;
+	bottom:4em;
+	left:1em;
+	right:1em;
+	font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;
+}
+
+.video-js .vjs-text-track {
+	display:none;
+	color:#2f2f2f;
+	font-size:1.4em;
+	text-align:center;
+	margin-bottom:.1em;
+	background:#000;
+	background:rgba(0,0,0,0.50);
+}
+
+.video-js .vjs-subtitles {
+	color:#020202;
+}
+
+.video-js .vjs-captions {
+	color:#f2ff00;
+}
+
+.vjs-tt-cue {
+	display:block;
+}
+
+.vjs-fade-in {
+	visibility:visible!important;
+	opacity:1!important;
+	-webkit-transition:visibility 0 linear 0s,opacity .3s linear;
+	-moz-transition:visibility 0 linear 0s,opacity .3s linear;
+	-ms-transition:visibility 0 linear 0s,opacity .3s linear;
+	-o-transition:visibility 0 linear 0s,opacity .3s linear;
+	transition:visibility 0 linear 0s,opacity .3s linear;
+}
+
+.vjs-fade-out {
+	visibility:hidden!important;
+	opacity:0!important;
+	-webkit-transition:visibility 0 linear 1.5s,opacity 1.5s linear;
+	-moz-transition:visibility 0 linear 1.5s,opacity 1.5s linear;
+	-ms-transition:visibility 0 linear 1.5s,opacity 1.5s linear;
+	-o-transition:visibility 0 linear 1.5s,opacity 1.5s linear;
+	transition:visibility 0 linear 1.5s,opacity 1.5s linear;
+}
+
+.vjs-redsheen-skin .vjs-controls {
+	position:absolute;
+	bottom:0;
+	left:0;
+	right:0;
+	margin:0;
+	padding:0;
+	height:2.6em;
+	color:#460505;
+	border-top:1px solid #da7272;
+	background:#520000;
+	visibility:hidden;
+	opacity:0;
+}
+
+.vjs-redsheen-skin .vjs-control {
+	position:relative;
+	float:left;
+	text-align:center;
+	margin:0;
+	padding:0;
+	height:2.6em;
+	width:2.6em;
+}
+
+.vjs-redsheen-skin .vjs-control:focus {
+	outline:0;
+}
+
+.vjs-redsheen-skin .vjs-control-text {
+	border:0;
+	clip:rect(0 0 0 0);
+	height:1px;
+	margin:-1px;
+	overflow:hidden;
+	padding:0;
+	position:absolute;
+	width:1px;
+}
+
+.vjs-redsheen-skin .vjs-play-control {
+	width:5em;
+	cursor:pointer!important;
+}
+
+.vjs-redsheen-skin.vjs-paused .vjs-play-control div {
+	width:15px;
+	height:17px;
+	background:url(video-js.png);
+	margin:.5em auto 0;
+}
+
+.vjs-redsheen-skin.vjs-playing .vjs-play-control div {
+	width:15px;
+	height:17px;
+	background:url(video-js.png) -25px 0;
+	margin:.5em auto 0;
+}
+
+.vjs-redsheen-skin .vjs-rewind-control {
+	width:5em;
+	cursor:pointer!important;
+}
+
+.vjs-redsheen-skin .vjs-rewind-control div {
+	width:19px;
+	height:16px;
+	background:url(video-js.png);
+	margin:.5em auto 0;
+}
+
+.vjs-redsheen-skin .vjs-mute-control {
+	width:3.8em;
+	cursor:pointer!important;
+	float:right;
+}
+
+.vjs-redsheen-skin .vjs-mute-control div {
+	width:22px;
+	height:16px;
+	background:url(video-js.png) -75px -25px;
+	margin:.5em auto 0;
+}
+
+.vjs-redsheen-skin .vjs-mute-control.vjs-vol-0 div {
+	background:url(video-js.png) 0 -25px;
+}
+
+.vjs-redsheen-skin .vjs-mute-control.vjs-vol-1 div {
+	background:url(video-js.png) -25px -25px;
+}
+
+.vjs-redsheen-skin .vjs-mute-control.vjs-vol-2 div {
+	background:url(video-js.png) -50px -25px;
+}
+
+.vjs-redsheen-skin .vjs-volume-control {
+	width:5em;
+	float:right;
+}
+
+.vjs-redsheen-skin .vjs-volume-bar {
+	position:relative;
+	width:5em;
+	height:.6em;
+	margin:1em auto 0;
+	cursor:pointer!important;
+	-moz-border-radius:.3em;
+	-webkit-border-radius:.3em;
+	border-radius:.3em;
+	background:#000000;
+}
+
+.vjs-redsheen-skin .vjs-volume-level {
+	position:absolute;
+	top:0;
+	left:0;
+	height:.6em;
+	-moz-border-radius:.3em;
+	-webkit-border-radius:.3em;
+	border-radius:.3em;
+	background:#ff8500;
+}
+
+.vjs-redsheen-skin .vjs-volume-handle {
+	position:absolute;
+	top:-.2em;
+	width:.8em;
+	height:.8em;
+	background:#ccc;
+	left:0;
+	border:1px solid #fff;
+	-moz-border-radius:.6em;
+	-webkit-border-radius:.6em;
+	border-radius:.6em;
+}
+
+.vjs-redsheen-skin div.vjs-progress-control {
+	position:absolute;
+	left:4.8em;
+	right:4.8em;
+	height:1em;
+	width:auto;
+	top:-1.3em;
+	border-bottom:1px solid #1f1f1f;
+	border-top:1px solid #222;
+	background:#333;
+	background:-moz-linear-gradient(top,#222,#333);
+	background:-webkit-gradient(linear,0% 0,0% 100%,from(#222),to(#333));
+	background:-webkit-linear-gradient(top,#222,#333);
+	background:-o-linear-gradient(top,#333,#222);
+	background:-ms-linear-gradient(top,#333,#222);
+	background:linear-gradient(top,#333,#222);
+}
+
+.vjs-redsheen-skin .vjs-progress-holder {
+	position:relative;
+	cursor:pointer!important;
+	padding:0;
+	margin:0;
+	height:1em;
+	-moz-border-radius:.6em;
+	-webkit-border-radius:.6em;
+	border-radius:.6em;
+	background:#111;
+	background:-moz-linear-gradient(top,#111,#262626);
+	background:-webkit-gradient(linear,0% 0,0% 100%,from(#111),to(#262626));
+	background:-webkit-linear-gradient(top,#111,#262626);
+	background:-o-linear-gradient(top,#111,#262626);
+	background:-ms-linear-gradient(top,#111,#262626);
+	background:linear-gradient(top,#111,#262626);
+}
+
+.vjs-redsheen-skin .vjs-progress-holder .vjs-play-progress,.vjs-redsheen-skin .vjs-progress-holder .vjs-load-progress {
+	position:absolute;
+	display:block;
+	height:1em;
+	margin:0;
+	padding:0;
+	left:0;
+	top:0;
+	-moz-border-radius:.6em;
+	-webkit-border-radius:.6em;
+	border-radius:.6em;
+}
+
+.vjs-redsheen-skin .vjs-play-progress {
+	background:#fff;
+	background:-moz-linear-gradient(top,#fff 0,#d6d6d6 50%,#fff 100%);
+	background:-webkit-gradient(linear,0% 0,0% 100%,color-stop(0%,#fff),color-stop(50%,#d6d6d6),color-stop(100%,#fff));
+	background:-webkit-linear-gradient(top,#fff 0,#d6d6d6 50%,#fff 100%);
+	background:-o-linear-gradient(top,#fff 0,#d6d6d6 50%,#fff 100%);
+	background:-ms-linear-gradient(top,#fff 0,#d6d6d6 50%,#fff 100%);
+	background:linear-gradient(top,#fff 0,#d6d6d6 50%,#fff 100%);
+	background:#efefef;
+	background:-moz-linear-gradient(top,#efefef 0,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);
+	background:-webkit-gradient(linear,0% 0,0% 100%,color-stop(0%,#efefef),color-stop(50%,#f5f5f5),color-stop(50%,#dbdbdb),color-stop(100%,#f1f1f1));
+	background:-webkit-linear-gradient(top,#efefef 0,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);
+	background:-o-linear-gradient(top,#efefef 0,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);
+	background:-ms-linear-gradient(top,#efefef 0,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);
+	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#efefef',endColorstr='#f1f1f1',GradientType=0);
+	background:linear-gradient(top,#efefef 0,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);
+}
+
+.vjs-redsheen-skin .vjs-load-progress {
+	opacity:.8;
+	background:#666;
+	background:-moz-linear-gradient(top,#666,#333);
+	background:-webkit-gradient(linear,0% 0,0% 100%,from(#666),to(#333));
+	background:-webkit-linear-gradient(top,#666,#333);
+	background:-o-linear-gradient(top,#666,#333);
+	background:-ms-linear-gradient(top,#666,#333);
+	background:linear-gradient(top,#666,#333);
+}
+
+.vjs-redsheen-skin div.vjs-seek-handle {
+	position:absolute;
+	width:16px;
+	height:16px;
+	margin-top:-.3em;
+	left:0;
+	top:0;
+	background:url(video-js.png) 0 -50px;
+	-moz-border-radius:.8em;
+	-webkit-border-radius:.8em;
+	border-radius:.8em;
+	-webkit-box-shadow:0 2px 4px 0 #000;
+	-moz-box-shadow:0 2px 4px 0 #000;
+	box-shadow:0 2px 4px 0 #000;
+}
+
+.vjs-redsheen-skin .vjs-time-controls {
+	position:absolute;
+	right:0;
+	height:1em;
+	width:4.8em;
+	top:-1.3em;
+	border-bottom:1px solid #1f1f1f;
+	border-top:1px solid #222;
+	background-color:#333;
+	font-size:1em;
+	line-height:1em;
+	font-weight:400;
+	font-family:Helvetica,Arial,sans-serif;
+	background:#333;
+	background:-moz-linear-gradient(top,#222,#333);
+	background:-webkit-gradient(linear,0% 0,0% 100%,from(#222),to(#333));
+	background:-webkit-linear-gradient(top,#222,#333);
+	background:-o-linear-gradient(top,#333,#222);
+	background:-ms-linear-gradient(top,#333,#222);
+	background:linear-gradient(top,#333,#222);
+}
+
+.vjs-redsheen-skin .vjs-current-time {
+	left:0;
+}
+
+.vjs-redsheen-skin .vjs-duration {
+	right:0;
+	display:none;
+}
+
+.vjs-redsheen-skin .vjs-remaining-time {
+	right:0;
+}
+
+.vjs-time-divider {
+	display:none;
+}
+
+.vjs-redsheen-skin .vjs-time-control {
+	font-size:1em;
+	line-height:1;
+	font-weight:400;
+	font-family:Helvetica,Arial,sans-serif;
+}
+
+.vjs-redsheen-skin .vjs-time-control span {
+	line-height:25px;
+}
+
+.vjs-secondary-controls {
+	float:right;
+}
+
+.vjs-redsheen-skin .vjs-fullscreen-control {
+	width:3.8em;
+	cursor:pointer!important;
+	float:right;
+}
+
+.vjs-redsheen-skin .vjs-fullscreen-control div {
+	width:16px;
+	height:16px;
+	background:url(video-js.png) -50px 0;
+	margin:.5em auto 0;
+}
+
+.vjs-redsheen-skin.vjs-fullscreen .vjs-fullscreen-control div {
+	background:url(video-js.png) -75px 0;
+}
+
+.vjs-redsheen-skin .vjs-big-play-button {
+	display:block;
+	z-index:2;
+	position:absolute;
+	top:50%;
+	left:50%;
+	width:8em;
+	height:8em;
+	margin:-42px 0 0 -42px;
+	text-align:center;
+	vertical-align:center;
+	cursor:pointer!important;
+	border:.2em solid #fff;
+	opacity:.95;
+	-webkit-border-radius:25px;
+	-moz-border-radius:25px;
+	border-radius:25px;
+	background:#454545;
+	background:-moz-linear-gradient(top,#454545 0,#232323 50%,#161616 50%,#3f3f3f 100%);
+	background:-webkit-gradient(linear,0% 0,0% 100%,color-stop(0%,#454545),color-stop(50%,#232323),color-stop(50%,#161616),color-stop(100%,#3f3f3f));
+	background:-webkit-linear-gradient(top,#454545 0,#232323 50%,#161616 50%,#3f3f3f 100%);
+	background:-o-linear-gradient(top,#454545 0,#232323 50%,#161616 50%,#3f3f3f 100%);
+	background:-ms-linear-gradient(top,#454545 0,#232323 50%,#161616 50%,#3f3f3f 100%);
+	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#454545',endColorstr='#3f3f3f',GradientType=0);
+	background:linear-gradient(top,#454545 0,#232323 50%,#161616 50%,#3f3f3f 100%);
+	-webkit-box-shadow:4px 4px 8px #000;
+	-moz-box-shadow:4px 4px 8px #000;
+	box-shadow:4px 4px 8px #000;
+}
+
+.vjs-redsheen-skin div.vjs-big-play-button:hover {
+	-webkit-box-shadow:0 0 80px #fff;
+	-moz-box-shadow:0 0 80px #fff;
+	box-shadow:0 0 80px #fff;
+}
+
+.vjs-redsheen-skin div.vjs-big-play-button span {
+	position:absolute;
+	top:50%;
+	left:50%;
+	display:block;
+	width:35px;
+	height:42px;
+	margin:-20px 0 0 -15px;
+	background:url(video-js.png) -100px 0;
+}
+
+.vjs-loading-spinner {
+	display:none;
+	position:absolute;
+	top:50%;
+	left:50%;
+	width:55px;
+	height:55px;
+	margin:-28px 0 0 -28px;
+	-webkit-animation-name:rotatethis;
+	-webkit-animation-duration:1s;
+	-webkit-animation-iteration-count:infinite;
+	-webkit-animation-timing-function:linear;
+	-moz-animation-name:rotatethis;
+	-moz-animation-duration:1s;
+	-moz-animation-iteration-count:infinite;
+	-moz-animation-timing-function:linear;
+}
+
+@-webkit-keyframes rotatethis {
+	0% {
+		-webkit-transform:scale(0.6) rotate(0deg);
+	}
+	
+	12.5% {
+		-webkit-transform:scale(0.6) rotate(0deg);
+	}
+	
+	12.51% {
+		-webkit-transform:scale(0.6) rotate(45deg);
+	}
+	
+	25% {
+		-webkit-transform:scale(0.6) rotate(45deg);
+	}
+	
+	25.01% {
+		-webkit-transform:scale(0.6) rotate(90deg);
+	}
+	
+	37.5% {
+		-webkit-transform:scale(0.6) rotate(90deg);
+	}
+	
+	37.51% {
+		-webkit-transform:scale(0.6) rotate(135deg);
+	}
+	
+	50% {
+		-webkit-transform:scale(0.6) rotate(135deg);
+	}
+	
+	50.01% {
+		-webkit-transform:scale(0.6) rotate(180deg);
+	}
+	
+	62.5% {
+		-webkit-transform:scale(0.6) rotate(180deg);
+	}
+	
+	62.51% {
+		-webkit-transform:scale(0.6) rotate(225deg);
+	}
+	
+	75% {
+		-webkit-transform:scale(0.6) rotate(225deg);
+	}
+	
+	75.01% {
+		-webkit-transform:scale(0.6) rotate(270deg);
+	}
+	
+	87.5% {
+		-webkit-transform:scale(0.6) rotate(270deg);
+	}
+	
+	87.51% {
+		-webkit-transform:scale(0.6) rotate(315deg);
+	}
+	
+	100% {
+		-webkit-transform:scale(0.6) rotate(315deg);
+	}
+}
+
+@-moz-keyframes rotatethis {
+	0% {
+		-moz-transform:scale(0.6) rotate(0deg);
+	}
+	
+	12.5% {
+		-moz-transform:scale(0.6) rotate(0deg);
+	}
+	
+	12.51% {
+		-moz-transform:scale(0.6) rotate(45deg);
+	}
+	
+	25% {
+		-moz-transform:scale(0.6) rotate(45deg);
+	}
+	
+	25.01% {
+		-moz-transform:scale(0.6) rotate(90deg);
+	}
+	
+	37.5% {
+		-moz-transform:scale(0.6) rotate(90deg);
+	}
+	
+	37.51% {
+		-moz-transform:scale(0.6) rotate(135deg);
+	}
+	
+	50% {
+		-moz-transform:scale(0.6) rotate(135deg);
+	}
+	
+	50.01% {
+		-moz-transform:scale(0.6) rotate(180deg);
+	}
+	
+	62.5% {
+		-moz-transform:scale(0.6) rotate(180deg);
+	}
+	
+	62.51% {
+		-moz-transform:scale(0.6) rotate(225deg);
+	}
+	
+	75% {
+		-moz-transform:scale(0.6) rotate(225deg);
+	}
+	
+	75.01% {
+		-moz-transform:scale(0.6) rotate(270deg);
+	}
+	
+	87.5% {
+		-moz-transform:scale(0.6) rotate(270deg);
+	}
+	
+	87.51% {
+		-moz-transform:scale(0.6) rotate(315deg);
+	}
+	
+	100% {
+		-moz-transform:scale(0.6) rotate(315deg);
+	}
+}
+
+div.vjs-loading-spinner .ball1 {
+	opacity:.12;
+	position:absolute;
+	left:20px;
+	top:0;
+	width:13px;
+	height:13px;
+	background:#fff;
+	border-radius:13px;
+	-webkit-border-radius:13px;
+	-moz-border-radius:13px;
+	border:1px solid #ccc;
+}
+
+div.vjs-loading-spinner .ball2 {
+	opacity:.25;
+	position:absolute;
+	left:34px;
+	top:6px;
+	width:13px;
+	height:13px;
+	background:#fff;
+	border-radius:13px;
+	-webkit-border-radius:13px;
+	-moz-border-radius:13px;
+	border:1px solid #ccc;
+}
+
+div.vjs-loading-spinner .ball3 {
+	opacity:.37;
+	position:absolute;
+	left:40px;
+	top:20px;
+	width:13px;
+	height:13px;
+	background:#fff;
+	border-radius:13px;
+	-webkit-border-radius:13px;
+	-moz-border-radius:13px;
+	border:1px solid #ccc;
+}
+
+div.vjs-loading-spinner .ball4 {
+	opacity:.5;
+	position:absolute;
+	left:34px;
+	top:34px;
+	width:13px;
+	height:13px;
+	background:#fff;
+	border-radius:10px;
+	-webkit-border-radius:10px;
+	-moz-border-radius:15px;
+	border:1px solid #ccc;
+}
+
+div.vjs-loading-spinner .ball5 {
+	opacity:.62;
+	position:absolute;
+	left:20px;
+	top:40px;
+	width:13px;
+	height:13px;
+	background:#fff;
+	border-radius:13px;
+	-webkit-border-radius:13px;
+	-moz-border-radius:13px;
+	border:1px solid #ccc;
+}
+
+div.vjs-loading-spinner .ball6 {
+	opacity:.75;
+	position:absolute;
+	left:6px;
+	top:34px;
+	width:13px;
+	height:13px;
+	background:#fff;
+	border-radius:13px;
+	-webkit-border-radius:13px;
+	-moz-border-radius:13px;
+	border:1px solid #ccc;
+}
+
+div.vjs-loading-spinner .ball7 {
+	opacity:.87;
+	position:absolute;
+	left:0;
+	top:20px;
+	width:13px;
+	height:13px;
+	background:#fff;
+	border-radius:13px;
+	-webkit-border-radius:13px;
+	-moz-border-radius:13px;
+	border:1px solid #ccc;
+}
+
+div.vjs-loading-spinner .ball8 {
+	opacity:1;
+	position:absolute;
+	left:6px;
+	top:6px;
+	width:13px;
+	height:13px;
+	background:#fff;
+	border-radius:13px;
+	-webkit-border-radius:13px;
+	-moz-border-radius:13px;
+	border:1px solid #ccc;
+}
+
+.vjs-redsheen-skin .vjs-menu-button {
+	float:right;
+	margin:.2em .5em 0 0;
+	padding:0;
+	width:3em;
+	height:2em;
+	cursor:pointer!important;
+	border:1px solid #111;
+	-moz-border-radius:.3em;
+	-webkit-border-radius:.3em;
+	border-radius:.3em;
+	background:#4d4d4d;
+	background:-moz-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);
+	background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#4d4d4d),color-stop(50%,#3f3f3f),color-stop(50%,#333),color-stop(100%,#252525));
+	background:-webkit-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);
+	background:-o-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);
+	background:-ms-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);
+	background:linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);
+}
+
+.vjs-redsheen-skin .vjs-menu-button div {
+	background:url(video-js.png) 0 -75px no-repeat;
+	width:16px;
+	height:16px;
+	margin:.2em auto 0;
+	padding:0;
+}
+
+.vjs-redsheen-skin .vjs-menu-button ul {
+	display:none;
+	opacity:.8;
+	padding:0;
+	margin:0;
+	position:absolute;
+	width:10em;
+	bottom:2em;
+	max-height:15em;
+	left:-3.5em;
+	background-color:#111;
+	border:2px solid #333;
+	-moz-border-radius:.7em;
+	-webkit-border-radius:1em;
+	border-radius:.5em;
+	-webkit-box-shadow:0 2px 4px 0 #000;
+	-moz-box-shadow:0 2px 4px 0 #000;
+	box-shadow:0 2px 4px 0 #000;
+	overflow:auto;
+}
+
+.vjs-redsheen-skin .vjs-menu-button:focus ul,.vjs-redsheen-skin .vjs-menu-button:hover ul {
+	display:block;
+	list-style:none;
+}
+
+.vjs-redsheen-skin .vjs-menu-button ul li {
+	list-style:none;
+	margin:0;
+	padding:.3em 0 .3em 20px;
+	line-height:1.4em;
+	font-size:1.2em;
+	font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;
+	text-align:left;
+}
+
+.vjs-redsheen-skin .vjs-menu-button ul li.vjs-selected {
+	text-decoration:underline;
+	background:url(video-js.png) -125px -50px no-repeat;
+}
+
+.vjs-redsheen-skin .vjs-menu-button ul li:focus,.vjs-redsheen-skin .vjs-menu-button ul li:hover,.vjs-redsheen-skin .vjs-menu-button ul li.vjs-selected:focus,.vjs-redsheen-skin .vjs-menu-button ul li.vjs-selected:hover {
+	background-color:#ccc;
+	color:#111;
+	outline:0;
+}
+
+.vjs-redsheen-skin .vjs-menu-button ul li.vjs-menu-title {
+	text-align:center;
+	text-transform:uppercase;
+	font-size:1em;
+	line-height:2em;
+	padding:0;
+	margin:0 0 .3em;
+	color:#fff;
+	font-weight:700;
+	cursor:default;
+	background:#4d4d4d;
+	background:-moz-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);
+	background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#4d4d4d),color-stop(50%,#3f3f3f),color-stop(50%,#333),color-stop(100%,#252525));
+	background:-webkit-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);
+	background:-o-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);
+	background:-ms-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);
+	background:linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);
+}
+
+.vjs-redsheen-skin .vjs-captions-button div {
+	background-position:-25px -75px;
+}
+
+.vjs-redsheen-skin .vjs-chapters-button div {
+	background-position:-100px -75px;
+}
+
+.vjs-redsheen-skin .vjs-chapters-button ul {
+	width:20em;
+	left:-8.5em;
+}
Index: /extensions/piwigo_videojs/video-js/video-js.css
===================================================================
--- /extensions/piwigo_videojs/video-js/video-js.css	(revision 24676)
+++ /extensions/piwigo_videojs/video-js/video-js.css	(revision 24676)
@@ -0,0 +1,726 @@
+/*!
+Video.js Default Styles (http://videojs.com)
+Version 4.1.0
+*/
+
+/*
+REQUIRED STYLES (be careful overriding)
+================================================================================ */
+/* When loading the player, the video tag is replaced with a DIV,
+   that will hold the video tag or object tag for other playback methods.
+   The div contains the video playback element (Flash or HTML5) and controls, and sets the width and height of the video.
+
+   ** If you want to add some kind of border/padding (e.g. a frame), or special positioning, use another containing element.
+   Otherwise you risk messing up control positioning and full window mode. **
+*/
+.video-js {
+  background-color: #000;
+  position: relative;
+  padding: 0;
+  /* Start with 10px for base font size so other dimensions can be em based and easily calculable. */
+  font-size: 10px;
+  /* Allow poster to be vertially aligned. */
+  vertical-align: middle;
+  /*  display: table-cell; */ /*This works in Safari but not Firefox.*/
+
+  /* Turn off user selection (text highlighting) by default.
+     The majority of player components will not be text blocks.
+     Text areas will need to turn user selection back on. */
+  -webkit-user-select: none;  /* Chrome all / Safari all */
+  -moz-user-select: none;     /* Firefox all */
+  -ms-user-select: none;      /* IE 10+ */
+  -o-user-select: none;
+  user-select: none;
+}
+
+/* Playback technology elements expand to the width/height of the containing div.
+    <video> or <object> */
+.video-js .vjs-tech {
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+}
+
+/* Fix for Firefox 9 fullscreen (only if it is enabled). Not needed when checking fullScreenEnabled. */
+.video-js:-moz-full-screen { position: absolute; }
+
+/* Fullscreen Styles */
+body.vjs-full-window {
+  padding: 0;
+  margin: 0;
+  height: 100%;
+  overflow-y: auto; /* Fix for IE6 full-window. http://www.cssplay.co.uk/layouts/fixed.html */
+}
+.video-js.vjs-fullscreen {
+  position: fixed;
+  overflow: hidden;
+  z-index: 1000;
+  left: 0;
+  top: 0;
+  bottom: 0;
+  right: 0;
+  width: 100% !important;
+  height: 100% !important;
+  _position: absolute; /* IE6 Full-window (underscore hack) */
+}
+.video-js:-webkit-full-screen {
+  width: 100% !important; height: 100% !important;
+}
+
+/* Poster Styles */
+.vjs-poster {
+  background-repeat: no-repeat;
+  background-position: 50% 50%;
+  background-size: contain;
+  cursor: pointer;
+  height: 100%;
+  margin: 0;
+  padding: 0;
+  position: relative;
+  width: 100%;
+}
+.vjs-poster img {
+  display: block;
+  margin: 0 auto;
+  max-height: 100%;
+  padding: 0;
+  width: 100%;
+}
+
+/* Text Track Styles */
+/* Overall track holder for both captions and subtitles */
+.video-js .vjs-text-track-display {
+  text-align: center;
+  position: absolute;
+  bottom: 4em;
+  left: 1em; /* Leave padding on left and right */
+  right: 1em;
+  font-family: Arial, sans-serif;
+}
+/* Individual tracks */
+.video-js .vjs-text-track {
+  display: none;
+  font-size: 1.4em;
+  text-align: center;
+  margin-bottom: 0.1em;
+  /* Transparent black background, or fallback to all black (oldIE) */
+  background: rgb(0, 0, 0); background: rgba(0, 0, 0, 0.50);
+}
+.video-js .vjs-subtitles { color: #fff; } /* Subtitles are white */
+.video-js .vjs-captions { color: #fc6; } /* Captions are yellow */
+.vjs-tt-cue { display: block; }
+
+/* Fading sytles, used to fade control bar. */
+.vjs-fade-in {
+  display: block !important;
+  visibility: visible; /* Needed to make sure things hide in older browsers too. */
+  opacity: 1;
+
+  -webkit-transition: visibility 0.1s, opacity 0.1s;
+     -moz-transition: visibility 0.1s, opacity 0.1s;
+      -ms-transition: visibility 0.1s, opacity 0.1s;
+       -o-transition: visibility 0.1s, opacity 0.1s;
+          transition: visibility 0.1s, opacity 0.1s;
+}
+.vjs-fade-out {
+  display: block !important;
+  visibility: hidden;
+  opacity: 0;
+
+  -webkit-transition: visibility 1.5s, opacity 1.5s;
+     -moz-transition: visibility 1.5s, opacity 1.5s;
+      -ms-transition: visibility 1.5s, opacity 1.5s;
+       -o-transition: visibility 1.5s, opacity 1.5s;
+          transition: visibility 1.5s, opacity 1.5s;
+
+  /* Wait a moment before fading out the control bar */
+  -webkit-transition-delay: 2s;
+     -moz-transition-delay: 2s;
+      -ms-transition-delay: 2s;
+       -o-transition-delay: 2s;
+          transition-delay: 2s;
+}
+/* Hide disabled or unsupported controls */
+.vjs-default-skin .vjs-hidden { display: none; }
+
+.vjs-lock-showing {
+  display: block !important;
+  opacity: 1;
+  visibility: visible;
+}
+
+/* DEFAULT SKIN (override in another file to create new skins)
+================================================================================
+Instead of editing this file, I recommend creating your own skin CSS file to be included after this file,
+so you can upgrade to newer versions easier. You can remove all these styles by removing the 'vjs-default-skin' class from the tag. */
+
+/* Base UI Component Classes
+-------------------------------------------------------------------------------- */
+@font-face{
+  font-family: 'VideoJS';
+  src: url('font/vjs.eot');
+  src: url('font/vjs.eot?#iefix') format('embedded-opentype'),
+  url('font/vjs.woff') format('woff'),
+  url('font/vjs.ttf') format('truetype');
+  font-weight: normal;
+  font-style: normal;
+}
+
+.vjs-default-skin {
+  color: #ccc;
+}
+
+/* Slider - used for Volume bar and Seek bar */
+.vjs-default-skin .vjs-slider {
+  outline: 0; /* Replace browser focus hightlight with handle highlight */
+  position: relative;
+  cursor: pointer;
+  padding: 0;
+
+  background: rgb(50, 50, 50); /* IE8- Fallback */
+  background: rgba(100, 100, 100, 0.5);
+}
+
+.vjs-default-skin .vjs-slider:focus {
+  background: rgb(70, 70, 70); /* IE8- Fallback */
+  background: rgba(100, 100, 100, 0.70);
+
+  -webkit-box-shadow: 0 0 2em rgba(255, 255, 255, 1);
+     -moz-box-shadow: 0 0 2em rgba(255, 255, 255, 1);
+          box-shadow: 0 0 2em rgba(255, 255, 255, 1);
+}
+
+.vjs-default-skin .vjs-slider-handle {
+  position: absolute;
+  /* Needed for IE6 */
+  left: 0;
+  top: 0;
+}
+
+.vjs-default-skin .vjs-slider-handle:before {
+  /*content: "\f111";*/ /* Circle icon = f111 */
+  content: "\e009"; /* Square icon */
+  font-family: VideoJS;
+  font-size: 1em;
+  line-height: 1;
+  text-align: center;
+  text-shadow: 0em 0em 1em #fff;
+
+  position: absolute;
+  top: 0;
+  left: 0;
+
+  /* Rotate the square icon to make a diamond */
+  -webkit-transform: rotate(-45deg);
+     -moz-transform: rotate(-45deg);
+      -ms-transform: rotate(-45deg);
+       -o-transform: rotate(-45deg);
+  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);
+}
+
+/* Control Bar
+-------------------------------------------------------------------------------- */
+/* The default control bar. Created by controls.js */
+.vjs-default-skin .vjs-control-bar {
+  display: none; /* Start hidden */
+  position: absolute;
+  /* Distance from the bottom of the box/video. Keep 0. Use height to add more bottom margin. */
+  bottom: 0;
+  /* 100% width of player div */
+  left: 0;
+  right: 0;
+  /* Controls are absolutely position, so no padding necessary */
+  padding: 0;
+  margin: 0;
+  /* Height includes any margin you want above or below control items */
+  height: 3.0em;
+  background-color: rgb(0, 0, 0);
+  /* Slight blue so it can be seen more easily on black. */
+  background-color: rgba(7, 40, 50, 0.7);
+  /* Default font settings */
+  font-style: normal;
+  font-weight: normal;
+  font-family: Arial, sans-serif;
+}
+
+/* General styles for individual controls. */
+.vjs-default-skin .vjs-control {
+  outline: none;
+  position: relative;
+  float: left;
+  text-align: center;
+  margin: 0;
+  padding: 0;
+  height: 3.0em;
+  width: 4em;
+}
+
+/* FontAwsome button icons */
+.vjs-default-skin .vjs-control:before {
+  font-family: VideoJS;
+  font-size: 1.5em;
+  line-height: 2;
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  text-align: center;
+  text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
+}
+
+/* Replacement for focus outline */
+.vjs-default-skin .vjs-control:focus:before,
+.vjs-default-skin .vjs-control:hover:before {
+  text-shadow: 0em 0em 1em rgba(255, 255, 255, 1);
+}
+
+.vjs-default-skin .vjs-control:focus { /*  outline: 0; */ /* keyboard-only users cannot see the focus on several of the UI elements when this is set to 0 */ }
+
+/* Hide control text visually, but have it available for screenreaders: h5bp.com/v */
+.vjs-default-skin .vjs-control-text { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
+
+/* Play/Pause
+-------------------------------------------------------------------------------- */
+.vjs-default-skin .vjs-play-control {
+  width: 5em;
+  cursor: pointer;
+}
+.vjs-default-skin .vjs-play-control:before {
+  content: "\e001"; /* Play Icon */
+}
+.vjs-default-skin.vjs-playing .vjs-play-control:before {
+  content: "\e002"; /* Pause Icon */
+}
+
+/* Rewind
+-------------------------------------------------------------------------------- */
+/*.vjs-default-skin .vjs-rewind-control { width: 5em; cursor: pointer !important; }
+.vjs-default-skin .vjs-rewind-control div { width: 19px; height: 16px; background: url('video-js.png'); margin: 0.5em auto 0; }
+*/
+
+/* Volume/Mute
+-------------------------------------------------------------------------------- */
+.vjs-default-skin .vjs-mute-control,
+.vjs-default-skin .vjs-volume-menu-button {
+  cursor: pointer;
+  float: right;
+}
+.vjs-default-skin .vjs-mute-control:before,
+.vjs-default-skin .vjs-volume-menu-button:before {
+  content: "\e006"; /* Full volume */
+}
+.vjs-default-skin .vjs-mute-control.vjs-vol-0:before,
+.vjs-default-skin .vjs-volume-menu-button.vjs-vol-0:before {
+  content: "\e003"; /* No volume */
+}
+.vjs-default-skin .vjs-mute-control.vjs-vol-1:before,
+.vjs-default-skin .vjs-volume-menu-button.vjs-vol-1:before {
+  content: "\e004"; /* Half volume */
+}
+.vjs-default-skin .vjs-mute-control.vjs-vol-2:before,
+.vjs-default-skin .vjs-volume-menu-button.vjs-vol-2:before {
+  content: "\e005"; /* Full volume */
+}
+
+.vjs-default-skin .vjs-volume-control {
+  width: 5em;
+  float: right;
+}
+.vjs-default-skin .vjs-volume-bar {
+  width: 5em;
+  height: 0.6em;
+  margin: 1.1em auto 0;
+}
+
+.vjs-default-skin .vjs-volume-menu-button .vjs-menu-content {
+  height: 2.9em;
+}
+
+.vjs-default-skin .vjs-volume-level {
+  position: absolute;
+  top: 0;
+  left: 0;
+  height: 0.5em;
+
+  background: #66A8CC
+    url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAP0lEQVQIHWWMAQoAIAgDR/QJ/Ub//04+w7ZICBwcOg5FZi5iBB82AGzixEglJrd4TVK5XUJpskSTEvpdFzX9AB2pGziSQcvAAAAAAElFTkSuQmCC)
+    -50% 0 repeat;
+}
+.vjs-default-skin .vjs-volume-bar .vjs-volume-handle {
+  width: 0.5em;
+  height: 0.5em;
+}
+
+.vjs-default-skin .vjs-volume-handle:before {
+  font-size: 0.9em;
+  top: -0.2em;
+  left: -0.2em;
+
+  width: 1em;
+  height: 1em;
+}
+
+.vjs-default-skin .vjs-volume-menu-button .vjs-menu .vjs-menu-content {
+  width: 6em;
+  left: -4em;
+}
+
+/*.vjs-default-skin .vjs-menu-button .vjs-volume-control {
+  height: 1.5em;
+}*/
+
+/* Progress
+-------------------------------------------------------------------------------- */
+.vjs-default-skin .vjs-progress-control {
+  position: absolute;
+  left: 0;
+  right: 0;
+  width: auto;
+  font-size: 0.3em;
+  height: 1em;
+  /* Set above the rest of the controls. */
+  top: -1em;
+
+  /* Shrink the bar slower than it grows. */
+  -webkit-transition: top 0.4s, height 0.4s, font-size 0.4s, -webkit-transform 0.4s;
+     -moz-transition: top 0.4s, height 0.4s, font-size 0.4s,    -moz-transform 0.4s;
+       -o-transition: top 0.4s, height 0.4s, font-size 0.4s,      -o-transform 0.4s;
+          transition: top 0.4s, height 0.4s, font-size 0.4s,         transform 0.4s;
+
+}
+
+/* On hover, make the progress bar grow to something that's more clickable.
+    This simply changes the overall font for the progress bar, and this
+    updates both the em-based widths and heights, as wells as the icon font */
+.vjs-default-skin:hover .vjs-progress-control {
+  font-size: .9em;
+
+  /* Even though we're not changing the top/height, we need to include them in
+      the transition so they're handled correctly. */
+  -webkit-transition: top 0.2s, height 0.2s, font-size 0.2s, -webkit-transform 0.2s;
+     -moz-transition: top 0.2s, height 0.2s, font-size 0.2s,    -moz-transform 0.2s;
+       -o-transition: top 0.2s, height 0.2s, font-size 0.2s,      -o-transform 0.2s;
+          transition: top 0.2s, height 0.2s, font-size 0.2s,         transform 0.2s;
+}
+
+/* Box containing play and load progresses. Also acts as seek scrubber. */
+.vjs-default-skin .vjs-progress-holder {
+  /* Placement within the progress control item */
+  height: 100%;
+}
+
+/* Progress Bars */
+.vjs-default-skin .vjs-progress-holder .vjs-play-progress,
+.vjs-default-skin .vjs-progress-holder .vjs-load-progress {
+  position: absolute;
+  display: block;
+  height: 100%;
+  margin: 0;
+  padding: 0;
+  /* Needed for IE6 */
+  left: 0;
+  top: 0;
+}
+
+.vjs-default-skin .vjs-play-progress {
+  /*
+    Using a data URI to create the white diagonal lines with a transparent
+      background. Surprising works in IE8.
+      Created using http://www.patternify.com
+    Changing the first color value will change the bar color.
+    Also using a paralax effect to make the lines move backwards.
+      The -50% left position makes that happen.
+  */
+  background: #66A8CC
+    url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAP0lEQVQIHWWMAQoAIAgDR/QJ/Ub//04+w7ZICBwcOg5FZi5iBB82AGzixEglJrd4TVK5XUJpskSTEvpdFzX9AB2pGziSQcvAAAAAAElFTkSuQmCC)
+    -50% 0 repeat;
+}
+.vjs-default-skin .vjs-load-progress {
+  background: rgb(100, 100, 100); /* IE8- Fallback */
+  background: rgba(255, 255, 255, 0.4);
+}
+
+.vjs-default-skin .vjs-seek-handle {
+  width: 1.5em;
+  height: 100%;
+}
+
+.vjs-default-skin .vjs-seek-handle:before {
+  padding-top: 0.1em; /* Minor adjustment */
+}
+
+/* Time Display
+-------------------------------------------------------------------------------- */
+.vjs-default-skin .vjs-time-controls {
+  font-size: 1em;
+  /* Align vertically by making the line height the same as the control bar */
+  line-height: 3em;
+}
+.vjs-default-skin .vjs-current-time { float: left; }
+.vjs-default-skin .vjs-duration { float: left; }
+/* Remaining time is in the HTML, but not included in default design */
+.vjs-default-skin .vjs-remaining-time { display: none; float: left; }
+.vjs-time-divider { float: left; line-height: 3em; }
+
+/* Fullscreen
+-------------------------------------------------------------------------------- */
+.vjs-default-skin .vjs-fullscreen-control {
+  width: 3.8em;
+  cursor: pointer;
+  float: right;
+}
+.vjs-default-skin .vjs-fullscreen-control:before {
+  content: "\e000"; /* Enter full screen */
+}
+.vjs-default-skin.vjs-fullscreen .vjs-fullscreen-control:before {
+  content: "\e00b"; /* Exit full screen */
+}
+
+/* Big Play Button (at start)
+---------------------------------------------------------*/
+.vjs-default-skin .vjs-big-play-button {
+  display: block;
+  z-index: 2;
+  position: absolute;
+  top: 2em;
+  left: 2em;
+  width: 12.0em;
+  height: 8.0em;
+  margin: 0;
+  text-align: center;
+  vertical-align: middle;
+  cursor: pointer;
+  opacity: 1;
+
+  /* Need a slightly gray bg so it can be seen on black backgrounds */
+  background-color: rgb(40, 40, 40);
+  background-color: rgba(7, 40, 50, 0.7);
+
+  border: 0.3em solid rgb(50, 50, 50);
+  border-color: rgba(255, 255, 255, 0.25);
+
+  -webkit-border-radius: 25px;
+     -moz-border-radius: 25px;
+          border-radius: 25px;
+
+  -webkit-box-shadow: 0px 0px 1em rgba(255, 255, 255, 0.25);
+     -moz-box-shadow: 0px 0px 1em rgba(255, 255, 255, 0.25);
+          box-shadow: 0px 0px 1em rgba(255, 255, 255, 0.25);
+
+  -webkit-transition: border 0.4s, -webkit-box-shadow 0.4s, -webkit-transform 0.4s;
+     -moz-transition: border 0.4s,    -moz-box-shadow 0.4s,    -moz-transform 0.4s;
+       -o-transition: border 0.4s,      -o-box-shadow 0.4s,      -o-transform 0.4s;
+          transition: border 0.4s,         box-shadow 0.4s,         transform 0.4s;
+}
+
+.vjs-default-skin:hover .vjs-big-play-button,
+.vjs-default-skin .vjs-big-play-button:focus {
+  outline: 0;
+  border-color: rgb(255, 255, 255);
+  border-color: rgba(255, 255, 255, 1);
+  /* IE8 needs a non-glow hover state */
+  background-color: rgb(80, 80, 80);
+  background-color: rgba(50, 50, 50, 0.75);
+
+  -webkit-box-shadow: 0 0 3em #fff;
+     -moz-box-shadow: 0 0 3em #fff;
+          box-shadow: 0 0 3em #fff;
+
+  -webkit-transition: border 0s, -webkit-box-shadow 0s, -webkit-transform 0s;
+     -moz-transition: border 0s,    -moz-box-shadow 0s,    -moz-transform 0s;
+       -o-transition: border 0s,      -o-box-shadow 0s,      -o-transform 0s;
+          transition: border 0s,         box-shadow 0s,         transform 0s;
+}
+
+.vjs-default-skin .vjs-big-play-button:before {
+  content: "\e001"; /* Play icon */
+  font-family: VideoJS;
+  font-size: 3em;
+  line-height: 2.66;
+  text-shadow: 0.05em 0.05em 0.1em #000;
+  text-align: center; /* Needed for IE8 */
+
+  position: absolute;
+  left: 0;
+  width: 100%;
+  height: 100%;
+}
+
+/* Loading Spinner
+---------------------------------------------------------*/
+.vjs-loading-spinner {
+  display: none;
+  position: absolute;
+  top: 50%;
+  left: 50%;
+
+  font-size: 5em;
+  line-height: 1;
+
+  width: 1em;
+  height: 1em;
+
+  margin-left: -0.5em;
+  margin-top: -0.5em;
+
+  opacity: 0.75;
+
+  -webkit-animation: spin 1.5s infinite linear;
+     -moz-animation: spin 1.5s infinite linear;
+       -o-animation: spin 1.5s infinite linear;
+          animation: spin 1.5s infinite linear;
+}
+
+.vjs-default-skin .vjs-loading-spinner:before {
+  content: "\e00a"; /* Loading spinner icon */
+  font-family: VideoJS;
+
+  position: absolute;
+  width: 1em;
+  height: 1em;
+  text-align: center;
+  text-shadow: 0em 0em 0.1em #000;
+}
+
+/* Add a gradient to the spinner by overlaying another copy.
+   Text gradient plus a text shadow doesn't work
+   and `background-clip: text` only works in Webkit. */
+.vjs-default-skin .vjs-loading-spinner:after {
+  content: "\e00a"; /* Loading spinner icon */
+  font-family: VideoJS;
+
+  position: absolute;
+  width: 1em;
+  height: 1em;
+  text-align: center;
+
+  -webkit-background-clip: text;
+  -webkit-text-fill-color: transparent;
+}
+
+@-moz-keyframes spin {
+  0% { -moz-transform: rotate(0deg); }
+  100% { -moz-transform: rotate(359deg); }
+}
+@-webkit-keyframes spin {
+  0% { -webkit-transform: rotate(0deg); }
+  100% { -webkit-transform: rotate(359deg); }
+}
+@-o-keyframes spin {
+  0% { -o-transform: rotate(0deg); }
+  100% { -o-transform: rotate(359deg); }
+}
+@-ms-keyframes spin {
+  0% { -ms-transform: rotate(0deg); }
+  100% { -ms-transform: rotate(359deg); }
+}
+@keyframes spin {
+  0% { transform: rotate(0deg); }
+  100% { transform: rotate(359deg); }
+}
+
+/* Menu Buttons (Captions/Subtitles/etc.)
+-------------------------------------------------------------------------------- */
+.vjs-default-skin .vjs-menu-button {
+  float: right;
+  cursor: pointer;
+}
+
+.vjs-default-skin .vjs-menu {
+  display: none;
+  position: absolute;
+  bottom: 0;
+  left: 0em; /* (Width of vjs-menu - width of button) / 2 */
+  width: 0em;
+  height: 0em;
+  margin-bottom: 3em;
+
+  border-left: 2em solid transparent;
+  border-right: 2em solid transparent;
+
+  border-top: 1.55em solid rgb(0, 0, 0); /* Same top as ul bottom */
+  border-top-color: rgba(7, 40, 50, 0.5); /* Same as ul background */
+}
+
+/* Button Pop-up Menu */
+.vjs-default-skin .vjs-menu-button .vjs-menu .vjs-menu-content {
+  display: block;
+  padding: 0; margin: 0;
+  position: absolute;
+  width: 10em;
+  bottom: 1.5em; /* Same bottom as vjs-menu border-top */
+  max-height: 15em;
+  overflow: auto;
+
+  left: -5em; /* Width of menu - width of button / 2 */
+
+  background-color: rgb(0, 0, 0);
+  background-color: rgba(7, 40, 50, 0.7);
+
+  -webkit-box-shadow: -20px -20px 0px rgba(255, 255, 255, 0.5);
+     -moz-box-shadow: 0 0 1em rgba(255, 255, 255, 0.5);
+          box-shadow: -0.2em -0.2em 0.3em rgba(255, 255, 255, 0.2);
+}
+
+/*.vjs-default-skin .vjs-menu-button:focus ul,*/ /* This is not needed because keyboard accessibility for the caption button is not handled with the focus any more. */
+.vjs-default-skin .vjs-menu-button:hover .vjs-menu {
+  display: block;
+}
+.vjs-default-skin .vjs-menu-button ul li {
+  list-style: none;
+  margin: 0;
+  padding: 0.3em 0 0.3em 0;
+  line-height: 1.4em;
+  font-size: 1.2em;
+  font-weight: normal;
+  text-align: center;
+  text-transform: lowercase;
+}
+.vjs-default-skin .vjs-menu-button ul li.vjs-selected {
+  background-color: #000;
+}
+.vjs-default-skin .vjs-menu-button ul li:focus,
+.vjs-default-skin .vjs-menu-button ul li:hover,
+.vjs-default-skin .vjs-menu-button ul li.vjs-selected:focus,
+.vjs-default-skin .vjs-menu-button ul li.vjs-selected:hover {
+  background-color: rgb(255, 255, 255);
+  background-color: rgba(255, 255, 255, 0.75);
+  color: #111;
+  outline: 0;
+
+  -webkit-box-shadow: 0 0 1em rgba(255, 255, 255, 1);
+     -moz-box-shadow: 0 0 1em rgba(255, 255, 255, 1);
+          box-shadow: 0 0 1em rgba(255, 255, 255, 1);
+}
+.vjs-default-skin .vjs-menu-button ul li.vjs-menu-title {
+  text-align: center;
+  text-transform: uppercase;
+  font-size: 1em;
+  line-height: 2em;
+  padding: 0;
+  margin: 0 0 0.3em 0;
+  font-weight: bold;
+  cursor: default;
+}
+
+/* Subtitles Button */
+.vjs-default-skin .vjs-subtitles-button:before { content: "\e00c"; }
+
+/* There's unfortunately no CC button in FontAwesome, so we need
+    to use another font. Please +1 the fontawesome request.
+    https://github.com/FortAwesome/Font-Awesome/issues/968 */
+.vjs-default-skin .vjs-captions-button:before {
+  content: "\e008";
+}
+
+
+/* Replacement for focus outline */
+.vjs-default-skin .vjs-captions-button:focus .vjs-control-content:before,
+.vjs-default-skin .vjs-captions-button:hover .vjs-control-content:before {
+  -webkit-box-shadow: 0 0 1em rgba(255, 255, 255, 1);
+     -moz-box-shadow: 0 0 1em rgba(255, 255, 255, 1);
+          box-shadow: 0 0 1em rgba(255, 255, 255, 1);
+}
Index: /extensions/piwigo_videojs/video-js/video-js.min.css
===================================================================
--- /extensions/piwigo_videojs/video-js/video-js.min.css	(revision 24676)
+++ /extensions/piwigo_videojs/video-js/video-js.min.css	(revision 24676)
@@ -0,0 +1,4 @@
+/*!
+Video.js Default Styles (http://videojs.com)
+Version 4.1.0
+*/.video-js{background-color:#000;position:relative;padding:0;font-size:10px;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.video-js .vjs-tech{position:absolute;top:0;left:0;width:100%;height:100%}.video-js:-moz-full-screen{position:absolute}body.vjs-full-window{padding:0;margin:0;height:100%;overflow-y:auto}.video-js.vjs-fullscreen{position:fixed;overflow:hidden;z-index:1000;left:0;top:0;bottom:0;right:0;width:100%!important;height:100%!important;_position:absolute}.video-js:-webkit-full-screen{width:100%!important;height:100%!important}.vjs-poster{background-repeat:no-repeat;background-position:50% 50%;background-size:contain;cursor:pointer;height:100%;margin:0;padding:0;position:relative;width:100%}.vjs-poster img{display:block;margin:0 auto;max-height:100%;padding:0;width:100%}.video-js .vjs-text-track-display{text-align:center;position:absolute;bottom:4em;left:1em;right:1em;font-family:Arial,sans-serif}.video-js .vjs-text-track{display:none;font-size:1.4em;text-align:center;margin-bottom:.1em;background:#000;background:rgba(0,0,0,.5)}.video-js .vjs-subtitles{color:#fff}.video-js .vjs-captions{color:#fc6}.vjs-tt-cue{display:block}.vjs-fade-in{display:block!important;visibility:visible;opacity:1;-webkit-transition:visibility .1s,opacity .1s;-moz-transition:visibility .1s,opacity .1s;-ms-transition:visibility .1s,opacity .1s;-o-transition:visibility .1s,opacity .1s;transition:visibility .1s,opacity .1s}.vjs-fade-out{display:block!important;visibility:hidden;opacity:0;-webkit-transition:visibility 1.5s,opacity 1.5s;-moz-transition:visibility 1.5s,opacity 1.5s;-ms-transition:visibility 1.5s,opacity 1.5s;-o-transition:visibility 1.5s,opacity 1.5s;transition:visibility 1.5s,opacity 1.5s;-webkit-transition-delay:2s;-moz-transition-delay:2s;-ms-transition-delay:2s;-o-transition-delay:2s;transition-delay:2s}.vjs-default-skin .vjs-hidden{display:none}.vjs-lock-showing{display:block!important;opacity:1;visibility:visible}@font-face{font-family:VideoJS;src:url(font/vjs.eot);src:url(font/vjs.eot?#iefix) format('embedded-opentype'),url(font/vjs.woff) format('woff'),url(font/vjs.ttf) format('truetype');font-weight:400;font-style:normal}.vjs-default-skin{color:#ccc}.vjs-default-skin .vjs-slider{outline:0;position:relative;cursor:pointer;padding:0;background:#323232;background:rgba(100,100,100,.5)}.vjs-default-skin .vjs-slider:focus{background:#464646;background:rgba(100,100,100,.7);-webkit-box-shadow:0 0 2em rgba(255,255,255,1);-moz-box-shadow:0 0 2em rgba(255,255,255,1);box-shadow:0 0 2em rgba(255,255,255,1)}.vjs-default-skin .vjs-slider-handle{position:absolute;left:0;top:0}.vjs-default-skin .vjs-slider-handle:before{content:"\e009";font-family:VideoJS;font-size:1em;line-height:1;text-align:center;text-shadow:0 0 1em #fff;position:absolute;top:0;left:0;-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-ms-transform:rotate(-45deg);-o-transform:rotate(-45deg);filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2)}.vjs-default-skin .vjs-control-bar{display:none;position:absolute;bottom:0;left:0;right:0;padding:0;margin:0;height:3em;background-color:#000;background-color:rgba(7,40,50,.7);font-style:normal;font-weight:400;font-family:Arial,sans-serif}.vjs-default-skin .vjs-control{outline:0;position:relative;float:left;text-align:center;margin:0;padding:0;height:3em;width:4em}.vjs-default-skin .vjs-control:before{font-family:VideoJS;font-size:1.5em;line-height:2;position:absolute;top:0;left:0;width:100%;height:100%;text-align:center;text-shadow:1px 1px 1px rgba(0,0,0,.5)}.vjs-default-skin .vjs-control:focus:before,.vjs-default-skin .vjs-control:hover:before{text-shadow:0 0 1em rgba(255,255,255,1)}.vjs-default-skin .vjs-control:focus{}.vjs-default-skin .vjs-control-text{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.vjs-default-skin .vjs-play-control{width:5em;cursor:pointer}.vjs-default-skin .vjs-play-control:before{content:"\e001"}.vjs-default-skin.vjs-playing .vjs-play-control:before{content:"\e002"}.vjs-default-skin .vjs-mute-control,.vjs-default-skin .vjs-volume-menu-button{cursor:pointer;float:right}.vjs-default-skin .vjs-mute-control:before,.vjs-default-skin .vjs-volume-menu-button:before{content:"\e006"}.vjs-default-skin .vjs-mute-control.vjs-vol-0:before,.vjs-default-skin .vjs-volume-menu-button.vjs-vol-0:before{content:"\e003"}.vjs-default-skin .vjs-mute-control.vjs-vol-1:before,.vjs-default-skin .vjs-volume-menu-button.vjs-vol-1:before{content:"\e004"}.vjs-default-skin .vjs-mute-control.vjs-vol-2:before,.vjs-default-skin .vjs-volume-menu-button.vjs-vol-2:before{content:"\e005"}.vjs-default-skin .vjs-volume-control{width:5em;float:right}.vjs-default-skin .vjs-volume-bar{width:5em;height:.6em;margin:1.1em auto 0}.vjs-default-skin .vjs-volume-menu-button .vjs-menu-content{height:2.9em}.vjs-default-skin .vjs-volume-level{position:absolute;top:0;left:0;height:.5em;background:#66A8CC url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAP0lEQVQIHWWMAQoAIAgDR/QJ/Ub//04+w7ZICBwcOg5FZi5iBB82AGzixEglJrd4TVK5XUJpskSTEvpdFzX9AB2pGziSQcvAAAAAAElFTkSuQmCC) -50% 0 repeat}.vjs-default-skin .vjs-volume-bar .vjs-volume-handle{width:.5em;height:.5em}.vjs-default-skin .vjs-volume-handle:before{font-size:.9em;top:-.2em;left:-.2em;width:1em;height:1em}.vjs-default-skin .vjs-volume-menu-button .vjs-menu .vjs-menu-content{width:6em;left:-4em}.vjs-default-skin .vjs-progress-control{position:absolute;left:0;right:0;width:auto;font-size:.3em;height:1em;top:-1em;-webkit-transition:top .4s,height .4s,font-size .4s,-webkit-transform .4s;-moz-transition:top .4s,height .4s,font-size .4s,-moz-transform .4s;-o-transition:top .4s,height .4s,font-size .4s,-o-transform .4s;transition:top .4s,height .4s,font-size .4s,transform .4s}.vjs-default-skin:hover .vjs-progress-control{font-size:.9em;-webkit-transition:top .2s,height .2s,font-size .2s,-webkit-transform .2s;-moz-transition:top .2s,height .2s,font-size .2s,-moz-transform .2s;-o-transition:top .2s,height .2s,font-size .2s,-o-transform .2s;transition:top .2s,height .2s,font-size .2s,transform .2s}.vjs-default-skin .vjs-progress-holder{height:100%}.vjs-default-skin .vjs-progress-holder .vjs-play-progress,.vjs-default-skin .vjs-progress-holder .vjs-load-progress{position:absolute;display:block;height:100%;margin:0;padding:0;left:0;top:0}.vjs-default-skin .vjs-play-progress{background:#66A8CC url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAP0lEQVQIHWWMAQoAIAgDR/QJ/Ub//04+w7ZICBwcOg5FZi5iBB82AGzixEglJrd4TVK5XUJpskSTEvpdFzX9AB2pGziSQcvAAAAAAElFTkSuQmCC) -50% 0 repeat}.vjs-default-skin .vjs-load-progress{background:#646464;background:rgba(255,255,255,.4)}.vjs-default-skin .vjs-seek-handle{width:1.5em;height:100%}.vjs-default-skin .vjs-seek-handle:before{padding-top:.1em}.vjs-default-skin .vjs-time-controls{font-size:1em;line-height:3em}.vjs-default-skin .vjs-current-time{float:left}.vjs-default-skin .vjs-duration{float:left}.vjs-default-skin .vjs-remaining-time{display:none;float:left}.vjs-time-divider{float:left;line-height:3em}.vjs-default-skin .vjs-fullscreen-control{width:3.8em;cursor:pointer;float:right}.vjs-default-skin .vjs-fullscreen-control:before{content:"\e000"}.vjs-default-skin.vjs-fullscreen .vjs-fullscreen-control:before{content:"\e00b"}.vjs-default-skin .vjs-big-play-button{display:block;z-index:2;position:absolute;top:2em;left:2em;width:12em;height:8em;margin:0;text-align:center;vertical-align:middle;cursor:pointer;opacity:1;background-color:#282828;background-color:rgba(7,40,50,.7);border:.3em solid #323232;border-color:rgba(255,255,255,.25);-webkit-border-radius:25px;-moz-border-radius:25px;border-radius:25px;-webkit-box-shadow:0 0 1em rgba(255,255,255,.25);-moz-box-shadow:0 0 1em rgba(255,255,255,.25);box-shadow:0 0 1em rgba(255,255,255,.25);-webkit-transition:border .4s,-webkit-box-shadow .4s,-webkit-transform .4s;-moz-transition:border .4s,-moz-box-shadow .4s,-moz-transform .4s;-o-transition:border .4s,-o-box-shadow .4s,-o-transform .4s;transition:border .4s,box-shadow .4s,transform .4s}.vjs-default-skin:hover .vjs-big-play-button,.vjs-default-skin .vjs-big-play-button:focus{outline:0;border-color:#fff;border-color:rgba(255,255,255,1);background-color:#505050;background-color:rgba(50,50,50,.75);-webkit-box-shadow:0 0 3em #fff;-moz-box-shadow:0 0 3em #fff;box-shadow:0 0 3em #fff;-webkit-transition:border 0s,-webkit-box-shadow 0s,-webkit-transform 0s;-moz-transition:border 0s,-moz-box-shadow 0s,-moz-transform 0s;-o-transition:border 0s,-o-box-shadow 0s,-o-transform 0s;transition:border 0s,box-shadow 0s,transform 0s}.vjs-default-skin .vjs-big-play-button:before{content:"\e001";font-family:VideoJS;font-size:3em;line-height:2.66;text-shadow:.05em .05em .1em #000;text-align:center;position:absolute;left:0;width:100%;height:100%}.vjs-loading-spinner{display:none;position:absolute;top:50%;left:50%;font-size:5em;line-height:1;width:1em;height:1em;margin-left:-.5em;margin-top:-.5em;opacity:.75;-webkit-animation:spin 1.5s infinite linear;-moz-animation:spin 1.5s infinite linear;-o-animation:spin 1.5s infinite linear;animation:spin 1.5s infinite linear}.vjs-default-skin .vjs-loading-spinner:before{content:"\e00a";font-family:VideoJS;position:absolute;width:1em;height:1em;text-align:center;text-shadow:0 0 .1em #000}.vjs-default-skin .vjs-loading-spinner:after{content:"\e00a";font-family:VideoJS;position:absolute;width:1em;height:1em;text-align:center;-webkit-background-clip:text;-webkit-text-fill-color:transparent}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg)}100%{-moz-transform:rotate(359deg)}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg)}100%{-o-transform:rotate(359deg)}}@-ms-keyframes spin{0%{-ms-transform:rotate(0deg)}100%{-ms-transform:rotate(359deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(359deg)}}.vjs-default-skin .vjs-menu-button{float:right;cursor:pointer}.vjs-default-skin .vjs-menu{display:none;position:absolute;bottom:0;left:0;width:0;height:0;margin-bottom:3em;border-left:2em solid transparent;border-right:2em solid transparent;border-top:1.55em solid #000;border-top-color:rgba(7,40,50,.5)}.vjs-default-skin .vjs-menu-button .vjs-menu .vjs-menu-content{display:block;padding:0;margin:0;position:absolute;width:10em;bottom:1.5em;max-height:15em;overflow:auto;left:-5em;background-color:#000;background-color:rgba(7,40,50,.7);-webkit-box-shadow:-20px -20px 0 rgba(255,255,255,.5);-moz-box-shadow:0 0 1em rgba(255,255,255,.5);box-shadow:-.2em -.2em .3em rgba(255,255,255,.2)}.vjs-default-skin .vjs-menu-button:hover .vjs-menu{display:block}.vjs-default-skin .vjs-menu-button ul li{list-style:none;margin:0;padding:.3em 0;line-height:1.4em;font-size:1.2em;font-weight:400;text-align:center;text-transform:lowercase}.vjs-default-skin .vjs-menu-button ul li.vjs-selected{background-color:#000}.vjs-default-skin .vjs-menu-button ul li:focus,.vjs-default-skin .vjs-menu-button ul li:hover,.vjs-default-skin .vjs-menu-button ul li.vjs-selected:focus,.vjs-default-skin .vjs-menu-button ul li.vjs-selected:hover{background-color:#fff;background-color:rgba(255,255,255,.75);color:#111;outline:0;-webkit-box-shadow:0 0 1em rgba(255,255,255,1);-moz-box-shadow:0 0 1em rgba(255,255,255,1);box-shadow:0 0 1em rgba(255,255,255,1)}.vjs-default-skin .vjs-menu-button ul li.vjs-menu-title{text-align:center;text-transform:uppercase;font-size:1em;line-height:2em;padding:0;margin:0 0 .3em;font-weight:700;cursor:default}.vjs-default-skin .vjs-subtitles-button:before{content:"\e00c"}.vjs-default-skin .vjs-captions-button:before{content:"\e008"}.vjs-default-skin .vjs-captions-button:focus .vjs-control-content:before,.vjs-default-skin .vjs-captions-button:hover .vjs-control-content:before{-webkit-box-shadow:0 0 1em rgba(255,255,255,1);-moz-box-shadow:0 0 1em rgba(255,255,255,1);box-shadow:0 0 1em rgba(255,255,255,1)}
Index: /extensions/piwigo_videojs/video-js/video.dev.js
===================================================================
--- /extensions/piwigo_videojs/video-js/video.dev.js	(revision 24676)
+++ /extensions/piwigo_videojs/video-js/video.dev.js	(revision 24676)
@@ -0,0 +1,6067 @@
+/**
+ * @fileoverview Main function src.
+ */
+
+// HTML5 Shiv. Must be in <head> to support older browsers.
+document.createElement('video');
+document.createElement('audio');
+document.createElement('track');
+
+/**
+ * Doubles as the main function for users to create a player instance and also
+ * the main library object.
+ *
+ * @param  {String|Element} id      Video element or video element ID
+ * @param  {Object=} options        Optional options object for config/settings
+ * @param  {Function=} ready        Optional ready callback
+ * @return {vjs.Player}             A player instance
+ */
+var vjs = function(id, options, ready){
+  var tag; // Element of ID
+
+  // Allow for element or ID to be passed in
+  // String ID
+  if (typeof id === 'string') {
+
+    // Adjust for jQuery ID syntax
+    if (id.indexOf('#') === 0) {
+      id = id.slice(1);
+    }
+
+    // If a player instance has already been created for this ID return it.
+    if (vjs.players[id]) {
+      return vjs.players[id];
+
+    // Otherwise get element for ID
+    } else {
+      tag = vjs.el(id);
+    }
+
+  // ID is a media element
+  } else {
+    tag = id;
+  }
+
+  // Check for a useable element
+  if (!tag || !tag.nodeName) { // re: nodeName, could be a box div also
+    throw new TypeError('The element or ID supplied is not valid. (videojs)'); // Returns
+  }
+
+  // Element may have a player attr referring to an already created player instance.
+  // If not, set up a new player and return the instance.
+  return tag['player'] || new vjs.Player(tag, options, ready);
+};
+
+// Extended name, also available externally, window.videojs
+var videojs = vjs;
+window.videojs = window.vjs = vjs;
+
+// CDN Version. Used to target right flash swf.
+vjs.CDN_VERSION = '4.1';
+vjs.ACCESS_PROTOCOL = ('https:' == document.location.protocol ? 'https://' : 'http://');
+
+/**
+ * Global Player instance options, surfaced from vjs.Player.prototype.options_
+ * vjs.options = vjs.Player.prototype.options_
+ * All options should use string keys so they avoid
+ * renaming by closure compiler
+ * @type {Object}
+ */
+vjs.options = {
+  // Default order of fallback technology
+  'techOrder': ['html5','flash'],
+  // techOrder: ['flash','html5'],
+
+  'html5': {},
+  'flash': {},
+
+  // Default of web browser is 300x150. Should rely on source width/height.
+  'width': 300,
+  'height': 150,
+  // defaultVolume: 0.85,
+  'defaultVolume': 0.00, // The freakin seaguls are driving me crazy!
+
+  // Included control sets
+  'children': {
+    'mediaLoader': {},
+    'posterImage': {},
+    'textTrackDisplay': {},
+    'loadingSpinner': {},
+    'bigPlayButton': {},
+    'controlBar': {}
+  }
+};
+
+// Set CDN Version of swf
+// The added (+) blocks the replace from changing this 4.1 string
+if (vjs.CDN_VERSION !== 'GENERATED'+'_CDN_VSN') {
+  videojs.options['flash']['swf'] = vjs.ACCESS_PROTOCOL + 'vjs.zencdn.net/'+vjs.CDN_VERSION+'/video-js.swf';
+}
+
+/**
+ * Global player list
+ * @type {Object}
+ */
+vjs.players = {};
+/**
+ * Core Object/Class for objects that use inheritance + contstructors
+ * @constructor
+ */
+vjs.CoreObject = vjs['CoreObject'] = function(){};
+// Manually exporting vjs['CoreObject'] here for Closure Compiler
+// because of the use of the extend/create class methods
+// If we didn't do this, those functions would get flattend to something like
+// `a = ...` and `this.prototype` would refer to the global object instead of
+// CoreObject
+
+/**
+ * Create a new object that inherits from this Object
+ * @param {Object} props Functions and properties to be applied to the
+ *                       new object's prototype
+ * @return {vjs.CoreObject} Returns an object that inherits from CoreObject
+ * @this {*}
+ */
+vjs.CoreObject.extend = function(props){
+  var init, subObj;
+
+  props = props || {};
+  // Set up the constructor using the supplied init method
+  // or using the init of the parent object
+  // Make sure to check the unobfuscated version for external libs
+  init = props['init'] || props.init || this.prototype['init'] || this.prototype.init || function(){};
+  // In Resig's simple class inheritance (previously used) the constructor
+  //  is a function that calls `this.init.apply(arguments)`
+  // However that would prevent us from using `ParentObject.call(this);`
+  //  in a Child constuctor because the `this` in `this.init`
+  //  would still refer to the Child and cause an inifinite loop.
+  // We would instead have to do
+  //    `ParentObject.prototype.init.apply(this, argumnents);`
+  //  Bleh. We're not creating a _super() function, so it's good to keep
+  //  the parent constructor reference simple.
+  subObj = function(){
+    init.apply(this, arguments);
+  };
+
+  // Inherit from this object's prototype
+  subObj.prototype = vjs.obj.create(this.prototype);
+  // Reset the constructor property for subObj otherwise
+  // instances of subObj would have the constructor of the parent Object
+  subObj.prototype.constructor = subObj;
+
+  // Make the class extendable
+  subObj.extend = vjs.CoreObject.extend;
+  // Make a function for creating instances
+  subObj.create = vjs.CoreObject.create;
+
+  // Extend subObj's prototype with functions and other properties from props
+  for (var name in props) {
+    if (props.hasOwnProperty(name)) {
+      subObj.prototype[name] = props[name];
+    }
+  }
+
+  return subObj;
+};
+
+/**
+ * Create a new instace of this Object class
+ * @return {vjs.CoreObject} Returns an instance of a CoreObject subclass
+ * @this {*}
+ */
+vjs.CoreObject.create = function(){
+  // Create a new object that inherits from this object's prototype
+  var inst = vjs.obj.create(this.prototype);
+
+  // Apply this constructor function to the new object
+  this.apply(inst, arguments);
+
+  // Return the new object
+  return inst;
+};
+/**
+ * @fileoverview Event System (John Resig - Secrets of a JS Ninja http://jsninja.com/)
+ * (Original book version wasn't completely usable, so fixed some things and made Closure Compiler compatible)
+ * This should work very similarly to jQuery's events, however it's based off the book version which isn't as
+ * robust as jquery's, so there's probably some differences.
+ */
+
+/**
+ * Add an event listener to element
+ * It stores the handler function in a separate cache object
+ * and adds a generic handler to the element's event,
+ * along with a unique id (guid) to the element.
+ * @param  {Element|Object}   elem Element or object to bind listeners to
+ * @param  {String}   type Type of event to bind to.
+ * @param  {Function} fn   Event listener.
+ */
+vjs.on = function(elem, type, fn){
+  var data = vjs.getData(elem);
+
+  // We need a place to store all our handler data
+  if (!data.handlers) data.handlers = {};
+
+  if (!data.handlers[type]) data.handlers[type] = [];
+
+  if (!fn.guid) fn.guid = vjs.guid++;
+
+  data.handlers[type].push(fn);
+
+  if (!data.dispatcher) {
+    data.disabled = false;
+
+    data.dispatcher = function (event){
+
+      if (data.disabled) return;
+      event = vjs.fixEvent(event);
+
+      var handlers = data.handlers[event.type];
+
+      if (handlers) {
+        // Copy handlers so if handlers are added/removed during the process it doesn't throw everything off.
+        var handlersCopy = handlers.slice(0);
+
+        for (var m = 0, n = handlersCopy.length; m < n; m++) {
+          if (event.isImmediatePropagationStopped()) {
+            break;
+          } else {
+            handlersCopy[m].call(elem, event);
+          }
+        }
+      }
+    };
+  }
+
+  if (data.handlers[type].length == 1) {
+    if (document.addEventListener) {
+      elem.addEventListener(type, data.dispatcher, false);
+    } else if (document.attachEvent) {
+      elem.attachEvent('on' + type, data.dispatcher);
+    }
+  }
+};
+
+/**
+ * Removes event listeners from an element
+ * @param  {Element|Object}   elem Object to remove listeners from
+ * @param  {String=}   type Type of listener to remove. Don't include to remove all events from element.
+ * @param  {Function} fn   Specific listener to remove. Don't incldue to remove listeners for an event type.
+ */
+vjs.off = function(elem, type, fn) {
+  // Don't want to add a cache object through getData if not needed
+  if (!vjs.hasData(elem)) return;
+
+  var data = vjs.getData(elem);
+
+  // If no events exist, nothing to unbind
+  if (!data.handlers) { return; }
+
+  // Utility function
+  var removeType = function(t){
+     data.handlers[t] = [];
+     vjs.cleanUpEvents(elem,t);
+  };
+
+  // Are we removing all bound events?
+  if (!type) {
+    for (var t in data.handlers) removeType(t);
+    return;
+  }
+
+  var handlers = data.handlers[type];
+
+  // If no handlers exist, nothing to unbind
+  if (!handlers) return;
+
+  // If no listener was provided, remove all listeners for type
+  if (!fn) {
+    removeType(type);
+    return;
+  }
+
+  // We're only removing a single handler
+  if (fn.guid) {
+    for (var n = 0; n < handlers.length; n++) {
+      if (handlers[n].guid === fn.guid) {
+        handlers.splice(n--, 1);
+      }
+    }
+  }
+
+  vjs.cleanUpEvents(elem, type);
+};
+
+/**
+ * Clean up the listener cache and dispatchers
+ * @param  {Element|Object} elem Element to clean up
+ * @param  {String} type Type of event to clean up
+ */
+vjs.cleanUpEvents = function(elem, type) {
+  var data = vjs.getData(elem);
+
+  // Remove the events of a particular type if there are none left
+  if (data.handlers[type].length === 0) {
+    delete data.handlers[type];
+    // data.handlers[type] = null;
+    // Setting to null was causing an error with data.handlers
+
+    // Remove the meta-handler from the element
+    if (document.removeEventListener) {
+      elem.removeEventListener(type, data.dispatcher, false);
+    } else if (document.detachEvent) {
+      elem.detachEvent('on' + type, data.dispatcher);
+    }
+  }
+
+  // Remove the events object if there are no types left
+  if (vjs.isEmpty(data.handlers)) {
+    delete data.handlers;
+    delete data.dispatcher;
+    delete data.disabled;
+
+    // data.handlers = null;
+    // data.dispatcher = null;
+    // data.disabled = null;
+  }
+
+  // Finally remove the expando if there is no data left
+  if (vjs.isEmpty(data)) {
+    vjs.removeData(elem);
+  }
+};
+
+/**
+ * Fix a native event to have standard property values
+ * @param  {Object} event Event object to fix
+ * @return {Object}
+ */
+vjs.fixEvent = function(event) {
+
+  function returnTrue() { return true; }
+  function returnFalse() { return false; }
+
+  // Test if fixing up is needed
+  // Used to check if !event.stopPropagation instead of isPropagationStopped
+  // But native events return true for stopPropagation, but don't have
+  // other expected methods like isPropagationStopped. Seems to be a problem
+  // with the Javascript Ninja code. So we're just overriding all events now.
+  if (!event || !event.isPropagationStopped) {
+    var old = event || window.event;
+
+    event = {};
+    // Clone the old object so that we can modify the values event = {};
+    // IE8 Doesn't like when you mess with native event properties
+    // Firefox returns false for event.hasOwnProperty('type') and other props
+    //  which makes copying more difficult.
+    // TODO: Probably best to create a whitelist of event props
+    for (var key in old) {
+      // Safari 6.0.3 warns you if you try to copy deprecated layerX/Y
+      if (key !== 'layerX' && key !== 'layerY') {
+        event[key] = old[key];
+      }
+    }
+
+    // The event occurred on this element
+    if (!event.target) {
+      event.target = event.srcElement || document;
+    }
+
+    // Handle which other element the event is related to
+    event.relatedTarget = event.fromElement === event.target ?
+      event.toElement :
+      event.fromElement;
+
+    // Stop the default browser action
+    event.preventDefault = function () {
+      if (old.preventDefault) {
+        old.preventDefault();
+      }
+      event.returnValue = false;
+      event.isDefaultPrevented = returnTrue;
+    };
+
+    event.isDefaultPrevented = returnFalse;
+
+    // Stop the event from bubbling
+    event.stopPropagation = function () {
+      if (old.stopPropagation) {
+        old.stopPropagation();
+      }
+      event.cancelBubble = true;
+      event.isPropagationStopped = returnTrue;
+    };
+
+    event.isPropagationStopped = returnFalse;
+
+    // Stop the event from bubbling and executing other handlers
+    event.stopImmediatePropagation = function () {
+      if (old.stopImmediatePropagation) {
+        old.stopImmediatePropagation();
+      }
+      event.isImmediatePropagationStopped = returnTrue;
+      event.stopPropagation();
+    };
+
+    event.isImmediatePropagationStopped = returnFalse;
+
+    // Handle mouse position
+    if (event.clientX != null) {
+      var doc = document.documentElement, body = document.body;
+
+      event.pageX = event.clientX +
+        (doc && doc.scrollLeft || body && body.scrollLeft || 0) -
+        (doc && doc.clientLeft || body && body.clientLeft || 0);
+      event.pageY = event.clientY +
+        (doc && doc.scrollTop || body && body.scrollTop || 0) -
+        (doc && doc.clientTop || body && body.clientTop || 0);
+    }
+
+    // Handle key presses
+    event.which = event.charCode || event.keyCode;
+
+    // Fix button for mouse clicks:
+    // 0 == left; 1 == middle; 2 == right
+    if (event.button != null) {
+      event.button = (event.button & 1 ? 0 :
+        (event.button & 4 ? 1 :
+          (event.button & 2 ? 2 : 0)));
+    }
+  }
+
+  // Returns fixed-up instance
+  return event;
+};
+
+/**
+ * Trigger an event for an element
+ * @param  {Element|Object} elem  Element to trigger an event on
+ * @param  {String} event Type of event to trigger
+ */
+vjs.trigger = function(elem, event) {
+  // Fetches element data and a reference to the parent (for bubbling).
+  // Don't want to add a data object to cache for every parent,
+  // so checking hasData first.
+  var elemData = (vjs.hasData(elem)) ? vjs.getData(elem) : {};
+  var parent = elem.parentNode || elem.ownerDocument;
+      // type = event.type || event,
+      // handler;
+
+  // If an event name was passed as a string, creates an event out of it
+  if (typeof event === 'string') {
+    event = { type:event, target:elem };
+  }
+  // Normalizes the event properties.
+  event = vjs.fixEvent(event);
+
+  // If the passed element has a dispatcher, executes the established handlers.
+  if (elemData.dispatcher) {
+    elemData.dispatcher.call(elem, event);
+  }
+
+  // Unless explicitly stopped, recursively calls this function to bubble the event up the DOM.
+  if (parent && !event.isPropagationStopped()) {
+    vjs.trigger(parent, event);
+
+  // If at the top of the DOM, triggers the default action unless disabled.
+  } else if (!parent && !event.isDefaultPrevented()) {
+    var targetData = vjs.getData(event.target);
+
+    // Checks if the target has a default action for this event.
+    if (event.target[event.type]) {
+      // Temporarily disables event dispatching on the target as we have already executed the handler.
+      targetData.disabled = true;
+      // Executes the default action.
+      if (typeof event.target[event.type] === 'function') {
+        event.target[event.type]();
+      }
+      // Re-enables event dispatching.
+      targetData.disabled = false;
+    }
+  }
+
+  // Inform the triggerer if the default was prevented by returning false
+  return !event.isDefaultPrevented();
+  /* Original version of js ninja events wasn't complete.
+   * We've since updated to the latest version, but keeping this around
+   * for now just in case.
+   */
+  // // Added in attion to book. Book code was broke.
+  // event = typeof event === 'object' ?
+  //   event[vjs.expando] ?
+  //     event :
+  //     new vjs.Event(type, event) :
+  //   new vjs.Event(type);
+
+  // event.type = type;
+  // if (handler) {
+  //   handler.call(elem, event);
+  // }
+
+  // // Clean up the event in case it is being reused
+  // event.result = undefined;
+  // event.target = elem;
+};
+
+/**
+ * Trigger a listener only once for an event
+ * @param  {Element|Object}   elem Element or object to
+ * @param  {[type]}   type [description]
+ * @param  {Function} fn   [description]
+ * @return {[type]}
+ */
+vjs.one = function(elem, type, fn) {
+  vjs.on(elem, type, function(){
+    vjs.off(elem, type, arguments.callee);
+    fn.apply(this, arguments);
+  });
+};
+var hasOwnProp = Object.prototype.hasOwnProperty;
+
+/**
+ * Creates an element and applies properties.
+ * @param  {String=} tagName    Name of tag to be created.
+ * @param  {Object=} properties Element properties to be applied.
+ * @return {Element}
+ */
+vjs.createEl = function(tagName, properties){
+  var el = document.createElement(tagName || 'div');
+
+  for (var propName in properties){
+    if (hasOwnProp.call(properties, propName)) {
+      //el[propName] = properties[propName];
+      // Not remembering why we were checking for dash
+      // but using setAttribute means you have to use getAttribute
+
+      // The check for dash checks for the aria-* attributes, like aria-label, aria-valuemin.
+      // The additional check for "role" is because the default method for adding attributes does not
+      // add the attribute "role". My guess is because it's not a valid attribute in some namespaces, although
+      // browsers handle the attribute just fine. The W3C allows for aria-* attributes to be used in pre-HTML5 docs.
+      // http://www.w3.org/TR/wai-aria-primer/#ariahtml. Using setAttribute gets around this problem.
+
+       if (propName.indexOf('aria-') !== -1 || propName=='role') {
+         el.setAttribute(propName, properties[propName]);
+       } else {
+         el[propName] = properties[propName];
+       }
+    }
+  }
+  return el;
+};
+
+/**
+ * Uppercase the first letter of a string
+ * @param  {String} string String to be uppercased
+ * @return {String}
+ */
+vjs.capitalize = function(string){
+  return string.charAt(0).toUpperCase() + string.slice(1);
+};
+
+/**
+ * Object functions container
+ * @type {Object}
+ */
+vjs.obj = {};
+
+/**
+ * Object.create shim for prototypal inheritance.
+ * https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/create
+ * @param  {Object}   obj Object to use as prototype
+ */
+ vjs.obj.create = Object.create || function(obj){
+  //Create a new function called 'F' which is just an empty object.
+  function F() {}
+
+  //the prototype of the 'F' function should point to the
+  //parameter of the anonymous function.
+  F.prototype = obj;
+
+  //create a new constructor function based off of the 'F' function.
+  return new F();
+};
+
+/**
+ * Loop through each property in an object and call a function
+ * whose arguments are (key,value)
+ * @param  {Object}   obj Object of properties
+ * @param  {Function} fn  Function to be called on each property.
+ * @this {*}
+ */
+vjs.obj.each = function(obj, fn, context){
+  for (var key in obj) {
+    if (hasOwnProp.call(obj, key)) {
+      fn.call(context || this, key, obj[key]);
+    }
+  }
+};
+
+/**
+ * Merge two objects together and return the original.
+ * @param  {Object} obj1
+ * @param  {Object} obj2
+ * @return {Object}
+ */
+vjs.obj.merge = function(obj1, obj2){
+  if (!obj2) { return obj1; }
+  for (var key in obj2){
+    if (hasOwnProp.call(obj2, key)) {
+      obj1[key] = obj2[key];
+    }
+  }
+  return obj1;
+};
+
+/**
+ * Merge two objects, and merge any properties that are objects
+ * instead of just overwriting one. Uses to merge options hashes
+ * where deeper default settings are important.
+ * @param  {Object} obj1 Object to override
+ * @param  {Object} obj2 Overriding object
+ * @return {Object}      New object. Obj1 and Obj2 will be untouched.
+ */
+vjs.obj.deepMerge = function(obj1, obj2){
+  var key, val1, val2, objDef;
+  objDef = '[object Object]';
+
+  // Make a copy of obj1 so we're not ovewriting original values.
+  // like prototype.options_ and all sub options objects
+  obj1 = vjs.obj.copy(obj1);
+
+  for (key in obj2){
+    if (hasOwnProp.call(obj2, key)) {
+      val1 = obj1[key];
+      val2 = obj2[key];
+
+      // Check if both properties are pure objects and do a deep merge if so
+      if (vjs.obj.isPlain(val1) && vjs.obj.isPlain(val2)) {
+        obj1[key] = vjs.obj.deepMerge(val1, val2);
+      } else {
+        obj1[key] = obj2[key];
+      }
+    }
+  }
+  return obj1;
+};
+
+/**
+ * Make a copy of the supplied object
+ * @param  {Object} obj Object to copy
+ * @return {Object}     Copy of object
+ */
+vjs.obj.copy = function(obj){
+  return vjs.obj.merge({}, obj);
+};
+
+/**
+ * Check if an object is plain, and not a dom node or any object sub-instance
+ * @param  {Object} obj Object to check
+ * @return {Boolean}     True if plain, false otherwise
+ */
+vjs.obj.isPlain = function(obj){
+  return !!obj
+    && typeof obj === 'object'
+    && obj.toString() === '[object Object]'
+    && obj.constructor === Object;
+};
+
+/**
+ * Bind (a.k.a proxy or Context). A simple method for changing the context of a function
+   It also stores a unique id on the function so it can be easily removed from events
+ * @param  {*}   context The object to bind as scope
+ * @param  {Function} fn      The function to be bound to a scope
+ * @param  {Number=}   uid     An optional unique ID for the function to be set
+ * @return {Function}
+ */
+vjs.bind = function(context, fn, uid) {
+  // Make sure the function has a unique ID
+  if (!fn.guid) { fn.guid = vjs.guid++; }
+
+  // Create the new function that changes the context
+  var ret = function() {
+    return fn.apply(context, arguments);
+  };
+
+  // Allow for the ability to individualize this function
+  // Needed in the case where multiple objects might share the same prototype
+  // IF both items add an event listener with the same function, then you try to remove just one
+  // it will remove both because they both have the same guid.
+  // when using this, you need to use the bind method when you remove the listener as well.
+  // currently used in text tracks
+  ret.guid = (uid) ? uid + '_' + fn.guid : fn.guid;
+
+  return ret;
+};
+
+/**
+ * Element Data Store. Allows for binding data to an element without putting it directly on the element.
+ * Ex. Event listneres are stored here.
+ * (also from jsninja.com, slightly modified and updated for closure compiler)
+ * @type {Object}
+ */
+vjs.cache = {};
+
+/**
+ * Unique ID for an element or function
+ * @type {Number}
+ */
+vjs.guid = 1;
+
+/**
+ * Unique attribute name to store an element's guid in
+ * @type {String}
+ * @constant
+ */
+vjs.expando = 'vdata' + (new Date()).getTime();
+
+/**
+ * Returns the cache object where data for an element is stored
+ * @param  {Element} el Element to store data for.
+ * @return {Object}
+ */
+vjs.getData = function(el){
+  var id = el[vjs.expando];
+  if (!id) {
+    id = el[vjs.expando] = vjs.guid++;
+    vjs.cache[id] = {};
+  }
+  return vjs.cache[id];
+};
+
+/**
+ * Returns the cache object where data for an element is stored
+ * @param  {Element} el Element to store data for.
+ * @return {Object}
+ */
+vjs.hasData = function(el){
+  var id = el[vjs.expando];
+  return !(!id || vjs.isEmpty(vjs.cache[id]));
+};
+
+/**
+ * Delete data for the element from the cache and the guid attr from getElementById
+ * @param  {Element} el Remove data for an element
+ */
+vjs.removeData = function(el){
+  var id = el[vjs.expando];
+  if (!id) { return; }
+  // Remove all stored data
+  // Changed to = null
+  // http://coding.smashingmagazine.com/2012/11/05/writing-fast-memory-efficient-javascript/
+  // vjs.cache[id] = null;
+  delete vjs.cache[id];
+
+  // Remove the expando property from the DOM node
+  try {
+    delete el[vjs.expando];
+  } catch(e) {
+    if (el.removeAttribute) {
+      el.removeAttribute(vjs.expando);
+    } else {
+      // IE doesn't appear to support removeAttribute on the document element
+      el[vjs.expando] = null;
+    }
+  }
+};
+
+vjs.isEmpty = function(obj) {
+  for (var prop in obj) {
+    // Inlude null properties as empty.
+    if (obj[prop] !== null) {
+      return false;
+    }
+  }
+  return true;
+};
+
+/**
+ * Add a CSS class name to an element
+ * @param {Element} element    Element to add class name to
+ * @param {String} classToAdd Classname to add
+ */
+vjs.addClass = function(element, classToAdd){
+  if ((' '+element.className+' ').indexOf(' '+classToAdd+' ') == -1) {
+    element.className = element.className === '' ? classToAdd : element.className + ' ' + classToAdd;
+  }
+};
+
+/**
+ * Remove a CSS class name from an element
+ * @param {Element} element    Element to remove from class name
+ * @param {String} classToAdd Classname to remove
+ */
+vjs.removeClass = function(element, classToRemove){
+  if (element.className.indexOf(classToRemove) == -1) { return; }
+  var classNames = element.className.split(' ');
+  // IE8 Does not support array.indexOf so using a for loop
+  for (var i = classNames.length - 1; i >= 0; i--) {
+    if (classNames[i] === classToRemove) {
+      classNames.splice(i,1);
+    }
+  }
+  // classNames.splice(classNames.indexOf(classToRemove),1);
+  element.className = classNames.join(' ');
+};
+
+/**
+ * Element for testing browser HTML5 video capabilities
+ * @type {Element}
+ * @constant
+ */
+vjs.TEST_VID = vjs.createEl('video');
+
+/**
+ * Useragent for browser testing.
+ * @type {String}
+ * @constant
+ */
+vjs.USER_AGENT = navigator.userAgent;
+
+/**
+ * Device is an iPhone
+ * @type {Boolean}
+ * @constant
+ */
+vjs.IS_IPHONE = (/iPhone/i).test(vjs.USER_AGENT);
+vjs.IS_IPAD = (/iPad/i).test(vjs.USER_AGENT);
+vjs.IS_IPOD = (/iPod/i).test(vjs.USER_AGENT);
+vjs.IS_IOS = vjs.IS_IPHONE || vjs.IS_IPAD || vjs.IS_IPOD;
+
+vjs.IOS_VERSION = (function(){
+  var match = vjs.USER_AGENT.match(/OS (\d+)_/i);
+  if (match && match[1]) { return match[1]; }
+})();
+
+vjs.IS_ANDROID = (/Android/i).test(vjs.USER_AGENT);
+vjs.ANDROID_VERSION = (function() {
+  // This matches Android Major.Minor.Patch versions
+  // ANDROID_VERSION is Major.Minor as a Number, if Minor isn't available, then only Major is returned
+  var match = vjs.USER_AGENT.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i),
+    major,
+    minor;
+
+  if (!match) {
+    return null;
+  }
+
+  major = match[1] && parseFloat(match[1]);
+  minor = match[2] && parseFloat(match[2]);
+
+  if (major && minor) {
+    return parseFloat(match[1] + '.' + match[2]);
+  } else if (major) {
+    return major;
+  } else {
+    return null;
+  }
+})();
+// Old Android is defined as Version older than 2.3, and requiring a webkit version of the android browser
+vjs.IS_OLD_ANDROID = vjs.IS_ANDROID && (/webkit/i).test(vjs.USER_AGENT) && vjs.ANDROID_VERSION < 2.3;
+
+vjs.IS_FIREFOX = (/Firefox/i).test(vjs.USER_AGENT);
+vjs.IS_CHROME = (/Chrome/i).test(vjs.USER_AGENT);
+
+
+/**
+ * Get an element's attribute values, as defined on the HTML tag
+ * Attributs are not the same as properties. They're defined on the tag
+ * or with setAttribute (which shouldn't be used with HTML)
+ * This will return true or false for boolean attributes.
+ * @param  {Element} tag Element from which to get tag attributes
+ * @return {Object}
+ */
+vjs.getAttributeValues = function(tag){
+  var obj = {};
+
+  // Known boolean attributes
+  // We can check for matching boolean properties, but older browsers
+  // won't know about HTML5 boolean attributes that we still read from.
+  // Bookending with commas to allow for an easy string search.
+  var knownBooleans = ','+'autoplay,controls,loop,muted,default'+',';
+
+  if (tag && tag.attributes && tag.attributes.length > 0) {
+    var attrs = tag.attributes;
+    var attrName, attrVal;
+
+    for (var i = attrs.length - 1; i >= 0; i--) {
+      attrName = attrs[i].name;
+      attrVal = attrs[i].value;
+
+      // Check for known booleans
+      // The matching element property will return a value for typeof
+      if (typeof tag[attrName] === 'boolean' || knownBooleans.indexOf(','+attrName+',') !== -1) {
+        // The value of an included boolean attribute is typically an empty string ('')
+        // which would equal false if we just check for a false value.
+        // We also don't want support bad code like autoplay='false'
+        attrVal = (attrVal !== null) ? true : false;
+      }
+
+      obj[attrName] = attrVal;
+    }
+  }
+
+  return obj;
+};
+
+/**
+ * Get the computed style value for an element
+ * From http://robertnyman.com/2006/04/24/get-the-rendered-style-of-an-element/
+ * @param  {Element} el        Element to get style value for
+ * @param  {String} strCssRule Style name
+ * @return {String}            Style value
+ */
+vjs.getComputedDimension = function(el, strCssRule){
+  var strValue = '';
+  if(document.defaultView && document.defaultView.getComputedStyle){
+    strValue = document.defaultView.getComputedStyle(el, '').getPropertyValue(strCssRule);
+
+  } else if(el.currentStyle){
+    // IE8 Width/Height support
+    strValue = el['client'+strCssRule.substr(0,1).toUpperCase() + strCssRule.substr(1)] + 'px';
+  }
+  return strValue;
+};
+
+/**
+ * Insert an element as the first child node of another
+ * @param  {Element} child   Element to insert
+ * @param  {[type]} parent Element to insert child into
+ */
+vjs.insertFirst = function(child, parent){
+  if (parent.firstChild) {
+    parent.insertBefore(child, parent.firstChild);
+  } else {
+    parent.appendChild(child);
+  }
+};
+
+/**
+ * Object to hold browser support information
+ * @type {Object}
+ */
+vjs.support = {};
+
+/**
+ * Shorthand for document.getElementById()
+ * Also allows for CSS (jQuery) ID syntax. But nothing other than IDs.
+ * @param  {String} id  Element ID
+ * @return {Element}    Element with supplied ID
+ */
+vjs.el = function(id){
+  if (id.indexOf('#') === 0) {
+    id = id.slice(1);
+  }
+
+  return document.getElementById(id);
+};
+
+/**
+ * Format seconds as a time string, H:MM:SS or M:SS
+ * Supplying a guide (in seconds) will force a number of leading zeros
+ * to cover the length of the guide
+ * @param  {Number} seconds Number of seconds to be turned into a string
+ * @param  {Number} guide   Number (in seconds) to model the string after
+ * @return {String}         Time formatted as H:MM:SS or M:SS
+ */
+vjs.formatTime = function(seconds, guide) {
+  guide = guide || seconds; // Default to using seconds as guide
+  var s = Math.floor(seconds % 60),
+      m = Math.floor(seconds / 60 % 60),
+      h = Math.floor(seconds / 3600),
+      gm = Math.floor(guide / 60 % 60),
+      gh = Math.floor(guide / 3600);
+
+  // Check if we need to show hours
+  h = (h > 0 || gh > 0) ? h + ':' : '';
+
+  // If hours are showing, we may need to add a leading zero.
+  // Always show at least one digit of minutes.
+  m = (((h || gm >= 10) && m < 10) ? '0' + m : m) + ':';
+
+  // Check if leading zero is need for seconds
+  s = (s < 10) ? '0' + s : s;
+
+  return h + m + s;
+};
+
+// Attempt to block the ability to select text while dragging controls
+vjs.blockTextSelection = function(){
+  document.body.focus();
+  document.onselectstart = function () { return false; };
+};
+// Turn off text selection blocking
+vjs.unblockTextSelection = function(){ document.onselectstart = function () { return true; }; };
+
+/**
+ * Trim whitespace from the ends of a string.
+ * @param  {String} string String to trim
+ * @return {String}        Trimmed string
+ */
+vjs.trim = function(string){
+  return string.toString().replace(/^\s+/, '').replace(/\s+$/, '');
+};
+
+/**
+ * Should round off a number to a decimal place
+ * @param  {Number} num Number to round
+ * @param  {Number} dec Number of decimal places to round to
+ * @return {Number}     Rounded number
+ */
+vjs.round = function(num, dec) {
+  if (!dec) { dec = 0; }
+  return Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
+};
+
+/**
+ * Should create a fake TimeRange object
+ * Mimics an HTML5 time range instance, which has functions that
+ * return the start and end times for a range
+ * TimeRanges are returned by the buffered() method
+ * @param  {Number} start Start time in seconds
+ * @param  {Number} end   End time in seconds
+ * @return {Object}       Fake TimeRange object
+ */
+vjs.createTimeRange = function(start, end){
+  return {
+    length: 1,
+    start: function() { return start; },
+    end: function() { return end; }
+  };
+};
+
+/**
+ * Simple http request for retrieving external files (e.g. text tracks)
+ * @param  {String} url           URL of resource
+ * @param  {Function=} onSuccess  Success callback
+ * @param  {Function=} onError    Error callback
+ */
+vjs.get = function(url, onSuccess, onError){
+  var local = (url.indexOf('file:') === 0 || (window.location.href.indexOf('file:') === 0 && url.indexOf('http') === -1));
+
+  if (typeof XMLHttpRequest === 'undefined') {
+    window.XMLHttpRequest = function () {
+      try { return new window.ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch (e) {}
+      try { return new window.ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch (f) {}
+      try { return new window.ActiveXObject('Msxml2.XMLHTTP'); } catch (g) {}
+      throw new Error('This browser does not support XMLHttpRequest.');
+    };
+  }
+
+  var request = new XMLHttpRequest();
+
+  try {
+    request.open('GET', url);
+  } catch(e) {
+    onError(e);
+  }
+
+  request.onreadystatechange = function() {
+    if (request.readyState === 4) {
+      if (request.status === 200 || local && request.status === 0) {
+        onSuccess(request.responseText);
+      } else {
+        if (onError) {
+          onError();
+        }
+      }
+    }
+  };
+
+  try {
+    request.send();
+  } catch(e) {
+    if (onError) {
+      onError(e);
+    }
+  }
+};
+
+/* Local Storage
+================================================================================ */
+vjs.setLocalStorage = function(key, value){
+  try {
+    // IE was throwing errors referencing the var anywhere without this
+    var localStorage = window.localStorage || false;
+    if (!localStorage) { return; }
+    localStorage[key] = value;
+  } catch(e) {
+    if (e.code == 22 || e.code == 1014) { // Webkit == 22 / Firefox == 1014
+      vjs.log('LocalStorage Full (VideoJS)', e);
+    } else {
+      if (e.code == 18) {
+        vjs.log('LocalStorage not allowed (VideoJS)', e);
+      } else {
+        vjs.log('LocalStorage Error (VideoJS)', e);
+      }
+    }
+  }
+};
+
+/**
+ * Get abosolute version of relative URL. Used to tell flash correct URL.
+ * http://stackoverflow.com/questions/470832/getting-an-absolute-url-from-a-relative-one-ie6-issue
+ * @param  {String} url URL to make absolute
+ * @return {String}     Absolute URL
+ */
+vjs.getAbsoluteURL = function(url){
+
+  // Check if absolute URL
+  if (!url.match(/^https?:\/\//)) {
+    // Convert to absolute URL. Flash hosted off-site needs an absolute URL.
+    url = vjs.createEl('div', {
+      innerHTML: '<a href="'+url+'">x</a>'
+    }).firstChild.href;
+  }
+
+  return url;
+};
+
+// usage: log('inside coolFunc',this,arguments);
+// http://paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
+vjs.log = function(){
+  vjs.log.history = vjs.log.history || [];   // store logs to an array for reference
+  vjs.log.history.push(arguments);
+  if(window.console){
+    window.console.log(Array.prototype.slice.call(arguments));
+  }
+};
+
+// Offset Left
+// getBoundingClientRect technique from John Resig http://ejohn.org/blog/getboundingclientrect-is-awesome/
+vjs.findPosition = function(el) {
+    var box, docEl, body, clientLeft, scrollLeft, left, clientTop, scrollTop, top;
+
+    if (el.getBoundingClientRect && el.parentNode) {
+      box = el.getBoundingClientRect();
+    }
+
+    if (!box) {
+      return {
+        left: 0,
+        top: 0
+      };
+    }
+
+    docEl = document.documentElement;
+    body = document.body;
+
+    clientLeft = docEl.clientLeft || body.clientLeft || 0;
+    scrollLeft = window.pageXOffset || body.scrollLeft;
+    left = box.left + scrollLeft - clientLeft;
+
+    clientTop = docEl.clientTop || body.clientTop || 0;
+    scrollTop = window.pageYOffset || body.scrollTop;
+    top = box.top + scrollTop - clientTop;
+
+    return {
+      left: left,
+      top: top
+    };
+};
+/**
+ * @fileoverview Player Component - Base class for all UI objects
+ *
+ */
+
+/**
+ * Base UI Component class
+ * @param {Object} player  Main Player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.Component = vjs.CoreObject.extend({
+  /** @constructor */
+  init: function(player, options, ready){
+    this.player_ = player;
+
+    // Make a copy of prototype.options_ to protect against overriding global defaults
+    this.options_ = vjs.obj.copy(this.options_);
+
+    // Updated options with supplied options
+    options = this.options(options);
+
+    // Get ID from options, element, or create using player ID and unique ID
+    this.id_ = options['id'] || ((options['el'] && options['el']['id']) ? options['el']['id'] : player.id() + '_component_' + vjs.guid++ );
+
+    this.name_ = options['name'] || null;
+
+    // Create element if one wasn't provided in options
+    this.el_ = options['el'] || this.createEl();
+
+    this.children_ = [];
+    this.childIndex_ = {};
+    this.childNameIndex_ = {};
+
+    // Add any child components in options
+    this.initChildren();
+
+    this.ready(ready);
+    // Don't want to trigger ready here or it will before init is actually
+    // finished for all children that run this constructor
+  }
+});
+
+/**
+ * Dispose of the component and all child components.
+ */
+vjs.Component.prototype.dispose = function(){
+  // Dispose all children.
+  if (this.children_) {
+    for (var i = this.children_.length - 1; i >= 0; i--) {
+      if (this.children_[i].dispose) {
+        this.children_[i].dispose();
+      }
+    }
+  }
+
+  // Delete child references
+  this.children_ = null;
+  this.childIndex_ = null;
+  this.childNameIndex_ = null;
+
+  // Remove all event listeners.
+  this.off();
+
+  // Remove element from DOM
+  if (this.el_.parentNode) {
+    this.el_.parentNode.removeChild(this.el_);
+  }
+
+  vjs.removeData(this.el_);
+  this.el_ = null;
+};
+
+/**
+ * Reference to main player instance.
+ * @type {vjs.Player}
+ * @private
+ */
+vjs.Component.prototype.player_;
+
+/**
+ * Return the component's player.
+ * @return {vjs.Player}
+ */
+vjs.Component.prototype.player = function(){
+  return this.player_;
+};
+
+/**
+ * Component options object.
+ * @type {Object}
+ * @private
+ */
+vjs.Component.prototype.options_;
+
+/**
+ * Deep merge of options objects
+ * Whenever a property is an object on both options objects
+ * the two properties will be merged using vjs.obj.deepMerge.
+ *
+ * This is used for merging options for child components. We
+ * want it to be easy to override individual options on a child
+ * component without having to rewrite all the other default options.
+ *
+ * Parent.prototype.options_ = {
+ *   children: {
+ *     'childOne': { 'foo': 'bar', 'asdf': 'fdsa' },
+ *     'childTwo': {},
+ *     'childThree': {}
+ *   }
+ * }
+ * newOptions = {
+ *   children: {
+ *     'childOne': { 'foo': 'baz', 'abc': '123' }
+ *     'childTwo': null,
+ *     'childFour': {}
+ *   }
+ * }
+ *
+ * this.options(newOptions);
+ *
+ * RESULT
+ *
+ * {
+ *   children: {
+ *     'childOne': { 'foo': 'baz', 'asdf': 'fdsa', 'abc': '123' },
+ *     'childTwo': null, // Disabled. Won't be initialized.
+ *     'childThree': {},
+ *     'childFour': {}
+ *   }
+ * }
+ *
+ * @param  {Object} obj Object whose values will be overwritten
+ * @return {Object}      NEW merged object. Does not return obj1.
+ */
+vjs.Component.prototype.options = function(obj){
+  if (obj === undefined) return this.options_;
+
+  return this.options_ = vjs.obj.deepMerge(this.options_, obj);
+};
+
+/**
+ * The DOM element for the component.
+ * @type {Element}
+ * @private
+ */
+vjs.Component.prototype.el_;
+
+/**
+ * Create the component's DOM element.
+ * @param  {String=} tagName  Element's node type. e.g. 'div'
+ * @param  {Object=} attributes An object of element attributes that should be set on the element.
+ * @return {Element}
+ */
+vjs.Component.prototype.createEl = function(tagName, attributes){
+  return vjs.createEl(tagName, attributes);
+};
+
+/**
+ * Return the component's DOM element.
+ * @return {Element}
+ */
+vjs.Component.prototype.el = function(){
+  return this.el_;
+};
+
+/**
+ * An optional element where, if defined, children will be inserted
+ *   instead of directly in el_
+ * @type {Element}
+ * @private
+ */
+vjs.Component.prototype.contentEl_;
+
+/**
+ * Return the component's DOM element for embedding content.
+ *   will either be el_ or a new element defined in createEl
+ * @return {Element}
+ */
+vjs.Component.prototype.contentEl = function(){
+  return this.contentEl_ || this.el_;
+};
+
+/**
+ * The ID for the component.
+ * @type {String}
+ * @private
+ */
+vjs.Component.prototype.id_;
+
+/**
+ * Return the component's ID.
+ * @return {String}
+ */
+vjs.Component.prototype.id = function(){
+  return this.id_;
+};
+
+/**
+ * The name for the component. Often used to reference the component.
+ * @type {String}
+ * @private
+ */
+vjs.Component.prototype.name_;
+
+/**
+ * Return the component's ID.
+ * @return {String}
+ */
+vjs.Component.prototype.name = function(){
+  return this.name_;
+};
+
+/**
+ * Array of child components
+ * @type {Array}
+ * @private
+ */
+vjs.Component.prototype.children_;
+
+/**
+ * Returns array of all child components.
+ * @return {Array}
+ */
+vjs.Component.prototype.children = function(){
+  return this.children_;
+};
+
+/**
+ * Object of child components by ID
+ * @type {Object}
+ * @private
+ */
+vjs.Component.prototype.childIndex_;
+
+/**
+ * Returns a child component with the provided ID.
+ * @return {Array}
+ */
+vjs.Component.prototype.getChildById = function(id){
+  return this.childIndex_[id];
+};
+
+/**
+ * Object of child components by Name
+ * @type {Object}
+ * @private
+ */
+vjs.Component.prototype.childNameIndex_;
+
+/**
+ * Returns a child component with the provided ID.
+ * @return {Array}
+ */
+vjs.Component.prototype.getChild = function(name){
+  return this.childNameIndex_[name];
+};
+
+/**
+ * Adds a child component inside this component.
+ * @param {String|vjs.Component} child The class name or instance of a child to add.
+ * @param {Object=} options Optional options, including options to be passed to
+ *  children of the child.
+ * @return {vjs.Component} The child component, because it might be created in this process.
+ * @suppress {accessControls|checkRegExp|checkTypes|checkVars|const|constantProperty|deprecated|duplicate|es5Strict|fileoverviewTags|globalThis|invalidCasts|missingProperties|nonStandardJsDocs|strictModuleDepCheck|undefinedNames|undefinedVars|unknownDefines|uselessCode|visibility}
+ */
+vjs.Component.prototype.addChild = function(child, options){
+  var component, componentClass, componentName, componentId;
+
+  // If string, create new component with options
+  if (typeof child === 'string') {
+
+    componentName = child;
+
+    // Make sure options is at least an empty object to protect against errors
+    options = options || {};
+
+    // Assume name of set is a lowercased name of the UI Class (PlayButton, etc.)
+    componentClass = options['componentClass'] || vjs.capitalize(componentName);
+
+    // Set name through options
+    options['name'] = componentName;
+
+    // Create a new object & element for this controls set
+    // If there's no .player_, this is a player
+    // Closure Compiler throws an 'incomplete alias' warning if we use the vjs variable directly.
+    // Every class should be exported, so this should never be a problem here.
+    component = new window['videojs'][componentClass](this.player_ || this, options);
+
+  // child is a component instance
+  } else {
+    component = child;
+  }
+
+  this.children_.push(component);
+
+  if (typeof component.id === 'function') {
+    this.childIndex_[component.id()] = component;
+  }
+
+  // If a name wasn't used to create the component, check if we can use the
+  // name function of the component
+  componentName = componentName || (component.name && component.name());
+
+  if (componentName) {
+    this.childNameIndex_[componentName] = component;
+  }
+
+  // Add the UI object's element to the container div (box)
+  // Having an element is not required
+  if (typeof component['el'] === 'function' && component['el']()) {
+    this.contentEl().appendChild(component['el']());
+  }
+
+  // Return so it can stored on parent object if desired.
+  return component;
+};
+
+vjs.Component.prototype.removeChild = function(component){
+  if (typeof component === 'string') {
+    component = this.getChild(component);
+  }
+
+  if (!component || !this.children_) return;
+
+  var childFound = false;
+  for (var i = this.children_.length - 1; i >= 0; i--) {
+    if (this.children_[i] === component) {
+      childFound = true;
+      this.children_.splice(i,1);
+      break;
+    }
+  }
+
+  if (!childFound) return;
+
+  this.childIndex_[component.id] = null;
+  this.childNameIndex_[component.name] = null;
+
+  var compEl = component.el();
+  if (compEl && compEl.parentNode === this.contentEl()) {
+    this.contentEl().removeChild(component.el());
+  }
+};
+
+/**
+ * Initialize default child components from options
+ */
+vjs.Component.prototype.initChildren = function(){
+  var options = this.options_;
+
+  if (options && options['children']) {
+    var self = this;
+
+    // Loop through components and add them to the player
+    vjs.obj.each(options['children'], function(name, opts){
+      // Allow for disabling default components
+      // e.g. vjs.options['children']['posterImage'] = false
+      if (opts === false) return;
+
+      // Allow waiting to add components until a specific event is called
+      var tempAdd = function(){
+        // Set property name on player. Could cause conflicts with other prop names, but it's worth making refs easy.
+        self[name] = self.addChild(name, opts);
+      };
+
+      if (opts['loadEvent']) {
+        // this.one(opts.loadEvent, tempAdd)
+      } else {
+        tempAdd();
+      }
+    });
+  }
+};
+
+vjs.Component.prototype.buildCSSClass = function(){
+    // Child classes can include a function that does:
+    // return 'CLASS NAME' + this._super();
+    return '';
+};
+
+/* Events
+============================================================================= */
+
+/**
+ * Add an event listener to this component's element. Context will be the component.
+ * @param  {String}   type Event type e.g. 'click'
+ * @param  {Function} fn   Event listener
+ * @return {vjs.Component}
+ */
+vjs.Component.prototype.on = function(type, fn){
+  vjs.on(this.el_, type, vjs.bind(this, fn));
+  return this;
+};
+
+/**
+ * Remove an event listener from the component's element
+ * @param  {String=}   type Optional event type. Without type it will remove all listeners.
+ * @param  {Function=} fn   Optional event listener. Without fn it will remove all listeners for a type.
+ * @return {vjs.Component}
+ */
+vjs.Component.prototype.off = function(type, fn){
+  vjs.off(this.el_, type, fn);
+  return this;
+};
+
+/**
+ * Add an event listener to be triggered only once and then removed
+ * @param  {String}   type Event type
+ * @param  {Function} fn   Event listener
+ * @return {vjs.Component}
+ */
+vjs.Component.prototype.one = function(type, fn) {
+  vjs.one(this.el_, type, vjs.bind(this, fn));
+  return this;
+};
+
+/**
+ * Trigger an event on an element
+ * @param  {String} type  Event type to trigger
+ * @param  {Event|Object} event Event object to be passed to the listener
+ * @return {vjs.Component}
+ */
+vjs.Component.prototype.trigger = function(type, event){
+  vjs.trigger(this.el_, type, event);
+  return this;
+};
+
+/* Ready
+================================================================================ */
+/**
+ * Is the component loaded.
+ * @type {Boolean}
+ * @private
+ */
+vjs.Component.prototype.isReady_;
+
+/**
+ * Trigger ready as soon as initialization is finished.
+ *   Allows for delaying ready. Override on a sub class prototype.
+ *   If you set this.isReadyOnInitFinish_ it will affect all components.
+ *   Specially used when waiting for the Flash player to asynchrnously load.
+ *   @type {Boolean}
+ *   @private
+ */
+vjs.Component.prototype.isReadyOnInitFinish_ = true;
+
+/**
+ * List of ready listeners
+ * @type {Array}
+ * @private
+ */
+vjs.Component.prototype.readyQueue_;
+
+/**
+ * Bind a listener to the component's ready state.
+ *   Different from event listeners in that if the ready event has already happend
+ *   it will trigger the function immediately.
+ * @param  {Function} fn Ready listener
+ * @return {vjs.Component}
+ */
+vjs.Component.prototype.ready = function(fn){
+  if (fn) {
+    if (this.isReady_) {
+      fn.call(this);
+    } else {
+      if (this.readyQueue_ === undefined) {
+        this.readyQueue_ = [];
+      }
+      this.readyQueue_.push(fn);
+    }
+  }
+  return this;
+};
+
+/**
+ * Trigger the ready listeners
+ * @return {vjs.Component}
+ */
+vjs.Component.prototype.triggerReady = function(){
+  this.isReady_ = true;
+
+  var readyQueue = this.readyQueue_;
+
+  if (readyQueue && readyQueue.length > 0) {
+
+    for (var i = 0, j = readyQueue.length; i < j; i++) {
+      readyQueue[i].call(this);
+    }
+
+    // Reset Ready Queue
+    this.readyQueue_ = [];
+
+    // Allow for using event listeners also, in case you want to do something everytime a source is ready.
+    this.trigger('ready');
+  }
+};
+
+/* Display
+============================================================================= */
+
+/**
+ * Add a CSS class name to the component's element
+ * @param {String} classToAdd Classname to add
+ * @return {vjs.Component}
+ */
+vjs.Component.prototype.addClass = function(classToAdd){
+  vjs.addClass(this.el_, classToAdd);
+  return this;
+};
+
+/**
+ * Remove a CSS class name from the component's element
+ * @param {String} classToRemove Classname to remove
+ * @return {vjs.Component}
+ */
+vjs.Component.prototype.removeClass = function(classToRemove){
+  vjs.removeClass(this.el_, classToRemove);
+  return this;
+};
+
+/**
+ * Show the component element if hidden
+ * @return {vjs.Component}
+ */
+vjs.Component.prototype.show = function(){
+  this.el_.style.display = 'block';
+  return this;
+};
+
+/**
+ * Hide the component element if hidden
+ * @return {vjs.Component}
+ */
+vjs.Component.prototype.hide = function(){
+  this.el_.style.display = 'none';
+  return this;
+};
+
+/**
+ * Fade a component in using CSS
+ * @return {vjs.Component}
+ */
+vjs.Component.prototype.fadeIn = function(){
+  this.removeClass('vjs-fade-out');
+  this.addClass('vjs-fade-in');
+  return this;
+};
+
+/**
+ * Fade a component out using CSS
+ * @return {vjs.Component}
+ */
+vjs.Component.prototype.fadeOut = function(){
+  this.removeClass('vjs-fade-in');
+  this.addClass('vjs-fade-out');
+  return this;
+};
+
+/**
+ * Lock an item in its visible state. To be used with fadeIn/fadeOut.
+ * @return {vjs.Component}
+ */
+vjs.Component.prototype.lockShowing = function(){
+  this.addClass('vjs-lock-showing');
+  return this;
+};
+
+/**
+ * Unlock an item to be hidden. To be used with fadeIn/fadeOut.
+ * @return {vjs.Component}
+ */
+vjs.Component.prototype.unlockShowing = function(){
+  this.removeClass('vjs-lock-showing');
+  return this;
+};
+
+/**
+ * Disable component by making it unshowable
+ */
+vjs.Component.prototype.disable = function(){
+  this.hide();
+  this.show = function(){};
+  this.fadeIn = function(){};
+};
+
+// TODO: Get enable working
+// vjs.Component.prototype.enable = function(){
+//   this.fadeIn = vjs.Component.prototype.fadeIn;
+//   this.show = vjs.Component.prototype.show;
+// };
+
+/**
+ * If a value is provided it will change the width of the player to that value
+ * otherwise the width is returned
+ * http://dev.w3.org/html5/spec/dimension-attributes.html#attr-dim-height
+ * Video tag width/height only work in pixels. No percents.
+ * But allowing limited percents use. e.g. width() will return number+%, not computed width
+ * @param  {Number|String=} num   Optional width number
+ * @param  {[type]} skipListeners Skip the 'resize' event trigger
+ * @return {vjs.Component|Number|String} Returns 'this' if dimension was set.
+ *   Otherwise it returns the dimension.
+ */
+vjs.Component.prototype.width = function(num, skipListeners){
+  return this.dimension('width', num, skipListeners);
+};
+
+/**
+ * Get or set the height of the player
+ * @param  {Number|String=} num     Optional new player height
+ * @param  {Boolean=} skipListeners Optional skip resize event trigger
+ * @return {vjs.Component|Number|String} The player, or the dimension
+ */
+vjs.Component.prototype.height = function(num, skipListeners){
+  return this.dimension('height', num, skipListeners);
+};
+
+/**
+ * Set both width and height at the same time.
+ * @param  {Number|String} width
+ * @param  {Number|String} height
+ * @return {vjs.Component}   The player.
+ */
+vjs.Component.prototype.dimensions = function(width, height){
+  // Skip resize listeners on width for optimization
+  return this.width(width, true).height(height);
+};
+
+/**
+ * Get or set width or height.
+ * All for an integer, integer + 'px' or integer + '%';
+ * Known issue: hidden elements. Hidden elements officially have a width of 0.
+ * So we're defaulting to the style.width value and falling back to computedStyle
+ * which has the hidden element issue.
+ * Info, but probably not an efficient fix:
+ * http://www.foliotek.com/devblog/getting-the-width-of-a-hidden-element-with-jquery-using-width/
+ * @param  {String=} widthOrHeight 'width' or 'height'
+ * @param  {Number|String=} num           New dimension
+ * @param  {Boolean=} skipListeners Skip resize event trigger
+ * @return {vjs.Component|Number|String} Return the player if setting a dimension.
+ *                                         Otherwise it returns the dimension.
+ */
+vjs.Component.prototype.dimension = function(widthOrHeight, num, skipListeners){
+  if (num !== undefined) {
+
+    // Check if using css width/height (% or px) and adjust
+    if ((''+num).indexOf('%') !== -1 || (''+num).indexOf('px') !== -1) {
+      this.el_.style[widthOrHeight] = num;
+    } else if (num === 'auto') {
+      this.el_.style[widthOrHeight] = '';
+    } else {
+      this.el_.style[widthOrHeight] = num+'px';
+    }
+
+    // skipListeners allows us to avoid triggering the resize event when setting both width and height
+    if (!skipListeners) { this.trigger('resize'); }
+
+    // Return component
+    return this;
+  }
+
+  // Not setting a value, so getting it
+  // Make sure element exists
+  if (!this.el_) return 0;
+
+  // Get dimension value from style
+  var val = this.el_.style[widthOrHeight];
+  var pxIndex = val.indexOf('px');
+  if (pxIndex !== -1) {
+    // Return the pixel value with no 'px'
+    return parseInt(val.slice(0,pxIndex), 10);
+
+  // No px so using % or no style was set, so falling back to offsetWidth/height
+  // If component has display:none, offset will return 0
+  // TODO: handle display:none and no dimension style using px
+  } else {
+
+    return parseInt(this.el_['offset'+vjs.capitalize(widthOrHeight)], 10);
+
+    // ComputedStyle version.
+    // Only difference is if the element is hidden it will return
+    // the percent value (e.g. '100%'')
+    // instead of zero like offsetWidth returns.
+    // var val = vjs.getComputedStyleValue(this.el_, widthOrHeight);
+    // var pxIndex = val.indexOf('px');
+
+    // if (pxIndex !== -1) {
+    //   return val.slice(0, pxIndex);
+    // } else {
+    //   return val;
+    // }
+  }
+};
+/* Button - Base class for all buttons
+================================================================================ */
+/**
+ * Base class for all buttons
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.Button = vjs.Component.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Component.call(this, player, options);
+
+    var touchstart = false;
+    this.on('touchstart', function() {
+      touchstart = true;
+    });
+    this.on('touchmove', function() {
+      touchstart = false;
+    });
+    var self = this;
+    this.on('touchend', function(event) {
+      if (touchstart) {
+        self.onClick(event);
+      }
+      event.preventDefault();
+      event.stopPropagation();
+    });
+
+    this.on('click', this.onClick);
+    this.on('focus', this.onFocus);
+    this.on('blur', this.onBlur);
+  }
+});
+
+vjs.Button.prototype.createEl = function(type, props){
+  // Add standard Aria and Tabindex info
+  props = vjs.obj.merge({
+    className: this.buildCSSClass(),
+    innerHTML: '<div class="vjs-control-content"><span class="vjs-control-text">' + (this.buttonText || 'Need Text') + '</span></div>',
+    role: 'button',
+    'aria-live': 'polite', // let the screen reader user know that the text of the button may change
+    tabIndex: 0
+  }, props);
+
+  return vjs.Component.prototype.createEl.call(this, type, props);
+};
+
+vjs.Button.prototype.buildCSSClass = function(){
+  // TODO: Change vjs-control to vjs-button?
+  return 'vjs-control ' + vjs.Component.prototype.buildCSSClass.call(this);
+};
+
+  // Click - Override with specific functionality for button
+vjs.Button.prototype.onClick = function(){};
+
+  // Focus - Add keyboard functionality to element
+vjs.Button.prototype.onFocus = function(){
+  vjs.on(document, 'keyup', vjs.bind(this, this.onKeyPress));
+};
+
+  // KeyPress (document level) - Trigger click when keys are pressed
+vjs.Button.prototype.onKeyPress = function(event){
+  // Check for space bar (32) or enter (13) keys
+  if (event.which == 32 || event.which == 13) {
+    event.preventDefault();
+    this.onClick();
+  }
+};
+
+// Blur - Remove keyboard triggers
+vjs.Button.prototype.onBlur = function(){
+  vjs.off(document, 'keyup', vjs.bind(this, this.onKeyPress));
+};
+/* Slider
+================================================================================ */
+/**
+ * Parent for seek bar and volume slider
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.Slider = vjs.Component.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Component.call(this, player, options);
+
+    // Set property names to bar and handle to match with the child Slider class is looking for
+    this.bar = this.getChild(this.options_['barName']);
+    this.handle = this.getChild(this.options_['handleName']);
+
+    player.on(this.playerEvent, vjs.bind(this, this.update));
+
+    this.on('mousedown', this.onMouseDown);
+    this.on('touchstart', this.onMouseDown);
+    this.on('focus', this.onFocus);
+    this.on('blur', this.onBlur);
+    this.on('click', this.onClick);
+
+    this.player_.on('controlsvisible', vjs.bind(this, this.update));
+
+    // This is actually to fix the volume handle position. http://twitter.com/#!/gerritvanaaken/status/159046254519787520
+    // this.player_.one('timeupdate', vjs.bind(this, this.update));
+
+    player.ready(vjs.bind(this, this.update));
+
+    this.boundEvents = {};
+  }
+});
+
+vjs.Slider.prototype.createEl = function(type, props) {
+  props = props || {};
+  // Add the slider element class to all sub classes
+  props.className = props.className + ' vjs-slider';
+  props = vjs.obj.merge({
+    role: 'slider',
+    'aria-valuenow': 0,
+    'aria-valuemin': 0,
+    'aria-valuemax': 100,
+    tabIndex: 0
+  }, props);
+
+  return vjs.Component.prototype.createEl.call(this, type, props);
+};
+
+vjs.Slider.prototype.onMouseDown = function(event){
+  event.preventDefault();
+  vjs.blockTextSelection();
+
+  this.boundEvents.move = vjs.bind(this, this.onMouseMove);
+  this.boundEvents.end = vjs.bind(this, this.onMouseUp);
+
+  vjs.on(document, 'mousemove', this.boundEvents.move);
+  vjs.on(document, 'mouseup', this.boundEvents.end);
+  vjs.on(document, 'touchmove', this.boundEvents.move);
+  vjs.on(document, 'touchend', this.boundEvents.end);
+
+  this.onMouseMove(event);
+};
+
+vjs.Slider.prototype.onMouseUp = function() {
+  vjs.unblockTextSelection();
+  vjs.off(document, 'mousemove', this.boundEvents.move, false);
+  vjs.off(document, 'mouseup', this.boundEvents.end, false);
+  vjs.off(document, 'touchmove', this.boundEvents.move, false);
+  vjs.off(document, 'touchend', this.boundEvents.end, false);
+
+  this.update();
+};
+
+vjs.Slider.prototype.update = function(){
+  // In VolumeBar init we have a setTimeout for update that pops and update to the end of the
+  // execution stack. The player is destroyed before then update will cause an error
+  if (!this.el_) return;
+
+  // If scrubbing, we could use a cached value to make the handle keep up with the user's mouse.
+  // On HTML5 browsers scrubbing is really smooth, but some flash players are slow, so we might want to utilize this later.
+  // var progress =  (this.player_.scrubbing) ? this.player_.getCache().currentTime / this.player_.duration() : this.player_.currentTime() / this.player_.duration();
+
+  var barProgress,
+      progress = this.getPercent(),
+      handle = this.handle,
+      bar = this.bar;
+
+  // Protect against no duration and other division issues
+  if (isNaN(progress)) { progress = 0; }
+
+  barProgress = progress;
+
+  // If there is a handle, we need to account for the handle in our calculation for progress bar
+  // so that it doesn't fall short of or extend past the handle.
+  if (handle) {
+
+    var box = this.el_,
+        boxWidth = box.offsetWidth,
+
+        handleWidth = handle.el().offsetWidth,
+
+        // The width of the handle in percent of the containing box
+        // In IE, widths may not be ready yet causing NaN
+        handlePercent = (handleWidth) ? handleWidth / boxWidth : 0,
+
+        // Get the adjusted size of the box, considering that the handle's center never touches the left or right side.
+        // There is a margin of half the handle's width on both sides.
+        boxAdjustedPercent = 1 - handlePercent,
+
+        // Adjust the progress that we'll use to set widths to the new adjusted box width
+        adjustedProgress = progress * boxAdjustedPercent;
+
+    // The bar does reach the left side, so we need to account for this in the bar's width
+    barProgress = adjustedProgress + (handlePercent / 2);
+
+    // Move the handle from the left based on the adjected progress
+    handle.el().style.left = vjs.round(adjustedProgress * 100, 2) + '%';
+  }
+
+  // Set the new bar width
+  bar.el().style.width = vjs.round(barProgress * 100, 2) + '%';
+};
+
+vjs.Slider.prototype.calculateDistance = function(event){
+  var el, box, boxX, boxY, boxW, boxH, handle, pageX, pageY;
+
+  el = this.el_;
+  box = vjs.findPosition(el);
+  boxW = boxH = el.offsetWidth;
+  handle = this.handle;
+
+  if (this.options_.vertical) {
+    boxY = box.top;
+
+    if (event.changedTouches) {
+      pageY = event.changedTouches[0].pageY;
+    } else {
+      pageY = event.pageY;
+    }
+
+    if (handle) {
+      var handleH = handle.el().offsetHeight;
+      // Adjusted X and Width, so handle doesn't go outside the bar
+      boxY = boxY + (handleH / 2);
+      boxH = boxH - handleH;
+    }
+
+    // Percent that the click is through the adjusted area
+    return Math.max(0, Math.min(1, ((boxY - pageY) + boxH) / boxH));
+
+  } else {
+    boxX = box.left;
+
+    if (event.changedTouches) {
+      pageX = event.changedTouches[0].pageX;
+    } else {
+      pageX = event.pageX;
+    }
+
+    if (handle) {
+      var handleW = handle.el().offsetWidth;
+
+      // Adjusted X and Width, so handle doesn't go outside the bar
+      boxX = boxX + (handleW / 2);
+      boxW = boxW - handleW;
+    }
+
+    // Percent that the click is through the adjusted area
+    return Math.max(0, Math.min(1, (pageX - boxX) / boxW));
+  }
+};
+
+vjs.Slider.prototype.onFocus = function(){
+  vjs.on(document, 'keyup', vjs.bind(this, this.onKeyPress));
+};
+
+vjs.Slider.prototype.onKeyPress = function(event){
+  if (event.which == 37) { // Left Arrow
+    event.preventDefault();
+    this.stepBack();
+  } else if (event.which == 39) { // Right Arrow
+    event.preventDefault();
+    this.stepForward();
+  }
+};
+
+vjs.Slider.prototype.onBlur = function(){
+  vjs.off(document, 'keyup', vjs.bind(this, this.onKeyPress));
+};
+
+/**
+ * Listener for click events on slider, used to prevent clicks
+ *   from bubbling up to parent elements like button menus.
+ * @param  {Object} event Event object
+ */
+vjs.Slider.prototype.onClick = function(event){
+  event.stopImmediatePropagation();
+  event.preventDefault();
+};
+
+/**
+ * SeekBar Behavior includes play progress bar, and seek handle
+ * Needed so it can determine seek position based on handle position/size
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.SliderHandle = vjs.Component.extend();
+
+/**
+ * Default value of the slider
+ * @type {Number}
+ */
+vjs.SliderHandle.prototype.defaultValue = 0;
+
+/** @inheritDoc */
+vjs.SliderHandle.prototype.createEl = function(type, props) {
+  props = props || {};
+  // Add the slider element class to all sub classes
+  props.className = props.className + ' vjs-slider-handle';
+  props = vjs.obj.merge({
+    innerHTML: '<span class="vjs-control-text">'+this.defaultValue+'</span>'
+  }, props);
+
+  return vjs.Component.prototype.createEl.call(this, 'div', props);
+};
+/* Menu
+================================================================================ */
+/**
+ * The base for text track and settings menu buttons.
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.Menu = vjs.Component.extend();
+
+/**
+ * Add a menu item to the menu
+ * @param {Object|String} component Component or component type to add
+ */
+vjs.Menu.prototype.addItem = function(component){
+  this.addChild(component);
+  component.on('click', vjs.bind(this, function(){
+    this.unlockShowing();
+  }));
+};
+
+/** @inheritDoc */
+vjs.Menu.prototype.createEl = function(){
+  var contentElType = this.options().contentElType || 'ul';
+  this.contentEl_ = vjs.createEl(contentElType, {
+    className: 'vjs-menu-content'
+  });
+  var el = vjs.Component.prototype.createEl.call(this, 'div', {
+    append: this.contentEl_,
+    className: 'vjs-menu'
+  });
+  el.appendChild(this.contentEl_);
+
+  // Prevent clicks from bubbling up. Needed for Menu Buttons,
+  // where a click on the parent is significant
+  vjs.on(el, 'click', function(event){
+    event.preventDefault();
+    event.stopImmediatePropagation();
+  });
+
+  return el;
+};
+
+/**
+ * Menu item
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.MenuItem = vjs.Button.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Button.call(this, player, options);
+    this.selected(options['selected']);
+  }
+});
+
+/** @inheritDoc */
+vjs.MenuItem.prototype.createEl = function(type, props){
+  return vjs.Button.prototype.createEl.call(this, 'li', vjs.obj.merge({
+    className: 'vjs-menu-item',
+    innerHTML: this.options_['label']
+  }, props));
+};
+
+/** @inheritDoc */
+vjs.MenuItem.prototype.onClick = function(){
+  this.selected(true);
+};
+
+/**
+ * Set this menu item as selected or not
+ * @param  {Boolean} selected
+ */
+vjs.MenuItem.prototype.selected = function(selected){
+  if (selected) {
+    this.addClass('vjs-selected');
+    this.el_.setAttribute('aria-selected',true);
+  } else {
+    this.removeClass('vjs-selected');
+    this.el_.setAttribute('aria-selected',false);
+  }
+};
+
+
+/**
+ * A button class with a popup menu
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.MenuButton = vjs.Button.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Button.call(this, player, options);
+
+    this.menu = this.createMenu();
+
+    // Add list to element
+    this.addChild(this.menu);
+
+    // Automatically hide empty menu buttons
+    if (this.items && this.items.length === 0) {
+      this.hide();
+    }
+
+    this.on('keyup', this.onKeyPress);
+    this.el_.setAttribute('aria-haspopup', true);
+    this.el_.setAttribute('role', 'button');
+  }
+});
+
+/**
+ * Track the state of the menu button
+ * @type {Boolean}
+ */
+vjs.MenuButton.prototype.buttonPressed_ = false;
+
+vjs.MenuButton.prototype.createMenu = function(){
+  var menu = new vjs.Menu(this.player_);
+
+  // Add a title list item to the top
+  if (this.options().title) {
+    menu.el().appendChild(vjs.createEl('li', {
+      className: 'vjs-menu-title',
+      innerHTML: vjs.capitalize(this.kind_),
+      tabindex: -1
+    }));
+  }
+
+  this.items = this.createItems();
+
+  if (this.items) {
+    // Add menu items to the menu
+    for (var i = 0; i < this.items.length; i++) {
+      menu.addItem(this.items[i]);
+    }
+  }
+
+  return menu;
+};
+
+/**
+ * Create the list of menu items. Specific to each subclass.
+ */
+vjs.MenuButton.prototype.createItems = function(){};
+
+/** @inheritDoc */
+vjs.MenuButton.prototype.buildCSSClass = function(){
+  return this.className + ' vjs-menu-button ' + vjs.Button.prototype.buildCSSClass.call(this);
+};
+
+// Focus - Add keyboard functionality to element
+// This function is not needed anymore. Instead, the keyboard functionality is handled by
+// treating the button as triggering a submenu. When the button is pressed, the submenu
+// appears. Pressing the button again makes the submenu disappear.
+vjs.MenuButton.prototype.onFocus = function(){};
+// Can't turn off list display that we turned on with focus, because list would go away.
+vjs.MenuButton.prototype.onBlur = function(){};
+
+vjs.MenuButton.prototype.onClick = function(){
+  // When you click the button it adds focus, which will show the menu indefinitely.
+  // So we'll remove focus when the mouse leaves the button.
+  // Focus is needed for tab navigation.
+  this.one('mouseout', vjs.bind(this, function(){
+    this.menu.unlockShowing();
+    this.el_.blur();
+  }));
+  if (this.buttonPressed_){
+    this.unpressButton();
+  } else {
+    this.pressButton();
+  }
+};
+
+vjs.MenuButton.prototype.onKeyPress = function(event){
+  event.preventDefault();
+
+  // Check for space bar (32) or enter (13) keys
+  if (event.which == 32 || event.which == 13) {
+    if (this.buttonPressed_){
+      this.unpressButton();
+    } else {
+      this.pressButton();
+    }
+  // Check for escape (27) key
+  } else if (event.which == 27){
+    if (this.buttonPressed_){
+      this.unpressButton();
+    }
+  }
+};
+
+vjs.MenuButton.prototype.pressButton = function(){
+  this.buttonPressed_ = true;
+  this.menu.lockShowing();
+  this.el_.setAttribute('aria-pressed', true);
+  if (this.items && this.items.length > 0) {
+    this.items[0].el().focus(); // set the focus to the title of the submenu
+  }
+};
+
+vjs.MenuButton.prototype.unpressButton = function(){
+  this.buttonPressed_ = false;
+  this.menu.unlockShowing();
+  this.el_.setAttribute('aria-pressed', false);
+};
+
+/**
+ * Main player class. A player instance is returned by _V_(id);
+ * @param {Element} tag        The original video tag used for configuring options
+ * @param {Object=} options    Player options
+ * @param {Function=} ready    Ready callback function
+ * @constructor
+ */
+vjs.Player = vjs.Component.extend({
+  /** @constructor */
+  init: function(tag, options, ready){
+    this.tag = tag; // Store the original tag used to set options
+
+    // Set Options
+    // The options argument overrides options set in the video tag
+    // which overrides globally set options.
+    // This latter part coincides with the load order
+    // (tag must exist before Player)
+    options = vjs.obj.merge(this.getTagSettings(tag), options);
+
+    // Cache for video property values.
+    this.cache_ = {};
+
+    // Set poster
+    this.poster_ = options['poster'];
+    // Set controls
+    this.controls_ = options['controls'];
+    // Use native controls for iOS and Android by default
+    //  until controls are more stable on those devices.
+    if (options['customControlsOnMobile'] !== true && (vjs.IS_IOS || vjs.IS_ANDROID)) {
+      tag.controls = options['controls'];
+      this.controls_ = false;
+    } else {
+      // Original tag settings stored in options
+      // now remove immediately so native controls don't flash.
+      tag.controls = false;
+    }
+
+    // Run base component initializing with new options.
+    // Builds the element through createEl()
+    // Inits and embeds any child components in opts
+    vjs.Component.call(this, this, options, ready);
+
+    // Firstplay event implimentation. Not sold on the event yet.
+    // Could probably just check currentTime==0?
+    this.one('play', function(e){
+      var fpEvent = { type: 'firstplay', target: this.el_ };
+      // Using vjs.trigger so we can check if default was prevented
+      var keepGoing = vjs.trigger(this.el_, fpEvent);
+
+      if (!keepGoing) {
+        e.preventDefault();
+        e.stopPropagation();
+        e.stopImmediatePropagation();
+      }
+    });
+
+    this.on('ended', this.onEnded);
+    this.on('play', this.onPlay);
+    this.on('firstplay', this.onFirstPlay);
+    this.on('pause', this.onPause);
+    this.on('progress', this.onProgress);
+    this.on('durationchange', this.onDurationChange);
+    this.on('error', this.onError);
+    this.on('fullscreenchange', this.onFullscreenChange);
+
+    // Make player easily findable by ID
+    vjs.players[this.id_] = this;
+
+    if (options['plugins']) {
+      vjs.obj.each(options['plugins'], function(key, val){
+        this[key](val);
+      }, this);
+    }
+  }
+});
+
+/**
+ * Player instance options, surfaced using vjs.options
+ * vjs.options = vjs.Player.prototype.options_
+ * Make changes in vjs.options, not here.
+ * All options should use string keys so they avoid
+ * renaming by closure compiler
+ * @type {Object}
+ * @private
+ */
+vjs.Player.prototype.options_ = vjs.options;
+
+vjs.Player.prototype.dispose = function(){
+  // this.isReady_ = false;
+
+  // Kill reference to this player
+  vjs.players[this.id_] = null;
+  if (this.tag && this.tag['player']) { this.tag['player'] = null; }
+  if (this.el_ && this.el_['player']) { this.el_['player'] = null; }
+
+  // Ensure that tracking progress and time progress will stop and plater deleted
+  this.stopTrackingProgress();
+  this.stopTrackingCurrentTime();
+
+  if (this.tech) { this.tech.dispose(); }
+
+  // Component dispose
+  vjs.Component.prototype.dispose.call(this);
+};
+
+vjs.Player.prototype.getTagSettings = function(tag){
+  var options = {
+    'sources': [],
+    'tracks': []
+  };
+
+  vjs.obj.merge(options, vjs.getAttributeValues(tag));
+
+  // Get tag children settings
+  if (tag.hasChildNodes()) {
+    var children, child, childName, i, j;
+
+    children = tag.childNodes;
+
+    for (i=0,j=children.length; i<j; i++) {
+      child = children[i];
+      // Change case needed: http://ejohn.org/blog/nodename-case-sensitivity/
+      childName = child.nodeName.toLowerCase();
+      if (childName === 'source') {
+        options['sources'].push(vjs.getAttributeValues(child));
+      } else if (childName === 'track') {
+        options['tracks'].push(vjs.getAttributeValues(child));
+      }
+    }
+  }
+
+  return options;
+};
+
+vjs.Player.prototype.createEl = function(){
+  var el = this.el_ = vjs.Component.prototype.createEl.call(this, 'div');
+  var tag = this.tag;
+
+  // Remove width/height attrs from tag so CSS can make it 100% width/height
+  tag.removeAttribute('width');
+  tag.removeAttribute('height');
+  // Empty video tag sources and tracks so the built-in player doesn't use them also.
+  // This may not be fast enough to stop HTML5 browsers from reading the tags
+  // so we'll need to turn off any default tracks if we're manually doing
+  // captions and subtitles. videoElement.textTracks
+  if (tag.hasChildNodes()) {
+    var nodes, nodesLength, i, node, nodeName, removeNodes;
+
+    nodes = tag.childNodes;
+    nodesLength = nodes.length;
+    removeNodes = [];
+
+    while (nodesLength--) {
+      node = nodes[nodesLength];
+      nodeName = node.nodeName.toLowerCase();
+      if (nodeName === 'source' || nodeName === 'track') {
+        removeNodes.push(node);
+      }
+    }
+
+    for (i=0; i<removeNodes.length; i++) {
+      tag.removeChild(removeNodes[i]);
+    }
+  }
+
+  // Make sure tag ID exists
+  tag.id = tag.id || 'vjs_video_' + vjs.guid++;
+
+  // Give video tag ID and class to player div
+  // ID will now reference player box, not the video tag
+  el.id = tag.id;
+  el.className = tag.className;
+
+  // Update tag id/class for use as HTML5 playback tech
+  // Might think we should do this after embedding in container so .vjs-tech class
+  // doesn't flash 100% width/height, but class only applies with .video-js parent
+  tag.id += '_html5_api';
+  tag.className = 'vjs-tech';
+
+  // Make player findable on elements
+  tag['player'] = el['player'] = this;
+  // Default state of video is paused
+  this.addClass('vjs-paused');
+
+  // Make box use width/height of tag, or rely on default implementation
+  // Enforce with CSS since width/height attrs don't work on divs
+  this.width(this.options_['width'], true); // (true) Skip resize listener on load
+  this.height(this.options_['height'], true);
+
+  // Wrap video tag in div (el/box) container
+  if (tag.parentNode) {
+    tag.parentNode.insertBefore(el, tag);
+  }
+  vjs.insertFirst(tag, el); // Breaks iPhone, fixed in HTML5 setup.
+
+  return el;
+};
+
+// /* Media Technology (tech)
+// ================================================================================ */
+// Load/Create an instance of playback technlogy including element and API methods
+// And append playback element in player div.
+vjs.Player.prototype.loadTech = function(techName, source){
+
+  // Pause and remove current playback technology
+  if (this.tech) {
+    this.unloadTech();
+
+  // If the first time loading, HTML5 tag will exist but won't be initialized
+  // So we need to remove it if we're not loading HTML5
+  } else if (techName !== 'Html5' && this.tag) {
+    this.el_.removeChild(this.tag);
+    this.tag['player'] = null;
+    this.tag = null;
+  }
+
+  this.techName = techName;
+
+  // Turn off API access because we're loading a new tech that might load asynchronously
+  this.isReady_ = false;
+
+  var techReady = function(){
+    this.player_.triggerReady();
+
+    // Manually track progress in cases where the browser/flash player doesn't report it.
+    if (!this.features.progressEvents) {
+      this.player_.manualProgressOn();
+    }
+
+    // Manually track timeudpates in cases where the browser/flash player doesn't report it.
+    if (!this.features.timeupdateEvents) {
+      this.player_.manualTimeUpdatesOn();
+    }
+  };
+
+  // Grab tech-specific options from player options and add source and parent element to use.
+  var techOptions = vjs.obj.merge({ 'source': source, 'parentEl': this.el_ }, this.options_[techName.toLowerCase()]);
+
+  if (source) {
+    if (source.src == this.cache_.src && this.cache_.currentTime > 0) {
+      techOptions['startTime'] = this.cache_.currentTime;
+    }
+
+    this.cache_.src = source.src;
+  }
+
+  // Initialize tech instance
+  this.tech = new window['videojs'][techName](this, techOptions);
+
+  this.tech.ready(techReady);
+};
+
+vjs.Player.prototype.unloadTech = function(){
+  this.isReady_ = false;
+  this.tech.dispose();
+
+  // Turn off any manual progress or timeupdate tracking
+  if (this.manualProgress) { this.manualProgressOff(); }
+
+  if (this.manualTimeUpdates) { this.manualTimeUpdatesOff(); }
+
+  this.tech = false;
+};
+
+// There's many issues around changing the size of a Flash (or other plugin) object.
+// First is a plugin reload issue in Firefox that has been around for 11 years: https://bugzilla.mozilla.org/show_bug.cgi?id=90268
+// Then with the new fullscreen API, Mozilla and webkit browsers will reload the flash object after going to fullscreen.
+// To get around this, we're unloading the tech, caching source and currentTime values, and reloading the tech once the plugin is resized.
+// reloadTech: function(betweenFn){
+//   vjs.log('unloadingTech')
+//   this.unloadTech();
+//   vjs.log('unloadedTech')
+//   if (betweenFn) { betweenFn.call(); }
+//   vjs.log('LoadingTech')
+//   this.loadTech(this.techName, { src: this.cache_.src })
+//   vjs.log('loadedTech')
+// },
+
+/* Fallbacks for unsupported event types
+================================================================================ */
+// Manually trigger progress events based on changes to the buffered amount
+// Many flash players and older HTML5 browsers don't send progress or progress-like events
+vjs.Player.prototype.manualProgressOn = function(){
+  this.manualProgress = true;
+
+  // Trigger progress watching when a source begins loading
+  this.trackProgress();
+
+  // Watch for a native progress event call on the tech element
+  // In HTML5, some older versions don't support the progress event
+  // So we're assuming they don't, and turning off manual progress if they do.
+  // As opposed to doing user agent detection
+  this.tech.one('progress', function(){
+
+    // Update known progress support for this playback technology
+    this.features.progressEvents = true;
+
+    // Turn off manual progress tracking
+    this.player_.manualProgressOff();
+  });
+};
+
+vjs.Player.prototype.manualProgressOff = function(){
+  this.manualProgress = false;
+  this.stopTrackingProgress();
+};
+
+vjs.Player.prototype.trackProgress = function(){
+
+  this.progressInterval = setInterval(vjs.bind(this, function(){
+    // Don't trigger unless buffered amount is greater than last time
+    // log(this.cache_.bufferEnd, this.buffered().end(0), this.duration())
+    /* TODO: update for multiple buffered regions */
+    if (this.cache_.bufferEnd < this.buffered().end(0)) {
+      this.trigger('progress');
+    } else if (this.bufferedPercent() == 1) {
+      this.stopTrackingProgress();
+      this.trigger('progress'); // Last update
+    }
+  }), 500);
+};
+vjs.Player.prototype.stopTrackingProgress = function(){ clearInterval(this.progressInterval); };
+
+/* Time Tracking -------------------------------------------------------------- */
+vjs.Player.prototype.manualTimeUpdatesOn = function(){
+  this.manualTimeUpdates = true;
+
+  this.on('play', this.trackCurrentTime);
+  this.on('pause', this.stopTrackingCurrentTime);
+  // timeupdate is also called by .currentTime whenever current time is set
+
+  // Watch for native timeupdate event
+  this.tech.one('timeupdate', function(){
+    // Update known progress support for this playback technology
+    this.features.timeupdateEvents = true;
+    // Turn off manual progress tracking
+    this.player_.manualTimeUpdatesOff();
+  });
+};
+
+vjs.Player.prototype.manualTimeUpdatesOff = function(){
+  this.manualTimeUpdates = false;
+  this.stopTrackingCurrentTime();
+  this.off('play', this.trackCurrentTime);
+  this.off('pause', this.stopTrackingCurrentTime);
+};
+
+vjs.Player.prototype.trackCurrentTime = function(){
+  if (this.currentTimeInterval) { this.stopTrackingCurrentTime(); }
+  this.currentTimeInterval = setInterval(vjs.bind(this, function(){
+    this.trigger('timeupdate');
+  }), 250); // 42 = 24 fps // 250 is what Webkit uses // FF uses 15
+};
+
+// Turn off play progress tracking (when paused or dragging)
+vjs.Player.prototype.stopTrackingCurrentTime = function(){ clearInterval(this.currentTimeInterval); };
+
+// /* Player event handlers (how the player reacts to certain events)
+// ================================================================================ */
+vjs.Player.prototype.onEnded = function(){
+  if (this.options_['loop']) {
+    this.currentTime(0);
+    this.play();
+  }
+};
+
+vjs.Player.prototype.onPlay = function(){
+  vjs.removeClass(this.el_, 'vjs-paused');
+  vjs.addClass(this.el_, 'vjs-playing');
+};
+
+vjs.Player.prototype.onFirstPlay = function(){
+    //If the first starttime attribute is specified
+    //then we will start at the given offset in seconds
+    if(this.options_['starttime']){
+      this.currentTime(this.options_['starttime']);
+    }
+};
+
+vjs.Player.prototype.onPause = function(){
+  vjs.removeClass(this.el_, 'vjs-playing');
+  vjs.addClass(this.el_, 'vjs-paused');
+};
+
+vjs.Player.prototype.onProgress = function(){
+  // Add custom event for when source is finished downloading.
+  if (this.bufferedPercent() == 1) {
+    this.trigger('loadedalldata');
+  }
+};
+
+// Update duration with durationchange event
+// Allows for cacheing value instead of asking player each time.
+vjs.Player.prototype.onDurationChange = function(){
+  this.duration(this.techGet('duration'));
+};
+
+vjs.Player.prototype.onError = function(e) {
+  vjs.log('Video Error', e);
+};
+
+vjs.Player.prototype.onFullscreenChange = function() {
+  if (this.isFullScreen) {
+    this.addClass('vjs-fullscreen');
+  } else {
+    this.removeClass('vjs-fullscreen');
+  }
+};
+
+// /* Player API
+// ================================================================================ */
+
+/**
+ * Object for cached values.
+ * @private
+ */
+vjs.Player.prototype.cache_;
+
+vjs.Player.prototype.getCache = function(){
+  return this.cache_;
+};
+
+// Pass values to the playback tech
+vjs.Player.prototype.techCall = function(method, arg){
+  // If it's not ready yet, call method when it is
+  if (this.tech && !this.tech.isReady_) {
+    this.tech.ready(function(){
+      this[method](arg);
+    });
+
+  // Otherwise call method now
+  } else {
+    try {
+      this.tech[method](arg);
+    } catch(e) {
+      vjs.log(e);
+      throw e;
+    }
+  }
+};
+
+// Get calls can't wait for the tech, and sometimes don't need to.
+vjs.Player.prototype.techGet = function(method){
+
+  // Make sure there is a tech
+  // if (!this.tech) {
+  //   return;
+  // }
+
+  if (this.tech.isReady_) {
+
+    // Flash likes to die and reload when you hide or reposition it.
+    // In these cases the object methods go away and we get errors.
+    // When that happens we'll catch the errors and inform tech that it's not ready any more.
+    try {
+      return this.tech[method]();
+    } catch(e) {
+      // When building additional tech libs, an expected method may not be defined yet
+      if (this.tech[method] === undefined) {
+        vjs.log('Video.js: ' + method + ' method not defined for '+this.techName+' playback technology.', e);
+      } else {
+        // When a method isn't available on the object it throws a TypeError
+        if (e.name == 'TypeError') {
+          vjs.log('Video.js: ' + method + ' unavailable on '+this.techName+' playback technology element.', e);
+          this.tech.isReady_ = false;
+        } else {
+          vjs.log(e);
+        }
+      }
+      throw e;
+    }
+  }
+
+  return;
+};
+
+/**
+ * Start media playback
+ * http://dev.w3.org/html5/spec/video.html#dom-media-play
+ * We're triggering the 'play' event here instead of relying on the
+ * media element to allow using event.preventDefault() to stop
+ * play from happening if desired. Usecase: preroll ads.
+ */
+vjs.Player.prototype.play = function(){
+  this.techCall('play');
+  return this;
+};
+
+// http://dev.w3.org/html5/spec/video.html#dom-media-pause
+vjs.Player.prototype.pause = function(){
+  this.techCall('pause');
+  return this;
+};
+
+// http://dev.w3.org/html5/spec/video.html#dom-media-paused
+// The initial state of paused should be true (in Safari it's actually false)
+vjs.Player.prototype.paused = function(){
+  return (this.techGet('paused') === false) ? false : true;
+};
+
+// http://dev.w3.org/html5/spec/video.html#dom-media-currenttime
+vjs.Player.prototype.currentTime = function(seconds){
+  if (seconds !== undefined) {
+
+    // Cache the last set value for smoother scrubbing.
+    this.cache_.lastSetCurrentTime = seconds;
+
+    this.techCall('setCurrentTime', seconds);
+
+    // Improve the accuracy of manual timeupdates
+    if (this.manualTimeUpdates) { this.trigger('timeupdate'); }
+
+    return this;
+  }
+
+  // Cache last currentTime and return
+  // Default to 0 seconds
+  return this.cache_.currentTime = (this.techGet('currentTime') || 0);
+};
+
+// http://dev.w3.org/html5/spec/video.html#dom-media-duration
+// Duration should return NaN if not available. ParseFloat will turn false-ish values to NaN.
+vjs.Player.prototype.duration = function(seconds){
+  if (seconds !== undefined) {
+
+    // Cache the last set value for optimiized scrubbing (esp. Flash)
+    this.cache_.duration = parseFloat(seconds);
+
+    return this;
+  }
+
+  return this.cache_.duration;
+};
+
+// Calculates how much time is left. Not in spec, but useful.
+vjs.Player.prototype.remainingTime = function(){
+  return this.duration() - this.currentTime();
+};
+
+// http://dev.w3.org/html5/spec/video.html#dom-media-buffered
+// Buffered returns a timerange object.
+// Kind of like an array of portions of the video that have been downloaded.
+// So far no browsers return more than one range (portion)
+vjs.Player.prototype.buffered = function(){
+  var buffered = this.techGet('buffered'),
+      start = 0,
+      // Default end to 0 and store in values
+      end = this.cache_.bufferEnd = this.cache_.bufferEnd || 0;
+
+  if (buffered && buffered.length > 0 && buffered.end(0) !== end) {
+    end = buffered.end(0);
+    // Storing values allows them be overridden by setBufferedFromProgress
+    this.cache_.bufferEnd = end;
+  }
+
+  return vjs.createTimeRange(start, end);
+};
+
+// Calculates amount of buffer is full. Not in spec but useful.
+vjs.Player.prototype.bufferedPercent = function(){
+  return (this.duration()) ? this.buffered().end(0) / this.duration() : 0;
+};
+
+// http://dev.w3.org/html5/spec/video.html#dom-media-volume
+vjs.Player.prototype.volume = function(percentAsDecimal){
+  var vol;
+
+  if (percentAsDecimal !== undefined) {
+    vol = Math.max(0, Math.min(1, parseFloat(percentAsDecimal))); // Force value to between 0 and 1
+    this.cache_.volume = vol;
+    this.techCall('setVolume', vol);
+    vjs.setLocalStorage('volume', vol);
+    return this;
+  }
+
+  // Default to 1 when returning current volume.
+  vol = parseFloat(this.techGet('volume'));
+  return (isNaN(vol)) ? 1 : vol;
+};
+
+// http://dev.w3.org/html5/spec/video.html#attr-media-muted
+vjs.Player.prototype.muted = function(muted){
+  if (muted !== undefined) {
+    this.techCall('setMuted', muted);
+    return this;
+  }
+  return this.techGet('muted') || false; // Default to false
+};
+
+// Check if current tech can support native fullscreen (e.g. with built in controls lik iOS, so not our flash swf)
+vjs.Player.prototype.supportsFullScreen = function(){ return this.techGet('supportsFullScreen') || false; };
+
+// Turn on fullscreen (or window) mode
+vjs.Player.prototype.requestFullScreen = function(){
+  var requestFullScreen = vjs.support.requestFullScreen;
+  this.isFullScreen = true;
+
+  if (requestFullScreen) {
+    // the browser supports going fullscreen at the element level so we can
+    // take the controls fullscreen as well as the video
+
+    // Trigger fullscreenchange event after change
+    // We have to specifically add this each time, and remove
+    // when cancelling fullscreen. Otherwise if there's multiple
+    // players on a page, they would all be reacting to the same fullscreen
+    // events
+    vjs.on(document, requestFullScreen.eventName, vjs.bind(this, function(e){
+      this.isFullScreen = document[requestFullScreen.isFullScreen];
+
+      // If cancelling fullscreen, remove event listener.
+      if (this.isFullScreen === false) {
+        vjs.off(document, requestFullScreen.eventName, arguments.callee);
+      }
+
+      this.trigger('fullscreenchange');
+    }));
+
+    this.el_[requestFullScreen.requestFn]();
+
+  } else if (this.tech.supportsFullScreen()) {
+    // we can't take the video.js controls fullscreen but we can go fullscreen
+    // with native controls
+    this.techCall('enterFullScreen');
+  } else {
+    // fullscreen isn't supported so we'll just stretch the video element to
+    // fill the viewport
+    this.enterFullWindow();
+    this.trigger('fullscreenchange');
+  }
+
+  return this;
+};
+
+vjs.Player.prototype.cancelFullScreen = function(){
+  var requestFullScreen = vjs.support.requestFullScreen;
+  this.isFullScreen = false;
+
+  // Check for browser element fullscreen support
+  if (requestFullScreen) {
+    document[requestFullScreen.cancelFn]();
+  } else if (this.tech.supportsFullScreen()) {
+   this.techCall('exitFullScreen');
+  } else {
+   this.exitFullWindow();
+   this.trigger('fullscreenchange');
+  }
+
+  return this;
+};
+
+// When fullscreen isn't supported we can stretch the video container to as wide as the browser will let us.
+vjs.Player.prototype.enterFullWindow = function(){
+  this.isFullWindow = true;
+
+  // Storing original doc overflow value to return to when fullscreen is off
+  this.docOrigOverflow = document.documentElement.style.overflow;
+
+  // Add listener for esc key to exit fullscreen
+  vjs.on(document, 'keydown', vjs.bind(this, this.fullWindowOnEscKey));
+
+  // Hide any scroll bars
+  document.documentElement.style.overflow = 'hidden';
+
+  // Apply fullscreen styles
+  vjs.addClass(document.body, 'vjs-full-window');
+
+  this.trigger('enterFullWindow');
+};
+vjs.Player.prototype.fullWindowOnEscKey = function(event){
+  if (event.keyCode === 27) {
+    if (this.isFullScreen === true) {
+      this.cancelFullScreen();
+    } else {
+      this.exitFullWindow();
+    }
+  }
+};
+
+vjs.Player.prototype.exitFullWindow = function(){
+  this.isFullWindow = false;
+  vjs.off(document, 'keydown', this.fullWindowOnEscKey);
+
+  // Unhide scroll bars.
+  document.documentElement.style.overflow = this.docOrigOverflow;
+
+  // Remove fullscreen styles
+  vjs.removeClass(document.body, 'vjs-full-window');
+
+  // Resize the box, controller, and poster to original sizes
+  // this.positionAll();
+  this.trigger('exitFullWindow');
+};
+
+vjs.Player.prototype.selectSource = function(sources){
+
+  // Loop through each playback technology in the options order
+  for (var i=0,j=this.options_['techOrder'];i<j.length;i++) {
+    var techName = vjs.capitalize(j[i]),
+        tech = window['videojs'][techName];
+
+    // Check if the browser supports this technology
+    if (tech.isSupported()) {
+      // Loop through each source object
+      for (var a=0,b=sources;a<b.length;a++) {
+        var source = b[a];
+
+        // Check if source can be played with this technology
+        if (tech['canPlaySource'](source)) {
+          return { source: source, tech: techName };
+        }
+      }
+    }
+  }
+
+  return false;
+};
+
+// src is a pretty powerful function
+// If you pass it an array of source objects, it will find the best source to play and use that object.src
+//   If the new source requires a new playback technology, it will switch to that.
+// If you pass it an object, it will set the source to object.src
+// If you pass it anything else (url string) it will set the video source to that
+vjs.Player.prototype.src = function(source){
+  // Case: Array of source objects to choose from and pick the best to play
+  if (source instanceof Array) {
+
+    var sourceTech = this.selectSource(source),
+        techName;
+
+    if (sourceTech) {
+        source = sourceTech.source;
+        techName = sourceTech.tech;
+
+      // If this technology is already loaded, set source
+      if (techName == this.techName) {
+        this.src(source); // Passing the source object
+      // Otherwise load this technology with chosen source
+      } else {
+        this.loadTech(techName, source);
+      }
+    } else {
+      this.el_.appendChild(vjs.createEl('p', {
+        innerHTML: 'Sorry, no compatible source and playback technology were found for this video. Try using another browser like <a href="http://bit.ly/ccMUEC">Chrome</a> or download the latest <a href="http://adobe.ly/mwfN1">Adobe Flash Player</a>.'
+      }));
+    }
+
+  // Case: Source object { src: '', type: '' ... }
+  } else if (source instanceof Object) {
+
+    if (window['videojs'][this.techName]['canPlaySource'](source)) {
+      this.src(source.src);
+    } else {
+      // Send through tech loop to check for a compatible technology.
+      this.src([source]);
+    }
+
+  // Case: URL String (http://myvideo...)
+  } else {
+    // Cache for getting last set source
+    this.cache_.src = source;
+
+    if (!this.isReady_) {
+      this.ready(function(){
+        this.src(source);
+      });
+    } else {
+      this.techCall('src', source);
+      if (this.options_['preload'] == 'auto') {
+        this.load();
+      }
+      if (this.options_['autoplay']) {
+        this.play();
+      }
+    }
+  }
+  return this;
+};
+
+// Begin loading the src data
+// http://dev.w3.org/html5/spec/video.html#dom-media-load
+vjs.Player.prototype.load = function(){
+  this.techCall('load');
+  return this;
+};
+
+// http://dev.w3.org/html5/spec/video.html#dom-media-currentsrc
+vjs.Player.prototype.currentSrc = function(){
+  return this.techGet('currentSrc') || this.cache_.src || '';
+};
+
+// Attributes/Options
+vjs.Player.prototype.preload = function(value){
+  if (value !== undefined) {
+    this.techCall('setPreload', value);
+    this.options_['preload'] = value;
+    return this;
+  }
+  return this.techGet('preload');
+};
+vjs.Player.prototype.autoplay = function(value){
+  if (value !== undefined) {
+    this.techCall('setAutoplay', value);
+    this.options_['autoplay'] = value;
+    return this;
+  }
+  return this.techGet('autoplay', value);
+};
+vjs.Player.prototype.loop = function(value){
+  if (value !== undefined) {
+    this.techCall('setLoop', value);
+    this.options_['loop'] = value;
+    return this;
+  }
+  return this.techGet('loop');
+};
+
+/**
+ * The url of the poster image source.
+ * @type {String}
+ * @private
+ */
+vjs.Player.prototype.poster_;
+
+/**
+ * Get or set the poster image source url.
+ * @param  {String} src Poster image source URL
+ * @return {String}    Poster image source URL or null
+ */
+vjs.Player.prototype.poster = function(src){
+  if (src !== undefined) {
+    this.poster_ = src;
+  }
+  return this.poster_;
+};
+
+/**
+ * Whether or not the controls are showing
+ * @type {Boolean}
+ * @private
+ */
+vjs.Player.prototype.controls_;
+
+/**
+ * Get or set whether or not the controls are showing.
+ * @param  {Boolean} controls Set controls to showing or not
+ * @return {Boolean}    Controls are showing
+ */
+vjs.Player.prototype.controls = function(controls){
+  if (controls !== undefined) {
+    // Don't trigger a change event unless it actually changed
+    if (this.controls_ !== controls) {
+      this.controls_ = !!controls; // force boolean
+      this.trigger('controlschange');
+    }
+  }
+  return this.controls_;
+};
+
+vjs.Player.prototype.error = function(){ return this.techGet('error'); };
+vjs.Player.prototype.ended = function(){ return this.techGet('ended'); };
+
+// Methods to add support for
+// networkState: function(){ return this.techCall('networkState'); },
+// readyState: function(){ return this.techCall('readyState'); },
+// seeking: function(){ return this.techCall('seeking'); },
+// initialTime: function(){ return this.techCall('initialTime'); },
+// startOffsetTime: function(){ return this.techCall('startOffsetTime'); },
+// played: function(){ return this.techCall('played'); },
+// seekable: function(){ return this.techCall('seekable'); },
+// videoTracks: function(){ return this.techCall('videoTracks'); },
+// audioTracks: function(){ return this.techCall('audioTracks'); },
+// videoWidth: function(){ return this.techCall('videoWidth'); },
+// videoHeight: function(){ return this.techCall('videoHeight'); },
+// defaultPlaybackRate: function(){ return this.techCall('defaultPlaybackRate'); },
+// playbackRate: function(){ return this.techCall('playbackRate'); },
+// mediaGroup: function(){ return this.techCall('mediaGroup'); },
+// controller: function(){ return this.techCall('controller'); },
+// defaultMuted: function(){ return this.techCall('defaultMuted'); }
+
+// TODO
+// currentSrcList: the array of sources including other formats and bitrates
+// playList: array of source lists in order of playback
+
+// RequestFullscreen API
+(function(){
+  var prefix, requestFS, div;
+
+  div = document.createElement('div');
+
+  requestFS = {};
+
+  // Current W3C Spec
+  // http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#api
+  // Mozilla Draft: https://wiki.mozilla.org/Gecko:FullScreenAPI#fullscreenchange_event
+  // New: https://dvcs.w3.org/hg/fullscreen/raw-file/529a67b8d9f3/Overview.html
+  if (div.cancelFullscreen !== undefined) {
+    requestFS.requestFn = 'requestFullscreen';
+    requestFS.cancelFn = 'exitFullscreen';
+    requestFS.eventName = 'fullscreenchange';
+    requestFS.isFullScreen = 'fullScreen';
+
+  // Webkit (Chrome/Safari) and Mozilla (Firefox) have working implementations
+  // that use prefixes and vary slightly from the new W3C spec. Specifically,
+  // using 'exit' instead of 'cancel', and lowercasing the 'S' in Fullscreen.
+  // Other browsers don't have any hints of which version they might follow yet,
+  // so not going to try to predict by looping through all prefixes.
+  } else {
+
+    if (document.mozCancelFullScreen) {
+      prefix = 'moz';
+      requestFS.isFullScreen = prefix + 'FullScreen';
+    } else {
+      prefix = 'webkit';
+      requestFS.isFullScreen = prefix + 'IsFullScreen';
+    }
+
+    if (div[prefix + 'RequestFullScreen']) {
+      requestFS.requestFn = prefix + 'RequestFullScreen';
+      requestFS.cancelFn = prefix + 'CancelFullScreen';
+    }
+    requestFS.eventName = prefix + 'fullscreenchange';
+  }
+
+  if (document[requestFS.cancelFn]) {
+    vjs.support.requestFullScreen = requestFS;
+  }
+
+})();
+/**
+ * Container of main controls
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.ControlBar = vjs.Component.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Component.call(this, player, options);
+
+    if (!player.controls()) {
+      this.disable();
+    }
+
+    player.one('play', vjs.bind(this, function(){
+      var touchstart,
+        fadeIn = vjs.bind(this, this.fadeIn),
+        fadeOut = vjs.bind(this, this.fadeOut);
+
+      this.fadeIn();
+
+      if ( !('ontouchstart' in window) ) {
+        this.player_.on('mouseover', fadeIn);
+        this.player_.on('mouseout', fadeOut);
+        this.player_.on('pause', vjs.bind(this, this.lockShowing));
+        this.player_.on('play', vjs.bind(this, this.unlockShowing));
+      }
+
+      touchstart = false;
+      this.player_.on('touchstart', function() {
+        touchstart = true;
+      });
+      this.player_.on('touchmove', function() {
+        touchstart = false;
+      });
+      this.player_.on('touchend', vjs.bind(this, function(event) {
+        var idx;
+        if (touchstart) {
+          idx = this.el().className.search('fade-in');
+          if (idx !== -1) {
+            this.fadeOut();
+          } else {
+            this.fadeIn();
+          }
+        }
+        touchstart = false;
+
+        if (!this.player_.paused()) {
+          event.preventDefault();
+        }
+      }));
+    }));
+  }
+});
+
+vjs.ControlBar.prototype.options_ = {
+  loadEvent: 'play',
+  children: {
+    'playToggle': {},
+    'currentTimeDisplay': {},
+    'timeDivider': {},
+    'durationDisplay': {},
+    'remainingTimeDisplay': {},
+    'progressControl': {},
+    'fullscreenToggle': {},
+    'volumeControl': {},
+    'muteToggle': {}
+    // 'volumeMenuButton': {}
+  }
+};
+
+vjs.ControlBar.prototype.createEl = function(){
+  return vjs.createEl('div', {
+    className: 'vjs-control-bar'
+  });
+};
+
+vjs.ControlBar.prototype.fadeIn = function(){
+  vjs.Component.prototype.fadeIn.call(this);
+  this.player_.trigger('controlsvisible');
+};
+
+vjs.ControlBar.prototype.fadeOut = function(){
+  vjs.Component.prototype.fadeOut.call(this);
+  this.player_.trigger('controlshidden');
+};/**
+ * Button to toggle between play and pause
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.PlayToggle = vjs.Button.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Button.call(this, player, options);
+
+    player.on('play', vjs.bind(this, this.onPlay));
+    player.on('pause', vjs.bind(this, this.onPause));
+  }
+});
+
+vjs.PlayToggle.prototype.buttonText = 'Play';
+
+vjs.PlayToggle.prototype.buildCSSClass = function(){
+  return 'vjs-play-control ' + vjs.Button.prototype.buildCSSClass.call(this);
+};
+
+  // OnClick - Toggle between play and pause
+vjs.PlayToggle.prototype.onClick = function(){
+  if (this.player_.paused()) {
+    this.player_.play();
+  } else {
+    this.player_.pause();
+  }
+};
+
+  // OnPlay - Add the vjs-playing class to the element so it can change appearance
+vjs.PlayToggle.prototype.onPlay = function(){
+  vjs.removeClass(this.el_, 'vjs-paused');
+  vjs.addClass(this.el_, 'vjs-playing');
+  this.el_.children[0].children[0].innerHTML = 'Pause'; // change the button text to "Pause"
+};
+
+  // OnPause - Add the vjs-paused class to the element so it can change appearance
+vjs.PlayToggle.prototype.onPause = function(){
+  vjs.removeClass(this.el_, 'vjs-playing');
+  vjs.addClass(this.el_, 'vjs-paused');
+  this.el_.children[0].children[0].innerHTML = 'Play'; // change the button text to "Play"
+};/**
+ * Displays the current time
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.CurrentTimeDisplay = vjs.Component.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Component.call(this, player, options);
+
+    player.on('timeupdate', vjs.bind(this, this.updateContent));
+  }
+});
+
+vjs.CurrentTimeDisplay.prototype.createEl = function(){
+  var el = vjs.Component.prototype.createEl.call(this, 'div', {
+    className: 'vjs-current-time vjs-time-controls vjs-control'
+  });
+
+  this.content = vjs.createEl('div', {
+    className: 'vjs-current-time-display',
+    innerHTML: '<span class="vjs-control-text">Current Time </span>' + '0:00', // label the current time for screen reader users
+    'aria-live': 'off' // tell screen readers not to automatically read the time as it changes
+  });
+
+  el.appendChild(vjs.createEl('div').appendChild(this.content));
+  return el;
+};
+
+vjs.CurrentTimeDisplay.prototype.updateContent = function(){
+  // Allows for smooth scrubbing, when player can't keep up.
+  var time = (this.player_.scrubbing) ? this.player_.getCache().currentTime : this.player_.currentTime();
+  this.content.innerHTML = '<span class="vjs-control-text">Current Time </span>' + vjs.formatTime(time, this.player_.duration());
+};
+
+/**
+ * Displays the duration
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.DurationDisplay = vjs.Component.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Component.call(this, player, options);
+
+    player.on('timeupdate', vjs.bind(this, this.updateContent)); // this might need to be changes to 'durationchange' instead of 'timeupdate' eventually, however the durationchange event fires before this.player_.duration() is set, so the value cannot be written out using this method. Once the order of durationchange and this.player_.duration() being set is figured out, this can be updated.
+  }
+});
+
+vjs.DurationDisplay.prototype.createEl = function(){
+  var el = vjs.Component.prototype.createEl.call(this, 'div', {
+    className: 'vjs-duration vjs-time-controls vjs-control'
+  });
+
+  this.content = vjs.createEl('div', {
+    className: 'vjs-duration-display',
+    innerHTML: '<span class="vjs-control-text">Duration Time </span>' + '0:00', // label the duration time for screen reader users
+    'aria-live': 'off' // tell screen readers not to automatically read the time as it changes
+  });
+
+  el.appendChild(vjs.createEl('div').appendChild(this.content));
+  return el;
+};
+
+vjs.DurationDisplay.prototype.updateContent = function(){
+  if (this.player_.duration()) {
+      this.content.innerHTML = '<span class="vjs-control-text">Duration Time </span>' + vjs.formatTime(this.player_.duration()); // label the duration time for screen reader users
+  }
+};
+
+/**
+ * Time Separator (Not used in main skin, but still available, and could be used as a 'spare element')
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.TimeDivider = vjs.Component.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Component.call(this, player, options);
+  }
+});
+
+vjs.TimeDivider.prototype.createEl = function(){
+  return vjs.Component.prototype.createEl.call(this, 'div', {
+    className: 'vjs-time-divider',
+    innerHTML: '<div><span>/</span></div>'
+  });
+};
+
+/**
+ * Displays the time left in the video
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.RemainingTimeDisplay = vjs.Component.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Component.call(this, player, options);
+
+    player.on('timeupdate', vjs.bind(this, this.updateContent));
+  }
+});
+
+vjs.RemainingTimeDisplay.prototype.createEl = function(){
+  var el = vjs.Component.prototype.createEl.call(this, 'div', {
+    className: 'vjs-remaining-time vjs-time-controls vjs-control'
+  });
+
+  this.content = vjs.createEl('div', {
+    className: 'vjs-remaining-time-display',
+    innerHTML: '<span class="vjs-control-text">Remaining Time </span>' + '-0:00', // label the remaining time for screen reader users
+    'aria-live': 'off' // tell screen readers not to automatically read the time as it changes
+  });
+
+  el.appendChild(vjs.createEl('div').appendChild(this.content));
+  return el;
+};
+
+vjs.RemainingTimeDisplay.prototype.updateContent = function(){
+  if (this.player_.duration()) {
+      if (this.player_.duration()) {
+          this.content.innerHTML = '<span class="vjs-control-text">Remaining Time </span>' + '-'+ vjs.formatTime(this.player_.remainingTime());
+      }
+  }
+
+  // Allows for smooth scrubbing, when player can't keep up.
+  // var time = (this.player_.scrubbing) ? this.player_.getCache().currentTime : this.player_.currentTime();
+  // this.content.innerHTML = vjs.formatTime(time, this.player_.duration());
+};/**
+ * Toggle fullscreen video
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.FullscreenToggle = vjs.Button.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Button.call(this, player, options);
+  }
+});
+
+vjs.FullscreenToggle.prototype.buttonText = 'Fullscreen';
+
+vjs.FullscreenToggle.prototype.buildCSSClass = function(){
+  return 'vjs-fullscreen-control ' + vjs.Button.prototype.buildCSSClass.call(this);
+};
+
+vjs.FullscreenToggle.prototype.onClick = function(){
+  if (!this.player_.isFullScreen) {
+    this.player_.requestFullScreen();
+    this.el_.children[0].children[0].innerHTML = 'Non-Fullscreen'; // change the button text to "Non-Fullscreen"
+  } else {
+    this.player_.cancelFullScreen();
+    this.el_.children[0].children[0].innerHTML = 'Fullscreen'; // change the button to "Fullscreen"
+  }
+};/**
+ * Seek, Load Progress, and Play Progress
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.ProgressControl = vjs.Component.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Component.call(this, player, options);
+  }
+});
+
+vjs.ProgressControl.prototype.options_ = {
+  children: {
+    'seekBar': {}
+  }
+};
+
+vjs.ProgressControl.prototype.createEl = function(){
+  return vjs.Component.prototype.createEl.call(this, 'div', {
+    className: 'vjs-progress-control vjs-control'
+  });
+};
+
+/**
+ * Seek Bar and holder for the progress bars
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.SeekBar = vjs.Slider.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Slider.call(this, player, options);
+    player.on('timeupdate', vjs.bind(this, this.updateARIAAttributes));
+    player.ready(vjs.bind(this, this.updateARIAAttributes));
+  }
+});
+
+vjs.SeekBar.prototype.options_ = {
+  children: {
+    'loadProgressBar': {},
+    'playProgressBar': {},
+    'seekHandle': {}
+  },
+  'barName': 'playProgressBar',
+  'handleName': 'seekHandle'
+};
+
+vjs.SeekBar.prototype.playerEvent = 'timeupdate';
+
+vjs.SeekBar.prototype.createEl = function(){
+  return vjs.Slider.prototype.createEl.call(this, 'div', {
+    className: 'vjs-progress-holder',
+    'aria-label': 'video progress bar'
+  });
+};
+
+vjs.SeekBar.prototype.updateARIAAttributes = function(){
+    // Allows for smooth scrubbing, when player can't keep up.
+    var time = (this.player_.scrubbing) ? this.player_.getCache().currentTime : this.player_.currentTime();
+    this.el_.setAttribute('aria-valuenow',vjs.round(this.getPercent()*100, 2)); // machine readable value of progress bar (percentage complete)
+    this.el_.setAttribute('aria-valuetext',vjs.formatTime(time, this.player_.duration())); // human readable value of progress bar (time complete)
+};
+
+vjs.SeekBar.prototype.getPercent = function(){
+  return this.player_.currentTime() / this.player_.duration();
+};
+
+vjs.SeekBar.prototype.onMouseDown = function(event){
+  vjs.Slider.prototype.onMouseDown.call(this, event);
+
+  this.player_.scrubbing = true;
+
+  this.videoWasPlaying = !this.player_.paused();
+  this.player_.pause();
+};
+
+vjs.SeekBar.prototype.onMouseMove = function(event){
+  var newTime = this.calculateDistance(event) * this.player_.duration();
+
+  // Don't let video end while scrubbing.
+  if (newTime == this.player_.duration()) { newTime = newTime - 0.1; }
+
+  // Set new time (tell player to seek to new time)
+  this.player_.currentTime(newTime);
+};
+
+vjs.SeekBar.prototype.onMouseUp = function(event){
+  vjs.Slider.prototype.onMouseUp.call(this, event);
+
+  this.player_.scrubbing = false;
+  if (this.videoWasPlaying) {
+    this.player_.play();
+  }
+};
+
+vjs.SeekBar.prototype.stepForward = function(){
+  this.player_.currentTime(this.player_.currentTime() + 5); // more quickly fast forward for keyboard-only users
+};
+
+vjs.SeekBar.prototype.stepBack = function(){
+  this.player_.currentTime(this.player_.currentTime() - 5); // more quickly rewind for keyboard-only users
+};
+
+
+/**
+ * Shows load progres
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.LoadProgressBar = vjs.Component.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Component.call(this, player, options);
+    player.on('progress', vjs.bind(this, this.update));
+  }
+});
+
+vjs.LoadProgressBar.prototype.createEl = function(){
+  return vjs.Component.prototype.createEl.call(this, 'div', {
+    className: 'vjs-load-progress',
+    innerHTML: '<span class="vjs-control-text">Loaded: 0%</span>'
+  });
+};
+
+vjs.LoadProgressBar.prototype.update = function(){
+  if (this.el_.style) { this.el_.style.width = vjs.round(this.player_.bufferedPercent() * 100, 2) + '%'; }
+};
+
+
+/**
+ * Shows play progress
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.PlayProgressBar = vjs.Component.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Component.call(this, player, options);
+  }
+});
+
+vjs.PlayProgressBar.prototype.createEl = function(){
+  return vjs.Component.prototype.createEl.call(this, 'div', {
+    className: 'vjs-play-progress',
+    innerHTML: '<span class="vjs-control-text">Progress: 0%</span>'
+  });
+};
+
+/**
+ * SeekBar component includes play progress bar, and seek handle
+ * Needed so it can determine seek position based on handle position/size
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.SeekHandle = vjs.SliderHandle.extend();
+
+/** @inheritDoc */
+vjs.SeekHandle.prototype.defaultValue = '00:00';
+
+/** @inheritDoc */
+vjs.SeekHandle.prototype.createEl = function(){
+  return vjs.SliderHandle.prototype.createEl.call(this, 'div', {
+    className: 'vjs-seek-handle'
+  });
+};/**
+ * Control the volume
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.VolumeControl = vjs.Component.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Component.call(this, player, options);
+
+    // hide volume controls when they're not supported by the current tech
+    if (player.tech && player.tech.features && player.tech.features.volumeControl === false) {
+      this.addClass('vjs-hidden');
+    }
+    player.on('loadstart', vjs.bind(this, function(){
+      if (player.tech.features && player.tech.features.volumeControl === false) {
+        this.addClass('vjs-hidden');
+      } else {
+        this.removeClass('vjs-hidden');
+      }
+    }));
+  }
+});
+
+vjs.VolumeControl.prototype.options_ = {
+  children: {
+    'volumeBar': {}
+  }
+};
+
+vjs.VolumeControl.prototype.createEl = function(){
+  return vjs.Component.prototype.createEl.call(this, 'div', {
+    className: 'vjs-volume-control vjs-control'
+  });
+};
+
+/**
+ * Contains volume level
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.VolumeBar = vjs.Slider.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Slider.call(this, player, options);
+    player.on('volumechange', vjs.bind(this, this.updateARIAAttributes));
+    player.ready(vjs.bind(this, this.updateARIAAttributes));
+    setTimeout(vjs.bind(this, this.update), 0); // update when elements is in DOM
+  }
+});
+
+vjs.VolumeBar.prototype.updateARIAAttributes = function(){
+  // Current value of volume bar as a percentage
+  this.el_.setAttribute('aria-valuenow',vjs.round(this.player_.volume()*100, 2));
+  this.el_.setAttribute('aria-valuetext',vjs.round(this.player_.volume()*100, 2)+'%');
+};
+
+vjs.VolumeBar.prototype.options_ = {
+  children: {
+    'volumeLevel': {},
+    'volumeHandle': {}
+  },
+  'barName': 'volumeLevel',
+  'handleName': 'volumeHandle'
+};
+
+vjs.VolumeBar.prototype.playerEvent = 'volumechange';
+
+vjs.VolumeBar.prototype.createEl = function(){
+  return vjs.Slider.prototype.createEl.call(this, 'div', {
+    className: 'vjs-volume-bar',
+    'aria-label': 'volume level'
+  });
+};
+
+vjs.VolumeBar.prototype.onMouseMove = function(event) {
+  this.player_.volume(this.calculateDistance(event));
+};
+
+vjs.VolumeBar.prototype.getPercent = function(){
+  if (this.player_.muted()) {
+    return 0;
+  } else {
+    return this.player_.volume();
+  }
+};
+
+vjs.VolumeBar.prototype.stepForward = function(){
+  this.player_.volume(this.player_.volume() + 0.1);
+};
+
+vjs.VolumeBar.prototype.stepBack = function(){
+  this.player_.volume(this.player_.volume() - 0.1);
+};
+
+/**
+ * Shows volume level
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.VolumeLevel = vjs.Component.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Component.call(this, player, options);
+  }
+});
+
+vjs.VolumeLevel.prototype.createEl = function(){
+  return vjs.Component.prototype.createEl.call(this, 'div', {
+    className: 'vjs-volume-level',
+    innerHTML: '<span class="vjs-control-text"></span>'
+  });
+};
+
+/**
+ * Change volume level
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+ vjs.VolumeHandle = vjs.SliderHandle.extend();
+
+ /** @inheritDoc */
+ vjs.VolumeHandle.prototype.defaultValue = '00:00';
+
+ /** @inheritDoc */
+ vjs.VolumeHandle.prototype.createEl = function(){
+   return vjs.SliderHandle.prototype.createEl.call(this, 'div', {
+     className: 'vjs-volume-handle'
+   });
+ };/**
+ * Mute the audio
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.MuteToggle = vjs.Button.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Button.call(this, player, options);
+
+    player.on('volumechange', vjs.bind(this, this.update));
+
+    // hide mute toggle if the current tech doesn't support volume control
+    if (player.tech && player.tech.features && player.tech.features.volumeControl === false) {
+      this.addClass('vjs-hidden');
+    }
+    player.on('loadstart', vjs.bind(this, function(){
+      if (player.tech.features && player.tech.features.volumeControl === false) {
+        this.addClass('vjs-hidden');
+      } else {
+        this.removeClass('vjs-hidden');
+      }
+    }));
+  }
+});
+
+vjs.MuteToggle.prototype.createEl = function(){
+  return vjs.Button.prototype.createEl.call(this, 'div', {
+    className: 'vjs-mute-control vjs-control',
+    innerHTML: '<div><span class="vjs-control-text">Mute</span></div>'
+  });
+};
+
+vjs.MuteToggle.prototype.onClick = function(){
+  this.player_.muted( this.player_.muted() ? false : true );
+};
+
+vjs.MuteToggle.prototype.update = function(){
+  var vol = this.player_.volume(),
+      level = 3;
+
+  if (vol === 0 || this.player_.muted()) {
+    level = 0;
+  } else if (vol < 0.33) {
+    level = 1;
+  } else if (vol < 0.67) {
+    level = 2;
+  }
+
+  // Don't rewrite the button text if the actual text doesn't change.
+  // This causes unnecessary and confusing information for screen reader users.
+  // This check is needed because this function gets called every time the volume level is changed.
+  if(this.player_.muted()){
+      if(this.el_.children[0].children[0].innerHTML!='Unmute'){
+          this.el_.children[0].children[0].innerHTML = 'Unmute'; // change the button text to "Unmute"
+      }
+  } else {
+      if(this.el_.children[0].children[0].innerHTML!='Mute'){
+          this.el_.children[0].children[0].innerHTML = 'Mute'; // change the button text to "Mute"
+      }
+  }
+
+  /* TODO improve muted icon classes */
+  for (var i = 0; i < 4; i++) {
+    vjs.removeClass(this.el_, 'vjs-vol-'+i);
+  }
+  vjs.addClass(this.el_, 'vjs-vol-'+level);
+};/**
+ * Menu button with a popup for showing the volume slider.
+ * @constructor
+ */
+vjs.VolumeMenuButton = vjs.MenuButton.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.MenuButton.call(this, player, options);
+
+    // Same listeners as MuteToggle
+    player.on('volumechange', vjs.bind(this, this.update));
+
+    // hide mute toggle if the current tech doesn't support volume control
+    if (player.tech && player.tech.features && player.tech.features.volumeControl === false) {
+      this.addClass('vjs-hidden');
+    }
+    player.on('loadstart', vjs.bind(this, function(){
+      if (player.tech.features && player.tech.features.volumeControl === false) {
+        this.addClass('vjs-hidden');
+      } else {
+        this.removeClass('vjs-hidden');
+      }
+    }));
+    this.addClass('vjs-menu-button');
+  }
+});
+
+vjs.VolumeMenuButton.prototype.createMenu = function(){
+  var menu = new vjs.Menu(this.player_, {
+    contentElType: 'div'
+  });
+  var vc = new vjs.VolumeBar(this.player_, vjs.obj.merge({vertical: true}, this.options_.volumeBar));
+  menu.addChild(vc);
+  return menu;
+};
+
+vjs.VolumeMenuButton.prototype.onClick = function(){
+  vjs.MuteToggle.prototype.onClick.call(this);
+  vjs.MenuButton.prototype.onClick.call(this);
+};
+
+vjs.VolumeMenuButton.prototype.createEl = function(){
+  return vjs.Button.prototype.createEl.call(this, 'div', {
+    className: 'vjs-volume-menu-button vjs-menu-button vjs-control',
+    innerHTML: '<div><span class="vjs-control-text">Mute</span></div>'
+  });
+};
+vjs.VolumeMenuButton.prototype.update = vjs.MuteToggle.prototype.update;
+/* Poster Image
+================================================================================ */
+/**
+ * Poster image. Shows before the video plays.
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.PosterImage = vjs.Button.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Button.call(this, player, options);
+
+    if (!player.poster() || !player.controls()) {
+      this.hide();
+    }
+
+    player.on('play', vjs.bind(this, this.hide));
+  }
+});
+
+vjs.PosterImage.prototype.createEl = function(){
+  var el = vjs.createEl('div', {
+        className: 'vjs-poster',
+
+        // Don't want poster to be tabbable.
+        tabIndex: -1
+      }),
+      poster = this.player_.poster();
+
+  if (poster) {
+    if ('backgroundSize' in el.style) {
+      el.style.backgroundImage = 'url("' + poster + '")';
+    } else {
+      el.appendChild(vjs.createEl('img', { src: poster }));
+    }
+  }
+
+  return el;
+};
+
+vjs.PosterImage.prototype.onClick = function(){
+  this.player_.play();
+};
+/* Loading Spinner
+================================================================================ */
+/**
+ * Loading spinner for waiting events
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.LoadingSpinner = vjs.Component.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Component.call(this, player, options);
+
+    player.on('canplay', vjs.bind(this, this.hide));
+    player.on('canplaythrough', vjs.bind(this, this.hide));
+    player.on('playing', vjs.bind(this, this.hide));
+    player.on('seeked', vjs.bind(this, this.hide));
+
+    player.on('seeking', vjs.bind(this, this.show));
+
+    // in some browsers seeking does not trigger the 'playing' event,
+    // so we also need to trap 'seeked' if we are going to set a
+    // 'seeking' event
+    player.on('seeked', vjs.bind(this, this.hide));
+
+    player.on('error', vjs.bind(this, this.show));
+
+    // Not showing spinner on stalled any more. Browsers may stall and then not trigger any events that would remove the spinner.
+    // Checked in Chrome 16 and Safari 5.1.2. http://help.videojs.com/discussions/problems/883-why-is-the-download-progress-showing
+    // player.on('stalled', vjs.bind(this, this.show));
+
+    player.on('waiting', vjs.bind(this, this.show));
+  }
+});
+
+vjs.LoadingSpinner.prototype.createEl = function(){
+  return vjs.Component.prototype.createEl.call(this, 'div', {
+    className: 'vjs-loading-spinner'
+  });
+};
+/* Big Play Button
+================================================================================ */
+/**
+ * Initial play button. Shows before the video has played.
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.BigPlayButton = vjs.Button.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Button.call(this, player, options);
+
+    if (!player.controls()) {
+      this.hide();
+    }
+
+    player.on('play', vjs.bind(this, this.hide));
+    // player.on('ended', vjs.bind(this, this.show));
+  }
+});
+
+vjs.BigPlayButton.prototype.createEl = function(){
+  return vjs.Button.prototype.createEl.call(this, 'div', {
+    className: 'vjs-big-play-button',
+    innerHTML: '<span></span>',
+    'aria-label': 'play video'
+  });
+};
+
+vjs.BigPlayButton.prototype.onClick = function(){
+  // Go back to the beginning if big play button is showing at the end.
+  // Have to check for current time otherwise it might throw a 'not ready' error.
+  //if(this.player_.currentTime()) {
+    //this.player_.currentTime(0);
+  //}
+  this.player_.play();
+};
+/**
+ * @fileoverview Media Technology Controller - Base class for media playback technology controllers like Flash and HTML5
+ */
+
+/**
+ * Base class for media (HTML5 Video, Flash) controllers
+ * @param {vjs.Player|Object} player  Central player instance
+ * @param {Object=} options Options object
+ * @constructor
+ */
+vjs.MediaTechController = vjs.Component.extend({
+  /** @constructor */
+  init: function(player, options, ready){
+    vjs.Component.call(this, player, options, ready);
+
+    // Make playback element clickable
+    // this.addEvent('click', this.proxy(this.onClick));
+
+    // player.triggerEvent('techready');
+  }
+});
+
+// destroy: function(){},
+// createElement: function(){},
+
+/**
+ * Handle a click on the media element. By default will play the media.
+ *
+ * On android browsers, having this toggle play state interferes with being
+ * able to toggle the controls and toggling play state with the play button
+ */
+vjs.MediaTechController.prototype.onClick = (function(){
+  if (vjs.IS_ANDROID) {
+    return function () {};
+  } else {
+    return function () {
+      if (this.player_.controls()) {
+        if (this.player_.paused()) {
+          this.player_.play();
+        } else {
+          this.player_.pause();
+        }
+      }
+    };
+  }
+})();
+
+vjs.MediaTechController.prototype.features = {
+  volumeControl: true,
+
+  // Resizing plugins using request fullscreen reloads the plugin
+  fullscreenResize: false,
+
+  // Optional events that we can manually mimic with timers
+  // currently not triggered by video-js-swf
+  progressEvents: false,
+  timeupdateEvents: false
+};
+
+vjs.media = {};
+
+/**
+ * List of default API methods for any MediaTechController
+ * @type {String}
+ */
+vjs.media.ApiMethods = 'play,pause,paused,currentTime,setCurrentTime,duration,buffered,volume,setVolume,muted,setMuted,width,height,supportsFullScreen,enterFullScreen,src,load,currentSrc,preload,setPreload,autoplay,setAutoplay,loop,setLoop,error,networkState,readyState,seeking,initialTime,startOffsetTime,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks,defaultPlaybackRate,playbackRate,mediaGroup,controller,controls,defaultMuted'.split(',');
+// Create placeholder methods for each that warn when a method isn't supported by the current playback technology
+
+function createMethod(methodName){
+  return function(){
+    throw new Error('The "'+methodName+'" method is not available on the playback technology\'s API');
+  };
+}
+
+for (var i = vjs.media.ApiMethods.length - 1; i >= 0; i--) {
+  var methodName = vjs.media.ApiMethods[i];
+  vjs.MediaTechController.prototype[vjs.media.ApiMethods[i]] = createMethod(methodName);
+}
+/**
+ * @fileoverview HTML5 Media Controller - Wrapper for HTML5 Media API
+ */
+
+/**
+ * HTML5 Media Controller - Wrapper for HTML5 Media API
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @param {Function=} ready
+ * @constructor
+ */
+vjs.Html5 = vjs.MediaTechController.extend({
+  /** @constructor */
+  init: function(player, options, ready){
+    // volume cannot be changed from 1 on iOS
+    this.features.volumeControl = vjs.Html5.canControlVolume();
+
+    // In iOS, if you move a video element in the DOM, it breaks video playback.
+    this.features.movingMediaElementInDOM = !vjs.IS_IOS;
+
+    // HTML video is able to automatically resize when going to fullscreen
+    this.features.fullscreenResize = true;
+
+    vjs.MediaTechController.call(this, player, options, ready);
+
+    var source = options['source'];
+
+    // If the element source is already set, we may have missed the loadstart event, and want to trigger it.
+    // We don't want to set the source again and interrupt playback.
+    if (source && this.el_.currentSrc == source.src) {
+      player.trigger('loadstart');
+
+    // Otherwise set the source if one was provided.
+    } else if (source) {
+      this.el_.src = source.src;
+    }
+
+    // Chrome and Safari both have issues with autoplay.
+    // In Safari (5.1.1), when we move the video element into the container div, autoplay doesn't work.
+    // In Chrome (15), if you have autoplay + a poster + no controls, the video gets hidden (but audio plays)
+    // This fixes both issues. Need to wait for API, so it updates displays correctly
+    player.ready(function(){
+      if (this.tag && this.options_['autoplay'] && this.paused()) {
+        delete this.tag['poster']; // Chrome Fix. Fixed in Chrome v16.
+        this.play();
+      }
+    });
+
+    this.on('click', this.onClick);
+
+    this.setupTriggers();
+
+    this.triggerReady();
+  }
+});
+
+vjs.Html5.prototype.dispose = function(){
+  vjs.MediaTechController.prototype.dispose.call(this);
+};
+
+vjs.Html5.prototype.createEl = function(){
+  var player = this.player_,
+      // If possible, reuse original tag for HTML5 playback technology element
+      el = player.tag,
+      newEl;
+
+  // Check if this browser supports moving the element into the box.
+  // On the iPhone video will break if you move the element,
+  // So we have to create a brand new element.
+  if (!el || this.features.movingMediaElementInDOM === false) {
+
+    // If the original tag is still there, remove it.
+    if (el) {
+      el['player'] = null;
+      player.tag = null;
+      player.el().removeChild(el);
+      el = el.cloneNode(false);
+    } else {
+      el = vjs.createEl('video', {
+        id:player.id() + '_html5_api',
+        className:'vjs-tech'
+      });
+    }
+    // associate the player with the new tag
+    el['player'] = player;
+
+    vjs.insertFirst(el, player.el());
+  }
+
+  // Update specific tag settings, in case they were overridden
+  var attrs = ['autoplay','preload','loop','muted'];
+  for (var i = attrs.length - 1; i >= 0; i--) {
+    var attr = attrs[i];
+    if (player.options_[attr] !== null) {
+      el[attr] = player.options_[attr];
+    }
+  }
+
+  return el;
+  // jenniisawesome = true;
+};
+
+// Make video events trigger player events
+// May seem verbose here, but makes other APIs possible.
+vjs.Html5.prototype.setupTriggers = function(){
+  for (var i = vjs.Html5.Events.length - 1; i >= 0; i--) {
+    vjs.on(this.el_, vjs.Html5.Events[i], vjs.bind(this.player_, this.eventHandler));
+  }
+};
+// Triggers removed using this.off when disposed
+
+vjs.Html5.prototype.eventHandler = function(e){
+  this.trigger(e);
+
+  // No need for media events to bubble up.
+  e.stopPropagation();
+};
+
+
+vjs.Html5.prototype.play = function(){ this.el_.play(); };
+vjs.Html5.prototype.pause = function(){ this.el_.pause(); };
+vjs.Html5.prototype.paused = function(){ return this.el_.paused; };
+
+vjs.Html5.prototype.currentTime = function(){ return this.el_.currentTime; };
+vjs.Html5.prototype.setCurrentTime = function(seconds){
+  try {
+    this.el_.currentTime = seconds;
+  } catch(e) {
+    vjs.log(e, 'Video is not ready. (Video.js)');
+    // this.warning(VideoJS.warnings.videoNotReady);
+  }
+};
+
+vjs.Html5.prototype.duration = function(){ return this.el_.duration || 0; };
+vjs.Html5.prototype.buffered = function(){ return this.el_.buffered; };
+
+vjs.Html5.prototype.volume = function(){ return this.el_.volume; };
+vjs.Html5.prototype.setVolume = function(percentAsDecimal){ this.el_.volume = percentAsDecimal; };
+vjs.Html5.prototype.muted = function(){ return this.el_.muted; };
+vjs.Html5.prototype.setMuted = function(muted){ this.el_.muted = muted; };
+
+vjs.Html5.prototype.width = function(){ return this.el_.offsetWidth; };
+vjs.Html5.prototype.height = function(){ return this.el_.offsetHeight; };
+
+vjs.Html5.prototype.supportsFullScreen = function(){
+  if (typeof this.el_.webkitEnterFullScreen == 'function') {
+
+    // Seems to be broken in Chromium/Chrome && Safari in Leopard
+    if (/Android/.test(vjs.USER_AGENT) || !/Chrome|Mac OS X 10.5/.test(vjs.USER_AGENT)) {
+      return true;
+    }
+  }
+  return false;
+};
+
+vjs.Html5.prototype.enterFullScreen = function(){
+  var video = this.el_;
+  if (video.paused && video.networkState <= video.HAVE_METADATA) {
+    // attempt to prime the video element for programmatic access
+    // this isn't necessary on the desktop but shouldn't hurt
+    this.el_.play();
+
+    // playing and pausing synchronously during the transition to fullscreen
+    // can get iOS ~6.1 devices into a play/pause loop
+    setTimeout(function(){
+      video.pause();
+      video.webkitEnterFullScreen();
+    }, 0);
+  } else {
+    video.webkitEnterFullScreen();
+  }
+};
+vjs.Html5.prototype.exitFullScreen = function(){
+  this.el_.webkitExitFullScreen();
+};
+vjs.Html5.prototype.src = function(src){ this.el_.src = src; };
+vjs.Html5.prototype.load = function(){ this.el_.load(); };
+vjs.Html5.prototype.currentSrc = function(){ return this.el_.currentSrc; };
+
+vjs.Html5.prototype.preload = function(){ return this.el_.preload; };
+vjs.Html5.prototype.setPreload = function(val){ this.el_.preload = val; };
+vjs.Html5.prototype.autoplay = function(){ return this.el_.autoplay; };
+vjs.Html5.prototype.setAutoplay = function(val){ this.el_.autoplay = val; };
+vjs.Html5.prototype.loop = function(){ return this.el_.loop; };
+vjs.Html5.prototype.setLoop = function(val){ this.el_.loop = val; };
+
+vjs.Html5.prototype.error = function(){ return this.el_.error; };
+  // networkState: function(){ return this.el_.networkState; },
+  // readyState: function(){ return this.el_.readyState; },
+vjs.Html5.prototype.seeking = function(){ return this.el_.seeking; };
+  // initialTime: function(){ return this.el_.initialTime; },
+  // startOffsetTime: function(){ return this.el_.startOffsetTime; },
+  // played: function(){ return this.el_.played; },
+  // seekable: function(){ return this.el_.seekable; },
+vjs.Html5.prototype.ended = function(){ return this.el_.ended; };
+  // videoTracks: function(){ return this.el_.videoTracks; },
+  // audioTracks: function(){ return this.el_.audioTracks; },
+  // videoWidth: function(){ return this.el_.videoWidth; },
+  // videoHeight: function(){ return this.el_.videoHeight; },
+  // textTracks: function(){ return this.el_.textTracks; },
+  // defaultPlaybackRate: function(){ return this.el_.defaultPlaybackRate; },
+  // playbackRate: function(){ return this.el_.playbackRate; },
+  // mediaGroup: function(){ return this.el_.mediaGroup; },
+  // controller: function(){ return this.el_.controller; },
+vjs.Html5.prototype.defaultMuted = function(){ return this.el_.defaultMuted; };
+
+/* HTML5 Support Testing ---------------------------------------------------- */
+
+vjs.Html5.isSupported = function(){
+  return !!vjs.TEST_VID.canPlayType;
+};
+
+vjs.Html5.canPlaySource = function(srcObj){
+  // IE9 on Windows 7 without MediaPlayer throws an error here
+  // https://github.com/videojs/video.js/issues/519
+  try {
+    return !!vjs.TEST_VID.canPlayType(srcObj.type);
+  } catch(e) {
+    return '';
+  }
+  // TODO: Check Type
+  // If no Type, check ext
+  // Check Media Type
+};
+
+vjs.Html5.canControlVolume = function(){
+  var volume =  vjs.TEST_VID.volume;
+  vjs.TEST_VID.volume = (volume / 2) + 0.1;
+  return volume !== vjs.TEST_VID.volume;
+};
+
+// List of all HTML5 events (various uses).
+vjs.Html5.Events = 'loadstart,suspend,abort,error,emptied,stalled,loadedmetadata,loadeddata,canplay,canplaythrough,playing,waiting,seeking,seeked,ended,durationchange,timeupdate,progress,play,pause,ratechange,volumechange'.split(',');
+
+
+// HTML5 Feature detection and Device Fixes --------------------------------- //
+
+  // Override Android 2.2 and less canPlayType method which is broken
+if (vjs.IS_OLD_ANDROID) {
+  document.createElement('video').constructor.prototype.canPlayType = function(type){
+    return (type && type.toLowerCase().indexOf('video/mp4') != -1) ? 'maybe' : '';
+  };
+}
+/**
+ * @fileoverview VideoJS-SWF - Custom Flash Player with HTML5-ish API
+ * https://github.com/zencoder/video-js-swf
+ * Not using setupTriggers. Using global onEvent func to distribute events
+ */
+
+/**
+ * HTML5 Media Controller - Wrapper for HTML5 Media API
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @param {Function=} ready
+ * @constructor
+ */
+vjs.Flash = vjs.MediaTechController.extend({
+  /** @constructor */
+  init: function(player, options, ready){
+    vjs.MediaTechController.call(this, player, options, ready);
+
+    var source = options['source'],
+
+        // Which element to embed in
+        parentEl = options['parentEl'],
+
+        // Create a temporary element to be replaced by swf object
+        placeHolder = this.el_ = vjs.createEl('div', { id: player.id() + '_temp_flash' }),
+
+        // Generate ID for swf object
+        objId = player.id()+'_flash_api',
+
+        // Store player options in local var for optimization
+        // TODO: switch to using player methods instead of options
+        // e.g. player.autoplay();
+        playerOptions = player.options_,
+
+        // Merge default flashvars with ones passed in to init
+        flashVars = vjs.obj.merge({
+
+          // SWF Callback Functions
+          'readyFunction': 'videojs.Flash.onReady',
+          'eventProxyFunction': 'videojs.Flash.onEvent',
+          'errorEventProxyFunction': 'videojs.Flash.onError',
+
+          // Player Settings
+          'autoplay': playerOptions.autoplay,
+          'preload': playerOptions.preload,
+          'loop': playerOptions.loop,
+          'muted': playerOptions.muted
+
+        }, options['flashVars']),
+
+        // Merge default parames with ones passed in
+        params = vjs.obj.merge({
+          'wmode': 'opaque', // Opaque is needed to overlay controls, but can affect playback performance
+          'bgcolor': '#000000' // Using bgcolor prevents a white flash when the object is loading
+        }, options['params']),
+
+        // Merge default attributes with ones passed in
+        attributes = vjs.obj.merge({
+          'id': objId,
+          'name': objId, // Both ID and Name needed or swf to identifty itself
+          'class': 'vjs-tech'
+        }, options['attributes'])
+    ;
+
+    // If source was supplied pass as a flash var.
+    if (source) {
+      flashVars['src'] = encodeURIComponent(vjs.getAbsoluteURL(source.src));
+    }
+
+    // Add placeholder to player div
+    vjs.insertFirst(placeHolder, parentEl);
+
+    // Having issues with Flash reloading on certain page actions (hide/resize/fullscreen) in certain browsers
+    // This allows resetting the playhead when we catch the reload
+    if (options['startTime']) {
+      this.ready(function(){
+        this.load();
+        this.play();
+        this.currentTime(options['startTime']);
+      });
+    }
+
+    // Flash iFrame Mode
+    // In web browsers there are multiple instances where changing the parent element or visibility of a plugin causes the plugin to reload.
+    // - Firefox just about always. https://bugzilla.mozilla.org/show_bug.cgi?id=90268 (might be fixed by version 13)
+    // - Webkit when hiding the plugin
+    // - Webkit and Firefox when using requestFullScreen on a parent element
+    // Loading the flash plugin into a dynamically generated iFrame gets around most of these issues.
+    // Issues that remain include hiding the element and requestFullScreen in Firefox specifically
+
+    // There's on particularly annoying issue with this method which is that Firefox throws a security error on an offsite Flash object loaded into a dynamically created iFrame.
+    // Even though the iframe was inserted into a page on the web, Firefox + Flash considers it a local app trying to access an internet file.
+    // I tried mulitple ways of setting the iframe src attribute but couldn't find a src that worked well. Tried a real/fake source, in/out of domain.
+    // Also tried a method from stackoverflow that caused a security error in all browsers. http://stackoverflow.com/questions/2486901/how-to-set-document-domain-for-a-dynamically-generated-iframe
+    // In the end the solution I found to work was setting the iframe window.location.href right before doing a document.write of the Flash object.
+    // The only downside of this it seems to trigger another http request to the original page (no matter what's put in the href). Not sure why that is.
+
+    // NOTE (2012-01-29): Cannot get Firefox to load the remote hosted SWF into a dynamically created iFrame
+    // Firefox 9 throws a security error, unleess you call location.href right before doc.write.
+    //    Not sure why that even works, but it causes the browser to look like it's continuously trying to load the page.
+    // Firefox 3.6 keeps calling the iframe onload function anytime I write to it, causing an endless loop.
+
+    if (options['iFrameMode'] === true && !vjs.IS_FIREFOX) {
+
+      // Create iFrame with vjs-tech class so it's 100% width/height
+      var iFrm = vjs.createEl('iframe', {
+        'id': objId + '_iframe',
+        'name': objId + '_iframe',
+        'className': 'vjs-tech',
+        'scrolling': 'no',
+        'marginWidth': 0,
+        'marginHeight': 0,
+        'frameBorder': 0
+      });
+
+      // Update ready function names in flash vars for iframe window
+      flashVars['readyFunction'] = 'ready';
+      flashVars['eventProxyFunction'] = 'events';
+      flashVars['errorEventProxyFunction'] = 'errors';
+
+      // Tried multiple methods to get this to work in all browsers
+
+      // Tried embedding the flash object in the page first, and then adding a place holder to the iframe, then replacing the placeholder with the page object.
+      // The goal here was to try to load the swf URL in the parent page first and hope that got around the firefox security error
+      // var newObj = vjs.Flash.embed(options['swf'], placeHolder, flashVars, params, attributes);
+      // (in onload)
+      //  var temp = vjs.createEl('a', { id:'asdf', innerHTML: 'asdf' } );
+      //  iDoc.body.appendChild(temp);
+
+      // Tried embedding the flash object through javascript in the iframe source.
+      // This works in webkit but still triggers the firefox security error
+      // iFrm.src = 'javascript: document.write('"+vjs.Flash.getEmbedCode(options['swf'], flashVars, params, attributes)+"');";
+
+      // Tried an actual local iframe just to make sure that works, but it kills the easiness of the CDN version if you require the user to host an iframe
+      // We should add an option to host the iframe locally though, because it could help a lot of issues.
+      // iFrm.src = "iframe.html";
+
+      // Wait until iFrame has loaded to write into it.
+      vjs.on(iFrm, 'load', vjs.bind(this, function(){
+
+        var iDoc,
+            iWin = iFrm.contentWindow;
+
+        // The one working method I found was to use the iframe's document.write() to create the swf object
+        // This got around the security issue in all browsers except firefox.
+        // I did find a hack where if I call the iframe's window.location.href='', it would get around the security error
+        // However, the main page would look like it was loading indefinitely (URL bar loading spinner would never stop)
+        // Plus Firefox 3.6 didn't work no matter what I tried.
+        // if (vjs.USER_AGENT.match('Firefox')) {
+        //   iWin.location.href = '';
+        // }
+
+        // Get the iFrame's document depending on what the browser supports
+        iDoc = iFrm.contentDocument ? iFrm.contentDocument : iFrm.contentWindow.document;
+
+        // Tried ensuring both document domains were the same, but they already were, so that wasn't the issue.
+        // Even tried adding /. that was mentioned in a browser security writeup
+        // document.domain = document.domain+'/.';
+        // iDoc.domain = document.domain+'/.';
+
+        // Tried adding the object to the iframe doc's innerHTML. Security error in all browsers.
+        // iDoc.body.innerHTML = swfObjectHTML;
+
+        // Tried appending the object to the iframe doc's body. Security error in all browsers.
+        // iDoc.body.appendChild(swfObject);
+
+        // Using document.write actually got around the security error that browsers were throwing.
+        // Again, it's a dynamically generated (same domain) iframe, loading an external Flash swf.
+        // Not sure why that's a security issue, but apparently it is.
+        iDoc.write(vjs.Flash.getEmbedCode(options['swf'], flashVars, params, attributes));
+
+        // Setting variables on the window needs to come after the doc write because otherwise they can get reset in some browsers
+        // So far no issues with swf ready event being called before it's set on the window.
+        iWin['player'] = this.player_;
+
+        // Create swf ready function for iFrame window
+        iWin['ready'] = vjs.bind(this.player_, function(currSwf){
+          var el = iDoc.getElementById(currSwf),
+              player = this,
+              tech = player.tech;
+
+          // Update reference to playback technology element
+          tech.el_ = el;
+
+          // Now that the element is ready, make a click on the swf play the video
+          vjs.on(el, 'click', tech.bind(tech.onClick));
+
+          // Make sure swf is actually ready. Sometimes the API isn't actually yet.
+          vjs.Flash.checkReady(tech);
+        });
+
+        // Create event listener for all swf events
+        iWin['events'] = vjs.bind(this.player_, function(swfID, eventName){
+          var player = this;
+          if (player && player.techName === 'flash') {
+            player.trigger(eventName);
+          }
+        });
+
+        // Create error listener for all swf errors
+        iWin['errors'] = vjs.bind(this.player_, function(swfID, eventName){
+          vjs.log('Flash Error', eventName);
+        });
+
+      }));
+
+      // Replace placeholder with iFrame (it will load now)
+      placeHolder.parentNode.replaceChild(iFrm, placeHolder);
+
+    // If not using iFrame mode, embed as normal object
+    } else {
+      vjs.Flash.embed(options['swf'], placeHolder, flashVars, params, attributes);
+    }
+  }
+});
+
+vjs.Flash.prototype.dispose = function(){
+  vjs.MediaTechController.prototype.dispose.call(this);
+};
+
+vjs.Flash.prototype.play = function(){
+  this.el_.vjs_play();
+};
+
+vjs.Flash.prototype.pause = function(){
+  this.el_.vjs_pause();
+};
+
+vjs.Flash.prototype.src = function(src){
+  // Make sure source URL is abosolute.
+  src = vjs.getAbsoluteURL(src);
+
+  this.el_.vjs_src(src);
+
+  // Currently the SWF doesn't autoplay if you load a source later.
+  // e.g. Load player w/ no source, wait 2s, set src.
+  if (this.player_.autoplay()) {
+    var tech = this;
+    setTimeout(function(){ tech.play(); }, 0);
+  }
+};
+
+vjs.Flash.prototype.load = function(){
+  this.el_.vjs_load();
+};
+
+vjs.Flash.prototype.poster = function(){
+  this.el_.vjs_getProperty('poster');
+};
+
+vjs.Flash.prototype.buffered = function(){
+  return vjs.createTimeRange(0, this.el_.vjs_getProperty('buffered'));
+};
+
+vjs.Flash.prototype.supportsFullScreen = function(){
+  return false; // Flash does not allow fullscreen through javascript
+};
+
+vjs.Flash.prototype.enterFullScreen = function(){
+  return false;
+};
+
+
+// Create setters and getters for attributes
+var api = vjs.Flash.prototype,
+    readWrite = 'preload,currentTime,defaultPlaybackRate,playbackRate,autoplay,loop,mediaGroup,controller,controls,volume,muted,defaultMuted'.split(','),
+    readOnly = 'error,currentSrc,networkState,readyState,seeking,initialTime,duration,startOffsetTime,paused,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks'.split(',');
+    // Overridden: buffered
+
+/**
+ * @this {*}
+ */
+var createSetter = function(attr){
+  var attrUpper = attr.charAt(0).toUpperCase() + attr.slice(1);
+  api['set'+attrUpper] = function(val){ return this.el_.vjs_setProperty(attr, val); };
+};
+
+/**
+ * @this {*}
+ */
+var createGetter = function(attr){
+  api[attr] = function(){ return this.el_.vjs_getProperty(attr); };
+};
+
+(function(){
+  var i;
+  // Create getter and setters for all read/write attributes
+  for (i = 0; i < readWrite.length; i++) {
+    createGetter(readWrite[i]);
+    createSetter(readWrite[i]);
+  }
+
+  // Create getters for read-only attributes
+  for (i = 0; i < readOnly.length; i++) {
+    createGetter(readOnly[i]);
+  }
+})();
+
+/* Flash Support Testing -------------------------------------------------------- */
+
+vjs.Flash.isSupported = function(){
+  return vjs.Flash.version()[0] >= 10;
+  // return swfobject.hasFlashPlayerVersion('10');
+};
+
+vjs.Flash.canPlaySource = function(srcObj){
+  if (srcObj.type in vjs.Flash.formats) { return 'maybe'; }
+};
+
+vjs.Flash.formats = {
+  'video/flv': 'FLV',
+  'video/x-flv': 'FLV',
+  'video/mp4': 'MP4',
+  'video/m4v': 'MP4'
+};
+
+vjs.Flash['onReady'] = function(currSwf){
+  var el = vjs.el(currSwf);
+
+  // Get player from box
+  // On firefox reloads, el might already have a player
+  var player = el['player'] || el.parentNode['player'],
+      tech = player.tech;
+
+  // Reference player on tech element
+  el['player'] = player;
+
+  // Update reference to playback technology element
+  tech.el_ = el;
+
+  // Now that the element is ready, make a click on the swf play the video
+  tech.on('click', tech.onClick);
+
+  vjs.Flash.checkReady(tech);
+};
+
+// The SWF isn't alwasy ready when it says it is. Sometimes the API functions still need to be added to the object.
+// If it's not ready, we set a timeout to check again shortly.
+vjs.Flash.checkReady = function(tech){
+
+  // Check if API property exists
+  if (tech.el().vjs_getProperty) {
+
+    // If so, tell tech it's ready
+    tech.triggerReady();
+
+  // Otherwise wait longer.
+  } else {
+
+    setTimeout(function(){
+      vjs.Flash.checkReady(tech);
+    }, 50);
+
+  }
+};
+
+// Trigger events from the swf on the player
+vjs.Flash['onEvent'] = function(swfID, eventName){
+  var player = vjs.el(swfID)['player'];
+  player.trigger(eventName);
+};
+
+// Log errors from the swf
+vjs.Flash['onError'] = function(swfID, err){
+  var player = vjs.el(swfID)['player'];
+  player.trigger('error');
+  vjs.log('Flash Error', err, swfID);
+};
+
+// Flash Version Check
+vjs.Flash.version = function(){
+  var version = '0,0,0';
+
+  // IE
+  try {
+    version = new window.ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
+
+  // other browsers
+  } catch(e) {
+    try {
+      if (navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin){
+        version = (navigator.plugins['Shockwave Flash 2.0'] || navigator.plugins['Shockwave Flash']).description.replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
+      }
+    } catch(err) {}
+  }
+  return version.split(',');
+};
+
+// Flash embedding method. Only used in non-iframe mode
+vjs.Flash.embed = function(swf, placeHolder, flashVars, params, attributes){
+  var code = vjs.Flash.getEmbedCode(swf, flashVars, params, attributes),
+
+      // Get element by embedding code and retrieving created element
+      obj = vjs.createEl('div', { innerHTML: code }).childNodes[0],
+
+      par = placeHolder.parentNode
+  ;
+
+  placeHolder.parentNode.replaceChild(obj, placeHolder);
+
+  // IE6 seems to have an issue where it won't initialize the swf object after injecting it.
+  // This is a dumb fix
+  var newObj = par.childNodes[0];
+  setTimeout(function(){
+    newObj.style.display = 'block';
+  }, 1000);
+
+  return obj;
+
+};
+
+vjs.Flash.getEmbedCode = function(swf, flashVars, params, attributes){
+
+  var objTag = '<object type="application/x-shockwave-flash"',
+      flashVarsString = '',
+      paramsString = '',
+      attrsString = '';
+
+  // Convert flash vars to string
+  if (flashVars) {
+    vjs.obj.each(flashVars, function(key, val){
+      flashVarsString += (key + '=' + val + '&amp;');
+    });
+  }
+
+  // Add swf, flashVars, and other default params
+  params = vjs.obj.merge({
+    'movie': swf,
+    'flashvars': flashVarsString,
+    'allowScriptAccess': 'always', // Required to talk to swf
+    'allowNetworking': 'all' // All should be default, but having security issues.
+  }, params);
+
+  // Create param tags string
+  vjs.obj.each(params, function(key, val){
+    paramsString += '<param name="'+key+'" value="'+val+'" />';
+  });
+
+  attributes = vjs.obj.merge({
+    // Add swf to attributes (need both for IE and Others to work)
+    'data': swf,
+
+    // Default to 100% width/height
+    'width': '100%',
+    'height': '100%'
+
+  }, attributes);
+
+  // Create Attributes string
+  vjs.obj.each(attributes, function(key, val){
+    attrsString += (key + '="' + val + '" ');
+  });
+
+  return objTag + attrsString + '>' + paramsString + '</object>';
+};
+/**
+ * @constructor
+ */
+vjs.MediaLoader = vjs.Component.extend({
+  /** @constructor */
+  init: function(player, options, ready){
+    vjs.Component.call(this, player, options, ready);
+
+    // If there are no sources when the player is initialized,
+    // load the first supported playback technology.
+    if (!player.options_['sources'] || player.options_['sources'].length === 0) {
+      for (var i=0,j=player.options_['techOrder']; i<j.length; i++) {
+        var techName = vjs.capitalize(j[i]),
+            tech = window['videojs'][techName];
+
+        // Check if the browser supports this technology
+        if (tech && tech.isSupported()) {
+          player.loadTech(techName);
+          break;
+        }
+      }
+    } else {
+      // // Loop through playback technologies (HTML5, Flash) and check for support.
+      // // Then load the best source.
+      // // A few assumptions here:
+      // //   All playback technologies respect preload false.
+      player.src(player.options_['sources']);
+    }
+  }
+});/**
+ * @fileoverview Text Tracks
+ * Text tracks are tracks of timed text events.
+ * Captions - text displayed over the video for the hearing impared
+ * Subtitles - text displayed over the video for those who don't understand langauge in the video
+ * Chapters - text displayed in a menu allowing the user to jump to particular points (chapters) in the video
+ * Descriptions (not supported yet) - audio descriptions that are read back to the user by a screen reading device
+ */
+
+// Player Additions - Functions add to the player object for easier access to tracks
+
+/**
+ * List of associated text tracks
+ * @type {Array}
+ * @private
+ */
+vjs.Player.prototype.textTracks_;
+
+/**
+ * Get an array of associated text tracks. captions, subtitles, chapters, descriptions
+ * http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#dom-media-texttracks
+ * @return {Array}           Array of track objects
+ */
+vjs.Player.prototype.textTracks = function(){
+  this.textTracks_ = this.textTracks_ || [];
+  return this.textTracks_;
+};
+
+/**
+ * Add a text track
+ * In addition to the W3C settings we allow adding additional info through options.
+ * http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#dom-media-addtexttrack
+ * @param {String}  kind        Captions, subtitles, chapters, descriptions, or metadata
+ * @param {String=} label       Optional label
+ * @param {String=} language    Optional language
+ * @param {Object=} options     Additional track options, like src
+ */
+vjs.Player.prototype.addTextTrack = function(kind, label, language, options){
+  var tracks = this.textTracks_ = this.textTracks_ || [];
+  options = options || {};
+
+  options['kind'] = kind;
+  options['label'] = label;
+  options['language'] = language;
+
+  // HTML5 Spec says default to subtitles.
+  // Uppercase first letter to match class names
+  var Kind = vjs.capitalize(kind || 'subtitles');
+
+  // Create correct texttrack class. CaptionsTrack, etc.
+  var track = new window['videojs'][Kind + 'Track'](this, options);
+
+  tracks.push(track);
+
+  // If track.dflt() is set, start showing immediately
+  // TODO: Add a process to deterime the best track to show for the specific kind
+  // Incase there are mulitple defaulted tracks of the same kind
+  // Or the user has a set preference of a specific language that should override the default
+  // if (track.dflt()) {
+  //   this.ready(vjs.bind(track, track.show));
+  // }
+
+  return track;
+};
+
+/**
+ * Add an array of text tracks. captions, subtitles, chapters, descriptions
+ * Track objects will be stored in the player.textTracks() array
+ * @param {Array} trackList Array of track elements or objects (fake track elements)
+ */
+vjs.Player.prototype.addTextTracks = function(trackList){
+  var trackObj;
+
+  for (var i = 0; i < trackList.length; i++) {
+    trackObj = trackList[i];
+    this.addTextTrack(trackObj['kind'], trackObj['label'], trackObj['language'], trackObj);
+  }
+
+  return this;
+};
+
+// Show a text track
+// disableSameKind: disable all other tracks of the same kind. Value should be a track kind (captions, etc.)
+vjs.Player.prototype.showTextTrack = function(id, disableSameKind){
+  var tracks = this.textTracks_,
+      i = 0,
+      j = tracks.length,
+      track, showTrack, kind;
+
+  // Find Track with same ID
+  for (;i<j;i++) {
+    track = tracks[i];
+    if (track.id() === id) {
+      track.show();
+      showTrack = track;
+
+    // Disable tracks of the same kind
+    } else if (disableSameKind && track.kind() == disableSameKind && track.mode() > 0) {
+      track.disable();
+    }
+  }
+
+  // Get track kind from shown track or disableSameKind
+  kind = (showTrack) ? showTrack.kind() : ((disableSameKind) ? disableSameKind : false);
+
+  // Trigger trackchange event, captionstrackchange, subtitlestrackchange, etc.
+  if (kind) {
+    this.trigger(kind+'trackchange');
+  }
+
+  return this;
+};
+
+/**
+ * Track Class
+ * Contains track methods for loading, showing, parsing cues of tracks
+ * @param {vjs.Player|Object} player
+ * @param {Object=} options
+ * @constructor
+ */
+vjs.TextTrack = vjs.Component.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.Component.call(this, player, options);
+
+    // Apply track info to track object
+    // Options will often be a track element
+
+    // Build ID if one doesn't exist
+    this.id_ = options['id'] || ('vjs_' + options['kind'] + '_' + options['language'] + '_' + vjs.guid++);
+    this.src_ = options['src'];
+    // 'default' is a reserved keyword in js so we use an abbreviated version
+    this.dflt_ = options['default'] || options['dflt'];
+    this.title_ = options['title'];
+    this.language_ = options['srclang'];
+    this.label_ = options['label'];
+    this.cues_ = [];
+    this.activeCues_ = [];
+    this.readyState_ = 0;
+    this.mode_ = 0;
+
+    this.player_.on('fullscreenchange', vjs.bind(this, this.adjustFontSize));
+  }
+});
+
+/**
+ * Track kind value. Captions, subtitles, etc.
+ * @private
+ */
+vjs.TextTrack.prototype.kind_;
+
+/**
+ * Get the track kind value
+ * @return {String}
+ */
+vjs.TextTrack.prototype.kind = function(){
+  return this.kind_;
+};
+
+/**
+ * Track src value
+ * @private
+ */
+vjs.TextTrack.prototype.src_;
+
+/**
+ * Get the track src value
+ * @return {String}
+ */
+vjs.TextTrack.prototype.src = function(){
+  return this.src_;
+};
+
+/**
+ * Track default value
+ * If default is used, subtitles/captions to start showing
+ * @private
+ */
+vjs.TextTrack.prototype.dflt_;
+
+/**
+ * Get the track default value
+ * 'default' is a reserved keyword
+ * @return {Boolean}
+ */
+vjs.TextTrack.prototype.dflt = function(){
+  return this.dflt_;
+};
+
+/**
+ * Track title value
+ * @private
+ */
+vjs.TextTrack.prototype.title_;
+
+/**
+ * Get the track title value
+ * @return {String}
+ */
+vjs.TextTrack.prototype.title = function(){
+  return this.title_;
+};
+
+/**
+ * Language - two letter string to represent track language, e.g. 'en' for English
+ * Spec def: readonly attribute DOMString language;
+ * @private
+ */
+vjs.TextTrack.prototype.language_;
+
+/**
+ * Get the track language value
+ * @return {String}
+ */
+vjs.TextTrack.prototype.language = function(){
+  return this.language_;
+};
+
+/**
+ * Track label e.g. 'English'
+ * Spec def: readonly attribute DOMString label;
+ * @private
+ */
+vjs.TextTrack.prototype.label_;
+
+/**
+ * Get the track label value
+ * @return {String}
+ */
+vjs.TextTrack.prototype.label = function(){
+  return this.label_;
+};
+
+/**
+ * All cues of the track. Cues have a startTime, endTime, text, and other properties.
+ * Spec def: readonly attribute TextTrackCueList cues;
+ * @private
+ */
+vjs.TextTrack.prototype.cues_;
+
+/**
+ * Get the track cues
+ * @return {Array}
+ */
+vjs.TextTrack.prototype.cues = function(){
+  return this.cues_;
+};
+
+/**
+ * ActiveCues is all cues that are currently showing
+ * Spec def: readonly attribute TextTrackCueList activeCues;
+ * @private
+ */
+vjs.TextTrack.prototype.activeCues_;
+
+/**
+ * Get the track active cues
+ * @return {Array}
+ */
+vjs.TextTrack.prototype.activeCues = function(){
+  return this.activeCues_;
+};
+
+/**
+ * ReadyState describes if the text file has been loaded
+ * const unsigned short NONE = 0;
+ * const unsigned short LOADING = 1;
+ * const unsigned short LOADED = 2;
+ * const unsigned short ERROR = 3;
+ * readonly attribute unsigned short readyState;
+ * @private
+ */
+vjs.TextTrack.prototype.readyState_;
+
+/**
+ * Get the track readyState
+ * @return {Number}
+ */
+vjs.TextTrack.prototype.readyState = function(){
+  return this.readyState_;
+};
+
+/**
+ * Mode describes if the track is showing, hidden, or disabled
+ * const unsigned short OFF = 0;
+ * const unsigned short HIDDEN = 1; (still triggering cuechange events, but not visible)
+ * const unsigned short SHOWING = 2;
+ * attribute unsigned short mode;
+ * @private
+ */
+vjs.TextTrack.prototype.mode_;
+
+/**
+ * Get the track mode
+ * @return {Number}
+ */
+vjs.TextTrack.prototype.mode = function(){
+  return this.mode_;
+};
+
+/**
+ * Change the font size of the text track to make it larger when playing in fullscreen mode
+ * and restore it to its normal size when not in fullscreen mode.
+ */
+vjs.TextTrack.prototype.adjustFontSize = function(){
+    if (this.player_.isFullScreen) {
+        // Scale the font by the same factor as increasing the video width to the full screen window width.
+        // Additionally, multiply that factor by 1.4, which is the default font size for
+        // the caption track (from the CSS)
+        this.el_.style.fontSize = screen.width / this.player_.width() * 1.4 * 100 + '%';
+    } else {
+        // Change the font size of the text track back to its original non-fullscreen size
+        this.el_.style.fontSize = '';
+    }
+};
+
+/**
+ * Create basic div to hold cue text
+ * @return {Element}
+ */
+vjs.TextTrack.prototype.createEl = function(){
+  return vjs.Component.prototype.createEl.call(this, 'div', {
+    className: 'vjs-' + this.kind_ + ' vjs-text-track'
+  });
+};
+
+/**
+ * Show: Mode Showing (2)
+ * Indicates that the text track is active. If no attempt has yet been made to obtain the track's cues, the user agent will perform such an attempt momentarily.
+ * The user agent is maintaining a list of which cues are active, and events are being fired accordingly.
+ * In addition, for text tracks whose kind is subtitles or captions, the cues are being displayed over the video as appropriate;
+ * for text tracks whose kind is descriptions, the user agent is making the cues available to the user in a non-visual fashion;
+ * and for text tracks whose kind is chapters, the user agent is making available to the user a mechanism by which the user can navigate to any point in the media resource by selecting a cue.
+ * The showing by default state is used in conjunction with the default attribute on track elements to indicate that the text track was enabled due to that attribute.
+ * This allows the user agent to override the state if a later track is discovered that is more appropriate per the user's preferences.
+ */
+vjs.TextTrack.prototype.show = function(){
+  this.activate();
+
+  this.mode_ = 2;
+
+  // Show element.
+  vjs.Component.prototype.show.call(this);
+};
+
+/**
+ * Hide: Mode Hidden (1)
+ * Indicates that the text track is active, but that the user agent is not actively displaying the cues.
+ * If no attempt has yet been made to obtain the track's cues, the user agent will perform such an attempt momentarily.
+ * The user agent is maintaining a list of which cues are active, and events are being fired accordingly.
+ */
+vjs.TextTrack.prototype.hide = function(){
+  // When hidden, cues are still triggered. Disable to stop triggering.
+  this.activate();
+
+  this.mode_ = 1;
+
+  // Hide element.
+  vjs.Component.prototype.hide.call(this);
+};
+
+/**
+ * Disable: Mode Off/Disable (0)
+ * Indicates that the text track is not active. Other than for the purposes of exposing the track in the DOM, the user agent is ignoring the text track.
+ * No cues are active, no events are fired, and the user agent will not attempt to obtain the track's cues.
+ */
+vjs.TextTrack.prototype.disable = function(){
+  // If showing, hide.
+  if (this.mode_ == 2) { this.hide(); }
+
+  // Stop triggering cues
+  this.deactivate();
+
+  // Switch Mode to Off
+  this.mode_ = 0;
+};
+
+/**
+ * Turn on cue tracking. Tracks that are showing OR hidden are active.
+ */
+vjs.TextTrack.prototype.activate = function(){
+  // Load text file if it hasn't been yet.
+  if (this.readyState_ === 0) { this.load(); }
+
+  // Only activate if not already active.
+  if (this.mode_ === 0) {
+    // Update current cue on timeupdate
+    // Using unique ID for bind function so other tracks don't remove listener
+    this.player_.on('timeupdate', vjs.bind(this, this.update, this.id_));
+
+    // Reset cue time on media end
+    this.player_.on('ended', vjs.bind(this, this.reset, this.id_));
+
+    // Add to display
+    if (this.kind_ === 'captions' || this.kind_ === 'subtitles') {
+      this.player_.getChild('textTrackDisplay').addChild(this);
+    }
+  }
+};
+
+/**
+ * Turn off cue tracking.
+ */
+vjs.TextTrack.prototype.deactivate = function(){
+  // Using unique ID for bind function so other tracks don't remove listener
+  this.player_.off('timeupdate', vjs.bind(this, this.update, this.id_));
+  this.player_.off('ended', vjs.bind(this, this.reset, this.id_));
+  this.reset(); // Reset
+
+  // Remove from display
+  this.player_.getChild('textTrackDisplay').removeChild(this);
+};
+
+// A readiness state
+// One of the following:
+//
+// Not loaded
+// Indicates that the text track is known to exist (e.g. it has been declared with a track element), but its cues have not been obtained.
+//
+// Loading
+// Indicates that the text track is loading and there have been no fatal errors encountered so far. Further cues might still be added to the track.
+//
+// Loaded
+// Indicates that the text track has been loaded with no fatal errors. No new cues will be added to the track except if the text track corresponds to a MutableTextTrack object.
+//
+// Failed to load
+// Indicates that the text track was enabled, but when the user agent attempted to obtain it, this failed in some way (e.g. URL could not be resolved, network error, unknown text track format). Some or all of the cues are likely missing and will not be obtained.
+vjs.TextTrack.prototype.load = function(){
+
+  // Only load if not loaded yet.
+  if (this.readyState_ === 0) {
+    this.readyState_ = 1;
+    vjs.get(this.src_, vjs.bind(this, this.parseCues), vjs.bind(this, this.onError));
+  }
+
+};
+
+vjs.TextTrack.prototype.onError = function(err){
+  this.error = err;
+  this.readyState_ = 3;
+  this.trigger('error');
+};
+
+// Parse the WebVTT text format for cue times.
+// TODO: Separate parser into own class so alternative timed text formats can be used. (TTML, DFXP)
+vjs.TextTrack.prototype.parseCues = function(srcContent) {
+  var cue, time, text,
+      lines = srcContent.split('\n'),
+      line = '', id;
+
+  for (var i=1, j=lines.length; i<j; i++) {
+    // Line 0 should be 'WEBVTT', so skipping i=0
+
+    line = vjs.trim(lines[i]); // Trim whitespace and linebreaks
+
+    if (line) { // Loop until a line with content
+
+      // First line could be an optional cue ID
+      // Check if line has the time separator
+      if (line.indexOf('-->') == -1) {
+        id = line;
+        // Advance to next line for timing.
+        line = vjs.trim(lines[++i]);
+      } else {
+        id = this.cues_.length;
+      }
+
+      // First line - Number
+      cue = {
+        id: id, // Cue Number
+        index: this.cues_.length // Position in Array
+      };
+
+      // Timing line
+      time = line.split(' --> ');
+      cue.startTime = this.parseCueTime(time[0]);
+      cue.endTime = this.parseCueTime(time[1]);
+
+      // Additional lines - Cue Text
+      text = [];
+
+      // Loop until a blank line or end of lines
+      // Assumeing trim('') returns false for blank lines
+      while (lines[++i] && (line = vjs.trim(lines[i]))) {
+        text.push(line);
+      }
+
+      cue.text = text.join('<br/>');
+
+      // Add this cue
+      this.cues_.push(cue);
+    }
+  }
+
+  this.readyState_ = 2;
+  this.trigger('loaded');
+};
+
+
+vjs.TextTrack.prototype.parseCueTime = function(timeText) {
+  var parts = timeText.split(':'),
+      time = 0,
+      hours, minutes, other, seconds, ms;
+
+  // Check if optional hours place is included
+  // 00:00:00.000 vs. 00:00.000
+  if (parts.length == 3) {
+    hours = parts[0];
+    minutes = parts[1];
+    other = parts[2];
+  } else {
+    hours = 0;
+    minutes = parts[0];
+    other = parts[1];
+  }
+
+  // Break other (seconds, milliseconds, and flags) by spaces
+  // TODO: Make additional cue layout settings work with flags
+  other = other.split(/\s+/);
+  // Remove seconds. Seconds is the first part before any spaces.
+  seconds = other.splice(0,1)[0];
+  // Could use either . or , for decimal
+  seconds = seconds.split(/\.|,/);
+  // Get milliseconds
+  ms = parseFloat(seconds[1]);
+  seconds = seconds[0];
+
+  // hours => seconds
+  time += parseFloat(hours) * 3600;
+  // minutes => seconds
+  time += parseFloat(minutes) * 60;
+  // Add seconds
+  time += parseFloat(seconds);
+  // Add milliseconds
+  if (ms) { time += ms/1000; }
+
+  return time;
+};
+
+// Update active cues whenever timeupdate events are triggered on the player.
+vjs.TextTrack.prototype.update = function(){
+  if (this.cues_.length > 0) {
+
+    // Get curent player time
+    var time = this.player_.currentTime();
+
+    // Check if the new time is outside the time box created by the the last update.
+    if (this.prevChange === undefined || time < this.prevChange || this.nextChange <= time) {
+      var cues = this.cues_,
+
+          // Create a new time box for this state.
+          newNextChange = this.player_.duration(), // Start at beginning of the timeline
+          newPrevChange = 0, // Start at end
+
+          reverse = false, // Set the direction of the loop through the cues. Optimized the cue check.
+          newCues = [], // Store new active cues.
+
+          // Store where in the loop the current active cues are, to provide a smart starting point for the next loop.
+          firstActiveIndex, lastActiveIndex,
+          cue, i; // Loop vars
+
+      // Check if time is going forwards or backwards (scrubbing/rewinding)
+      // If we know the direction we can optimize the starting position and direction of the loop through the cues array.
+      if (time >= this.nextChange || this.nextChange === undefined) { // NextChange should happen
+        // Forwards, so start at the index of the first active cue and loop forward
+        i = (this.firstActiveIndex !== undefined) ? this.firstActiveIndex : 0;
+      } else {
+        // Backwards, so start at the index of the last active cue and loop backward
+        reverse = true;
+        i = (this.lastActiveIndex !== undefined) ? this.lastActiveIndex : cues.length - 1;
+      }
+
+      while (true) { // Loop until broken
+        cue = cues[i];
+
+        // Cue ended at this point
+        if (cue.endTime <= time) {
+          newPrevChange = Math.max(newPrevChange, cue.endTime);
+
+          if (cue.active) {
+            cue.active = false;
+          }
+
+          // No earlier cues should have an active start time.
+          // Nevermind. Assume first cue could have a duration the same as the video.
+          // In that case we need to loop all the way back to the beginning.
+          // if (reverse && cue.startTime) { break; }
+
+        // Cue hasn't started
+        } else if (time < cue.startTime) {
+          newNextChange = Math.min(newNextChange, cue.startTime);
+
+          if (cue.active) {
+            cue.active = false;
+          }
+
+          // No later cues should have an active start time.
+          if (!reverse) { break; }
+
+        // Cue is current
+        } else {
+
+          if (reverse) {
+            // Add cue to front of array to keep in time order
+            newCues.splice(0,0,cue);
+
+            // If in reverse, the first current cue is our lastActiveCue
+            if (lastActiveIndex === undefined) { lastActiveIndex = i; }
+            firstActiveIndex = i;
+          } else {
+            // Add cue to end of array
+            newCues.push(cue);
+
+            // If forward, the first current cue is our firstActiveIndex
+            if (firstActiveIndex === undefined) { firstActiveIndex = i; }
+            lastActiveIndex = i;
+          }
+
+          newNextChange = Math.min(newNextChange, cue.endTime);
+          newPrevChange = Math.max(newPrevChange, cue.startTime);
+
+          cue.active = true;
+        }
+
+        if (reverse) {
+          // Reverse down the array of cues, break if at first
+          if (i === 0) { break; } else { i--; }
+        } else {
+          // Walk up the array fo cues, break if at last
+          if (i === cues.length - 1) { break; } else { i++; }
+        }
+
+      }
+
+      this.activeCues_ = newCues;
+      this.nextChange = newNextChange;
+      this.prevChange = newPrevChange;
+      this.firstActiveIndex = firstActiveIndex;
+      this.lastActiveIndex = lastActiveIndex;
+
+      this.updateDisplay();
+
+      this.trigger('cuechange');
+    }
+  }
+};
+
+// Add cue HTML to display
+vjs.TextTrack.prototype.updateDisplay = function(){
+  var cues = this.activeCues_,
+      html = '',
+      i=0,j=cues.length;
+
+  for (;i<j;i++) {
+    html += '<span class="vjs-tt-cue">'+cues[i].text+'</span>';
+  }
+
+  this.el_.innerHTML = html;
+};
+
+// Set all loop helper values back
+vjs.TextTrack.prototype.reset = function(){
+  this.nextChange = 0;
+  this.prevChange = this.player_.duration();
+  this.firstActiveIndex = 0;
+  this.lastActiveIndex = 0;
+};
+
+// Create specific track types
+/**
+ * @constructor
+ */
+vjs.CaptionsTrack = vjs.TextTrack.extend();
+vjs.CaptionsTrack.prototype.kind_ = 'captions';
+// Exporting here because Track creation requires the track kind
+// to be available on global object. e.g. new window['videojs'][Kind + 'Track']
+
+/**
+ * @constructor
+ */
+vjs.SubtitlesTrack = vjs.TextTrack.extend();
+vjs.SubtitlesTrack.prototype.kind_ = 'subtitles';
+
+/**
+ * @constructor
+ */
+vjs.ChaptersTrack = vjs.TextTrack.extend();
+vjs.ChaptersTrack.prototype.kind_ = 'chapters';
+
+
+/* Text Track Display
+============================================================================= */
+// Global container for both subtitle and captions text. Simple div container.
+
+/**
+ * @constructor
+ */
+vjs.TextTrackDisplay = vjs.Component.extend({
+  /** @constructor */
+  init: function(player, options, ready){
+    vjs.Component.call(this, player, options, ready);
+
+    // This used to be called during player init, but was causing an error
+    // if a track should show by default and the display hadn't loaded yet.
+    // Should probably be moved to an external track loader when we support
+    // tracks that don't need a display.
+    if (player.options_['tracks'] && player.options_['tracks'].length > 0) {
+      this.player_.addTextTracks(player.options_['tracks']);
+    }
+  }
+});
+
+vjs.TextTrackDisplay.prototype.createEl = function(){
+  return vjs.Component.prototype.createEl.call(this, 'div', {
+    className: 'vjs-text-track-display'
+  });
+};
+
+
+/* Text Track Menu Items
+============================================================================= */
+/**
+ * @constructor
+ */
+vjs.TextTrackMenuItem = vjs.MenuItem.extend({
+  /** @constructor */
+  init: function(player, options){
+    var track = this.track = options['track'];
+
+    // Modify options for parent MenuItem class's init.
+    options['label'] = track.label();
+    options['selected'] = track.dflt();
+    vjs.MenuItem.call(this, player, options);
+
+    this.player_.on(track.kind() + 'trackchange', vjs.bind(this, this.update));
+  }
+});
+
+vjs.TextTrackMenuItem.prototype.onClick = function(){
+  vjs.MenuItem.prototype.onClick.call(this);
+  this.player_.showTextTrack(this.track.id_, this.track.kind());
+};
+
+vjs.TextTrackMenuItem.prototype.update = function(){
+  this.selected(this.track.mode() == 2);
+};
+
+/**
+ * @constructor
+ */
+vjs.OffTextTrackMenuItem = vjs.TextTrackMenuItem.extend({
+  /** @constructor */
+  init: function(player, options){
+    // Create pseudo track info
+    // Requires options['kind']
+    options['track'] = {
+      kind: function() { return options['kind']; },
+      player: player,
+      label: function(){ return options['kind'] + ' off'; },
+      dflt: function(){ return false; },
+      mode: function(){ return false; }
+    };
+    vjs.TextTrackMenuItem.call(this, player, options);
+    this.selected(true);
+  }
+});
+
+vjs.OffTextTrackMenuItem.prototype.onClick = function(){
+  vjs.TextTrackMenuItem.prototype.onClick.call(this);
+  this.player_.showTextTrack(this.track.id_, this.track.kind());
+};
+
+vjs.OffTextTrackMenuItem.prototype.update = function(){
+  var tracks = this.player_.textTracks(),
+      i=0, j=tracks.length, track,
+      off = true;
+
+  for (;i<j;i++) {
+    track = tracks[i];
+    if (track.kind() == this.track.kind() && track.mode() == 2) {
+      off = false;
+    }
+  }
+
+  this.selected(off);
+};
+
+/* Captions Button
+================================================================================ */
+/**
+ * @constructor
+ */
+vjs.TextTrackButton = vjs.MenuButton.extend({
+  /** @constructor */
+  init: function(player, options){
+    vjs.MenuButton.call(this, player, options);
+
+    if (this.items.length <= 1) {
+      this.hide();
+    }
+  }
+});
+
+// vjs.TextTrackButton.prototype.buttonPressed = false;
+
+// vjs.TextTrackButton.prototype.createMenu = function(){
+//   var menu = new vjs.Menu(this.player_);
+
+//   // Add a title list item to the top
+//   // menu.el().appendChild(vjs.createEl('li', {
+//   //   className: 'vjs-menu-title',
+//   //   innerHTML: vjs.capitalize(this.kind_),
+//   //   tabindex: -1
+//   // }));
+
+//   this.items = this.createItems();
+
+//   // Add menu items to the menu
+//   for (var i = 0; i < this.items.length; i++) {
+//     menu.addItem(this.items[i]);
+//   }
+
+//   // Add list to element
+//   this.addChild(menu);
+
+//   return menu;
+// };
+
+// Create a menu item for each text track
+vjs.TextTrackButton.prototype.createItems = function(){
+  var items = [], track;
+
+  // Add an OFF menu item to turn all tracks off
+  items.push(new vjs.OffTextTrackMenuItem(this.player_, { 'kind': this.kind_ }));
+
+  for (var i = 0; i < this.player_.textTracks().length; i++) {
+    track = this.player_.textTracks()[i];
+    if (track.kind() === this.kind_) {
+      items.push(new vjs.TextTrackMenuItem(this.player_, {
+        'track': track
+      }));
+    }
+  }
+
+  return items;
+};
+
+/**
+ * @constructor
+ */
+vjs.CaptionsButton = vjs.TextTrackButton.extend({
+  /** @constructor */
+  init: function(player, options, ready){
+    vjs.TextTrackButton.call(this, player, options, ready);
+    this.el_.setAttribute('aria-label','Captions Menu');
+  }
+});
+vjs.CaptionsButton.prototype.kind_ = 'captions';
+vjs.CaptionsButton.prototype.buttonText = 'Captions';
+vjs.CaptionsButton.prototype.className = 'vjs-captions-button';
+
+/**
+ * @constructor
+ */
+vjs.SubtitlesButton = vjs.TextTrackButton.extend({
+  /** @constructor */
+  init: function(player, options, ready){
+    vjs.TextTrackButton.call(this, player, options, ready);
+    this.el_.setAttribute('aria-label','Subtitles Menu');
+  }
+});
+vjs.SubtitlesButton.prototype.kind_ = 'subtitles';
+vjs.SubtitlesButton.prototype.buttonText = 'Subtitles';
+vjs.SubtitlesButton.prototype.className = 'vjs-subtitles-button';
+
+// Chapters act much differently than other text tracks
+// Cues are navigation vs. other tracks of alternative languages
+/**
+ * @constructor
+ */
+vjs.ChaptersButton = vjs.TextTrackButton.extend({
+  /** @constructor */
+  init: function(player, options, ready){
+    vjs.TextTrackButton.call(this, player, options, ready);
+    this.el_.setAttribute('aria-label','Chapters Menu');
+  }
+});
+vjs.ChaptersButton.prototype.kind_ = 'chapters';
+vjs.ChaptersButton.prototype.buttonText = 'Chapters';
+vjs.ChaptersButton.prototype.className = 'vjs-chapters-button';
+
+// Create a menu item for each text track
+vjs.ChaptersButton.prototype.createItems = function(){
+  var items = [], track;
+
+  for (var i = 0; i < this.player_.textTracks().length; i++) {
+    track = this.player_.textTracks()[i];
+    if (track.kind() === this.kind_) {
+      items.push(new vjs.TextTrackMenuItem(this.player_, {
+        'track': track
+      }));
+    }
+  }
+
+  return items;
+};
+
+vjs.ChaptersButton.prototype.createMenu = function(){
+  var tracks = this.player_.textTracks(),
+      i = 0,
+      j = tracks.length,
+      track, chaptersTrack,
+      items = this.items = [];
+
+  for (;i<j;i++) {
+    track = tracks[i];
+    if (track.kind() == this.kind_ && track.dflt()) {
+      if (track.readyState() < 2) {
+        this.chaptersTrack = track;
+        track.on('loaded', vjs.bind(this, this.createMenu));
+        return;
+      } else {
+        chaptersTrack = track;
+        break;
+      }
+    }
+  }
+
+  var menu = this.menu = new vjs.Menu(this.player_);
+
+  menu.el_.appendChild(vjs.createEl('li', {
+    className: 'vjs-menu-title',
+    innerHTML: vjs.capitalize(this.kind_),
+    tabindex: -1
+  }));
+
+  if (chaptersTrack) {
+    var cues = chaptersTrack.cues_, cue, mi;
+    i = 0;
+    j = cues.length;
+
+    for (;i<j;i++) {
+      cue = cues[i];
+
+      mi = new vjs.ChaptersTrackMenuItem(this.player_, {
+        'track': chaptersTrack,
+        'cue': cue
+      });
+
+      items.push(mi);
+
+      menu.addChild(mi);
+    }
+  }
+
+  if (this.items.length > 0) {
+    this.show();
+  }
+
+  return menu;
+};
+
+
+/**
+ * @constructor
+ */
+vjs.ChaptersTrackMenuItem = vjs.MenuItem.extend({
+  /** @constructor */
+  init: function(player, options){
+    var track = this.track = options['track'],
+        cue = this.cue = options['cue'],
+        currentTime = player.currentTime();
+
+    // Modify options for parent MenuItem class's init.
+    options['label'] = cue.text;
+    options['selected'] = (cue.startTime <= currentTime && currentTime < cue.endTime);
+    vjs.MenuItem.call(this, player, options);
+
+    track.on('cuechange', vjs.bind(this, this.update));
+  }
+});
+
+vjs.ChaptersTrackMenuItem.prototype.onClick = function(){
+  vjs.MenuItem.prototype.onClick.call(this);
+  this.player_.currentTime(this.cue.startTime);
+  this.update(this.cue.startTime);
+};
+
+vjs.ChaptersTrackMenuItem.prototype.update = function(){
+  var cue = this.cue,
+      currentTime = this.player_.currentTime();
+
+  // vjs.log(currentTime, cue.startTime);
+  this.selected(cue.startTime <= currentTime && currentTime < cue.endTime);
+};
+
+// Add Buttons to controlBar
+vjs.obj.merge(vjs.ControlBar.prototype.options_['children'], {
+  'subtitlesButton': {},
+  'captionsButton': {},
+  'chaptersButton': {}
+});
+
+// vjs.Cue = vjs.Component.extend({
+//   /** @constructor */
+//   init: function(player, options){
+//     vjs.Component.call(this, player, options);
+//   }
+// });
+/**
+ * @fileoverview Add JSON support
+ * @suppress {undefinedVars}
+ * (Compiler doesn't like JSON not being declared)
+ */
+
+/**
+ * Javascript JSON implementation
+ * (Parse Method Only)
+ * https://github.com/douglascrockford/JSON-js/blob/master/json2.js
+ * Only using for parse method when parsing data-setup attribute JSON.
+ * @type {Object}
+ * @suppress {undefinedVars}
+ */
+vjs.JSON;
+
+/**
+ * @suppress {undefinedVars}
+ */
+if (typeof window.JSON !== 'undefined' && window.JSON.parse === 'function') {
+  vjs.JSON = window.JSON;
+
+} else {
+  vjs.JSON = {};
+
+  var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
+
+  vjs.JSON.parse = function (text, reviver) {
+      var j;
+
+      function walk(holder, key) {
+          var k, v, value = holder[key];
+          if (value && typeof value === 'object') {
+              for (k in value) {
+                  if (Object.prototype.hasOwnProperty.call(value, k)) {
+                      v = walk(value, k);
+                      if (v !== undefined) {
+                          value[k] = v;
+                      } else {
+                          delete value[k];
+                      }
+                  }
+              }
+          }
+          return reviver.call(holder, key, value);
+      }
+      text = String(text);
+      cx.lastIndex = 0;
+      if (cx.test(text)) {
+          text = text.replace(cx, function (a) {
+              return '\\u' +
+                  ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+          });
+      }
+
+      if (/^[\],:{}\s]*$/
+              .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
+                  .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
+                  .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
+
+          j = eval('(' + text + ')');
+
+          return typeof reviver === 'function' ?
+              walk({'': j}, '') : j;
+      }
+
+      throw new SyntaxError('JSON.parse(): invalid or malformed JSON data');
+  };
+}
+/**
+ * @fileoverview Functions for automatically setting up a player
+ * based on the data-setup attribute of the video tag
+ */
+
+// Automatically set up any tags that have a data-setup attribute
+vjs.autoSetup = function(){
+  var options, vid, player,
+      vids = document.getElementsByTagName('video');
+
+  // Check if any media elements exist
+  if (vids && vids.length > 0) {
+
+    for (var i=0,j=vids.length; i<j; i++) {
+      vid = vids[i];
+
+      // Check if element exists, has getAttribute func.
+      // IE seems to consider typeof el.getAttribute == 'object' instead of 'function' like expected, at least when loading the player immediately.
+      if (vid && vid.getAttribute) {
+
+        // Make sure this player hasn't already been set up.
+        if (vid['player'] === undefined) {
+          options = vid.getAttribute('data-setup');
+
+          // Check if data-setup attr exists.
+          // We only auto-setup if they've added the data-setup attr.
+          if (options !== null) {
+
+            // Parse options JSON
+            // If empty string, make it a parsable json object.
+            options = vjs.JSON.parse(options || '{}');
+
+            // Create new video.js instance.
+            player = videojs(vid, options);
+          }
+        }
+
+      // If getAttribute isn't defined, we need to wait for the DOM.
+      } else {
+        vjs.autoSetupTimeout(1);
+        break;
+      }
+    }
+
+  // No videos were found, so keep looping unless page is finisehd loading.
+  } else if (!vjs.windowLoaded) {
+    vjs.autoSetupTimeout(1);
+  }
+};
+
+// Pause to let the DOM keep processing
+vjs.autoSetupTimeout = function(wait){
+  setTimeout(vjs.autoSetup, wait);
+};
+
+vjs.one(window, 'load', function(){
+  vjs.windowLoaded = true;
+});
+
+// Run Auto-load players
+// You have to wait at least once in case this script is loaded after your video in the DOM (weird behavior only with minified version)
+vjs.autoSetupTimeout(1);
+vjs.plugin = function(name, init){
+  vjs.Player.prototype[name] = init;
+};
Index: /extensions/piwigo_videojs/video-js/video.js
===================================================================
--- /extensions/piwigo_videojs/video-js/video.js	(revision 24676)
+++ /extensions/piwigo_videojs/video-js/video.js	(revision 24676)
@@ -0,0 +1,121 @@
+/*! Video.js v4.1.0 Copyright 2013 Brightcove, Inc. https://github.com/videojs/video.js/blob/master/LICENSE */
+ (function() {var b=void 0,f=!0,h=null,l=!1;function m(){return function(){}}function p(a){return function(){return this[a]}}function r(a){return function(){return a}}var t;document.createElement("video");document.createElement("audio");document.createElement("track");function u(a,c,d){if("string"===typeof a){0===a.indexOf("#")&&(a=a.slice(1));if(u.va[a])return u.va[a];a=u.r(a)}if(!a||!a.nodeName)throw new TypeError("The element or ID supplied is not valid. (videojs)");return a.player||new u.C(a,c,d)}var v=u;
+window.Bd=window.Cd=u;u.Qb="4.1";u.yc="https:"==document.location.protocol?"https://":"http://";u.options={techOrder:["html5","flash"],html5:{},flash:{},width:300,height:150,defaultVolume:0,children:{mediaLoader:{},posterImage:{},textTrackDisplay:{},loadingSpinner:{},bigPlayButton:{},controlBar:{}}};"GENERATED_CDN_VSN"!==u.Qb&&(v.options.flash.swf=u.yc+"vjs.zencdn.net/"+u.Qb+"/video-js.swf");u.va={};u.ka=u.CoreObject=m();
+u.ka.extend=function(a){var c,d;a=a||{};c=a.init||a.g||this.prototype.init||this.prototype.g||m();d=function(){c.apply(this,arguments)};d.prototype=u.i.create(this.prototype);d.prototype.constructor=d;d.extend=u.ka.extend;d.create=u.ka.create;for(var e in a)a.hasOwnProperty(e)&&(d.prototype[e]=a[e]);return d};u.ka.create=function(){var a=u.i.create(this.prototype);this.apply(a,arguments);return a};
+u.d=function(a,c,d){var e=u.getData(a);e.z||(e.z={});e.z[c]||(e.z[c]=[]);d.u||(d.u=u.u++);e.z[c].push(d);e.T||(e.disabled=l,e.T=function(c){if(!e.disabled){c=u.hc(c);var d=e.z[c.type];if(d)for(var d=d.slice(0),k=0,q=d.length;k<q&&!c.nc();k++)d[k].call(a,c)}});1==e.z[c].length&&(document.addEventListener?a.addEventListener(c,e.T,l):document.attachEvent&&a.attachEvent("on"+c,e.T))};
+u.t=function(a,c,d){if(u.mc(a)){var e=u.getData(a);if(e.z)if(c){var g=e.z[c];if(g){if(d){if(d.u)for(e=0;e<g.length;e++)g[e].u===d.u&&g.splice(e--,1)}else e.z[c]=[];u.ec(a,c)}}else for(g in e.z)c=g,e.z[c]=[],u.ec(a,c)}};u.ec=function(a,c){var d=u.getData(a);0===d.z[c].length&&(delete d.z[c],document.removeEventListener?a.removeEventListener(c,d.T,l):document.detachEvent&&a.detachEvent("on"+c,d.T));u.Bb(d.z)&&(delete d.z,delete d.T,delete d.disabled);u.Bb(d)&&u.sc(a)};
+u.hc=function(a){function c(){return f}function d(){return l}if(!a||!a.Cb){var e=a||window.event;a={};for(var g in e)"layerX"!==g&&"layerY"!==g&&(a[g]=e[g]);a.target||(a.target=a.srcElement||document);a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;a.preventDefault=function(){e.preventDefault&&e.preventDefault();a.returnValue=l;a.Ab=c};a.Ab=d;a.stopPropagation=function(){e.stopPropagation&&e.stopPropagation();a.cancelBubble=f;a.Cb=c};a.Cb=d;a.stopImmediatePropagation=function(){e.stopImmediatePropagation&&
+e.stopImmediatePropagation();a.nc=c;a.stopPropagation()};a.nc=d;if(a.clientX!=h){g=document.documentElement;var j=document.body;a.pageX=a.clientX+(g&&g.scrollLeft||j&&j.scrollLeft||0)-(g&&g.clientLeft||j&&j.clientLeft||0);a.pageY=a.clientY+(g&&g.scrollTop||j&&j.scrollTop||0)-(g&&g.clientTop||j&&j.clientTop||0)}a.which=a.charCode||a.keyCode;a.button!=h&&(a.button=a.button&1?0:a.button&4?1:a.button&2?2:0)}return a};
+u.k=function(a,c){var d=u.mc(a)?u.getData(a):{},e=a.parentNode||a.ownerDocument;"string"===typeof c&&(c={type:c,target:a});c=u.hc(c);d.T&&d.T.call(a,c);if(e&&!c.Cb())u.k(e,c);else if(!e&&!c.Ab()&&(d=u.getData(c.target),c.target[c.type])){d.disabled=f;if("function"===typeof c.target[c.type])c.target[c.type]();d.disabled=l}return!c.Ab()};u.R=function(a,c,d){u.d(a,c,function(){u.t(a,c,arguments.callee);d.apply(this,arguments)})};var w=Object.prototype.hasOwnProperty;
+u.e=function(a,c){var d=document.createElement(a||"div"),e;for(e in c)w.call(c,e)&&(-1!==e.indexOf("aria-")||"role"==e?d.setAttribute(e,c[e]):d[e]=c[e]);return d};u.Z=function(a){return a.charAt(0).toUpperCase()+a.slice(1)};u.i={};u.i.create=Object.create||function(a){function c(){}c.prototype=a;return new c};u.i.ra=function(a,c,d){for(var e in a)w.call(a,e)&&c.call(d||this,e,a[e])};u.i.B=function(a,c){if(!c)return a;for(var d in c)w.call(c,d)&&(a[d]=c[d]);return a};
+u.i.gc=function(a,c){var d,e,g;a=u.i.copy(a);for(d in c)w.call(c,d)&&(e=a[d],g=c[d],a[d]=u.i.oc(e)&&u.i.oc(g)?u.i.gc(e,g):c[d]);return a};u.i.copy=function(a){return u.i.B({},a)};u.i.oc=function(a){return!!a&&"object"===typeof a&&"[object Object]"===a.toString()&&a.constructor===Object};u.bind=function(a,c,d){function e(){return c.apply(a,arguments)}c.u||(c.u=u.u++);e.u=d?d+"_"+c.u:c.u;return e};u.pa={};u.u=1;u.expando="vdata"+(new Date).getTime();
+u.getData=function(a){var c=a[u.expando];c||(c=a[u.expando]=u.u++,u.pa[c]={});return u.pa[c]};u.mc=function(a){a=a[u.expando];return!(!a||u.Bb(u.pa[a]))};u.sc=function(a){var c=a[u.expando];if(c){delete u.pa[c];try{delete a[u.expando]}catch(d){a.removeAttribute?a.removeAttribute(u.expando):a[u.expando]=h}}};u.Bb=function(a){for(var c in a)if(a[c]!==h)return l;return f};u.p=function(a,c){-1==(" "+a.className+" ").indexOf(" "+c+" ")&&(a.className=""===a.className?c:a.className+" "+c)};
+u.w=function(a,c){if(-1!=a.className.indexOf(c)){for(var d=a.className.split(" "),e=d.length-1;0<=e;e--)d[e]===c&&d.splice(e,1);a.className=d.join(" ")}};u.ma=u.e("video");u.G=navigator.userAgent;u.Cc=/iPhone/i.test(u.G);u.Bc=/iPad/i.test(u.G);u.Dc=/iPod/i.test(u.G);u.Ub=u.Cc||u.Bc||u.Dc;var aa=u,x;var y=u.G.match(/OS (\d+)_/i);x=y&&y[1]?y[1]:b;aa.td=x;u.ab=/Android/i.test(u.G);var ba=u,z;var A=u.G.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i),B,C;
+A?(B=A[1]&&parseFloat(A[1]),C=A[2]&&parseFloat(A[2]),z=B&&C?parseFloat(A[1]+"."+A[2]):B?B:h):z=h;ba.zc=z;u.Ec=u.ab&&/webkit/i.test(u.G)&&2.3>u.zc;u.Ac=/Firefox/i.test(u.G);u.ud=/Chrome/i.test(u.G);u.xb=function(a){var c={};if(a&&a.attributes&&0<a.attributes.length)for(var d=a.attributes,e,g,j=d.length-1;0<=j;j--){e=d[j].name;g=d[j].value;if("boolean"===typeof a[e]||-1!==",autoplay,controls,loop,muted,default,".indexOf(","+e+","))g=g!==h?f:l;c[e]=g}return c};
+u.xd=function(a,c){var d="";document.defaultView&&document.defaultView.getComputedStyle?d=document.defaultView.getComputedStyle(a,"").getPropertyValue(c):a.currentStyle&&(d=a["client"+c.substr(0,1).toUpperCase()+c.substr(1)]+"px");return d};u.zb=function(a,c){c.firstChild?c.insertBefore(a,c.firstChild):c.appendChild(a)};u.Ob={};u.r=function(a){0===a.indexOf("#")&&(a=a.slice(1));return document.getElementById(a)};
+u.Ka=function(a,c){c=c||a;var d=Math.floor(a%60),e=Math.floor(a/60%60),g=Math.floor(a/3600),j=Math.floor(c/60%60),k=Math.floor(c/3600),g=0<g||0<k?g+":":"";return g+(((g||10<=j)&&10>e?"0"+e:e)+":")+(10>d?"0"+d:d)};u.Ic=function(){document.body.focus();document.onselectstart=r(l)};u.od=function(){document.onselectstart=r(f)};u.trim=function(a){return a.toString().replace(/^\s+/,"").replace(/\s+$/,"")};u.round=function(a,c){c||(c=0);return Math.round(a*Math.pow(10,c))/Math.pow(10,c)};
+u.tb=function(a,c){return{length:1,start:function(){return a},end:function(){return c}}};
+u.get=function(a,c,d){var e=0===a.indexOf("file:")||0===window.location.href.indexOf("file:")&&-1===a.indexOf("http");"undefined"===typeof XMLHttpRequest&&(window.XMLHttpRequest=function(){try{return new window.ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new window.ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(c){}try{return new window.ActiveXObject("Msxml2.XMLHTTP")}catch(d){}throw Error("This browser does not support XMLHttpRequest.");});var g=new XMLHttpRequest;try{g.open("GET",a)}catch(j){d(j)}g.onreadystatechange=
+function(){4===g.readyState&&(200===g.status||e&&0===g.status?c(g.responseText):d&&d())};try{g.send()}catch(k){d&&d(k)}};u.gd=function(a){try{var c=window.localStorage||l;c&&(c.volume=a)}catch(d){22==d.code||1014==d.code?u.log("LocalStorage Full (VideoJS)",d):18==d.code?u.log("LocalStorage not allowed (VideoJS)",d):u.log("LocalStorage Error (VideoJS)",d)}};u.kc=function(a){a.match(/^https?:\/\//)||(a=u.e("div",{innerHTML:'<a href="'+a+'">x</a>'}).firstChild.href);return a};
+u.log=function(){u.log.history=u.log.history||[];u.log.history.push(arguments);window.console&&window.console.log(Array.prototype.slice.call(arguments))};u.Qc=function(a){var c,d;a.getBoundingClientRect&&a.parentNode&&(c=a.getBoundingClientRect());if(!c)return{left:0,top:0};a=document.documentElement;d=document.body;return{left:c.left+(window.pageXOffset||d.scrollLeft)-(a.clientLeft||d.clientLeft||0),top:c.top+(window.pageYOffset||d.scrollTop)-(a.clientTop||d.clientTop||0)}};
+u.c=u.ka.extend({g:function(a,c,d){this.a=a;this.f=u.i.copy(this.f);c=this.options(c);this.O=c.id||(c.el&&c.el.id?c.el.id:a.id()+"_component_"+u.u++);this.Vc=c.name||h;this.b=c.el||this.e();this.H=[];this.rb={};this.S={};if((a=this.f)&&a.children){var e=this;u.i.ra(a.children,function(a,c){c!==l&&!c.loadEvent&&(e[a]=e.Y(a,c))})}this.P(d)}});t=u.c.prototype;
+t.D=function(){if(this.H)for(var a=this.H.length-1;0<=a;a--)this.H[a].D&&this.H[a].D();this.S=this.rb=this.H=h;this.t();this.b.parentNode&&this.b.parentNode.removeChild(this.b);u.sc(this.b);this.b=h};t.bd=p("a");t.options=function(a){return a===b?this.f:this.f=u.i.gc(this.f,a)};t.e=function(a,c){return u.e(a,c)};t.r=p("b");t.id=p("O");t.name=p("Vc");t.children=p("H");
+t.Y=function(a,c){var d,e;"string"===typeof a?(e=a,c=c||{},d=c.componentClass||u.Z(e),c.name=e,d=new window.videojs[d](this.a||this,c)):d=a;this.H.push(d);"function"===typeof d.id&&(this.rb[d.id()]=d);(e=e||d.name&&d.name())&&(this.S[e]=d);"function"===typeof d.el&&d.el()&&(this.qa||this.b).appendChild(d.el());return d};
+t.removeChild=function(a){"string"===typeof a&&(a=this.S[a]);if(a&&this.H){for(var c=l,d=this.H.length-1;0<=d;d--)if(this.H[d]===a){c=f;this.H.splice(d,1);break}c&&(this.rb[a.id]=h,this.S[a.name]=h,(c=a.r())&&c.parentNode===(this.qa||this.b)&&(this.qa||this.b).removeChild(a.r()))}};t.Q=r("");t.d=function(a,c){u.d(this.b,a,u.bind(this,c));return this};t.t=function(a,c){u.t(this.b,a,c);return this};t.R=function(a,c){u.R(this.b,a,u.bind(this,c));return this};t.k=function(a,c){u.k(this.b,a,c);return this};
+t.P=function(a){a&&(this.aa?a.call(this):(this.Ra===b&&(this.Ra=[]),this.Ra.push(a)));return this};t.Ta=function(){this.aa=f;var a=this.Ra;if(a&&0<a.length){for(var c=0,d=a.length;c<d;c++)a[c].call(this);this.Ra=[];this.k("ready")}};t.p=function(a){u.p(this.b,a);return this};t.w=function(a){u.w(this.b,a);return this};t.show=function(){this.b.style.display="block";return this};t.v=function(){this.b.style.display="none";return this};t.$=function(){this.w("vjs-fade-out");this.p("vjs-fade-in");return this};
+t.ta=function(){this.w("vjs-fade-in");this.p("vjs-fade-out");return this};t.pc=function(){this.p("vjs-lock-showing");return this};t.Ua=function(){this.w("vjs-lock-showing");return this};t.disable=function(){this.v();this.show=m();this.$=m()};t.width=function(a,c){return D(this,"width",a,c)};t.height=function(a,c){return D(this,"height",a,c)};t.Mc=function(a,c){return this.width(a,f).height(c)};
+function D(a,c,d,e){if(d!==b)return a.b.style[c]=-1!==(""+d).indexOf("%")||-1!==(""+d).indexOf("px")?d:"auto"===d?"":d+"px",e||a.k("resize"),a;if(!a.b)return 0;d=a.b.style[c];e=d.indexOf("px");return-1!==e?parseInt(d.slice(0,e),10):parseInt(a.b["offset"+u.Z(c)],10)}
+u.o=u.c.extend({g:function(a,c){u.c.call(this,a,c);var d=l;this.d("touchstart",function(){d=f});this.d("touchmove",function(){d=l});var e=this;this.d("touchend",function(a){d&&e.n(a);a.preventDefault();a.stopPropagation()});this.d("click",this.n);this.d("focus",this.Na);this.d("blur",this.Ma)}});t=u.o.prototype;
+t.e=function(a,c){c=u.i.B({className:this.Q(),innerHTML:'<div class="vjs-control-content"><span class="vjs-control-text">'+(this.oa||"Need Text")+"</span></div>",dd:"button","aria-live":"polite",tabIndex:0},c);return u.c.prototype.e.call(this,a,c)};t.Q=function(){return"vjs-control "+u.c.prototype.Q.call(this)};t.n=m();t.Na=function(){u.d(document,"keyup",u.bind(this,this.ba))};t.ba=function(a){if(32==a.which||13==a.which)a.preventDefault(),this.n()};
+t.Ma=function(){u.t(document,"keyup",u.bind(this,this.ba))};u.M=u.c.extend({g:function(a,c){u.c.call(this,a,c);this.Hc=this.S[this.f.barName];this.handle=this.S[this.f.handleName];a.d(this.qc,u.bind(this,this.update));this.d("mousedown",this.Oa);this.d("touchstart",this.Oa);this.d("focus",this.Na);this.d("blur",this.Ma);this.d("click",this.n);this.a.d("controlsvisible",u.bind(this,this.update));a.P(u.bind(this,this.update));this.N={}}});t=u.M.prototype;
+t.e=function(a,c){c=c||{};c.className+=" vjs-slider";c=u.i.B({dd:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},c);return u.c.prototype.e.call(this,a,c)};t.Oa=function(a){a.preventDefault();u.Ic();this.N.move=u.bind(this,this.Hb);this.N.end=u.bind(this,this.Ib);u.d(document,"mousemove",this.N.move);u.d(document,"mouseup",this.N.end);u.d(document,"touchmove",this.N.move);u.d(document,"touchend",this.N.end);this.Hb(a)};
+t.Ib=function(){u.od();u.t(document,"mousemove",this.N.move,l);u.t(document,"mouseup",this.N.end,l);u.t(document,"touchmove",this.N.move,l);u.t(document,"touchend",this.N.end,l);this.update()};t.update=function(){if(this.b){var a,c=this.yb(),d=this.handle,e=this.Hc;isNaN(c)&&(c=0);a=c;if(d){a=this.b.offsetWidth;var g=d.r().offsetWidth;a=g?g/a:0;c*=1-a;a=c+a/2;d.r().style.left=u.round(100*c,2)+"%"}e.r().style.width=u.round(100*a,2)+"%"}};
+function E(a,c){var d,e,g,j;d=a.b;e=u.Qc(d);j=g=d.offsetWidth;d=a.handle;if(a.f.pd)return j=e.top,e=c.changedTouches?c.changedTouches[0].pageY:c.pageY,d&&(d=d.r().offsetHeight,j+=d/2,g-=d),Math.max(0,Math.min(1,(j-e+g)/g));g=e.left;e=c.changedTouches?c.changedTouches[0].pageX:c.pageX;d&&(d=d.r().offsetWidth,g+=d/2,j-=d);return Math.max(0,Math.min(1,(e-g)/j))}t.Na=function(){u.d(document,"keyup",u.bind(this,this.ba))};
+t.ba=function(a){37==a.which?(a.preventDefault(),this.vc()):39==a.which&&(a.preventDefault(),this.wc())};t.Ma=function(){u.t(document,"keyup",u.bind(this,this.ba))};t.n=function(a){a.stopImmediatePropagation();a.preventDefault()};u.ga=u.c.extend();u.ga.prototype.defaultValue=0;u.ga.prototype.e=function(a,c){c=c||{};c.className+=" vjs-slider-handle";c=u.i.B({innerHTML:'<span class="vjs-control-text">'+this.defaultValue+"</span>"},c);return u.c.prototype.e.call(this,"div",c)};u.la=u.c.extend();
+function ca(a,c){a.Y(c);c.d("click",u.bind(a,function(){this.Ua()}))}u.la.prototype.e=function(){var a=this.options().Kc||"ul";this.qa=u.e(a,{className:"vjs-menu-content"});a=u.c.prototype.e.call(this,"div",{append:this.qa,className:"vjs-menu"});a.appendChild(this.qa);u.d(a,"click",function(a){a.preventDefault();a.stopImmediatePropagation()});return a};u.L=u.o.extend({g:function(a,c){u.o.call(this,a,c);this.selected(c.selected)}});
+u.L.prototype.e=function(a,c){return u.o.prototype.e.call(this,"li",u.i.B({className:"vjs-menu-item",innerHTML:this.f.label},c))};u.L.prototype.n=function(){this.selected(f)};u.L.prototype.selected=function(a){a?(this.p("vjs-selected"),this.b.setAttribute("aria-selected",f)):(this.w("vjs-selected"),this.b.setAttribute("aria-selected",l))};
+u.ea=u.o.extend({g:function(a,c){u.o.call(this,a,c);this.ua=this.Ja();this.Y(this.ua);this.J&&0===this.J.length&&this.v();this.d("keyup",this.ba);this.b.setAttribute("aria-haspopup",f);this.b.setAttribute("role","button")}});t=u.ea.prototype;t.na=l;t.Ja=function(){var a=new u.la(this.a);this.options().title&&a.r().appendChild(u.e("li",{className:"vjs-menu-title",innerHTML:u.Z(this.A),md:-1}));if(this.J=this.sb())for(var c=0;c<this.J.length;c++)ca(a,this.J[c]);return a};t.sb=m();
+t.Q=function(){return this.className+" vjs-menu-button "+u.o.prototype.Q.call(this)};t.Na=m();t.Ma=m();t.n=function(){this.R("mouseout",u.bind(this,function(){this.ua.Ua();this.b.blur()}));this.na?F(this):G(this)};t.ba=function(a){a.preventDefault();32==a.which||13==a.which?this.na?F(this):G(this):27==a.which&&this.na&&F(this)};function G(a){a.na=f;a.ua.pc();a.b.setAttribute("aria-pressed",f);a.J&&0<a.J.length&&a.J[0].r().focus()}function F(a){a.na=l;a.ua.Ua();a.b.setAttribute("aria-pressed",l)}
+u.C=u.c.extend({g:function(a,c,d){this.F=a;c=u.i.B(da(a),c);this.s={};this.rc=c.poster;this.Ia=c.controls;c.customControlsOnMobile!==f&&(u.Ub||u.ab)?(a.controls=c.controls,this.Ia=l):a.controls=l;u.c.call(this,this,c,d);this.R("play",function(a){u.k(this.b,{type:"firstplay",target:this.b})||(a.preventDefault(),a.stopPropagation(),a.stopImmediatePropagation())});this.d("ended",this.Xc);this.d("play",this.Kb);this.d("firstplay",this.Yc);this.d("pause",this.Jb);this.d("progress",this.$c);this.d("durationchange",
+this.Wc);this.d("error",this.Gb);this.d("fullscreenchange",this.Zc);u.va[this.O]=this;c.plugins&&u.i.ra(c.plugins,function(a,c){this[a](c)},this)}});t=u.C.prototype;t.f=u.options;t.D=function(){u.va[this.O]=h;this.F&&this.F.player&&(this.F.player=h);this.b&&this.b.player&&(this.b.player=h);clearInterval(this.Qa);this.xa();this.h&&this.h.D();u.c.prototype.D.call(this)};
+function da(a){var c={sources:[],tracks:[]};u.i.B(c,u.xb(a));if(a.hasChildNodes()){var d,e,g,j;a=a.childNodes;g=0;for(j=a.length;g<j;g++)d=a[g],e=d.nodeName.toLowerCase(),"source"===e?c.sources.push(u.xb(d)):"track"===e&&c.tracks.push(u.xb(d))}return c}
+t.e=function(){var a=this.b=u.c.prototype.e.call(this,"div"),c=this.F;c.removeAttribute("width");c.removeAttribute("height");if(c.hasChildNodes()){var d,e,g,j,k;d=c.childNodes;e=d.length;for(k=[];e--;)g=d[e],j=g.nodeName.toLowerCase(),("source"===j||"track"===j)&&k.push(g);for(d=0;d<k.length;d++)c.removeChild(k[d])}c.id=c.id||"vjs_video_"+u.u++;a.id=c.id;a.className=c.className;c.id+="_html5_api";c.className="vjs-tech";c.player=a.player=this;this.p("vjs-paused");this.width(this.f.width,f);this.height(this.f.height,
+f);c.parentNode&&c.parentNode.insertBefore(a,c);u.zb(c,a);return a};
+function H(a,c,d){a.h?(a.aa=l,a.h.D(),a.Eb&&(a.Eb=l,clearInterval(a.Qa)),a.Fb&&I(a),a.h=l):"Html5"!==c&&a.F&&(a.b.removeChild(a.F),a.F.player=h,a.F=h);a.ya=c;a.aa=l;var e=u.i.B({source:d,parentEl:a.b},a.f[c.toLowerCase()]);d&&(d.src==a.s.src&&0<a.s.currentTime&&(e.startTime=a.s.currentTime),a.s.src=d.src);a.h=new window.videojs[c](a,e);a.h.P(function(){this.a.Ta();if(!this.j.Mb){var a=this.a;a.Eb=f;a.Qa=setInterval(u.bind(a,function(){this.s.mb<this.buffered().end(0)?this.k("progress"):1==this.Ha()&&
+(clearInterval(this.Qa),this.k("progress"))}),500);a.h.R("progress",function(){this.j.Mb=f;var a=this.a;a.Eb=l;clearInterval(a.Qa)})}this.j.Pb||(a=this.a,a.Fb=f,a.d("play",a.xc),a.d("pause",a.xa),a.h.R("timeupdate",function(){this.j.Pb=f;I(this.a)}))})}function I(a){a.Fb=l;a.xa();a.t("play",a.xc);a.t("pause",a.xa)}t.xc=function(){this.fc&&this.xa();this.fc=setInterval(u.bind(this,function(){this.k("timeupdate")}),250)};t.xa=function(){clearInterval(this.fc)};
+t.Xc=function(){this.f.loop&&(this.currentTime(0),this.play())};t.Kb=function(){u.w(this.b,"vjs-paused");u.p(this.b,"vjs-playing")};t.Yc=function(){this.f.starttime&&this.currentTime(this.f.starttime)};t.Jb=function(){u.w(this.b,"vjs-playing");u.p(this.b,"vjs-paused")};t.$c=function(){1==this.Ha()&&this.k("loadedalldata")};t.Wc=function(){this.duration(J(this,"duration"))};t.Gb=function(a){u.log("Video Error",a)};t.Zc=function(){this.I?this.p("vjs-fullscreen"):this.w("vjs-fullscreen")};
+function K(a,c,d){if(a.h&&!a.h.aa)a.h.P(function(){this[c](d)});else try{a.h[c](d)}catch(e){throw u.log(e),e;}}function J(a,c){if(a.h.aa)try{return a.h[c]()}catch(d){throw a.h[c]===b?u.log("Video.js: "+c+" method not defined for "+a.ya+" playback technology.",d):"TypeError"==d.name?(u.log("Video.js: "+c+" unavailable on "+a.ya+" playback technology element.",d),a.h.aa=l):u.log(d),d;}}t.play=function(){K(this,"play");return this};t.pause=function(){K(this,"pause");return this};
+t.paused=function(){return J(this,"paused")===l?l:f};t.currentTime=function(a){return a!==b?(this.s.zd=a,K(this,"setCurrentTime",a),this.Fb&&this.k("timeupdate"),this):this.s.currentTime=J(this,"currentTime")||0};t.duration=function(a){return a!==b?(this.s.duration=parseFloat(a),this):this.s.duration};t.buffered=function(){var a=J(this,"buffered"),c=this.s.mb=this.s.mb||0;a&&(0<a.length&&a.end(0)!==c)&&(c=a.end(0),this.s.mb=c);return u.tb(0,c)};
+t.Ha=function(){return this.duration()?this.buffered().end(0)/this.duration():0};t.volume=function(a){if(a!==b)return a=Math.max(0,Math.min(1,parseFloat(a))),this.s.volume=a,K(this,"setVolume",a),u.gd(a),this;a=parseFloat(J(this,"volume"));return isNaN(a)?1:a};t.muted=function(a){return a!==b?(K(this,"setMuted",a),this):J(this,"muted")||l};t.Sa=function(){return J(this,"supportsFullScreen")||l};
+t.wa=function(){var a=u.Ob.wa;this.I=f;a?(u.d(document,a.vb,u.bind(this,function(c){this.I=document[a.I];this.I===l&&u.t(document,a.vb,arguments.callee);this.k("fullscreenchange")})),this.b[a.tc]()):this.h.Sa()?K(this,"enterFullScreen"):(this.Sc=f,this.Nc=document.documentElement.style.overflow,u.d(document,"keydown",u.bind(this,this.ic)),document.documentElement.style.overflow="hidden",u.p(document.body,"vjs-full-window"),this.k("enterFullWindow"),this.k("fullscreenchange"));return this};
+t.pb=function(){var a=u.Ob.wa;this.I=l;if(a)document[a.ob]();else this.h.Sa()?K(this,"exitFullScreen"):(L(this),this.k("fullscreenchange"));return this};t.ic=function(a){27===a.keyCode&&(this.I===f?this.pb():L(this))};function L(a){a.Sc=l;u.t(document,"keydown",a.ic);document.documentElement.style.overflow=a.Nc;u.w(document.body,"vjs-full-window");a.k("exitFullWindow")}
+t.src=function(a){if(a instanceof Array){var c;a:{c=a;for(var d=0,e=this.f.techOrder;d<e.length;d++){var g=u.Z(e[d]),j=window.videojs[g];if(j.isSupported())for(var k=0,q=c;k<q.length;k++){var n=q[k];if(j.canPlaySource(n)){c={source:n,h:g};break a}}}c=l}c?(a=c.source,c=c.h,c==this.ya?this.src(a):H(this,c,a)):this.b.appendChild(u.e("p",{innerHTML:'Sorry, no compatible source and playback technology were found for this video. Try using another browser like <a href="http://bit.ly/ccMUEC">Chrome</a> or download the latest <a href="http://adobe.ly/mwfN1">Adobe Flash Player</a>.'}))}else a instanceof
+Object?window.videojs[this.ya].canPlaySource(a)?this.src(a.src):this.src([a]):(this.s.src=a,this.aa?(K(this,"src",a),"auto"==this.f.preload&&this.load(),this.f.autoplay&&this.play()):this.P(function(){this.src(a)}));return this};t.load=function(){K(this,"load");return this};t.currentSrc=function(){return J(this,"currentSrc")||this.s.src||""};t.Pa=function(a){return a!==b?(K(this,"setPreload",a),this.f.preload=a,this):J(this,"preload")};
+t.autoplay=function(a){return a!==b?(K(this,"setAutoplay",a),this.f.autoplay=a,this):J(this,"autoplay")};t.loop=function(a){return a!==b?(K(this,"setLoop",a),this.f.loop=a,this):J(this,"loop")};t.poster=function(a){a!==b&&(this.rc=a);return this.rc};t.controls=function(a){a!==b&&this.Ia!==a&&(this.Ia=!!a,this.k("controlschange"));return this.Ia};t.error=function(){return J(this,"error")};var M,N,O;O=document.createElement("div");N={};
+O.vd!==b?(N.tc="requestFullscreen",N.ob="exitFullscreen",N.vb="fullscreenchange",N.I="fullScreen"):(document.mozCancelFullScreen?(M="moz",N.I=M+"FullScreen"):(M="webkit",N.I=M+"IsFullScreen"),O[M+"RequestFullScreen"]&&(N.tc=M+"RequestFullScreen",N.ob=M+"CancelFullScreen"),N.vb=M+"fullscreenchange");document[N.ob]&&(u.Ob.wa=N);
+u.da=u.c.extend({g:function(a,c){u.c.call(this,a,c);a.controls()||this.disable();a.R("play",u.bind(this,function(){var a,c=u.bind(this,this.$),g=u.bind(this,this.ta);this.$();"ontouchstart"in window||(this.a.d("mouseover",c),this.a.d("mouseout",g),this.a.d("pause",u.bind(this,this.pc)),this.a.d("play",u.bind(this,this.Ua)));a=l;this.a.d("touchstart",function(){a=f});this.a.d("touchmove",function(){a=l});this.a.d("touchend",u.bind(this,function(c){var e;a&&(e=this.r().className.search("fade-in"),-1!==
+e?this.ta():this.$());a=l;this.a.paused()||c.preventDefault()}))}))}});u.da.prototype.f={Ad:"play",children:{playToggle:{},currentTimeDisplay:{},timeDivider:{},durationDisplay:{},remainingTimeDisplay:{},progressControl:{},fullscreenToggle:{},volumeControl:{},muteToggle:{}}};u.da.prototype.e=function(){return u.e("div",{className:"vjs-control-bar"})};u.da.prototype.$=function(){u.c.prototype.$.call(this);this.a.k("controlsvisible")};u.da.prototype.ta=function(){u.c.prototype.ta.call(this);this.a.k("controlshidden")};
+u.Xb=u.o.extend({g:function(a,c){u.o.call(this,a,c);a.d("play",u.bind(this,this.Kb));a.d("pause",u.bind(this,this.Jb))}});t=u.Xb.prototype;t.oa="Play";t.Q=function(){return"vjs-play-control "+u.o.prototype.Q.call(this)};t.n=function(){this.a.paused()?this.a.play():this.a.pause()};t.Kb=function(){u.w(this.b,"vjs-paused");u.p(this.b,"vjs-playing");this.b.children[0].children[0].innerHTML="Pause"};
+t.Jb=function(){u.w(this.b,"vjs-playing");u.p(this.b,"vjs-paused");this.b.children[0].children[0].innerHTML="Play"};u.Ya=u.c.extend({g:function(a,c){u.c.call(this,a,c);a.d("timeupdate",u.bind(this,this.Ba))}});
+u.Ya.prototype.e=function(){var a=u.c.prototype.e.call(this,"div",{className:"vjs-current-time vjs-time-controls vjs-control"});this.content=u.e("div",{className:"vjs-current-time-display",innerHTML:'<span class="vjs-control-text">Current Time </span>0:00',"aria-live":"off"});a.appendChild(u.e("div").appendChild(this.content));return a};
+u.Ya.prototype.Ba=function(){var a=this.a.Nb?this.a.s.currentTime:this.a.currentTime();this.content.innerHTML='<span class="vjs-control-text">Current Time </span>'+u.Ka(a,this.a.duration())};u.Za=u.c.extend({g:function(a,c){u.c.call(this,a,c);a.d("timeupdate",u.bind(this,this.Ba))}});
+u.Za.prototype.e=function(){var a=u.c.prototype.e.call(this,"div",{className:"vjs-duration vjs-time-controls vjs-control"});this.content=u.e("div",{className:"vjs-duration-display",innerHTML:'<span class="vjs-control-text">Duration Time </span>0:00',"aria-live":"off"});a.appendChild(u.e("div").appendChild(this.content));return a};u.Za.prototype.Ba=function(){this.a.duration()&&(this.content.innerHTML='<span class="vjs-control-text">Duration Time </span>'+u.Ka(this.a.duration()))};
+u.ac=u.c.extend({g:function(a,c){u.c.call(this,a,c)}});u.ac.prototype.e=function(){return u.c.prototype.e.call(this,"div",{className:"vjs-time-divider",innerHTML:"<div><span>/</span></div>"})};u.gb=u.c.extend({g:function(a,c){u.c.call(this,a,c);a.d("timeupdate",u.bind(this,this.Ba))}});
+u.gb.prototype.e=function(){var a=u.c.prototype.e.call(this,"div",{className:"vjs-remaining-time vjs-time-controls vjs-control"});this.content=u.e("div",{className:"vjs-remaining-time-display",innerHTML:'<span class="vjs-control-text">Remaining Time </span>-0:00',"aria-live":"off"});a.appendChild(u.e("div").appendChild(this.content));return a};
+u.gb.prototype.Ba=function(){this.a.duration()&&this.a.duration()&&(this.content.innerHTML='<span class="vjs-control-text">Remaining Time </span>-'+u.Ka(this.a.duration()-this.a.currentTime()))};u.Da=u.o.extend({g:function(a,c){u.o.call(this,a,c)}});u.Da.prototype.oa="Fullscreen";u.Da.prototype.Q=function(){return"vjs-fullscreen-control "+u.o.prototype.Q.call(this)};
+u.Da.prototype.n=function(){this.a.I?(this.a.pb(),this.b.children[0].children[0].innerHTML="Fullscreen"):(this.a.wa(),this.b.children[0].children[0].innerHTML="Non-Fullscreen")};u.fb=u.c.extend({g:function(a,c){u.c.call(this,a,c)}});u.fb.prototype.f={children:{seekBar:{}}};u.fb.prototype.e=function(){return u.c.prototype.e.call(this,"div",{className:"vjs-progress-control vjs-control"})};u.Yb=u.M.extend({g:function(a,c){u.M.call(this,a,c);a.d("timeupdate",u.bind(this,this.Aa));a.P(u.bind(this,this.Aa))}});
+t=u.Yb.prototype;t.f={children:{loadProgressBar:{},playProgressBar:{},seekHandle:{}},barName:"playProgressBar",handleName:"seekHandle"};t.qc="timeupdate";t.e=function(){return u.M.prototype.e.call(this,"div",{className:"vjs-progress-holder","aria-label":"video progress bar"})};t.Aa=function(){var a=this.a.Nb?this.a.s.currentTime:this.a.currentTime();this.b.setAttribute("aria-valuenow",u.round(100*this.yb(),2));this.b.setAttribute("aria-valuetext",u.Ka(a,this.a.duration()))};
+t.yb=function(){return this.a.currentTime()/this.a.duration()};t.Oa=function(a){u.M.prototype.Oa.call(this,a);this.a.Nb=f;this.qd=!this.a.paused();this.a.pause()};t.Hb=function(a){a=E(this,a)*this.a.duration();a==this.a.duration()&&(a-=0.1);this.a.currentTime(a)};t.Ib=function(a){u.M.prototype.Ib.call(this,a);this.a.Nb=l;this.qd&&this.a.play()};t.wc=function(){this.a.currentTime(this.a.currentTime()+5)};t.vc=function(){this.a.currentTime(this.a.currentTime()-5)};
+u.bb=u.c.extend({g:function(a,c){u.c.call(this,a,c);a.d("progress",u.bind(this,this.update))}});u.bb.prototype.e=function(){return u.c.prototype.e.call(this,"div",{className:"vjs-load-progress",innerHTML:'<span class="vjs-control-text">Loaded: 0%</span>'})};u.bb.prototype.update=function(){this.b.style&&(this.b.style.width=u.round(100*this.a.Ha(),2)+"%")};u.Wb=u.c.extend({g:function(a,c){u.c.call(this,a,c)}});
+u.Wb.prototype.e=function(){return u.c.prototype.e.call(this,"div",{className:"vjs-play-progress",innerHTML:'<span class="vjs-control-text">Progress: 0%</span>'})};u.hb=u.ga.extend();u.hb.prototype.defaultValue="00:00";u.hb.prototype.e=function(){return u.ga.prototype.e.call(this,"div",{className:"vjs-seek-handle"})};u.jb=u.c.extend({g:function(a,c){u.c.call(this,a,c);a.h&&(a.h.j&&a.h.j.U===l)&&this.p("vjs-hidden");a.d("loadstart",u.bind(this,function(){a.h.j&&a.h.j.U===l?this.p("vjs-hidden"):this.w("vjs-hidden")}))}});
+u.jb.prototype.f={children:{volumeBar:{}}};u.jb.prototype.e=function(){return u.c.prototype.e.call(this,"div",{className:"vjs-volume-control vjs-control"})};u.ib=u.M.extend({g:function(a,c){u.M.call(this,a,c);a.d("volumechange",u.bind(this,this.Aa));a.P(u.bind(this,this.Aa));setTimeout(u.bind(this,this.update),0)}});t=u.ib.prototype;t.Aa=function(){this.b.setAttribute("aria-valuenow",u.round(100*this.a.volume(),2));this.b.setAttribute("aria-valuetext",u.round(100*this.a.volume(),2)+"%")};
+t.f={children:{volumeLevel:{},volumeHandle:{}},barName:"volumeLevel",handleName:"volumeHandle"};t.qc="volumechange";t.e=function(){return u.M.prototype.e.call(this,"div",{className:"vjs-volume-bar","aria-label":"volume level"})};t.Hb=function(a){this.a.volume(E(this,a))};t.yb=function(){return this.a.muted()?0:this.a.volume()};t.wc=function(){this.a.volume(this.a.volume()+0.1)};t.vc=function(){this.a.volume(this.a.volume()-0.1)};u.bc=u.c.extend({g:function(a,c){u.c.call(this,a,c)}});
+u.bc.prototype.e=function(){return u.c.prototype.e.call(this,"div",{className:"vjs-volume-level",innerHTML:'<span class="vjs-control-text"></span>'})};u.kb=u.ga.extend();u.kb.prototype.defaultValue="00:00";u.kb.prototype.e=function(){return u.ga.prototype.e.call(this,"div",{className:"vjs-volume-handle"})};
+u.fa=u.o.extend({g:function(a,c){u.o.call(this,a,c);a.d("volumechange",u.bind(this,this.update));a.h&&(a.h.j&&a.h.j.U===l)&&this.p("vjs-hidden");a.d("loadstart",u.bind(this,function(){a.h.j&&a.h.j.U===l?this.p("vjs-hidden"):this.w("vjs-hidden")}))}});u.fa.prototype.e=function(){return u.o.prototype.e.call(this,"div",{className:"vjs-mute-control vjs-control",innerHTML:'<div><span class="vjs-control-text">Mute</span></div>'})};u.fa.prototype.n=function(){this.a.muted(this.a.muted()?l:f)};
+u.fa.prototype.update=function(){var a=this.a.volume(),c=3;0===a||this.a.muted()?c=0:0.33>a?c=1:0.67>a&&(c=2);this.a.muted()?"Unmute"!=this.b.children[0].children[0].innerHTML&&(this.b.children[0].children[0].innerHTML="Unmute"):"Mute"!=this.b.children[0].children[0].innerHTML&&(this.b.children[0].children[0].innerHTML="Mute");for(a=0;4>a;a++)u.w(this.b,"vjs-vol-"+a);u.p(this.b,"vjs-vol-"+c)};
+u.Fa=u.ea.extend({g:function(a,c){u.ea.call(this,a,c);a.d("volumechange",u.bind(this,this.update));a.h&&(a.h.j&&a.h.j.U===l)&&this.p("vjs-hidden");a.d("loadstart",u.bind(this,function(){a.h.j&&a.h.j.U===l?this.p("vjs-hidden"):this.w("vjs-hidden")}));this.p("vjs-menu-button")}});u.Fa.prototype.Ja=function(){var a=new u.la(this.a,{Kc:"div"}),c=new u.ib(this.a,u.i.B({pd:f},this.f.Dd));a.Y(c);return a};u.Fa.prototype.n=function(){u.fa.prototype.n.call(this);u.ea.prototype.n.call(this)};
+u.Fa.prototype.e=function(){return u.o.prototype.e.call(this,"div",{className:"vjs-volume-menu-button vjs-menu-button vjs-control",innerHTML:'<div><span class="vjs-control-text">Mute</span></div>'})};u.Fa.prototype.update=u.fa.prototype.update;u.eb=u.o.extend({g:function(a,c){u.o.call(this,a,c);(!a.poster()||!a.controls())&&this.v();a.d("play",u.bind(this,this.v))}});
+u.eb.prototype.e=function(){var a=u.e("div",{className:"vjs-poster",tabIndex:-1}),c=this.a.poster();c&&("backgroundSize"in a.style?a.style.backgroundImage='url("'+c+'")':a.appendChild(u.e("img",{src:c})));return a};u.eb.prototype.n=function(){this.a.play()};
+u.Vb=u.c.extend({g:function(a,c){u.c.call(this,a,c);a.d("canplay",u.bind(this,this.v));a.d("canplaythrough",u.bind(this,this.v));a.d("playing",u.bind(this,this.v));a.d("seeked",u.bind(this,this.v));a.d("seeking",u.bind(this,this.show));a.d("seeked",u.bind(this,this.v));a.d("error",u.bind(this,this.show));a.d("waiting",u.bind(this,this.show))}});u.Vb.prototype.e=function(){return u.c.prototype.e.call(this,"div",{className:"vjs-loading-spinner"})};
+u.Wa=u.o.extend({g:function(a,c){u.o.call(this,a,c);a.controls()||this.v();a.d("play",u.bind(this,this.v))}});u.Wa.prototype.e=function(){return u.o.prototype.e.call(this,"div",{className:"vjs-big-play-button",innerHTML:"<span></span>","aria-label":"play video"})};u.Wa.prototype.n=function(){this.a.play()};u.q=u.c.extend({g:function(a,c,d){u.c.call(this,a,c,d)}});u.q.prototype.n=u.ab?m():function(){this.a.controls()&&(this.a.paused()?this.a.play():this.a.pause())};u.q.prototype.j={U:f,jc:l,Mb:l,Pb:l};
+u.media={};u.media.Va="play pause paused currentTime setCurrentTime duration buffered volume setVolume muted setMuted width height supportsFullScreen enterFullScreen src load currentSrc preload setPreload autoplay setAutoplay loop setLoop error networkState readyState seeking initialTime startOffsetTime played seekable ended videoTracks audioTracks videoWidth videoHeight textTracks defaultPlaybackRate playbackRate mediaGroup controller controls defaultMuted".split(" ");
+function ea(){var a=u.media.Va[i];return function(){throw Error('The "'+a+"\" method is not available on the playback technology's API");}}for(var i=u.media.Va.length-1;0<=i;i--)u.q.prototype[u.media.Va[i]]=ea();
+u.m=u.q.extend({g:function(a,c,d){this.j.U=u.m.Jc();this.j.Uc=!u.Ub;this.j.jc=f;u.q.call(this,a,c,d);(c=c.source)&&this.b.currentSrc==c.src?a.k("loadstart"):c&&(this.b.src=c.src);a.P(function(){this.F&&(this.f.autoplay&&this.paused())&&(delete this.F.poster,this.play())});this.d("click",this.n);for(a=u.m.$a.length-1;0<=a;a--)u.d(this.b,u.m.$a[a],u.bind(this.a,this.Pc));this.Ta()}});t=u.m.prototype;t.D=function(){u.q.prototype.D.call(this)};
+t.e=function(){var a=this.a,c=a.F;if(!c||this.j.Uc===l)c?(c.player=h,a.F=h,a.r().removeChild(c),c=c.cloneNode(l)):c=u.e("video",{id:a.id()+"_html5_api",className:"vjs-tech"}),c.player=a,u.zb(c,a.r());for(var d=["autoplay","preload","loop","muted"],e=d.length-1;0<=e;e--){var g=d[e];a.f[g]!==h&&(c[g]=a.f[g])}return c};t.Pc=function(a){this.k(a);a.stopPropagation()};t.play=function(){this.b.play()};t.pause=function(){this.b.pause()};t.paused=function(){return this.b.paused};t.currentTime=function(){return this.b.currentTime};
+t.fd=function(a){try{this.b.currentTime=a}catch(c){u.log(c,"Video is not ready. (Video.js)")}};t.duration=function(){return this.b.duration||0};t.buffered=function(){return this.b.buffered};t.volume=function(){return this.b.volume};t.ld=function(a){this.b.volume=a};t.muted=function(){return this.b.muted};t.jd=function(a){this.b.muted=a};t.width=function(){return this.b.offsetWidth};t.height=function(){return this.b.offsetHeight};
+t.Sa=function(){return"function"==typeof this.b.webkitEnterFullScreen&&(/Android/.test(u.G)||!/Chrome|Mac OS X 10.5/.test(u.G))?f:l};t.src=function(a){this.b.src=a};t.load=function(){this.b.load()};t.currentSrc=function(){return this.b.currentSrc};t.Pa=function(){return this.b.Pa};t.kd=function(a){this.b.Pa=a};t.autoplay=function(){return this.b.autoplay};t.ed=function(a){this.b.autoplay=a};t.loop=function(){return this.b.loop};t.hd=function(a){this.b.loop=a};t.error=function(){return this.b.error};
+u.m.isSupported=function(){return!!u.ma.canPlayType};u.m.nb=function(a){try{return!!u.ma.canPlayType(a.type)}catch(c){return""}};u.m.Jc=function(){var a=u.ma.volume;u.ma.volume=a/2+0.1;return a!==u.ma.volume};u.m.$a="loadstart suspend abort error emptied stalled loadedmetadata loadeddata canplay canplaythrough playing waiting seeking seeked ended durationchange timeupdate progress play pause ratechange volumechange".split(" ");
+u.Ec&&(document.createElement("video").constructor.prototype.canPlayType=function(a){return a&&-1!=a.toLowerCase().indexOf("video/mp4")?"maybe":""});
+u.l=u.q.extend({g:function(a,c,d){u.q.call(this,a,c,d);d=c.source;var e=c.parentEl,g=this.b=u.e("div",{id:a.id()+"_temp_flash"}),j=a.id()+"_flash_api";a=a.f;var k=u.i.B({readyFunction:"videojs.Flash.onReady",eventProxyFunction:"videojs.Flash.onEvent",errorEventProxyFunction:"videojs.Flash.onError",autoplay:a.autoplay,preload:a.Pa,loop:a.loop,muted:a.muted},c.flashVars),q=u.i.B({wmode:"opaque",bgcolor:"#000000"},c.params),n=u.i.B({id:j,name:j,"class":"vjs-tech"},c.attributes);d&&(k.src=encodeURIComponent(u.kc(d.src)));
+u.zb(g,e);c.startTime&&this.P(function(){this.load();this.play();this.currentTime(c.startTime)});if(c.iFrameMode===f&&!u.Ac){var s=u.e("iframe",{id:j+"_iframe",name:j+"_iframe",className:"vjs-tech",scrolling:"no",marginWidth:0,marginHeight:0,frameBorder:0});k.readyFunction="ready";k.eventProxyFunction="events";k.errorEventProxyFunction="errors";u.d(s,"load",u.bind(this,function(){var a,d=s.contentWindow;a=s.contentDocument?s.contentDocument:s.contentWindow.document;a.write(u.l.lc(c.swf,k,q,n));d.player=
+this.a;d.ready=u.bind(this.a,function(c){c=a.getElementById(c);var d=this.h;d.b=c;u.d(c,"click",d.bind(d.n));u.l.qb(d)});d.events=u.bind(this.a,function(a,c){this&&"flash"===this.ya&&this.k(c)});d.errors=u.bind(this.a,function(a,c){u.log("Flash Error",c)})}));g.parentNode.replaceChild(s,g)}else u.l.Oc(c.swf,g,k,q,n)}});t=u.l.prototype;t.D=function(){u.q.prototype.D.call(this)};t.play=function(){this.b.vjs_play()};t.pause=function(){this.b.vjs_pause()};
+t.src=function(a){a=u.kc(a);this.b.vjs_src(a);if(this.a.autoplay()){var c=this;setTimeout(function(){c.play()},0)}};t.load=function(){this.b.vjs_load()};t.poster=function(){this.b.vjs_getProperty("poster")};t.buffered=function(){return u.tb(0,this.b.vjs_getProperty("buffered"))};t.Sa=r(l);var P=u.l.prototype,Q="preload currentTime defaultPlaybackRate playbackRate autoplay loop mediaGroup controller controls volume muted defaultMuted".split(" "),R="error currentSrc networkState readyState seeking initialTime duration startOffsetTime paused played seekable ended videoTracks audioTracks videoWidth videoHeight textTracks".split(" ");
+function fa(){var a=Q[S],c=a.charAt(0).toUpperCase()+a.slice(1);P["set"+c]=function(c){return this.b.vjs_setProperty(a,c)}}function T(a){P[a]=function(){return this.b.vjs_getProperty(a)}}var S;for(S=0;S<Q.length;S++)T(Q[S]),fa();for(S=0;S<R.length;S++)T(R[S]);u.l.isSupported=function(){return 10<=u.l.version()[0]};u.l.nb=function(a){if(a.type in u.l.Rc)return"maybe"};u.l.Rc={"video/flv":"FLV","video/x-flv":"FLV","video/mp4":"MP4","video/m4v":"MP4"};
+u.l.onReady=function(a){a=u.r(a);var c=a.player||a.parentNode.player,d=c.h;a.player=c;d.b=a;d.d("click",d.n);u.l.qb(d)};u.l.qb=function(a){a.r().vjs_getProperty?a.Ta():setTimeout(function(){u.l.qb(a)},50)};u.l.onEvent=function(a,c){u.r(a).player.k(c)};u.l.onError=function(a,c){u.r(a).player.k("error");u.log("Flash Error",c,a)};
+u.l.version=function(){var a="0,0,0";try{a=(new window.ActiveXObject("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(c){try{navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin&&(a=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1])}catch(d){}}return a.split(",")};
+u.l.Oc=function(a,c,d,e,g){a=u.l.lc(a,d,e,g);a=u.e("div",{innerHTML:a}).childNodes[0];d=c.parentNode;c.parentNode.replaceChild(a,c);var j=d.childNodes[0];setTimeout(function(){j.style.display="block"},1E3)};
+u.l.lc=function(a,c,d,e){var g="",j="",k="";c&&u.i.ra(c,function(a,c){g+=a+"="+c+"&amp;"});d=u.i.B({movie:a,flashvars:g,allowScriptAccess:"always",allowNetworking:"all"},d);u.i.ra(d,function(a,c){j+='<param name="'+a+'" value="'+c+'" />'});e=u.i.B({data:a,width:"100%",height:"100%"},e);u.i.ra(e,function(a,c){k+=a+'="'+c+'" '});return'<object type="application/x-shockwave-flash"'+k+">"+j+"</object>"};
+u.Fc=u.c.extend({g:function(a,c,d){u.c.call(this,a,c,d);if(!a.f.sources||0===a.f.sources.length){c=0;for(d=a.f.techOrder;c<d.length;c++){var e=u.Z(d[c]),g=window.videojs[e];if(g&&g.isSupported()){H(a,e);break}}}else a.src(a.f.sources)}});function U(a){a.za=a.za||[];return a.za}function V(a,c,d){for(var e=a.za,g=0,j=e.length,k,q;g<j;g++)k=e[g],k.id()===c?(k.show(),q=k):d&&(k.K()==d&&0<k.mode())&&k.disable();(c=q?q.K():d?d:l)&&a.k(c+"trackchange")}
+u.V=u.c.extend({g:function(a,c){u.c.call(this,a,c);this.O=c.id||"vjs_"+c.kind+"_"+c.language+"_"+u.u++;this.uc=c.src;this.Lc=c["default"]||c.dflt;this.nd=c.title;this.yd=c.srclang;this.Tc=c.label;this.ha=[];this.cc=[];this.ia=this.ja=0;this.a.d("fullscreenchange",u.bind(this,this.Gc))}});t=u.V.prototype;t.K=p("A");t.src=p("uc");t.ub=p("Lc");t.title=p("nd");t.label=p("Tc");t.readyState=p("ja");t.mode=p("ia");t.Gc=function(){this.b.style.fontSize=this.a.I?140*(screen.width/this.a.width())+"%":""};
+t.e=function(){return u.c.prototype.e.call(this,"div",{className:"vjs-"+this.A+" vjs-text-track"})};t.show=function(){W(this);this.ia=2;u.c.prototype.show.call(this)};t.v=function(){W(this);this.ia=1;u.c.prototype.v.call(this)};t.disable=function(){2==this.ia&&this.v();this.a.t("timeupdate",u.bind(this,this.update,this.O));this.a.t("ended",u.bind(this,this.reset,this.O));this.reset();this.a.S.textTrackDisplay.removeChild(this);this.ia=0};
+function W(a){0===a.ja&&a.load();0===a.ia&&(a.a.d("timeupdate",u.bind(a,a.update,a.O)),a.a.d("ended",u.bind(a,a.reset,a.O)),("captions"===a.A||"subtitles"===a.A)&&a.a.S.textTrackDisplay.Y(a))}t.load=function(){0===this.ja&&(this.ja=1,u.get(this.uc,u.bind(this,this.ad),u.bind(this,this.Gb)))};t.Gb=function(a){this.error=a;this.ja=3;this.k("error")};
+t.ad=function(a){var c,d;a=a.split("\n");for(var e="",g=1,j=a.length;g<j;g++)if(e=u.trim(a[g])){-1==e.indexOf("--\x3e")?(c=e,e=u.trim(a[++g])):c=this.ha.length;c={id:c,index:this.ha.length};d=e.split(" --\x3e ");c.startTime=X(d[0]);c.sa=X(d[1]);for(d=[];a[++g]&&(e=u.trim(a[g]));)d.push(e);c.text=d.join("<br/>");this.ha.push(c)}this.ja=2;this.k("loaded")};
+function X(a){var c=a.split(":");a=0;var d,e,g;3==c.length?(d=c[0],e=c[1],c=c[2]):(d=0,e=c[0],c=c[1]);c=c.split(/\s+/);c=c.splice(0,1)[0];c=c.split(/\.|,/);g=parseFloat(c[1]);c=c[0];a+=3600*parseFloat(d);a+=60*parseFloat(e);a+=parseFloat(c);g&&(a+=g/1E3);return a}
+t.update=function(){if(0<this.ha.length){var a=this.a.currentTime();if(this.Lb===b||a<this.Lb||this.La<=a){var c=this.ha,d=this.a.duration(),e=0,g=l,j=[],k,q,n,s;a>=this.La||this.La===b?s=this.wb!==b?this.wb:0:(g=f,s=this.Db!==b?this.Db:c.length-1);for(;;){n=c[s];if(n.sa<=a)e=Math.max(e,n.sa),n.Ga&&(n.Ga=l);else if(a<n.startTime){if(d=Math.min(d,n.startTime),n.Ga&&(n.Ga=l),!g)break}else g?(j.splice(0,0,n),q===b&&(q=s),k=s):(j.push(n),k===b&&(k=s),q=s),d=Math.min(d,n.sa),e=Math.max(e,n.startTime),
+n.Ga=f;if(g)if(0===s)break;else s--;else if(s===c.length-1)break;else s++}this.cc=j;this.La=d;this.Lb=e;this.wb=k;this.Db=q;a=this.cc;c="";d=0;for(e=a.length;d<e;d++)c+='<span class="vjs-tt-cue">'+a[d].text+"</span>";this.b.innerHTML=c;this.k("cuechange")}}};t.reset=function(){this.La=0;this.Lb=this.a.duration();this.Db=this.wb=0};u.Rb=u.V.extend();u.Rb.prototype.A="captions";u.Zb=u.V.extend();u.Zb.prototype.A="subtitles";u.Tb=u.V.extend();u.Tb.prototype.A="chapters";
+u.$b=u.c.extend({g:function(a,c,d){u.c.call(this,a,c,d);if(a.f.tracks&&0<a.f.tracks.length){c=this.a;a=a.f.tracks;var e;for(d=0;d<a.length;d++){e=a[d];var g=c,j=e.kind,k=e.label,q=e.language,n=e;e=g.za=g.za||[];n=n||{};n.kind=j;n.label=k;n.language=q;j=u.Z(j||"subtitles");g=new window.videojs[j+"Track"](g,n);e.push(g)}}}});u.$b.prototype.e=function(){return u.c.prototype.e.call(this,"div",{className:"vjs-text-track-display"})};
+u.X=u.L.extend({g:function(a,c){var d=this.ca=c.track;c.label=d.label();c.selected=d.ub();u.L.call(this,a,c);this.a.d(d.K()+"trackchange",u.bind(this,this.update))}});u.X.prototype.n=function(){u.L.prototype.n.call(this);V(this.a,this.ca.O,this.ca.K())};u.X.prototype.update=function(){this.selected(2==this.ca.mode())};u.cb=u.X.extend({g:function(a,c){c.track={K:function(){return c.kind},bd:a,label:function(){return c.kind+" off"},ub:r(l),mode:r(l)};u.X.call(this,a,c);this.selected(f)}});
+u.cb.prototype.n=function(){u.X.prototype.n.call(this);V(this.a,this.ca.O,this.ca.K())};u.cb.prototype.update=function(){for(var a=U(this.a),c=0,d=a.length,e,g=f;c<d;c++)e=a[c],e.K()==this.ca.K()&&2==e.mode()&&(g=l);this.selected(g)};u.W=u.ea.extend({g:function(a,c){u.ea.call(this,a,c);1>=this.J.length&&this.v()}});u.W.prototype.sb=function(){var a=[],c;a.push(new u.cb(this.a,{kind:this.A}));for(var d=0;d<U(this.a).length;d++)c=U(this.a)[d],c.K()===this.A&&a.push(new u.X(this.a,{track:c}));return a};
+u.Ca=u.W.extend({g:function(a,c,d){u.W.call(this,a,c,d);this.b.setAttribute("aria-label","Captions Menu")}});u.Ca.prototype.A="captions";u.Ca.prototype.oa="Captions";u.Ca.prototype.className="vjs-captions-button";u.Ea=u.W.extend({g:function(a,c,d){u.W.call(this,a,c,d);this.b.setAttribute("aria-label","Subtitles Menu")}});u.Ea.prototype.A="subtitles";u.Ea.prototype.oa="Subtitles";u.Ea.prototype.className="vjs-subtitles-button";
+u.Sb=u.W.extend({g:function(a,c,d){u.W.call(this,a,c,d);this.b.setAttribute("aria-label","Chapters Menu")}});t=u.Sb.prototype;t.A="chapters";t.oa="Chapters";t.className="vjs-chapters-button";t.sb=function(){for(var a=[],c,d=0;d<U(this.a).length;d++)c=U(this.a)[d],c.K()===this.A&&a.push(new u.X(this.a,{track:c}));return a};
+t.Ja=function(){for(var a=U(this.a),c=0,d=a.length,e,g,j=this.J=[];c<d;c++)if(e=a[c],e.K()==this.A&&e.ub()){if(2>e.readyState()){this.wd=e;e.d("loaded",u.bind(this,this.Ja));return}g=e;break}a=this.ua=new u.la(this.a);a.b.appendChild(u.e("li",{className:"vjs-menu-title",innerHTML:u.Z(this.A),md:-1}));if(g){e=g.ha;for(var k,c=0,d=e.length;c<d;c++)k=e[c],k=new u.Xa(this.a,{track:g,cue:k}),j.push(k),a.Y(k)}0<this.J.length&&this.show();return a};
+u.Xa=u.L.extend({g:function(a,c){var d=this.ca=c.track,e=this.cue=c.cue,g=a.currentTime();c.label=e.text;c.selected=e.startTime<=g&&g<e.sa;u.L.call(this,a,c);d.d("cuechange",u.bind(this,this.update))}});u.Xa.prototype.n=function(){u.L.prototype.n.call(this);this.a.currentTime(this.cue.startTime);this.update(this.cue.startTime)};u.Xa.prototype.update=function(){var a=this.cue,c=this.a.currentTime();this.selected(a.startTime<=c&&c<a.sa)};
+u.i.B(u.da.prototype.f.children,{subtitlesButton:{},captionsButton:{},chaptersButton:{}});
+if("undefined"!==typeof window.JSON&&"function"===window.JSON.parse)u.JSON=window.JSON;else{u.JSON={};var Y=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;u.JSON.parse=function(a,c){function d(a,e){var k,q,n=a[e];if(n&&"object"===typeof n)for(k in n)Object.prototype.hasOwnProperty.call(n,k)&&(q=d(n,k),q!==b?n[k]=q:delete n[k]);return c.call(a,e,n)}var e;a=String(a);Y.lastIndex=0;Y.test(a)&&(a=a.replace(Y,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));
+if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return e=eval("("+a+")"),"function"===typeof c?d({"":e},""):e;throw new SyntaxError("JSON.parse(): invalid or malformed JSON data");}}
+u.dc=function(){var a,c,d=document.getElementsByTagName("video");if(d&&0<d.length)for(var e=0,g=d.length;e<g;e++)if((c=d[e])&&c.getAttribute)c.player===b&&(a=c.getAttribute("data-setup"),a!==h&&(a=u.JSON.parse(a||"{}"),v(c,a)));else{u.lb();break}else u.rd||u.lb()};u.lb=function(){setTimeout(u.dc,1)};u.R(window,"load",function(){u.rd=f});u.lb();u.cd=function(a,c){u.C.prototype[a]=c};var Z=this;Z.sd=f;function $(a,c){var d=a.split("."),e=Z;!(d[0]in e)&&e.execScript&&e.execScript("var "+d[0]);for(var g;d.length&&(g=d.shift());)!d.length&&c!==b?e[g]=c:e=e[g]?e[g]:e[g]={}};$("videojs",u);$("_V_",u);$("videojs.options",u.options);$("videojs.players",u.va);$("videojs.cache",u.pa);$("videojs.Component",u.c);u.c.prototype.dispose=u.c.prototype.D;u.c.prototype.createEl=u.c.prototype.e;u.c.prototype.el=u.c.prototype.r;u.c.prototype.addChild=u.c.prototype.Y;u.c.prototype.children=u.c.prototype.children;u.c.prototype.on=u.c.prototype.d;u.c.prototype.off=u.c.prototype.t;u.c.prototype.one=u.c.prototype.R;u.c.prototype.trigger=u.c.prototype.k;u.c.prototype.triggerReady=u.c.prototype.Ta;
+u.c.prototype.show=u.c.prototype.show;u.c.prototype.hide=u.c.prototype.v;u.c.prototype.width=u.c.prototype.width;u.c.prototype.height=u.c.prototype.height;u.c.prototype.dimensions=u.c.prototype.Mc;u.c.prototype.ready=u.c.prototype.P;u.c.prototype.fadeIn=u.c.prototype.$;u.c.prototype.fadeOut=u.c.prototype.ta;$("videojs.Player",u.C);u.C.prototype.dispose=u.C.prototype.D;u.C.prototype.requestFullScreen=u.C.prototype.wa;u.C.prototype.cancelFullScreen=u.C.prototype.pb;u.C.prototype.bufferedPercent=u.C.prototype.Ha;
+$("videojs.MediaLoader",u.Fc);$("videojs.TextTrackDisplay",u.$b);$("videojs.ControlBar",u.da);$("videojs.Button",u.o);$("videojs.PlayToggle",u.Xb);$("videojs.FullscreenToggle",u.Da);$("videojs.BigPlayButton",u.Wa);$("videojs.LoadingSpinner",u.Vb);$("videojs.CurrentTimeDisplay",u.Ya);$("videojs.DurationDisplay",u.Za);$("videojs.TimeDivider",u.ac);$("videojs.RemainingTimeDisplay",u.gb);$("videojs.Slider",u.M);$("videojs.ProgressControl",u.fb);$("videojs.SeekBar",u.Yb);$("videojs.LoadProgressBar",u.bb);
+$("videojs.PlayProgressBar",u.Wb);$("videojs.SeekHandle",u.hb);$("videojs.VolumeControl",u.jb);$("videojs.VolumeBar",u.ib);$("videojs.VolumeLevel",u.bc);$("videojs.VolumeHandle",u.kb);$("videojs.MuteToggle",u.fa);$("videojs.PosterImage",u.eb);$("videojs.Menu",u.la);$("videojs.MenuItem",u.L);$("videojs.SubtitlesButton",u.Ea);$("videojs.CaptionsButton",u.Ca);$("videojs.ChaptersButton",u.Sb);$("videojs.MediaTechController",u.q);u.q.prototype.features=u.q.prototype.j;u.q.prototype.j.volumeControl=u.q.prototype.j.U;
+u.q.prototype.j.fullscreenResize=u.q.prototype.j.jc;u.q.prototype.j.progressEvents=u.q.prototype.j.Mb;u.q.prototype.j.timeupdateEvents=u.q.prototype.j.Pb;$("videojs.Html5",u.m);u.m.Events=u.m.$a;u.m.isSupported=u.m.isSupported;u.m.canPlaySource=u.m.nb;u.m.prototype.setCurrentTime=u.m.prototype.fd;u.m.prototype.setVolume=u.m.prototype.ld;u.m.prototype.setMuted=u.m.prototype.jd;u.m.prototype.setPreload=u.m.prototype.kd;u.m.prototype.setAutoplay=u.m.prototype.ed;u.m.prototype.setLoop=u.m.prototype.hd;
+$("videojs.Flash",u.l);u.l.isSupported=u.l.isSupported;u.l.canPlaySource=u.l.nb;u.l.onReady=u.l.onReady;$("videojs.TextTrack",u.V);u.V.prototype.label=u.V.prototype.label;$("videojs.CaptionsTrack",u.Rb);$("videojs.SubtitlesTrack",u.Zb);$("videojs.ChaptersTrack",u.Tb);$("videojs.autoSetup",u.dc);$("videojs.plugin",u.cd);$("videojs.createTimeRange",u.tb);})();//@ sourceMappingURL=video.js.map
